[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/plasma/applets/lancelot/app
From:       Ivan Čukić <ivan.cukic+kde () gmail ! com>
Date:       2007-10-10 15:47:14
Message-ID: 1192031234.638367.30242.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 723747 by ivan:

Fixed crashing... everything else is a mess...

 M  +1 -1      ActionListView.cpp  
 M  +1 -1      ActionListView.h  
 M  +11 -6     BaseWidget.cpp  
 M  +6 -3      BaseWidget.h  
 M  +10 -7     ExtenderButton.cpp  
 M  +4 -4      ExtenderButton.h  
 M  +3 -0      LancelotWindow.cpp  
 M  +3 -3      Panel.cpp  
 M  +30 -18    ui_LancelotWindow.h  


--- trunk/extragear/plasma/applets/lancelot/app/ActionListView.cpp #723746:723747
@@ -90,7 +90,7 @@
 Lancelot::ExtenderButton * ActionListView::createButton()
 {
     Lancelot::ExtenderButton * button = new Lancelot::ExtenderButton(
-            "", "", this);
+            "", "", "", this);
     button->resize(size().width() - EXTENDER_SIZE, m_itemHeight);
     button->setInnerOrientation(Lancelot::ExtenderButton::HORIZONTAL);
     button->setExtenderPosition(Lancelot::ExtenderButton::RIGHT);
--- trunk/extragear/plasma/applets/lancelot/app/ActionListView.h #723746:723747
@@ -81,7 +81,7 @@
     class ScrollButton : public Lancelot::BaseWidget {
     public:
         ScrollButton (ActionListView * list, ActionListView::ScrollDirection \
                direction)
-          : BaseWidget("", "", list), m_list(list), m_direction(direction) {
+          : BaseWidget("", "", "", list), m_list(list), m_direction(direction) {
             m_svg = new Plasma::Svg("lancelot/action_list_view");
             m_svg->setContentType(Plasma::Svg::ImageSet);
             m_svgElementPrefix = QString((m_direction == UP)?"up":"down") + \
                "_scroll_";
--- trunk/extragear/plasma/applets/lancelot/app/BaseWidget.cpp #723746:723747
@@ -44,29 +44,29 @@
     resize(140, 38);
 }
 
-BaseWidget::BaseWidget(QString title, QString description, QGraphicsItem * parent)
+BaseWidget::BaseWidget(QString name, QString title, QString description, \
QGraphicsItem * parent)  : Plasma::Widget(parent), m_hover(false), m_svg(NULL), \
                m_svgElementPrefix(""), 
     m_svgElementSufix(""), m_icon(NULL), m_iconInSvg(NULL), m_iconSize(32, 32), 
     m_innerOrientation(HORIZONTAL), m_alignment(Qt::AlignCenter), 
-    m_title(title), m_description(description)
+    m_title(title), m_description(description), m_name(name)
 {
     init();
 }
 
-BaseWidget::BaseWidget(QIcon * icon, QString title, QString description, \
QGraphicsItem * parent) +BaseWidget::BaseWidget(QString name, QIcon * icon, QString \
title, QString description, QGraphicsItem * parent)  : Plasma::Widget(parent), \
m_hover(false), m_svg(NULL), m_svgElementPrefix(""),   m_svgElementSufix(""), \
m_icon(icon), m_iconInSvg(NULL), m_iconSize(32, 32),   \
                m_innerOrientation(HORIZONTAL), m_alignment(Qt::AlignCenter),
-  m_title(title), m_description(description) 
+  m_title(title), m_description(description), m_name(name)
 {
     init();
 }
 
-BaseWidget::BaseWidget(Plasma::Svg * icon, QString title, QString description, \
QGraphicsItem * parent) +BaseWidget::BaseWidget(QString name, Plasma::Svg * icon, \
QString title, QString description, QGraphicsItem * parent)  : \
Plasma::Widget(parent), m_hover(false), m_svg(NULL), m_svgElementPrefix(""),   \
m_svgElementSufix(""), m_icon(NULL), m_iconInSvg(icon), m_iconSize(32, 32),   \
                m_innerOrientation(HORIZONTAL), m_alignment(Qt::AlignCenter),
-  m_title(title), m_description(description) 
+  m_title(title), m_description(description), m_name(name) 
 {
     init();
 }
@@ -107,6 +107,8 @@
     Q_UNUSED(widget);
     Q_UNUSED(option);
     
+    kDebug() << "Painting widget named " << name() << "\n";
+    
     // Background Painting
     if (m_svg) {
         resizeSvg();
@@ -246,6 +248,9 @@
 void BaseWidget::setIconInSvg(Plasma::Svg * icon) { m_iconInSvg = icon; update(); }
 Plasma::Svg * BaseWidget::iconInSvg() const { return m_iconInSvg; }
 
+void BaseWidget::setName(QString name) { m_name = name; }
+QString BaseWidget::name() const { return m_name; }
+
 void BaseWidget::setTitle(QString title) { m_title = title; update(); }
 QString BaseWidget::title() const { return m_title; }
 
--- trunk/extragear/plasma/applets/lancelot/app/BaseWidget.h #723746:723747
@@ -34,9 +34,9 @@
 public:
     enum InnerOrientation { VERTICAL, HORIZONTAL };
     
-    BaseWidget(QString title = QString(), QString description = QString(), \
                QGraphicsItem * parent = 0);
-    BaseWidget(QIcon * icon, QString title = QString(), QString description = \
                QString(), QGraphicsItem * parent = 0);
-    BaseWidget(Plasma::Svg * icon, QString title = QString(), QString description = \
QString(), QGraphicsItem * parent = 0); +    BaseWidget(QString name = QString(), \
QString title = QString(), QString description = QString(), QGraphicsItem * parent = \
0); +    BaseWidget(QString name, QIcon * icon, QString title = QString(), QString \
description = QString(), QGraphicsItem * parent = 0); +    BaseWidget(QString name, \
Plasma::Svg * icon, QString title = QString(), QString description = QString(), \
QGraphicsItem * parent = 0);  
     virtual ~BaseWidget();
 
@@ -71,6 +71,8 @@
     void setAlignment(Qt::Alignment alignment);
     Qt::Alignment alignment() const;
     
+    void setName(QString name);
+    QString name() const;
     
 Q_SIGNALS:
     void mouseHoverEnter();
@@ -92,6 +94,7 @@
     
     QString m_title;
     QString m_description;
+    QString m_name; // ATM mostly for debuging purposes
     
 private:
     void init();
--- trunk/extragear/plasma/applets/lancelot/app/ExtenderButton.cpp #723746:723747
@@ -28,25 +28,25 @@
 Plasma::Svg * ExtenderButton::m_extenderIconSvg= NULL;
 int * ExtenderButton::m_extendersCount = 0;
 
-ExtenderButton::ExtenderButton(QString title, QString description,
+ExtenderButton::ExtenderButton(QString name, QString title, QString description,
         QGraphicsItem * parent) :
-    SUPER(title, description, parent), m_extender(NULL),
+    SUPER(name, title, description, parent), m_extender(NULL),
             m_extenderPosition(NO), m_activationMethod(CLICK)
 {
     init();
 }
 
-ExtenderButton::ExtenderButton(QIcon * icon, QString title,
+ExtenderButton::ExtenderButton(QString name, QIcon * icon, QString title,
         QString description, QGraphicsItem * parent) :
-    SUPER(icon, title, description, parent), m_extender(NULL),
+    SUPER(name, icon, title, description, parent), m_extender(NULL),
             m_extenderPosition(NO), m_activationMethod(CLICK)
 {
     init();
 }
 
-ExtenderButton::ExtenderButton(Plasma::Svg * icon, QString title,
+ExtenderButton::ExtenderButton(QString name, Plasma::Svg * icon, QString title,
         QString description, QGraphicsItem * parent) :
-    SUPER(icon, title, description, parent), m_extender(NULL),
+    SUPER(name, icon, title, description, parent), m_extender(NULL),
             m_extenderPosition(NO), m_activationMethod(CLICK)
 {
     init();
@@ -54,6 +54,7 @@
 
 void ExtenderButton::init()
 {
+    kDebug() << "ExtenderButton::init()\n";
     if (!m_extenderButtonSvg) {
         m_extenderButtonSvg = new Plasma::Svg("lancelot/extender_button");
         m_extenderButtonSvg->setContentType(Plasma::Svg::ImageSet);
@@ -66,7 +67,7 @@
 
     m_svg = m_extenderButtonSvg;
 
-    m_extender = new Extender(m_extenderIconSvg, this);
+    m_extender = new Extender(name() + "::Extender", m_extenderIconSvg, this);
     m_extender->setVisible(false);
     m_extender->m_svg = m_svg;
     m_extender->m_iconSize = QSize(16, 16);
@@ -76,6 +77,8 @@
 
 ExtenderButton::~ExtenderButton()
 {
+    kDebug() << "ExtenderButton::~ExtenderButton()\n";
+
     if (--m_extendersCount == 0) {
         delete m_extenderButtonSvg;
         delete m_extenderIconSvg;
--- trunk/extragear/plasma/applets/lancelot/app/ExtenderButton.h #723746:723747
@@ -43,16 +43,16 @@
 
     class Extender : public SUPER {
     public:
-        Extender(Plasma::Svg * icon, QGraphicsItem * parent = 0) : SUPER(icon, "", \
"", parent) { +        Extender(QString name, Plasma::Svg * icon, QGraphicsItem * \
parent = 0) : SUPER(name, icon, "", "", parent) {  m_svgElementPrefix = "extender_";
         };
         friend class ExtenderButton;
         
     };
 
-    ExtenderButton(QString title = QString(), QString description = QString(), \
                QGraphicsItem * parent = 0);
-    ExtenderButton(QIcon * icon, QString title = QString(), QString description = \
                QString(), QGraphicsItem * parent = 0);
-    ExtenderButton(Plasma::Svg * icon, QString title = QString(), QString \
description = QString(), QGraphicsItem * parent = 0); +    ExtenderButton(QString \
name = QString(), QString title = QString(), QString description = QString(), \
QGraphicsItem * parent = 0); +    ExtenderButton(QString name, QIcon * icon, QString \
title = QString(), QString description = QString(), QGraphicsItem * parent = 0); +    \
ExtenderButton(QString name, Plasma::Svg * icon, QString title = QString(), QString \
description = QString(), QGraphicsItem * parent = 0);  
     virtual ~ExtenderButton();
 
--- trunk/extragear/plasma/applets/lancelot/app/LancelotWindow.cpp #723746:723747
@@ -115,6 +115,9 @@
 }
 
 bool LancelotWindow::lancelotShow() {
+    foreach (Lancelot::ExtenderButton * btn , systemButtons) {
+        kDebug() << "Button's name is " << btn->name() << "\n";
+    }
     show();
     m_hideTimer.stop();
     return true;
--- trunk/extragear/plasma/applets/lancelot/app/Panel.cpp #723746:723747
@@ -5,21 +5,21 @@
 
 Panel::Panel(QIcon * icon, QString title, QGraphicsItem * parent)
   : Plasma::Widget(parent),
-    m_titleWidget(icon, title, "", this), m_layout(NULL), m_widget(NULL)
+    m_titleWidget("", icon, title, "", this), m_layout(NULL), m_widget(NULL)
 {
     init();
 }
 
 Panel::Panel(QString title, QGraphicsItem * parent)
   : Plasma::Widget(parent),
-    m_titleWidget(title, "", this), m_layout(NULL), m_widget(NULL)
+    m_titleWidget("", title, "", this), m_layout(NULL), m_widget(NULL)
 {
     init();
 }
 
 Panel::Panel(QGraphicsItem * parent)
   : Plasma::Widget(parent),
-    m_titleWidget("", "", this), m_layout(NULL), m_widget(NULL)
+    m_titleWidget("", "", "", this), m_layout(NULL), m_widget(NULL)
 {
     init();
 }
--- trunk/extragear/plasma/applets/lancelot/app/ui_LancelotWindow.h #723746:723747
@@ -109,6 +109,7 @@
     
     void setupUi(QFrame * object) 
     {
+        kDebug() << "Ui::LancelotWindow::setupUi() {\n";
         setupShell(object);
         createObjects(object);
         setupObjects(object);
@@ -122,12 +123,13 @@
         layoutMain->setSize(50, Plasma::BottomPositioned);
         
         m_corona->setSceneRect(QRectF(0, 0, 550, 500));
-
+        kDebug() << "} // Ui::LancelotWindow::setupUi()\n";
     }
     
     void createObjects(QFrame * object)
     {
         Q_UNUSED(object);
+        kDebug() << "Ui::LancelotWindow::createObjects()\n";
         
         // Components
         layoutMain = new Plasma::BorderLayout();
@@ -136,25 +138,27 @@
         layoutSystem = new Plasma::HBoxLayout();
         panelSystem = new Lancelot::Panel();
 
+        systemButtons.clear();
         systemButtons.append(buttonSystemLockScreen = 
-            new Lancelot::ExtenderButton(new KIcon("system-lock-screen"), "Lock \
Session", "", panelSystem)); +            new \
Lancelot::ExtenderButton("buttonSystemLockScreen", new KIcon("system-lock-screen"), \
"Lock Session", "", panelSystem));  systemButtons.append(buttonSystemLogout = 
-            new Lancelot::ExtenderButton(new KIcon("system-log-out"), "Log Out...", \
"", panelSystem)); +            new Lancelot::ExtenderButton("buttonSystemLogout", \
new KIcon("system-log-out"), "Log Out...", "", panelSystem));  \
                systemButtons.append(buttonSystemSwitchUser = 
-            new Lancelot::ExtenderButton(new KIcon("switchuser"), "Switch User", "", \
panelSystem)); +            new Lancelot::ExtenderButton("buttonSystemSwitchUser", \
new KIcon("switchuser"), "Switch User", "", panelSystem));  
         // Sections area
         layoutSections = new Plasma::VBoxLayout();
         panelSections = new Lancelot::Panel();
         
+        sectionButtons.clear();
         sectionButtons.append(buttonSectionApplications = 
-            new Lancelot::ExtenderButton(new KIcon("make-kdevelop"), "Applications", \
"", panelSections)); +            new \
Lancelot::ExtenderButton("buttonSectionApplications", new KIcon("make-kdevelop"), \
"Applications", "", panelSections));  sectionButtons.append(buttonSectionContacts = 
-            new Lancelot::ExtenderButton(new KIcon("kontact"), "Contacts", "", \
panelSections)); +            new Lancelot::ExtenderButton("buttonSectionContacts", \
new KIcon("kontact"), "Contacts", "", panelSections));  \
                sectionButtons.append(buttonSectionDocuments = 
-            new Lancelot::ExtenderButton(new KIcon("applications-office"), \
"Documents", "", panelSections)); +            new \
Lancelot::ExtenderButton("buttonSectionDocuments", new KIcon("applications-office"), \
"Documents", "", panelSections));  sectionButtons.append(buttonSectionSystem = 
-            new Lancelot::ExtenderButton(new KIcon("video-display"), "System", "", \
panelSections)); +            new Lancelot::ExtenderButton("buttonSectionSystem", new \
KIcon("video-display"), "System", "", panelSections));  
         // Search area     
         layoutSearch = new Plasma::HBoxLayout();
@@ -166,22 +170,25 @@
     void setupObjects(QFrame * object)
     {
         Q_UNUSED(object);
+        kDebug() << "Ui::LancelotWindow::setupObjects()\n";
 
         // System area
-        layoutMain->addItem(layoutSystem, Plasma::BottomPositioned);
-        
+        layoutMain->addItem(panelSystem, Plasma::BottomPositioned);
+
         foreach (Lancelot::ExtenderButton * button, systemButtons) {
             button->setActivationMethod(Lancelot::ExtenderButton::EXTENDER);
             button->setExtenderPosition(Lancelot::ExtenderButton::BOTTOM);
             button->setIconSize(QSize(24, 24));
             button->setZValue(SYSTEM_BUTTONS_Z_VALUE);
 
-            m_corona->addItem(button);
-            layoutSystem->addItem(button);
+            //m_corona->addItem(button);
+            //layoutSystem->addItem(button);
         }
+        panelSystem->setLayout(layoutSystem);
+        m_corona->addItem(panelSystem);
 
         // Sections area
-        layoutMain->addItem(layoutSections, Plasma::LeftPositioned);
+        layoutMain->addItem(panelSections, Plasma::LeftPositioned);
         layoutSections->setSpacing(0);
         
         foreach (Lancelot::ExtenderButton * button, sectionButtons) {
@@ -190,21 +197,26 @@
             button->setZValue(1);
             button->setInnerOrientation(Lancelot::BaseWidget::VERTICAL);
 
-            m_corona->addItem(button);
-            layoutSections->addItem(button);
+            //m_corona->addItem(button);
+            //layoutSections->addItem(button);
         }
+        panelSections->setLayout(layoutSections);
+        m_corona->addItem(panelSections);
         
-        
-
         // Search area     
-        layoutMain->addItem(layoutSearch, Plasma::TopPositioned);
+        layoutMain->addItem(panelSearch, Plasma::TopPositioned);
         
         layoutSearch->addItem(editSearch);
+        panelSearch->setLayout(layoutSearch);
+        m_corona->addItem(panelSearch);
 
 
+
     }
     
     void setupShell(QFrame * object) {
+        kDebug() << "Ui::LancelotWindow::setupShell()\n";
+        
         object->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);
         KWindowSystem::setState( object->winId(), NET::SkipTaskbar | NET::SkipPager \
| NET::KeepAbove );  


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic