Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 0c4649c61723bd0f53842781736ae138a07842ea @MohammadAG MohammadAG committed May 28, 2012
@@ -0,0 +1 @@
+system-ui-brightness-control.pro.user system-ui-brightness-control.pro.user.2.3pre1
@@ -0,0 +1,51 @@
+#include "brightnesscontroller.h"
+#include <MSlider>
+#include <MImageWidget>
+
+BrightnessController::BrightnessController(BrightnessPlugin *brightnessPlugin, QGraphicsItem *parent) :
+ MWidget(parent),
+ m_brightnessSlider(new MSlider(this)),
+ m_brightnessPlugin(brightnessPlugin)
+{
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal, this);
+ //setTitle(tr("Brightness"));
+ setObjectName("StatusIndicatorMenuExtensionContentItem");
+
+ MImageWidget *lowBrightnessImage = new MImageWidget("icon-s-camera-low-brightness", this);
+ layout->addItem(lowBrightnessImage);
+
+ m_brightnessSlider->setRange(1, GConfItem("/system/osso/dsm/display/max_display_brightness_levels", this).value().toInt());
+ layout->addItem(m_brightnessSlider);
+
+ MImageWidget *highBrightnessImage = new MImageWidget("icon-s-camera-high-brightness", this);
+ layout->addItem(highBrightnessImage);
+
+ layout->setContentsMargins(30, 15, 15, 15);
+
+ m_brightnessGConfItem = new GConfItem("/system/osso/dsm/display/display_brightness");
+ m_brightnessSlider->setValue(m_brightnessGConfItem->value().toInt());
+ connect(m_brightnessGConfItem, SIGNAL(valueChanged()), this, SLOT(onValueChanged()));
+ connect(m_brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
+}
+
+BrightnessController::~BrightnessController()
+{
+
+}
+
+void BrightnessController::onValueChanged()
+{
+ // Avoid infinite loops :)
+ disconnect(m_brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
+
+ m_brightnessSlider->setValue(m_brightnessGConfItem->value().toInt());
+
+ connect(m_brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
+}
+
+void BrightnessController::onSliderValueChanged(int newValue)
+{
+ m_brightnessGConfItem->blockSignals(true);
+ m_brightnessGConfItem->set(newValue);
+ m_brightnessGConfItem->blockSignals(false);
+}
@@ -0,0 +1,51 @@
+#include "brightnesscontroller.h"
+#include <MSlider>
+#include <MImageWidget>
+
+BrightnessController::BrightnessController(BrightnessPlugin *brightnessPlugin, QGraphicsItem *parent) :
+ MWidget(parent),
+ m_brightnessSlider(new MSlider(this)),
+ m_brightnessPlugin(brightnessPlugin)
+{
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal, this);
+ //setTitle(tr("Brightness"));
+ setObjectName("StatusIndicatorMenuExtensionContentItem");
+
+ MImageWidget *lowBrightnessImage = new MImageWidget("icon-s-camera-low-brightness", this);
+ layout->addItem(lowBrightnessImage);
+
+ m_brightnessSlider->setRange(1, GConfItem("/system/osso/dsm/display/max_display_brightness_levels", this).value().toInt());
+ layout->addItem(m_brightnessSlider);
+
+ MImageWidget *highBrightnessImage = new MImageWidget("icon-s-camera-high-brightness", this);
+ layout->addItem(highBrightnessImage);
+
+ layout->setContentsMargins(30, 15, 15, 15);
+
+ m_brightnessGConfItem = new GConfItem("/system/osso/dsm/display/display_brightness");
+ m_brightnessSlider->setValue(m_brightnessGConfItem->value().toInt());
+ connect(m_brightnessGConfItem, SIGNAL(valueChanged()), this, SLOT(onValueChanged()));
+ connect(m_brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
+}
+
+BrightnessController::~BrightnessController()
+{
+
+}
+
+void BrightnessController::onValueChanged()
+{
+ // Avoid infinite loops :)
+ disconnect(m_brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
+
+ m_brightnessSlider->setValue(m_brightnessGConfItem->value().toInt());
+
+ connect(m_brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
+}
+
+void BrightnessController::onSliderValueChanged(int newValue)
+{
+ m_brightnessGConfItem->blockSignals(true);
+ m_brightnessGConfItem->set(newValue);
+ m_brightnessGConfItem->blockSignals(false);
+}
@@ -0,0 +1,35 @@
+#ifndef BRIGHTNESSCONTROLLER_H
+#define BRIGHTNESSCONTROLLER_H
+
+#include <MContentItem>
+#include <MSlider>
+#include <QGraphicsLinearLayout>
+#include "brightnessplugin.h"
+#include <gq/GConfItem>
+
+class MStatusIndicatorMenuInterface;
+class ProfilePlugin;
+
+class BrightnessController : public MWidget
+{
+ Q_OBJECT
+public:
+ explicit BrightnessController(BrightnessPlugin *brightnessPlugin, QGraphicsItem *parent = NULL);
+ virtual ~BrightnessController();
+
+signals:
+
+public slots:
+
+private:
+ MSlider *m_brightnessSlider;
+ BrightnessPlugin *m_brightnessPlugin;
+
+ GConfItem *m_brightnessGConfItem;
+
+private slots:
+ void onSliderValueChanged(int);
+ void onValueChanged();
+};
+
+#endif // BRIGHTNESSCONTROLLER_H
@@ -0,0 +1,36 @@
+#include "brightnessplugin.h"
+#include "brightnesscontroller.h"
+
+Q_EXPORT_PLUGIN2(profile, BrightnessPlugin)
+
+BrightnessPlugin::BrightnessPlugin(QObject *parent) :
+ statusIndicatorMenu(0),
+ m_brightnessController(0)
+{
+ Q_UNUSED(parent)
+}
+
+void BrightnessPlugin::setStatusIndicatorMenuInterface(MStatusIndicatorMenuInterface &menuInterface)
+{
+ statusIndicatorMenu = &menuInterface;
+}
+
+MStatusIndicatorMenuInterface *BrightnessPlugin::statusIndicatorMenuInterface() const
+{
+ return statusIndicatorMenu;
+}
+
+// Methods derived from MApplicationExtensionInterface
+bool BrightnessPlugin::initialize(const QString &)
+{
+ m_brightnessController = new BrightnessController(this);
+
+ return true;
+}
+
+QGraphicsWidget *BrightnessPlugin::widget()
+{
+ return m_brightnessController;
+}
+
+M_LIBRARY
@@ -0,0 +1,40 @@
+#ifndef BRIGHTNESSPLUGIN_H
+#define BRIGHTNESSPLUGIN_H
+
+#include <QObject>
+#include <QtPlugin>
+#include <MLibrary>
+#include <MStatusIndicatorMenuExtensionInterface>
+#include <MApplicationExtensionInterface>
+#include <QGraphicsWidget>
+
+class BrightnessController;
+
+class BrightnessPlugin : public QObject, public MStatusIndicatorMenuExtensionInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(MStatusIndicatorMenuExtensionInterface MApplicationExtensionInterface)
+
+public:
+ explicit BrightnessPlugin(QObject *parent = 0);
+
+ // Getter for the status indicator menu interface
+ MStatusIndicatorMenuInterface *statusIndicatorMenuInterface() const;
+
+ // Methods derived from MStatusIndicatorMenuPlugin
+ virtual void setStatusIndicatorMenuInterface(MStatusIndicatorMenuInterface &menuInterface);
+
+ // Methods derived from MApplicationExtensionInterface
+ virtual bool initialize(const QString &interface);
+ virtual QGraphicsWidget *widget();
+
+signals:
+
+public slots:
+
+private:
+ MStatusIndicatorMenuInterface *statusIndicatorMenu;
+ BrightnessController *m_brightnessController;
+};
+
+#endif // BRIGHTNESSPLUGIN_H
@@ -0,0 +1,5 @@
+system-ui-brightness-control (0.1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Mohammad Abu-Garbeyyeh <mohammad7410@gmail.com> Mon, 28 May 2012 22:31:39 +0300
@@ -0,0 +1 @@
+7
@@ -0,0 +1,14 @@
+Source: system-ui-brightness-control
+Section: user/other
+Priority: optional
+Maintainer: Mohammad Abu-Garbeyyeh <mohammad7410@gmail.com>
+Build-Depends: debhelper (>= 5), libqt4-dev, libmeegotouch-dev
+Standards-Version: 3.7.3
+
+Package: system-ui-brightness-control
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, unrestricted-system-ui
+Description: Brightness plugin in status menu
+ A status menu plugin that can be used to change
+ the brightness of the display.
+XSBC-Maemo-Display-Name: Brightness control status menu applet
@@ -0,0 +1,36 @@
+This package was debianized by Mohammad Abu-Garbeyyeh
+<mohammad7410@gmail.com> on Sat, 02 Jul 2011 01:38:53 +0300.
+
+Upstream Author(s):
+
+ Mohammad Abu-Garbeyyeh <mohammad7410@gmail.com>
+
+Copyright:
+
+ Copyright (C) 2012 Mohammad Abu-Garbeyyeh
+
+License:
+
+ This package 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 package 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 package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2012, Mohammad Abu-Garbeyyeh <mohammad7410@gmail.com> and
+is licensed under the GPL, see above.
+
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
@@ -0,0 +1,69 @@
+AutoGenerateAegisFile
+<!-- Aegis manifest declares the security credentials required by an
+ application to run correctly. By default, a manifest file will be
+ created or updated automatically as a part of build.
+
+ The detection of required credentials is based on static scan of
+ application binaries. In some cases, the scan may not be able to
+ detect the correct set of permissions. If this is the case, you must
+ declare the credentials required by your application in this file.
+
+ To create a manifest file automatically as a part of build (DEFAULT):
+
+ * Make sure this file starts with the string "AutoGenerateAegisFile" (without quotes).
+ * Alternatively, it can also be completely empty.
+
+ To provide a manifest yourself:
+
+ * List the correct credentials for the application in this file.
+ * Some commented-out examples of often required tokens are provided.
+ * Ensure the path to your application binary given in
+ '<for path="/path/to/app" />' is correct.
+ * Please do not request more credentials than what your application
+ actually requires.
+
+ To disable manifest file:
+
+ * Replace this file with a file starting with the string "NoAegisFile" (without quotes).
+ * Final application package will not contain a manifest.
+
+-->
+<aegis>
+ <request policy="add">
+
+ <!-- Make a GSM call, send text messages (SMS). -->
+ <!--
+ <credential name="Cellular" />
+ -->
+
+ <!-- Access Facebook social data. -->
+ <!--
+ <credential name="FacebookSocial" />
+ -->
+
+ <!-- Read access to data stored in tracker. -->
+ <!--
+ <credential name="TrackerReadAccess" />
+ -->
+
+ <!-- Read and write access to data stored in tracker. -->
+ <!--
+ <credential name="TrackerWriteAccess" />
+ -->
+
+ <!-- Read Location information. -->
+ <!--
+ <credential name="Location" />
+ -->
+
+ <!-- Access to Audio, Multimedia and Camera. -->
+ <!--
+ <credential name="GRP::pulse-access" />
+ <credential name="GRP::video" />
+ <credential name="GRP::audio" />
+ -->
+
+ <for path="/opt/system-ui-brightness-control/bin/system-ui-brightness-control" />
+ <for path="applauncherd-launcher::/usr/bin/applauncherd.bin" id="" />
+ </request>
+</aegis>
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+echo "Restarting status menu"
+/sbin/stop xsession/sysuid
+sleep 1
+/sbin/start xsession/sysuid
+
+exit 0
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+/sbin/stop xsession/sysuid
+sleep 1
+/sbin/start xsession/sysuid
+exit 0
Oops, something went wrong.

0 comments on commit 0c4649c

Please sign in to comment.