Skip to content

Commit

Permalink
Rename Qm classes
Browse files Browse the repository at this point in the history
Remove qm from names and rename the namespace too.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
  • Loading branch information
Tomin1 committed Apr 21, 2020
1 parent 1e4ffb0 commit 6852d39
Show file tree
Hide file tree
Showing 41 changed files with 483 additions and 489 deletions.
2 changes: 1 addition & 1 deletion plugin/plugin.pro
Expand Up @@ -16,7 +16,7 @@ INCLUDEPATH += ../src \
../src/utilities \
../src/xtools \
../src/compositor \
../src/qmsystem2 \
../src/devicestate \
../src/touchscreen

LIBS += -L../src -llipstick-qt5
Expand Down
42 changes: 21 additions & 21 deletions src/qmsystem2/qmsystemstate.cpp → src/devicestate/devicestate.cpp
@@ -1,6 +1,6 @@
/*!
* @file qmsystemstate.cpp
* @brief QmSystemState
* @file devicestate.cpp
* @brief DeviceState
<p>
Copyright (c) 2009-2011 Nokia Corporation
Expand All @@ -27,8 +27,8 @@
License along with SystemSW QtAPI. If not, see <http://www.gnu.org/licenses/>.
</p>
*/
#include "qmsystemstate.h"
#include "qmsystemstate_p.h"
#include "devicestate.h"
#include "devicestate_p.h"

#include <dsme/thermalmanager_dbus_if.h>

Expand All @@ -38,32 +38,32 @@
#include <QMetaMethod>


namespace MeeGo {
namespace DeviceState {

QmSystemState::QmSystemState(QObject *parent)
DeviceState::DeviceState(QObject *parent)
: QObject(parent) {
MEEGO_INITIALIZE(QmSystemState);
MEEGO_INITIALIZE(DeviceState);

connect(priv, SIGNAL(systemStateChanged(MeeGo::QmSystemState::StateIndication)),
this, SIGNAL(systemStateChanged(MeeGo::QmSystemState::StateIndication)));
connect(priv, SIGNAL(systemStateChanged(DeviceState::DeviceState::StateIndication)),
this, SIGNAL(systemStateChanged(DeviceState::DeviceState::StateIndication)));
}

QmSystemState::~QmSystemState() {
MEEGO_PRIVATE(QmSystemState)
DeviceState::~DeviceState() {
MEEGO_PRIVATE(DeviceState)

disconnect(priv, SIGNAL(systemStateChanged(MeeGo::QmSystemState::StateIndication)),
this, SIGNAL(systemStateChanged(MeeGo::QmSystemState::StateIndication)));
disconnect(priv, SIGNAL(systemStateChanged(DeviceState::DeviceState::StateIndication)),
this, SIGNAL(systemStateChanged(DeviceState::DeviceState::StateIndication)));

MEEGO_UNINITIALIZE(QmSystemState);
MEEGO_UNINITIALIZE(DeviceState);
}

void QmSystemState::connectNotify(const QMetaMethod &signal) {
MEEGO_PRIVATE(QmSystemState)
void DeviceState::connectNotify(const QMetaMethod &signal) {
MEEGO_PRIVATE(DeviceState)

/* QObject::connect() needs to be thread-safe */
QMutexLocker locker(&priv->connectMutex);

if (signal == QMetaMethod::fromSignal(&QmSystemState::systemStateChanged)) {
if (signal == QMetaMethod::fromSignal(&DeviceState::systemStateChanged)) {
if (0 == priv->connectCount[SIGNAL_SYSTEM_STATE]) {
QDBusConnection::systemBus().connect(dsme_service,
dsme_sig_path,
Expand Down Expand Up @@ -106,13 +106,13 @@ void QmSystemState::connectNotify(const QMetaMethod &signal) {
}
}

void QmSystemState::disconnectNotify(const QMetaMethod &signal) {
MEEGO_PRIVATE(QmSystemState)
void DeviceState::disconnectNotify(const QMetaMethod &signal) {
MEEGO_PRIVATE(DeviceState)

/* QObject::disconnect() needs to be thread-safe */
QMutexLocker locker(&priv->connectMutex);

if (signal == QMetaMethod::fromSignal(&QmSystemState::systemStateChanged)) {
if (signal == QMetaMethod::fromSignal(&DeviceState::systemStateChanged)) {
priv->connectCount[SIGNAL_SYSTEM_STATE]--;

if (0 == priv->connectCount[SIGNAL_SYSTEM_STATE]) {
Expand Down Expand Up @@ -156,4 +156,4 @@ void QmSystemState::disconnectNotify(const QMetaMethod &signal) {
}
}

} // MeeGo namespace
} // DeviceState namespace
41 changes: 19 additions & 22 deletions src/qmsystem2/qmsystemstate.h → src/devicestate/devicestate.h
@@ -1,6 +1,6 @@
/*!
* @file qmsystemstate.h
* @brief Contains QmSystemState which provides information and actions on device state.
* @file devicestate.h
* @brief Contains DeviceState which provides information and actions on device state.
<p>
@copyright (C) 2009-2011 Nokia Corporation
Expand Down Expand Up @@ -32,25 +32,25 @@
License along with SystemSW QtAPI. If not, see <http://www.gnu.org/licenses/>.
</p>
*/
#ifndef QMSYSTEMSTATE_H
#define QMSYSTEMSTATE_H
#ifndef DEVICESTATE_H
#define DEVICESTATE_H

#include "system_global.h"
#include <QtCore/qobject.h>

QT_BEGIN_HEADER

namespace MeeGo {
namespace DeviceState {

class QmSystemStatePrivate;
class DeviceStatePrivate;

/*!
* @scope Nokia Meego
*
* @class QmSystemState
* @brief QmSystemState provides information and actions on device state.
* @class DeviceState
* @brief DeviceState provides information and actions on device state.
*/
class QmSystemState : public QObject
class DeviceState : public QObject
{
Q_OBJECT
Q_ENUMS(StateIndication)
Expand All @@ -59,9 +59,9 @@ class QmSystemState : public QObject
//! State indication
enum StateIndication
{
Shutdown = 0, //!< Normal shutdown
ThermalStateFatal, //!< Shutdown due to thermal state
BatteryStateEmpty, //!< Shutdown due battery empty within few seconds
Shutdown = 0, //!< Normal shutdown
ThermalStateFatal, //!< Shutdown due to thermal state
BatteryStateEmpty, //!< Shutdown due battery empty within few seconds
SaveData, //!< Save data
RebootDeniedUSB, //!< Reboot denied because USB is connected in mass storage mode
ShutdownDeniedUSB, //!< Shutdown denied because USB is connected in mass storage mode
Expand All @@ -73,30 +73,27 @@ class QmSystemState : public QObject
* @brief Constructor
* @param parent The possible parent object
*/
QmSystemState(QObject *parent = 0);
~QmSystemState();
DeviceState(QObject *parent = 0);
~DeviceState();

Q_SIGNALS:
/*!
* @brief Sent when device state indication has been received.
* @param what Received state indication type
*/
void systemStateChanged(MeeGo::QmSystemState::StateIndication what);
void systemStateChanged(DeviceState::DeviceState::StateIndication what);

protected:
void connectNotify(const QMetaMethod &signal);
void disconnectNotify(const QMetaMethod &signal);

private:
Q_DISABLE_COPY(QmSystemState)
MEEGO_DECLARE_PRIVATE(QmSystemState)
Q_DISABLE_COPY(DeviceState)
MEEGO_DECLARE_PRIVATE(DeviceState)
};

} // MeeGo namespace
} // DeviceState namespace

QT_END_HEADER

#endif // QMSYSTEMSTATE_H

// End of file

#endif // DEVICESTATE_H
40 changes: 20 additions & 20 deletions src/qmsystem2/qmsystemstate_p.h → src/devicestate/devicestate_p.h
@@ -1,6 +1,6 @@
/*!
* @file qmsystemstate_p.h
* @brief Contains QmSystemStatePrivate
* @file devicestate_p.h
* @brief Contains DeviceStatePrivate
<p>
Copyright (c) 2009-2011 Nokia Corporation
Expand All @@ -24,78 +24,78 @@
License along with SystemSW QtAPI. If not, see <http://www.gnu.org/licenses/>.
</p>
*/
#ifndef QMSYSTEMSTATE_P_H
#define QMSYSTEMSTATE_P_H
#ifndef DEVICESTATE_P_H
#define DEVICESTATE_P_H

#include "qmsystemstate.h"
#include "qmipcinterface_p.h"
#include "devicestate.h"
#include "ipcinterface_p.h"
#include "dsme/dsme_dbus_if.h"

#include <QMutex>

#define SIGNAL_SYSTEM_STATE 0

namespace MeeGo
namespace DeviceState
{

class QmSystemStatePrivate : public QObject
class DeviceStatePrivate : public QObject
{
Q_OBJECT
MEEGO_DECLARE_PUBLIC(QmSystemState)
MEEGO_DECLARE_PUBLIC(DeviceState)

public:
QmSystemStatePrivate() {
DeviceStatePrivate() {
connectCount[SIGNAL_SYSTEM_STATE] = 0;
}

~QmSystemStatePrivate() {
~DeviceStatePrivate() {
}

QMutex connectMutex;
size_t connectCount[1];

Q_SIGNALS:

void systemStateChanged(MeeGo::QmSystemState::StateIndication what);
void systemStateChanged(DeviceState::DeviceState::StateIndication what);

private Q_SLOTS:

void emitShutdown() {
emit systemStateChanged(QmSystemState::Shutdown);
emit systemStateChanged(DeviceState::Shutdown);
}

void emitThermalShutdown(QString thermalState) {
// TODO: hardcoded "fatal"
if (thermalState == "fatal") {
emit systemStateChanged(QmSystemState::ThermalStateFatal);
emit systemStateChanged(DeviceState::ThermalStateFatal);
}
}

void emitBatteryShutdown() {
emit systemStateChanged(QmSystemState::BatteryStateEmpty);
emit systemStateChanged(DeviceState::BatteryStateEmpty);
}

void emitSaveData() {
emit systemStateChanged(QmSystemState::SaveData);
emit systemStateChanged(DeviceState::SaveData);
}

void emitShutdownDenied(QString reqType, QString reason) {
// XXX: Move hardcoded strings somewere else
if (reason == "usb") {
if (reqType == "shutdown") {
emit systemStateChanged(QmSystemState::ShutdownDeniedUSB);
emit systemStateChanged(DeviceState::ShutdownDeniedUSB);
} else if (reqType == "reboot") {
emit systemStateChanged(QmSystemState::RebootDeniedUSB);
emit systemStateChanged(DeviceState::RebootDeniedUSB);
}
}
}

void emitStateChangeInd(QString state) {
// TODO: hardcoded "REBOOT"
if (state == "REBOOT") {
emit systemStateChanged(QmSystemState::Reboot);
emit systemStateChanged(DeviceState::Reboot);
}
}
};
}
#endif // QMSYSTEMSTATE_P_H
#endif // DEVICESTATE_P_H

0 comments on commit 6852d39

Please sign in to comment.