Skip to content

Commit

Permalink
Adapt to Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
yixinshark committed Jan 20, 2025
1 parent f043bfd commit 8824ee3
Show file tree
Hide file tree
Showing 12 changed files with 229 additions and 21 deletions.
31 changes: 31 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,35 @@ if test x"$enable_liblightdm_qt5" != "xno"; then
fi
AM_CONDITIONAL(COMPILE_LIBLIGHTDM_QT5, test x"$compile_liblightdm_qt5" != "xno")

AC_ARG_ENABLE(liblightdm-qt6,
AS_HELP_STRING([--enable-liblightdm-qt6],[Enable LightDM client Qt6 libraries [[default=auto]]]),
[enable_liblightdm_qt6=$enableval],
[enable_liblightdm_qt6="auto"])
compile_liblightdm_qt6=no
if test x"$enable_liblightdm_qt6" != "xno"; then
PKG_CHECK_MODULES(LIBLIGHTDM_QT6, [
Qt6Core
Qt6DBus
Qt6Gui
],
[compile_liblightdm_qt6=yes],
[if test "x$enable_liblightdm_qt6" != xauto; then
AC_MSG_FAILURE(
[--enable-liblightdm-qt6 was given, but test for Qt6 failed])
fi
])

QT6_VALIDATE_MOC(MOC6)
if test x$MOC6 = x; then
compile_liblightdm_qt6=no
if test "x$enable_liblightdm_qt6" != xauto; then
AC_MSG_FAILURE(
[--enable-liblightdm-qt6 was given, but MOC not found])
fi
fi
fi
AM_CONDITIONAL(COMPILE_LIBLIGHTDM_QT6, test x"$compile_liblightdm_qt6" != "xno")

AC_ARG_ENABLE([libaudit],
AS_HELP_STRING([--enable-libaudit],
[Enable libaudit logging of login and logout events [[default=auto]]]),
Expand Down Expand Up @@ -212,6 +241,7 @@ liblightdm-gobject/liblightdm-gobject-1.pc
liblightdm-gobject/Makefile
liblightdm-qt/Makefile
liblightdm-qt/liblightdm-qt5-3.pc
liblightdm-qt/liblightdm-qt6-3.pc
po/Makefile.in
src/Makefile
tests/Makefile
Expand All @@ -237,6 +267,7 @@ echo "
GObject introspection: $found_introspection
Vala bindings: $enable_vala
liblightdm-qt5: $compile_liblightdm_qt5
liblightdm-qt6: $compile_liblightdm_qt6
libaudit support: $use_libaudit
Enable tests: $enable_tests
"
18 changes: 9 additions & 9 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Build-Depends: autoconf,
libxdmcp-dev,
libxklavier-dev,
pkg-config,
qtbase5-dev,
qt6-base-dev,
quilt,
valac,
yelp-tools
Expand Down Expand Up @@ -77,16 +77,16 @@ Depends: ${misc:Depends},
Description: Typelib file for liblightdm-1
A GObject based library for LightDM clients to use to interface with LightDM.

Package: liblightdm-qt5-3-0
Package: liblightdm-qt6-3-0
Section: libs
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends},
${shlibs:Depends},
Recommends: lightdm,
Description: LightDM Qt 5 client library
A Qt 5 based library for LightDM clients to use to interface with LightDM.
Description: LightDM Qt 6 client library
A Qt 6 based library for LightDM clients to use to interface with LightDM.

Package: liblightdm-gobject-1-dev
Section: libdevel
Expand All @@ -104,15 +104,15 @@ Description: LightDM GObject client library (development files)
This package contains header files and development information, which
is useful for building LightDM greeters and user switchers.

Package: liblightdm-qt5-3-dev
Package: liblightdm-qt6-3-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
liblightdm-qt5-3-0 (= ${binary:Version}),
qtbase5-dev,
Description: LightDM Qt 5 client library (development files)
A Qt 5 based library for LightDM clients to use to interface with LightDM.
liblightdm-qt6-3-0 (= ${binary:Version}),
qt6-base-dev,
Description: LightDM Qt 6 client library (development files)
A Qt 6 based library for LightDM clients to use to interface with LightDM.
.
This package contains header files and development information, which
is useful for building LightDM greeters and user switchers.
Expand Down
1 change: 1 addition & 0 deletions debian/liblightdm-qt6-3-0.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/liblightdm-qt6-*.so.*
104 changes: 104 additions & 0 deletions debian/liblightdm-qt6-3-0.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
liblightdm-qt6-3.so.0 liblightdm-qt6-3-0 #MINVER#
(c++|regex)"^.*::qt_metacall\(QMetaObject::Call, int, void[*][*]\)@Base$" 0
(c++|regex)"^.*::qt_metacast\(char const[*]\)@Base$" 0
(c++|regex)"^.*::staticMetaObject@Base$" 0
(c++|regex)"^.*::metaObject\(\) const@Base$" 0
(c++|regex)"^typeinfo for .*@Base$" 0
(c++|regex)"^typeinfo name for .*@Base$" 0
(c++|regex)"^vtable for .*@Base$" 0
(c++|optional)"QByteArray::~QByteArray()@Base" 0
(c++|optional)"QString::~QString()@Base" 0
(c++|optional)"QVector<int>::~QVector()@Base" 0
(c++|optional)"QHash<int, QByteArray>::deleteNode2(QHashData::Node*)@Base" 0
(c++|optional)"QHash<int, QByteArray>::duplicateNode(QHashData::Node*, void*)@Base" 0
(c++|optional)"QHash<int, QByteArray>::findNode(int const&, unsigned int) const@Base" 0
(c++|optional)"QHash<int, QByteArray>::~QHash()@Base" 0
(c++|optional)"SessionItem::~SessionItem()@Base" 1.21.3
(c++|optional)"SessionsModelPrivate::loadSessions(QLightDM::SessionsModel::SessionType)@Base" 1.21.3
(c++|optional)"SessionsModelPrivate::SessionsModelPrivate(QLightDM::SessionsModel*)@Base" 1.21.3
(c++|optional)"QList<SessionItem>::detach_helper_grow(int, int)@Base" 1.21.3
(c++|optional)"QList<SessionItem>::append(SessionItem const&)@Base" 1.21.3
(c++|optional)"UserItem::displayName() const@Base" 1.21.3
(c++|optional)"UserItem::~UserItem()@Base" 1.21.3
(c++|optional)"QList<UserItem>::detach_helper(int)@Base" 1.21.3
(c++|optional)"QList<UserItem>::detach_helper_grow(int, int)@Base" 1.21.3
(c++|optional)"QList<UserItem>::append(UserItem const&)@Base" 1.21.3
(c++)"QLightDM::UsersModel::UsersModel(QObject*)@Base" 1.21.3
(c++)"QLightDM::UsersModel::~UsersModel()@Base" 1.21.3
(c++)"QLightDM::SessionsModel::SessionsModel(QLightDM::SessionsModel::SessionType, QObject*)@Base" 1.21.3
(c++)"QLightDM::SessionsModel::SessionsModel(QObject*)@Base" 1.21.3
(c++)"QLightDM::SessionsModel::SessionsModel(QLightDM::SessionsModel::SessionType, QObject*)@Base" 1.21.3
(c++)"QLightDM::SessionsModel::SessionsModel(QObject*)@Base" 1.21.3
(c++)"QLightDM::SessionsModel::~SessionsModel()@Base" 1.21.3
(c++)"QLightDM::GreeterPrivate::cb_showPrompt(_LightDMGreeter*, char const*, LightDMPromptType, void*)@Base" 1.21.3
(c++)"QLightDM::GreeterPrivate::cb_showMessage(_LightDMGreeter*, char const*, LightDMMessageType, void*)@Base" 1.21.3
(c++)"QLightDM::GreeterPrivate::cb_autoLoginExpired(_LightDMGreeter*, void*)@Base" 1.21.3
(c++)"QLightDM::GreeterPrivate::cb_authenticationComplete(_LightDMGreeter*, void*)@Base" 1.21.3
(c++)"QLightDM::GreeterPrivate::cb_idle(_LightDMGreeter*, void*)@Base" 1.21.3
(c++)"QLightDM::GreeterPrivate::cb_reset(_LightDMGreeter*, void*)@Base" 1.21.3
(c++)"QLightDM::GreeterPrivate::GreeterPrivate(QLightDM::Greeter*)@Base" 1.21.3
(c++)"QLightDM::PowerInterface::canRestart()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::canSuspend()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::canShutdown()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::canHibernate()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::PowerInterfacePrivate::PowerInterfacePrivate()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::restart()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::suspend()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::shutdown()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::hibernate()@Base" 1.21.3
(c++)"QLightDM::PowerInterface::PowerInterface(QObject*)@Base" 1.21.3
(c++)"QLightDM::PowerInterface::~PowerInterface()@Base" 1.21.3
(c++)"QLightDM::UsersModelPrivate::cb_userAdded(_LightDMUserList*, _LightDMUser*, void*)@Base" 1.21.3
(c++)"QLightDM::UsersModelPrivate::cb_userChanged(_LightDMUserList*, _LightDMUser*, void*)@Base" 1.21.3
(c++)"QLightDM::UsersModelPrivate::cb_userRemoved(_LightDMUserList*, _LightDMUser*, void*)@Base" 1.21.3
(c++)"QLightDM::UsersModelPrivate::loadUsers()@Base" 1.21.3
(c++)"QLightDM::UsersModelPrivate::UsersModelPrivate(QLightDM::UsersModel*)@Base" 1.21.3
(c++)"QLightDM::UsersModelPrivate::~UsersModelPrivate()@Base" 1.21.3
(c++)"QLightDM::Greeter::showPrompt(QString, QLightDM::Greeter::PromptType)@Base" 1.21.3
(c++)"QLightDM::Greeter::connectSync()@Base" 1.21.3
(c++)"QLightDM::Greeter::setLanguage(QString const&)@Base" 1.21.3
(c++)"QLightDM::Greeter::showMessage(QString, QLightDM::Greeter::MessageType)@Base" 1.21.3
(c++)"QLightDM::Greeter::authenticate(QString const&)@Base" 1.21.3
(c++)"QLightDM::Greeter::setResettable(bool)@Base" 1.21.3
(c++)"QLightDM::Greeter::cancelAutologin()@Base" 1.21.3
(c++)"QLightDM::Greeter::startSessionSync(QString const&)@Base" 1.21.3
(c++)"QLightDM::Greeter::authenticateRemote(QString const&, QString const&)@Base" 1.21.3
(c++)"QLightDM::Greeter::authenticateAsGuest()@Base" 1.21.3
(c++)"QLightDM::Greeter::connectToDaemonSync()@Base" 1.21.3
(c++)"QLightDM::Greeter::cancelAuthentication()@Base" 1.21.3
(c++)"QLightDM::Greeter::authenticateAutologin()@Base" 1.21.3
(c++)"QLightDM::Greeter::autologinTimerExpired()@Base" 1.21.3
(c++)"QLightDM::Greeter::authenticationComplete()@Base" 1.21.3
(c++)"QLightDM::Greeter::ensureSharedDataDirSync(QString const&)@Base" 1.21.3
(c++)"QLightDM::Greeter::idle()@Base" 1.21.3
(c++)"QLightDM::Greeter::reset()@Base" 1.21.3
(c++)"QLightDM::Greeter::respond(QString const&)@Base" 1.21.3
(c++)"QLightDM::Greeter::Greeter(QObject*)@Base" 1.21.3
(c++)"QLightDM::Greeter::~Greeter()@Base" 1.21.3
(c++)"QLightDM::UsersModel::data(QModelIndex const&, int) const@Base" 1.21.3
(c++)"QLightDM::UsersModel::rowCount(QModelIndex const&) const@Base" 1.21.3
(c++)"QLightDM::SessionsModel::data(QModelIndex const&, int) const@Base" 1.21.3
(c++)"QLightDM::SessionsModel::rowCount(QModelIndex const&) const@Base" 1.21.3
(c++)"QLightDM::Greeter::osVersionId() const@Base" 1.21.3
(c++)"QLightDM::Greeter::osPrettyName() const@Base" 1.21.3
(c++)"QLightDM::Greeter::hideUsersHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::selectUserHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::isAuthenticated() const@Base" 1.21.3
(c++)"QLightDM::Greeter::selectGuestHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::inAuthentication() const@Base" 1.21.3
(c++)"QLightDM::Greeter::autologinSessionHint() const@Base" 1.25.0
(c++)"QLightDM::Greeter::autologinUserHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::authenticationUser() const@Base" 1.21.3
(c++)"QLightDM::Greeter::autologinGuestHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::defaultSessionHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::hasGuestAccountHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::showManualLoginHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::showRemoteLoginHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::autologinTimeoutHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::motd() const@Base" 1.21.3
(c++)"QLightDM::Greeter::osId() const@Base" 1.21.3
(c++)"QLightDM::Greeter::osName() const@Base" 1.21.3
(c++)"QLightDM::Greeter::getHint(QString const&) const@Base" 1.21.3
(c++)"QLightDM::Greeter::hostname() const@Base" 1.21.3
(c++)"QLightDM::Greeter::lockHint() const@Base" 1.21.3
(c++)"QLightDM::Greeter::osVersion() const@Base" 1.21.3
3 changes: 3 additions & 0 deletions debian/liblightdm-qt6-3-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
usr/include/lightdm-qt6-*
usr/lib/*/pkgconfig/liblightdm-qt6-*.pc
usr/lib/*/liblightdm-qt6-*.so
25 changes: 25 additions & 0 deletions liblightdm-qt/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ common_libadd = \
liblightdm_qt5_3_la_LIBADD = \
$(LIBLIGHTDM_QT5_LIBS) \
$(common_libadd)
liblightdm_qt6_3_la_LIBADD = \
$(LIBLIGHTDM_QT6_LIBS) \
$(common_libadd)

common_cflags = \
$(WARN_CXXFLAGS) \
Expand All @@ -15,6 +18,11 @@ liblightdm_qt5_3_la_CXXFLAGS = \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(4, 0, 0)" \
$(LIBLIGHTDM_QT5_CFLAGS) \
$(common_cflags)
liblightdm_qt6_3_la_CXXFLAGS = \
-fPIC \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(5, 0, 0)" \
$(LIBLIGHTDM_QT6_CFLAGS) \
$(common_cflags)

common_headers = \
QLightDM/Greeter \
Expand All @@ -27,6 +35,7 @@ common_headers = \
QLightDM/usersmodel.h

liblightdm_qt5_3includedir=$(includedir)/lightdm-qt5-3/QLightDM
liblightdm_qt6_3includedir=$(includedir)/lightdm-qt6-3/QLightDM

common_sources = \
greeter.cpp \
Expand All @@ -36,6 +45,9 @@ common_sources = \
liblightdm_qt5_3_la_SOURCES = \
$(common_sources) \
$(liblightdm_qt5_3include_HEADERS)
liblightdm_qt6_3_la_SOURCES = \
$(common_sources) \
$(liblightdm_qt6_3include_HEADERS)

pkgconfigdir = $(libdir)/pkgconfig

Expand All @@ -56,9 +68,22 @@ BUILT_SOURCES += $(common_sources:.cpp=_moc5.cpp)
pkgconfig_DATA += liblightdm-qt5-3.pc
endif

if COMPILE_LIBLIGHTDM_QT6
lib_LTLIBRARIES += liblightdm-qt6-3.la
liblightdm_qt6_3include_HEADERS = $(common_headers)
BUILT_SOURCES += $(common_sources:.cpp=_moc6.cpp)
pkgconfig_DATA += liblightdm-qt6-3.pc
endif

# Support pretty printing MOC
AM_V_MOC5 = $(am__v_MOC5_$(V))
am__v_MOC5_ = $(am__v_MOC5_$(AM_DEFAULT_VERBOSITY))
am__v_MOC5_0 = @echo " MOC5 " $@;
%_moc5.cpp: QLightDM/%.h
$(AM_V_MOC5) $(MOC5) $< -o $@

AM_V_MOC6 = $(am__v_MOC6_$(V))
am__v_MOC6_ = $(am__v_MOC6_$(AM_DEFAULT_VERBOSITY))
am__v_MOC6_0 = @echo " MOC6 " $@;
%_moc6.cpp: QLightDM/%.h
$(AM_V_MOC6) $(MOC6) $< -o $@
6 changes: 3 additions & 3 deletions liblightdm-qt/greeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ QString Greeter::motd() const
return QString::fromUtf8(lightdm_get_motd());
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "greeter_moc5.cpp"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "greeter_moc6.cpp"
#else
#include "greeter_moc4.cpp"
#include "greeter_moc5.cpp"
#endif
11 changes: 11 additions & 0 deletions liblightdm-qt/liblightdm-qt6-3.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: liblightdm-qt6
Description: LightDM Qt6 client library
Version: @VERSION@
Requires: Qt6Core Qt6Gui
Libs: -L${libdir} -llightdm-qt6-3
Cflags: -I${includedir}/lightdm-qt6-3
6 changes: 3 additions & 3 deletions liblightdm-qt/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ bool PowerInterface::restart()
return lightdm_restart (NULL);
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "power_moc5.cpp"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "power_moc6.cpp"
#else
#include "power_moc4.cpp"
#include "power_moc5.cpp"
#endif
6 changes: 3 additions & 3 deletions liblightdm-qt/sessionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ QVariant SessionsModel::data(const QModelIndex &index, int role) const
return QVariant();
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "sessionsmodel_moc5.cpp"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "sessionsmodel_moc6.cpp"
#else
#include "sessionsmodel_moc4.cpp"
#include "sessionsmodel_moc5.cpp"
#endif
6 changes: 3 additions & 3 deletions liblightdm-qt/usersmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ QVariant UsersModel::data(const QModelIndex &index, int role) const
}


#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "usersmodel_moc5.cpp"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "usersmodel_moc6.cpp"
#else
#include "usersmodel_moc4.cpp"
#include "usersmodel_moc5.cpp"
#endif
33 changes: 33 additions & 0 deletions m4/qt-validate-moc.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
dnl Qt6
AC_DEFUN([QT6_IF_QT6_MOC],
AS_IF([$1 -v >/dev/null 2>/dev/null &&
(test "`$1 -v 2<&1 | grep -o 'Qt [[[0-9]]]\+'`" = "Qt 6" ||
test "`$1 -v 2<&1 | grep -o 'moc [[[0-9]]]\+'`" = "moc 6" ||
test "`$1 -v 2<&1 | grep -o 'moc-qt[[[0-9]]]\+'`" = "moc-qt6")],
[$2]))

dnl Set MOCCMD to $1 if it is the Qt 6 "moc".
AC_DEFUN([QT6_TRY_MOC],
[QT6_IF_QT6_MOC([$1], [MOCCMD="$1"])])

dnl If a usable moc command is found set $1
AC_DEFUN([QT6_VALIDATE_MOC], [
AC_MSG_CHECKING([the Qt 6 moc command])
dnl Try to find a Qt 6 'moc'
AS_IF([test "x$MOCCMD" = "x"],
[for mocpath in "moc" "qtchooser -run-tool=moc -qt=6" "moc-qt6" \
"/usr/lib/qt6/moc" "/usr/lib/qt6/libexec/moc" \
"/usr/lib64/qt6/moc" "/usr/lib64/qt6/libexec/moc" \
"$prefix/lib/qt6/moc" "$prefix/lib/qt6/libexec/moc" \
"$libexecdir/moc" "$libexecdir/qt6/moc" \
"$libdir/qt6/moc" "$libdir/qt6/libexec/moc"
do
if test "x$MOCCMD" = "x" ; then
QT6_TRY_MOC([$mocpath])
fi
done
AS_IF([test "x$MOCCMD" = "x"],
[AC_MSG_RESULT([not found]); AC_SUBST($1,"")],
[AC_MSG_RESULT([$MOCCMD]); AC_SUBST($1,"$MOCCMD")])
MOCCMD=""],
[AC_MSG_ERROR(["MOCCMD should not be set"])])])

0 comments on commit 8824ee3

Please sign in to comment.