+* Mon Jul 7 2010 - Christophe Dumez <dchris@gmail.com> - v0.4
+ - UI changes to improve usability
+
* Mon Jul 5 2010 - Christophe Dumez <dchris@gmail.com> - v0.3
- Edited project file to make packaging easier
<value key="192.168.1.4" type="QDateTime">2010-06-26T16:09:16</value>
<value key="localhost" type="QDateTime">2010-06-26T16:55:11</value>
</valuemap>
- <value key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId" type="qulonglong">8</value>
+ <value key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId" type="qulonglong">16</value>
<valuemap key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployed" type="QVariantMap">
<value key="192.168.1.4" type="QDateTime">2010-06-29T00:09:20</value>
- <value key="localhost" type="QDateTime">2010-06-28T20:15:39</value>
+ <value key="localhost" type="QDateTime">2010-07-07T00:05:11</value>
</valuemap>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
<context>
<name>MainWindow</name>
<message>
- <location filename="../mainwindow.cpp" line="34"/>
- <source>Use silent profile between</source>
+ <location filename="../mainwindow.cpp" line="39"/>
+ <source>Use the silent profile between</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="40"/>
+ <location filename="../mainwindow.cpp" line="45"/>
<source>and</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="48"/>
- <source>Enabled</source>
+ <location filename="../mainwindow.cpp" line="53"/>
+ <source>Activated</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="57"/>
- <source>The timed silencer is enabled</source>
+ <location filename="../mainwindow.cpp" line="58"/>
+ <source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="60"/>
- <source>The timed silencer is disabled</source>
+ <location filename="../mainwindow.cpp" line="79"/>
+ <source>The daily profile switching is activated</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="82"/>
+ <source>The daily profile switching is deactivated</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
- <location filename="../mainwindow.cpp" line="34"/>
<source>Use silent profile between</source>
+ <translation type="obsolete">Utiliser le profil silencieux entre</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="39"/>
+ <source>Use the silent profile between</source>
<translation>Utiliser le profil silencieux entre</translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="40"/>
+ <location filename="../mainwindow.cpp" line="45"/>
<source>and</source>
<translation>et</translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="48"/>
- <source>Enabled</source>
+ <location filename="../mainwindow.cpp" line="53"/>
+ <source>Activated</source>
<translation>Activé</translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="57"/>
+ <location filename="../mainwindow.cpp" line="58"/>
+ <source>Save</source>
+ <translation>Enregistrer</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="79"/>
+ <source>The daily profile switching is activated</source>
+ <translation>Le changement de profil journalier est activé</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="82"/>
+ <source>The daily profile switching is deactivated</source>
+ <translation>Le changement de profil journalier est désactivé</translation>
+ </message>
+ <message>
+ <source>Enabled</source>
+ <translation type="obsolete">Activé</translation>
+ </message>
+ <message>
<source>The timed silencer is enabled</source>
- <translation>La mise en silence automatique est activée</translation>
+ <translation type="obsolete">La mise en silence automatique est activée</translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="60"/>
<source>The timed silencer is disabled</source>
- <translation>La mise en silence automatique est désactivée</translation>
+ <translation type="obsolete">La mise en silence automatique est désactivée</translation>
</message>
<message>
<source>The Timed Silencer is now enabled</source>
<context>
<name>MainWindow</name>
<message>
- <location filename="../mainwindow.cpp" line="34"/>
<source>Use silent profile between</source>
- <translation>使用静音模式时段</translation>
+ <translation type="obsolete">使用静音模式时段</translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="40"/>
+ <location filename="../mainwindow.cpp" line="39"/>
+ <source>Use the silent profile between</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="45"/>
<source>and</source>
<translation>至</translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="48"/>
+ <location filename="../mainwindow.cpp" line="53"/>
+ <source>Activated</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="58"/>
+ <source>Save</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="79"/>
+ <source>The daily profile switching is activated</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="82"/>
+ <source>The daily profile switching is deactivated</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>Enabled</source>
- <translation>启用</translation>
+ <translation type="obsolete">启用</translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="57"/>
<source>The timed silencer is enabled</source>
- <translation>定时静音器已启用</translation>
+ <translation type="obsolete">定时静音器已启用</translation>
</message>
<message>
- <location filename="../mainwindow.cpp" line="60"/>
<source>The timed silencer is disabled</source>
- <translation>定时静音器已禁用</translation>
+ <translation type="obsolete">定时静音器已禁用</translation>
</message>
<message>
<source>The Timed Silencer is now enabled</source>
#include <QVBoxLayout>
#include <QLabel>
#include <QSpacerItem>
-#include <QMenuBar>
#include <QSettings>
+#include <QCheckBox>
+#include <QPushButton>
+#include <QHBoxLayout>
+#include <QCloseEvent>
#include "mainwindow.h"
#include "alarmd_backend.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
setCentralWidget(new QWidget());
- QVBoxLayout *verticalLayout = new QVBoxLayout(centralWidget());
- QLabel *from_lbl = new QLabel(tr("Use silent profile between"));
+ QHBoxLayout *hori_layout = new QHBoxLayout(centralWidget());
+ QVBoxLayout *verticalLayoutL = new QVBoxLayout();
+ verticalLayoutL->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ QLabel *from_lbl = new QLabel(tr("Use the silent profile between"));
from_lbl->setAlignment(Qt::AlignHCenter);
- verticalLayout->addWidget(from_lbl);
+ verticalLayoutL->addWidget(from_lbl);
from_button = new QMaemo5ValueButton();
from_button->setPickSelector(new QMaemo5TimePickSelector());
- verticalLayout->addWidget(from_button);
+ verticalLayoutL->addWidget(from_button);
QLabel *to_lbl = new QLabel(tr("and"));
to_lbl->setAlignment(Qt::AlignHCenter);
- verticalLayout->addWidget(to_lbl);
+ verticalLayoutL->addWidget(to_lbl);
to_button = new QMaemo5ValueButton();
to_button->setPickSelector(new QMaemo5TimePickSelector());
- verticalLayout->addWidget(to_button);
- verticalLayout->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
- // Menu actions
- active_action = menuBar()->addAction(tr("Enabled"));
- active_action->setCheckable(true);
+ verticalLayoutL->addWidget(to_button);
+ // Status
+ verticalLayoutL->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ cb_enable = new QCheckBox(tr("Activated"));
+ verticalLayoutL->addWidget(cb_enable);
+ hori_layout->addLayout(verticalLayoutL);
+ QVBoxLayout *verticalLayoutR = new QVBoxLayout;
+ verticalLayoutR->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ done_btn = new QPushButton(tr("Save"));
+ done_btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ connect(done_btn, SIGNAL(clicked()), this, SLOT(close()));
+ verticalLayoutR->addWidget(done_btn);
+ hori_layout->addLayout(verticalLayoutR);
// Load settings
loadSettings();
- connect(active_action, SIGNAL(triggered(bool)), this, SLOT(enableSilencing(bool)));
+ connect(cb_enable, SIGNAL(toggled(bool)), this, SLOT(enableSilencing(bool)));
// Auto rotation
setAttribute(Qt::WA_Maemo5AutoOrientation, true);
}
MainWindow::~MainWindow() {
- if(active_action->isChecked()) {
- QMaemo5InformationBox::information(this, tr("The timed silencer is enabled"), 0);
+ delete from_button;
+ delete to_button;
+ delete cb_enable;
+ delete done_btn;
+}
+
+void MainWindow::closeEvent(QCloseEvent *event) {
+ if(cb_enable->isChecked()) {
+ QMaemo5InformationBox::information(this, tr("The daily profile switching is activated"), 0);
setProfileEvents();
} else {
- QMaemo5InformationBox::information(this, tr("The timed silencer is disabled"), 0);
+ QMaemo5InformationBox::information(this, tr("The daily profile switching is deactivated"), 0);
}
saveSettings();
- delete from_button;
- delete to_button;
+ event->accept();
}
void MainWindow::saveSettings() {
QSettings settings("TimedSilencer", "TimedSilencer");
settings.setValue("from_time", static_cast<QMaemo5TimePickSelector*>(from_button->pickSelector())->currentTime());
settings.setValue("to_time", static_cast<QMaemo5TimePickSelector*>(to_button->pickSelector())->currentTime());
- settings.setValue("enabled", active_action->isChecked());
+ settings.setValue("enabled", cb_enable->isChecked());
}
void MainWindow::loadSettings() {
static_cast<QMaemo5TimePickSelector*>(from_button->pickSelector())->setCurrentTime(from_time);
QTime to_time = settings.value("to_time", QTime(8, 0)).toTime();
static_cast<QMaemo5TimePickSelector*>(to_button->pickSelector())->setCurrentTime(to_time);
- active_action->setChecked(settings.value("enabled", true).toBool());
+ cb_enable->setChecked(settings.value("enabled", true).toBool());
}
void MainWindow::enableSilencing(bool enabled) {
if(enabled) {
setProfileEvents();
- //QMaemo5InformationBox::information(this, tr("The Timed Silencer is now enabled"), QMaemo5InformationBox::DefaultTimeout);
} else {
AlarmdBackend::deleteEvents();
- //QMaemo5InformationBox::information(this, tr("The Timed Silencer is now disabled"), QMaemo5InformationBox::DefaultTimeout);
}
}
struct QMaemo5ValueButton;
struct QAction;
+struct QCheckBox;
+struct QPushButton;
class MainWindow : public QMainWindow {
Q_OBJECT
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
+protected:
+ void closeEvent(QCloseEvent *event);
+
protected slots:
void saveSettings();
void loadSettings();
private:
QMaemo5ValueButton *from_button, *to_button;
QAction *active_action;
+ QCheckBox *cb_enable;
+ QPushButton *done_btn;
};
#endif // MAINWINDOW_H