1 #include "timedprofildialog.h"
2 #include "ui_timedprofildialog.h"
3 #include <QMaemo5ValueButton>
4 #include <QMaemo5ListPickSelector>
5 #include <QMaemo5InformationBox>
6 #include <QMaemo5TimePickSelector>
7 #include <QtCore/QStringList>
9 #include <QtGui/QStandardItemModel>
11 #include <QtCore/QDebug> //Debug pro informace
12 TimedProfilDialog::TimedProfilDialog(QStringList list,QWidget *parent) :
14 ui(new Ui::TimedprofilDialog)
18 createNewMaemoButtons(list);
22 /** createNewMaemoButtons()
25 void TimedProfilDialog::createNewMaemoButtons(QStringList list)
27 QStandardItemModel *testmodel = new QStandardItemModel(this);
28 for (int i = 0; i < list.size(); ++i)
29 testmodel->appendRow(new QStandardItem(list.at(i)));
31 v1 = new QMaemo5ValueButton(tr("Name of profile"), this);
32 v1->setValueLayout(QMaemo5ValueButton::ValueBesideText);
33 list_pick = new QMaemo5ListPickSelector();
34 list_pick->setModel(testmodel);
35 v1->setPickSelector(list_pick);
36 ui->gridLayout->addWidget(v1,0,1);
38 v2 = new QMaemo5ValueButton(tr("Time"),this);
39 v2->setValueLayout(QMaemo5ValueButton::ValueBesideText);
40 time_pick = new QMaemo5TimePickSelector();
41 time_pick->setCurrentTime(QTime(0,0));//0 hours, 0 min
42 v2->setPickSelector(time_pick);
43 ui->gridLayout->addWidget(v2,1,1);
49 void TimedProfilDialog::createNewLabels()
51 QLabel * label_name = new QLabel(this);
52 label_name->setObjectName(QString::fromUtf8("label_name"));
54 font.setPointSize(17);
55 label_name->setFont(font);
56 label_name->setText(tr("Name of profile"));
57 ui->gridLayout->addWidget(label_name, 0, 0);
58 QLabel *label_time = new QLabel(this);
59 label_time->setObjectName(QString::fromUtf8("label_time"));
60 label_time->setFont(font);
61 label_time->setText(tr("Select time"));
62 ui->gridLayout->addWidget(label_time, 1, 0);
66 TimedProfilDialog::~TimedProfilDialog()
72 Slot for signal when user click on save button.
73 Check is everyting is OK
75 void TimedProfilDialog::accept()
77 qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << " Profile is:" << list_pick->currentValueText();
78 qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << " Time is : " << time_pick->currentValueText();
79 time_for_set = time_pick->currentTime();
81 name_of_profile = list_pick->currentValueText();
82 if(name_of_profile.isEmpty())
84 QMaemo5InformationBox::information(this, tr("Select profile"), QMaemo5InformationBox::DefaultTimeout);
89 qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << "Hours: " << time_for_set.hour() << "min " << time_for_set.minute();
90 qDebug() << "In file:" << __FILE__ << ":" << "on line:" << __LINE__ << " in function:" << __FUNCTION__ << "text::" << "sec to" << nula_cas.secsTo(time_for_set);
91 done(QDialog::Accepted);
95 Return time from time picker
97 QTime TimedProfilDialog::GetTime()
103 Return name from list picker
105 QString TimedProfilDialog::GetName()
107 return name_of_profile;
110 void TimedProfilDialog::changeEvent(QEvent *e)
112 QDialog::changeEvent(e);
114 case QEvent::LanguageChange:
115 ui->retranslateUi(this);