From 452d39a98e5118b2753c1e4dcb177d1f1d58b734 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 11 Sep 2013 12:18:51 +0200 Subject: [PATCH] add a desktop view --- src/plasmaquick/plasmaquickview.h | 2 +- src/shell/CMakeLists.txt | 1 + src/shell/desktopview.cpp | 57 +++++++++++++++++++++++++++++++ src/shell/desktopview.h | 47 +++++++++++++++++++++++++ src/shell/shellcorona.cpp | 9 +++-- 5 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 src/shell/desktopview.cpp create mode 100644 src/shell/desktopview.h diff --git a/src/plasmaquick/plasmaquickview.h b/src/plasmaquick/plasmaquickview.h index 8c08b2c6a..128b56971 100644 --- a/src/plasmaquick/plasmaquickview.h +++ b/src/plasmaquick/plasmaquickview.h @@ -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 diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt index 60982a68b..a60711e79 100644 --- a/src/shell/CMakeLists.txt +++ b/src/shell/CMakeLists.txt @@ -57,6 +57,7 @@ set(widgetexplorer_SRC add_executable(plasma-shell main.cpp + desktopview.cpp panelview.cpp panelconfigview.cpp panelshadows.cpp diff --git a/src/shell/desktopview.cpp b/src/shell/desktopview.cpp new file mode 100644 index 000000000..0af8b1c13 --- /dev/null +++ b/src/shell/desktopview.cpp @@ -0,0 +1,57 @@ +/* + * Copyright 2013 Marco Martin + * + * 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(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" diff --git a/src/shell/desktopview.h b/src/shell/desktopview.h new file mode 100644 index 000000000..498dbd64c --- /dev/null +++ b/src/shell/desktopview.h @@ -0,0 +1,47 @@ +/* + * Copyright 2013 Marco Martin + * + * 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 +#include "panelconfigview.h" +#include + +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 m_configView; +}; + +#endif // DESKTOVIEW_H diff --git a/src/shell/shellcorona.cpp b/src/shell/shellcorona.cpp index c46f10c32..808ebc3e7 100644 --- a/src/shell/shellcorona.cpp +++ b/src/shell/shellcorona.cpp @@ -31,8 +31,7 @@ #include #include -#include - +#include "desktopview.h" #include "panelview.h" #include "scripting/desktopscriptengine.h" #include "widgetexplorer/widgetexplorerview.h" @@ -52,7 +51,7 @@ public: QString shell; QDesktopWidget * desktopWidget; - QList views; + QList views; WidgetExplorerView * widgetExplorerView; QHash 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(); }