Disable DBus as dependency for Android
This commit is contained in:
parent
fb1516281e
commit
0846dd9d9b
@ -30,7 +30,7 @@ find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test
|
|||||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons Syndication Config I18n)
|
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons Syndication Config I18n)
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Svg DBus)
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Svg)
|
||||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2)
|
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
else()
|
else()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCS_alligator
|
set(SRCS_base
|
||||||
main.cpp
|
main.cpp
|
||||||
feedsmodel.cpp
|
feedsmodel.cpp
|
||||||
entriesmodel.cpp
|
entriesmodel.cpp
|
||||||
@ -19,21 +19,27 @@ set(SRCS_alligator
|
|||||||
errorlogmodel.cpp
|
errorlogmodel.cpp
|
||||||
error.h
|
error.h
|
||||||
mpris2/mpris2.cpp
|
mpris2/mpris2.cpp
|
||||||
mpris2/mediaplayer2.cpp
|
|
||||||
mpris2/mediaplayer2player.cpp
|
|
||||||
resources.qrc
|
resources.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(ANDROID)
|
||||||
|
set (SRCS ${SRCS_base})
|
||||||
|
else()
|
||||||
|
set (SRCS ${SRCS_base}
|
||||||
|
mpris2/mediaplayer2.cpp
|
||||||
|
mpris2/mediaplayer2player.cpp
|
||||||
|
)
|
||||||
|
|
||||||
qt5_add_dbus_interface(SRCS_alligator dbus-interfaces/org.freedesktop.PowerManagement.Inhibit.xml inhibitinterface)
|
qt5_add_dbus_interface(SRCS dbus-interfaces/org.freedesktop.PowerManagement.Inhibit.xml inhibitinterface)
|
||||||
qt5_add_dbus_interface(SRCS_alligator dbus-interfaces/org.gnome.SessionManager.xml gnomesessioninterface)
|
qt5_add_dbus_interface(SRCS dbus-interfaces/org.gnome.SessionManager.xml gnomesessioninterface)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(alligator ${SRCS_alligator})
|
add_executable(alligator ${SRCS})
|
||||||
|
|
||||||
kconfig_add_kcfg_files(alligator settingsmanager.kcfgc GENERATE_MOC)
|
kconfig_add_kcfg_files(alligator settingsmanager.kcfgc GENERATE_MOC)
|
||||||
|
|
||||||
target_include_directories(alligator PRIVATE ${CMAKE_BINARY_DIR})
|
target_include_directories(alligator PRIVATE ${CMAKE_BINARY_DIR})
|
||||||
target_link_libraries(alligator PRIVATE Qt5::Core Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::Sql Qt5::Multimedia Qt5::DBus KF5::Syndication KF5::CoreAddons KF5::ConfigGui KF5::I18n)
|
target_link_libraries(alligator PRIVATE Qt5::Core Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::Sql Qt5::Multimedia KF5::Syndication KF5::CoreAddons KF5::ConfigGui KF5::I18n)
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
target_link_libraries(alligator PRIVATE
|
target_link_libraries(alligator PRIVATE
|
||||||
@ -72,7 +78,7 @@ if(ANDROID)
|
|||||||
overflow-menu
|
overflow-menu
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(alligator PRIVATE Qt5::Widgets)
|
target_link_libraries(alligator PRIVATE Qt5::Widgets Qt5::DBus)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS alligator ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS alligator ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
|
@ -8,10 +8,14 @@
|
|||||||
|
|
||||||
#include "mpris2.h"
|
#include "mpris2.h"
|
||||||
#include "audiomanager.h"
|
#include "audiomanager.h"
|
||||||
|
#if !defined Q_OS_ANDROID
|
||||||
#include "mediaplayer2.h"
|
#include "mediaplayer2.h"
|
||||||
#include "mediaplayer2player.h"
|
#include "mediaplayer2player.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined Q_OS_ANDROID
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined Q_OS_WIN
|
#if defined Q_OS_WIN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@ -26,6 +30,7 @@ Mpris2::Mpris2(QObject *parent)
|
|||||||
|
|
||||||
void Mpris2::initDBusService()
|
void Mpris2::initDBusService()
|
||||||
{
|
{
|
||||||
|
#if !defined Q_OS_ANDROID
|
||||||
QString mspris2Name(QStringLiteral("org.mpris.MediaPlayer2.") + m_playerName);
|
QString mspris2Name(QStringLiteral("org.mpris.MediaPlayer2.") + m_playerName);
|
||||||
|
|
||||||
bool success = QDBusConnection::sessionBus().registerService(mspris2Name);
|
bool success = QDBusConnection::sessionBus().registerService(mspris2Name);
|
||||||
@ -49,6 +54,7 @@ void Mpris2::initDBusService()
|
|||||||
|
|
||||||
connect(m_mp2.get(), &MediaPlayer2::raisePlayer, this, &Mpris2::raisePlayer);
|
connect(m_mp2.get(), &MediaPlayer2::raisePlayer, this, &Mpris2::raisePlayer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Mpris2::~Mpris2() = default;
|
Mpris2::~Mpris2() = default;
|
||||||
@ -76,11 +82,13 @@ void Mpris2::setPlayerName(const QString &playerName)
|
|||||||
|
|
||||||
m_playerName = playerName;
|
m_playerName = playerName;
|
||||||
|
|
||||||
|
#if !defined Q_OS_ANDROID
|
||||||
if (m_audioPlayer && !m_playerName.isEmpty()) {
|
if (m_audioPlayer && !m_playerName.isEmpty()) {
|
||||||
if (!m_mp2) {
|
if (!m_mp2) {
|
||||||
initDBusService();
|
initDBusService();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
emit playerNameChanged();
|
emit playerNameChanged();
|
||||||
}
|
}
|
||||||
@ -92,18 +100,22 @@ void Mpris2::setAudioPlayer(AudioManager *audioPlayer)
|
|||||||
|
|
||||||
m_audioPlayer = audioPlayer;
|
m_audioPlayer = audioPlayer;
|
||||||
|
|
||||||
|
#if !defined Q_OS_ANDROID
|
||||||
if (m_audioPlayer && !m_playerName.isEmpty()) {
|
if (m_audioPlayer && !m_playerName.isEmpty()) {
|
||||||
if (!m_mp2) {
|
if (!m_mp2) {
|
||||||
initDBusService();
|
initDBusService();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
emit audioPlayerChanged();
|
emit audioPlayerChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::setShowProgressOnTaskBar(bool value)
|
void Mpris2::setShowProgressOnTaskBar(bool value)
|
||||||
{
|
{
|
||||||
|
#if !defined Q_OS_ANDROID
|
||||||
m_mp2p->setShowProgressOnTaskBar(value);
|
m_mp2p->setShowProgressOnTaskBar(value);
|
||||||
|
#endif
|
||||||
mShowProgressOnTaskBar = value;
|
mShowProgressOnTaskBar = value;
|
||||||
Q_EMIT showProgressOnTaskBarChanged();
|
Q_EMIT showProgressOnTaskBarChanged();
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#if !defined Q_OS_ANDROID
|
||||||
class MediaPlayer2Player;
|
class MediaPlayer2Player;
|
||||||
class MediaPlayer2;
|
class MediaPlayer2;
|
||||||
|
#endif
|
||||||
class AudioManager;
|
class AudioManager;
|
||||||
|
|
||||||
class Mpris2 : public QObject
|
class Mpris2 : public QObject
|
||||||
@ -54,8 +56,11 @@ Q_SIGNALS:
|
|||||||
private:
|
private:
|
||||||
void initDBusService();
|
void initDBusService();
|
||||||
|
|
||||||
|
#if !defined Q_OS_ANDROID
|
||||||
std::unique_ptr<MediaPlayer2> m_mp2;
|
std::unique_ptr<MediaPlayer2> m_mp2;
|
||||||
std::unique_ptr<MediaPlayer2Player> m_mp2p;
|
std::unique_ptr<MediaPlayer2Player> m_mp2p;
|
||||||
|
#endif
|
||||||
|
|
||||||
QString m_playerName;
|
QString m_playerName;
|
||||||
AudioManager *m_audioPlayer = nullptr;
|
AudioManager *m_audioPlayer = nullptr;
|
||||||
bool mShowProgressOnTaskBar = true;
|
bool mShowProgressOnTaskBar = true;
|
||||||
|
@ -24,8 +24,10 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#if !defined Q_OS_ANDROID && !defined Q_OS_WIN
|
||||||
#include "gnomesessioninterface.h"
|
#include "gnomesessioninterface.h"
|
||||||
#include "inhibitinterface.h"
|
#include "inhibitinterface.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class PowerManagementInterfacePrivate
|
class PowerManagementInterfacePrivate
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user