Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[core] Rename WidgetPlugin to ViewControllerPlugin

Rename to give it more sense
  • Loading branch information...
commit c27d6004f38991e4bb058ba5bf2f5056b82b393c 1 parent 7a5f39d
authored
6  base/core/CMakeLists.txt
@@ -51,7 +51,7 @@ SET(sourceFiles
51 51
     abstractsource.h
52 52
     pluginloader.cpp
53 53
     pendingjob.cpp
54  
-    widgetplugin.cpp
  54
+    viewcontrollerplugin.cpp
55 55
     )
56 56
 
57 57
 SET(headerFiles
@@ -66,7 +66,7 @@ SET(headerFiles
66 66
     abstractdesktopview.h
67 67
     pendingjob.h
68 68
     desktopviewplugin.h
69  
-    widgetplugin.h
  69
+    viewcontrollerplugin.h
70 70
    )
71 71
 
72 72
 SET(MOC_SRCS
@@ -78,7 +78,7 @@ SET(MOC_SRCS
78 78
     pluginloader.h
79 79
     abstractdesktopview.h
80 80
     pendingjob.h
81  
-    widgetplugin.h
  81
+    viewcontrollerplugin.h
82 82
     desktopviewplugin.h
83 83
    )
84 84
 
2  base/core/abstractdesktopview.h
@@ -21,7 +21,7 @@
21 21
 #define PLEXY_ABSTRACT_DESKTOP_VIEW_H
22 22
 
23 23
 #include <plexy.h>
24  
-#include <widgetplugin.h>
  24
+#include <viewcontrollerplugin.h>
25 25
 #include <abstractdesktopwidget.h>
26 26
 
27 27
 namespace PlexyDesk
59  base/core/viewcontrollerplugin.cpp
... ...
@@ -0,0 +1,59 @@
  1
+#include <viewcontrollerplugin.h>
  2
+#include <pluginloader.h>
  3
+
  4
+namespace PlexyDesk
  5
+{
  6
+
  7
+class ViewControllerPlugin::PrivateViewControllerPlugin
  8
+{
  9
+public:
  10
+    PrivateViewControllerPlugin() {}
  11
+    ~PrivateViewControllerPlugin() {}
  12
+    DataSource *mDataSource;
  13
+};
  14
+
  15
+ViewControllerPlugin::ViewControllerPlugin(QObject *parent) : QObject(parent), d(new PrivateViewControllerPlugin)
  16
+{
  17
+    d->mDataSource = 0;
  18
+}
  19
+
  20
+ViewControllerPlugin::~ViewControllerPlugin()
  21
+{
  22
+    delete d;
  23
+}
  24
+
  25
+QStringList ViewControllerPlugin::visibleActions() const
  26
+{
  27
+    return QStringList();
  28
+}
  29
+
  30
+void ViewControllerPlugin::requestAction(const QString &actionName)
  31
+{
  32
+    Q_EMIT actionComleted(false, QString("Invalid Action"));
  33
+}
  34
+
  35
+DataSource *ViewControllerPlugin::dataSource()
  36
+{
  37
+    return d->mDataSource;
  38
+}
  39
+
  40
+bool ViewControllerPlugin::connectToDataSource(const QString &source)
  41
+{
  42
+   d->mDataSource =
  43
+           qobject_cast<PlexyDesk::DataSource*> (PluginLoader::getInstance()->instance(source));
  44
+
  45
+   if (!d->mDataSource)
  46
+       return 0;
  47
+
  48
+   connect(d->mDataSource, SIGNAL(ready()), this, SLOT(onReady()));
  49
+
  50
+   return true;
  51
+}
  52
+
  53
+void ViewControllerPlugin::onReady()
  54
+{
  55
+    if(d->mDataSource)
  56
+       Q_EMIT data(d->mDataSource);
  57
+}
  58
+
  59
+}
24  base/core/widgetplugin.h → base/core/viewcontrollerplugin.h
... ...
@@ -1,6 +1,6 @@
1 1
 
2  
-#ifndef PLEXY_WIDGET_PLUGIN_H
3  
-#define PLEXY_WIDGET_PLUGIN_H
  2
+#ifndef PLEXY_VIEW_CONTROLLER_PLUGIN_H
  3
+#define PLEXY_VIEW_CONTROLLER_PLUGIN_H
4 4
 
5 5
 #include <datasource.h>
6 6
 #include <plexy.h>
@@ -9,16 +9,16 @@ class QGraphicsItem;
9 9
 
10 10
 /*!
11 11
 
12  
-  \class PlexyDesk::WidgetPlugin
  12
+  \class PlexyDesk::ViewControllerPlugin
13 13
 
14 14
   \brief Base class for writing view plugins
15 15
 
16  
-  \fn PlexyDesk::WidgetPlugin::visibleActions
  16
+  \fn PlexyDesk::ViewControllerPlugin::visibleActions
17 17
 
18 18
   \brief Actions supported by the plugin
19 19
 
20 20
   \paragraph Widget Plugins can optionaly provide actions which
21  
-  it can perform on the view and the data source. So WidgetPlugins
  21
+  it can perform on the view and the data source. So ViewControllerPlugins
22 22
   mostly act as a controller which knows about the data and the view
23 23
   and provides suitable actions which the user can perform.
24 24
 
@@ -29,21 +29,21 @@ class QGraphicsItem;
29 29
 
30 30
   \paragraph But if you plugin needs user actions such as adding a clock with a different
31 31
   Time Zone, then you can return the actions you want to perform by overiding
32  
-  PlexyDesk::WidgetPlugin::visibleActions method and returning the string lables for your action.
33  
-  once you complete the user action remember to emit PlexyDesk::WidgetPlugin::actionCompleted signal
  32
+  PlexyDesk::ViewControllerPlugin::visibleActions method and returning the string lables for your action.
  33
+  once you complete the user action remember to emit PlexyDesk::ViewControllerPlugin::actionCompleted signal
34 34
   so that the action requester can notify the user about what happened to the action.
35 35
 
36 36
   \returns A list of action label supported by the widget  plugin
37 37
 */
38 38
 namespace PlexyDesk
39 39
 {
40  
-class PLEXYDESK_EXPORT WidgetPlugin : public QObject
  40
+class PLEXYDESK_EXPORT ViewControllerPlugin : public QObject
41 41
 {
42 42
     Q_OBJECT
43 43
 
44 44
 public:
45  
-    WidgetPlugin(QObject *parent = 0);
46  
-    virtual ~WidgetPlugin();
  45
+    ViewControllerPlugin(QObject *parent = 0);
  46
+    virtual ~ViewControllerPlugin();
47 47
 
48 48
     virtual QGraphicsItem *view() = 0;
49 49
     virtual QStringList visibleActions() const;
@@ -61,8 +61,8 @@ private Q_SLOTS:
61 61
     virtual void onReady();
62 62
 
63 63
 private:
64  
-    class PrivateWidgetPlugin;
65  
-    PrivateWidgetPlugin *const d;
  64
+    class PrivateViewControllerPlugin;
  65
+    PrivateViewControllerPlugin *const d;
66 66
 };
67 67
 }
68 68
 #endif
59  base/core/widgetplugin.cpp
... ...
@@ -1,59 +0,0 @@
1  
-#include <widgetplugin.h>
2  
-#include <pluginloader.h>
3  
-
4  
-namespace PlexyDesk
5  
-{
6  
-
7  
-class WidgetPlugin::PrivateWidgetPlugin
8  
-{
9  
-public:
10  
-    PrivateWidgetPlugin() {}
11  
-    ~PrivateWidgetPlugin() {}
12  
-    DataSource *mDataSource;
13  
-};
14  
-
15  
-WidgetPlugin::WidgetPlugin(QObject *parent) : QObject(parent), d(new PrivateWidgetPlugin)
16  
-{
17  
-    d->mDataSource = 0;
18  
-}
19  
-
20  
-WidgetPlugin::~WidgetPlugin()
21  
-{
22  
-    delete d;
23  
-}
24  
-
25  
-QStringList WidgetPlugin::visibleActions() const
26  
-{
27  
-    return QStringList();
28  
-}
29  
-
30  
-void WidgetPlugin::requestAction(const QString &actionName)
31  
-{
32  
-    Q_EMIT actionComleted(false, QString("Invalid Action"));
33  
-}
34  
-
35  
-DataSource *WidgetPlugin::dataSource()
36  
-{
37  
-    return d->mDataSource;
38  
-}
39  
-
40  
-bool WidgetPlugin::connectToDataSource(const QString &source)
41  
-{
42  
-   d->mDataSource =
43  
-           qobject_cast<PlexyDesk::DataSource*> (PluginLoader::getInstance()->instance(source));
44  
-
45  
-   if (!d->mDataSource)
46  
-       return 0;
47  
-
48  
-   connect(d->mDataSource, SIGNAL(ready()), this, SLOT(onReady()));
49  
-
50  
-   return true;
51  
-}
52  
-
53  
-void WidgetPlugin::onReady()
54  
-{
55  
-    if(d->mDataSource)
56  
-       Q_EMIT data(d->mDataSource);
57  
-}
58  
-
59  
-}
3  extensions/data/rest/rest.cpp
@@ -71,9 +71,6 @@ void RestData::setArguments(QVariant &arg)
71 71
     } else if (type == POST) {
72 72
         d->manager->post(QNetworkRequest(url), par.toAscii());
73 73
     }
74  
-
75  
-    // TODO:
76  
-    // handle errors
77 74
 }
78 75
 
79 76
 void RestData::replyFinished(QNetworkReply *reply)
2  extensions/data/timer/timer.cpp
@@ -19,7 +19,7 @@
19 19
 #include <desktopwidget.h>
20 20
 #include <plexyconfig.h>
21 21
 #include <QTimer>
22  
-#include <widgetplugin.h>
  22
+#include <viewcontrollerplugin.h>
23 23
 
24 24
 class TimerData::Private
25 25
 {
18  extensions/desktop/plexy/desktopview.cpp
@@ -31,7 +31,7 @@
31 31
 #include <desktopwidget.h>
32 32
 #include <pluginloader.h>
33 33
 #include <backdropplugin.h>
34  
-#include <widgetplugin.h>
  34
+#include <viewcontrollerplugin.h>
35 35
 #include <viewlayer.h>
36 36
 #include <qplexymime.h>
37 37
 #include <qmldesktopwidget.h>
@@ -79,12 +79,12 @@ class DesktopView::Private
79 79
     AbstractPluginInterface *bIface;
80 80
     BackgroundSource *mBackgroundSource;
81 81
     PlexyDesk::ThemepackLoader *mThemeLoader;
82  
-    QList<WidgetPlugin *> mDesktopPluginsList;
  82
+    QList<ViewControllerPlugin *> mDesktopPluginsList;
83 83
 
84  
-    WidgetPlugin *mPhotoDialogProvider;
  84
+    ViewControllerPlugin *mPhotoDialogProvider;
85 85
     DesktopWidget *mPhotoDialog;
86 86
 
87  
-    WidgetPlugin *mDirProvider;
  87
+    ViewControllerPlugin *mDirProvider;
88 88
     DesktopWidget *mDirWidget;
89 89
 
90 90
     float row;
@@ -392,7 +392,7 @@ void DesktopView::addExtension(const QString &name,
392 392
         const QPoint &pos,
393 393
         PlexyDesk::AbstractDesktopWidget::State state)
394 394
 {
395  
-    WidgetPlugin *provider = static_cast<WidgetPlugin *>(PluginLoader::getInstance()->instance(name));
  395
+    ViewControllerPlugin *provider = static_cast<ViewControllerPlugin *>(PluginLoader::getInstance()->instance(name));
396 396
     if (provider) {
397 397
         DesktopWidget *widget = (DesktopWidget *) provider->view();
398 398
         if (widget) {
@@ -441,7 +441,7 @@ void DesktopView::dropEvent(QDropEvent * event)
441 441
         /* handle folders */
442 442
         qDebug() << Q_FUNC_INFO << "Dir Drop accepted...";
443 443
 
444  
-        WidgetPlugin *dirWidgetPlugin = registerHandler (QLatin1String("folderwidget"));
  444
+        ViewControllerPlugin *dirWidgetPlugin = registerHandler (QLatin1String("folderwidget"));
445 445
 
446 446
         if(dirWidgetPlugin) {
447 447
             QVariantMap data;
@@ -524,7 +524,7 @@ void DesktopView::registerPhotoDialog()
524 524
 
525 525
     const QString name = "photoframe";
526 526
     const QPoint pos (0.0, 0.0);
527  
-    WidgetPlugin *provider = static_cast<WidgetPlugin *>(PluginLoader::getInstance()->instance(name));
  527
+    ViewControllerPlugin *provider = static_cast<ViewControllerPlugin *>(PluginLoader::getInstance()->instance(name));
528 528
     if (provider) {
529 529
         DesktopWidget *widget = (DesktopWidget *) provider->view();
530 530
         if (widget) {
@@ -550,10 +550,10 @@ void DesktopView::registerPhotoDialog()
550 550
 }
551 551
 
552 552
 //FIXME: Refactor so that we can avoid having a method per type
553  
-WidgetPlugin *DesktopView::registerHandler(const QString &name, bool effects_on)
  553
+ViewControllerPlugin *DesktopView::registerHandler(const QString &name, bool effects_on)
554 554
 {
555 555
     const QPoint pos (0.0, 0.0);
556  
-    WidgetPlugin *provider = static_cast<WidgetPlugin *>(PluginLoader::getInstance()->instance(name));
  556
+    ViewControllerPlugin *provider = static_cast<ViewControllerPlugin *>(PluginLoader::getInstance()->instance(name));
557 557
     if (provider) {
558 558
         DesktopWidget *widget = (DesktopWidget *) provider->view();
559 559
         if (widget) {
4  extensions/desktop/plexy/desktopview.h
@@ -24,7 +24,7 @@
24 24
 
25 25
 #include <plexy.h>
26 26
 #include <desktopwidget.h>
27  
-#include <widgetplugin.h>
  27
+#include <viewcontrollerplugin.h>
28 28
 #include <abstractdesktopview.h>
29 29
 
30 30
 using namespace PlexyDesk;
@@ -47,7 +47,7 @@ class DesktopView : public AbstractDesktopView
47 47
     void setThemePack(const QString &name);
48 48
     void addWallpaperItem();
49 49
     void registerPhotoDialog();
50  
-    PlexyDesk::WidgetPlugin *registerHandler(const QString &name, bool effects_on = false);
  50
+    PlexyDesk::ViewControllerPlugin *registerHandler(const QString &name, bool effects_on = false);
51 51
 
52 52
     void enableOpenGL(bool state);
53 53
 
4  extensions/facebook/authwin/authplugin.h
@@ -2,9 +2,9 @@
2 2
 #define PLEXY_YOUTUBE_H
3 3
 
4 4
 #include <plexy.h>
5  
-#include <widgetplugin.h>
  5
+#include <viewcontrollerplugin.h>
6 6
 
7  
-class AuthPlugin : public PlexyDesk::WidgetPlugin
  7
+class AuthPlugin : public PlexyDesk::ViewControllerPlugin
8 8
 {
9 9
     Q_OBJECT
10 10
 
5  extensions/widgets/clock/clock.cpp
@@ -19,14 +19,13 @@
19 19
 #include "clock.h"
20 20
 #include "clockwidget.h"
21 21
 
22  
-Clock::Clock(QObject *parent) : PlexyDesk::WidgetPlugin (parent)
  22
+Clock::Clock(QObject *parent) : PlexyDesk::ViewControllerPlugin (parent)
23 23
 {
24 24
     clock = new ClockWidget(QRectF(0, 0, 210, 210));
25 25
 
26 26
     if (connectToDataSource("timerengine")) {
27  
-        connect(dataSource(), SIGNAL(data(QVariantMap)), this, SLOT(onDataUpdated(QVariantMap)));
  27
+        connect(dataSource(), SIGNAL(sourceUpdated(QVariantMap)), this, SLOT(onDataUpdated(QVariantMap)));
28 28
     }
29  
-
30 29
 }
31 30
 
32 31
 Clock::~Clock()
4  extensions/widgets/clock/clock.h
@@ -20,13 +20,13 @@
20 20
 #define PLEXY_WIDGET_CLOCK_H
21 21
 
22 22
 #include <plexy.h>
23  
-#include <widgetplugin.h>
  23
+#include <viewcontrollerplugin.h>
24 24
 #include <datasource.h>
25 25
 #include <QTimer>
26 26
 #include "clockwidget.h"
27 27
 
28 28
 
29  
-class Clock : public PlexyDesk::WidgetPlugin
  29
+class Clock : public PlexyDesk::ViewControllerPlugin
30 30
 {
31 31
     Q_OBJECT
32 32
 
4  extensions/widgets/folderwidget/folderplugin.h
@@ -22,14 +22,14 @@
22 22
 #include <plexy.h>
23 23
 
24 24
 #include <abstractplugininterface.h>
25  
-#include <widgetplugin.h>
  25
+#include <viewcontrollerplugin.h>
26 26
 #include <themepackloader.h>
27 27
 #include <qmldesktopwidget.h>
28 28
 
29 29
 class QLineEdit;
30 30
 class QWidget;
31 31
 
32  
-class FolderPlugin : public PlexyDesk::WidgetPlugin
  32
+class FolderPlugin : public PlexyDesk::ViewControllerPlugin
33 33
 {
34 34
     Q_OBJECT
35 35
     Q_PROPERTY(QString dirSource READ dirSource WRITE setDirSource NOTIFY dirSourceChanged)
4  extensions/widgets/photoframe/imageplugin.h
@@ -24,14 +24,14 @@
24 24
 #include <abstractplugininterface.h>
25 25
 #include "pictureflow.h"
26 26
 #include "imageitem.h"
27  
-#include <widgetplugin.h>
  27
+#include <viewcontrollerplugin.h>
28 28
 #include <themepackloader.h>
29 29
 #include "photowidget.h"
30 30
 
31 31
 class QLineEdit;
32 32
 class QWidget;
33 33
 
34  
-class ImagePlugin : public PlexyDesk::WidgetPlugin
  34
+class ImagePlugin : public PlexyDesk::ViewControllerPlugin
35 35
 {
36 36
     Q_OBJECT
37 37
     Q_PROPERTY(QString imageSource READ imageSource WRITE setImageSource NOTIFY imageSourceChanged)
4  extensions/widgets/youtubewidget/youtube.h
@@ -2,9 +2,9 @@
2 2
 #define PLEXY_YOUTUBE_H
3 3
 
4 4
 #include <plexy.h>
5  
-#include <widgetplugin.h>
  5
+#include <viewcontrollerplugin.h>
6 6
 
7  
-class YouTube : public PlexyDesk::WidgetPlugin
  7
+class YouTube : public PlexyDesk::ViewControllerPlugin
8 8
 {
9 9
     Q_OBJECT
10 10
 

0 notes on commit c27d600

Please sign in to comment.
Something went wrong with that request. Please try again.