当前位置: 首页>>代码示例>>C++>>正文


C++ EventListener::setMainWin方法代码示例

本文整理汇总了C++中EventListener::setMainWin方法的典型用法代码示例。如果您正苦于以下问题:C++ EventListener::setMainWin方法的具体用法?C++ EventListener::setMainWin怎么用?C++ EventListener::setMainWin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventListener的用法示例。


在下文中一共展示了EventListener::setMainWin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........

    //QString ApplicationPath = QApplication::applicationFilePath();
    //        ApplicationPath.truncate(ApplicationPath.lastIndexOf("/"));
    //QString ResourcesPath = ApplicationPath + "/sta-data";

    ParseCommandLine();

    QString staResourcesPath = findDataFolder();


#if defined(Q_WS_MAC)
    if (!QDir::setCurrent(staResourcesPath))
    {
        QMessageBox::warning(NULL,
                             QObject::tr("STA Resources Not Found"),
                             QObject::tr("STA resources folder wasn't found. This probably means that STA was not properly installed"));
        exit(0);
    }
#else
    if (!QDir::setCurrent(staResourcesPath))  // Patched by Guillermo
    {
        QMessageBox::warning(NULL,
                             QObject::tr("STA Resources Not Found"),
                             QObject::tr("STA resources folder wasn't found. This probably means that STA was not properly installed"));
        exit(0);
    }
#endif

    // Initialize the astro core
    SolarSystemBodyDictionary::Create();

    // Initialize SPICE
    SpiceEphemeris* spiceEphem = SpiceEphemeris::InitializeSpice(QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/spice");
    if (spiceEphem)
    {
        qDebug() << "Using SPICE ephemeris";
        SolarSystemBodyDictionary::UseEphemeris(spiceEphem);
        qDebug() << "OK";
    }
    else
    {
        qDebug() << "SPICE kernels for solar system ephemeris not located or incomplete. JPL DE405 ephemeris";
        qDebug() << "will be instead. This is only a problem when analyzing missions to natural satellites";
        qDebug() << "other than the Moon.";

        QString ephemerisFilename("ephemerides/de406_1800-2100.dat");
        QFile ephemerisFile(ephemerisFilename);
        if (!ephemerisFile.open(QFile::ReadOnly))
        {
            QMessageBox::critical(NULL,
                                  QObject::tr("Ephemeris Data Missing"),
                                  QObject::tr("Ephemeris data file %1 not found.").arg(ephemerisFilename));

            exit(0);
        }

        sta::JPLEphemeris* ephemeris = sta::JPLEphemeris::load(&ephemerisFile);
        if (!ephemeris)
        {
            QMessageBox::critical(NULL,
                                  QObject::tr("Error Reading Ephemeris"),
                                  QObject::tr("Ephemeris file %1 is corrupted.").arg(ephemerisFilename));
            exit(0);
        }

        SolarSystemBodyDictionary::UseEphemeris(ephemeris);
    }

    // end astro core initialization


    MainWindow* mainwindow = new MainWindow();

#if defined (Q_WS_MAC)
    eventListener->setMainWin(mainwindow);
    QString fileToOpen = eventListener->file();
    mainwindow->openFileFromAEvent(fileToOpen);
#else
    QString fileToOpen = ":/untitled.stas";
    const QStringList args = QCoreApplication::arguments();
    if (args.count() == 2)
    {
        fileToOpen = args.at(1);
        mainwindow->openFileFromAEvent(fileToOpen);
    }
#endif


    mainwindow->show();

    splash.hide();

    int result = app->exec();

    delete mainwindow;
    delete eventListener;
    delete app;

    return result;
} ////////////////////////// End of Main.CPP /////////////////////
开发者ID:Dwarf-Planet-Project,项目名称:SpaceDesignTool,代码行数:101,代码来源:main.cpp

示例2: main


//.........这里部分代码省略.........
		IniFilename=HomeDir+"/config.ini";
	}
	else
		IniFilename=args.configLocation();

#ifdef Q_WS_X11
	{
		QString OldHomeDir = QDir::homePath()+"/.keepassx";
		if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) {
			QFile::rename(OldHomeDir+"/config", HomeDir+"/config.ini");
			if (QDir(OldHomeDir).entryList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System).count()==0)
				QDir().rmdir(OldHomeDir);
		}
	}
#else
	if (args.configLocation().isEmpty() && QFile::exists(HomeDir+"/config") && !QFile::exists(HomeDir+"/config.ini"))
		QFile::rename(HomeDir+"/config", HomeDir+"/config.ini");
#endif
	config = new KpxConfig(IniFilename);
	fileDlgHistory.load();
	
	// PlugIns
	/*
#ifdef Q_WS_X11
	if(config->integrPlugin()!=KpxConfig::NoIntegr){
		QString LibName="libkeepassx-";
		if(config->integrPlugin()==KpxConfig::KDE)
			LibName+="kde.so";
		else if(config->integrPlugin()==KpxConfig::Gnome)
			LibName+="gnome.so";
		QString filename=findPlugin(LibName);
		if(filename!=QString()){
			QPluginLoader plugin(filename);
			if(!plugin.load()){
				PluginLoadError=plugin.errorString();
				qWarning("Could not load desktop integration plugin:");
				qWarning("%s", CSTR(PluginLoadError));
			}
			else{
				QObject *plugininstance=plugin.instance();
				IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugininstance);
				IconLoader=qobject_cast<IIconTheme*>(plugininstance);
				if(IconLoader==NULL){
					qWarning("Error: Integration Plugin: Could not initialize IconTheme interface.");
				}
				KpxFileDialogs::setPlugin(fdlg);
				if(config->integrPlugin()==KpxConfig::KDE){
					IKdeInit* kdeinit=qobject_cast<IKdeInit*>(plugin.instance());
					app=kdeinit->getMainAppObject(argc,argv);
					if(!app) PluginLoadError = "Initialization failed.";
				}
				if(config->integrPlugin()==KpxConfig::Gnome){
					IGnomeInit* ginit=qobject_cast<IGnomeInit*>(plugin.instance());
					if(!ginit->init(argc,argv)){
						KpxFileDialogs::setPlugin(NULL);
						qWarning("GtkIntegrPlugin: Gtk init failed.");
						PluginLoadError = "Initialization failed.";
					}
				}
			}
		}
		else{
			qWarning(CSTR(QString("Could not load desktop integration plugin: File '%1' not found.").arg(LibName)));
			PluginLoadError=QApplication::translate("Main", "Could not locate library file.");
		}
	}
#endif
	*/
	
	DetailViewTemplate=config->detailViewTemplate();

	loadImages();
	KpxBookmarks::load();
	initYarrow(); //init random number generator
	SecString::generateSessionKey();
	
	installTranslator();

#ifdef Q_WS_MAC
	QApplication::processEvents();
	if (args.file().isEmpty() && !eventListener->file().isEmpty()) {
		args.setFile(eventListener->file());
	}
#endif

	KeepassMainWindow *mainWin = new KeepassMainWindow(args.file(), args.startMinimized(), args.startLocked());
#ifdef Q_WS_MAC
	eventListener->setMainWin(mainWin);
#endif

	int r=app->exec();
	delete mainWin;
	delete eventListener;

	fileDlgHistory.save();
	SecString::deleteSessionKey();
	delete app;
	delete config;
	return r;
}
开发者ID:Davenport-Physics,项目名称:keepassx-classic,代码行数:101,代码来源:main.cpp


注:本文中的EventListener::setMainWin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。