summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahul Chowdhury <rahulc93@gmail.com>2015-09-12 09:46:11 (GMT)
committerRahul Chowdhury <rahulc93@gmail.com>2015-09-12 13:41:43 (GMT)
commita8f7980bec385bd7f31ea9e43a2f59fefb56248d (patch)
tree4b909a360580a2783deb447ef896bc054f81d09d
parentf7e144b101d58eb6e04ce03d0f66bef68ac0bc68 (diff)
Port K4AboutData -> KAboutData
Port KCmdLineArgs -> QCommandLineParser REVIEW: 125188
-rw-r--r--compoundviewer/kalziumglpart.cpp2
-rw-r--r--src/main.cpp157
2 files changed, 116 insertions, 43 deletions
diff --git a/compoundviewer/kalziumglpart.cpp b/compoundviewer/kalziumglpart.cpp
index 825077d..e664fef 100644
--- a/compoundviewer/kalziumglpart.cpp
+++ b/compoundviewer/kalziumglpart.cpp
@@ -23,7 +23,7 @@ KAboutData kalziumGLPartAboutData()
KAboutData aboutData(
"kalzium", QByteArray(), ki18n("Kalzium OpenGL Part"), "1.1.1",
ki18n("A cool thing"),
- KAboutData::License_GPL, ki18n("(c) 2006, Carsten Niehaus"),
+ KAboutLicense::GPL, ki18n("(c) 2006, Carsten Niehaus"),
KLocalizedString(),
"http://edu.kde.org/kalzium/index.php"
);
diff --git a/src/main.cpp b/src/main.cpp
index 48d40ca..729bac8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,16 +17,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <kaboutdata.h>
-#include <KCmdLineArgs>
+#include <KAboutData>
+
#include <KLocale>
-#include <k4aboutdata.h>
-#include <kapplication.h>
+#include <KLocalizedString>
+
#include "kalzium.h"
#include <config-kalzium.h>
+#include <QApplication>
+#include <QCommandLineParser>
+#include <QCommandLineOption>
#define APP_VERSION "2.4.03"
@@ -46,41 +49,113 @@ int main(int argc, char **argv)
caml_startup(argv);
#endif
- K4AboutData about("kalzium", 0, ki18n("Kalzium"), version, ki18n(description),
- K4AboutData::License_GPL, ki18n("(C) 2002-2014 Carsten Niehaus"), KLocalizedString(), "http://edu.kde.org/kalzium");
- about.addAuthor(ki18n("Carsten Niehaus"), KLocalizedString(), "cniehaus@kde.org");
- about.addCredit(ki18n("Pino Toscano"), ki18n("Large code contributions; resident guru helping the other developers"));
- about.addCredit(ki18n("Benoit Jacob"), ki18n("Base work on the molecular viewer, mentored Marcus during his SoC"));
- about.addCredit(ki18n("Marcus Hanwell"), ki18n("SoC on the molecular viewer and libavogadro porting/integration"));
- about.addCredit(ki18n("Kashyap R Puranik"), ki18n("SoC on the calculator widget and a few smaller improvements"));
- about.addCredit(ki18n("Thomas Nagy"), ki18n("EqChem, the equation solver"));
- about.addCredit(ki18n("Inge Wallin"), ki18n("Code cleaning, parser for the molecule weight calculator, and a lot of smaller improvements"));
- about.addCredit(ki18n("Anne-Marie Mahfouf"), ki18n("A lot of small things and the documentation"));
- about.addCredit(ki18n("Johannes Simon"), ki18n("Code and documentation contributions to the equation solver and molecular viewer"));
- about.addCredit(ki18n("Jarle Akselsen"), ki18n("Many beautiful element icons"));
- about.addCredit(ki18n("Noémie Scherer"), ki18n("Many beautiful element icons, too!"));
- about.addCredit(ki18n("Danny Allen"), ki18n("Several icons"));
- about.addCredit(ki18n("Lee Olson"), ki18n("Several icons in the information dialog"));
-
- about.addCredit(ki18n("Jörg Buchwald"), ki18n("Contributed most isotope information"));
- about.addCredit(ki18n("Marco Martin"), ki18n("Some icons and inspiration for others"));
- about.addCredit(ki18n("Daniel Haas"), ki18n("The design of the information dialog"));
- about.addCredit(ki18n("Brian Beck"), ki18n("The orbits icon"));
-
- about.addCredit(ki18n("Paulo Cattai"),ki18n("New interface design and usability improvements"));
- about.addCredit(ki18n("Danilo Balzaque"),ki18n("New interface design and usability improvements"));
- about.addCredit(ki18n("Roberto Cunha"),ki18n("New interface design and usability improvements"));
- about.addCredit(ki18n("Tadeu Araujo"),ki18n("New interface design and usability improvements"));
- about.addCredit(ki18n("Tiago Porangaba"),ki18n("New interface design and usability improvements"));
- about.addCredit(ki18n("Etienne Rebetez"),ki18n("Adding new sizable Periodic System"));
-
- KCmdLineArgs::init(argc, argv, &about);
- KCmdLineOptions options;
-#if defined(HAVE_OPENBABEL2) && defined(HAVE_EIGEN) && defined(HAVE_AVOGADRO)
- options.add("molecule <file>", ki18n("Open the given molecule file"));
-#endif
- KCmdLineArgs::addCmdLineOptions(options);
- KApplication app;
+ KLocalizedString::setApplicationDomain("kalzium");
+
+ KAboutData about("kalzium",
+ ki18n("Kalzium").toString(),
+ version,
+ ki18n(description).toString(),
+ KAboutLicense::GPL,
+ ki18n("(C) 2002-2014 Carsten Niehaus").toString(),
+ QString(),
+ "http://edu.kde.org/kalzium");
+
+ about.addAuthor(ki18n("Carsten Niehaus").toString(),
+ QString(),
+ "cniehaus@kde.org");
+
+
+ about.addCredit(ki18n("Pino Toscano").toString(),
+ ki18n("Large code contributions; resident guru helping the other developers").toString());
+
+ about.addCredit(ki18n("Benoit Jacob").toString(),
+ ki18n("Base work on the molecular viewer, mentored Marcus during his SoC").toString());
+
+ about.addCredit(ki18n("Marcus Hanwell").toString(),
+ ki18n("SoC on the molecular viewer and libavogadro porting/integration").toString());
+
+ about.addCredit(ki18n("Kashyap R Puranik").toString(),
+ ki18n("SoC on the calculator widget and a few smaller improvements").toString());
+
+ about.addCredit(ki18n("Thomas Nagy").toString(),
+ ki18n("EqChem, the equation solver").toString());
+
+ about.addCredit(ki18n("Inge Wallin").toString(),
+ ki18n("Code cleaning, parser for the molecule weight calculator, and a lot of smaller improvements").toString());
+
+ about.addCredit(ki18n("Anne-Marie Mahfouf").toString(),
+ ki18n("A lot of small things and the documentation").toString());
+
+ about.addCredit(ki18n("Johannes Simon").toString(),
+ ki18n("Code and documentation contributions to the equation solver and molecular viewer").toString());
+
+ about.addCredit(ki18n("Jarle Akselsen").toString(),
+ ki18n("Many beautiful element icons").toString());
+
+ about.addCredit(ki18n("Noémie Scherer").toString(),
+ ki18n("Many beautiful element icons, too!").toString());
+
+ about.addCredit(ki18n("Danny Allen").toString(),
+ ki18n("Several icons").toString());
+
+ about.addCredit(ki18n("Lee Olson").toString(),
+ ki18n("Several icons in the information dialog").toString());
+
+ about.addCredit(ki18n("Jörg Buchwald").toString(),
+ ki18n("Contributed most isotope information").toString());
+
+ about.addCredit(ki18n("Marco Martin").toString(),
+ ki18n("Some icons and inspiration for others").toString());
+
+ about.addCredit(ki18n("Daniel Haas").toString(),
+ ki18n("The design of the information dialog").toString());
+
+ about.addCredit(ki18n("Brian Beck").toString(),
+ ki18n("The orbits icon").toString());
+
+ about.addCredit(ki18n("Paulo Cattai").toString(),
+ ki18n("New interface design and usability improvements").toString());
+
+ about.addCredit(ki18n("Danilo Balzaque").toString(),
+ ki18n("New interface design and usability improvements").toString());
+
+ about.addCredit(ki18n("Roberto Cunha").toString(),
+ ki18n("New interface design and usability improvements").toString());
+
+ about.addCredit(ki18n("Tadeu Araujo").toString(),
+ ki18n("New interface design and usability improvements").toString());
+
+ about.addCredit(ki18n("Tiago Porangaba").toString(),
+ ki18n("New interface design and usability improvements").toString());
+
+ about.addCredit(ki18n("Etienne Rebetez").toString(),
+ ki18n("Adding new sizable Periodic System").toString());
+
+
+ KAboutData::setApplicationData(about);
+
+ QApplication::setApplicationName("kalzium");
+ QApplication::setApplicationVersion(version);
+ QApplication::setOrganizationDomain("kde.org");
+ QApplication::setApplicationDisplayName(i18n("kalzium"));
+ QApplication app(argc, argv);
+
+ QCommandLineParser parser;
+ parser.addVersionOption();
+ parser.addHelpOption();
+
+ parser.addPositionalArgument(ki18n("[molecule]").toString(), ki18n("Open the given molecule file").toString());
+
+ QCommandLineOption moleculeOption(ki18n("molecule").toString(), ki18n("Open the given molecule file").toString());
+ parser.addOption(moleculeOption);
+
+ about.setupCommandLine(&parser);
+ parser.process(app);
+ about.processCommandLine(&parser);
+
+ #if defined(HAVE_OPENBABEL2) && defined(HAVE_EIGEN) && defined(HAVE_AVOGADRO)
+ parser.addOption(QCommandLineOption(QStringList() << QLatin1String("m") << QLatin1String("molecule"), i18n("Open the given molecule file"), QLatin1String("file")));
+ #endif
Kalzium *mainWin = 0;
@@ -88,14 +163,13 @@ int main(int argc, char **argv)
RESTORE(Kalzium);
} else {
// no session.. just start up normally
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
/// @todo do something with the command line args here
mainWin = new Kalzium();
mainWin->show();
- const QStringList molecules = args->getOptionList("molecule");
+ const QStringList molecules = parser.values("molecule");
if (molecules.count() == 1) {
mainWin->loadMolecule(molecules[0]);
} else if (molecules.count() > 1) {
@@ -103,7 +177,6 @@ int main(int argc, char **argv)
ts << i18n("Can't open more than one molecule at a time");
}
- args->clear();
}
// mainWin has WDestructiveClose flag by default, so it will delete itself.