本文整理汇总了C++中KApplication::applicationFilePath方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::applicationFilePath方法的具体用法?C++ KApplication::applicationFilePath怎么用?C++ KApplication::applicationFilePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KApplication
的用法示例。
在下文中一共展示了KApplication::applicationFilePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char** argv )
{
QString version = CalligraVersionWrapper::versionString(true);
K4AboutData aboutData("calligragemini",
"calligrawords",
ki18n("Calligra Gemini"),
version.toLatin1(),
ki18n("Calligra Gemini: Writing and Presenting at Home and on the Go"),
K4AboutData::License_GPL,
ki18n("(c) 1999-%1 The Calligra team and KO GmbH.\n").subs(CalligraVersionWrapper::versionYear()),
KLocalizedString(),
"http://www.calligra.org",
"[email protected]");
KCmdLineArgs::init (argc, argv, &aboutData);
KCmdLineOptions options;
options.add( "+[files]", ki18n( "Document to open" ) );
options.add( "vkb", ki18n( "Use the virtual keyboard" ) );
KCmdLineArgs::addCmdLineOptions( options );
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
QStringList fileNames;
if (args->count() > 0) {
for (int i = 0; i < args->count(); ++i) {
QString fileName = args->arg(i);
if (QFile::exists(fileName)) {
fileNames << fileName;
}
}
}
KApplication app;
app.setApplicationName("calligragemini");
KIconLoader::global()->addAppDir("calligrawords");
KIconLoader::global()->addAppDir("words");
KIconLoader::global()->addAppDir("calligrastage");
KIconLoader::global()->addAppDir("stage");
#ifdef Q_OS_WIN
QDir appdir(app.applicationDirPath());
appdir.cdUp();
QString envStringSet;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
if (!env.contains("KDESYCOCA")) {
_putenv_s("KDESYCOCA", QString(appdir.absolutePath() + "/sycoca").toLocal8Bit());
envStringSet.append("KDESYCOCA ");
}
if (!env.contains("XDG_DATA_DIRS")) {
_putenv_s("XDG_DATA_DIRS", QString(appdir.absolutePath() + "/share").toLocal8Bit());
envStringSet.append("XDG_DATA_DIRS ");
}
_putenv_s("PATH", QString(appdir.absolutePath() + "/bin" + ";"
+ appdir.absolutePath() + "/lib" + ";"
+ appdir.absolutePath() + "/lib" + "/kde4" + ";"
+ appdir.absolutePath()).toLocal8Bit());
if(envStringSet.length() > 0) {
qDebug() << envStringSet << "were set from main, restarting application in new environment!";
// Pass all the arguments along, but don't include the application name...
QProcess::startDetached(app.applicationFilePath(), KCmdLineArgs::allArguments().mid(1));
exit(0);
}
app.addLibraryPath(appdir.absolutePath());
app.addLibraryPath(appdir.absolutePath() + "/bin");
app.addLibraryPath(appdir.absolutePath() + "/lib");
app.addLibraryPath(appdir.absolutePath() + "/lib/kde4");
QStringList iconThemePaths;
iconThemePaths << appdir.absolutePath() + "/share/icons";
QIcon::setThemeSearchPaths(iconThemePaths);
QIcon::setThemeName("oxygen");
#endif
if (qgetenv("KDE_FULL_SESSION").isEmpty()) {
// There are two themes that work for Krita, oxygen and plastique. Try to set plastique first, then oxygen
qobject_cast<QApplication*>(QApplication::instance())->setStyle("Plastique");
qobject_cast<QApplication*>(QApplication::instance())->setStyle("Oxygen");
}
// then create the pixmap from an xpm: we cannot get the
// location of our datadir before we've started our components,
// so use an xpm.
// QPixmap pm(splash_screen_xpm);
// QSplashScreen splash(pm);
// splash.show();
// splash.showMessage(".");
app.processEvents();
#if defined HAVE_X11
QApplication::setAttribute(Qt::AA_X11InitThreads);
#endif
MainWindow window(fileNames);
if (args->isSet("vkb")) {
// app.setInputContext(new SketchInputContext(&app));
//.........这里部分代码省略.........