mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Implemented MainWindow singleton pattern.
This commit is contained in:
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
|
||||
I::sleep(1);
|
||||
|
||||
// Create window.
|
||||
MainWindow win;
|
||||
MainWindow* win = MainWindow::instance();
|
||||
|
||||
QFontDatabase db;
|
||||
Q_ASSERT( QFontDatabase::addApplicationFont(":/base-font") != -1);
|
||||
@@ -130,34 +130,37 @@ int main(int argc, char *argv[])
|
||||
QString projectFileValue = parser.value("file");
|
||||
if (projectFileValue != "")
|
||||
{
|
||||
win.loadFile(projectFileValue);
|
||||
win->loadFile(projectFileValue);
|
||||
}
|
||||
|
||||
QString oscPortNumberValue = parser.value("osc-port");
|
||||
if (oscPortNumberValue != "")
|
||||
{
|
||||
win.setOscPort(oscPortNumberValue);
|
||||
win->setOscPort(oscPortNumberValue);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Terminate splash.
|
||||
splash.showMessage(" " + QObject::tr("Done."),
|
||||
Qt::AlignLeft | Qt::AlignTop, MM::WHITE);
|
||||
splash.finish(&win);
|
||||
splash.finish(win);
|
||||
splash.raise();
|
||||
|
||||
// Launch program.
|
||||
win.show();
|
||||
win->show();
|
||||
|
||||
#if USING_QT_5
|
||||
if (parser.isSet(fullscreenOption))
|
||||
{
|
||||
qDebug() << "TODO: Running in fullscreen mode";
|
||||
win.startFullScreen();
|
||||
win->startFullScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Start app.
|
||||
return app.exec();
|
||||
int result = app.exec();
|
||||
|
||||
delete win;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user