예제 #1
0
파일: main.cpp 프로젝트: Fat-Zer/kdeartwork
int main(int argc, char *argv[])
{
    KCmdLineArgs::init(argc, argv, appName, I18N_NOOP("KLock"), description, version);

    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;

    KCrash::setCrashHandler( crashHandler );

    DemoWindow *demoWidget = 0;
    Window saveWin = 0;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if (args->isSet("setup"))
    {
       setupScreenSaver();
       exit(0);
    }

    if (args->isSet("window-id"))
    {
        saveWin = atol(args->getOption("window-id"));
    }

    if (args->isSet("root"))
    {
        saveWin = TQApplication::desktop()->handle();
    }

    if (args->isSet("demo"))
    {
        saveWin = 0;
    }

    if (saveWin == 0)
    {
        demoWidget = new DemoWindow();
        demoWidget->setBackgroundMode(TQWidget::NoBackground);
//        demoWidget->setBackgroundColor(TQt::black);
        demoWidget->show();
        saveWin = demoWidget->winId();
        app.setMainWidget(demoWidget);
        app.processEvents();
    }

    startScreenSaver(saveWin);
    app.exec();
    stopScreenSaver();

    if (demoWidget)
    {
        delete demoWidget;
    }

    return 0;
}
예제 #2
0
파일: main.cpp 프로젝트: Fat-Zer/tdelibs
KDE_EXPORT int main(int argc, char *argv[])
{
    TDELocale::setMainCatalogue("libtdescreensaver");
    TDECmdLineArgs::init(argc, argv, kss_applicationName, kss_description, kss_version);

    TDECmdLineArgs::addCmdLineOptions(options);

    TDEApplication app;

    TDECrash::setCrashHandler( crashHandler );
    TDEGlobal::locale()->insertCatalogue("klock");
    TDEGlobal::locale()->insertCatalogue("tdescreensaver");

    DemoWindow *demoWidget = 0;
    Window saveWin = 0;
    KScreenSaver *target;

    TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();

    if (args->isSet("setup"))
    {
       TQDialog *dlg = kss_setup();
       args->clear();
       dlg->exec();
       delete dlg;
       exit(0);
    }

    if (args->isSet("window-id"))
    {
        saveWin = atol(args->getOption("window-id"));
    }

#ifdef Q_WS_X11 //FIXME
    if (args->isSet("root"))
    {
        saveWin = RootWindow(tqt_xdisplay(), tqt_xscreen());
    }
#endif

    if (args->isSet("demo"))
    {
        saveWin = 0;
    }

    if (saveWin == 0)
    {
        demoWidget = new DemoWindow();
        demoWidget->setBackgroundMode(TQWidget::NoBackground);
        saveWin = demoWidget->winId();
        app.setMainWidget(demoWidget);
        app.processEvents();
    }

    target = kss_create( saveWin );

    if ( demoWidget )
    {
        demoWidget->setFixedSize( 600, 420 );
        demoWidget->show();
    }
    args->clear();
    app.exec();

    delete target;
    delete demoWidget;

    return 0;
}