[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdereview/binary-clock
From: Andre Moreira Magalhaes <andrunko () yahoo ! com ! br>
Date: 2008-01-23 0:50:55
Message-ID: 1201049455.384900.2737.nullmailer () svn ! kde ! org
[Download RAW message or body]
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 @@
<rect>
<x>0</x>
<y>0</y>
- <width>350</width>
- <height>367</height>
+ <width>400</width>
+ <height>400</height>
</rect>
</property>
<property name="minimumSize" >
<size>
- <width>350</width>
- <height>200</height>
+ <width>400</width>
+ <height>300</height>
</size>
</property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>9</number>
- </property>
- <property name="topMargin" >
- <number>9</number>
- </property>
- <property name="rightMargin" >
- <number>9</number>
- </property>
- <property name="bottomMargin" >
- <number>9</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="0" column="0" >
- <layout class="QVBoxLayout" >
- <property name="spacing" >
- <number>6</number>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Appearance</string>
</property>
- <property name="leftMargin" >
- <number>0</number>
+ <property name="flat" >
+ <bool>true</bool>
</property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <item>
- <widget class="KTimeZoneWidget" name="timeZones" >
- <property name="minimumSize" >
- <size>
- <width>300</width>
- <height>0</height>
- </size>
- </property>
- <column>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QCheckBox" name="showSecondHandCheckBox" >
+ <property name="toolTip" >
+ <string>Show the second leds</string>
+ </property>
+ <property name="whatsThis" >
+ <string>Check this if you want to display second leds in order to see the \
seconds.</string> + </property>
<property name="text" >
- <string>Area</string>
+ <string>Show &seconds</string>
</property>
- </column>
- <column>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="showGridCheckBox" >
+ <property name="toolTip" >
+ <string>Show the grid</string>
+ </property>
+ <property name="whatsThis" >
+ <string>Check this if you want to see a grid around leds.</string>
+ </property>
<property name="text" >
- <string>Region</string>
+ <string>Show grid</string>
</property>
- </column>
- <column>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="showOffLedsCheckBox" >
+ <property name="toolTip" >
+ <string>Show the off leds</string>
+ </property>
+ <property name="whatsThis" >
+ <string>Check this if you want to see off leds.</string>
+ </property>
<property name="text" >
- <string>Comment</string>
+ <string>Show off leds</string>
</property>
- </column>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="showSecondHandCheckBox" >
- <property name="toolTip" >
- <string>Display second leds</string>
- </property>
- <property name="whatsThis" >
- <string>Check this if you want to display second leds in order to see the \
seconds.</string>
- </property>
- <property name="text" >
- <string>Display seconds</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="showGridCheckBox" >
- <property name="toolTip" >
- <string>Show the grid</string>
- </property>
- <property name="whatsThis" >
- <string>Check this if you want to see a grid around leds.</string>
- </property>
- <property name="text" >
- <string>Show grid</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="showOffLedsCheckBox" >
- <property name="toolTip" >
- <string>Display off leds</string>
- </property>
- <property name="whatsThis" >
- <string>Check this if you want to see off leds.</string>
- </property>
- <property name="text" >
- <string>Show off leds</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
- <number>6</number>
- </property>
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- </layout>
- </item>
- </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>Timezones</string>
+ </property>
+ <property name="flat" >
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QCheckBox" name="localTimeZone" >
+ <property name="text" >
+ <string>Use &local timezone</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KTimeZoneWidget" name="timeZones" >
+ <property name="minimumSize" >
+ <size>
+ <width>300</width>
+ <height>0</height>
+ </size>
+ </property>
+ <column>
+ <property name="text" >
+ <string>Area</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Region</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Comment</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
@@ -146,5 +121,22 @@
</customwidget>
</customwidgets>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>localTimeZone</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>timeZones</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>199</x>
+ <y>177</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>199</x>
+ <y>289</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic