Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mce-qt5] Initial commit. JB#36523
  • Loading branch information
monich committed Jan 31, 2017
0 parents commit 29ea45c
Show file tree
Hide file tree
Showing 18 changed files with 997 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*~
build
.DS_Store
*.pro.user
1 change: 1 addition & 0 deletions README
@@ -0,0 +1 @@
Qt client for mce, and a declarative plugin for it.
14 changes: 14 additions & 0 deletions lib/dbus/com.nokia.mce.request.xml
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE node PUBLIC
"-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
"http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
<node name="/com/nokia/mce/request">
<interface name="com.nokia.mce.request">
<method name="get_display_status">
<arg direction="out" name="display_state" type="s"/>
</method>
<method name="get_tklock_mode">
<arg direction="out" name="mode_name" type="s"/>
</method>
</interface>
</node>
14 changes: 14 additions & 0 deletions lib/dbus/com.nokia.mce.signal.xml
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE node PUBLIC
"-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
"http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
<node name="/com/nokia/mce/signal">
<interface name="com.nokia.mce.signal">
<signal name="display_status_ind">
<arg name="display_state" type="s"/>
</signal>
<signal name="tklock_mode_ind">
<arg name="tklock_mode" type="s"/>
</signal>
</interface>
</node>
70 changes: 70 additions & 0 deletions lib/include/qmcedisplay.h
@@ -0,0 +1,70 @@
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* any official policies, either expressed or implied.
*/

#ifndef QMCE_DISPLAY_H
#define QMCE_DISPLAY_H

#include "qmcetypes.h"

class QMCE_EXPORT QMceDisplay : public QObject
{
Q_OBJECT
Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
Q_PROPERTY(State state READ state NOTIFY stateChanged)
Q_ENUMS(State)

public:
enum State {
DisplayOff,
DisplayDim,
DisplayOn
};

QMceDisplay(QObject* aParent = NULL);

bool valid() const;
State state() const;

Q_SIGNALS:
void validChanged();
void stateChanged();

private:
class Private;
Private* iPrivate;
};

#endif // QMCE_DISPLAY_H
77 changes: 77 additions & 0 deletions lib/include/qmcetklock.h
@@ -0,0 +1,77 @@
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* any official policies, either expressed or implied.
*/

#ifndef QMCE_TKLOCK_H
#define QMCE_TKLOCK_H

#include "qmcetypes.h"

class QMCE_EXPORT QMceTkLock : public QObject
{
Q_OBJECT
Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
Q_PROPERTY(bool locked READ locked NOTIFY lockedChanged)
Q_PROPERTY(Mode mode READ mode NOTIFY modeChanged)
Q_ENUMS(Mode)

public:
enum Mode {
Locked,
SilentLocked,
LockedDim,
LockedDelay,
SilentLockedDim,
Unlocked,
SilentUnlocked
};

QMceTkLock(QObject* aParent = NULL);

bool valid() const;
bool locked() const;
Mode mode() const;

Q_SIGNALS:
void validChanged();
void lockedChanged();
void modeChanged();

private:
class Private;
Private* iPrivate;
};

#endif // QMCE_TKLOCK_H
48 changes: 48 additions & 0 deletions lib/include/qmcetypes.h
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* any official policies, either expressed or implied.
*/

#ifndef QMCE_TYPES_H
#define QMCE_TYPES_H

#include <QtCore>

#ifdef QMCE_LIBRARY
# define QMCE_EXPORT Q_DECL_EXPORT
#else
# define QMCE_EXPORT Q_DECL_IMPORT
#endif

#endif // QMCE_TYPES_H
64 changes: 64 additions & 0 deletions lib/lib.pro
@@ -0,0 +1,64 @@
TARGET = mce-qt5
CONFIG += create_pc create_prl no_install_prl link_pkgconfig
PKGCONFIG += mce

QT += dbus
QT -= gui
QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-psabi
INCLUDEPATH += include

include(version.pri)

TEMPLATE = lib
DEFINES += QMCE_LIBRARY

isEmpty(PREFIX) {
PREFIX=/usr
}

XML_FILES += \
dbus/com.nokia.mce.request.xml \
dbus/com.nokia.mce.signal.xml

OTHER_FILES += $$XML_FILES

SOURCES += \
src/qmcedisplay.cpp \
src/qmceproxy.cpp \
src/qmcetklock.cpp

PUBLIC_HEADERS += \
include/qmcedisplay.h \
include/qmcetypes.h \
include/qmcetklock.h

HEADERS += \
$$PUBLIC_HEADERS \
src/qmceproxy.h

DBUS_INTERFACES += com_nokia_mce_request
com_nokia_mce_request.files = dbus/com.nokia.mce.request.xml
com_nokia_mce_request.header_flags = -N -c QMceRequestProxy
com_nokia_mce_request.source_flags = -N -c QMceRequestProxy

DBUS_INTERFACES += com_nokia_mce_signal
com_nokia_mce_signal.files = dbus/com.nokia.mce.signal.xml
com_nokia_mce_signal.header_flags = -N -c QMceSignalProxy
com_nokia_mce_signal.source_flags = -N -c QMceSignalProxy

target.path = $$[QT_INSTALL_LIBS]

headers.files = $$PUBLIC_HEADERS
headers.path = $$INSTALL_ROOT$$PREFIX/include/mce-qt5

pkgconfig.files = mce-qt5.pc
pkgconfig.path = $$[QT_INSTALL_LIBS]/pkgconfig

QMAKE_PKGCONFIG_NAME = $$TARGET
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_INCDIR = $$headers.path
QMAKE_PKGCONFIG_DESCRIPTION = Qt bindings for mce
QMAKE_PKGCONFIG_PREFIX = $$PREFIX
QMAKE_PKGCONFIG_VERSION = $$VERSION

INSTALLS += target headers pkgconfig

0 comments on commit 29ea45c

Please sign in to comment.