no more old layouts in libplasma, new stuff on API can start

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=796624
This commit is contained in:
Alexis Ménard 2008-04-13 22:01:18 +00:00
parent 17215e3d33
commit aa3c3eccce
4 changed files with 17 additions and 25 deletions

View File

@ -34,6 +34,7 @@
#include <QTimer> #include <QTimer>
#include <QUiLoader> #include <QUiLoader>
#include <QLabel> #include <QLabel>
#include <QPushButton>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QGraphicsLinearLayout> #include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget> #include <QGraphicsProxyWidget>
@ -67,8 +68,6 @@
#include "plasma/layouts/boxlayout.h" #include "plasma/layouts/boxlayout.h"
#include "plasma/widgets/widget.h" #include "plasma/widgets/widget.h"
#include "plasma/widgets/lineedit.h"
#include "plasma/widgets/pushbutton.h"
//#define DYNAMIC_SHADOWS //#define DYNAMIC_SHADOWS
namespace Plasma namespace Plasma
@ -106,7 +105,6 @@ public:
package(0), package(0),
needsConfigOverlay(0), needsConfigOverlay(0),
background(0), background(0),
failureText(0),
script(0), script(0),
configXml(0), configXml(0),
shadow(0), shadow(0),
@ -311,7 +309,7 @@ public:
QList<QGraphicsItem*> watchedForMouseMove; QList<QGraphicsItem*> watchedForMouseMove;
QStringList loadedEngines; QStringList loadedEngines;
Plasma::SvgPanel *background; Plasma::SvgPanel *background;
Plasma::LineEdit *failureText; //Plasma::LineEdit *failureText;
AppletScript *script; AppletScript *script;
ConfigXml* configXml; ConfigXml* configXml;
ShadowItem* shadow; ShadowItem* shadow;
@ -688,17 +686,14 @@ void Applet::paintWindowFrame ( QPainter * painter, const QStyleOptionGraphicsIt
void Applet::setFailedToLaunch(bool failed, const QString& reason) void Applet::setFailedToLaunch(bool failed, const QString& reason)
{ {
if (d->failed == failed) { if (d->failed == failed) {
if (d->failureText) {
d->failureText->setHtml(visibleFailureText(reason));
setGeometry(QRectF(geometry().topLeft(), d->failureText->sizeHint()));
}
return; return;
} }
d->failed = failed; d->failed = failed;
prepareGeometryChange(); prepareGeometryChange();
d->failureText = 0;
qDeleteAll(QGraphicsItem::children()); qDeleteAll(QGraphicsItem::children());
setLayout(0); setLayout(0);
@ -763,14 +758,15 @@ void Applet::setNeedsConfiguring(bool needsConfig)
d->needsConfigOverlay->setZValue(zValue); d->needsConfigOverlay->setZValue(zValue);
qDeleteAll(d->needsConfigOverlay->QGraphicsItem::children()); qDeleteAll(d->needsConfigOverlay->QGraphicsItem::children());
PushButton* button = new PushButton(d->needsConfigOverlay); QPushButton* button = new QPushButton();
button->setText(i18n("Configure...")); button->setText(i18n("Configure..."));
connect(button, SIGNAL(clicked()), this, SLOT(showConfigurationInterface())); connect(button, SIGNAL(clicked()), this, SLOT(showConfigurationInterface()));
QSizeF s = button->geometry().size(); QGraphicsLinearLayout *configLayout = new QGraphicsLinearLayout(this);
button->resize(s); configLayout->setContentsMargins(0, 0, 0, 0);
button->setPos(d->needsConfigOverlay->boundingRect().width() / 2 - s.width() / 2, QGraphicsProxyWidget * configWidget = new QGraphicsProxyWidget(this);
d->needsConfigOverlay->boundingRect().height() / 2 - s.height() / 2); configWidget->setWidget(button);
button->show(); configLayout->addItem(configWidget);
setLayout(configLayout);
d->needsConfigOverlay->show(); d->needsConfigOverlay->show();
} }

View File

@ -46,9 +46,6 @@
#include "desktoptoolbox_p.h" #include "desktoptoolbox_p.h"
#include "svg.h" #include "svg.h"
#include "layouts/freelayout.h"
#include "layouts/boxlayout.h"
namespace Plasma namespace Plasma
{ {
@ -268,17 +265,17 @@ void Containment::setContainmentType(Containment::Type type)
if (isContainment() && type == DesktopContainment) { if (isContainment() && type == DesktopContainment) {
if (!d->toolbox) { if (!d->toolbox) {
Plasma::Widget *addWidgetTool = addToolBoxTool("addwidgets", "list-add", i18n("Add Widgets")); QGraphicsWidget *addWidgetTool = addToolBoxTool("addwidgets", "list-add", i18n("Add Widgets"));
connect(addWidgetTool, SIGNAL(clicked()), this, SIGNAL(showAddWidgets())); connect(addWidgetTool, SIGNAL(clicked()), this, SIGNAL(showAddWidgets()));
Plasma::Widget *zoomInTool = addToolBoxTool("zoomIn", "zoom-in", i18n("Zoom In")); QGraphicsWidget *zoomInTool = addToolBoxTool("zoomIn", "zoom-in", i18n("Zoom In"));
connect(zoomInTool, SIGNAL(clicked()), this, SLOT(zoomIn())); connect(zoomInTool, SIGNAL(clicked()), this, SLOT(zoomIn()));
Plasma::Widget *zoomOutTool = addToolBoxTool("zoomOut", "zoom-out", i18n("Zoom Out")); QGraphicsWidget *zoomOutTool = addToolBoxTool("zoomOut", "zoom-out", i18n("Zoom Out"));
connect(zoomOutTool, SIGNAL(clicked()), this, SIGNAL(zoomOut())); connect(zoomOutTool, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
if (!isKioskImmutable()) { if (!isKioskImmutable()) {
Plasma::Widget *lockTool = addToolBoxTool("lockWidgets", "object-locked", QGraphicsWidget *lockTool = addToolBoxTool("lockWidgets", "object-locked",
isImmutable() ? i18n("Unlock Widgets") : isImmutable() ? i18n("Unlock Widgets") :
i18n("Lock Widgets")); i18n("Lock Widgets"));
connect(lockTool, SIGNAL(clicked()), this, SLOT(toggleDesktopImmutability())); connect(lockTool, SIGNAL(clicked()), this, SLOT(toggleDesktopImmutability()));
@ -1214,7 +1211,7 @@ void Containment::emitLaunchActivated()
emit launchActivated(); emit launchActivated();
} }
Plasma::Widget * Containment::addToolBoxTool(const QString& toolName, const QString& iconName, const QString& iconText) QGraphicsWidget * Containment::addToolBoxTool(const QString& toolName, const QString& iconName, const QString& iconText)
{ {
Plasma::Icon *tool = new Plasma::Icon(this); Plasma::Icon *tool = new Plasma::Icon(this);

View File

@ -273,7 +273,7 @@ class PLASMA_EXPORT Containment : public Applet
* *
* @return the constructed tool * @return the constructed tool
*/ */
Plasma::Widget * addToolBoxTool(const QString &toolName = QString(), const QString &iconName = QString(), const QString &iconText = QString()); QGraphicsWidget * addToolBoxTool(const QString &toolName = QString(), const QString &iconName = QString(), const QString &iconText = QString());
/** /**
* Enables or disables a toolbox tool by name * Enables or disables a toolbox tool by name

View File

@ -40,7 +40,6 @@
#include "plasma/applet.h" #include "plasma/applet.h"
#include "layouts/freelayout.h"
#include "plasma/plasma.h" #include "plasma/plasma.h"
#include "plasma/view.h" #include "plasma/view.h"
#include "plasma/containment.h" #include "plasma/containment.h"