[Kst] branches/work/kst/portto4/kst/src/libkstapp
Peter Kümmel
syntheticpp at gmx.net
Thu Mar 3 22:23:35 CET 2011
SVN commit 1223587 by kuemmel:
prepare for --version
M +15 -16 commandlineparser.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/commandlineparser.cpp #1223586:1223587
@@ -111,30 +111,26 @@
"Plot column 2 and column 3 in plot P1 and column 4 in plot P2\n"
" kst data.dat -P P1 -y 2 -y 3 -P P2 -y 4\n";
+static void printText(const QString& text, const QString& detailText, const QString& t = QString())
+{
#ifdef Q_OS_WIN
-static void printUsage(QString t) { // No console on Windows.
- QString displayText(usageMessage);
- if (!t.isEmpty()) {
- displayText += '\n';
- displayText += t;
- }
- QMessageBox box(QMessageBox::Information, "Kst", displayText);
- QString detailText(usageDetailsMessage);
+ // No console on Windows.
+ QMessageBox box(QMessageBox::Information, "Kst", text + t);
box.setDetailedText(detailText);
box.exec();
-}
#else
-static void printUsage(const QString &t) {
- QString displayText = QString(usageMessage) + QString(usageDetailsMessage);
- if (!t.isEmpty()) {
- displayText += "\n\n";
- displayText += t;
- }
+ QString displayText = QString(text) + QString(detailText) + t;
qWarning("%s", qPrintable(displayText));
-}
#endif
+}
+static void printUsage(const QString &t)
+{
+ printText(QString(usageMessage), QString(usageDetailsMessage), "\n" + t);
+}
+
+
CommandLineParser::CommandLineParser(Document *doc):
_doAve(false), _doSkip(false), _doConsecutivePlots(true), _useBargraph(false),
_useLines(true), _usePoints(false), _overrideStyle(false), _sampleRate(1.0),
@@ -367,6 +363,9 @@
if ((arg == "--help")||(arg == "-help")) {
printUsage(QString());
*ok = false;
+ } else if (arg == "--version" || arg == "-version") {
+ printUsage(QString());
+ *ok = false;
} else if (arg == "-f") {
*ok = _setIntArg(&_startFrame, i18n("Usage: -f <startframe>\n"), true);
_document->objectStore()->override.f0 = _startFrame;
More information about the Kst
mailing list