Skip to content

Commit 78896fb

Browse files
author
Alf Birger Rustad
committed
Enable command line parsing of xml file, issue #60
1 parent a257ab9 commit 78896fb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Main.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ using namespace std;
3030
*/
3131
int main(int argc, char *argv[])
3232
{
33-
QApplication app(argc, argv);//starts the application
34-
//there should probably be some code that calls Main_crava(0,true,fileName) if a an argument is an exisiting xml file.
35-
QPointer<Main_crava> crava=new Main_crava;//creates the application main window
33+
QApplication app(argc, argv);//starts the application, argc is QString, argv is QList
34+
QPointer<Main_crava> crava;//declare pointer to the main window
35+
if(argc==2){//har filename been provided on command line?
36+
crava=new Main_crava(0,true,argv[1]);//creates the application main window with file from commandline
37+
}
38+
else{
39+
crava=new Main_crava;//creates application window with no command line parameters
40+
}
3641
crava->show();//shows it.
3742
return app.exec();//pass control
3843
}

0 commit comments

Comments
 (0)