Changeset View
Changeset View
Standalone View
Standalone View
plasmoidviewer/main.cpp
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 75 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("size"), | |||
---|---|---|---|---|---|
77 | QStringLiteral("widthXheight"))); | 77 | QStringLiteral("widthXheight"))); | ||
78 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("p") << QStringLiteral("pixmapcache"), | 78 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("p") << QStringLiteral("pixmapcache"), | ||
79 | i18n("The size in kB to set the pixmap cache to"), | 79 | i18n("The size in kB to set the pixmap cache to"), | ||
80 | QStringLiteral("size"))); | 80 | QStringLiteral("size"))); | ||
81 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("t") << QStringLiteral("theme"), | 81 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("t") << QStringLiteral("theme"), | ||
82 | i18n("The name of the theme which the shell will use"), | 82 | i18n("The name of the theme which the shell will use"), | ||
83 | QStringLiteral("themeName"))); | 83 | QStringLiteral("themeName"))); | ||
84 | 84 | | |||
85 | parser.addPositionalArgument(QStringLiteral("externalData"), i18n("Data that should be passed to the applet as 'externalData' event")); | ||||
85 | 86 | | |||
86 | parser.addHelpOption(); | 87 | parser.addHelpOption(); | ||
87 | parser.addVersionOption(); | 88 | parser.addVersionOption(); | ||
88 | parser.process(app); | 89 | parser.process(app); | ||
89 | 90 | | |||
90 | const QString applet = parser.value("applet"); | 91 | const QString applet = parser.value("applet"); | ||
91 | if (applet.isEmpty()) { | 92 | if (applet.isEmpty()) { | ||
92 | qWarning() << "An applet name must be specified"; | 93 | qWarning() << "An applet name must be specified"; | ||
Show All 37 Lines | |||||
130 | if (parser.isSet("yPosition")) { | 131 | if (parser.isSet("yPosition")) { | ||
131 | v->setY(parser.value("yPosition").toInt()); | 132 | v->setY(parser.value("yPosition").toInt()); | ||
132 | } | 133 | } | ||
133 | 134 | | |||
134 | if (parser.isSet("pixmapcache")) { | 135 | if (parser.isSet("pixmapcache")) { | ||
135 | QPixmapCache::setCacheLimit(parser.value("pixmapcache").toInt()); | 136 | QPixmapCache::setCacheLimit(parser.value("pixmapcache").toInt()); | ||
136 | } | 137 | } | ||
137 | 138 | | |||
139 | // emit externalData event so we you can launch e.g. an icon applet already with a proper URL | ||||
140 | if (parser.positionalArguments().count() == 1) { | ||||
141 | v->emitExternalData(parser.positionalArguments().constFirst()); | ||||
142 | } | ||||
143 | | ||||
138 | v->show(); | 144 | v->show(); | ||
139 | 145 | | |||
140 | return app.exec(); | 146 | return app.exec(); | ||
141 | } | 147 | } | ||
142 | 148 | |