[Kst] branches/work/kst/portto4/kst/src/libkstapp
Adam Treat
treat at kde.org
Wed Jul 18 03:17:53 CEST 2007
SVN commit 689265 by treat:
* A cheap and simple getopt for now.
M +10 -4 kstapplication.cpp
M +4 -2 libkstapp.pro
A qgetoptions.cpp [License: GPL (v2+)]
A qgetoptions.h [License: GPL (v2+)]
--- branches/work/kst/portto4/kst/src/libkstapp/kstapplication.cpp #689264:689265
@@ -10,6 +10,7 @@
***************************************************************************/
#include "kstapplication.h"
+#include "qgetoptions.h"
KstApplication::KstApplication(int &argc, char **argv)
: QApplication(argc, argv) {
@@ -19,11 +20,16 @@
_mainWindow = new Kst::MainWindow;
connect(this, SIGNAL(aboutToQuit()), _mainWindow, SLOT(aboutToQuit()));
- //FIXME need a real getopt here...
- QStringList args = QCoreApplication::arguments();
- if (!args.at(1).isEmpty())
- _mainWindow->openFile(args.at(1));
+ QGetOptions options;
+ QVariant file;
+ options.addOption("file", QOption::Argument, &file);
+
+ options.getValues();
+
+ if (!file.toString().isEmpty())
+ _mainWindow->openFile(file.toString());
+
_mainWindow->show();
}
--- branches/work/kst/portto4/kst/src/libkstapp/libkstapp.pro #689264:689265
@@ -50,7 +50,8 @@
viewitemdialog.cpp \
axis.cpp \
plotrenderer2d.cpp \
- render2dcartesian.cpp
+ render2dcartesian.cpp \
+ qgetoptions.cpp
HEADERS += \
applicationsettings.h \
@@ -85,7 +86,8 @@
viewcommand.h \
view.h \
viewitemdialog.h \
- viewitem.h
+ viewitem.h \
+ qgetoptions.h
FORMS += \
datamanager.ui \
More information about the Kst
mailing list