[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/clock
From:       Anne-Marie Mahfouf <annma () kde ! org>
Date:       2007-06-19 7:20:08
Message-ID: 1182237608.208208.25957.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 677455 by annma:

replace config dialog code by a Designer file
remove "TZ Mania" checkbox 


 M  +1 -0      CMakeLists.txt  
 M  +13 -44    clock.cpp  
 M  +3 -8      clock.h  
 A             clockConfig.ui  


--- trunk/KDE/kdebase/workspace/plasma/applets/clock/CMakeLists.txt #677454:677455
@@ -5,6 +5,7 @@
     clock.cpp)
 
 kde4_automoc(${clock_SRCS})
+kde4_add_ui_files(clock_SRCS clockConfig.ui )
 kde4_add_plugin(plasma_applet_clock ${clock_SRCS})
 target_link_libraries(plasma_applet_clock plasma ${KDE4_KIO_LIBS})
 set_target_properties(plasma_applet_clock PROPERTIES VERSION 1.0.0 SOVERSION 1)
--- trunk/KDE/kdebase/workspace/plasma/applets/clock/clock.cpp #677454:677455
@@ -47,9 +47,7 @@
 
 Clock::Clock(QObject *parent, const QStringList &args)
     : Plasma::Applet(parent, args),
-      m_dialog(0),
-      m_showTimeStringCheckBox(0),
-      m_spinSize(0)
+      m_dialog(0)
 {
     setFlags(QGraphicsItem::ItemIsMovable);
 
@@ -97,54 +95,30 @@
         m_dialog = new KDialog;
         m_dialog->setCaption( "Configure Clock" );
 
-        //TODO: use a Designer layout!
+        ui.setupUi(m_dialog->mainWidget());
         m_dialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
         connect( m_dialog, SIGNAL(applyClicked()), this, SLOT(configAccepted()) );
         connect( m_dialog, SIGNAL(okClicked()), this, SLOT(configAccepted()) );
 
-        QWidget* configWidget = new QWidget(m_dialog);
-
-        m_timeZones = new KTimeZoneWidget(configWidget);
-        m_swapTzs = new QCheckBox("TZ Mania!", configWidget);
-
-        m_showSecondHandCheckBox = new QCheckBox("Display seconds", configWidget);
-        m_showTimeStringCheckBox = new QCheckBox("Also display the time in text", configWidget);
-        m_spinSize = new QSpinBox;
-        QLabel *labelSize = new QLabel("Size of the clock");
-
-        QHBoxLayout *sizeLay = new QHBoxLayout;
-        sizeLay->addWidget(m_spinSize);
-        sizeLay->addWidget(labelSize);
-        QVBoxLayout *lay = new QVBoxLayout(configWidget);
-        lay->addWidget(m_timeZones);
-        lay->addWidget(m_swapTzs);
-        lay->addWidget(m_showSecondHandCheckBox);
-        lay->addWidget(m_showTimeStringCheckBox);
-        lay->addLayout(sizeLay);
-
-        m_dialog->setMainWidget(configWidget);
+	ui.timeZones->setSelected(m_timezone, true);
+	ui.spinSize->setValue((int)m_bounds.width());
+	ui.showTimeStringCheckBox->setChecked(m_showTimeString);
+	ui.showSecondHandCheckBox->setChecked(m_showSecondHand);
     }
-
-    m_timeZones->setSelected(m_timezone, true);
-    m_spinSize->setRange(0, 500);
-    m_spinSize->setValue((int)m_bounds.width());
-    m_showTimeStringCheckBox->setChecked(m_showTimeString);
-    m_showSecondHandCheckBox->setChecked(m_showSecondHand);
-
     m_dialog->show();
 }
 
 void Clock::configAccepted()
 {
     KConfigGroup cg = appletConfig();
-    m_showTimeString = m_showTimeStringCheckBox->checkState() == Qt::Checked;
-    m_showSecondHand = m_showSecondHandCheckBox->checkState() == Qt::Checked;
+    m_showTimeString = ui.showTimeStringCheckBox->checkState() == Qt::Checked;
+    m_showSecondHand = ui.showSecondHandCheckBox->checkState() == Qt::Checked;
     cg.writeEntry("showTimeString", m_showTimeString);
     cg.writeEntry("showSecondHand", m_showSecondHand);
     QGraphicsItem::update();
-    cg.writeEntry("size", m_spinSize->value());
-    m_theme->resize(m_spinSize->value(), m_spinSize->value());
-    QStringList tzs = m_timeZones->selection();
+    cg.writeEntry("size", ui.spinSize->value());
+    m_theme->resize(ui.spinSize->value(), ui.spinSize->value());
+    QStringList tzs = ui.timeZones->selection();
     /*
     if (tzs.count() > 0) {
         //TODO: support multiple timezones
@@ -160,13 +134,8 @@
         dataEngine("time")->connectSource(m_timezone, this);
     }
     */
-        dataEngine("time")->disconnectSource(m_timezone, this);
-    if (m_swapTzs->checkState() == Qt::Checked) {
-        m_timezone = "America/Toronto";
-    } else {
-        m_timezone = i18n("Local");
-    }
-        dataEngine("time")->connectSource(m_timezone, this);
+
+    dataEngine("time")->connectSource(m_timezone, this);
     constraintsUpdated();
     cg.config()->sync();
 }
--- trunk/KDE/kdebase/workspace/plasma/applets/clock/clock.h #677454:677455
@@ -36,13 +36,11 @@
 
 #include <plasma/applet.h>
 #include <plasma/dataengine.h>
+#include "ui_clockConfig.h"
 
 class QTimer;
-class QCheckBox;
-class QSpinBox;
 
 class KDialog;
-class KTimeZoneWidget;
 
 namespace Plasma
 {
@@ -80,11 +78,8 @@
         Plasma::Svg* m_theme;
         QTime m_time;
         KDialog *m_dialog; //should we move this into another class?
-        QCheckBox *m_showTimeStringCheckBox;
-        QCheckBox *m_showSecondHandCheckBox;
-        QCheckBox *m_swapTzs;
-        QSpinBox *m_spinSize;
-        KTimeZoneWidget *m_timeZones;
+	/// Designer Config file
+	Ui::clockConfig ui;
 };
 
 K_EXPORT_PLASMA_APPLET(clock, Clock)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic