Example #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{   
    Settings::create(QApplication::applicationDirPath() + "/appSettings.ini");
    ui->setupUi(this);    
    createPlotsGroups();
    routePlotsMenu();
    createPlotsTilingMenu();
    createPlotSettingsView();
    restoreVisibilityActionsState();
    restoreSettings();
    createProject();
    createSamplesProxyActions();
    createRecentlyProjectPaths();
    initAbout();
    createTranslator();
}
Example #2
0
int main(int argc, char **argv)
{
//QTime t = QTime::currentTime();
	Q_UNUSED(copyrightString);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
	qInstallMessageHandler(debugOutput);
#else
	qInstallMsgHandler(debugOutput);
#endif

#ifndef KTIKZ_USE_KDE
	// discard session (X11 calls QApplication::saveState() also when the app
	// has been started, but then also calls QSessionManager::discardCommand()
	// which we define as below in order to remove unnecessary session
	// information)
	if (argc == 3 && !strcmp(argv[1], "--discard"))
	{
		QSettings settings(QString::fromLocal8Bit(ORGNAME), QString::fromLocal8Bit(APPNAME));
		settings.remove(QLatin1String("Session") + QLatin1String(argv[2])); // argv[2] contains the session id
		settings.sync();
		return 0;
	}
#endif

#ifdef KTIKZ_USE_KDE
	Q_INIT_RESOURCE(ktikz);

	KAboutData aboutData("ktikz", "ktikz", ki18n("KtikZ"), APPVERSION);
	aboutData.setShortDescription(ki18n("A TikZ Editor"));
	aboutData.setLicense(KAboutData::License_GPL_V2);
	aboutData.setCopyrightStatement(ki18n("Copyright 2007-2014 Florian Hackenberger, Glad Deschrijver"));
	aboutData.setOtherText(ki18n("This is a program for creating TikZ (from the LaTeX pgf package) diagrams."));
	aboutData.setBugAddress("*****@*****.**");
	aboutData.addAuthor(ki18n("Florian Hackenberger"), ki18n("Maintainer"), "*****@*****.**");
	aboutData.addAuthor(ki18n("Glad Deschrijver"), ki18n("Developer"), "*****@*****.**");

	KCmdLineArgs::init(argc, argv, &aboutData);

	KCmdLineOptions options;
	options.add("+[URL]", ki18n("TikZ document to open"));
	KCmdLineArgs::addCmdLineOptions(options);
#else
	Q_INIT_RESOURCE(qtikz);
#endif

	KtikzApplication app(argc, argv); // slow
	QCoreApplication::setOrganizationName(QString::fromLocal8Bit(ORGNAME));

#ifndef KTIKZ_USE_KDE
	QCoreApplication::setApplicationName(QString::fromLocal8Bit(APPNAME));
	QCoreApplication::setApplicationVersion(QString::fromLocal8Bit(APPVERSION));
#endif

	const QString translationsDirPath = QString::fromLocal8Bit(qgetenv("KTIKZ_TRANSLATIONS_DIR").constData());
	QTranslator qtTranslator;
	QTranslator qtikzTranslator;
	createTranslator(&qtTranslator, QLatin1String("qt"), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
	createTranslator(&qtikzTranslator, QLatin1String("qtikz"), translationsDirPath);
	app.installTranslator(&qtTranslator);
	app.installTranslator(&qtikzTranslator);

	app.init();
//qCritical() << t.msecsTo(QTime::currentTime());
	return app.exec();
}