SVN commit 765032 by andrunko:
Improved binary clock config dialog.
Relayout dialog.
Add the possibility to select local timezone.
M +28 -21 binaryclock.cpp
M +109 -117 clockConfig.ui
--- trunk/kdereview/binary-clock/binaryclock.cpp #765031:765032
@@ -51,7 +51,6 @@
BinaryClock::~BinaryClock()
{
-
}
Qt::Orientations BinaryClock::expandingDirections() const
@@ -96,7 +95,6 @@
return sizeHint;
}
-
void BinaryClock::connectToEngine()
{
Plasma::DataEngine* timeEngine = dataEngine("time");
@@ -108,7 +106,6 @@
}
}
-
void BinaryClock::constraintsUpdated(Plasma::Constraints constraints)
{
Q_UNUSED(constraints)
@@ -116,7 +113,6 @@
updateGeometry();
}
-
void BinaryClock::dataUpdated(const QString& source, const Plasma::DataEngine::Data &data)
{
Q_UNUSED(source);
@@ -134,7 +130,6 @@
update();
}
-
void BinaryClock::showConfigurationInterface()
{
if (m_dialog == 0) {
@@ -147,8 +142,10 @@
connect( m_dialog, SIGNAL(applyClicked()), this, SLOT(configAccepted()) );
connect( m_dialog, SIGNAL(okClicked()), this, SLOT(configAccepted()) );
}
+
ui.timeZones->setSelected(m_timezone, true);
-
+ ui.timeZones->setEnabled(m_timezone != "Local");
+ ui.localTimeZone->setChecked(m_timezone == "Local");
ui.showSecondHandCheckBox->setChecked(m_showSeconds);
ui.showGridCheckBox->setChecked(m_showGrid);
ui.showOffLedsCheckBox->setChecked(m_showOffLeds);
@@ -170,7 +167,11 @@
update();
QStringList tzs = ui.timeZones->selection();
- if (tzs.count() > 0) {
+ if (ui.localTimeZone->checkState() == Qt::Checked) {
+ dataEngine("time")->disconnectSource(m_timezone, this);
+ m_timezone = "Local";
+ cg.writeEntry("timezone", m_timezone);
+ } else if (tzs.count() > 0) {
//TODO: support multiple timezones
QString tz = tzs.at(0);
if (tz != m_timezone) {
@@ -180,6 +181,7 @@
} else if (m_timezone != "Local") {
dataEngine("time")->disconnectSource(m_timezone, this);
m_timezone = "Local";
+ cg.writeEntry("timezone", m_timezone);
}
connectToEngine();
@@ -187,15 +189,14 @@
cg.config()->sync();
}
-
void BinaryClock::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option,
-const QRect &contentsRect)
+ const QRect &contentsRect)
{
Q_UNUSED(option);
QSizeF m_size = contentsRect.size();
- int appletHeight = m_size.height();
- int appletWidth = m_size.width();
+ int appletHeight = (int) m_size.height();
+ int appletWidth = (int) m_size.width();
int dots = m_showSeconds ? 6 : 4;
int rectSize = (appletHeight - 3) / 4;
@@ -210,26 +211,32 @@
minutes[0].toAscii(), minutes[1].toAscii(),
seconds[0].toAscii(), seconds[1].toAscii()};
- for (int i = 0; i < dots; i++)
- for (int j = 0; j < 4; j++)
- if (timeDigits[i] & (1 << (3 - j)))
+ for (int i = 0; i < dots; i++) {
+ for (int j = 0; j < 4; j++) {
+ if (timeDigits[i] & (1 << (3 - j))) {
p->fillRect(xPos + (i * (rectSize + 1)), yPos + (j * (rectSize + 1)), rectSize, rectSize, m_ledsColor);
- else if (m_showOffLeds)
+ } else if (m_showOffLeds) {
p->fillRect(xPos + (i * (rectSize + 1)), yPos + (j * (rectSize + 1)), rectSize, rectSize, m_offLedsColor);
+ }
+ }
+ }
- if (m_showGrid){
+ if (m_showGrid) {
p->setPen(m_gridColor);
p->drawRect((xPos - 1), (yPos - 1),
(dots * (rectSize + 1)), (4 * (rectSize + 1)) );
- for (int i = 1; i < dots; i++)
- for (int j = 0; j < 4; j++)
+ for (int i = 1; i < dots; i++) {
+ for (int j = 0; j < 4; j++) {
p->drawLine((xPos + (i * (rectSize + 1)) - 1), (yPos + (j * (rectSize + 1))),
(xPos + (i * (rectSize + 1)) - 1), (yPos + (j * (rectSize + 1)) + rectSize - 1) );
+ }
+ }
- for (int j = 1; j < 4; j++)
- p->drawLine(xPos, (yPos + (j * (rectSize + 1)) - 1),
- (xPos + (dots * (rectSize + 1)) - 2), (yPos + (j * (rectSize + 1)) - 1) );
+ for (int j = 1; j < 4; j++) {
+ p->drawLine(xPos, (yPos + (j * (rectSize + 1)) - 1),
+ (xPos + (dots * (rectSize + 1)) - 2), (yPos + (j * (rectSize + 1)) - 1) );
+ }
}
}
--- trunk/kdereview/binary-clock/clockConfig.ui #765031:765032
@@ -5,137 +5,112 @@
0
0
- 350
- 367
+ 400
+ 400
- 350
- 200
+ 400
+ 300
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 6
-
-
- 6
-
- -
-
-
- 6
+
+
-
+
+
+ Appearance
-
- 0
+
+ true
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 300
- 0
-
-
-
+
+
-
+
+
+ Show the second leds
+
+
+ Check this if you want to display second leds in order to see the seconds.
+
- Area
+ Show &seconds
-
-
+
+
+ -
+
+
+ Show the grid
+
+
+ Check this if you want to see a grid around leds.
+
- Region
+ Show grid
-
-
+
+
+ -
+
+
+ Show the off leds
+
+
+ Check this if you want to see off leds.
+
- Comment
+ Show off leds
-
-
-
- -
-
-
- Display second leds
-
-
- Check this if you want to display second leds in order to see the seconds.
-
-
- Display seconds
-
-
-
- -
-
-
- Show the grid
-
-
- Check this if you want to see a grid around leds.
-
-
- Show grid
-
-
-
- -
-
-
- Display off leds
-
-
- Check this if you want to see off leds.
-
-
- Show off leds
-
-
-
- -
-
-
- 6
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
+
+
+
+
+ -
+
+
+ Timezones
+
+
+ true
+
+
+
-
+
+
+ Use &local timezone
+
+
+
+ -
+
+
+
+ 300
+ 0
+
+
+
+
+ Area
+
+
+
+
+ Region
+
+
+
+
+ Comment
+
+
+
+
+
+
+
@@ -146,5 +121,22 @@
-
+
+
+ localTimeZone
+ toggled(bool)
+ timeZones
+ setDisabled(bool)
+
+
+ 199
+ 177
+
+
+ 199
+ 289
+
+
+
+