1 #include <QtCore/QDebug> //Debug pro informace
2 #include <QtCore/QSettings>
3 #include <QtCore/QTimer>
4 #include "timeprofile.h"
5 #include "timedprofildialog.h"
6 #include <QtCore/QStringList>
7 #include <QtCore/QTime>
11 TimeProfile::TimeProfile(QWidget *parent,QSettings *set) :
15 timer = new QTimer(this);
16 timer->setSingleShot(true);//A single-shot timer fires only once
17 connect(timer,SIGNAL(timeout()),this,SLOT(TimerTimeout()));
23 void TimeProfile::SetTimer(QStringList list_of_profiles_n)
25 TimedProfilDialog dialog(list_of_profiles_n, this);
26 int result = dialog.exec();
30 // dialog.GetTime().msec()
31 //qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << "time:" << dialog.GetTime() ;
32 //qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << "different:" << nula_cas.msecsTo(dialog.GetTime());
33 if(dialog.GetTime() == nula_cas){
35 profile = QString("");
36 emit s_set_timed_profile(QString(""));//send empty string
39 timer->start(nula_cas.msecsTo(dialog.GetTime()));
40 profile = dialog.GetName();
41 emit s_set_timed_profile(profile);
48 void TimeProfile::TimerTimeout()
50 //qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << "timer timeout" ;
51 profile = QString("");
52 emit s_set_timed_profile(QString(""));//send empty string
56 When profiles change , find profile
57 if not exist stop this profile
59 void TimeProfile::ChangeInProfles(QStringList list_profiles)
61 if(!list_profiles.contains(profile))
64 emit s_set_timed_profile(QString(""));//send empty string