UI changes to improve usability, French translation update and bump to v0.4
authorChristophe Dumez <dchris@gmail.com>
Tue, 6 Jul 2010 22:17:32 +0000 (00:17 +0200)
committerChristophe Dumez <dchris@gmail.com>
Tue, 6 Jul 2010 22:17:32 +0000 (00:17 +0200)
Changelog
TimedSilencer.pro.user
lang/timedsilencer_en.ts
lang/timedsilencer_fr.qm
lang/timedsilencer_fr.ts
lang/timedsilencer_zh.qm
lang/timedsilencer_zh.ts
mainwindow.cpp
mainwindow.h

index ac1f872..08aebcd 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,6 @@
+* 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
 
index 9a63204..7eea5c4 100644 (file)
      <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>
index a4b6c38..976d855 100644 (file)
@@ -4,28 +4,33 @@
 <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>
index fdce28a..ca39b43 100644 (file)
Binary files a/lang/timedsilencer_fr.qm and b/lang/timedsilencer_fr.qm differ
index 2f060f5..2c30e91 100644 (file)
 <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>
index 702b525..4d5655e 100644 (file)
Binary files a/lang/timedsilencer_zh.qm and b/lang/timedsilencer_zh.qm differ
index 8e40105..fefcab0 100644 (file)
 <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>
index 9506049..dc2acd0 100644 (file)
 #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() {
@@ -79,16 +98,14 @@ 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);
   }
 }
 
index 9fbfb39..375ab19 100644 (file)
@@ -22,6 +22,8 @@
 
 struct QMaemo5ValueButton;
 struct QAction;
+struct QCheckBox;
+struct QPushButton;
 
 class MainWindow : public QMainWindow {
   Q_OBJECT
@@ -30,6 +32,9 @@ public:
   explicit MainWindow(QWidget *parent = 0);
   ~MainWindow();
 
+protected:
+  void closeEvent(QCloseEvent *event);
+
 protected slots:
   void saveSettings();
   void loadSettings();
@@ -39,6 +44,8 @@ protected slots:
 private:
   QMaemo5ValueButton *from_button, *to_button;
   QAction *active_action;
+  QCheckBox *cb_enable;
+  QPushButton *done_btn;
 };
 
 #endif // MAINWINDOW_H