diff options
author | albert-github <albert.tests@gmail.com> | 2014-02-26 13:29:20 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2014-02-26 13:29:20 (GMT) |
commit | 6a0651d9328262271ade2b733c125aae4415e3c3 (patch) | |
tree | f6b085d6bc5a746241d15367eeb51996af09879a /addon | |
parent | c7e36ca9e3bfccea54c3d3e3d2f668b74ac1563c (diff) | |
download | Doxygen-6a0651d9328262271ade2b733c125aae4415e3c3.zip Doxygen-6a0651d9328262271ade2b733c125aae4415e3c3.tar.gz Doxygen-6a0651d9328262271ade2b733c125aae4415e3c3.tar.bz2 |
Showing error message on windows in case on error on startup
On case, on windows, more than 1 argument is given doxywizard stops without showing a message even though a printf is present.
In this patch the message is show (for all platforms) by means of a message box, furthermore in case the argument --help is given the usage message is given in a message box.
Diffstat (limited to 'addon')
-rw-r--r-- | addon/doxywizard/doxywizard.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp index ce764e0..1ef95cc 100644 --- a/addon/doxywizard/doxywizard.cpp +++ b/addon/doxywizard/doxywizard.cpp @@ -1,4 +1,5 @@ #include <QtGui> +#include <QImageReader> #include "doxywizard.h" #include "version.h" #include "expert.h" @@ -624,20 +625,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); } - main.show(); - return a.exec(); + 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(); + } } |