Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: port to qt6 #46

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
cmake_minimum_required(VERSION 3.16)
set(KF5_MIN_VERSION "5.54")

project(xdg-desktop-portal-dde
VERSION 1.0.0
VERSION 1.0.0
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX /usr)
set(CMAKE_INSTALL_PREFIX /usr)
endif ()

include(GNUInstallDirs)

add_subdirectory(src)

configure_file(
misc/xdg-desktop-portal-dde.service.in
xdg-desktop-portal-dde.service
@ONLY)
misc/xdg-desktop-portal-dde.service.in
xdg-desktop-portal-dde.service
@ONLY)

configure_file(
misc/org.freedesktop.impl.portal.desktop.dde.service.in
org.freedesktop.impl.portal.desktop.dde.service
@ONLY)
misc/org.freedesktop.impl.portal.desktop.dde.service.in
org.freedesktop.impl.portal.desktop.dde.service
@ONLY)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xdg-desktop-portal-dde.service DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/user/")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.impl.portal.desktop.dde.service DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services")
Expand Down
4 changes: 2 additions & 2 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pkgdesc='xdg-desktop-portal backend for deepin'
arch=('x86_64' 'aarch64')
url='https://github.com/linuxdeepin/xdg-desktop-portal-dde'
license=('LGPL3')
depends=('qt5-base' 'qt5-wayland' 'wayland' 'ki18n5' 'dwayland-git' 'knotifications5')
makedepends=('git' 'ninja' 'cmake' 'qt5-tools' 'wayland-protocols' 'extra-cmake-modules')
depends=('qt6-base' 'qt6-wayland' 'wayland')
makedepends=('git' 'ninja' 'cmake' 'qt6-tools' 'wayland-protocols')
provides=('xdg-desktop-portal-impl')
groups=('deepin-git')
source=("${sourcetars[@]}")
Expand Down
18 changes: 4 additions & 14 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,12 @@ Build-Depends:
cmake (>= 3.0~),
dbus-x11,
debhelper (>= 11~),
extra-cmake-modules (>= 5.50.0~),
qtwayland5-dev-tools,
libkf5coreaddons-dev (>= 5.50.0~),
libkf5i18n-dev (>= 5.50.0~),
libkf5notifications-dev (>= 5.50.0~),
libkf5widgetsaddons-dev (>= 5.50.0~),
libkf5windowsystem-dev (>= 5.50.0~),
pkg-kde-tools (>= 0.15.18~),
qtbase5-dev (>= 5.11.0~),
qtbase5-private-dev,
qt6-base-dev,
qt6-wayland,
qt6-wayland-dev,
qt6-wayland-dev-tools,
libpipewire-0.3-dev,
libgbm-dev,
libepoxy-dev,
libkf5declarative-dev,
libwayland-dev,
libdwayland-dev
Standards-Version: 4.5.0

Package: xdg-desktop-portal-dde
Expand Down
155 changes: 57 additions & 98 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core)
find_package(
Qt${QT_VERSION_MAJOR} CONFIG REQUIRED COMPONENTS
Core
Concurrent
DBus
Widgets)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)

set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

find_package(QtWaylandScanner REQUIRED)

find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
I18n
Notifications
)

find_package(DWayland REQUIRED)
find_package(KF5I18n CONFIG REQUIRED)
find_package(Wayland 1.15 REQUIRED COMPONENTS Client)
find_package(PkgConfig)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
Qt6 CONFIG REQUIRED COMPONENTS
Core
Concurrent
DBus
Widgets
WaylandClient)
find_package(Qt6WaylandScannerTools REQUIRED)

set_source_files_properties(
${CMAKE_SOURCE_DIR}/misc/org.freedesktop.Notifications.xml
Expand All @@ -31,90 +15,65 @@ set_source_files_properties(
NO_NAMESPACE
OFF
)
qt5_add_dbus_interface(NotificationInterface

qt6_add_dbus_interface(NotificationInterface
${CMAKE_SOURCE_DIR}/misc/org.freedesktop.Notifications.xml
notification_interface
)

set(SRC
${NotificationInterface}
xdg-desktop-portal-dde.cpp
ddesktopportal.h
ddesktopportal.cpp
screenshot.h
screenshot.cpp
background.h
background.cpp
filechooser.h
filechooser.cpp
wallpaper.h
wallpaper.cpp
notification.h
notification.cpp
settings.h
settings.cpp
inhibit.h
inhibit.cpp
appchooser.h
appchooser.cpp
appchooserdialog.h
appchooserdialog.cpp
appchooserdelegate.h
appchooserdelegate.cpp
appchoosermodel.h
appchoosermodel.cpp
iteminfo.h
iteminfo.cpp
account.h
account.cpp
session.h
session.cpp
globalshortcut.h
globalshortcut.cpp
lockdown.h
lockdown.cpp
secret.h
secret.cpp
request.h
request.cpp
dbushelpers.h
utils.h
utils.cpp
screencast.cpp
screencasting.cpp
screencastwidget.cpp
screenchooserdialog.cpp
remotedesktop.cpp
remotedesktopdialog.cpp
waylandintegration.cpp
)

QT5_WRAP_UI(SRC
screenchooserdialog.ui
remotedesktopdialog.ui)

ecm_add_qtwayland_client_protocol(SRC
PROTOCOL ${CMAKE_SOURCE_DIR}/misc/zkde-screencast-unstable-v1.xml
BASENAME zkde-screencast-unstable-v1
)

ecm_add_qtwayland_client_protocol(SRC
PROTOCOL ${Wayland_DATADIR}/wayland.xml
BASENAME wayland
${NotificationInterface}
xdg-desktop-portal-dde.cpp
ddesktopportal.h
ddesktopportal.cpp
screenshot.h
screenshot.cpp
background.h
background.cpp
filechooser.h
filechooser.cpp
wallpaper.h
wallpaper.cpp
notification.h
notification.cpp
settings.h
settings.cpp
inhibit.h
inhibit.cpp
appchooser.h
appchooser.cpp
appchooserdialog.h
appchooserdialog.cpp
appchooserdelegate.h
appchooserdelegate.cpp
appchoosermodel.h
appchoosermodel.cpp
iteminfo.h
iteminfo.cpp
account.h
account.cpp
globalshortcut.h
globalshortcut.cpp
lockdown.h
lockdown.cpp
secret.h
secret.cpp
request.h
request.cpp
dbushelpers.h
utils.h
utils.cpp
)

add_executable(${PROJECT_NAME}
${SRC})
${SRC})

target_link_libraries(${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::DBus
Qt${QT_VERSION_MAJOR}::Concurrent
KF5::I18n
DWaylandClient
KF5::Notifications
Wayland::Client)
Qt::Core
Qt::Widgets
Qt::Gui
Qt::DBus
Qt::Concurrent
Qt::WaylandClient)

install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
8 changes: 0 additions & 8 deletions src/ddesktopportal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@
#include "secret.h"
#include "lockdown.h"
#include "globalshortcut.h"
#include "session.h"
#include "remotedesktop.h"
#include "account.h"
#include "inhibit.h"
#include "settings.h"
#include "screenshot.h"
#include "screencast.h"
#include "background.h"
#include "filechooser.h"
#include "wallpaper.h"
#include "notification.h"
#include "waylandintegration.h"

DDesktopPortal::DDesktopPortal(QObject *parent)
: QObject(parent)
Expand All @@ -31,16 +27,12 @@ DDesktopPortal::DDesktopPortal(QObject *parent)
const QByteArray &xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toUpper();
if (xdgCurrentDesktop == "DDE" || xdgCurrentDesktop == "DEEPIN") {
m_screenshot = new ScreenshotPortal(this);
m_screencast = new ScreenCastPortal(this);
m_background = new BackgroundPortal(this);
m_settings = new SettingsPortal(this);
m_inhibit = new InhibitPortal(this);
m_account = new AccountPortal(this);
m_session = new SessionPortal(this);
m_remote = new RemoteDesktopPortal(this);
m_shortcut = new GlobalShortcutPortal(this);
m_lockdown = new LockdownPortal(this);
m_secret = new SecretPortal(this);
WaylandIntegration::init();
}
}
6 changes: 0 additions & 6 deletions src/ddesktopportal.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
#include <QObject>

class ScreenshotPortal;
class ScreenCastPortal;
class BackgroundPortal;
class InhibitPortal;
class SettingsPortal;
class AccountPortal;
class SessionPortal;
class RemoteDesktopPortal;
class GlobalShortcutPortal;
class LockdownPortal;
class SecretPortal;
Expand All @@ -35,13 +32,10 @@ class DDesktopPortal : public QObject, public QDBusContext
AppChooserPortal *const m_appChooser;
FileChooserPortal *const m_fileChooser;
ScreenshotPortal *m_screenshot = nullptr;
ScreenCastPortal *m_screencast = nullptr;
BackgroundPortal *m_background = nullptr;
InhibitPortal *m_inhibit = nullptr;
SettingsPortal *m_settings = nullptr;
AccountPortal *m_account = nullptr;
SessionPortal *m_session = nullptr;
RemoteDesktopPortal *m_remote = nullptr;
GlobalShortcutPortal *m_shortcut = nullptr;
LockdownPortal *m_lockdown = nullptr;
SecretPortal *m_secret = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/notification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void NotificationPortal::AddNotification(const QString &app_id, const QString &i
}

QStringList actions;
for (const QVariantMap &button : qAsConst(buttons)) {
for (const QVariantMap &button : std::as_const(buttons)) {
actions << button.value(QStringLiteral("label")).toString();
}

Expand Down
Loading
Loading