Exemplo n.º 1
0
int main( int argc, char * *argv )
{
    QApplication app(argc, argv);

#ifdef Q_WS_WIN
    QString pluginPath = QString(PLEXPREFIX) + "/plugins/imageformats";
    app.addLibraryPath(pluginPath);
#endif

    Canvas scene;
    scene.setBackgroundBrush(Qt::NoBrush);
    scene.setItemIndexMethod(QGraphicsScene::NoIndex);
    scene.setSceneRect(QDesktopWidget().availableGeometry()); //TODO Resolution changes ?

    QSharedPointer<DesktopView> view = QSharedPointer<DesktopView>(new DesktopView(0));
    view->enableOpenGL(
            PlexyDesk::Config::getInstance()->openGL);
    view->setScene(&scene);
    QObject::connect(view.data(), SIGNAL(closeApplication()), &app, SLOT(quit()));
       QRect r = QDesktopWidget().geometry();
    view->move(r.x(), r.y());
    view->resize(QDesktopWidget().geometry().size());
#ifdef Q_WS_WIN
    /// \brief: remove plexy from taskbar
    view->move(0, 0);
    view->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
#endif

#ifdef Q_WS_X11
    NETWinInfo info(QX11Info::display(), view->winId(), QX11Info::appRootWindow(), NET::WMDesktop );
    info.setDesktop(NETWinInfo::OnAllDesktops);
    info.setWindowType(NET::Desktop);
#endif

    PlexyDesk::PluginLoader *loader = PlexyDesk::PluginLoader::getInstance();
    loader->scanDisk();
    view->show();
    /* Load the widget from settings */
    QStringList list = PlexyDesk::Config::getInstance()->widgetList;

    Q_FOREACH (QString str, list) {
        view->addExtension(str);
    }
Exemplo n.º 2
0
int main( int argc, char * *argv )
{
#ifndef Q_WS_MAC
    QApplication::setGraphicsSystem(QLatin1String("raster"));
#endif

    QByteArray debug_settings = qgetenv("PLEXYDESK_CONSOLE_DEBUG").toLower();

    if (debug_settings != "enable" && debug_settings != "true" && debug_settings != "1" ) {
       qInstallMsgHandler(plexyWindowsLogger);
    }

    QApplication app(argc, argv);

    QString appIconPath = PlexyDesk::Config::getInstance()->plexydeskBasePath() + "/share/plexy/plexydesk.png";
    QIcon appIcon = QIcon(QDir::toNativeSeparators(appIconPath));
    app.setWindowIcon(appIcon);
    app.setApplicationName(QString(PLEXYNAME));

#ifdef Q_WS_WIN
    QString pluginPath = PlexyDesk::Config::getInstance()->plexydeskBasePath() + "/lib/qt4/plugins/imageformats";
    app.addLibraryPath(QDir::toNativeSeparators(pluginPath));
#endif

#ifdef Q_WS_MAC
    PlexyDesk::Config::getInstance()->setOpenGL(false);
#endif
   
    PlexyDesk::PluginLoader *loader = PlexyDesk::PluginLoader::getInstance();
    loader->scanDisk();
    // Set this to false if you need a "close to tray" functionality when systray exists
    QApplication::setQuitOnLastWindowClosed(true);

 
    DesktopBaseUi * ui = new DesktopBaseUi();

    return app.exec();
}