remove unused files
This commit is contained in:
parent
2cb232be33
commit
bd764aa3db
@ -266,8 +266,7 @@ set(plasma_LIB_INCLUDES
|
|||||||
servicejob.h
|
servicejob.h
|
||||||
svg.h
|
svg.h
|
||||||
theme.h
|
theme.h
|
||||||
version.h
|
version.h)
|
||||||
view.h)
|
|
||||||
|
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QGraphicsView>
|
|
||||||
#include <QGraphicsGridLayout>
|
#include <QGraphicsGridLayout>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@ -46,7 +45,6 @@
|
|||||||
#include "pluginloader.h"
|
#include "pluginloader.h"
|
||||||
#include "private/applet_p.h"
|
#include "private/applet_p.h"
|
||||||
#include "private/containment_p.h"
|
#include "private/containment_p.h"
|
||||||
#include "view.h"
|
|
||||||
|
|
||||||
using namespace Plasma;
|
using namespace Plasma;
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
#include "containment.h"
|
#include "containment.h"
|
||||||
#include "view.h"
|
|
||||||
#include "private/packages_p.h"
|
#include "private/packages_p.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010 by Marco MArtin <mart@kde.org>
|
|
||||||
* Copyright 2008 by Alessandro Diaferia <alediaferia@gmail.com>
|
|
||||||
* Copyright 2007 by Alexis Ménard <darktears31@gmail.com>
|
|
||||||
* Copyright 2007 Sebastian Kuegler <sebas@kde.org>
|
|
||||||
* Copyright 2006 Aaron Seigo <aseigo@kde.org>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LIBS_PLASMA_DIALOG_P_H
|
|
||||||
#define LIBS_PLASMA_DIALOG_P_H
|
|
||||||
|
|
||||||
#include "plasma/dialog.h"
|
|
||||||
|
|
||||||
namespace Plasma {
|
|
||||||
|
|
||||||
class Applet;
|
|
||||||
class FrameSvg;
|
|
||||||
|
|
||||||
class DialogPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DialogPrivate(Dialog *dialog)
|
|
||||||
: q(dialog),
|
|
||||||
background(0),
|
|
||||||
view(0),
|
|
||||||
resizeCorners(Dialog::NoCorner),
|
|
||||||
resizeStartCorner(Dialog::NoCorner),
|
|
||||||
leftResizeMin(-1),
|
|
||||||
topResizeMin(-1),
|
|
||||||
rightResizeMin(-1),
|
|
||||||
bottomResizeMin(-1),
|
|
||||||
moveTimer(0),
|
|
||||||
aspectRatioMode(Plasma::IgnoreAspectRatio),
|
|
||||||
resizeChecksWithBorderCheck(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~DialogPrivate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void scheduleBorderCheck(bool triggeredByResize = false);
|
|
||||||
void themeChanged();
|
|
||||||
void updateMask();
|
|
||||||
void checkBorders();
|
|
||||||
void checkBorders(bool updateMaskIfNeeded);
|
|
||||||
void updateResizeCorners();
|
|
||||||
int calculateWidthForHeightAndRatio(int height, qreal ratio);
|
|
||||||
void delayedAdjustSize();
|
|
||||||
|
|
||||||
Plasma::Dialog *q;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Holds the background SVG, to be re-rendered when the cache is invalidated,
|
|
||||||
* for example by resizing the dialogue.
|
|
||||||
*/
|
|
||||||
Plasma::FrameSvg *background;
|
|
||||||
QGraphicsView *view;
|
|
||||||
QWeakPointer<QGraphicsWidget> graphicsWidgetPtr;
|
|
||||||
QWeakPointer<Applet> appletPtr;
|
|
||||||
Dialog::ResizeCorners resizeCorners;
|
|
||||||
QMap<Dialog::ResizeCorner, QRect> resizeAreas;
|
|
||||||
int resizeStartCorner;
|
|
||||||
int leftResizeMin;
|
|
||||||
int topResizeMin;
|
|
||||||
int rightResizeMin;
|
|
||||||
int bottomResizeMin;
|
|
||||||
QTimer *moveTimer;
|
|
||||||
QTimer *adjustViewTimer;
|
|
||||||
QTimer *adjustSizeTimer;
|
|
||||||
QSize oldGraphicsWidgetMinimumSize;
|
|
||||||
QSize oldGraphicsWidgetMaximumSize;
|
|
||||||
Plasma::AspectRatioMode aspectRatioMode;
|
|
||||||
bool resizeChecksWithBorderCheck;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
418
view.cpp
418
view.cpp
@ -1,418 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2007 Aaron Seigo <aseigo@kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "view.h"
|
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kwindowsystem.h>
|
|
||||||
#include <kactioncollection.h>
|
|
||||||
|
|
||||||
#include "corona.h"
|
|
||||||
#include "containment.h"
|
|
||||||
#include "private/containment_p.h"
|
|
||||||
#include "wallpaper.h"
|
|
||||||
|
|
||||||
using namespace Plasma;
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
|
|
||||||
class ViewPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ViewPrivate(View *view, int uniqueId)
|
|
||||||
: q(view),
|
|
||||||
containment(0),
|
|
||||||
viewId(0),
|
|
||||||
lastScreen(-1),
|
|
||||||
lastDesktop(-2),
|
|
||||||
drawWallpaper(true),
|
|
||||||
trackChanges(true),
|
|
||||||
init(false)
|
|
||||||
{
|
|
||||||
if (uniqueId > 0 && !viewIds.contains(uniqueId)) {
|
|
||||||
s_maxViewId = uniqueId;
|
|
||||||
viewId = uniqueId;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewId == 0) {
|
|
||||||
// we didn't get a sane value assigned to us, so lets
|
|
||||||
// grab the next available id
|
|
||||||
viewId = ++s_maxViewId;
|
|
||||||
}
|
|
||||||
viewIds.insert(viewId);
|
|
||||||
}
|
|
||||||
|
|
||||||
~ViewPrivate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void privateInit()
|
|
||||||
{
|
|
||||||
q->setContainment(containment);
|
|
||||||
init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateSceneRect()
|
|
||||||
{
|
|
||||||
if (!containment || !trackChanges) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
kDebug() << "!!!!!!!!!!!!!!!!! setting the scene rect to"
|
|
||||||
<< containment->sceneBoundingRect()
|
|
||||||
<< "associated screen is" << containment->screen();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
emit q->sceneRectAboutToChange();
|
|
||||||
if (q->transform().isIdentity()) { //we're not zoomed out
|
|
||||||
q->setSceneRect(containment->sceneBoundingRect());
|
|
||||||
} else {
|
|
||||||
//kDebug() << "trying to show the containment nicely";
|
|
||||||
q->ensureVisible(containment->sceneBoundingRect());
|
|
||||||
//q->centerOn(containment);
|
|
||||||
}
|
|
||||||
emit q->sceneRectChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void containmentDestroyed()
|
|
||||||
{
|
|
||||||
containment = 0;
|
|
||||||
emit q->lostContainment();
|
|
||||||
}
|
|
||||||
|
|
||||||
void containmentScreenChanged(int wasScreen, int newScreen, Plasma::Containment *containment)
|
|
||||||
{
|
|
||||||
Q_UNUSED(wasScreen)
|
|
||||||
lastScreen = newScreen;
|
|
||||||
lastDesktop = containment->desktop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void initGraphicsView()
|
|
||||||
{
|
|
||||||
q->setFrameShape(QFrame::NoFrame);
|
|
||||||
q->setAttribute(Qt::WA_TranslucentBackground);
|
|
||||||
q->setAutoFillBackground(true);
|
|
||||||
q->setDragMode(QGraphicsView::NoDrag);
|
|
||||||
q->setInteractive(true);
|
|
||||||
q->setAcceptDrops(true);
|
|
||||||
q->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
||||||
q->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
||||||
q->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int s_maxViewId;
|
|
||||||
//ugly but the only reliable way to do collision detection of ids
|
|
||||||
static QSet<int> viewIds;
|
|
||||||
|
|
||||||
Plasma::View *q;
|
|
||||||
Plasma::Containment *containment;
|
|
||||||
int viewId;
|
|
||||||
int lastScreen;
|
|
||||||
int lastDesktop;
|
|
||||||
bool drawWallpaper : 1;
|
|
||||||
bool trackChanges : 1;
|
|
||||||
bool init : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
int ViewPrivate::s_maxViewId(0);
|
|
||||||
QSet<int> ViewPrivate::viewIds;
|
|
||||||
|
|
||||||
View::View(Containment *containment, QWidget *parent)
|
|
||||||
: QGraphicsView(parent),
|
|
||||||
d(new ViewPrivate(this, 0))
|
|
||||||
{
|
|
||||||
d->initGraphicsView();
|
|
||||||
|
|
||||||
if (containment) {
|
|
||||||
setScene(containment->scene());
|
|
||||||
d->containment = containment;
|
|
||||||
QTimer::singleShot(0, this, SLOT(privateInit()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
View::View(Containment *containment, int viewId, QWidget *parent)
|
|
||||||
: QGraphicsView(parent),
|
|
||||||
d(new ViewPrivate(this, viewId))
|
|
||||||
{
|
|
||||||
d->initGraphicsView();
|
|
||||||
|
|
||||||
if (containment) {
|
|
||||||
setScene(containment->scene());
|
|
||||||
d->containment = containment;
|
|
||||||
QTimer::singleShot(0, this, SLOT(privateInit()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
View::~View()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
// FIXME FIX a focus crash but i wasn't able to reproduce in a simple test case for Qt guys
|
|
||||||
// NB: this is also done in Corona
|
|
||||||
clearFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::setScreen(int screen, int desktop)
|
|
||||||
{
|
|
||||||
if (screen < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle desktop views
|
|
||||||
// -1 == All desktops
|
|
||||||
if (desktop < -1 || desktop > KWindowSystem::numberOfDesktops() - 1) {
|
|
||||||
desktop = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->lastScreen = screen;
|
|
||||||
d->lastDesktop = desktop;
|
|
||||||
|
|
||||||
// handle views that are working with panel containment types
|
|
||||||
if (d->containment &&
|
|
||||||
(d->containment->containmentType() == Containment::PanelContainment ||
|
|
||||||
d->containment->containmentType() == Containment::CustomPanelContainment)) {
|
|
||||||
d->containment->setScreen(screen, desktop);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Plasma::Corona *corona = qobject_cast<Plasma::Corona*>(scene());
|
|
||||||
if (corona) {
|
|
||||||
Containment *containment = corona->containmentForScreen(screen, desktop);
|
|
||||||
|
|
||||||
if (containment) {
|
|
||||||
d->containment = 0; //so that we don't end up on the old containment's screen
|
|
||||||
setContainment(containment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int View::screen() const
|
|
||||||
{
|
|
||||||
return d->lastScreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
int View::desktop() const
|
|
||||||
{
|
|
||||||
if (d->containment) {
|
|
||||||
return d->containment->desktop();
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->lastDesktop;
|
|
||||||
}
|
|
||||||
|
|
||||||
int View::effectiveDesktop() const
|
|
||||||
{
|
|
||||||
int desk = desktop();
|
|
||||||
return desk > -1 ? desk : KWindowSystem::currentDesktop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::setContainment(Plasma::Containment *containment)
|
|
||||||
{
|
|
||||||
if (d->init && containment == d->containment) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d->containment) {
|
|
||||||
disconnect(d->containment, SIGNAL(destroyed(QObject*)), this, SLOT(containmentDestroyed()));
|
|
||||||
disconnect(d->containment, SIGNAL(geometryChanged()), this, SLOT(updateSceneRect()));
|
|
||||||
disconnect(d->containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)), this, SLOT(containmentScreenChanged(int,int,Plasma::Containment*)));
|
|
||||||
d->containment->removeAssociatedWidget(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!containment) {
|
|
||||||
d->containment = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Containment *oldContainment = d->containment;
|
|
||||||
|
|
||||||
int screen = d->lastScreen;
|
|
||||||
int desktop = d->lastDesktop;
|
|
||||||
if (oldContainment && oldContainment != containment) {
|
|
||||||
screen = oldContainment->screen();
|
|
||||||
desktop = oldContainment->desktop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scene() != containment->scene()) {
|
|
||||||
setScene(containment->scene());
|
|
||||||
}
|
|
||||||
|
|
||||||
d->containment = containment;
|
|
||||||
|
|
||||||
//add keyboard-shortcut actions
|
|
||||||
d->containment->addAssociatedWidget(this);
|
|
||||||
|
|
||||||
int otherScreen = containment->screen();
|
|
||||||
int otherDesktop = containment->desktop();
|
|
||||||
|
|
||||||
if (screen > -1) {
|
|
||||||
d->lastScreen = screen;
|
|
||||||
d->lastDesktop = desktop;
|
|
||||||
//kDebug() << "set screen from setContainment due to old containment";
|
|
||||||
if (oldContainment && oldContainment != containment) {
|
|
||||||
oldContainment->setScreen(-1, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (screen != containment->screen() || desktop != containment->desktop()) {
|
|
||||||
containment->setScreen(screen, desktop);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
d->lastScreen = otherScreen;
|
|
||||||
d->lastDesktop = otherDesktop;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oldContainment && oldContainment != containment && otherScreen > -1 &&
|
|
||||||
(!containment || otherScreen != containment->screen() || otherDesktop != containment->desktop())) {
|
|
||||||
// assign the old containment the old screen/desktop
|
|
||||||
//kDebug() << "set screen from setContainment" << screen << otherScreen << desktop << otherDesktop;
|
|
||||||
oldContainment->setScreen(otherScreen, otherDesktop);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (oldContainment) {
|
|
||||||
#ifndef NDEBUG
|
|
||||||
kDebug() << "old" << (QObject*)oldContainment << screen << oldContainment->screen()
|
|
||||||
#endif
|
|
||||||
<< "new" << (QObject*)containment << otherScreen << containment->screen();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
d->updateSceneRect();
|
|
||||||
connect(containment, SIGNAL(destroyed(QObject*)), this, SLOT(containmentDestroyed()));
|
|
||||||
connect(containment, SIGNAL(geometryChanged()), this, SLOT(updateSceneRect()));
|
|
||||||
connect(containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)), this, SLOT(containmentScreenChanged(int,int,Plasma::Containment*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Containment *View::containment() const
|
|
||||||
{
|
|
||||||
return d->containment;
|
|
||||||
}
|
|
||||||
|
|
||||||
Containment *View::swapContainment(const QString &name, const QVariantList &args)
|
|
||||||
{
|
|
||||||
return swapContainment(d->containment, name, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
Containment *View::swapContainment(Plasma::Containment *existing, const QString &name, const QVariantList &args)
|
|
||||||
{
|
|
||||||
if (!existing) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Containment *old = existing;
|
|
||||||
Plasma::Corona *corona = old->corona();
|
|
||||||
Plasma::Containment *c = corona->addContainmentDelayed(name, args);
|
|
||||||
if (c) {
|
|
||||||
c->init();
|
|
||||||
|
|
||||||
KConfigGroup oldConfig = old->config();
|
|
||||||
KConfigGroup newConfig = c->config();
|
|
||||||
|
|
||||||
// ensure that the old containments configuration is up to date
|
|
||||||
old->save(oldConfig);
|
|
||||||
|
|
||||||
// Copy configuration to new containment
|
|
||||||
oldConfig.copyTo(&newConfig);
|
|
||||||
|
|
||||||
if (old == d->containment) {
|
|
||||||
// set our containment to the new one, if the the old containment was us
|
|
||||||
setContainment(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
// load the configuration of the old containment into the new one
|
|
||||||
c->restore(newConfig);
|
|
||||||
c->updateConstraints(Plasma::StartupCompletedConstraint);
|
|
||||||
c->d->initApplets();
|
|
||||||
emit corona->containmentAdded(c);
|
|
||||||
|
|
||||||
// destroy the old one
|
|
||||||
old->destroy(false);
|
|
||||||
|
|
||||||
// and now save the config
|
|
||||||
c->save(newConfig);
|
|
||||||
corona->requestConfigSync();
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
KConfigGroup View::config() const
|
|
||||||
{
|
|
||||||
KConfigGroup views(KSharedConfig::openConfig(), "PlasmaViews");
|
|
||||||
return KConfigGroup(&views, QString::number(d->viewId));
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::configNeedsSaving() const
|
|
||||||
{
|
|
||||||
Plasma::Corona *corona = qobject_cast<Plasma::Corona*>(scene());
|
|
||||||
if (corona) {
|
|
||||||
corona->requestConfigSync();
|
|
||||||
} else {
|
|
||||||
KSharedConfig::openConfig()->sync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int View::id() const
|
|
||||||
{
|
|
||||||
return d->viewId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::setWallpaperEnabled(bool draw)
|
|
||||||
{
|
|
||||||
d->drawWallpaper = draw;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool View::isWallpaperEnabled() const
|
|
||||||
{
|
|
||||||
return d->drawWallpaper;
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::setTrackContainmentChanges(bool trackChanges)
|
|
||||||
{
|
|
||||||
d->trackChanges = trackChanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool View::trackContainmentChanges()
|
|
||||||
{
|
|
||||||
return d->trackChanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
View * View::topLevelViewAt(const QPoint & pos)
|
|
||||||
{
|
|
||||||
QWidget *w = QApplication::topLevelAt(pos);
|
|
||||||
if (w) {
|
|
||||||
Plasma::View *v = qobject_cast<Plasma::View *>(w);
|
|
||||||
return v;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Plasma
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_view.cpp"
|
|
222
view.h
222
view.h
@ -1,222 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2007 Aaron Seigo <aseigo@kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PLASMA_VIEW_H
|
|
||||||
#define PLASMA_VIEW_H
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QGraphicsView>
|
|
||||||
|
|
||||||
#include <kconfiggroup.h>
|
|
||||||
|
|
||||||
#include <plasma/plasma_export.h>
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
|
|
||||||
class Containment;
|
|
||||||
class Corona;
|
|
||||||
class ViewPrivate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class View plasma/view.h <Plasma/View>
|
|
||||||
*
|
|
||||||
* @short A QGraphicsView for a single Containment
|
|
||||||
*
|
|
||||||
* Each View is associated with a Plasma::Containment and tracks geometry
|
|
||||||
* changes, maps to the current desktop (if any) among other helpful
|
|
||||||
* utilities. It isn't stricly required to use a Plasma::View with Plasma
|
|
||||||
* enabled applications, but it can make some things easier.
|
|
||||||
*/
|
|
||||||
class PLASMA_EXPORT View : public QGraphicsView
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Constructs a view for a given contanment. An Id is automatically
|
|
||||||
* assigned to the View.
|
|
||||||
*
|
|
||||||
* @param containment the containment to center the view on
|
|
||||||
* @param parent the parent object for this view
|
|
||||||
*/
|
|
||||||
explicit View(Containment *containment, QWidget *parent = 0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a view for a given contanment.
|
|
||||||
*
|
|
||||||
* @param containment the containment to center the view on
|
|
||||||
* @param viewId the id to assign to this view
|
|
||||||
* @param parent the parent object for this view
|
|
||||||
*/
|
|
||||||
View(Containment *containment, int viewId, QWidget *parent = 0);
|
|
||||||
|
|
||||||
~View();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether or not to draw the containment wallpaper when painting
|
|
||||||
* on this item
|
|
||||||
*/
|
|
||||||
void setWallpaperEnabled(bool draw);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return whether or not containments should draw wallpaper
|
|
||||||
*/
|
|
||||||
bool isWallpaperEnabled() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets which screen this view is associated with, if any.
|
|
||||||
* This will also set the containment if a valid screen is specified
|
|
||||||
*
|
|
||||||
* @param screen the physical screen number; -1 for no screen
|
|
||||||
* @param desktop the virtual desktop number, or -1 for all virtual desktops
|
|
||||||
*/
|
|
||||||
void setScreen(int screen, int desktop = -1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the screen this view is associated with
|
|
||||||
*
|
|
||||||
* @return the xinerama screen number, or -1 for none
|
|
||||||
*/
|
|
||||||
int screen() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The virtual desktop this view is associated with
|
|
||||||
*
|
|
||||||
* @return the desktop number, -1 for all desktops and less than -1 for none
|
|
||||||
*/
|
|
||||||
int desktop() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The virtual desktop this view is actually being viewed on
|
|
||||||
*
|
|
||||||
* @return the desktop number (always valid, never < 0)
|
|
||||||
*/
|
|
||||||
int effectiveDesktop() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the containment associated with this view, or 0 if none is
|
|
||||||
*/
|
|
||||||
Containment *containment() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swaps one containment with another.
|
|
||||||
*
|
|
||||||
* @param existing the existing containment to swap out
|
|
||||||
* @param name the plugin name for the new containment.
|
|
||||||
* @param args argument list to pass to the containment
|
|
||||||
* @return the new containment
|
|
||||||
*/
|
|
||||||
Containment *swapContainment(Plasma::Containment *existing,
|
|
||||||
const QString &name,
|
|
||||||
const QVariantList &args = QVariantList());
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap the containment for this view, which will also cause the view
|
|
||||||
* to track the geometry of the containment.
|
|
||||||
*
|
|
||||||
* @param name the plugin name for the new containment.
|
|
||||||
* @param args argument list to pass to the containment
|
|
||||||
*/
|
|
||||||
Containment *swapContainment(const QString &name,
|
|
||||||
const QVariantList &args = QVariantList());
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set whether or not the view should adjust its size when the associated
|
|
||||||
* containment does.
|
|
||||||
* @param trackChanges true to synchronize the view's size with the containment's
|
|
||||||
* (this is the default behaviour), false to ignore containment size changes
|
|
||||||
*/
|
|
||||||
void setTrackContainmentChanges(bool trackChanges);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return whether or not the view tracks changes to the containment
|
|
||||||
*/
|
|
||||||
bool trackContainmentChanges();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param pos the position in screen coordinates.
|
|
||||||
* @return the Plasma::View that is at position pos.
|
|
||||||
*/
|
|
||||||
static View * topLevelViewAt(const QPoint & pos);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the id of the View set in the constructor
|
|
||||||
*/
|
|
||||||
int id() const;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
/**
|
|
||||||
* This signal is emitted whenever the containment being viewed has
|
|
||||||
* changed its geometry, but before the View has shifted the viewd scene rect
|
|
||||||
* to the new geometry. This is useful for Views which want to keep
|
|
||||||
* their rect() in sync with the containment'sa
|
|
||||||
*/
|
|
||||||
void sceneRectAboutToChange();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This signal is emitted whenever the containment being viewed has
|
|
||||||
* changed its geometry, and after the View has shifted the viewd scene rect
|
|
||||||
* to the new geometry. This is useful for Views which want to keep
|
|
||||||
* their rect() in sync with the containment's.
|
|
||||||
*/
|
|
||||||
void sceneRectChanged();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is emitted after the containment is destroyed, for views that need to do something about
|
|
||||||
* it (like find a new one).
|
|
||||||
*/
|
|
||||||
void lostContainment();
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
/**
|
|
||||||
* Sets the containment for this view, which will also cause the view
|
|
||||||
* to track the geometry of the containment.
|
|
||||||
*
|
|
||||||
* @param containment the containment to center the view on
|
|
||||||
*/
|
|
||||||
virtual void setContainment(Plasma::Containment *containment);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @return a KConfigGroup in the application's config file unique to the view
|
|
||||||
*/
|
|
||||||
KConfigGroup config() const;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Requests that the config be synchronized to disk
|
|
||||||
*/
|
|
||||||
void configNeedsSaving() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ViewPrivate * const d;
|
|
||||||
|
|
||||||
Q_PRIVATE_SLOT(d, void updateSceneRect())
|
|
||||||
Q_PRIVATE_SLOT(d, void containmentDestroyed())
|
|
||||||
Q_PRIVATE_SLOT(d, void containmentScreenChanged(int, int, Plasma::Containment *))
|
|
||||||
Q_PRIVATE_SLOT(d, void privateInit())
|
|
||||||
|
|
||||||
friend class ViewPrivate;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Plasma
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user