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


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

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


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

示例1: main

int main(int argc, char *argv[])
{
    //QTextStream out (stdout);

    QApplication* app = new QApplication(argc,argv);
    //////////// Handling of drag and drop events ////////////////
    EventListener* eventListener = new EventListener();
    app->installEventFilter(eventListener);
    app->processEvents();
    //////////// End of handling of drag and drop events ////////////////

    // Splash screen
    QPixmap pixmap(":/icons/STAsplash.png");
    QSplashScreen splash(pixmap, Qt::Tool);
    splash.resize(550, 326);
    splash.show();

    QCoreApplication::setOrganizationName(QObject::tr("STA Steering Board"));
    QCoreApplication::setApplicationName("STA");
    QCoreApplication::setOrganizationName("stasb");    // 'stasb' means STA Steering Board
    QCoreApplication::setOrganizationDomain("org");  // Patched by Guillermo
    QCoreApplication::setApplicationVersion("4.0");
    QCoreApplication::setOrganizationDomain("STASB");  // Patched by Guillermo

    //QString ApplicationPath = QDir::currentPath ();
    //QString ResourcesPath = ApplicationPath + "/sta-data";

    //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)
//.........这里部分代码省略.........
开发者ID:Dwarf-Planet-Project,项目名称:SpaceDesignTool,代码行数:101,代码来源:main.cpp

示例2: main

int main(int argc, char **argv)
{
#ifdef Q_WS_WIN
	// Make sure Windows doesn't load DLLs from the current working directory
	SetDllDirectoryA("");
	SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE);
#endif

	setlocale(LC_CTYPE, "");
	
#if defined(Q_WS_X11) && defined(AUTOTYPE)
	QApplication* app = new KeepassApplication(argc,argv);
#else
	QApplication* app = new QApplication(argc,argv);
#endif
	EventListener* eventListener = new EventListener();
	app->installEventFilter(eventListener);
	
	QApplication::setQuitOnLastWindowClosed(false);
	
	AppDir = QApplication::applicationFilePath();
	AppDir.truncate(AppDir.lastIndexOf("/"));
#if defined(Q_WS_X11)
	DataDir = AppDir+"/../share/keepassx";
	if (!QFile::exists(DataDir) && QFile::exists(AppDir+"/share"))
		DataDir = AppDir+"/share";
	const char* env = getenv("XDG_CONFIG_HOME");
	if (!env) {
		HomeDir = QDir::homePath() + "/.config";
	}
	else {
		QString qenv = QTextCodec::codecForLocale()->toUnicode(env);
		if (qenv[0] == '/')
			HomeDir = qenv;
		else
			HomeDir = QDir::homePath() + '/' + qenv;
	}
	HomeDir += "/keepassx";
#elif defined(Q_WS_MAC)
	HomeDir = QDir::homePath()+"/.keepassx";
	DataDir = AppDir+"/../Resources/keepassx";
#else //Q_WS_WIN
	HomeDir = qtWindowsConfigPath(CSIDL_APPDATA);
	if(!HomeDir.isEmpty() && QFile::exists(HomeDir))
		HomeDir = QDir::fromNativeSeparators(HomeDir)+"/KeePassX";
	else
		HomeDir = QDir::homePath()+"/KeePassX";
	
	DataDir = AppDir+"/share";
#endif
	DataDir = QDir::cleanPath(DataDir);
	
	CmdLineArgs args;
	if ( !args.parse(QApplication::arguments()) ){
		qCritical("%s\n", CSTR( args.error() ));
		args.printHelp();
		return 1;
	}
	if (args.help()){
		args.printHelp();
		return 1;
	}

	//Load Config
	QString IniFilename;
	if(args.configLocation().isEmpty()){
		if(!QDir(HomeDir).exists()){
			QDir conf(QDir::homePath());
			if(!QDir().mkpath(HomeDir))
				qWarning("Warning: Could not create directory '%s'", CSTR(HomeDir));
		}
		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)
//.........这里部分代码省略.........
开发者ID:Davenport-Physics,项目名称:keepassx-classic,代码行数:101,代码来源:main.cpp


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