Changeset View
Changeset View
Standalone View
Standalone View
src/app/main.cpp
Show All 17 Lines | |||||
18 | *********************************************************************************/ | 18 | *********************************************************************************/ | ||
19 | 19 | | |||
20 | #include "kcoloredit.h" | 20 | #include "kcoloredit.h" | ||
21 | 21 | | |||
22 | #include <KUrl> | 22 | #include <KUrl> | ||
23 | #include <KApplication> | 23 | #include <KApplication> | ||
24 | #include <KCmdLineArgs> | 24 | #include <KCmdLineArgs> | ||
25 | #include <KAboutData> | 25 | #include <KAboutData> | ||
26 | #include <KIcon> | 26 | #include <QCommandLineParser> | ||
27 | 27 | | |||
28 | int main(int argc, char * argv[]) | 28 | int main(int argc, char * argv[]) | ||
29 | { | 29 | { | ||
30 | KAboutData about("kcoloredit", 0, ki18n(I18N_NOOP("KColorEdit")), "2.09.99 (KColorEdit 2.1 RC 2)", | 30 | QApplication app(argc, argv); | ||
31 | ki18n(I18N_NOOP("KColorEdit, a tool for editing color palettes.")), | | |||
32 | KAboutData::License_GPL, ki18n("(C) 2009, Percy Camilo Triveño Aucahuasi\n" "(C) 2000, Artur Rataj")); | | |||
33 | about.addAuthor(ki18n("Percy Camilo Triveño Aucahuasi"), ki18n("Current maintainer - Upgraded and developed the new version."), "percy.camilo.ta@gmail.com"); | | |||
34 | about.addAuthor(ki18n("Artur Rataj"), ki18n("Former maintainer - Created KColorEdit"), "art@zeus.polsl.gliwice.pl"); | | |||
35 | | ||||
36 | KCmdLineArgs::init(argc, argv, &about); | | |||
37 | | ||||
38 | KCmdLineOptions options; | | |||
39 | options.add("+[URL]", ki18n("File to open (Text file with colors and comments items)")); | | |||
40 | KCmdLineArgs::addCmdLineOptions(options); | | |||
41 | 31 | | |||
42 | KApplication app; | 32 | KAboutData about(QLatin1Literal("kcoloredit"), | ||
43 | QApplication::setWindowIcon(KIcon("kcoloredit")); | 33 | i18n("KColorEdit"), | ||
34 | "2.09.99 (KColorEdit 2.1 RC 2)", | ||||
35 | i18n("KColorEdit, a tool for editing color palettes."), | ||||
36 | KAboutLicense::GPL_V2, | ||||
37 | i18n("(C) 2009, Percy Camilo Triveño Aucahuasi\n" "(C) 2000, Artur Rataj"), | ||||
38 | QLatin1String(""), | ||||
39 | QLatin1String("https://userbase.kde.org/KColorEdit") | ||||
40 | ); | ||||
44 | 41 | | |||
45 | KCmdLineArgs * args = KCmdLineArgs::parsedArgs(); | 42 | about.addAuthor(i18n("Percy Camilo Triveño Aucahuasi"), i18n("Current maintainer - Upgraded and developed the new version."), "percy.camilo.ta@gmail.com"); | ||
43 | about.addAuthor(i18n("Artur Rataj"), i18n("Former maintainer - Created KColorEdit"), "art@zeus.polsl.gliwice.pl"); | ||||
46 | 44 | | |||
47 | KColorEditMainWnd * kceMainWnd = new KColorEditMainWnd; | 45 | QCommandLineParser parser; | ||
46 | | ||||
47 | KAboutData::setApplicationData(about); | ||||
48 | about.setupCommandLine(&parser); | ||||
49 | | ||||
50 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[URL]"), i18n("File to open (Text file with colors and comments items)"))); | ||||
48 | 51 | | |||
49 | if (args->count()) | 52 | parser.process(app); | ||
50 | kceMainWnd->openFile(args->url(0)); | 53 | about.processCommandLine(&parser); | ||
54 | | ||||
55 | QApplication::setWindowIcon(QIcon::fromTheme("kcoloredit")); | ||||
56 | | ||||
57 | KColorEditMainWnd * kceMainWnd = new KColorEditMainWnd; | ||||
51 | 58 | | |||
52 | args->clear(); | 59 | const QStringList urls = parser.positionalArguments(); | ||
60 | if (urls.count()) | ||||
61 | kceMainWnd->openFile(QUrl::fromUserInput(urls.at(0))); | ||||
53 | 62 | | |||
54 | kceMainWnd->show(); | 63 | kceMainWnd->show(); | ||
55 | 64 | | |||
56 | return app.exec(); | 65 | return app.exec(); | ||
57 | } | 66 | } |