Changes the toolbox tools from buttons to icons.
Changes the toolbox icon from 'configure' to 'plasma' Changed the toolbox gradient to something "prettier" svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=755534
This commit is contained in:
parent
f6bc2e893d
commit
590e039859
@ -45,7 +45,6 @@
|
||||
|
||||
#include "layouts/freelayout.h"
|
||||
#include "layouts/boxlayout.h"
|
||||
#include "widgets/pushbutton.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
@ -182,20 +181,14 @@ void Containment::setContainmentType(Containment::Type type)
|
||||
|
||||
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()));
|
||||
Plasma::Widget *addWidgetTool = addToolBoxTool("addwidgets", "edit-add", i18n("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");
|
||||
Plasma::Widget *zoomInTool = addToolBoxTool("zoomIn", "zoom-in", i18n("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");
|
||||
Plasma::Widget *zoomOutTool = addToolBoxTool("zoomOut", "zoom-out", i18n("Zoom Out"));
|
||||
connect(zoomOutTool, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
|
||||
}
|
||||
} else {
|
||||
delete d->toolbox;
|
||||
@ -814,9 +807,21 @@ void Containment::emitLaunchActivated()
|
||||
emit launchActivated();
|
||||
}
|
||||
|
||||
void Containment::addToolBoxTool(QGraphicsItem *tool, const QString& toolName)
|
||||
Plasma::Widget * Containment::addToolBoxTool(const QString& toolName, const QString& iconName, const QString& iconText)
|
||||
{
|
||||
Plasma::Icon *tool = new Plasma::Icon(this);
|
||||
|
||||
tool->setIcon(KIcon(iconName));
|
||||
tool->setText(iconText);
|
||||
tool->setOrientation(Qt::Horizontal);
|
||||
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)
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <plasma/applet.h>
|
||||
#include <plasma/phase.h>
|
||||
|
||||
#include "widgets/icon.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
@ -214,9 +216,15 @@ class PLASMA_EXPORT Containment : public Applet
|
||||
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. The toolbox takes over ownership of the item. 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());
|
||||
Plasma::Widget * addToolBoxTool(const QString &toolName = QString(), const QString &iconName = QString(), const QString &iconText = QString());
|
||||
|
||||
/**
|
||||
* Enables or disables a toolbox tool by name
|
||||
|
@ -35,7 +35,7 @@ static const int ToolName = 7001;
|
||||
|
||||
DesktopToolbox::DesktopToolbox(QGraphicsItem *parent)
|
||||
: QGraphicsItem(parent),
|
||||
m_icon("configure"),
|
||||
m_icon("plasma"),
|
||||
m_size(50),
|
||||
m_showing(false),
|
||||
m_animId(0),
|
||||
@ -67,8 +67,9 @@ void DesktopToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
||||
QPainterPath p = shape();
|
||||
QRadialGradient gradient(QPoint(m_size*2, 0), m_size*3);
|
||||
gradient.setFocalPoint(QPointF(m_size*2, 0));
|
||||
gradient.setColorAt(0, QColor(255, 255, 255, 128));
|
||||
gradient.setColorAt(.9, QColor(128, 128, 128, 128));
|
||||
gradient.setColorAt(0, QColor(255, 255, 255, 96));
|
||||
gradient.setColorAt(.33, QColor(128, 128, 128, 96));
|
||||
gradient.setColorAt(.66, QColor(128, 128, 128, 0));
|
||||
painter->save();
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
@ -90,7 +91,7 @@ QPainterPath DesktopToolbox::shape() const
|
||||
void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
// Plasma::Phase::self()->moveItem(this, Phase::SlideIn, QPoint(-25, -25));
|
||||
int x = -25; // pos().x();
|
||||
int x = -35; // pos().x();
|
||||
int y = 0; // pos().y();
|
||||
Plasma::Phase* phase = Plasma::Phase::self();
|
||||
foreach (QGraphicsItem* tool, QGraphicsItem::children()) {
|
||||
|
Loading…
Reference in New Issue
Block a user