Esempio n. 1
0
Setting::Setting(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Setting)
{
    ui->setupUi(this);
    this->setWindowTitle("Settings");
    this->setMaximumSize(543,441);
    this->setMinimumSize(543,441);
    readTxt();
    connect(ui->applyButton,SIGNAL(clicked()),this,SLOT(applySlot()));
    connect(ui->okButton,SIGNAL(clicked()),this,SLOT(okSlot()));
}
Esempio n. 2
0
bool IexFmncFab::readTxtFile(
			const string& fullpath
		) {
	bool retval;

	Txtrd rd(VecVIme::getIx);

	rd.openFile(fullpath);

	retval = readTxt(rd);

	rd.closeFile();

	return retval;
};
Esempio n. 3
0
int MainWindow::ShowMessage()//通知提示函数
{
    readTxt();
    systemTime = QDateTime::currentDateTime();
    QString week = systemTime.toString("dddd");

    if(contains.contains(week.at(2)))
    {
        QTime n1(h1,m1,0);
        i = QTime::currentTime().secsTo(n1);
        shutdownString = ".Power will be off at "+QString::number(h1)+":"+QString::number(m1)+"; ";
        command = "shutdown -s -t " + QString::number(i);
        p.execute(command);
    }
    else
    {
        if(judge == 0)
        {
            QTime n2(h2,m2,0);
            i = QTime::currentTime().secsTo(n2);
            shutdownString = ".Power will be off at "+QString::number(h2)+":"+QString::number(m2)+"; ";
            command = "shutdown -s -t " + QString::number(i);
            p.execute(command);
        }
        else
        {
            p.execute("shutdown -a");
            tray->showMessage("PowerSet","There is no plan for today.",QSystemTrayIcon::Information,1500);
            return 0;
        }
    }



    int seconds,minutes,hours;
    seconds = i;
    hours = seconds / 3600;
    minutes = (seconds - 3600*hours)/60;
    seconds = (seconds - 3600*hours - 60*minutes);

    tray->showMessage("PowerSet","Today is "+systemTime.toString("dddd")+shutdownString
                      +QString::number(hours)+" hours, "+QString::number(minutes)+" minutes, "
                      +QString::number(seconds)+" seconds left.",QSystemTrayIcon::Information,2000);
    return 1;
}