Moved the devices to a own plugin
This commit is contained in:
parent
b0d8dd685f
commit
8f13ff385d
5 changed files with 63 additions and 16 deletions
12
telldus-gui/Plugins/Devices/Devices.pro
Normal file
12
telldus-gui/Plugins/Devices/Devices.pro
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# -------------------------------------------------
|
||||||
|
# Project created by QtCreator 2009-03-10T12:16:44
|
||||||
|
# -------------------------------------------------
|
||||||
|
QT += core \
|
||||||
|
gui
|
||||||
|
TARGET = Devices
|
||||||
|
TEMPLATE = lib
|
||||||
|
CONFIG += plugin
|
||||||
|
DESTDIR = ../../TelldusCenter/plugins
|
||||||
|
SOURCES += devicesplugin.cpp
|
||||||
|
HEADERS += devicesplugin.h
|
||||||
|
#RESOURCES += Devices.qrc
|
27
telldus-gui/Plugins/Devices/devicesplugin.cpp
Normal file
27
telldus-gui/Plugins/Devices/devicesplugin.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include <QtCore>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QApplication>
|
||||||
|
#include "devicesplugin.h"
|
||||||
|
|
||||||
|
#include "../../TelldusGui/telldusgui.h"
|
||||||
|
|
||||||
|
QIcon DevicesPlugin::iconForPage( const QString &page ) const {
|
||||||
|
return QIcon(":/images/devices.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DevicesPlugin::pluginName() const {
|
||||||
|
return "Devices";
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *DevicesPlugin::widget( const QString &page, QWidget *parent ) const {
|
||||||
|
QWidget *deviceWidget = tdDeviceWidget(parent);
|
||||||
|
connect(deviceWidget, SIGNAL(showMessage(const QString &, const QString &, const QString &)), qApp, SLOT(showMessage(const QString &, const QString &, const QString &)));
|
||||||
|
connect(deviceWidget, SIGNAL(eventTriggered(const QString &, const QString &)), qApp, SLOT(eventTriggered(const QString &, const QString &)));
|
||||||
|
return deviceWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList DevicesPlugin::widgets() const {
|
||||||
|
return QStringList() << "devicest.default";
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EXPORT_PLUGIN2(DevicesInterface, DevicesPlugin)
|
21
telldus-gui/Plugins/Devices/devicesplugin.h
Normal file
21
telldus-gui/Plugins/Devices/devicesplugin.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef DEVICESPLUGIN_H
|
||||||
|
#define DEVICESPLUGIN_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QIcon>
|
||||||
|
#include "../../TelldusCenter/tellduscenterplugin.h"
|
||||||
|
|
||||||
|
class DevicesPlugin : public QObject, public TelldusCenterPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(TelldusCenterPlugin)
|
||||||
|
public:
|
||||||
|
virtual QIcon iconForPage( const QString &page ) const;
|
||||||
|
virtual QString pluginName() const;
|
||||||
|
|
||||||
|
virtual QWidget *widget( const QString &page, QWidget *parent ) const;
|
||||||
|
virtual QStringList widgets() const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DEVICESPLUGIN_H
|
|
@ -14,7 +14,6 @@
|
||||||
#include "tellduscenterapplication.h"
|
#include "tellduscenterapplication.h"
|
||||||
#include "tellduscenterplugin.h"
|
#include "tellduscenterplugin.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "../TelldusGui/telldusgui.h"
|
|
||||||
|
|
||||||
class MainWindowPrivate {
|
class MainWindowPrivate {
|
||||||
public:
|
public:
|
||||||
|
@ -48,12 +47,6 @@ MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags)
|
||||||
d->stackedLayout = new QStackedLayout;
|
d->stackedLayout = new QStackedLayout;
|
||||||
layout->addLayout(d->stackedLayout);
|
layout->addLayout(d->stackedLayout);
|
||||||
|
|
||||||
TelldusCenterApplication *app = TelldusCenterApplication::instance();
|
|
||||||
QWidget *deviceWidget = tdDeviceWidget(this);
|
|
||||||
connect(deviceWidget, SIGNAL(showMessage(const QString &, const QString &, const QString &)), app, SLOT(showMessage(const QString &, const QString &, const QString &)));
|
|
||||||
connect(deviceWidget, SIGNAL(eventTriggered(const QString &, const QString &)), app, SLOT(eventTriggered(const QString &, const QString &)));
|
|
||||||
d->stackedLayout->addWidget(deviceWidget);
|
|
||||||
|
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
|
|
||||||
setupToolBar();
|
setupToolBar();
|
||||||
|
@ -99,14 +92,6 @@ void MainWindow::setupToolBar()
|
||||||
QActionGroup *ag = new QActionGroup(this);
|
QActionGroup *ag = new QActionGroup(this);
|
||||||
|
|
||||||
QSet<QString> toolbarIcons;
|
QSet<QString> toolbarIcons;
|
||||||
QAction *actionDevices = new QAction( QIcon(":/images/devices.png"), tr("Devices"), this );
|
|
||||||
actionDevices->setCheckable( true );
|
|
||||||
actionDevices->setChecked( true );
|
|
||||||
actionDevices->setData(0);
|
|
||||||
connect(actionDevices, SIGNAL(triggered()), this, SLOT(slotPagesClick()));
|
|
||||||
ag->addAction(actionDevices);
|
|
||||||
toolbarIcons.insert("devices");
|
|
||||||
|
|
||||||
TelldusCenterApplication *app = TelldusCenterApplication::instance();
|
TelldusCenterApplication *app = TelldusCenterApplication::instance();
|
||||||
PluginList plugins = app->plugins();
|
PluginList plugins = app->plugins();
|
||||||
foreach( TelldusCenterPlugin *plugin, plugins ) {
|
foreach( TelldusCenterPlugin *plugin, plugins ) {
|
||||||
|
@ -133,6 +118,7 @@ void MainWindow::setupToolBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ag->actions().first()->setChecked( true );
|
||||||
d->pagesBar->addActions( ag->actions() );
|
d->pagesBar->addActions( ag->actions() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
TEMPLATE=subdirs
|
TEMPLATE=subdirs
|
||||||
SUBDIRS = TelldusGui \
|
SUBDIRS = TelldusGui \
|
||||||
TelldusCenter
|
TelldusCenter \
|
||||||
|
Plugins
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue