diff options
-rw-r--r-- | libre/quassel/0001-qtui-Set-desktop-file-name.patch | 14 | ||||
-rw-r--r-- | libre/quassel/0002-common-Disable-enum-type-stream-operators-for-Qt-5.1.patch | 35 | ||||
-rw-r--r-- | libre/quassel/0003-Removed-mozilla-IRC-network-from-networks.ini.patch | 24 | ||||
-rw-r--r-- | libre/quassel/0004-This-commit-changes-the-official-Quassel-IRC-channel.patch | 99 | ||||
-rw-r--r-- | libre/quassel/9000-search-duck.patch (renamed from libre/quassel/search-duck.patch) | 0 | ||||
-rw-r--r-- | libre/quassel/PKGBUILD | 114 | ||||
-rw-r--r-- | libre/quassel/quassel-0.13.1-qt5.14.patch | 118 |
7 files changed, 247 insertions, 157 deletions
diff --git a/libre/quassel/0001-qtui-Set-desktop-file-name.patch b/libre/quassel/0001-qtui-Set-desktop-file-name.patch index e82bb8d82..10f017e9e 100644 --- a/libre/quassel/0001-qtui-Set-desktop-file-name.patch +++ b/libre/quassel/0001-qtui-Set-desktop-file-name.patch @@ -1,5 +1,4 @@ -From 919ac3d7184faee0ccfa7fe65c6635a7dcf5d234 Mon Sep 17 00:00:00 2001 -Message-Id: <919ac3d7184faee0ccfa7fe65c6635a7dcf5d234.1553291431.git.jan.steffens@gmail.com> +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> Date: Fri, 22 Mar 2019 22:37:22 +0100 Subject: [PATCH] qtui: Set desktop file name @@ -18,7 +17,7 @@ confused. 2 files changed, 6 insertions(+) diff --git a/src/qtui/monoapplication.cpp b/src/qtui/monoapplication.cpp -index 809f1147..3f60523f 100644 +index 809f1147..457a5dce 100644 --- a/src/qtui/monoapplication.cpp +++ b/src/qtui/monoapplication.cpp @@ -32,6 +32,9 @@ MonolithicApplication::MonolithicApplication(int &argc, char **argv) @@ -26,13 +25,13 @@ index 809f1147..3f60523f 100644 { Quassel::setRunMode(Quassel::Monolithic); +#if QT_VERSION >= 0x050700 -+ QGuiApplication::setDesktopFileName(Quassel::buildInfo().applicationName + ".desktop"); ++ QGuiApplication::setDesktopFileName(Quassel::buildInfo().applicationName); +#endif } diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp -index e5b0b773..989a1961 100644 +index e5b0b773..42e4bf77 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -92,6 +92,9 @@ QtUiApplication::QtUiApplication(int &argc, char **argv) @@ -40,11 +39,8 @@ index e5b0b773..989a1961 100644 QGuiApplication::setFallbackSessionManagementEnabled(false); #endif +#if QT_VERSION >= 0x050700 -+ QGuiApplication::setDesktopFileName(Quassel::buildInfo().clientApplicationName + ".desktop"); ++ QGuiApplication::setDesktopFileName(Quassel::buildInfo().clientApplicationName); +#endif } --- -2.21.0 - diff --git a/libre/quassel/0002-common-Disable-enum-type-stream-operators-for-Qt-5.1.patch b/libre/quassel/0002-common-Disable-enum-type-stream-operators-for-Qt-5.1.patch new file mode 100644 index 000000000..734501fb5 --- /dev/null +++ b/libre/quassel/0002-common-Disable-enum-type-stream-operators-for-Qt-5.1.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Manuel Nickschas <sputnick@quassel-irc.org> +Date: Tue, 7 Jan 2020 18:34:54 +0100 +Subject: [PATCH] common: Disable enum type stream operators for Qt >= 5.14 + +Starting from version 5.14, Qt provides stream operators for enum +types, which collide with the ones we ship in types.h. Disable +Quassel's stream operators when compiling against Qt 5.14 or later. + +Add a unit test that ensures that enum serialization honors the width +of the underlying type. +--- + src/common/types.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/common/types.h b/src/common/types.h +index 467d9fb2..c4b9f364 100644 +--- a/src/common/types.h ++++ b/src/common/types.h +@@ -140,6 +140,7 @@ Q_DECLARE_METATYPE(QHostAddress) + typedef QList<MsgId> MsgIdList; + typedef QList<BufferId> BufferIdList; + ++#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + /** + * Catch-all stream serialization operator for enum types. + * +@@ -169,6 +170,7 @@ QDataStream &operator>>(QDataStream &in, T &value) { + value = static_cast<T>(v); + return in; + } ++#endif + + // Exceptions + diff --git a/libre/quassel/0003-Removed-mozilla-IRC-network-from-networks.ini.patch b/libre/quassel/0003-Removed-mozilla-IRC-network-from-networks.ini.patch new file mode 100644 index 000000000..7a745de59 --- /dev/null +++ b/libre/quassel/0003-Removed-mozilla-IRC-network-from-networks.ini.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Svetlana T <svetlana@members.fsf.org> +Date: Sun, 8 Mar 2020 07:46:19 +1100 +Subject: [PATCH] Removed mozilla IRC network from networks.ini + +Mozilla IRC has shut down this month. Mozilla moved their chat services to matrix. I am removing it from the default preset now. +--- + data/networks.ini | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/data/networks.ini b/data/networks.ini +index 5f8fa029..73afecb3 100644 +--- a/data/networks.ini ++++ b/data/networks.ini +@@ -35,9 +35,6 @@ Servers=irc.gamesnet.net:6667 + [IRCnet] + Servers=irc.ircnet.com:6667,open.ircnet.net:6666,irc.us.ircnet.net:6665,ircnet.netvision.net.il:6666,irc.tokyo.wide.ad.jp:6666,irc.freebsd.org.tw:6666,linz.irc.at:6666,vienna.irc.at:6666,ircnet.realroot.be:6666,irc.datacomm.ch:6664,irc.felk.cvut.cz:6667,random.ircd.de:6666,irc.dotsrc.org:6666,irc.ircnet.ee:6666,irc.cs.hut.fi:6667,ircnet.club-internet.fr:6666,atw.irc.hu:6667,irc.simnet.is:6660,irc.eutelia.it:6664,irc.eutelia.it:7000,irc.tin.it:6665,irc.apollo.lv:6666,irc.apollo.lv:7000,irc.uunet.nl:6660,irc.xs4all.nl:6660,irc.snt.utwente.nl:6660,irc.ifi.uio.no:6667,irc.pvv.ntnu.no:6667,lublin.irc.pl:6666,warszawa.irc.pl:6666,irc.ludd.luth.se:6661,irc.swipnet.se:6660,irc.swipnet.se:8000,irc.arnes.si:6666,irc.link.si:6666,irc.nextra.sk:6666,ircnet.demon.co.uk:6665,ircnet.eversible.com:6665,ircnet.choopa.net:6665 + +-[Mozilla] +-Servers=irc.mozilla.org:+6697,irc.mozilla.org:6667 +- + [OFTC] + Servers=irc.oftc.net:+6697,irc.oftc.net:6667 + diff --git a/libre/quassel/0004-This-commit-changes-the-official-Quassel-IRC-channel.patch b/libre/quassel/0004-This-commit-changes-the-official-Quassel-IRC-channel.patch new file mode 100644 index 000000000..af33d510c --- /dev/null +++ b/libre/quassel/0004-This-commit-changes-the-official-Quassel-IRC-channel.patch @@ -0,0 +1,99 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: phuzion <398094+phuzion@users.noreply.github.com> +Date: Wed, 19 May 2021 18:05:36 +0000 +Subject: [PATCH] This commit changes the official Quassel IRC channel, + (#quassel) from the Freenode IRC network to the Libera IRC network in + response to recent issues which resulted in the entire volunteer staff of + Freenode stepping down. + +For more information about this situation, please read this: +https://gist.github.com/joepie91/df80d8d36cd9d1bde46ba018af497409 +--- + README.md | 6 ++---- + data/networks.ini | 7 +++++-- + src/qtui/aboutdlg.cpp | 2 +- + 3 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/README.md b/README.md +index c7b03dc2..6f54dfaa 100644 +--- a/README.md ++++ b/README.md +@@ -47,31 +47,29 @@ documentation. + + IRC is the preferred means of getting in touch with the developers. + +-The Quassel IRC Team can be contacted on **`Freenode/#quassel`** +-(or **`#quassel.de`**). If you have trouble getting Quassel to connect, +-you can use [Freenode's webchat][help-freenode]. ++The Quassel IRC Team can be contacted on **`Libera Chat/#quassel`** ++(or **`#quassel.de`**). + + We always welcome new users in our channels! + + You can learn more and reach out to us in several ways: + * [Visit our homepage][web-home] + * [Submit and browse issues on the bugtracker][dev-bugs] + * GitHub issues are not used, but [pull requests][dev-pr-new] are accepted! + * [Email the dev team - devel@quassel-irc.org][dev-email] + + Thanks for reading, + + ~ *The Quassel IRC Team* + + [web-home]: https://quassel-irc.org + [web-download]: https://quassel-irc.org/downloads + [dev-bugs]: https://bugs.quassel-irc.org + [dev-email]: mailto:devel@quassel-irc.org + [dev-pr-new]: https://github.com/quassel/quassel/pull/new/master + [docs-wiki]: https://bugs.quassel-irc.org/projects/quassel-irc/wiki + [docs-wiki-unofficial-build]: https://bugs.quassel-irc.org/projects/quassel-irc/wiki#Unofficial-builds + [docs-wiki-getstart]: https://bugs.quassel-irc.org/projects/quassel-irc/wiki#Getting-started +-[help-freenode]: https://webchat.freenode.net?channels=%23quassel + [repo-changelog]: ChangeLog + [ci-linux-badge]: https://travis-ci.org/quassel/quassel.svg?branch=master + [ci-linux-status-page]: https://travis-ci.org/quassel/quassel/branches +diff --git a/data/networks.ini b/data/networks.ini +index 73afecb3..cf16313e 100644 +--- a/data/networks.ini ++++ b/data/networks.ini +@@ -19,22 +19,25 @@ Servers=irc.efnet.info:6667,irc.efnet.org:6667,irc.inter.net.il:6667,irc.igs.ca: + Servers=irc.enterthegame.com:6667 + + [Freenode] +-Default=Yes +-DefaultChannels=#quassel + Servers=chat.freenode.net:+6697,chat.freenode.net:6667 + + [GalaxyNet] + Servers=irc.galaxynet.org:6662,irc.galaxynet.org:7000,boston.ma.us.galaxynet.org:6661 + + [GameSurge] + Servers=irc.gamesurge.net:6667,irc.eu.gamesurge.net:6667 + + [GamesNET] + Servers=irc.gamesnet.net:6667 + + [IRCnet] + Servers=irc.ircnet.com:6667,open.ircnet.net:6666,irc.us.ircnet.net:6665,ircnet.netvision.net.il:6666,irc.tokyo.wide.ad.jp:6666,irc.freebsd.org.tw:6666,linz.irc.at:6666,vienna.irc.at:6666,ircnet.realroot.be:6666,irc.datacomm.ch:6664,irc.felk.cvut.cz:6667,random.ircd.de:6666,irc.dotsrc.org:6666,irc.ircnet.ee:6666,irc.cs.hut.fi:6667,ircnet.club-internet.fr:6666,atw.irc.hu:6667,irc.simnet.is:6660,irc.eutelia.it:6664,irc.eutelia.it:7000,irc.tin.it:6665,irc.apollo.lv:6666,irc.apollo.lv:7000,irc.uunet.nl:6660,irc.xs4all.nl:6660,irc.snt.utwente.nl:6660,irc.ifi.uio.no:6667,irc.pvv.ntnu.no:6667,lublin.irc.pl:6666,warszawa.irc.pl:6666,irc.ludd.luth.se:6661,irc.swipnet.se:6660,irc.swipnet.se:8000,irc.arnes.si:6666,irc.link.si:6666,irc.nextra.sk:6666,ircnet.demon.co.uk:6665,ircnet.eversible.com:6665,ircnet.choopa.net:6665 + ++[Libera Chat] ++Default=Yes ++DefaultChannels=#quassel ++Servers=irc.libera.chat:+6697,irc.libera.chat:6667 ++ + [OFTC] + Servers=irc.oftc.net:+6697,irc.oftc.net:6667 + +diff --git a/src/qtui/aboutdlg.cpp b/src/qtui/aboutdlg.cpp +index 6b21b0f5..a6c4da25 100644 +--- a/src/qtui/aboutdlg.cpp ++++ b/src/qtui/aboutdlg.cpp +@@ -67,7 +67,7 @@ QString AboutDlg::about() const + QString res {tr("<b>A modern, distributed IRC Client</b><br><br>" + "©%1 by the Quassel Project<br>" + "<a href=\"https://quassel-irc.org\">https://quassel-irc.org</a><br>" +- "<a href=\"irc://irc.freenode.net/quassel\">#quassel</a> on <a href=\"https://www.freenode.net\">Freenode</a><br><br>" ++ "<a href=\"irc://irc.libera.chat/quassel\">#quassel</a> on <a href=\"https://libera.chat\">Libera Chat</a><br><br>" + "Quassel IRC is dual-licensed under <a href=\"https://www.gnu.org/licenses/gpl-2.0.txt\">GPLv2</a> and " + "<a href=\"https://www.gnu.org/licenses/gpl-3.0.txt\">GPLv3</a>.<br>" + "<a href=\"https://api.kde.org/frameworks/breeze-icons/html\">Breeze icon theme</a> © Uri Herrera and others, licensed under the " diff --git a/libre/quassel/search-duck.patch b/libre/quassel/9000-search-duck.patch index 9fc77b724..9fc77b724 100644 --- a/libre/quassel/search-duck.patch +++ b/libre/quassel/9000-search-duck.patch diff --git a/libre/quassel/PKGBUILD b/libre/quassel/PKGBUILD index 3802c9964..3cccb2ef2 100644 --- a/libre/quassel/PKGBUILD +++ b/libre/quassel/PKGBUILD @@ -4,47 +4,58 @@ # parabola changes and rationale: # - repalce qt5-webengine with qt5-webkit (for URL previews) - +# - set duckduckgo as default search engine pkgbase=quassel pkgname=('quassel-core' 'quassel-client' - 'quassel-client-small' - 'quassel-monolithic') + 'quassel-client-qt' + 'quassel-monolithic' + 'quassel-monolithic-qt' + 'quassel-common') pkgver=0.13.1 -pkgrel=4 +pkgrel=9 pkgrel+=.parabola1 pkgdesc="Next-generation distributed IRC client" arch=('x86_64') arch+=('armv7h' 'i686') url="https://quassel-irc.org/" license=('GPL') -makedepends=('qt5-base' 'qt5-tools' 'qt5-webengine' 'qca-qt5' 'qt5-script' +makedepends=('qt5-base' 'qt5-tools' 'qt5-webengine' 'qca' 'qt5-script' 'qt5-multimedia' 'knotifyconfig' 'sonnet' 'libldap' 'cmake' 'extra-cmake-modules' 'python' 'hicolor-icon-theme') makedepends=(${makedepends[*]/qt5-webengine/qt5-webkit}) source=(https://quassel-irc.org/pub/$pkgbase-$pkgver.tar.bz2 0001-qtui-Set-desktop-file-name.patch - quassel-0.13.1-qt5.14.patch - search-duck.patch + 0002-common-Disable-enum-type-stream-operators-for-Qt-5.1.patch + 0003-Removed-mozilla-IRC-network-from-networks.ini.patch + 0004-This-commit-changes-the-official-Quassel-IRC-channel.patch $pkgbase.service $pkgbase.sysusers $pkgbase.tmpfiles $pkgbase.conf) +source+=(9000-search-duck.patch) sha256sums=('48efee9778743b1db9f44efb91d1c913104db01190c57f2ff57483c39a97e855' - '695ff3b605ea62ccfdf9ec4b9e6ffa74f3e2c0ac81402d51a74d263c47886c92' - '3d43f498df04db59a5199e0a81b8fd7ac37ef46fffb0c69ab5a17bcafb6d8c65' - '3d90a7edfa2b2e27e5f56b25f7583585efbcd35219c04a3bf138d9fe9bb9eab2' + '7a64214024dc047f35ec8af3c5d543853a5c89c0506766c69c2e1072ca8f5ec7' + 'a1f874558f31c786b2fb483454d14e74a0dfc01382e1ba58bd610a65e02f4df4' + '0f92f3a51d2e3272d71b21a563047d7fae93bc2dd6676f405a2d63a20d48521b' + 'f59d4138f5fc8c9e84b5626fcbe16eec21b22344dc6c28d784c511677de661e1' '5dbe20290f3361b9b7a74a52905137e76b656976febf2d31082a2276f9dcde7f' '3c72441a99e2668c6a8a751fa07beeb44f937576c8a1b5f615e4a55f841d93d9' '2afd4340c7713f6533e5d175a86b28fd118ecd907776c2b10925d1a4fb31cdca' 'f3031ea8217e01ba42cea14606169e3e27affa5918968ffd5a03c21ae92fe2b8') +sha256sums+=('3d90a7edfa2b2e27e5f56b25f7583585efbcd35219c04a3bf138d9fe9bb9eab2') + prepare() { cd $pkgbase-$pkgver patch -Np1 -i ../0001-qtui-Set-desktop-file-name.patch - patch -Np1 -i ../quassel-0.13.1-qt5.14.patch - patch -Np1 -i ../search-duck.patch + patch -Np1 -i ../0002-common-Disable-enum-type-stream-operators-for-Qt-5.1.patch + patch -Np1 -i ../0003-Removed-mozilla-IRC-network-from-networks.ini.patch + patch -Np1 -i ../0004-This-commit-changes-the-official-Quassel-IRC-channel.patch + + # parabola patches + patch -Np1 -i ../9000-search-duck.patch } _build() ( @@ -77,6 +88,15 @@ build() { -DWITH_WEBENGINE=OFF \ -DWITH_KDE=ON + _build monolithic-qt \ + -DWANT_CORE=OFF \ + -DWANT_QTCLIENT=OFF \ + -DWITH_WEBKIT=OFF \ + -DWITH_WEBENGINE=OFF \ + -DCMAKE_DISABLE_FIND_PACKAGE_dbusmenu-qt5=ON \ + -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Multimedia=ON \ + -DCMAKE_DISABLE_FIND_PACKAGE_Phonon4Qt5=ON + _build client \ -DWANT_CORE=OFF \ -DWANT_MONO=OFF \ @@ -84,7 +104,7 @@ build() { -DWITH_WEBENGINE=OFF \ -DWITH_KDE=ON - _build client-small \ + _build client-qt \ -DWANT_CORE=OFF \ -DWANT_MONO=OFF \ -DWITH_WEBKIT=OFF \ @@ -96,7 +116,7 @@ build() { package_quassel-core() { pkgdesc="Next-generation distributed IRC client - core only" -depends=('icu' 'qca-qt5' 'qt5-script' 'libldap') +depends=('icu' 'qca' 'qt5-script' 'libldap') optdepends=('postgresql: PostgreSQL database support') backup=(etc/conf.d/quassel) @@ -116,41 +136,75 @@ backup=(etc/conf.d/quassel) } package_quassel-client() { -pkgdesc="Next-generation distributed IRC client - client only" -pkgdesc+=" (with webkit HTML rendering)" -depends=('qt5-base' 'qt5-webengine' 'qt5-multimedia' 'knotifyconfig' - 'hicolor-icon-theme') +pkgdesc="Next-generation distributed IRC client - client only, KDE version" +depends=('quassel-common' 'qt5-base' 'qt5-webengine' 'qt5-multimedia' 'knotifyconfig') +pkgdesc+=" with webkit HTML rendering" depends=(${depends[*]/qt5-webengine/qt5-webkit}) optdepends=('perl: for builtin /exec scripts') -conflicts=('quassel-monolithic' 'quassel-client-small') +conflicts=('quassel-client-qt') _install client install -Dm644 $pkgbase-$pkgver/data/quasselclient.appdata.xml "$pkgdir/usr/share/metainfo/quasselclient.appdata.xml" + + # Split quassel-common + rm -r "$pkgdir"/usr/share/{icons,knotifications5,pixmaps,quassel} } -package_quassel-client-small() { -pkgdesc="Next-generation distributed IRC client - client only, reduced deps" -depends=('qt5-base' 'qt5-svg' 'sonnet' 'hicolor-icon-theme') +package_quassel-client-qt() { +pkgdesc="Next-generation distributed IRC client - client only, Qt version with reduced deps" +depends=('quassel-common' 'qt5-base' 'qt5-svg' 'sonnet') optdepends=('perl: for builtin /exec scripts') -conflicts=('quassel-monolithic' 'quassel-client') -replaces=('quassel-remote') +conflicts=('quassel-client') +replaces=('quassel-client-small' 'quassel-remote') + + _install client-qt - _install client-small + # Split quassel-common + rm -r "$pkgdir"/usr/share/{icons,pixmaps,quassel} # Ignore package by AppStream to avoid duplicated IDs echo 'X-AppStream-Ignore=true' >> "$pkgdir/usr/share/applications/quasselclient.desktop" } package_quassel-monolithic() { -pkgdesc="Next-generation distributed IRC client - monolithic" -pkgdesc+=" (with webkit HTML rendering)" -depends=('qt5-base' 'qt5-webengine' 'qt5-multimedia' 'qt5-script' 'qca-qt5' - 'knotifyconfig' 'libldap' 'hicolor-icon-theme') +pkgdesc="Next-generation distributed IRC client - monolithic, KDE version" +depends=('quassel-common' 'qt5-base' 'qt5-webengine' 'qt5-multimedia' 'qt5-script' 'qca' + 'knotifyconfig' 'libldap') +pkgdesc+=" with webkit HTML rendering" depends=(${depends[*]/qt5-webengine/qt5-webkit}) optdepends=('perl: for builtin /exec scripts' 'postgresql: PostgreSQL database support') -conflicts=('quassel-client' 'quassel-client-small') +conflicts=('quassel-monolithic-qt') _install monolithic install -Dm644 $pkgbase-$pkgver/data/quassel.appdata.xml "$pkgdir/usr/share/metainfo/quassel.appdata.xml" + + # Split quassel-common + mkdir "$srcdir/quassel-common" + mv "$pkgdir"/usr/share/{icons,knotifications5,pixmaps,quassel} \ + "$srcdir/quassel-common/" +} + +package_quassel-monolithic-qt() { +pkgdesc="Next-generation distributed IRC client - monolithic, Qt version with reduced deps" +depends=('quassel-common' 'qca' 'qt5-base' 'qt5-svg' 'qt5-script' 'sonnet') +optdepends=('perl: for builtin /exec scripts' + 'postgresql: PostgreSQL database support') +conflicts=('quassel-monolithic') + + _install monolithic-qt + + # Split quassel-common + rm -r "$pkgdir"/usr/share/{icons,pixmaps,quassel} + + # Ignore package by AppStream to avoid duplicated IDs + echo 'X-AppStream-Ignore=true' >> "$pkgdir/usr/share/applications/quassel.desktop" +} + +package_quassel-common() { + pkgdesc="Common files for Quassel" + depends=('hicolor-icon-theme') + + install -dm755 "$pkgdir/usr/share" + mv quassel-common/* "$pkgdir/usr/share" } diff --git a/libre/quassel/quassel-0.13.1-qt5.14.patch b/libre/quassel/quassel-0.13.1-qt5.14.patch deleted file mode 100644 index f0305ea53..000000000 --- a/libre/quassel/quassel-0.13.1-qt5.14.patch +++ /dev/null @@ -1,118 +0,0 @@ -commit c90702bdbc43fc542d7df6d5ec4b321912ca0035 -Author: Manuel Nickschas <sputnick@quassel-irc.org> -Date: Tue Jan 7 18:34:54 2020 +0100 - - common: Disable enum type stream operators for Qt >= 5.14 - - Starting from version 5.14, Qt provides stream operators for enum - types, which collide with the ones we ship in types.h. Disable - Quassel's stream operators when compiling against Qt 5.14 or later. - - Add a unit test that ensures that enum serialization honors the width - of the underlying type. - -diff --git a/src/common/types.h b/src/common/types.h -index 467d9fb2..c4b9f364 100644 ---- a/src/common/types.h -+++ b/src/common/types.h -@@ -140,6 +140,7 @@ Q_DECLARE_METATYPE(QHostAddress) - typedef QList<MsgId> MsgIdList; - typedef QList<BufferId> BufferIdList; - -+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - /** - * Catch-all stream serialization operator for enum types. - * -@@ -169,6 +170,7 @@ QDataStream &operator>>(QDataStream &in, T &value) { - value = static_cast<T>(v); - return in; - } -+#endif - - // Exceptions - -diff --git a/src/common/typestest.cpp b/src/common/typestest.cpp -new file mode 100644 -index 00000000..04031c29 ---- /dev/null -+++ b/src/common/typestest.cpp -@@ -0,0 +1,79 @@ -+/*************************************************************************** -+ * Copyright (C) 2005-2020 by the Quassel Project * -+ * devel@quassel-irc.org * -+ * * -+ * This program is free software; you can redistribute it and/or modify * -+ * it under the terms of the GNU General Public License as published by * -+ * the Free Software Foundation; either version 2 of the License, or * -+ * (at your option) version 3. * -+ * * -+ * This program is distributed in the hope that it will be useful, * -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of * -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -+ * GNU General Public License for more details. * -+ * * -+ * You should have received a copy of the GNU General Public License * -+ * along with this program; if not, write to the * -+ * Free Software Foundation, Inc., * -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -+ ***************************************************************************/ -+ -+#include <cstdint> -+ -+#include <QByteArray> -+#include <QDataStream> -+#include <QObject> -+ -+#include "testglobal.h" -+#include "types.h" -+ -+using namespace ::testing; -+ -+class EnumHolder -+{ -+ Q_GADGET -+ -+public: -+ enum class Enum16 : uint16_t {}; -+ enum class Enum32 : uint32_t {}; -+ -+ enum class EnumQt16 : uint16_t {}; -+ Q_ENUM(EnumQt16) -+ enum class EnumQt32 : uint32_t {}; -+ Q_ENUM(EnumQt32) -+}; -+ -+// Verify that enums are (de)serialized as their underlying type -+TEST(TypesTest, enumSerialization) -+{ -+ QByteArray data; -+ QDataStream out(&data, QIODevice::WriteOnly); -+ -+ // Serialize -+ out << EnumHolder::Enum16(0xabcd); -+ ASSERT_THAT(data.size(), Eq(2)); -+ out << EnumHolder::Enum32(0x123456); -+ ASSERT_THAT(data.size(), Eq(6)); -+ out << EnumHolder::EnumQt16(0x4321); -+ ASSERT_THAT(data.size(), Eq(8)); -+ out << EnumHolder::Enum32(0xfedcba); -+ ASSERT_THAT(data.size(), Eq(12)); -+ ASSERT_THAT(out.status(), Eq(QDataStream::Status::Ok)); -+ -+ // Deserialize -+ QDataStream in(data); -+ EnumHolder::Enum16 enum16; -+ EnumHolder::Enum32 enum32; -+ EnumHolder::EnumQt16 enumQt16; -+ EnumHolder::EnumQt32 enumQt32; -+ in >> enum16 >> enum32 >> enumQt16 >> enumQt32; -+ ASSERT_THAT(in.status(), Eq(QDataStream::Status::Ok)); -+ EXPECT_TRUE(in.atEnd()); -+ -+ EXPECT_THAT((int)enum16, Eq(0xabcd)); -+ EXPECT_THAT((int)enum32, Eq(0x123456)); -+ EXPECT_THAT((int)enumQt16, Eq(0x4321)); -+ EXPECT_THAT((int)enumQt32, Eq(0xfedcba)); -+} -+ -+#include "typestest.moc" |