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

List:       kde-panel-devel
Subject:    Re: [Panel-devel] [PATCH] Smaller toolbox with icons
From:       "Craig Duquette" <cduquette () gmail ! com>
Date:       2007-12-28 6:45:23
Message-ID: f5fcb8a90712272245i149833a1y1f0272096329fb63 () mail ! gmail ! com
[Download RAW message or body]

Alright I'm going to try and do things one at a time, wait for a
critique, make changes and then upload the changes to SVN instead of
having 1 patch that does a lot of stuff at once :D

This patch I'm attaching changes the toolbox buttons to icons. Text is
stored underneath for the time being until more work is done on
Plasma::Icon allowing me to put text on the side.

Once I get approval on this patch I'll work on fixed-positioning on
the toolbox and positioning of the widgets.

~Craig AKA gamma

On 12/27/07, Chani <chanika@gmail.com> wrote:
>
> > i like the direction of this. it will need text ... but i do like the
> icons
> > ending up on the arc.. maybe the text can appear outside the arc and the
> > icons in the arc.
>
> gamma was talking about two possibilities in irc, iirc: putting text beside
> the icons (should be supported by icons real soon) or having one central
> textlabel that shows the text of the icon under the mouse. tooltips turned
> out to be too ugly in this case.
> oh, and for text beside icons... he'd need it to show up on the left, not
> the
> right, mart.
>
> --
> This message brought to you by evyl bananas, and the number 3.
> www.chani3.com
>

["icons-122707.patch" (text/x-patch)]

Index: containment.h
===================================================================
--- containment.h	(revision 753662)
+++ containment.h	(working copy)
@@ -214,9 +214,15 @@
         void emitLaunchActivated();
 
         /**
-         * Adds an item to the toolbox. The toolbox takes over ownership of the \
item. +         * Constructs a toolbox item and adds it to the toolbox. Returns the \
constructed tool. +         * 
+         * @arg name of the tool
+         * @arg name of the icon
+         * @arg text to be displayed on the icon
+         *
+         * @return the constructed tool
          */
-        void addToolBoxTool(QGraphicsItem *tool, const QString &toolname = \
QString()); +        QObject * addToolBoxTool(const QString &toolName = QString(), \
const QString &iconName = QString(), const QString &iconText = QString());  
         /**
          * Enables or disables a toolbox tool by name
Index: containment.cpp
===================================================================
--- containment.cpp	(revision 753662)
+++ containment.cpp	(working copy)
@@ -45,7 +45,7 @@
 
 #include "layouts/freelayout.h"
 #include "layouts/boxlayout.h"
-#include "widgets/pushbutton.h"
+#include "widgets/icon.h"
 
 namespace Plasma
 {
@@ -182,20 +182,14 @@
 
     if (isContainment() && type == DesktopContainment) {
         if (!d->toolbox) {
-            Plasma::PushButton *tool = new Plasma::PushButton(i18n("Add Widgets"));
-            tool->resize(tool->sizeHint());
-            addToolBoxTool(tool, "addwidgets");
-            connect(tool, SIGNAL(clicked()), this, SIGNAL(showAddWidgets()));
+            QObject *addWidgetTool = addToolBoxTool("addwidgets", "edit-add", "Add \
Widgets"); +            connect(addWidgetTool, SIGNAL(clicked()), this, \
SIGNAL(showAddWidgets()));  
-            tool = new Plasma::PushButton(i18n("Zoom In"));
-            connect(tool, SIGNAL(clicked()), this, SIGNAL(zoomIn()));
-            tool->resize(tool->sizeHint());
-            addToolBoxTool(tool, "zoomIn");
+            QObject *zoomInTool = addToolBoxTool("zoomIn", "zoom-in", "Zoom In");
+            connect(zoomInTool, SIGNAL(clicked()), this, SIGNAL(zoomIn()));
 
-            tool = new Plasma::PushButton(i18n("Zoom Out"));
-            connect(tool, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
-            tool->resize(tool->sizeHint());
-            addToolBoxTool(tool, "zoomOut");
+            QObject *zoomOutTool = addToolBoxTool("zoomOut", "zoom-out", "Zoom \
Out"); +            connect(zoomOutTool, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
         }
     } else {
         delete d->toolbox;
@@ -807,9 +801,20 @@
     emit launchActivated();
 }
 
-void Containment::addToolBoxTool(QGraphicsItem *tool, const QString& toolName)
+QObject * Containment::addToolBoxTool(const QString& toolName, const QString& \
iconName, const QString& iconText)  {
+    Plasma::Icon *tool = new Plasma::Icon(this);
+
+    tool->setIcon(KIcon(iconName));
+    tool->setText(i18n(iconText.toAscii()));
+    QSizeF iconSize = tool->sizeFromIconSize(22);
+    tool->setMinimumSize(iconSize);
+    tool->setMaximumSize(iconSize);
+    tool->resize(tool->sizeHint());
+
     d->createToolbox()->addTool(tool, toolName);
+
+    return tool;
 }
 
 void Containment::enableToolBoxTool(const QString &toolname, bool enable)


["icons.png" (image/png)]

_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel


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

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