zooming is gone; activity switching can be done for now using the activity switcher or the keyboard shortcuts. a new activity manager will be built up from here
svn path=/trunk/KDE/kdelibs/; revision=1080793
This commit is contained in:
parent
586e18576b
commit
5eb78f23ea
22
applet.cpp
22
applet.cpp
@ -69,6 +69,7 @@
|
|||||||
|
|
||||||
#include <solid/powermanagement.h>
|
#include <solid/powermanagement.h>
|
||||||
|
|
||||||
|
#include "abstracttoolbox.h"
|
||||||
#include "authorizationmanager.h"
|
#include "authorizationmanager.h"
|
||||||
#include "authorizationrule.h"
|
#include "authorizationrule.h"
|
||||||
#include "configloader.h"
|
#include "configloader.h"
|
||||||
@ -106,7 +107,6 @@
|
|||||||
#include "private/popupapplet_p.h"
|
#include "private/popupapplet_p.h"
|
||||||
#include "private/remotedataengine_p.h"
|
#include "private/remotedataengine_p.h"
|
||||||
#include "private/service_p.h"
|
#include "private/service_p.h"
|
||||||
#include "private/internaltoolbox_p.h"
|
|
||||||
#include "ui_publish.h"
|
#include "ui_publish.h"
|
||||||
|
|
||||||
#include "config-plasma.h"
|
#include "config-plasma.h"
|
||||||
@ -394,6 +394,7 @@ void Applet::saveState(KConfigGroup &group) const
|
|||||||
if (d->script) {
|
if (d->script) {
|
||||||
emit d->script->saveState(group);
|
emit d->script->saveState(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group.config()->name() != config().config()->name()) {
|
if (group.config()->name() != config().config()->name()) {
|
||||||
// we're being saved to a different file!
|
// we're being saved to a different file!
|
||||||
// let's just copy the current values in our configuration over
|
// let's just copy the current values in our configuration over
|
||||||
@ -452,8 +453,7 @@ void Applet::destroy()
|
|||||||
if (isContainment()) {
|
if (isContainment()) {
|
||||||
d->cleanUpAndDelete();
|
d->cleanUpAndDelete();
|
||||||
} else {
|
} else {
|
||||||
Animation *zoomAnim =
|
Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
||||||
Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
|
||||||
connect(zoomAnim, SIGNAL(finished()), this, SLOT(appletAnimationComplete()));
|
connect(zoomAnim, SIGNAL(finished()), this, SLOT(appletAnimationComplete()));
|
||||||
zoomAnim->setTargetWidget(this);
|
zoomAnim->setTargetWidget(this);
|
||||||
zoomAnim->start();
|
zoomAnim->start();
|
||||||
@ -1322,17 +1322,6 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
|
|||||||
View* v = qobject_cast<Plasma::View*>(widget->parent());
|
View* v = qobject_cast<Plasma::View*>(widget->parent());
|
||||||
Containment* c = qobject_cast<Plasma::Containment*>(this);
|
Containment* c = qobject_cast<Plasma::Containment*>(this);
|
||||||
|
|
||||||
//update the view transform of the toolbox, since it ignores transforms
|
|
||||||
if (v && c && c->d->toolBox) {
|
|
||||||
InternalToolBox *toolBox = qobject_cast<InternalToolBox *>(c->d->toolBox.data());
|
|
||||||
if (toolBox && toolBox->viewTransform().isScaling() && !v->transform().isScaling()) {
|
|
||||||
c->d->positionToolBox();
|
|
||||||
}
|
|
||||||
if (toolBox && v) {
|
|
||||||
toolBox->setViewTransform(v->transform());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!v || v->isWallpaperEnabled()) {
|
if (!v || v->isWallpaperEnabled()) {
|
||||||
|
|
||||||
// paint the wallpaper
|
// paint the wallpaper
|
||||||
@ -1923,7 +1912,7 @@ void AppletPrivate::updateShortcuts()
|
|||||||
//we pull them out, then read, then put them back
|
//we pull them out, then read, then put them back
|
||||||
QList<QString> names;
|
QList<QString> names;
|
||||||
QList<QAction*> qactions;
|
QList<QAction*> qactions;
|
||||||
names << "zoom out" << "add sibling containment" << "configure shortcuts" << "lock widgets";
|
names << "add sibling containment" << "configure shortcuts" << "lock widgets";
|
||||||
foreach (const QString &name, names) {
|
foreach (const QString &name, names) {
|
||||||
QAction *a = actions->action(name);
|
QAction *a = actions->action(name);
|
||||||
actions->takeAction(a); //FIXME this is stupid, KActionCollection needs a takeAction(QString) method
|
actions->takeAction(a); //FIXME this is stupid, KActionCollection needs a takeAction(QString) method
|
||||||
@ -2856,8 +2845,7 @@ AppletOverlayWidget::AppletOverlayWidget(QGraphicsWidget *parent)
|
|||||||
|
|
||||||
void AppletOverlayWidget::destroy()
|
void AppletOverlayWidget::destroy()
|
||||||
{
|
{
|
||||||
Animation *zoomAnim =
|
Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
||||||
Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
|
||||||
connect(zoomAnim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete()));
|
connect(zoomAnim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete()));
|
||||||
zoomAnim->setTargetWidget(this);
|
zoomAnim->setTargetWidget(this);
|
||||||
zoomAnim->start();
|
zoomAnim->start();
|
||||||
|
@ -202,37 +202,26 @@ void Containment::init()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->type == PanelContainment ||
|
if (d->type != PanelContainment && d->type != CustomPanelContainment) {
|
||||||
d->type == CustomPanelContainment) {
|
|
||||||
d->actions()->removeAction(action("zoom in"));
|
|
||||||
} else {
|
|
||||||
QAction *zoomAction = action("zoom in");
|
|
||||||
connect(zoomAction, SIGNAL(triggered()), this, SLOT(zoomIn()));
|
|
||||||
|
|
||||||
if (corona()) {
|
if (corona()) {
|
||||||
QAction *action = corona()->action("zoom out");
|
act = corona()->action("add sibling containment");
|
||||||
if (action) {
|
if (act) {
|
||||||
d->actions()->addAction("zoom out", action);
|
d->actions()->addAction("add sibling containment", act);
|
||||||
}
|
|
||||||
action = corona()->action("add sibling containment");
|
|
||||||
if (action) {
|
|
||||||
d->actions()->addAction("add sibling containment", action);
|
|
||||||
}
|
}
|
||||||
//a stupid hack to make this one's keyboard shortcut work
|
//a stupid hack to make this one's keyboard shortcut work
|
||||||
action = corona()->action("configure shortcuts");
|
act = corona()->action("configure shortcuts");
|
||||||
if (action) {
|
if (act) {
|
||||||
d->actions()->addAction("configure shortcuts", action);
|
d->actions()->addAction("configure shortcuts", act);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->type == DesktopContainment && d->toolBox) {
|
if (d->type == DesktopContainment && d->toolBox) {
|
||||||
d->toolBox.data()->addTool(this->action("add widgets"));
|
d->toolBox.data()->addTool(action("add widgets"));
|
||||||
d->toolBox.data()->addTool(this->action("zoom in"));
|
|
||||||
|
|
||||||
//TODO: do we need some way to allow this be overridden?
|
//TODO: do we need some way to allow this be overridden?
|
||||||
// it's always available because shells rely on this
|
// it's always available because shells rely on this
|
||||||
// to offer their own custom configuration as well
|
// to offer their own custom configuration as well
|
||||||
QAction *configureContainment = this->action("configure");
|
QAction *configureContainment = action("configure");
|
||||||
if (configureContainment) {
|
if (configureContainment) {
|
||||||
d->toolBox.data()->addTool(configureContainment);
|
d->toolBox.data()->addTool(configureContainment);
|
||||||
}
|
}
|
||||||
@ -311,15 +300,6 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
|
|||||||
//no icon
|
//no icon
|
||||||
action->setShortcut(KShortcut("alt+d, p"));
|
action->setShortcut(KShortcut("alt+d, p"));
|
||||||
action->setData(AbstractToolBox::ControlTool);
|
action->setData(AbstractToolBox::ControlTool);
|
||||||
|
|
||||||
KAction *zoomAction = actions->addAction("zoom in");
|
|
||||||
zoomAction->setAutoRepeat(false);
|
|
||||||
zoomAction->setText(i18n("Zoom In"));
|
|
||||||
zoomAction->setIcon(KIcon("zoom-in"));
|
|
||||||
//two shortcuts because I hate ctrl-+ but others expect it
|
|
||||||
zoomAction->setShortcuts(KShortcut("alt+d, +; alt+d, ="));
|
|
||||||
zoomAction->setData(AbstractToolBox::ControlTool);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper function for sorting the list of applets
|
// helper function for sorting the list of applets
|
||||||
@ -382,9 +362,9 @@ void Containment::restore(KConfigGroup &group)
|
|||||||
setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper),
|
setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper),
|
||||||
group.readEntry("wallpaperpluginmode", defaultWallpaperMode));
|
group.readEntry("wallpaperpluginmode", defaultWallpaperMode));
|
||||||
|
|
||||||
InternalToolBox *toolBox = qobject_cast<InternalToolBox *>(d->toolBox.data());
|
InternalToolBox *internalToolBox = qobject_cast<InternalToolBox *>(d->toolBox.data());
|
||||||
if (toolBox) {
|
if (internalToolBox) {
|
||||||
toolBox->load(group);
|
internalToolBox->restore(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
KConfigGroup cfg(&group, "ActionPlugins");
|
KConfigGroup cfg(&group, "ActionPlugins");
|
||||||
@ -2094,20 +2074,6 @@ void Containment::destroy(bool confirm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainmentPrivate::zoomIn()
|
|
||||||
{
|
|
||||||
emit q->zoomRequested(q, Plasma::ZoomIn);
|
|
||||||
positionToolBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ContainmentPrivate::zoomOut()
|
|
||||||
{
|
|
||||||
emit q->zoomRequested(q, Plasma::ZoomOut);
|
|
||||||
positionToolBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractToolBox *ContainmentPrivate::createToolBox()
|
AbstractToolBox *ContainmentPrivate::createToolBox()
|
||||||
{
|
{
|
||||||
if (!toolBox) {
|
if (!toolBox) {
|
||||||
@ -2135,11 +2101,11 @@ AbstractToolBox *ContainmentPrivate::createToolBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toolBox) {
|
if (toolBox) {
|
||||||
InternalToolBox *internalToolBox = qobject_cast<InternalToolBox *>(toolBox.data());
|
|
||||||
QObject::connect(toolBox.data(), SIGNAL(toggled()), q, SIGNAL(toolBoxToggled()));
|
QObject::connect(toolBox.data(), SIGNAL(toggled()), q, SIGNAL(toolBoxToggled()));
|
||||||
QObject::connect(toolBox.data(), SIGNAL(toggled()), q, SLOT(updateToolBoxVisibility()));
|
QObject::connect(toolBox.data(), SIGNAL(toggled()), q, SLOT(updateToolBoxVisibility()));
|
||||||
|
InternalToolBox *internalToolBox = qobject_cast<InternalToolBox *>(toolBox.data());
|
||||||
if (internalToolBox) {
|
if (internalToolBox) {
|
||||||
internalToolBox->load();
|
internalToolBox->restore();
|
||||||
positionToolBox();
|
positionToolBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2152,6 +2118,7 @@ void ContainmentPrivate::positionToolBox()
|
|||||||
{
|
{
|
||||||
InternalToolBox *internalToolBox = qobject_cast<InternalToolBox *>(toolBox.data());
|
InternalToolBox *internalToolBox = qobject_cast<InternalToolBox *>(toolBox.data());
|
||||||
if (internalToolBox) {
|
if (internalToolBox) {
|
||||||
|
internalToolBox->updateToolBox();
|
||||||
internalToolBox->reposition();
|
internalToolBox->reposition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,6 +402,7 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when the containment requests zooming in or out one step.
|
* Emitted when the containment requests zooming in or out one step.
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
void zoomRequested(Plasma::Containment *containment, Plasma::ZoomDirection direction);
|
void zoomRequested(Plasma::Containment *containment, Plasma::ZoomDirection direction);
|
||||||
|
|
||||||
@ -608,8 +609,6 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
|
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
|
||||||
Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
|
Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
|
||||||
Q_PRIVATE_SLOT(d, void positionToolBox())
|
Q_PRIVATE_SLOT(d, void positionToolBox())
|
||||||
Q_PRIVATE_SLOT(d, void zoomIn())
|
|
||||||
Q_PRIVATE_SLOT(d, void zoomOut())
|
|
||||||
Q_PRIVATE_SLOT(d, void requestConfiguration())
|
Q_PRIVATE_SLOT(d, void requestConfiguration())
|
||||||
Q_PRIVATE_SLOT(d, void updateToolBoxVisibility())
|
Q_PRIVATE_SLOT(d, void updateToolBoxVisibility())
|
||||||
Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
|
Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
|
||||||
|
@ -181,8 +181,6 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
|
|||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
|
||||||
int value = int(0xff * amount);
|
|
||||||
|
|
||||||
QPixmap startPixmap(from);
|
QPixmap startPixmap(from);
|
||||||
QPixmap targetPixmap(to);
|
QPixmap targetPixmap(to);
|
||||||
|
|
||||||
|
@ -85,8 +85,6 @@ public:
|
|||||||
void handleDisappeared(AppletHandle *handle);
|
void handleDisappeared(AppletHandle *handle);
|
||||||
void appletDestroyed(Plasma::Applet*);
|
void appletDestroyed(Plasma::Applet*);
|
||||||
void appletAppearAnimationComplete();
|
void appletAppearAnimationComplete();
|
||||||
void zoomIn();
|
|
||||||
void zoomOut();
|
|
||||||
void clearDataForMimeJob(KIO::Job *job);
|
void clearDataForMimeJob(KIO::Job *job);
|
||||||
void remoteAppletReady(Plasma::AccessAppletJob *job);
|
void remoteAppletReady(Plasma::AccessAppletJob *job);
|
||||||
void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype);
|
void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype);
|
||||||
|
@ -49,51 +49,33 @@ class EmptyGraphicsItem : public QGraphicsWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EmptyGraphicsItem(QGraphicsItem *parent)
|
EmptyGraphicsItem(QGraphicsItem *parent)
|
||||||
: QGraphicsWidget(parent),
|
: QGraphicsWidget(parent)
|
||||||
m_toolbar(true)
|
|
||||||
{
|
{
|
||||||
setAcceptsHoverEvents(true);
|
setAcceptsHoverEvents(true);
|
||||||
m_layout = new QGraphicsLinearLayout(this);
|
m_layout = new QGraphicsLinearLayout(this);
|
||||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
m_layout->setSpacing(0);
|
m_layout->setSpacing(0);
|
||||||
m_background = new Plasma::FrameSvg(this);
|
m_background = new Plasma::FrameSvg(this);
|
||||||
setIsToolbar(false);
|
m_background->setImagePath("widgets/background");
|
||||||
|
m_background->setEnabledBorders(FrameSvg::AllBorders);
|
||||||
|
m_layout->setOrientation(Qt::Vertical);
|
||||||
|
updateMargins();
|
||||||
}
|
}
|
||||||
|
|
||||||
~EmptyGraphicsItem()
|
~EmptyGraphicsItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIsToolbar(bool toolbar)
|
void updateMargins()
|
||||||
{
|
{
|
||||||
if (m_toolbar == toolbar) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_toolbar = toolbar;
|
|
||||||
if (m_toolbar) {
|
|
||||||
m_background->setImagePath("widgets/toolbox");
|
|
||||||
m_background->setEnabledBorders(FrameSvg::LeftBorder|FrameSvg::RightBorder|FrameSvg::BottomBorder);
|
|
||||||
m_layout->setOrientation(Qt::Horizontal);
|
|
||||||
} else {
|
|
||||||
m_background->setImagePath("widgets/background");
|
|
||||||
m_background->setEnabledBorders(FrameSvg::AllBorders);
|
|
||||||
m_layout->setOrientation(Qt::Vertical);
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal left, top, right, bottom;
|
qreal left, top, right, bottom;
|
||||||
m_background->getMargins(left, top, right, bottom);
|
m_background->getMargins(left, top, right, bottom);
|
||||||
setContentsMargins(left, top, right, bottom);
|
setContentsMargins(left, top, right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isToolbar() const
|
void paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *)
|
||||||
{
|
{
|
||||||
return m_toolbar;
|
m_background->paintFrame(p, option->rect, option->rect);
|
||||||
}
|
|
||||||
|
|
||||||
void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
|
|
||||||
{
|
|
||||||
m_background->paintFrame(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearLayout()
|
void clearLayout()
|
||||||
@ -115,9 +97,7 @@ class EmptyGraphicsItem : public QGraphicsWidget
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_toolbar;
|
|
||||||
QRectF m_rect;
|
QRectF m_rect;
|
||||||
Plasma::FrameSvg *m_toolbarBackground;
|
|
||||||
Plasma::FrameSvg *m_background;
|
Plasma::FrameSvg *m_background;
|
||||||
QGraphicsLinearLayout *m_layout;
|
QGraphicsLinearLayout *m_layout;
|
||||||
};
|
};
|
||||||
@ -250,7 +230,7 @@ QSize DesktopToolBox::fullHeight() const
|
|||||||
|
|
||||||
void DesktopToolBox::toolTipAboutToShow()
|
void DesktopToolBox::toolTipAboutToShow()
|
||||||
{
|
{
|
||||||
if (isToolbar() || isShowing()) {
|
if (isShowing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,10 +296,6 @@ void DesktopToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||||||
Q_UNUSED(option)
|
Q_UNUSED(option)
|
||||||
Q_UNUSED(widget)
|
Q_UNUSED(widget)
|
||||||
|
|
||||||
if (isToolbar()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPainterPath p = shape();
|
QPainterPath p = shape();
|
||||||
|
|
||||||
QPoint iconPos;
|
QPoint iconPos;
|
||||||
@ -507,9 +483,7 @@ QGraphicsWidget *DesktopToolBox::toolParent()
|
|||||||
|
|
||||||
void DesktopToolBox::showToolBox()
|
void DesktopToolBox::showToolBox()
|
||||||
{
|
{
|
||||||
setFlag(ItemIgnoresTransformations, isToolbar());
|
if (isShowing()) {
|
||||||
|
|
||||||
if (isShowing() && !isToolbar()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +492,6 @@ void DesktopToolBox::showToolBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
d->toolBacker->setZValue(zValue() + 1);
|
d->toolBacker->setZValue(zValue() + 1);
|
||||||
d->toolBacker->setIsToolbar(isToolbar());
|
|
||||||
|
|
||||||
adjustToolBackerGeometry();
|
adjustToolBackerGeometry();
|
||||||
|
|
||||||
@ -533,6 +506,7 @@ void DesktopToolBox::showToolBox()
|
|||||||
|
|
||||||
void DesktopToolBox::updateToolBox()
|
void DesktopToolBox::updateToolBox()
|
||||||
{
|
{
|
||||||
|
InternalToolBox::updateToolBox();
|
||||||
adjustToolBackerGeometry();
|
adjustToolBackerGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,15 +529,6 @@ void DesktopToolBox::adjustToolBackerGeometry()
|
|||||||
} else {
|
} else {
|
||||||
icon->hide();
|
icon->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewTransform().m11() != Plasma::scalingFactor(Plasma::OverviewZoom) &&
|
|
||||||
(viewTransform().m11() == Plasma::scalingFactor(Plasma::DesktopZoom) ||
|
|
||||||
icon->action() == d->containment->action("add sibling containment") ||
|
|
||||||
icon->action() == d->containment->action("add widgets"))) {
|
|
||||||
icon->setText(icon->action()->text());
|
|
||||||
} else {
|
|
||||||
icon->setText(QString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal left, top, right, bottom;
|
qreal left, top, right, bottom;
|
||||||
@ -609,34 +574,21 @@ void DesktopToolBox::adjustToolBackerGeometry()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isToolbar()) {
|
//kDebug() << "starting at" << x << startY;
|
||||||
QPointF topRight;
|
d->toolBacker->setPos(x, y);
|
||||||
|
// now check that it actually fits within the parent's boundaries
|
||||||
|
QRectF backerRect = mapToParent(d->toolBacker->geometry()).boundingRect();
|
||||||
|
QSizeF parentSize = parentWidget()->size();
|
||||||
|
if (backerRect.x() < 5) {
|
||||||
|
d->toolBacker->setPos(mapFromParent(QPointF(5, 0)).x(), y);
|
||||||
|
} else if (backerRect.right() > parentSize.width() - 5) {
|
||||||
|
d->toolBacker->setPos(mapFromParent(QPointF(parentSize.width() - 5 - backerRect.width(), 0)).x(), y);
|
||||||
|
}
|
||||||
|
|
||||||
//could that cast ever fail?
|
if (backerRect.y() < 5) {
|
||||||
if (d->containment) {
|
d->toolBacker->setPos(x, mapFromParent(QPointF(0, 5)).y());
|
||||||
topRight = d->containment->geometry().bottomRight();
|
} else if (backerRect.bottom() > parentSize.height() - 5) {
|
||||||
} else {
|
d->toolBacker->setPos(x, mapFromParent(QPointF(0, parentSize.height() - 5 - backerRect.height())).y());
|
||||||
topRight = boundingRect().topRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
d->toolBacker->setPos(viewTransform().map(mapFromScene(topRight))-QPoint(d->toolBacker->size().width(), 0));
|
|
||||||
} else {
|
|
||||||
//kDebug() << "starting at" << x << startY;
|
|
||||||
d->toolBacker->setPos(x, y);
|
|
||||||
// now check that it actually fits within the parent's boundaries
|
|
||||||
QRectF backerRect = mapToParent(d->toolBacker->geometry()).boundingRect();
|
|
||||||
QSizeF parentSize = parentWidget()->size();
|
|
||||||
if (backerRect.x() < 5) {
|
|
||||||
d->toolBacker->setPos(mapFromParent(QPointF(5, 0)).x(), y);
|
|
||||||
} else if (backerRect.right() > parentSize.width() - 5) {
|
|
||||||
d->toolBacker->setPos(mapFromParent(QPointF(parentSize.width() - 5 - backerRect.width(), 0)).x(), y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (backerRect.y() < 5) {
|
|
||||||
d->toolBacker->setPos(x, mapFromParent(QPointF(0, 5)).y());
|
|
||||||
} else if (backerRect.bottom() > parentSize.height() - 5) {
|
|
||||||
d->toolBacker->setPos(x, mapFromParent(QPointF(0, parentSize.height() - 5 - backerRect.height())).y());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,7 +596,7 @@ void DesktopToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
{
|
{
|
||||||
//kDebug() << event->pos() << event->scenePos()
|
//kDebug() << event->pos() << event->scenePos()
|
||||||
// << d->toolBacker->rect().contains(event->scenePos().toPoint());
|
// << d->toolBacker->rect().contains(event->scenePos().toPoint());
|
||||||
if (!d->hovering || isShowing() || isToolbar()) {
|
if (!d->hovering || isShowing()) {
|
||||||
QGraphicsItem::hoverLeaveEvent(event);
|
QGraphicsItem::hoverLeaveEvent(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -656,14 +608,6 @@ void DesktopToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
|
|
||||||
void DesktopToolBox::hideToolBox()
|
void DesktopToolBox::hideToolBox()
|
||||||
{
|
{
|
||||||
foreach (QGraphicsItem *tool, tools()) {
|
|
||||||
const int height = static_cast<int>(tool->boundingRect().height());
|
|
||||||
if (isToolbar()) {
|
|
||||||
tool->setPos(toolPosition(height));
|
|
||||||
tool->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d->toolBacker) {
|
if (d->toolBacker) {
|
||||||
Plasma::Animation *fadeAnim = Animator::create(Animator::FadeAnimation, d->toolBacker);
|
Plasma::Animation *fadeAnim = Animator::create(Animator::FadeAnimation, d->toolBacker);
|
||||||
connect(fadeAnim, SIGNAL(finished()), this, SLOT(hideToolBacker()));
|
connect(fadeAnim, SIGNAL(finished()), this, SLOT(hideToolBacker()));
|
||||||
@ -672,6 +616,8 @@ void DesktopToolBox::hideToolBox()
|
|||||||
fadeAnim->setProperty("targetOpacity", 0);
|
fadeAnim->setProperty("targetOpacity", 0);
|
||||||
fadeAnim->start(QAbstractAnimation::DeleteWhenStopped);
|
fadeAnim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
highlight(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopToolBox::hideToolBacker()
|
void DesktopToolBox::hideToolBacker()
|
||||||
@ -727,10 +673,6 @@ qreal DesktopToolBox::highlight()
|
|||||||
|
|
||||||
void DesktopToolBox::toggle()
|
void DesktopToolBox::toggle()
|
||||||
{
|
{
|
||||||
if (isToolbar()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setShowing(!isShowing());
|
setShowing(!isShowing());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ public:
|
|||||||
hidden(false),
|
hidden(false),
|
||||||
showing(false),
|
showing(false),
|
||||||
movable(false),
|
movable(false),
|
||||||
toolbar(false),
|
|
||||||
dragging(false),
|
dragging(false),
|
||||||
userMoved(false)
|
userMoved(false)
|
||||||
{}
|
{}
|
||||||
@ -65,7 +64,6 @@ public:
|
|||||||
bool hidden : 1;
|
bool hidden : 1;
|
||||||
bool showing : 1;
|
bool showing : 1;
|
||||||
bool movable : 1;
|
bool movable : 1;
|
||||||
bool toolbar : 1;
|
|
||||||
bool dragging : 1;
|
bool dragging : 1;
|
||||||
bool userMoved : 1;
|
bool userMoved : 1;
|
||||||
};
|
};
|
||||||
@ -263,7 +261,7 @@ QSize InternalToolBox::fullHeight() const
|
|||||||
|
|
||||||
void InternalToolBox::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void InternalToolBox::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!d->movable || (!d->dragging && boundingRect().contains(event->pos())) || isToolbar()) {
|
if (!d->movable || (!d->dragging && boundingRect().contains(event->pos()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,21 +380,6 @@ void InternalToolBox::setIsMovable(bool movable)
|
|||||||
d->movable = movable;
|
d->movable = movable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InternalToolBox::isToolbar() const
|
|
||||||
{
|
|
||||||
return d->toolbar;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InternalToolBox::setIsToolbar(bool toolbar)
|
|
||||||
{
|
|
||||||
d->toolbar = toolbar;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTransform InternalToolBox::viewTransform() const
|
|
||||||
{
|
|
||||||
return d->viewTransform;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InternalToolBox::setCorner(const Corner corner)
|
void InternalToolBox::setCorner(const Corner corner)
|
||||||
{
|
{
|
||||||
d->corner = corner;
|
d->corner = corner;
|
||||||
@ -407,25 +390,6 @@ InternalToolBox::Corner InternalToolBox::corner() const
|
|||||||
return d->corner;
|
return d->corner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InternalToolBox::setViewTransform(const QTransform &transform)
|
|
||||||
{
|
|
||||||
if (d->viewTransform == transform) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->viewTransform = transform;
|
|
||||||
|
|
||||||
if (transform.isScaling()) {
|
|
||||||
d->toolbar = true;
|
|
||||||
showToolBox();
|
|
||||||
} else {
|
|
||||||
d->toolbar = false;
|
|
||||||
if (d->viewTransform != transform) {
|
|
||||||
hideToolBox();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void InternalToolBox::save(KConfigGroup &cg) const
|
void InternalToolBox::save(KConfigGroup &cg) const
|
||||||
{
|
{
|
||||||
if (!d->movable) {
|
if (!d->movable) {
|
||||||
@ -451,7 +415,7 @@ void InternalToolBox::save(KConfigGroup &cg) const
|
|||||||
group.writeEntry("offset", offset);
|
group.writeEntry("offset", offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InternalToolBox::load(const KConfigGroup &containmentGroup)
|
void InternalToolBox::restore(const KConfigGroup &containmentGroup)
|
||||||
{
|
{
|
||||||
if (!d->movable) {
|
if (!d->movable) {
|
||||||
return;
|
return;
|
||||||
@ -508,7 +472,7 @@ void InternalToolBox::reposition()
|
|||||||
{
|
{
|
||||||
if (d->userMoved) {
|
if (d->userMoved) {
|
||||||
//FIXME: adjust for situations like changing of the available space
|
//FIXME: adjust for situations like changing of the available space
|
||||||
load();
|
restore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,14 +79,8 @@ public:
|
|||||||
bool isMovable() const;
|
bool isMovable() const;
|
||||||
void setIsMovable(bool movable);
|
void setIsMovable(bool movable);
|
||||||
|
|
||||||
bool isToolbar() const;
|
|
||||||
void setIsToolbar(bool toolbar);
|
|
||||||
|
|
||||||
QTransform viewTransform() const;
|
|
||||||
void setViewTransform(const QTransform &transform);
|
|
||||||
|
|
||||||
void save(KConfigGroup &cg) const;
|
void save(KConfigGroup &cg) const;
|
||||||
void load(const KConfigGroup &containmentGroup = KConfigGroup());
|
void restore(const KConfigGroup &containmentGroup = KConfigGroup());
|
||||||
void reposition();
|
void reposition();
|
||||||
|
|
||||||
virtual QSize fullWidth() const;
|
virtual QSize fullWidth() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user