From 594c9a80fe6e0e0cffb91aa071c70e44ac930fe2 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 --- CMakeLists.txt | 1 + desktopview.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ desktopview.h | 47 ++++++++++++++++++++++++++++++++++++++++ shellcorona.cpp | 9 ++++---- 4 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 desktopview.cpp create mode 100644 desktopview.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 60982a68b..a60711e79 100644 --- a/CMakeLists.txt +++ b/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/desktopview.cpp b/desktopview.cpp new file mode 100644 index 000000000..0af8b1c13 --- /dev/null +++ b/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/desktopview.h b/desktopview.h new file mode 100644 index 000000000..498dbd64c --- /dev/null +++ b/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/shellcorona.cpp b/shellcorona.cpp index c46f10c32..808ebc3e7 100644 --- a/shellcorona.cpp +++ b/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(); }