X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=timeprofile.cpp;fp=timeprofile.cpp;h=775a1182958cdf9b1789d1964336bf891626ad9c;hb=23b75b4fd9e13840b977617446a3887a54a77bc1;hp=0000000000000000000000000000000000000000;hpb=ef70148faf8124c557b1bb8dd2c29142759ea45b;p=n9profile diff --git a/timeprofile.cpp b/timeprofile.cpp new file mode 100644 index 0000000..775a118 --- /dev/null +++ b/timeprofile.cpp @@ -0,0 +1,67 @@ +#include //Debug pro informace +#include +#include +#include "timeprofile.h" +#include "timedprofildialog.h" +#include +#include +/** TimeProfile() +create new labels +*/ +TimeProfile::TimeProfile(QWidget *parent,QSettings *set) : + QWidget(parent) +{ + settings = set; + timer = new QTimer(this); + timer->setSingleShot(true);//A single-shot timer fires only once + connect(timer,SIGNAL(timeout()),this,SLOT(TimerTimeout())); +} + +/** SetTimer() +create new labels +*/ +void TimeProfile::SetTimer(QStringList list_of_profiles_n) +{ + TimedProfilDialog dialog(list_of_profiles_n, this); + int result = dialog.exec(); + if(result) + { + QTime nula_cas(0,0); + // dialog.GetTime().msec() + //qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << "time:" << dialog.GetTime() ; + //qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << "different:" << nula_cas.msecsTo(dialog.GetTime()); + if(dialog.GetTime() == nula_cas){ + timer->stop(); + profile = QString(""); + emit s_set_timed_profile(QString(""));//send empty string + return; + } + timer->start(nula_cas.msecsTo(dialog.GetTime())); + profile = dialog.GetName(); + emit s_set_timed_profile(profile); + } +} + +/** TimerTimeout() +timer timeout slot +*/ +void TimeProfile::TimerTimeout() +{ + //qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << "timer timeout" ; + profile = QString(""); + emit s_set_timed_profile(QString(""));//send empty string +} + +/** ChangeInProfles() +When profiles change , find profile +if not exist stop this profile +*/ +void TimeProfile::ChangeInProfles(QStringList list_profiles) +{ + if(!list_profiles.contains(profile)) + { + timer->stop(); + emit s_set_timed_profile(QString(""));//send empty string + } +} +