shadowm

Untitled

Sep 1st, 2018
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. int main(int argc, char *argv[])
  2. {
  3.     QApplication a(argc, argv);
  4.     QString initial_file = "";
  5.     QStringList argvq = a.arguments();
  6.  
  7.     if(argvq.count() > 1)
  8.         initial_file = argvq.last();
  9.  
  10.     QCoreApplication::setApplicationName("Morning Star");
  11.     QCoreApplication::setOrganizationName("Wesnoth");
  12.     QCoreApplication::setOrganizationDomain("wesnoth.org");
  13.     QCoreApplication::setApplicationVersion(mos_version);
  14.  
  15.     a.setWindowIcon(QIcon(":/wesnoth-rcx-icon-64.png"));
  16.  
  17.     a.setQuitOnLastWindowClosed(true);
  18.  
  19.     MainWindow w;
  20.     if(w.initial_open(initial_file)) {
  21.  
  22.         QObject::connect(&a, &QApplication::lastWindowClosed, []{
  23.             qDebug() << "Last window closed!";
  24.         });
  25.  
  26.  
  27.         w.show();
  28.         return a.exec();
  29.     }
  30.  
  31.     return 1;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment