Esempio n. 1
0
QString Logger::path()
{
    QDir dir;
    QString path = KStandardDirs::locateLocal("data", "lancelot", true);
    if (!path.endsWith('/')) {
        path += '/';
    }
    path += "log/";

    if (!dir.exists(path)) {
        if (!dir.mkpath(path)) {
            return QString();
        }

        KNotification * notify = new KNotification("UsageLoggingOn");
        notify->setText(i18n("Usage logging is activated."));
        notify->setPixmap(KIcon("view-history").pixmap(KIconLoader::SizeMedium, KIconLoader::SizeMedium));
        notify->setActions(QStringList(i18n("Configure")));

        QObject::connect(notify, SIGNAL(activated(uint)), Logger::self(), SLOT(configureMenu()));

        notify->sendEvent();
    }

    QDate date = QDate::currentDate();
    path += "log-" + QString::number(date.year())
            + '-' + QString::number(date.month());

    return path;
}
Esempio n. 2
0
/**
 * Method used to display menu.
 */
void Menu::showMenu()
{
	bool quit = false;
	try
	{
		configureMenu("fonts/arial.ttf", "Data/background.bmp", 20);
	} catch (FontException font)
	{
		//AllocConsole();
		//freopen("CONOUT$", "wb", stdout);
		std::cout << "Nieprawidlowa sciezka do czcionki. Zakonczenie aplikacji.\n";
		//system("pause");
		//fclose(stdout);
		//FreeConsole();
		exit(0);
	} catch (TextCreationException text)
	{
		///AllocConsole();
		//freopen("CONOUT$", "wb", stdout);
		std::cout << "Brak mozliwosci inicjalizacji czcionek. Zakonczenie aplikacji.\n";
		//system("pause");
		//fclose(stdout);
		//FreeConsole();
		exit(0);
	}
	displayMenuBackground();
	stateContext->printMenu(font, screen);
	while( !quit ) 
	{
		SDL_Event event;
		if( SDL_PollEvent( &event ) ) 
		{
			switch( event.type ) 
			{
				case SDL_KEYDOWN: 
				{
					int key = event.key.keysym.sym;
					if( key == SDLK_UP)
					{
						menuUp();
						displayMenuBackground();
						stateContext->printMenu(font, screen);
						continue;
					}
					if( key == SDLK_DOWN)
					{
						menuDown();
						displayMenuBackground();
						stateContext->printMenu(font, screen);
						continue;
					}
					if ( key == SDLK_RETURN )
					{
						quit = stateContext->performAction();
						if (!quit)
						{
							displayMenuBackground();
							stateContext->printMenu(font, screen);
							continue;
						}
					}
					if( key == SDLK_ESCAPE ) 
					{
						quit = stateContext->performQuitMenuAction();
					}
					break;
				}
			}
		}
	}
}