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

List:       kde-commits
Subject:    playground/base/plasma/applets/systray-refactor
From:       Jason Stubbs <jasonbstubbs () gmail ! com>
Date:       2008-07-27 14:23:23
Message-ID: 1217168603.371662.10178.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 838321 by jstubbs:

Splitting out the tray icon layout into a separate child widget. Layouting
problems are still occurring... :(


 M  +1 -0      CMakeLists.txt  
 M  +1 -1      core/fdo/x11embedcontainer.cpp  
 M  +1 -1      core/fdo/x11embedcontainer.h  
 M  +16 -20    ui/applet.cpp  
 M  +5 -7      ui/applet.h  
 A             ui/taskarea.cpp   [License: GPL (v2+)]
 A             ui/taskarea.h   [License: GPL (v2+)]


--- trunk/playground/base/plasma/applets/systray-refactor/CMakeLists.txt #838320:838321
@@ -13,6 +13,7 @@
     core/fdo/x11embedcontainer.cpp
 
     ui/applet.cpp
+    ui/taskarea.cpp
 
     )
 
--- trunk/playground/base/plasma/applets/systray-refactor/core/fdo/x11embedcontainer.cpp #838320:838321
@@ -1,7 +1,7 @@
 /***************************************************************************
  *   systemtraywidget.h                                                    *
  *                                                                         *
- *   Copyright (C) 2007 Jason Stubbs <jasonbstubbs@gmail.com>              *
+ *   Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com>              *
  *                                                                         *
  *   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  *
--- trunk/playground/base/plasma/applets/systray-refactor/core/fdo/x11embedcontainer.h #838320:838321
@@ -1,7 +1,7 @@
 /***************************************************************************
  *   x11embedcontainer.h                                                   *
  *                                                                         *
- *   Copyright (C) 2007 Jason Stubbs <jasonbstubbs@gmail.com>              *
+ *   Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com>              *
  *                                                                         *
  *   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  *
--- trunk/playground/base/plasma/applets/systray-refactor/ui/applet.cpp #838320:838321
@@ -1,7 +1,7 @@
 /***************************************************************************
- *   systemtray.cpp                                                        *
+ *   applet.cpp                                                            *
  *                                                                         *
- *   Copyright (C) 2007 Jason Stubbs <jasonbstubbs@gmail.com>              *
+ *   Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com>              *
  *                                                                         *
  *   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  *
@@ -23,6 +23,9 @@
 #include "applet.h"
 #include "../core/manager.h"
 
+// Qt
+#include <QGraphicsGridLayout>
+
 // Plasma
 #include <plasma/panelsvg.h>
 
@@ -35,7 +38,6 @@
 
 Applet::Applet(QObject *parent, const QVariantList &arguments)
     : Plasma::Applet(parent, arguments)
-    , layout(new QGraphicsLinearLayout(this))
 {
 }
 
@@ -43,10 +45,17 @@
 void
 Applet::init()
 {
+    QGraphicsGridLayout* layout = new QGraphicsGridLayout();
+
+    taskArea = new TaskArea();
+    layout->addItem(taskArea, 1, 1);
+
+    setLayout(layout);
+
     connect(Manager::self(), SIGNAL(taskAdded(Task*)),
             this, SLOT(handleTaskAdd(Task*)));
     connect(Manager::self(), SIGNAL(taskRemoved(Task*)),
-            this, SLOT(handleTaskRemove(Task*)));
+            taskArea, SLOT(removeTask(Task*)));
 
     foreach (Task* task, Manager::self()->tasks()) {
         handleTaskAdd(task);
@@ -59,9 +68,9 @@
 {
     if (constraints & Plasma::FormFactorConstraint) {
         if (formFactor() == Plasma::Vertical) {
-            layout->setOrientation(Qt::Vertical);
+            taskArea->setOrientation(Qt::Vertical);
         } else {
-            layout->setOrientation(Qt::Horizontal);
+            taskArea->setOrientation(Qt::Horizontal);
         }
     }
 }
@@ -71,24 +80,11 @@
 Applet::handleTaskAdd(Task* task)
 {
     if (task->isEmbeddable()) {
-        layout->addItem(task->widget());
+        taskArea->addTask(task);
     }
-    layout->invalidate();
-    resize(layout->effectiveSizeHint(Qt::MinimumSize));
 }
 
 
-void
-Applet::handleTaskRemove(Task* task)
-{
-    foreach (QGraphicsWidget* widget, task->associatedWidgets()) {
-        layout->removeItem(widget);
-    }
-    layout->invalidate();
-    resize(layout->effectiveSizeHint(Qt::MinimumSize));
-}
-
-
 };
 
 #include "applet.moc"
--- trunk/playground/base/plasma/applets/systray-refactor/ui/applet.h #838320:838321
@@ -1,8 +1,7 @@
 /***************************************************************************
- *   systemtray.h                                                          *
+ *   applet.h                                                              *
  *                                                                         *
- *   Copyright (C) 2007 Alexander Rodin <rodin.alexander@gmail.com>        *
- *   Copyright (C) 2007 Jason Stubbs <jasonbstubbs@gmail.com>              *
+ *   Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com>              *
  *                                                                         *
  *   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  *
@@ -25,13 +24,13 @@
 
 // Plasma
 #include <plasma/applet.h>
-#include <plasma/panelsvg.h>
 
 // Qt
 #include <QGraphicsLinearLayout>
 
 // Own
-#include "core/task.h"
+#include "taskarea.h"
+#include "../core/task.h"
 
 
 namespace SystemTray
@@ -49,10 +48,9 @@
 
 private slots:
     void handleTaskAdd(Task* task);
-    void handleTaskRemove(Task* task);
 
 private:
-    QGraphicsLinearLayout* layout;
+    TaskArea* taskArea;
 };
 
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

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