add a desktop view

This commit is contained in:
Marco Martin 2013-09-11 12:18:51 +02:00
parent 5157958c00
commit 452d39a98e
5 changed files with 110 additions and 6 deletions

View File

@ -55,7 +55,7 @@ public:
* sets the containment for this view
* @param cont the containment of this view
**/
virtual void setContainment(Plasma::Containment *cont);
void setContainment(Plasma::Containment *cont);
/**
* @return the containment of this View

View File

@ -57,6 +57,7 @@ set(widgetexplorer_SRC
add_executable(plasma-shell
main.cpp
desktopview.cpp
panelview.cpp
panelconfigview.cpp
panelshadows.cpp

57
src/shell/desktopview.cpp Normal file
View File

@ -0,0 +1,57 @@
/*
* Copyright 2013 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, 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 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 "desktopview.h"
#include "shellcorona.h"
DesktopView::DesktopView(ShellCorona *corona, QWindow *parent)
: PlasmaQuickView(corona, parent)
{
}
DesktopView::~DesktopView()
{
}
/*
void DesktopView::showConfigurationInterface(Plasma::Applet *applet)
{
if (m_configView) {
m_configView.data()->hide();
m_configView.data()->deleteLater();
}
if (!applet || !applet->containment()) {
return;
}
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(applet);
if (cont) {
m_configView = new PanelConfigView(cont, this);
} else {
m_configView = new ConfigView(applet);
}
m_configView.data()->init();
m_configView.data()->show();
}*/
#include "moc_desktopview.cpp"

47
src/shell/desktopview.h Normal file
View File

@ -0,0 +1,47 @@
/*
* Copyright 2013 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, 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 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 DESKTOVIEW_H
#define DESKTOVIEW_H
#include <plasmaquickview.h>
#include "panelconfigview.h"
#include <QtCore/qpointer.h>
class ShellCorona;
class DesktopView : public PlasmaQuickView
{
Q_OBJECT
public:
explicit DesktopView(ShellCorona *corona, QWindow *parent = 0);
virtual ~DesktopView();
protected Q_SLOTS:
/**
* It will be called when the configuration is requested
*/
//virtual void showConfigurationInterface(Plasma::Applet *applet);
private:
QPointer<ConfigView> m_configView;
};
#endif // DESKTOVIEW_H

View File

@ -31,8 +31,7 @@
#include <Plasma/Package>
#include <Plasma/PluginLoader>
#include <plasmaquickview.h>
#include "desktopview.h"
#include "panelview.h"
#include "scripting/desktopscriptengine.h"
#include "widgetexplorer/widgetexplorerview.h"
@ -52,7 +51,7 @@ public:
QString shell;
QDesktopWidget * desktopWidget;
QList <PlasmaQuickView *> views;
QList <DesktopView *> views;
WidgetExplorerView * widgetExplorerView;
QHash <Plasma::Containment *, PanelView *> panelViews;
KConfigGroup desktopDefaultsConfig;
@ -304,7 +303,7 @@ void ShellCorona::checkViews()
} else if (d->views.count() < d->desktopWidget->screenCount()) {
for (int i = d->views.count(); i < d->desktopWidget->screenCount(); ++i) {
PlasmaQuickView *view = new PlasmaQuickView(this);
DesktopView *view = new DesktopView(this);
QSurfaceFormat format;
view->show();
@ -312,7 +311,7 @@ void ShellCorona::checkViews()
}
} else {
for (int i = d->desktopWidget->screenCount(); i < d->views.count(); ++i) {
PlasmaQuickView *view = d->views.last();
DesktopView *view = d->views.last();
view->deleteLater();
d->views.pop_back();
}