SVN commit 1005926 by ruberg: Fixed bug concerning the new tooltip Beautified code Added comments M +0 -5 AlphaNumKey.cpp M +12 -3 AlphaNumKey.h M +2 -5 PanelIcon.cpp M +1 -2 PanelIcon.h M +2 -6 widget.cpp M +22 -3 widget.h --- trunk/playground/base/plasma/applets/plasmaboard/AlphaNumKey.cpp #1005925:1005926 @@ -21,7 +21,6 @@ //#include "AlphaNumKey.h" #include #include "AlphaNumKey.h" -#include "widget.h" AlphaNumKey::AlphaNumKey(PlasmaboardWidget *parent): @@ -39,10 +38,6 @@ setLabel(0); } -void AlphaNumKey::setText(const QString &text){ - BoardKey::setText(text); -} - void AlphaNumKey::setLabel(int level){ setText(QChar(Helpers::mapToUnicode(Helpers::keycodeToKeysym(getKeycode(),level)))); } --- trunk/playground/base/plasma/applets/plasmaboard/AlphaNumKey.h #1005925:1005926 @@ -36,18 +36,27 @@ virtual ~AlphaNumKey(); void switchKey(bool isLevel2, bool isAlternative, bool isLocked); + /* + defines the keycode this button must send + */ void setKeycode(unsigned int keysym); - void setText(const QString &text); + /* + * Sets button text regarding the key level + */ void setLabel(int level); public Q_SLOTS: + /* + * called when button is pressed + */ virtual void sendKeycodePress(); + /* + * called when button is released + */ virtual void sendKeycodeRelease(); signals: void keySend ( QString text ); - - }; #endif /* ALPHANUMKEY_H_ */ --- trunk/playground/base/plasma/applets/plasmaboard/PanelIcon.cpp #1005925:1005926 @@ -38,14 +38,11 @@ PanelIcon::~PanelIcon() { - + delete contextExtended; + delete contextBasic; } -void PanelIcon::init(){ -} - - QGraphicsWidget *PanelIcon::graphicsWidget() { if (!m_plasmaboard) { --- trunk/playground/base/plasma/applets/plasmaboard/PanelIcon.h #1005925:1005926 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2008 by Sebastian Kuegler * + * Copyright (C) 2009 by Björn Ruberg -#include -#include -#include -#include -#include #include #include #include @@ -91,7 +86,7 @@ PlasmaboardWidget::~PlasmaboardWidget(){ - + delete tooltipTimer; } void PlasmaboardWidget::resetKeyboard(){ @@ -530,5 +525,6 @@ void PlasmaboardWidget::clearTooltip(){ Plasma::ToolTipManager::self()->hide(this); + tooltip.setMainText(""); Plasma::ToolTipManager::self()->clearContent(this); } --- trunk/playground/base/plasma/applets/plasmaboard/widget.h #1005925:1005926 @@ -24,7 +24,6 @@ #include "BoardKey.h" #include -#include #include #include #include "Helpers.h" @@ -32,13 +31,14 @@ #define XK_TECHNICAL #define XK_PUBLISHING #define XK_LATIN1 + #include class AlphaNumKey; class FuncKey; class QGraphicsGridLayout; -// Define our plasma Applet + class PlasmaboardWidget : public Plasma::Containment { Q_OBJECT @@ -75,11 +75,30 @@ public Q_SLOTS: + /* + * Switch key level between lower and upper + */ void switchLevel(); + /* + * Switch between the alternative lvel + */ void switchAlternative(); + /* + * Switch caps key on and off + */ void switchCaps(); + /* + Unsets all pressed keys despite of caps + */ void clear(); + + /* + Sets tooltip to a new text + */ void setTooltip(QString text); + /* + * Removes tooltip + */ void clearTooltip(); private: @@ -91,7 +110,7 @@ bool isLocked; // is lock activddated bool basicKeys; // are basic keys displayed bool extendedKeys; // are extended keys displayed - QGraphicsGridLayout *m_layout; + QGraphicsGridLayout *m_layout; // layout the keys are positioned in Plasma::ToolTipContent tooltip; QTimer *tooltipTimer; };