Commit 8c9f9f94 authored by Wescoeur's avatar Wescoeur

feat(App): coding style on Single App and move component

parent 71e7e8cb
......@@ -77,9 +77,9 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_
# ------------------------------------------------------------------------------
set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network)
if(ENABLE_DBUS)
list(APPEND QT5_PACKAGES DBus)
endif()
if (ENABLE_DBUS)
list(APPEND QT5_PACKAGES DBus)
endif ()
set(QT5_PACKAGES_OPTIONAL TextToSpeech)
if (LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
......@@ -194,7 +194,6 @@ set(HEADERS
src/components/telephone-numbers/TelephoneNumbersModel.hpp
src/components/timeline/TimelineModel.hpp
src/components/url-handlers/UrlHandlers.hpp
src/externals/single-application/SingleApplication.hpp
src/utils/LinphoneUtils.hpp
src/utils/Utils.hpp
)
......@@ -203,8 +202,8 @@ if(ENABLE_DBUS)
list(APPEND SOURCES src/app/single-application/SingleApplicationDBus.cpp)
list(APPEND HEADERS src/app/single-application/SingleApplicationDBusPrivate.hpp)
else()
list(APPEND SOURCES src/externals/single-application/SingleApplication.cpp)
list(APPEND HEADERS src/externals/single-application/SingleApplicationPrivate.hpp)
list(APPEND SOURCES src/app/single-application/SingleApplication.cpp)
list(APPEND HEADERS src/app/single-application/SingleApplicationPrivate.hpp)
endif()
set(QRC_RESOURCES resources.qrc)
......
......@@ -28,7 +28,7 @@
#include "../components/notifier/Notifier.hpp"
#include "../components/other/colors/Colors.hpp"
#include "../externals/single-application/SingleApplication.hpp"
#include "single-application/SingleApplication.hpp"
#define APP_CODE_RESTART 1000
......
......@@ -22,8 +22,8 @@
// See: https://github.com/itay-grudev/SingleApplication/
#ifndef SINGLE_APPLICATION_H
#define SINGLE_APPLICATION_H
#ifndef SINGLE_APPLICATION_H_
#define SINGLE_APPLICATION_H_
#include <QApplication>
#include <QtCore/QtGlobal>
......@@ -123,4 +123,4 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(SingleApplication::Options)
#endif // SINGLE_APPLICATION_H
#endif // SINGLE_APPLICATION_H_
......@@ -26,9 +26,7 @@
#include <QtCore/QByteArray>
#include <QtDBus/QtDBus>
#include "../../utils/Utils.hpp"
#include "../../externals/single-application/SingleApplication.hpp"
#include "SingleApplication.hpp"
#include "SingleApplicationDBusPrivate.hpp"
// =============================================================================
......@@ -36,24 +34,18 @@
const char *SERVICE_NAME = "org.linphone.SingleApplication";
SingleApplicationPrivate::SingleApplicationPrivate (SingleApplication *q_ptr)
: QDBusAbstractAdaptor(q_ptr), q_ptr(q_ptr) {
}
SingleApplicationPrivate::~SingleApplicationPrivate () {
}
: QDBusAbstractAdaptor(q_ptr), q_ptr(q_ptr) {}
QDBusConnection SingleApplicationPrivate::getBus () const {
if (options & SingleApplication::Mode::User) {
if (options & SingleApplication::Mode::User)
return QDBusConnection::sessionBus();
} else {
return QDBusConnection::systemBus();
}
return QDBusConnection::systemBus();
}
void SingleApplicationPrivate::startPrimary () {
if (getBus().registerObject("/", this, QDBusConnection::ExportAllSlots) == false) {
qWarning() << "Failed to register single application object on DBus";
}
if (!getBus().registerObject("/", this, QDBusConnection::ExportAllSlots))
qWarning() << QStringLiteral("Failed to register single application object on DBus.");
instanceNumber = 0;
}
......@@ -69,7 +61,7 @@ SingleApplication::SingleApplication (int &argc, char *argv[], bool allowSeconda
d->options = options;
if (!d->getBus().isConnected()) {
qWarning() << "Cannot connect to the D-Bus session bus.";
qWarning() << QStringLiteral("Cannot connect to the D-Bus session bus.");
delete d;
::exit(EXIT_FAILURE);
}
......
......@@ -20,13 +20,13 @@
* Author: Ghislain MARY
*/
#ifndef SINGLE_APPLICATION_DBUS_PRIVATE_H
#define SINGLE_APPLICATION_DBUS_PRIVATE_H
#include "../../externals/single-application/SingleApplication.hpp"
#ifndef SINGLE_APPLICATION_DBUS_PRIVATE_H_
#define SINGLE_APPLICATION_DBUS_PRIVATE_H_
#include <QtDBus/QtDBus>
#include "SingleApplication.hpp"
// =============================================================================
struct InstancesInfo {
......@@ -40,7 +40,7 @@ class SingleApplicationPrivate : public QDBusAbstractAdaptor {
public:
Q_DECLARE_PUBLIC(SingleApplication) SingleApplicationPrivate (SingleApplication *q_ptr);
~SingleApplicationPrivate ();
~SingleApplicationPrivate () = default;
QDBusConnection getBus () const;
......@@ -52,7 +52,7 @@ public:
quint32 instanceNumber;
public Q_SLOTS:
void messageReceived(quint32 instanceId, QByteArray message);
void messageReceived (quint32 instanceId, QByteArray message);
};
#endif // SINGLE_APPLICATION_DBUS_PRIVATE_H
#endif // SINGLE_APPLICATION_DBUS_PRIVATE_H_
......@@ -29,8 +29,8 @@
// version without notice, or may even be removed.
//
#ifndef SINGLE_APPLICATION_PRIVATE_H
#define SINGLE_APPLICATION_PRIVATE_H
#ifndef SINGLE_APPLICATION_PRIVATE_H_
#define SINGLE_APPLICATION_PRIVATE_H_
#include <QtCore/QMutex>
#include <QtCore/QSharedMemory>
......@@ -79,4 +79,4 @@ public Q_SLOTS:
void slotClientConnectionClosed(QLocalSocket *, quint32);
};
#endif // SINGLE_APPLICATION_PRIVATE_H
#endif // SINGLE_APPLICATION_PRIVATE_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment