int main( int argc, char** argv ) { KAboutData aboutData("kritasketch", "krita", ki18n("Krita Sketch"), "0.1", ki18n("Krita Sketch: Painting on the Go for Artists"), KAboutData::License_GPL, ki18n("(c) 1999-2014 The Krita team and KO GmbH.\n"), KLocalizedString(), "http://www.krita.org", "*****@*****.**"); KCmdLineArgs::init (argc, argv, &aboutData); KCmdLineOptions options; options.add( "+[files]", ki18n( "Images to open" ) ); options.add( "vkb", ki18n( "Use the virtual keyboard" ) ); options.add( "windowed", ki18n( "Open sketch in a window, otherwise defaults to full-screen" ) ); 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("kritasketch"); KIconLoader::global()->addAppDir("krita"); QDir appdir(app.applicationDirPath()); appdir.cdUp(); #ifdef Q_OS_WIN QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); // If there's no kdehome, set it and restart the process. //QMessageBox::information(0, "krita sketch", "KDEHOME: " + env.value("KDEHOME")); if (!env.contains("KDEHOME") ) { _putenv_s("KDEHOME", QDesktopServices::storageLocation(QDesktopServices::DataLocation).toLocal8Bit()); } if (!env.contains("KDESYCOCA")) { _putenv_s("KDESYCOCA", QString(appdir.absolutePath() + "/sycoca").toLocal8Bit()); } if (!env.contains("XDG_DATA_DIRS")) { _putenv_s("XDG_DATA_DIRS", QString(appdir.absolutePath() + "/share").toLocal8Bit()); } if (!env.contains("KDEDIR")) { _putenv_s("KDEDIR", appdir.absolutePath().toLocal8Bit()); } if (!env.contains("KDEDIRS")) { _putenv_s("KDEDIRS", appdir.absolutePath().toLocal8Bit()); } _putenv_s("PATH", QString(appdir.absolutePath() + "/bin" + ";" + appdir.absolutePath() + "/lib" + ";" + appdir.absolutePath() + "/lib" + "/kde4" + ";" + appdir.absolutePath()).toLocal8Bit()); app.addLibraryPath(appdir.absolutePath()); app.addLibraryPath(appdir.absolutePath() + "/bin"); app.addLibraryPath(appdir.absolutePath() + "/lib"); app.addLibraryPath(appdir.absolutePath() + "/lib/kde4"); #endif #if defined Q_OS_WIN KisTabletSupportWin::init(); app.setEventFilter(&KisTabletSupportWin::eventFilter); #elif defined Q_WS_X11 KisTabletSupportX11::init(); app.setEventFilter(&KisTabletSupportX11::eventFilter); #endif #if defined Q_WS_X11 && QT_VERSION >= 0x040800 QApplication::setAttribute(Qt::AA_X11InitThreads); #endif MainWindow window(fileNames); if (args->isSet("vkb")) { app.setInputContext(new SketchInputContext(&app)); } if (args->isSet("windowed")) { window.show(); } else { window.showFullScreen(); } return app.exec(); }
int main( int argc, char** argv ) { QString calligraVersion(CALLIGRA_VERSION_STRING); QString version; #ifdef CALLIGRA_GIT_SHA1_STRING QString gitVersion(CALLIGRA_GIT_SHA1_STRING); version = QString("%1 (git %2)").arg(calligraVersion).arg(gitVersion).toLatin1(); #else version = calligraVersion; #endif KAboutData aboutData("kritagemini", "krita", ki18n("Krita Gemini"), version.toLatin1(), ki18n("Krita Gemini: Painting at Home and on the Go for Artists"), KAboutData::License_GPL, ki18n("(c) 1999-%1 The Krita team and KO GmbH.\n").subs(CALLIGRA_YEAR), KLocalizedString(), "http://www.kritastudio.com", "*****@*****.**"); KCmdLineArgs::init (argc, argv, &aboutData); KCmdLineOptions options; options.add( "+[files]", ki18n( "Images to open" ) ); options.add( "vkb", ki18n( "Use the virtual keyboard" ) ); options.add( "fullscreen", ki18n( "Use full-screen display" ) ); 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("kritagemini"); KIconLoader::global()->addAppDir("krita"); KIconLoader::global()->addAppDir("kritasketch"); #ifdef Q_OS_WIN QDir appdir(app.applicationDirPath()); appdir.cdUp(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); // If there's no kdehome, set it and restart the process. //QMessageBox::information(0, "krita sketch", "KDEHOME: " + env.value("KDEHOME")); if (!env.contains("KDEHOME") ) { _putenv_s("KDEHOME", QDesktopServices::storageLocation(QDesktopServices::DataLocation).toLocal8Bit()); } if (!env.contains("KDESYCOCA")) { _putenv_s("KDESYCOCA", QString(appdir.absolutePath() + "/sycoca").toLocal8Bit()); } if (!env.contains("XDG_DATA_DIRS")) { _putenv_s("XDG_DATA_DIRS", QString(appdir.absolutePath() + "/share").toLocal8Bit()); } if (!env.contains("KDEDIR")) { _putenv_s("KDEDIR", appdir.absolutePath().toLocal8Bit()); } if (!env.contains("KDEDIRS")) { _putenv_s("KDEDIRS", appdir.absolutePath().toLocal8Bit()); } _putenv_s("PATH", QString(appdir.absolutePath() + "/bin" + ";" + appdir.absolutePath() + "/lib" + ";" + appdir.absolutePath() + "/lib" + "/kde4" + ";" + appdir.absolutePath()).toLocal8Bit()); app.addLibraryPath(appdir.absolutePath()); app.addLibraryPath(appdir.absolutePath() + "/bin"); app.addLibraryPath(appdir.absolutePath() + "/lib"); app.addLibraryPath(appdir.absolutePath() + "/lib/kde4"); #endif #if defined Q_OS_WIN KisTabletSupportWin::init(); app.setEventFilter(&KisTabletSupportWin::eventFilter); #elif defined Q_WS_X11 KisTabletSupportX11::init(); app.setEventFilter(&KisTabletSupportX11::eventFilter); #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"); } bool showFullscreen = false; if (args->isSet("fullscreen")) { showFullscreen = true; } // 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. // If fullscreen, hide splash screen QPixmap pm(splash_screen_xpm); QSplashScreen splash(pm); if (!showFullscreen) { splash.show(); splash.showMessage("."); app.processEvents(); } #if defined Q_WS_X11 && QT_VERSION >= 0x040800 QApplication::setAttribute(Qt::AA_X11InitThreads); #endif MainWindow window(fileNames); if (args->isSet("vkb")) { app.setInputContext(new SketchInputContext(&app)); } if (showFullscreen) { window.showFullScreen(); } else { #ifdef Q_OS_WIN window.showMaximized(); #else window.show(); #endif } splash.finish(&window); return app.exec(); }