示例#1
0
Q_DECL_EXPORT int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    app.setOrganizationName("cuteTube2");
    app.setApplicationName("cuteTube2");

    Settings settings;
    Clipboard clipboard;
    Dailymotion dailymotion;
    DBusService dbus;
    NetworkAccessManagerFactory factory;
    Resources resources;
    ResourcesPlugins plugins;
    Transfers transfers;
    Utils utils;
    VideoLauncher launcher;
    Vimeo vimeo;
    YouTube youtube;
        
    initDatabase();
    registerTypes();
    plugins.load();
    settings.setNetworkProxy();
    
    QQmlApplicationEngine engine;
    QQmlContext *context = engine.rootContext();
    
    context->setContextProperty("Clipboard", &clipboard);
    context->setContextProperty("CookieJar", factory.cookieJar());
    context->setContextProperty("Dailymotion", &dailymotion);
    context->setContextProperty("DBus", &dbus);
    context->setContextProperty("Plugins", &plugins);
    context->setContextProperty("Resources", &resources);
    context->setContextProperty("Settings", &settings);
    context->setContextProperty("Transfers", &transfers);
    context->setContextProperty("Utils", &utils);
    context->setContextProperty("VideoLauncher", &launcher);
    context->setContextProperty("Vimeo", &vimeo);
    context->setContextProperty("YouTube", &youtube);
    context->setContextProperty("AUDIO_CONVERTOR_ENABLED", (QFile::exists("/usr/bin/ffmpeg"))
                                                           || (QFile::exists("/usr/bin/avconv")));
    context->setContextProperty("MAX_RESULTS", MAX_RESULTS);
    context->setContextProperty("VERSION_NUMBER", VERSION_NUMBER);

    engine.setNetworkAccessManagerFactory(&factory);
    engine.load("/opt/cutetube2/qml/main.qml");
    
    return app.exec();
}
示例#2
0
Q_DECL_EXPORT int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    app.setOrganizationName("MusiKloud2");
    app.setApplicationName("MusiKloud2");
    app.setApplicationVersion(VERSION_NUMBER);
    app.setWindowIcon(QIcon::fromTheme("musikloud2"));

    Settings settings;
    Clipboard clipboard;
    DBusService dbus;
    Resources resources;
    ResourcesPlugins plugins;
    SoundCloud soundcloud;
    Transfers transfers;
    Utils utils;
        
    initDatabase();
    registerTypes();
    plugins.load();
    settings.setNetworkProxy();
    
    QQmlApplicationEngine engine;
    QQmlContext *context = engine.rootContext();
    
    context->setContextProperty("Clipboard", &clipboard);
    context->setContextProperty("DBus", &dbus);
    context->setContextProperty("Plugins", &plugins);
    context->setContextProperty("Resources", &resources);
    context->setContextProperty("Settings", &settings);
    context->setContextProperty("SoundCloud", &soundcloud);
    context->setContextProperty("Transfers", &transfers);
    context->setContextProperty("Utils", &utils);
    context->setContextProperty("MAX_RESULTS", MAX_RESULTS);
    context->setContextProperty("VERSION_NUMBER", VERSION_NUMBER);

    engine.load("/opt/musikloud2/qml/main.qml");
    
    return app.exec();
}