2010-02-02 21:16:22 -07:00
|
|
|
// cmoddview - An application for previewing cmod and other 3D file formats
|
|
|
|
// supported by Celestia.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2010, Chris Laurel <claurel@gmail.com>
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
|
2010-03-07 11:44:38 -07:00
|
|
|
#include "mainwindow.h"
|
2010-02-02 21:16:22 -07:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QGLFormat>
|
2022-02-17 13:51:37 -07:00
|
|
|
#include <celutil/logger.h>
|
2010-02-02 21:16:22 -07:00
|
|
|
|
2022-02-17 13:51:37 -07:00
|
|
|
using celestia::util::CreateLogger;
|
2010-02-02 21:16:22 -07:00
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication app(argc, argv);
|
|
|
|
|
|
|
|
QCoreApplication::setOrganizationName("Celestia");
|
|
|
|
QCoreApplication::setOrganizationDomain("shatters.net");
|
|
|
|
QCoreApplication::setApplicationName("cmodview");
|
|
|
|
|
|
|
|
// Enable multisample antialiasing
|
|
|
|
QGLFormat format;
|
|
|
|
format.setSampleBuffers(true);
|
|
|
|
format.setSamples(4);
|
|
|
|
QGLFormat::setDefaultFormat(format);
|
|
|
|
|
2010-02-03 21:58:21 -07:00
|
|
|
QStringList arguments = app.arguments();
|
|
|
|
QString fileName;
|
|
|
|
if (arguments.length() > 1)
|
|
|
|
{
|
|
|
|
fileName = arguments.at(1);
|
|
|
|
}
|
|
|
|
|
2010-02-02 21:16:22 -07:00
|
|
|
MainWindow window;
|
2010-02-18 17:15:44 -07:00
|
|
|
|
2010-02-02 21:16:22 -07:00
|
|
|
window.resize(QSize(800, 600));
|
2010-02-19 14:23:26 -07:00
|
|
|
window.readSettings();
|
2010-02-02 21:16:22 -07:00
|
|
|
window.show();
|
|
|
|
|
2010-02-03 21:58:21 -07:00
|
|
|
// If a file name was given on the command line, open it immediately.
|
|
|
|
if (!fileName.isEmpty())
|
|
|
|
{
|
|
|
|
window.openModel(fileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Install an event filter so that the main window can take care of file
|
|
|
|
// open events.
|
|
|
|
app.installEventFilter(&window);
|
|
|
|
|
2022-02-17 13:51:37 -07:00
|
|
|
CreateLogger();
|
|
|
|
|
2010-02-02 21:16:22 -07:00
|
|
|
return app.exec();
|
|
|
|
}
|