[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeplasma-addons/applets/timer
From: Marco Martin <notmart () gmail ! com>
Date: 2009-02-22 17:09:38
Message-ID: 1235322578.143900.3135.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 930081 by mart:
optionally show a title
BUG:183673
patch by Shantanu Tushar
M +31 -4 timer.cpp
M +2 -0 timer.h
M +55 -112 timerConfig.ui
--- trunk/KDE/kdeplasma-addons/applets/timer/timer.cpp #930080:930081
@@ -43,7 +43,8 @@
Timer::Timer(QObject *parent, const QVariantList &args)
: Plasma::Applet(parent, args),
m_seconds(),
- m_running(false)
+ m_running(false),
+ m_title("Timer")
{
resize(315, 125);
setHasConfigurationInterface(true);
@@ -66,6 +67,8 @@
<< "00:10:00" << "00:15:00" << "00:20:00"
<< "00:25:00" << "00:30:00" << "00:45:00"
<< "01:00:00");
+ m_showTitle = cg.readEntry("showTitle", false);
+ m_title = cg.readEntry("title", i18n("Timer"));
m_showMessage = cg.readEntry("showMessage", true);
m_message = cg.readEntry("message", i18n("Timer Timeout"));
m_runCommand = cg.readEntry("runCommand", false);
@@ -145,12 +148,13 @@
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
+ ui.showTitleCheckBox->setChecked(m_showTitle);
+ ui.titleLineEdit->setEnabled(m_showTitle);
+ ui.titleLineEdit->setText(m_title);
ui.showMessageCheckBox->setChecked(m_showMessage);
- ui.messageLabel->setEnabled(m_showMessage);
ui.messageLineEdit->setEnabled(m_showMessage);
ui.messageLineEdit->setText(m_message);
ui.runCommandCheckBox->setChecked(m_runCommand);
- ui.commandLabel->setEnabled(m_runCommand);
ui.commandLineEdit->setEnabled(m_runCommand);
ui.commandLineEdit->setText(m_command);
@@ -170,6 +174,12 @@
}
cg.writePathEntry("predefinedTimers", unlocalizedTimers);
+ m_showTitle = ui.showTitleCheckBox->isChecked();
+ cg.writeEntry("showTitle", m_showTitle);
+
+ m_title = ui.titleLineEdit->text();
+ cg.writeEntry("title", m_title);
+
m_showMessage = ui.showMessageCheckBox->isChecked();
cg.writeEntry("showMessage", m_showMessage);
@@ -208,7 +218,10 @@
{
if (m_showMessage){
//TODO: probably something with an OK button is better.
- KNotification::event(KNotification::Notification, m_message);
+ if (m_showTitle)
+ KNotification::event(KNotification::Notification, m_title + " - " + m_message);
+ else
+ KNotification::event(KNotification::Notification, m_message);
}
if (m_runCommand && !m_command.isEmpty()){
@@ -368,6 +381,20 @@
m_svg->paint(p, QRectF(x + (w * 5), y, w, h), QString::number(seconds / 10) + suffix);
m_svg->paint(p, QRectF(x + (w * 6), y, w, h), QString::number(seconds % 10) + suffix);
+
+ //Draw the title
+ if (m_showTitle) {
+ QFont font = this->font();
+ font.setPixelSize( y - 6 ); // Minor
+ QRect rectText( 0, 4, appletWidth, y - 2 ); // adjustments
+ p->save();
+ p->setFont( font );
+ p->setPen( Plasma::Theme::defaultTheme()->color( Plasma::Theme::TextColor ));
+ p->drawText(rectText,
+ Qt::AlignTop | Qt::AlignHCenter,
+ m_title);
+ p->restore();
+ }
}
#include "timer.moc"
--- trunk/KDE/kdeplasma-addons/applets/timer/timer.h #930080:930081
@@ -73,6 +73,8 @@
Ui::timerConfig ui;
QStringList m_predefinedTimers;
+ bool m_showTitle;
+ QString m_title;
bool m_showMessage;
QString m_message;
bool m_runCommand;
--- trunk/KDE/kdeplasma-addons/applets/timer/timerConfig.ui #930080:930081
@@ -1,7 +1,8 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>timerConfig</class>
- <widget class="QWidget" name="timerConfig" >
- <property name="geometry" >
+ <widget class="QWidget" name="timerConfig">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -9,98 +10,56 @@
<height>156</height>
</rect>
</property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" colspan="3" >
- <widget class="QLabel" name="label" >
- <property name="font" >
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="showTitleCheckBox">
+ <property name="text">
+ <string>Show Title</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KLineEdit" name="titleLineEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
- <property name="text" >
+ <property name="text">
<string>Actions on Timeout</string>
</property>
</widget>
</item>
- <item row="2" column="3" >
- <widget class="KLineEdit" name="messageLineEdit" />
- </item>
- <item row="3" column="1" colspan="2" >
- <widget class="QCheckBox" name="runCommandCheckBox" >
- <property name="text" >
- <string>Run a command</string>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="showMessageCheckBox">
+ <property name="text">
+ <string>Show a message</string>
</property>
</widget>
</item>
- <item row="4" column="2" >
- <widget class="QLabel" name="commandLabel" >
- <property name="text" >
- <string>Command:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
+ <item row="2" column="1">
+ <widget class="KLineEdit" name="messageLineEdit"/>
</item>
- <item row="4" column="3" >
- <widget class="KLineEdit" name="commandLineEdit" />
- </item>
- <item row="2" column="2" >
- <widget class="QLabel" name="messageLabel" >
- <property name="text" >
- <string>Message:</string>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="runCommandCheckBox">
+ <property name="text">
+ <string>Run a command</string>
</property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
</widget>
</item>
- <item row="1" column="1" colspan="2" >
- <widget class="QCheckBox" name="showMessageCheckBox" >
- <property name="text" >
- <string>Show a message</string>
- </property>
- </widget>
+ <item row="3" column="1">
+ <widget class="KLineEdit" name="commandLineEdit"/>
</item>
- <item row="1" column="0" >
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="1" >
- <spacer name="horizontalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="5" column="3" >
- <spacer name="verticalSpacer" >
- <property name="orientation" >
+ <item row="4" column="1">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@@ -125,61 +84,45 @@
<receiver>messageLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
- <hint type="sourcelabel" >
- <x>300</x>
- <y>228</y>
+ <hint type="sourcelabel">
+ <x>154</x>
+ <y>82</y>
</hint>
- <hint type="destinationlabel" >
- <x>341</x>
- <y>258</y>
+ <hint type="destinationlabel">
+ <x>393</x>
+ <y>85</y>
</hint>
</hints>
</connection>
<connection>
- <sender>showMessageCheckBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>messageLabel</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>300</x>
- <y>228</y>
- </hint>
- <hint type="destinationlabel" >
- <x>64</x>
- <y>258</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>runCommandCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>commandLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
- <hint type="sourcelabel" >
- <x>300</x>
- <y>310</y>
+ <hint type="sourcelabel">
+ <x>154</x>
+ <y>114</y>
</hint>
- <hint type="destinationlabel" >
- <x>343</x>
- <y>340</y>
+ <hint type="destinationlabel">
+ <x>393</x>
+ <y>117</y>
</hint>
</hints>
</connection>
<connection>
- <sender>runCommandCheckBox</sender>
+ <sender>showTitleCheckBox</sender>
<signal>toggled(bool)</signal>
- <receiver>commandLabel</receiver>
+ <receiver>titleLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
- <hint type="sourcelabel" >
- <x>300</x>
- <y>310</y>
+ <hint type="sourcelabel">
+ <x>52</x>
+ <y>14</y>
</hint>
- <hint type="destinationlabel" >
- <x>66</x>
- <y>340</y>
+ <hint type="destinationlabel">
+ <x>177</x>
+ <y>17</y>
</hint>
</hints>
</connection>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic