Exemplo n.º 1
0
int settingsHighlight()
{
	u32 kDown = hidKeysDown();

	if (touch.px  >= 0 && touch.px  <= 198 && touch.py >= 75 && touch.py <= 133)
	{
		sf2d_draw_texture(wifi_highlight, 0, 87);
		sftd_draw_textf(roboto, 48, 106, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][0]);
		/*if (kDown & KEY_A)
		{
			settingsUnload();
		}*/
	}
	else if (touch.px  >= 0 && touch.px  <= 198 && touch.py >= 134 && touch.py <= 174)
	{
		sf2d_draw_texture(display_highlight, 0, 135);
		sftd_draw_textf(roboto, 48, 153, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][1]);
		/*if (kDown & KEY_A)
		{
			settingsUnload();
		}*/
	}
	else if (touch.px  >= 0 && touch.px  <= 198 && touch.py >= 175 && touch.py <= 240)
	{
		sf2d_draw_texture(developeroptions_highlight, 0, 183);
		sftd_draw_textf(roboto, 48, 202, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][2]);
		/*if (kDown & KEY_A)
		{
			settingsUnload();
		}*/
	}
	else if (touch.px  >= 203 && touch.px  <= 400 && touch.py >= 75 && touch.py <= 133)
	{
		sf2d_draw_texture(security_highlight, 199, 87);
		sftd_draw_textf(roboto, 250, 106, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][3]);
		/*if (kDown & KEY_A)
		{
			settingsUnload();
		}*/
	}
	else if (touch.px  >= 203 && touch.px  <= 400 && touch.py >= 134 && touch.py <= 174)
	{
		sf2d_draw_texture(performance_highlight, 203, 135);
		sftd_draw_textf(roboto, 250, 153, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][4]);
		/*if (kDown & KEY_A)
		{
			settingsUnload();
		}*/
	}
	else if (touch.px  >= 203 && touch.px  <= 400 && touch.py >= 175 && touch.py <= 240)
	{
		sf2d_draw_texture(about_highlight, 203, 183);
		sftd_draw_textf(roboto, 250, 202, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][5]);
		if (kDown & KEY_TOUCH)
		{
			settingsUnload();
			aboutMenu();
		}
	}
	
	return 0;
}
Exemplo n.º 2
0
Tomatime::Tomatime(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Tomatime)
{
    QCoreApplication::setOrganizationName("Tomatime");
    QCoreApplication::setOrganizationDomain("github.com");
    QCoreApplication::setApplicationName("tomatime");

    ui->setupUi(this);

    // Don't forget to define this
    timer = new QTimer(this);
    timeValue = new QTime();
    restoreAction = new QAction(this);
    quitAction = new QAction(this);
    trayIcon = new QSystemTrayIcon(this);
    trayIconMenu = new QMenu(this);

    // Init Child Dialog
    settingDialog = new Settings(this);
    aboutWidget = new About(this);

    // Initialize value from setting
    QSettings setting;

    setWorkingTime( (setting.value("time/working").isNull() == true ) ? setting.value("time/break", 25).toInt() : setting.value("time/working").toInt() );
    setBreakTime( (setting.value("time/break").isNull() == true ) ? setting.value("time/break", 5).toInt() : setting.value("time/break").toInt() );
    setLongBreakTime( (setting.value("time/longbreak").isNull() ) ? setting.value("time/longbreak", 10).toInt() : setting.value("time/longbreak").toInt() );


    connect(ui->start_button, SIGNAL(clicked()),this, SLOT(clickedStartButton()));
    connect(ui->settings_button, SIGNAL(clicked()),this, SLOT(clickedSettingsButton()));
    connect(ui->stop_button, SIGNAL(clicked()),this, SLOT(clickedStopButton()));

    connect(ui->actionSettings, SIGNAL(triggered()),this,SLOT(settingsMenu()));
    connect(ui->actionAbout, SIGNAL(triggered()),this,SLOT(aboutMenu()));

    // Listen signal from setting
    connect(settingDialog,SIGNAL(emitWorkingTimeValue(int)),this,SLOT(setWorkingTime(int)));
    connect(settingDialog,SIGNAL(emitBreakTimeValue(int)),this,SLOT(setBreakTime(int)));
    connect(settingDialog,SIGNAL(emitLongBreakTimeValue(int)),this,SLOT(setLongBreakTime(int)));
    connect(settingDialog,SIGNAL(emitSetTimer(int,int)),this,SLOT(setTimer(int,int)));

    // Recenter form
    QRect position = frameGeometry();
    position.moveCenter(QDesktopWidget().availableGeometry().center());
    move(position.topLeft());

    // Init LCD
    ui->lcdNumber->display(QTime(0,getWorkingTime(),0).toString());

    // Init working count
    workingCount = 0;

    // Init Timer mode
    // 0 = Working
    // 1 = Short Break
    // 2 = Long Break
    timerMode = 0;

    // Init System tray
    createActions();
    createTrayIcon();
    trayIcon->show();

}