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


C++ QCoreApplication::setApplicationName方法代码示例

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


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

示例1: initialize

void QGBSettings::initialize(const QCoreApplication & appli){
  appli.setOrganizationName("Satellite");
  appli.setOrganizationDomain("satellite.epfl.ch");
  appli.setApplicationName("QGoldenBook");

  d_instance = new QGBSettings();
}
开发者ID:atuleu,项目名称:QGoldenBook,代码行数:7,代码来源:QGBSettings.cpp

示例2: start

void ServiceApp::start()
{
  QCoreApplication *app = application();
  app->setApplicationName(SCHAT_NAME);
  app->setApplicationVersion(SCHAT_VERSION);
  app->setOrganizationName(LS("IMPOMEZIA"));
  app->setOrganizationDomain(SCHAT_DOMAIN);

  m_init = new NodeInit(LS("schatd2"), app);
}
开发者ID:johnbolia,项目名称:schat,代码行数:10,代码来源:ServiceApp.cpp

示例3: main


//.........这里部分代码省略.........
		{
		    kde = false;
		}
#endif
		else
                {
                    printUsage(appName);
                    return 0;
                }
            }
            else
            {
                if (!script.isEmpty())
                    scriptArgs.append(KJS::jsString(arg));
                else
                    script = arg;
            }
        }
    }
    else
    {
        printUsage(appName);
        return 0;
    }

    // Setup QApplication
    QCoreApplication *app;

#ifndef QT_ONLY
    if (kde)
    {
        KAboutData aboutData( "kjscmd", 0, ki18n("KJSCmd"), "0.2",
            ki18n(""
            "Utility for running KJSEmbed scripts \n" ),
            KAboutData::License_LGPL,
            ki18n("(C) 2005-2006 The KJSEmbed Authors") );

        KCmdLineOptions options;
        options.add("e", ki18n("Execute script without gui support"));
        options.add("exec", ki18n("Execute script without gui support"));
        options.add("i", ki18n("start interactive kjs interpreter"));
        options.add("interactive", ki18n("start interactive kjs interpreter"));
        options.add("n", ki18n("start without KDE KApplication support."));
        options.add("no-kde", ki18n("start without KDE KApplication support."));
        options.add("!+command", ki18n("Script to execute"));

        KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
        KCmdLineArgs::init( argc, argv, &aboutData );

        app = new KApplication(gui);
    }
    else
#endif
    if (gui)
    {
	qDebug("no KDE");
        app = new QApplication( argc, argv );
        dynamic_cast<QApplication*>(app)->connect( app, SIGNAL(lastWindowClosed()), SLOT(quit()) );
    }
    else
    {
	qDebug("no GUI");
        app = new QCoreApplication(argc, argv);
    }
    qDebug(" New %s %dms", app->metaObject()->className(), time.elapsed());

    app->setApplicationName( appName );
    
    // Setup Interpreter
    time.restart();
    Engine kernel;
    qDebug(" New engine %dms", time.elapsed());
    time.restart();

    KJS::Interpreter *js = kernel.interpreter();
    js->setShouldPrintExceptions(true);
    KJS::ExecState *exec = js->globalExec();

    // Publish bindings
    KJS::JSObject *appObject = kernel.addObject( app, "Application" );
    KJS::JSObject *argObject = js->builtinArray()->construct( exec, scriptArgs );
    appObject->put( exec, "args", argObject );
    Engine::ExitStatus result = Engine::Failure;

    if (!script.isEmpty())
    {
        result = kernel.runFile(toUString(script));
    }
    else // exec shell
    {
        result = kernel.runFile( ":/console.js" );
    }

    if ( result != Engine::Success )
    {
        KJS::Completion jsres = kernel.completion();
       (*KJSEmbed::conerr()) << toQString(jsres.value()->toString(exec)) << endl;
    }
    return (int)result;
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: main

int main(int argc, char *argv[])
{
	//Initialization of system functions
	InitSystem();

	//configure debug output
	qInstallMessageHandler(myMessageOutput);

	//class for interface windows
	gMainInterface = new cInterface;

	WriteLog("Prepare QApplication", 2);
	QCoreApplication *gCoreApplication = new QCoreApplication(argc, argv);
	gCoreApplication->setOrganizationName("Mandelbulber");
	gCoreApplication->setApplicationName("Mandelbulber");
	gCoreApplication->setApplicationVersion(MANDELBULBER_VERSION_STRING);

	UpdateLanguage(gCoreApplication);

	cCommandLineInterface commandLineInterface(gApplication);

	if (commandLineInterface.isNoGUI())
	{
		gApplication = qobject_cast<QApplication *>(gCoreApplication);
	}
	else
	{
		delete gCoreApplication;
		gApplication = new QApplication(argc, argv);
		gApplication->setOrganizationName("Mandelbulber");
		gApplication->setApplicationName("Mandelbulber");
		gApplication->setApplicationVersion(MANDELBULBER_VERSION_STRING);
	}

	//registering types for queued connections
	qRegisterMetaType<cStatistics>("cStatistics");
	qRegisterMetaType<QList<QByteArray> >("QList<QByteArray>");
	qRegisterMetaType<QList<int> >("QList<int>");
	qRegisterMetaType<cParameterContainer>("cParameterContainer");
	qRegisterMetaType<cFractalContainer>("cFractalContainer");
	qRegisterMetaType<sTextures>("sTextures");
	qRegisterMetaType<cProgressText::enumProgressType>("cProgressText::enumProgressType");
	qRegisterMetaType<QVector<int> >("QVector<int>");
	qRegisterMetaType<CVector2<double> >("CVector2<double>");
	qRegisterMetaType<QMessageBox::StandardButtons>("QMessageBox::StandardButtons");
	qRegisterMetaType<QMessageBox::StandardButtons*>("QMessageBox::StandardButtons*");
	qRegisterMetaType<cErrorMessage::enumMessageType>("cErrorMessage::enumMessageType");

	gErrorMessage = new cErrorMessage;

	//create default directories and copy all needed files
	WriteLog("CreateDefaultFolders()", 2);
	if (!CreateDefaultFolders())
	{
		qCritical() << "Files/directories initialization failed" << endl;
		return 73;
	}

	//create internal database with parameters
	gPar = new cParameterContainer;
	gParFractal = new cFractalContainer;

	//Allocate container for animation frames
	gAnimFrames = new cAnimationFrames;

	//Allocate container for key frames
	gKeyframes = new cKeyframes;

	gPar->SetContainerName("main");
	InitParams(gPar);
	for (int i = 0; i < NUMBER_OF_FRACTALS; i++)
	{
		gParFractal->at(i).SetContainerName(QString("fractal") + QString::number(i));
		InitFractalParams(&gParFractal->at(i));
	}

	/****************** TEMPORARY CODE FOR MATERIALS *******************/

	//InitMaterialParams(1, gPar);
	//InitMaterialParams(2, gPar);
	//InitMaterialParams(3, gPar);

	/*******************************************************************/

	//Define list of fractal formulas
	DefineFractalList(&fractalList);

	//Netrender
	gNetRender = new CNetRender(systemData.numberOfThreads);

	//loading AppSettings
	if (QFile(systemData.dataDirectory + "mandelbulber.ini").exists())
	{
		cSettings parSettings(cSettings::formatAppSettings);
		parSettings.LoadFromFile(systemData.dataDirectory + "mandelbulber.ini");
		parSettings.Decode(gPar, gParFractal);
	}

	systemData.loggingVerbosity = gPar->Get<int>("logging_verbosity");

//.........这里部分代码省略.........
开发者ID:w77,项目名称:mandelbulber2,代码行数:101,代码来源:main.cpp

示例5: dirPath

QSqlDatabase SObjectManager::Private::connection()
{
    if (!mConnection.isValid()) {
        QString databasePath;
        QCoreApplication *a = QCoreApplication::instance();

        QString orgName = a->organizationName();
        QString appName = a->applicationName();

        a->setOrganizationName(QLatin1String("saesu"));
        a->setApplicationName(QLatin1String("clouds"));

        databasePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);

        QDir dirPath(databasePath);
        if (!dirPath.exists())
            dirPath.mkpath(databasePath);


        // restore app name/org details
        a->setOrganizationName(orgName);
        a->setApplicationName(appName);

        mConnection = QSqlDatabase::addDatabase("QSQLITE", QLatin1String("saesu-cloud://") + mTableName);
        mConnection.setDatabaseName(databasePath + "/" + mTableName);
        if (!mConnection.open()) {
            // TODO: error handling
            sWarning() << "Couldn't open database";
            return mConnection;
        }

        const int currentDbVersion = 3;

        // TODO: make this work with multiple ObjectManagers
        if (!mConnection.tables().contains("_saesu")) {
            QSqlQuery q(mConnection);
            mConnection.transaction();

            // create table(s)
            sDebug() << "Creating tables";

            q.exec("CREATE TABLE _saesu (version integer)");
            q.exec("INSERT INTO _saesu VALUES (" + QString::number(currentDbVersion) + ")");
            q.exec("CREATE TABLE objects (key primary key, timestamp integer, hash blob, object blob)");
            q.exec("CREATE TABLE deletelist (key primary key, timestamp integer)");

            mConnection.commit();
        } else {
            QSqlQuery q(mConnection);
            mConnection.transaction();

            sDebug() << "Checking for migration";
            q.exec("SELECT version FROM _saesu");
            q.next();
            qint64 dbVersion = q.value(0).toLongLong();
            
            switch (dbVersion) {
                case currentDbVersion:
                    sDebug() << "Database up to date";
                    break;
                case 1:
                case 2:
                    // need to add a 'deletelist' table.
                    q.exec("CREATE TABLE deletelist (key primary key, timestamp integer)");
                    sDebug() << "Migrated successfully from schema v1";
                    break;
                default:
                    qCritical("I don't understand schema version!");
                    
            }

            q.exec("UPDATE _saesu SET version = '" + QString::number(currentDbVersion) + "'");

            mConnection.commit();
        }
    }

    return mConnection;
}
开发者ID:saesu,项目名称:libsaesu,代码行数:79,代码来源:sobjectmanager.cpp


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