コード例 #1
0
ファイル: main.cpp プロジェクト: davidgraeff/oldstuff
int main(int argc, char **argv)
{

	KAboutData aboutData("liri-control-kde4",
		0,
		ki18n("Liri Control"), //programname
		ABOUT_VERSION, //version
		ki18n(ABOUT_SUMMARY), //short Desc
		KAboutData::License_LGPL_V3, //license
		ki18n(ABOUT_COPYRIGHT), //copywrite statement
		ki18n("Status of liri components"), //text
		"http://cerebro.webhop.net/liri", //homepage
		ABOUT_AUTHOR_EMAIL); //bugsemail address
	aboutData.addAuthor(ki18n(ABOUT_AUTHOR), ki18n("Lead developer"), ABOUT_AUTHOR_EMAIL);
	aboutData.setProgramIconName(QLatin1String("liri-control"));

	KCmdLineArgs::init( argc, argv, &aboutData );
	KApplication app;

	app.setWindowIcon(KIcon(QLatin1String("liri-control")));
	app.setQuitOnLastWindowClosed(true);

	BusConnection* busconnection = new BusConnection();

	/* self freeing object! */
	MainWindow* window = new MainWindow(busconnection);
	window->show();

	int res = app.exec();

	delete busconnection;

	return res;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: mvalle/kamerka
int main(int argc, char *argv[]) {
	printf("Kamerka version %s\n    Copyright (C) 2011-2014 Sebastian Krzyszkowiak\n", VERSION);
	printf("    Kamerka comes with ABSOLUTELY NO WARRANTY.\n");
	printf("    This is free software, and you are welcome to redistribute it\n");
	printf("    under certain conditions; type `./kamerka --license' for details.\n\n");
	fflush(stdout);

	QApplication::setGraphicsSystem("raster"); // improves performance a lot, should be default on modern systems
	KAboutData aboutData("kamerka", 0, ki18n("Kamerka"), VERSION,
											 ki18n("Simple photo taking application with fancy animated interface"),
											 KAboutData::License_GPL, ki18n("Copyright (C) 2011-2014 Sebastian Krzyszkowiak") );
	KCmdLineArgs::init(argc, argv, &aboutData);
	KApplication a;
	QIcon icon(":/icons/kamerka.png");
	a.setWindowIcon(icon);
	new MainWindow();
	return a.exec();
}
コード例 #3
0
ファイル: main.cpp プロジェクト: mgottschlag/kwin-tiling
int kScreenSaverMain( int argc, char** argv, KScreenSaverInterface& screenSaverInterface )
{
    KLocale::setMainCatalog("libkscreensaver");
    KCmdLineArgs::init(argc, argv, screenSaverInterface.aboutData());


    KCmdLineOptions options;

    options.add("setup", ki18n("Setup screen saver"));

    options.add("window-id wid", ki18n("Run in the specified XWindow"));

    options.add("root", ki18n("Run in the root XWindow"));

    options.add("demo", ki18n("Start screen saver in demo mode"), "default");

    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;

    // Set a useful default icon.
    app.setWindowIcon(KIcon("preferences-desktop-screensaver"));


    if (!pipe(termPipe))
    {
#ifndef Q_WS_WIN
        struct sigaction sa;
        sa.sa_handler = termHandler;
        sigemptyset(&sa.sa_mask);
        sa.sa_flags = 0;
        sigaction(SIGTERM, &sa, 0);
#endif
        QSocketNotifier *sn = new QSocketNotifier(termPipe[0], QSocketNotifier::Read, &app);
        QObject::connect(sn, SIGNAL(activated(int)), &app, SLOT(quit()));
    }

#ifdef Q_WS_X11
    oldXErrorHandler = XSetErrorHandler(xErrorHandler);
#endif
    KCrash::setCrashHandler( crashHandler );
    KGlobal::locale()->insertCatalog("klock");
    KGlobal::locale()->insertCatalog("kscreensaver");

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

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if (args->isSet("setup"))
    {
       QDialog *dlg = screenSaverInterface.setup();
       args->clear();
       dlg->exec();
       delete dlg;
       return 0;
    }

    if (args->isSet("window-id"))
    {
#ifdef Q_WS_WIN
        saveWin = (HWND)(args->getOption("window-id").toULong());
#else
        saveWin = args->getOption("window-id").toInt();
#endif
    }

#ifdef Q_WS_X11 //FIXME
    if (args->isSet("root"))
    {
		QX11Info inf;
        saveWin = RootWindow(QX11Info::display(), inf.screen());
    }
#endif

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

    if (saveWin == 0)
    {
        demoWidget = new DemoWindow();
        demoWidget->setAttribute(Qt::WA_NoSystemBackground);
        demoWidget->setAttribute(Qt::WA_PaintOnScreen);
        demoWidget->show();
        app.processEvents();
        saveWin = demoWidget->winId();
    }

    target = screenSaverInterface.create( saveWin );
    target->setAttribute(Qt::WA_PaintOnScreen);
    target->show();

    if (demoWidget)
    {
        target->installEventFilter( demoWidget );
    }

    args->clear();
    app.exec();

    delete target;
    delete demoWidget;

    return 0;
}