[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: [Panel-devel] digital clock improvements
From: Sebastian =?utf-8?q?K=C3=BCgler?= <sebas () kde ! org>
Date: 2007-07-25 14:12:25
Message-ID: 200707251612.25811.sebas () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
Hi Ruphy,
Here's a patch which does the following:
- Remove options to show seconds (specifically, don't animate the minute
display every second, remove corresponding UI, config options and members
- Remove scrollbards from TimeZoneWidget by setting the dialog's minimumSize
- Clean up headers big time (there's quite some -- I think -- unnecessary
headers included)
Can I commit this? Comment is otherwise welcome.
--
sebas
http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
["digital-clock-no-seconds.diff" (text/x-diff)]
Index: clock.h
===================================================================
--- clock.h (revision 692323)
+++ clock.h (working copy)
@@ -21,18 +21,9 @@
#ifndef CLOCK_H
#define CLOCK_H
-#include <QImage>
-#include <QPaintDevice>
-#include <QLabel>
-#include <QPixmap>
-#include <QTimer>
-#include <QPaintEvent>
-#include <QPainter>
#include <QTime>
#include <QDate>
#include <QX11Info>
-#include <QGraphicsItem>
-#include <QColor>
#include <plasma/applet.h>
#include <plasma/dataengine.h>
@@ -71,8 +62,6 @@
private:
void animateUpdate();
- bool m_showTimeString;
- bool m_showSecondHand;
QRectF m_bounds;
int m_pixelSize;
QString m_timezone;
Index: clock.cpp
===================================================================
--- clock.cpp (revision 692323)
+++ clock.cpp (working copy)
@@ -23,18 +23,8 @@
#include <math.h>
-#include <QApplication>
-#include <QBitmap>
-#include <QGraphicsScene>
-#include <QMatrix>
-#include <QPaintEvent>
#include <QPainter>
-#include <QPixmap>
#include <QStyleOptionGraphicsItem>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QCheckBox>
-#include <QPushButton>
#include <QSpinBox>
#include <QTimeLine>
@@ -58,8 +48,6 @@
setDrawStandardBackground(true);
KConfigGroup cg = config();
- m_showTimeString = cg.readEntry("showTimeString", false);
- m_showSecondHand = cg.readEntry("showSecondHand", false);
m_timezone = cg.readEntry("timezone", "Local");
m_theme = new Plasma::Svg("widgets/digital-clock", this);
m_theme->setContentType(Plasma::Svg::ImageSet);
@@ -67,7 +55,7 @@
Plasma::DataEngine* timeEngine = dataEngine("time");
timeEngine->connectSource(m_timezone, this);
- timeEngine->setProperty("reportSeconds", m_showSecondHand);
+ timeEngine->setProperty("reportSeconds", false);
constraintsUpdated();
}
@@ -97,8 +85,7 @@
m_time = data["Time"].toTime();
m_date = data["Date"].toDate();
- if (m_time.minute() == m_lastTimeSeen.minute() &&
- m_time.second() == m_lastTimeSeen.second()) {
+ if (m_time.minute() == m_lastTimeSeen.minute()) {
// avoid unnecessary repaints
//kDebug() << "avoided unecessary update!" << endl;
return;
@@ -119,21 +106,13 @@
connect( m_dialog, SIGNAL(okClicked()), this, SLOT(configAccepted()) );
ui.timeZones->setSelected(m_timezone, true);
- ui.spinSize->setValue((int)m_bounds.width());
- ui.showTimeStringCheckBox->setChecked(m_showTimeString);
- ui.showSecondHandCheckBox->setChecked(m_showSecondHand);
- }
+ ui.spinSize->setValue((int)m_bounds.width()); }
m_dialog->show();
}
void Clock::configAccepted()
{
KConfigGroup cg = config();
- m_showTimeString = ui.showTimeStringCheckBox->checkState() == Qt::Checked;
- m_showSecondHand = ui.showSecondHandCheckBox->checkState() == Qt::Checked;
- cg.writeEntry("showTimeString", m_showTimeString);
- cg.writeEntry("showSecondHand", m_showSecondHand);
- dataEngine("time")->setProperty("reportSeconds", m_showSecondHand);
QGraphicsItem::update();
QStringList tzs = ui.timeZones->selection();
/*
@@ -190,11 +169,12 @@
void Clock::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, \
const QRect &contentsRect) {
+ Q_UNUSED( contentsRect );
+ Q_UNUSED( option );
// p->setRenderHint(QPainter::SmoothPixmapTransform);
QString hours = m_time.toString("HH");
QString minutes = m_time.toString("mm");
- QString seconds = m_time.toString("ss");
QString day = m_date.toString("dd");
QString month = m_date.toString("M");
QString year = m_date.toString("yyyy");
Index: clockConfig.ui
===================================================================
--- clockConfig.ui (revision 692323)
+++ clockConfig.ui (working copy)
@@ -5,18 +5,36 @@
<rect>
<x>0</x>
<y>0</y>
- <width>276</width>
- <height>295</height>
+ <width>320</width>
+ <height>203</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
<item row="0" column="0" >
<layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
<item>
<widget class="KTimeZoneWidget" name="timeZones" >
+ <property name="minimumSize" >
+ <size>
+ <width>300</width>
+ <height>150</height>
+ </size>
+ </property>
<column>
<property name="text" >
<string>Area</string>
@@ -35,45 +53,13 @@
</widget>
</item>
<item>
- <widget class="QCheckBox" name="showSecondHandCheckBox" >
- <property name="toolTip" >
- <string><html><head><meta name="qrichtext" content="1" /><style \
type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; \
font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;">Display the second \
hand</p></body></html></string> + <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
</property>
- <property name="whatsThis" >
- <string><html><head><meta name="qrichtext" content="1" /><style \
type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; \
font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;">Check this if you want to display the second \
hand in order to see the seconds.</p></body></html></string> + \
<property name="spacing" > + <number>6</number>
</property>
- <property name="text" >
- <string>Display seconds</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="showTimeStringCheckBox" >
- <property name="toolTip" >
- <string><html><head><meta name="qrichtext" content="1" /><style \
type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; \
font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;">Display the time as a \
string</p></body></html></string>
- </property>
- <property name="whatsThis" >
- <string><html><head><meta name="qrichtext" content="1" /><style \
type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; \
font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;">Check this if you want to display the time as a \
string within the clock.</p></body></html></string>
- </property>
- <property name="text" >
- <string>Also display the time in text</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="labelSize" >
<property name="text" >
["signature.asc" (application/pgp-signature)]
_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic