diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch) | |
tree | 2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /kicker-applets/kbinaryclock | |
download | tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker-applets/kbinaryclock')
-rw-r--r-- | kicker-applets/kbinaryclock/Makefile.am | 22 | ||||
-rw-r--r-- | kicker-applets/kbinaryclock/datepicker.cpp | 51 | ||||
-rw-r--r-- | kicker-applets/kbinaryclock/datepicker.h | 42 | ||||
-rw-r--r-- | kicker-applets/kbinaryclock/kbinaryclock.cpp | 411 | ||||
-rw-r--r-- | kicker-applets/kbinaryclock/kbinaryclock.desktop | 108 | ||||
-rw-r--r-- | kicker-applets/kbinaryclock/kbinaryclock.h | 105 | ||||
-rw-r--r-- | kicker-applets/kbinaryclock/kbinaryclock.kcfg | 49 | ||||
-rw-r--r-- | kicker-applets/kbinaryclock/prefs.kcfgc | 7 | ||||
-rw-r--r-- | kicker-applets/kbinaryclock/settings.ui | 483 |
9 files changed, 1278 insertions, 0 deletions
diff --git a/kicker-applets/kbinaryclock/Makefile.am b/kicker-applets/kbinaryclock/Makefile.am new file mode 100644 index 0000000..5039925 --- /dev/null +++ b/kicker-applets/kbinaryclock/Makefile.am @@ -0,0 +1,22 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kbinaryclock_panelapplet.la + +kbinaryclock_panelapplet_la_SOURCES = kbinaryclock.cpp settings.ui datepicker.cpp prefs.kcfgc + +METASOURCES = AUTO + +noinst_HEADERS = kbinaryclock.h datepicker.h + +lnkdir = $(kde_datadir)/kicker/applets +lnk_DATA = kbinaryclock.desktop +kde_kcfg_DATA = kbinaryclock.kcfg + +EXTRA_DIST = $(lnk_DATA) + +kbinaryclock_panelapplet_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +kbinaryclock_panelapplet_la_LIBADD = $(LIB_KDEUI) + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/kbinaryclock.pot + diff --git a/kicker-applets/kbinaryclock/datepicker.cpp b/kicker-applets/kbinaryclock/datepicker.cpp new file mode 100644 index 0000000..19efc1d --- /dev/null +++ b/kicker-applets/kbinaryclock/datepicker.cpp @@ -0,0 +1,51 @@ +/************************************************************ + +Copyright (c) 1996-2002 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include "datepicker.h" + + +#include <kdatepicker.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kwin.h> + +DatePicker::DatePicker(QWidget *parent, const QDate& date) + : QVBox( parent, 0, WType_TopLevel | WDestructiveClose | + WStyle_Customize | WStyle_StaysOnTop | WStyle_NoBorder ) +{ + setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); + KWin::setOnAllDesktops( handle(), true ); + picker = new KDatePicker(this, date); + picker->setCloseButton(true); + + /* name and icon for kicker's taskbar */ + setCaption(i18n("Calendar")); + setIcon(SmallIcon("date")); +} + +void DatePicker::keyReleaseEvent(QKeyEvent *e) +{ + DATEPICKER_INHERITED::keyReleaseEvent(e); + if (e->key() == Qt::Key_Escape) + close(); +} diff --git a/kicker-applets/kbinaryclock/datepicker.h b/kicker-applets/kbinaryclock/datepicker.h new file mode 100644 index 0000000..2cf524a --- /dev/null +++ b/kicker-applets/kbinaryclock/datepicker.h @@ -0,0 +1,42 @@ +/***************************************************************** + +Copyright (c) 1996-2000 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef __DATEPICKER_H +#define __DATEPICKER_H + +#include <qvbox.h> + +class QDate; +class KDatePicker; + +#define DATEPICKER_INHERITED QVBox +class DatePicker : public QVBox +{ +public: + DatePicker(QWidget*, const QDate&); +private: + KDatePicker *picker; + void keyReleaseEvent(QKeyEvent *e); +}; + +#endif diff --git a/kicker-applets/kbinaryclock/kbinaryclock.cpp b/kicker-applets/kbinaryclock/kbinaryclock.cpp new file mode 100644 index 0000000..33e8ced --- /dev/null +++ b/kicker-applets/kbinaryclock/kbinaryclock.cpp @@ -0,0 +1,411 @@ +/* + * Copyright (C) 2003 Benjamin C Meyer (ben+kbinaryclock@meyerhome.net) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#include "kbinaryclock.h" +#include "datepicker.h" + +#include <kapplication.h> +#include <kconfigdialog.h> +#include <kconfig.h> +#include <kiconloader.h> +#include <kglobalsettings.h> + +#include <qradiobutton.h> +#include <kcolorbutton.h> +#include <kpopupmenu.h> +#include <qslider.h> +#include <qcursor.h> +#include <qtimer.h> +#include <qtooltip.h> +#include <qlabel.h> + +#include <kprocess.h> +#include <kstandarddirs.h> +#include <qclipboard.h> +#include <kled.h> + +extern "C" +{ + KDE_EXPORT KPanelApplet* init( QWidget *parent, const QString& configFile ) { + KGlobal::locale()->insertCatalogue( "kbinaryclock"); + return new KBinaryClock( configFile, KPanelApplet::Normal, + KPanelApplet::Preferences, parent, "kbinaryclock"); + } +} + +KConfigDialogImp::KConfigDialogImp( QWidget *parent, const char *name, KConfigSkeleton *prefs, KDialogBase::DialogType dialogType, KDialogBase::ButtonCode defaultButton, bool modal) : + KConfigDialog(parent, name, prefs, dialogType,(KDialogBase::ButtonCode) (KDialogBase::Default | KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel ), defaultButton, modal) +{ + // As a temporary mesure until the kicker applet's app name is set to the + // applets name so KDialogBase gets the right info. + setPlainCaption(i18n("Configure - KBinaryClock")); + setIcon(SmallIcon("date")); + + settings = new SettingsImp(0, "General"); + addPage(settings, i18n("General"), "package_settings"); + connect(this, SIGNAL(widgetModified()), settings, SLOT(updatePreview())); +} + +SettingsImp::SettingsImp(QWidget* parent, const char* name, WFlags fl): Settings(parent, name, fl){ +} + +/** + * Update the preview + */ +void SettingsImp::updatePreview(){ + int shape = Shape_Circular->isChecked() ? Prefs::EnumShape::Circular : Prefs::EnumShape::Rectangular; + int look = KLed::Raised; + look = Look_Flat->isChecked() ? Prefs::EnumLook::Flat : look; + look = Look_Sunken->isChecked() ? Prefs::EnumLook::Sunken : look; + QColor color = kcfg_Color->color(); + int darkFactor = kcfg_DarkFactor->value(); + QColor backgroundColor = kcfg_Background->color(); + frame1->setBackgroundColor(backgroundColor); + + kLed1->setBackgroundColor(backgroundColor); + kLed2->setBackgroundColor(backgroundColor); + kLed3->setBackgroundColor(backgroundColor); + kLed4->setBackgroundColor(backgroundColor); + kLed5->setBackgroundColor(backgroundColor); + kLed6->setBackgroundColor(backgroundColor); + + kLed1->setShape((KLed::Shape)shape); + kLed2->setShape((KLed::Shape)shape); + kLed3->setShape((KLed::Shape)shape); + kLed4->setShape((KLed::Shape)shape); + kLed5->setShape((KLed::Shape)shape); + kLed6->setShape((KLed::Shape)shape); + + kLed1->setColor(color); + kLed2->setColor(color); + kLed3->setColor(color); + kLed4->setColor(color); + kLed5->setColor(color); + kLed6->setColor(color); + + kLed1->setLook((KLed::Look)look); + kLed2->setLook((KLed::Look)look); + kLed3->setLook((KLed::Look)look); + kLed4->setLook((KLed::Look)look); + kLed5->setLook((KLed::Look)look); + kLed6->setLook((KLed::Look)look); + + kLed1->setDarkFactor(darkFactor); + kLed2->setDarkFactor(darkFactor); + kLed3->setDarkFactor(darkFactor); + kLed4->setDarkFactor(darkFactor); + kLed5->setDarkFactor(darkFactor); + kLed6->setDarkFactor(darkFactor); +} + +/** + * Constructor, create LED's + */ +KBinaryClock::KBinaryClock(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) + : KPanelApplet(configFile, type, actions, parent, name), ledWidth(6), + _calendar(NULL), _disableCalendar(false), + prefs( new Prefs(sharedConfig())), m_tooltip(this) +{ + prefs->readConfig(); + setBackgroundOrigin(AncestorOrigin); + for(int i=0; i < 4; i++){ + for(int j=0; j < ledWidth;j++){ + KLed *led = new KLed( this ); + led->setBackgroundOrigin(AncestorOrigin); + ledMatrix[j][i] = led; + } + } + + // Why does kicker start out with a size of 800x409? + // Kicker bug? + resize(60,42); + + updateClock(); + loadSettings(); + QTimer *timer=new QTimer(this); + connect (timer, SIGNAL (timeout()), this, SLOT (updateClock())); + timer->start(500,false); +} + +KBinaryClock::~KBinaryClock() +{ + delete prefs; + KGlobal::locale()->removeCatalogue( "kbinaryclock"); +} + +/** + * Return the computed height of the widget. + */ +int KBinaryClock::widthForHeight( int height ) const { + return (height-2)/4*ledWidth; +} + +/** + * Return the computed width of the widget. + */ +int KBinaryClock::heightForWidth( int width ) const { + return (width/ledWidth)*4; +} + +void KBinaryClock::resizeEvent( QResizeEvent *e ) { + int width = e->size().width(); + for (int i=0; i < ledWidth; i++) + for (int j=0; j < 4; j++) + ledMatrix[i][j]->setGeometry( QRect( (width/ledWidth)*i, (width/ledWidth)*j, width/ledWidth, width/ledWidth) ); +} + +/** + * Load the settings for the clock. + */ +void KBinaryClock::loadSettings(){ + int shape = prefs->shape(); + int look = prefs->look(); + QColor color = prefs->color(); + + int darkFactor = prefs->darkFactor(); + QColor backgroundColor = prefs->background(); + bool modifyBackground = false; + if(backgroundColor != KApplication::palette().active().background()){ + setPaletteBackgroundColor(backgroundColor); + modifyBackground = true; + } + + bool showSeconds = prefs->show_Seconds(); + ledWidth = (showSeconds == true) ? 6 : 4; + for(int i=0; i < 4; i++){ + for(int j=4; j < 6;j++){ + if(showSeconds) + ledMatrix[j][i]->show(); + else + ledMatrix[j][i]->hide(); + } + } + for(int i=0; i < 4; i++){ + for(int j=0; j < ledWidth;j++){ + ledMatrix[j][i]->setShape((KLed::Shape)shape); + ledMatrix[j][i]->setColor(color); + ledMatrix[j][i]->setLook((KLed::Look)look); + ledMatrix[j][i]->setDarkFactor(darkFactor); + // Dammed if you do, dammed if you don't + if(modifyBackground || ledMatrix[j][i]->backgroundColor() != backgroundColor) + ledMatrix[j][i]->setPaletteBackgroundColor(backgroundColor); + } + } + updateLayout(); +} + +/** + * Show Settings dialog. + */ +void KBinaryClock::preferences(){ + if(KConfigDialog::showDialog("settings")) + return; + + KConfigDialogImp *dialog = new KConfigDialogImp(this, "settings", prefs, KDialogBase::Swallow); + connect(dialog, SIGNAL(settingsChanged()), this, SLOT(loadSettings())); + dialog->show(); + dialog->settings->updatePreview(); +} + +/** + * Get the time and update the LED's + */ +void KBinaryClock::updateClock(){ + QString time = "hhmmss"; + if(KGlobal::locale()->use12Clock()) + time += "ap"; + + QString currentTime = (QTime::currentTime()).toString(time); + int splice[6]; + splice[0] = currentTime.mid( 0, 1 ).toInt(); + splice[1] = currentTime.mid( 1, 1 ).toInt(); + splice[2] = currentTime.mid( 2, 1 ).toInt(); + splice[3] = currentTime.mid( 3, 1 ).toInt(); + splice[4] = currentTime.mid( 4, 1 ).toInt(); + splice[5] = currentTime.mid( 5, 1 ).toInt(); + + for (int i=0; i<ledWidth; i++) { + (splice[i] & 8) != 0 ? ledMatrix[i][0]->setState(KLed::On) : ledMatrix[i][0]->setState(KLed::Off); + (splice[i] & 4) != 0 ? ledMatrix[i][1]->setState(KLed::On) : ledMatrix[i][1]->setState(KLed::Off); + (splice[i] & 2) != 0 ? ledMatrix[i][2]->setState(KLed::On) : ledMatrix[i][2]->setState(KLed::Off); + (splice[i] & 1) != 0 ? ledMatrix[i][3]->setState(KLed::On) : ledMatrix[i][3]->setState(KLed::Off); + } + + // TODO add hide_Off_Leds checkbox to ui file post 3.3 + // sense we can't add strings. + if(prefs->hide_Off_Leds()) + for (int i=0; i<ledWidth; i++) { + for( int j=0; j < 4;j++){ + if(ledMatrix[i][j]->state() == KLed::Off) + ledMatrix[i][j]->hide(); + else + ledMatrix[i][j]->show(); + } + } +} + +/** + * Catch the right click press + */ + void KBinaryClock::mousePressEvent(QMouseEvent *event) { + switch (event->button()) { + case QMouseEvent::RightButton: + QToolTip::remove(this); + openContextMenu(); + break; + case QMouseEvent::LeftButton: + toggleCalendar(); + QToolTip::remove(this); + break; + case QMouseEvent::MidButton: + QToolTip::remove(this); + break; + default: + break; + } +} + +/** + * Deal with right click's + */ +void KBinaryClock::openContextMenu() { + bool bImmutable = config()->isImmutable(); + + KPopupMenu *menu = new KPopupMenu(); + menu->insertTitle( SmallIcon( "clock" ), i18n( "KBinaryClock" ) ); + + KLocale *loc = KGlobal::locale(); + QDateTime dt = QDateTime::currentDateTime(); + + KPopupMenu *copyMenu = new KPopupMenu( menu ); + copyMenu->insertItem(loc->formatDateTime(dt), 201); + copyMenu->insertItem(loc->formatDate(dt.date()), 202); + copyMenu->insertItem(loc->formatDate(dt.date(), true), 203); + copyMenu->insertItem(loc->formatTime(dt.time()), 204); + copyMenu->insertItem(loc->formatTime(dt.time(), true), 205); + copyMenu->insertItem(dt.date().toString(), 206); + copyMenu->insertItem(dt.time().toString(), 207); + copyMenu->insertItem(dt.toString(), 208); + connect( copyMenu, SIGNAL( activated(int) ), this, SLOT( slotCopyMenuActivated(int) ) ); + + if (!bImmutable) + { + if (kapp->authorize("user/root")) + { + menu->insertItem(SmallIcon("date"), i18n("&Adjust Date && Time..."), 103, 4); + } + menu->insertItem(SmallIcon("kcontrol"), i18n("Date && Time &Format..."), 104, 5); + } + + menu->insertItem(SmallIcon("editcopy"), i18n("C&opy to Clipboard"), copyMenu, 105, 6); + if (!bImmutable) + { + menu->insertSeparator(7); + menu->insertItem(SmallIcon("configure"), i18n("&Configure KBinaryClock..."), 102, 8); + } + int result = menu->exec( QCursor::pos() ); + + KProcess proc; + switch (result) { + case 102: + preferences(); + break; + case 103: + proc << locate("exe", "kdesu"); + proc << "--nonewdcop"; + proc << QString("%1 clock --lang %2") + .arg(locate("exe", "kcmshell")) + .arg(KGlobal::locale()->language()); + proc.start(KProcess::DontCare); + break; + case 104: + proc << locate("exe", "kcmshell"); + proc << "language"; + proc.start(KProcess::DontCare); + break; + case 110: + preferences(); + break; + } /* switch() */ + delete menu; +} + +void KBinaryClock::slotCopyMenuActivated( int id ) { + QPopupMenu *m = (QPopupMenu *) sender(); + QString s = m->text(id); + QApplication::clipboard()->setText(s); +} + +void KBinaryClock::toggleCalendar() +{ + if (_calendar && !_disableCalendar) { + // calls slotCalendarDeleted which does the cleanup for us + _calendar->close(); + return; + } + if (_calendar || _disableCalendar){ + return; + } + _calendar = new DatePicker(this, QDateTime::currentDateTime().date()); + connect( _calendar, SIGNAL( destroyed() ), SLOT( slotCalendarDeleted() )); + + // some extra spacing is included if aligned on a desktop edge + QPoint c = mapToGlobal(QPoint(0,0)); + + int w = _calendar->sizeHint().width() + 28; + // Added 28 px. to size poperly as said in API + int h = _calendar->sizeHint().height(); + + switch (position()) { + case KPanelApplet::pLeft: c.setX(c.x()+width()+2); break; + case KPanelApplet::pRight: c.setX(c.x()-w-2); break; + case KPanelApplet::pTop: c.setY(c.y()+height()+2); break; + case KPanelApplet::pBottom: c.setY(c.y()-h-2); break; + } + + // make calendar fully visible + QRect deskR = KGlobalSettings::desktopGeometry(QPoint(0,0)); + + if (c.y()+h > deskR.bottom()) c.setY(deskR.bottom()-h-1); + if (c.x()+w > deskR.right()) c.setX(deskR.right()-w-1); + + _calendar->move(c); + _calendar->show(); +} + +void KBinaryClock::slotCalendarDeleted() +{ + _calendar = 0L; + // don't reopen the calendar immediately ... + _disableCalendar = true; + QTimer::singleShot(100, this, SLOT(slotEnableCalendar())); +} + +void KBinaryClock::slotEnableCalendar() +{ + _disableCalendar = false; +} + +ClockAppletToolTip::ClockAppletToolTip( KBinaryClock *clock ) : QToolTip( clock ), m_clock( clock ) {} + +void ClockAppletToolTip::maybeTip( const QPoint & /*point*/ ) +{ + tip(m_clock->geometry(), KGlobal::locale()->formatDate(QDateTime::currentDateTime().date(), false)); +} + +#include "kbinaryclock.moc" diff --git a/kicker-applets/kbinaryclock/kbinaryclock.desktop b/kicker-applets/kbinaryclock/kbinaryclock.desktop new file mode 100644 index 0000000..962d48e --- /dev/null +++ b/kicker-applets/kbinaryclock/kbinaryclock.desktop @@ -0,0 +1,108 @@ +[Desktop Entry] +Type=Plugin +Name=Binary Clock +Name[bg]=Двоичен часовник +Name[br]=Eurier binarel +Name[ca]=Rellotge binari +Name[cs]=Binární hodiny +Name[cy]=Cloc Deuaidd +Name[da]=Binært ur +Name[de]=Binäruhr +Name[el]=Δυαδικό ρολόι +Name[eo]=Duuma horloĝo +Name[es]=Reloj binario +Name[et]=Binaarkell +Name[eu]=Erloju bitarra +Name[fa]=ساعت دودویی +Name[fi]=Binäärikello +Name[fr]=Horloge binaire +Name[fy]=Binêre klok +Name[ga]=Clog Dénártha +Name[gl]=Relóxio Binário +Name[he]=שעון בינרי +Name[hi]=बाइनरी क्लॉक +Name[hr]=Binarni sat +Name[hu]=KBinaryClock +Name[is]=Tvíundarklukka +Name[it]=Orologio binario +Name[ja]=バイナリ時計 +Name[ka]=ორობითი საათი +Name[kk]=Бинарлы сағат +Name[km]=នាឡិកាគោលពីរ +Name[lt]=Skaitmeninis laikrodis +Name[mk]=Бинарен часовник +Name[ms]=Jam Binari +Name[nb]=Binærklokke +Name[nds]=Bineerklock +Name[ne]=बाइनरि घडी +Name[nl]=Binaire klok +Name[nn]=Binærklokke +Name[pa]=ਬਾਈਨਰੀ ਘੜੀ +Name[pl]=Zegar binarny +Name[pt]=Relógio Binário +Name[pt_BR]=Relógio Binário +Name[ru]=Двоичные часы +Name[sk]=Binárne hodiny +Name[sl]=Dvojiška ura +Name[sr]=Бинарни часовник +Name[sr@Latn]=Binarni časovnik +Name[sv]=Binärklocka +Name[ta]=இருநிலை கடிகாரம் +Name[tr]=İkili Saat +Name[uk]=KBinaryClock +Name[uz]=Binar soat +Name[uz@cyrillic]=Бинар соат +Name[vi]=Đồng hồ nhị phân +Name[zh_CN]=二进制时钟 +Name[zh_TW]=二位元鐘 +Comment=Shows the time in binary format +Comment[bg]=Показване на времето в двоичен формат +Comment[ca]=Mostra l'hora en format binari +Comment[cs]=Zobrazuje čas v binárním tvaru +Comment[da]=Viser tiden i binært format +Comment[de]=Zeigt die Zeit in binärem Format +Comment[el]=Εμφάνιση του χρόνου σε δυαδική μορφή +Comment[eo]=Montras la tempon per duuma formato +Comment[es]=Muestra la hora en formato binario +Comment[et]=Näitab aega binaarkujul +Comment[eu]=Erakutsi ordua formatu bitarrean +Comment[fa]=فقرهها را در قالب دودویی نمایش میدهد +Comment[fi]=Näyttää ajan binäärimuodossa +Comment[fr]=Affiche l'heure en binaire +Comment[fy]=Toant de tiid yn in binêr formaat +Comment[ga]=Taispeáin an t-am i bhformáid dhénártha +Comment[gl]=Mostra a hora en formato binário +Comment[hr]=Prikaz vremena u binarnom obliku +Comment[hu]=Bináris formátumban jeleníti meg az időt +Comment[is]=Sýnir tímann í tvíunarsniði +Comment[it]=Mostra il tempo in formato binario +Comment[ja]=時刻をバイナリ形式で表示します +Comment[ka]=დროს ორობით ფორმატში აჩვენებს +Comment[kk]=Уақытты бинарлы пішімінде көрсету +Comment[km]=បង្ហាញម៉ោងជាទ្រង់ទ្រាយគោលពីរ +Comment[lt]=Rodo laiką skaitmeniniu formatu +Comment[mk]=Го прикажува времето во бинарен формат +Comment[nb]=Viser klokkeslett i binært format +Comment[nds]=Wiest de Tiet in bineer Formaat +Comment[ne]=बाइनरि ढाँचामा समय देखाउछ +Comment[nl]=Toont de tijd in een binair formaat +Comment[nn]=Viser tida i binærformat +Comment[pl]=Pokazuje czas w postaci binarnej +Comment[pt]=Mostra a hora em formato binário +Comment[pt_BR]=Mostra a hora em formato binário +Comment[ru]=Показ времени в двоичном формате +Comment[sk]=Zobrazí čas v binárnom formáte +Comment[sl]=Prikazuje čas v dvojiški obliki +Comment[sr]=Приказује време у бинарном формату +Comment[sr@Latn]=Prikazuje vreme u binarnom formatu +Comment[sv]=Visar tiden med binärformat +Comment[tr]=Zamanı ikili biçemde gösterir +Comment[uk]=Показує час в двійковому форматі +Comment[uz]=Vaqtni ikkili sanoq tizimida koʻrsatish +Comment[uz@cyrillic]=Вақтни иккили саноқ тизимида кўрсатиш +Comment[vi]=Hiển thị giờ định dạng nhị phân +Comment[zh_CN]=以二进制格式显示时间 +Comment[zh_TW]=以二進位格式顯示時間 +Icon=kbinaryclock +X-KDE-Library=kbinaryclock_panelapplet +X-KDE-UniqueApplet = false diff --git a/kicker-applets/kbinaryclock/kbinaryclock.h b/kicker-applets/kbinaryclock/kbinaryclock.h new file mode 100644 index 0000000..9edf51d --- /dev/null +++ b/kicker-applets/kbinaryclock/kbinaryclock.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2003 Benjamin C Meyer (ben+kbinaryclock@meyerhome.net) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#ifndef KBINARYCLOCK_H +#define KBINARYCLOCK_H + +#include <kpanelapplet.h> +#include <qevent.h> +#include <kglobal.h> +#include <kaboutdata.h> +#include <qdatetime.h> +#include <qtooltip.h> +#include <kconfigdialog.h> + +#include "settings.h" +#include "prefs.h" + +class KLed; +class QGridLayout; +class DatePicker; +class QGridLayout; +class KBinaryClock; + +class SettingsImp : public Settings { + Q_OBJECT +public: + SettingsImp(QWidget* parent=0, + const char* name=0, + WFlags fl=0); +public slots: + void updatePreview(); + +}; + +class KConfigDialogImp : public KConfigDialog { +public: + KConfigDialogImp(QWidget *parent, const char *name, + KConfigSkeleton *prefs, + KDialogBase::DialogType dialogType = KDialogBase::IconList, + KDialogBase::ButtonCode defaultButton = Ok, + bool modal=false); + SettingsImp *settings; +}; + +class ClockAppletToolTip : public QToolTip +{ + public: + ClockAppletToolTip( KBinaryClock* clock ); + + protected: + virtual void maybeTip( const QPoint & ); + + private: + KBinaryClock *m_clock; +}; + +class KBinaryClock : public KPanelApplet { + Q_OBJECT +public: + KBinaryClock(const QString& configFile, Type t = Normal, int actions = 0, QWidget *parent = 0, const char *name = 0); + ~KBinaryClock(); + + virtual int widthForHeight (int height) const; + virtual int heightForWidth (int width) const; + +protected: + virtual void resizeEvent(QResizeEvent *event); + virtual void mousePressEvent(QMouseEvent *event); + +protected slots: + void preferences(); + void updateClock(); + void loadSettings(); + void slotCopyMenuActivated(int); + void slotCalendarDeleted(); + void slotEnableCalendar(); + +private: + void openContextMenu(); + void toggleCalendar(); + KLed *ledMatrix[6][4]; + int ledWidth; + DatePicker *_calendar; + bool _disableCalendar; + Prefs *prefs; + ClockAppletToolTip m_tooltip; +}; + +#endif // KBINARYCLOCK_H + diff --git a/kicker-applets/kbinaryclock/kbinaryclock.kcfg b/kicker-applets/kbinaryclock/kbinaryclock.kcfg new file mode 100644 index 0000000..b5a5fb3 --- /dev/null +++ b/kicker-applets/kbinaryclock/kbinaryclock.kcfg @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <include>kapplication.h</include> + <kcfgfile arg="true"/> + <group name="General"> + <entry name="Shape" type="Enum"> + <label>Shape of the LEDs</label> + <choices> + <choice name="Rectangular"/> + <choice name="Circular"/> + </choices> + <default>Circular</default> + </entry> + <entry name="Look" type="Enum"> + <label>Look</label> + <choices> + <choice name="Flat"/> + <choice name="Raised"/> + <choice name="Sunken"/> + </choices> + <default>Raised</default> + </entry> + <entry name="Color" type="Color"> + <label>Color of the LEDs</label> + <default>55,49,238</default> + </entry> + <entry name="DarkFactor" type="Int"> + <label>Darkness of disabled LEDs</label> + <default>300</default> + <min>0</min> + <max>1000</max> + </entry> + <entry name="Background" type="Color"> + <label>Background color</label> + <default code="true">KApplication::palette().active().background()</default> + </entry> + <entry name="Show_Seconds" type="Bool"> + <label>Whether to show seconds</label> + <default>true</default> + </entry> + <entry name="Hide_Off_Leds" type="Bool"> + <label>Whether to show LEDs that are off</label> + <default>false</default> + </entry> + </group> +</kcfg> diff --git a/kicker-applets/kbinaryclock/prefs.kcfgc b/kicker-applets/kbinaryclock/prefs.kcfgc new file mode 100644 index 0000000..7e91072 --- /dev/null +++ b/kicker-applets/kbinaryclock/prefs.kcfgc @@ -0,0 +1,7 @@ +# Code generation options for kconfig_compiler +File=kbinaryclock.kcfg +#IncludeFiles=defines.h +ClassName=Prefs +Singleton=false +#CustomAdditions=true +#Mutators=Zoom diff --git a/kicker-applets/kbinaryclock/settings.ui b/kicker-applets/kbinaryclock/settings.ui new file mode 100644 index 0000000..43462af --- /dev/null +++ b/kicker-applets/kbinaryclock/settings.ui @@ -0,0 +1,483 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>Settings</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Settings</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>452</width> + <height>247</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupBox6</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Disabled LED</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Light</string> + </property> + </widget> + <widget class="QSlider" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>kcfg_DarkFactor</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="maxValue"> + <number>1000</number> + </property> + <property name="lineStep"> + <number>5</number> + </property> + <property name="pageStep"> + <number>10</number> + </property> + <property name="value"> + <number>300</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>NoMarks</enum> + </property> + <property name="tickInterval"> + <number>50</number> + </property> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>textLabel6</cstring> + </property> + <property name="text"> + <string>Dark</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Color</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Background:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>LED:</string> + </property> + </widget> + <widget class="KColorButton" row="0" column="1"> + <property name="name"> + <cstring>kcfg_Color</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="1" column="1"> + <property name="name"> + <cstring>kcfg_Background</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer row="0" column="2" rowspan="2" colspan="1"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QButtonGroup" row="2" column="2"> + <property name="name"> + <cstring>kcfg_Shape</cstring> + </property> + <property name="title"> + <string>LED Shape</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>Shape_Rectangular</cstring> + </property> + <property name="text"> + <string>&Rectangular</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>Shape_Circular</cstring> + </property> + <property name="text"> + <string>&Circular</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + <widget class="QButtonGroup" row="1" column="2"> + <property name="name"> + <cstring>kcfg_Look</cstring> + </property> + <property name="title"> + <string>LED Look</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>Look_Flat</cstring> + </property> + <property name="text"> + <string>&Flat</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>Look_Raised</cstring> + </property> + <property name="text"> + <string>R&aised</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>Look_Sunken</cstring> + </property> + <property name="text"> + <string>&Sunken</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="4" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>preview</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Preview</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QFrame"> + <property name="name"> + <cstring>frame1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>2</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="KLed" row="0" column="0"> + <property name="name"> + <cstring>kLed1</cstring> + </property> + <property name="minimumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="state"> + <enum>Off</enum> + </property> + </widget> + <widget class="KLed" row="0" column="1"> + <property name="name"> + <cstring>kLed2</cstring> + </property> + <property name="minimumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + <widget class="KLed" row="1" column="1"> + <property name="name"> + <cstring>kLed4</cstring> + </property> + <property name="minimumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + <widget class="KLed" row="1" column="0"> + <property name="name"> + <cstring>kLed3</cstring> + </property> + <property name="minimumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="state"> + <enum>Off</enum> + </property> + </widget> + <widget class="KLed" row="2" column="1"> + <property name="name"> + <cstring>kLed6</cstring> + </property> + <property name="minimumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="state"> + <enum>Off</enum> + </property> + </widget> + <widget class="KLed" row="2" column="0"> + <property name="name"> + <cstring>kLed5</cstring> + </property> + <property name="minimumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>84</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>kcfg_Show_Seconds</cstring> + </property> + <property name="text"> + <string>Show seconds</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_Hide_Off_Leds</cstring> + </property> + <property name="text"> + <string>Hide unlit LEDs</string> + </property> + </widget> + <widget class="Line" row="0" column="3" rowspan="3" colspan="1"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="frameShape"> + <enum>VLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcolorbutton.h</includehint> + <includehint>kled.h</includehint> +</includehints> +</UI> |