TeaCooker/teacooker.svg0000644000175000017500000232323411040773560015035 0ustar swizecswizec image/svg+xml TeaCooker/teacooker.notifyrc0000644000175000017500000000032511043737225016063 0ustar swizecswizec[Global] IconName=kteatime Comment=Tea Cooker Plasmoid [Event/teacooker_teaReady] Name=Tea Comment=Tea is ready (currently this is nonfunctional) Sound=KDE-Sys-App-Positive.ogg Action=Sound|Popup Persistant=falseTeaCooker/CMakeLists.txt0000600000175000017500000000177711044102606015062 0ustar swizecswizec# Project Needs a name ofcourse project(plasma-teacooker) #set(CMAKE_BACKWARDS_COMPATIBILITY 2.2) # Find the required Libaries find_package(KDE4 REQUIRED) include(KDE4Defaults) find_package(Plasma REQUIRED) add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ) # We add our source code here set(teacooker_SRCS plasma-teacooker.cpp) # Now make sure all files get to the right place kde4_add_ui_files(teacooker_SRCS) kde4_add_plugin(teacooker ${teacooker_SRCS}) target_link_libraries(teacooker ${PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS}) install(TARGETS teacooker DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES plasma-applet-teacooker.desktop DESTINATION ${SERVICES_INSTALL_DIR}) install(FILES teacooker.svg DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/widgets/) install( FILES teacooker.notifyrc DESTINATION ${DATA_INSTALL_DIR}/teacooker) TeaCooker/README0000600000175000017500000000274111044120600013164 0ustar swizecswizecPlasmoid Tea Cooker widget *********************************************** This KDE4 plasmoid is for all tea lovers who aren't so keen on having a full fledged application, like kteatime, running just to steep their tea. This Software is published under the terms of the GNU GPL V3 and comes without any warranty. Feel free to change or distribute this software. Build dependencies *********************************************** Ubuntu/Debian users: build-essential kde4-devel kde4libs-bin Others: [coming soon] Installation *********************************************** 1. $ tar -xvzf plasma-teacooker-0.1.tar.gz 2. $ cd TeaCooker 3. $ mkdir build 4. $ cd build 4.1 K/X/Ubuntu users: $ export PATH=$PATH:/usr/lib/kde4/bin 5. $ cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` .. 6. $ make 7. $ make install Changelog *********************************************** 21.07.2k8 :: v0.1 - Initial Release (very very rudimentary) 21.07.2k8 :: v0.1.1 - just some changes to the readme - a screenshot and a .deb package 27.07.2k8 :: v0.2.0 - start/reset steeping - some different teas - KNotify (kind of broken atm) 27.07.2k8 :: v0.2.1 - knotify config fixed so it appears properly in system settings - bug where reseting tea cooker didn't also "stop" it fixed - icon size bug fixed 29.07.2k8 :: v0.2.2 - when tea is done steeping you can now reset it to an empty cup 30.07.2k8 :: v0.2.3 - using phonon to play a sound when steeping is done - countdown timer displayedTeaCooker/plasma-teacooker.h0000600000175000017500000000601611044120510015703 0ustar swizecswizec/*************************************************************************** * Copyright (C) 2008 by Swizec * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ // Here we avoid loading the header multiple times #ifndef Plasma_Teacooker_HEADER #define Plasma_Teacooker_HEADER // We need the Plasma Applet headers #include #include #include #include #include #include class QSizeF; class QTimer; class QAction; class Plasma_Teacooker : public Plasma::Applet { Q_OBJECT public: // Basic Create/Destroy Plasma_Teacooker(QObject *parent, const QVariantList &args); ~Plasma_Teacooker(); // The paintInterface procedure paints the applet to screen void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect& contentsRect); void init(); QSizeF contentSizeHint() const; Qt::Orientations expandingDirections() const; QList contextualActions(); signals: void contentsChanged(); public slots: void refresh(); void pressed(); void createMenu(); void popup(); void slotOpen(); void resetTea(); void startTea(); void stopTea(); void refreshCountdown(); protected: private: void paintImage(QPainter *p, const QRect &contentsRect); QTimer* timer; int animCounter; bool animEnd; int timerPause; bool steeping; QString countdown; int countdownSeconds; QTimer* countdownT; QAction *m_actionResetTea; QAction *m_actionStopTea; QString m_activeTea; QMap m_teas; void teaDone( QString tea ); Phonon::MediaObject *sound; }; // This is the command that links your applet to the .desktop file K_EXPORT_PLASMA_APPLET(plasma-teacooker, Plasma_Teacooker) #endif TeaCooker/plasma-applet-teacooker.desktop0000600000175000017500000000102111043117153020407 0ustar swizecswizec[Desktop Entry] Encoding=UTF-8 Name=Tea Cooker Comment=A simple tea timer to hopefully improve on kteatime's idea Type=Service X-KDE-ServiceTypes=Plasma/Applet Icon=kteatime X-KDE-Library=teacooker X-KDE-PluginInfo-Author=Swizec X-KDE-PluginInfo-Email=swizec@swizec.com X-KDE-PluginInfo-Name=teacooker X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Website=http://plasma.kde.org/ X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-PlasmoidCategory=Timer TeaCooker/CTestTestfile.cmake0000600000175000017500000000070011034053165016033 0ustar swizecswizec# CMake generated Testfile for # Source directory: /home/mark/src/kde/trunk/playground/base/plasma/applets/wifi-signal-strength # Build directory: /home/mark/src/kde/trunk/playground/base/plasma/applets/wifi-signal-strength # # This file replicates the SUBDIRS() and ADD_TEST() commands from the source # tree CMakeLists.txt file, skipping any SUBDIRS() or ADD_TEST() commands # that are excluded by CMake control structures, i.e. IF() commands. TeaCooker/plasma-teacooker.notifyrc0000644000175000017500000000027111043114216017323 0ustar swizecswizec[Global] IconName=kteatime Comment=Tea Cooker Plasmoid [Event/teacooker_teaReady] Name=Tea Comment=Tea is ready Sound=KDE-Sys-App-Special.ogg Action=Sound|Popup|Taskbar Persistant=trueTeaCooker/plasma-teacooker.cpp0000600000175000017500000002241111044123715016245 0ustar swizecswizec/*************************************************************************** * Copyright (C) 2008 by Swizec * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #include "plasma-teacooker.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // #include // K_GLOBAL_STATIC_WITH_ARGS(KComponentData, // teacookerComponent, // ("plasma-applet-teacooker", // QByteArray(), // KComponentData::SkipMainComponentRegistration)) Plasma_Teacooker::Plasma_Teacooker( QObject *parent, const QVariantList &args ) : Plasma::Applet(parent, args) { timer = new QTimer(this); animCounter = 0; animEnd = false; timerPause = 100; steeping = false; countdown = ""; countdownSeconds = 0; countdownT = new QTimer( this ); resize(100, 100); setHasConfigurationInterface(false); setBackgroundHints(DefaultBackground); connect(timer, SIGNAL(timeout()), this, SLOT(refresh())); connect(countdownT, SIGNAL(timeout()), this, SLOT(refreshCountdown())); m_actionResetTea = new QAction("Reset Tea", this); connect(m_actionResetTea, SIGNAL(triggered()), this, SLOT(resetTea())); m_actionStopTea = new QAction("Stop Tea", this); connect(m_actionStopTea, SIGNAL(triggered()), this, SLOT(stopTea())); m_teas.insert( "black tea", 3 ); m_teas.insert( "earl grey", 5 ); m_teas.insert( "fruit tea", 10 ); sound = Phonon::createPlayer(Phonon::NotificationCategory, Phonon::MediaSource( KStandardDirs::locate( "sound", "KDE-Sys-App-Positive.ogg" ) ) ); } Plasma_Teacooker::~Plasma_Teacooker() { timer->stop(); delete timer; delete m_actionResetTea; delete m_actionStopTea; delete countdownT; delete sound; } void Plasma_Teacooker::init() { createMenu(); } void Plasma_Teacooker::refresh() { timer->stop(); if ( steeping ) { animCounter++; if ( !animEnd ) { timer->setInterval( timerPause ); timer->start(); } } update(); emit contentsChanged(); } void Plasma_Teacooker::refreshCountdown() { countdownT->stop(); if ( steeping ) { countdownSeconds--; countdown = QTime( 0, countdownSeconds/60, countdownSeconds%60 ).toString( "mm:ss" ); countdownT->setInterval( 1000 ); countdownT->start(); } update(); emit contentsChanged(); } void Plasma_Teacooker::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect) { Q_UNUSED( option ); int delta = (int)contentsRect.height()/10*2; p->setRenderHint(QPainter::SmoothPixmapTransform); p->setRenderHint(QPainter::Antialiasing); if ( !animEnd ) { QRect imageRect(contentsRect.left(), contentsRect.top()+delta, (int)contentsRect.width(), (int)contentsRect.height()-delta); paintImage(p, imageRect); }else { QRect imageRect(contentsRect.left(), contentsRect.top(), (int)contentsRect.width(), (int)contentsRect.height()); paintImage(p, imageRect); } QRect textRect(contentsRect.left(), contentsRect.top()+(contentsRect.height()/3.0)*2-5, (int)(contentsRect.width() ), (int)contentsRect.height()/2.0); if ( !animEnd ) { p->setPen(Qt::black); p->setFont( QFont("FreeSans", textRect.height()/2+2, QFont::Bold ) ); p->drawText(textRect, Qt::AlignCenter, countdown); p->setPen(Qt::white); p->setFont( QFont("FreeSans", textRect.height()/2, QFont::Bold ) ); p->drawText(textRect, Qt::AlignCenter, countdown); }else { p->setPen(Qt::black); p->setFont( QFont("FreeSans", textRect.height()/3+2, QFont::Bold ) ); p->drawText(textRect, Qt::AlignCenter, countdown); p->setPen(Qt::red); p->setFont( QFont("FreeSans", textRect.height()/3, QFont::Bold ) ); p->drawText(textRect, Qt::AlignCenter, countdown); } p->save(); p->restore(); } void Plasma_Teacooker::paintImage( QPainter *p, const QRect &imageRect ) { QString svg_file = QString(); svg_file = "widgets/teacooker"; Plasma::Svg* svg; svg = new Plasma::Svg(this); svg->setImagePath( svg_file ); svg->setContainsMultipleImages(true); svg->resize(imageRect.width(), imageRect.height()); if ( animCounter == 0 ) { svg->paint(p, imageRect, "empty" ); }else if ( animCounter > 12 ) { animEnd = true; steeping = false; svg->paint(p, imageRect, "done" ); teaDone( m_activeTea ); }else { QString num; num = QString( "%1" ).arg( animCounter ); svg->paint(p, imageRect, "steeping"+num ); } } // this way will be used when tooltipmanager.h becomes available outside SVN void Plasma_Teacooker::createMenu() { // QAction* open = new QAction(SmallIcon("document-open"),i18n("&Open"), this); // actions.append(open); // connect(open, SIGNAL(triggered(bool)), this , SLOT(slotOpen())); // // m_menu.addTitle(i18n("Trash")); // m_menu.addAction(open); // m_menu.addAction(emptyTrash); // // //add the menu as an action icon // QAction* menu = new QAction(SmallIcon("arrow-up-double"),i18n("&Menu"), this); // connect(menu, SIGNAL(triggered(bool)), this , SLOT(popup())); // m_icon->addIconAction(menu); } void Plasma_Teacooker::popup() { // if (m_menu.isVisible()) { // m_menu.hide(); // return; // } // m_menu.popup(popupPosition(m_menu.sizeHint())); // m_icon->setPressed(); } void Plasma_Teacooker::slotOpen() { // emit releaseVisualFocus(); // KRun::runUrl(m_trashUrl, "inode/directory", 0); } void Plasma_Teacooker::pressed() { // emit releaseVisualFocus(); // KRun::runUrl(m_trashUrl, "inode/directory", 0); } void Plasma_Teacooker::startTea( ) { QAction *tmp = qobject_cast(sender()); m_activeTea = tmp->data().toString(); countdownSeconds = m_teas.value( m_activeTea )*60; countdown = ""; timerPause = countdownSeconds*1000/12; steeping = true; refreshCountdown(); refresh(); } void Plasma_Teacooker::resetTea() { animCounter = 0; animEnd = false; steeping = false; countdown = ""; update(); } void Plasma_Teacooker::stopTea() { steeping = false; countdown = ""; update(); } Qt::Orientations Plasma_Teacooker::expandingDirections() const { // no use of additional space in any direction return 0; } QList Plasma_Teacooker::contextualActions() { QList actions; if ( !steeping ) { QAction *tmp; for(QMap::const_iterator it = m_teas.begin(); it != m_teas.end(); ++it) { QString tea = QString( "Steep "+it.key()+" (%1min)" ).arg( m_teas.value( it.key() ) ); tmp = new QAction( tea, this); tmp->setData(it.key()); connect(tmp, SIGNAL(triggered()), this, SLOT(startTea())); actions << tmp; } if ( animEnd ) { actions << m_actionResetTea; } }else if ( !animEnd ) { actions << m_actionStopTea; }else { actions << m_actionResetTea; } return actions; } void Plasma_Teacooker::teaDone( QString tea ) { // because there seems to be no way of making knotify work let's just play something through phonon sound->play(); countdown = tea; // KNotification *notify=new KNotification("kopete_contact_incoming"); // notify->setText(""+tea+" is now ready"); // notify->sendEvent(); // KNotification::event( "kopete_contact_incoming", "Blablabla" ); /* QPixmap m_pix=QPixmap( "widgets/teacooker" ); QString content=i18n("%1 is now ready", tea); KNotification::event( "teacooker_teaReady", content, m_pix, 0L, KNotification::CloseOnTimeout, *teacookerComponent);*/ } #include "plasma-teacooker.moc" TeaCooker/COPYING0000600000175000017500000002400011034053165013341 0ustar swizecswizec GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along witTeaCooker/README~0000600000175000017500000000270411044120600013361 0ustar swizecswizecPlasmoid Tea Cooker widget *********************************************** This KDE4 plasmoid is for all tea lovers who aren't so keen on having a full fledged application, like kteatime, running just to steep their tea. This Software is published under the terms of the GNU GPL V3 and comes without any warranty. Feel free to change or distribute this software. Build dependencies *********************************************** Ubuntu/Debian users: build-essential kde4-devel kde4libs-bin Others: [coming soon] Installation *********************************************** 1. $ tar -xvzf plasma-teacooker-0.1.tar.gz 2. $ cd TeaCooker 3. $ mkdir build 4. $ cd build 4.1 K/X/Ubuntu users: $ export PATH=$PATH:/usr/lib/kde4/bin 5. $ cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` .. 6. $ make 7. $ make install Changelog *********************************************** 21.07.2k8 :: v0.1 - Initial Release (very very rudimentary) 21.07.2k8 :: v0.1.1 - just some changes to the readme - a screenshot and a .deb package 27.07.2k8 :: v0.2.0 - start/reset steeping - some different teas - KNotify (kind of broken atm) 27.07.2k8 :: v0.2.1 - knotify config fixed so it appears properly in system settings - bug where reseting tea cooker didn't also "stop" it fixed - icon size bug fixed 29.07.2k8 :: v0.2.2 - when tea is done steeping you can now reset it to an empty cup 30.07.2k8 :: v0.2.3 - using phonon to play a sound when steeping is done