Commit 910d2c0d authored by Dimitri van Heesch's avatar Dimitri van Heesch
Browse files

Merge pull request #125 from albert-github/feature/doxygwizard_args

Showing error message on windows in case of an error on startup
parents e6d504fa 0e12f6bf
Loading
Loading
Loading
Loading
+22 −8
Original line number Diff line number Diff line
@@ -624,20 +624,34 @@ bool MainWindow::discardUnsavedChanges(bool saveOption)
}

//-----------------------------------------------------------------------

int main(int argc,char **argv)
{
  QApplication a(argc,argv);
  MainWindow &main = MainWindow::instance();
  if (argc==2 && argv[1][0]!='-') // name of config file as an argument
  if (argc == 2)
  {
    main.loadConfigFromFile(QString::fromLocal8Bit(argv[1]));
    if (!qstrcmp(argv[1],"--help"))
    {
      QMessageBox msgBox;
      msgBox.setText(QString().sprintf("Usage: %s [config file]",argv[0]));
      msgBox.exec();
      exit(0);
    }
  }
  else if (argc>1)
  if (argc > 2)
  {
    printf("Usage: %s [config file]\n",argv[0]);
    QMessageBox msgBox;
    msgBox.setText(QString().sprintf("Too many arguments specified\n\nUsage: %s [config file]",argv[0]));
    msgBox.exec();
    exit(1);
  }
  else
  {
    MainWindow &main = MainWindow::instance();
    if (argc==2 && argv[1][0]!='-') // name of config file as an argument
    {
      main.loadConfigFromFile(QString::fromLocal8Bit(argv[1]));
    }
    main.show();
    return a.exec();
  }
}