示例#1
0
文件: main.cpp 项目: OnceBe/qlcplus
/**
 * THE entry point for the application
 *
 * @param argc Number of arguments in array argv
 * @param argv Arguments array
 */
int main(int argc, char** argv)
{
    /* Create the Qt core application object */
    QApplication qapp(argc, argv);

    /* At least MIDI plugin requires this so best to declare it here for everyone */
    qRegisterMetaType<QVariant>("QVariant");

#ifdef __APPLE__
    /* Load plugins from within the bundle ONLY */
    QDir dir(QApplication::applicationDirPath());
    dir.cdUp();
    dir.cd("plugins");
    QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif

    QLCi18n::init();

    /* Let the world know... */
    printVersion();

    /* Parse command-line arguments */
    if (parseArgs() == false)
        return 0;

    /* Load translation for main application */
    QLCi18n::loadTranslation("qlcplus");

    /* Handle debug messages */
    qInstallMsgHandler(qlcMessageHandler);

    /* Create and initialize the QLC application object */
    App app;

#if defined(WIN32) || defined(__APPLE__)
    if (QLCArgs::debugLevel < QtSystemMsg)
    {
        QLCArgs::dbgBox = new DebugBox(&app);
        QLCArgs::dbgBox->show();
    }
#endif
    app.startup();
    app.show();

    if (QLCArgs::workspace.isEmpty() == false)
        app.loadXML(QLCArgs::workspace);
    if (QLCArgs::operate == true)
        app.slotModeOperate();
    if (QLCArgs::kioskMode == true)
        app.enableKioskMode();
    if (QLCArgs::fullScreen == true)
        app.slotControlFullScreen(QLCArgs::fullScreenResize);
    if (QLCArgs::kioskMode == true && QLCArgs::closeButtonRect.isValid() == true)
        app.createKioskCloseButton(QLCArgs::closeButtonRect);

    return qapp.exec();
}
示例#2
0
/**
 * THE entry point for the application
 *
 * @param argc Number of arguments in array argv
 * @param argv Arguments array
 */
int main(int argc, char** argv)
{
    /* Create the Qt core application object */
    QApplication qapp(argc, argv);

    /* At least MIDI plugin requires this so best to declare it here for everyone */
    qRegisterMetaType<QVariant>("QVariant");

#if defined(__APPLE__) || defined(Q_OS_MAC)
    /* Load plugins from within the bundle ONLY */
    QDir dir(QApplication::applicationDirPath());
    dir.cdUp();
    dir.cd("plugins");
    QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif

    QLCi18n::init();

    /* Let the world know... */
    printVersion();

    /* Parse command-line arguments */
    if (parseArgs() == false)
        return 0;

    /* Load translation for main application */
    QLCi18n::loadTranslation("qlcplus");

    /* Handle debug messages */
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    qInstallMsgHandler(qlcMessageHandler);
#else
    qInstallMessageHandler(qlcMessageHandler);
#endif

    /* Create and initialize the QLC application object */
    App app;

#if defined(WIN32) || defined(__APPLE__)
    if (QLCArgs::logToFile == false && QLCArgs::debugLevel < QtSystemMsg)
    {
        QLCArgs::dbgBox = new DebugBox(&app);
        QLCArgs::dbgBox->show();
    }
#endif
    app.startup();
    app.show();

    if (QLCArgs::workspace.isEmpty() == false)
    {
        if (app.loadXML(QLCArgs::workspace) == QFile::NoError)
            app.updateFileOpenMenu(QLCArgs::workspace);
    }
    if (QLCArgs::operate == true)
        app.slotModeOperate();
    if (QLCArgs::kioskMode == true)
        app.enableKioskMode();
    if (QLCArgs::fullScreen == true)
        app.slotControlFullScreen(QLCArgs::fullScreenResize);
    if (QLCArgs::kioskMode == true && QLCArgs::closeButtonRect.isValid() == true)
        app.createKioskCloseButton(QLCArgs::closeButtonRect);

    if (QLCArgs::enableWebAccess == true)
    {
        WebAccess *webAccess = new WebAccess(app.doc(), VirtualConsole::instance(),
                                               SimpleDesk::instance());

        QObject::connect(webAccess, SIGNAL(toggleDocMode()),
                &app, SLOT(slotModeToggle()));
        QObject::connect(webAccess, SIGNAL(loadProject(QString)),
                &app, SLOT(slotLoadDocFromMemory(QString)));
        QObject::connect(webAccess, SIGNAL(storeAutostartProject(QString)),
                &app, SLOT(slotSaveAutostart(QString)));
    }

    return qapp.exec();
}