summaryrefslogtreecommitdiff
path: root/mediaoverrider
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-08-05 13:32:04 +0300
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-08-05 13:32:04 +0300
commit186e21da5f83fc26cd33f13e800cd59316250d04 (patch)
treec00e4a568bcc0019ddfc27613ed959808d075daa /mediaoverrider
parent223a40ec162252785591c2164f3ca1326d7878ea (diff)
downloadlibresourceqt-186e21da5f83fc26cd33f13e800cd59316250d04.tar.gz
Renamed libresource-overridesqt => libmediaoverridesqt
Renamed resourceoverrider => mediaoverrider
Diffstat (limited to 'mediaoverrider')
-rw-r--r--mediaoverrider/main.cpp10
-rw-r--r--mediaoverrider/mediaoverrider.cpp83
-rw-r--r--mediaoverrider/mediaoverrider.desktop7
-rw-r--r--mediaoverrider/mediaoverrider.h38
-rw-r--r--mediaoverrider/mediaoverrider.pro28
5 files changed, 166 insertions, 0 deletions
diff --git a/mediaoverrider/main.cpp b/mediaoverrider/main.cpp
new file mode 100644
index 0000000..db13d33
--- /dev/null
+++ b/mediaoverrider/main.cpp
@@ -0,0 +1,10 @@
+#include "mediaoverrider.h"
+
+int main(int argc, char **argv)
+{
+ MediaOverrider app(argc, argv);
+// MApplication app(argc, argv);
+
+ return app.run();
+}
+
diff --git a/mediaoverrider/mediaoverrider.cpp b/mediaoverrider/mediaoverrider.cpp
new file mode 100644
index 0000000..24d9afc
--- /dev/null
+++ b/mediaoverrider/mediaoverrider.cpp
@@ -0,0 +1,83 @@
+#include "mediaoverrider.h"
+
+MediaOverrider::MediaOverrider(int argc, char **argv, QObject *parent):
+ QObject(parent), app(argc, argv)
+{
+// MTheme::loadCSS("MediaOverrider.css");
+ window = new MApplicationWindow;
+ page = new MApplicationPage;
+
+ layout = new MLayout;
+ policy = new MGridLayoutPolicy(layout);
+ policy->setSpacing(10);
+
+ page->setTitle("Resource Overrider");
+ MLabel * label = new MLabel("Press the toggle buttons to change overrides");
+ policy->addItem(label, 0, 1);
+ label->setObjectName("label");
+ label->setAlignment(Qt::AlignCenter);
+
+ muteButton = new MButton(page->centralWidget());
+ muteButton->setText("Mute");
+ muteButton->setViewType(MButton::toggleType);
+ muteButton->setCheckable(true);
+ policy->addItem(muteButton, 1, 0);
+ muteButton->setObjectName("button");
+
+ privacyButton = new MButton(page->centralWidget());
+ privacyButton->setText("Privacy");
+ privacyButton->setViewType(MButton::toggleType);
+ privacyButton->setCheckable(true);
+ policy->addItem(privacyButton, 1, 1);
+ privacyButton->setObjectName("button");
+
+ btButton = new MButton(page->centralWidget());
+ btButton->setText("BT");
+ btButton->setViewType(MButton::toggleType);
+ btButton->setCheckable(true);
+ policy->addItem(btButton, 1, 2);
+ btButton->setObjectName("button");
+
+ page->centralWidget()->setLayout(layout);
+
+ mute = ResourcePolicy::createMute(this);
+ privacyOverride = ResourcePolicy::createPrivacyOverride(this);
+ btOverride = ResourcePolicy::createBluetoothOVerride(this);
+
+ QObject::connect(mute, SIGNAL(changed(bool)), this, SLOT(handleMuteChange(bool)));
+ QObject::connect(muteButton, SIGNAL(toggled(bool)), mute, SLOT(request(bool)));
+
+ QObject::connect(privacyOverride, SIGNAL(changed(bool)), this, SLOT(handlePrivacyChange(bool)));
+ QObject::connect(privacyButton, SIGNAL(toggled(bool)), privacyOverride, SLOT(request(bool)));
+
+ QObject::connect(btOverride, SIGNAL(changed(bool)), this, SLOT(handleBtChange(bool)));
+ QObject::connect(btButton, SIGNAL(toggled(bool)), btOverride, SLOT(request(bool)));
+
+}
+
+MediaOverrider::~MediaOverrider()
+{}
+
+int MediaOverrider::run()
+{
+ page->appear();
+ window->show();
+
+ return app.exec();
+}
+
+void MediaOverrider::handleMuteChange(bool newState)
+{
+ muteButton->setChecked(newState);
+}
+
+void MediaOverrider::handlePrivacyChange(bool newState)
+{
+ privacyButton->setChecked(newState);
+}
+
+void MediaOverrider::handleBtChange(bool newState)
+{
+ btButton->setChecked(newState);
+}
+
diff --git a/mediaoverrider/mediaoverrider.desktop b/mediaoverrider/mediaoverrider.desktop
new file mode 100644
index 0000000..b257a5e
--- /dev/null
+++ b/mediaoverrider/mediaoverrider.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=Policy Media Overrider
+Icon=icon-l-music
+Exec=/usr/bin/mediaoverrider
+OnlyShowIn=X-MeeGo;
+
diff --git a/mediaoverrider/mediaoverrider.h b/mediaoverrider/mediaoverrider.h
new file mode 100644
index 0000000..052a7e0
--- /dev/null
+++ b/mediaoverrider/mediaoverrider.h
@@ -0,0 +1,38 @@
+#include <MApplication>
+#include <MApplicationWindow>
+#include <MApplicationPage>
+#include <MButton>
+#include <MLabel>
+#include <MGridLayoutPolicy>
+#include <MLayout>
+#include <MTheme>
+
+#include <override.h>
+
+class MediaOverrider: public QObject
+{
+ Q_OBJECT
+public:
+ MediaOverrider(int argc, char **argv, QObject *parent=NULL);
+ ~MediaOverrider();
+ int run();
+private slots:
+ void handleMuteChange(bool newState);
+ void handlePrivacyChange(bool newState);
+ void handleBtChange(bool newState);
+
+private:
+ MApplication app;
+ ResourcePolicy::Override *mute;
+ ResourcePolicy::Override *privacyOverride;
+ ResourcePolicy::Override *btOverride;
+
+ MApplicationWindow *window;
+ MApplicationPage *page;
+ MLayout *layout;
+ MGridLayoutPolicy *policy;
+ MButton *muteButton;
+ MButton *privacyButton;
+ MButton *btButton;
+};
+
diff --git a/mediaoverrider/mediaoverrider.pro b/mediaoverrider/mediaoverrider.pro
new file mode 100644
index 0000000..e74679a
--- /dev/null
+++ b/mediaoverrider/mediaoverrider.pro
@@ -0,0 +1,28 @@
+include(../common.pri)
+
+TEMPLATE = app
+TARGET = mediaoverrider
+MOC_DIR = moc
+OBJECTS_DIR = build
+DEPENDPATH += .
+INCLUDEPATH += $${LIBMEDIAOVERRIDESQT}
+CONFIG += qt meegotouch
+QT += dbus
+
+LIBS += -L$${LIBMEDIAOVERRIDESQT}/build -lmediaoverridesqt
+
+# Input
+HEADERS += mediaoverrider.h
+SOURCES += main.cpp mediaoverrider.cpp
+
+QMAKE_DISTCLEAN += -r moc build
+
+# Install options
+
+target.path = /usr/bin/
+
+desktop.path = /usr/share/applications/
+desktop.files = mediaoverrider.desktop
+
+INSTALLS = target desktop
+