Skip to content

Commit 48377a9

Browse files
authored
build: Added experimental QT6 support (#178)
1 parent e002aac commit 48377a9

File tree

8 files changed

+201
-40
lines changed

8 files changed

+201
-40
lines changed

.github/workflows/main.yml

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ env:
2020
FPC_BRANCH: 'release_3_2_2'
2121
LAZ_URL: 'gitlab'
2222
LAZ_BRANCH: 'lazarus_2_2_4'
23+
LAZ_REVISION_2_4: '0a3429053c0dfcae2359e3b0b62e1763d5e6a319'
2324
LAZ_DIR: 'fpcLaz'
2425
BUILD_MODE: 'Debug_GH_Action'
2526
FPCUP_OPT: '--lazopt="-g -gl" --fpcopt="-g -gl"'
@@ -43,25 +44,25 @@ jobs:
4344

4445
- os: windows-latest
4546
name: 'Windows 64'
46-
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0h/fpclazup-x86_64-win64.exe'
47+
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0nf/fpclazup-x86_64-win64.exe'
4748
lazbuild: 'fpcLaz/lazarus/lazbuild.exe'
4849
dbg2mab: 'dbg2mab.exe'
4950
build-widgetset: 'win32'
5051
build-os: 'win64'
5152
debug_file: 'ASuite.dbg'
5253

53-
- os: ubuntu-latest
54+
- os: ubuntu-22.04
5455
name: 'Linux 64 GTK2'
55-
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0h/fpclazup-x86_64-linux'
56+
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0nf/fpclazup-x86_64-linux'
5657
lazbuild: 'fpcLaz/lazarus/lazbuild'
5758
dbg2mab: 'dbg2mab'
5859
build-widgetset: 'gtk2'
5960
build-os: 'linux'
6061
debug_file: 'ASuite.dbg'
6162

62-
- os: ubuntu-latest
63+
- os: ubuntu-22.04
6364
name: 'Linux 64 GTK3'
64-
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0h/fpclazup-x86_64-linux'
65+
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0nf/fpclazup-x86_64-linux'
6566
lazbuild: 'fpcLaz/lazarus/lazbuild'
6667
dbg2mab: 'dbg2mab'
6768
build-widgetset: 'gtk3'
@@ -70,30 +71,39 @@ jobs:
7071

7172
- os: ubuntu-20.04
7273
name: 'Linux 64 QT5'
73-
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0h/fpclazup-x86_64-linux'
74+
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0nf/fpclazup-x86_64-linux'
7475
lazbuild: 'fpcLaz/lazarus/lazbuild'
7576
dbg2mab: 'dbg2mab'
7677
build-widgetset: 'qt5'
7778
build-os: 'linux'
7879
debug_file: 'ASuite.dbg'
80+
81+
- os: ubuntu-22.04
82+
name: 'Linux 64 QT6'
83+
fpcup-url: 'https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.2.0nf/fpclazup-x86_64-linux'
84+
lazbuild: 'fpcLaz/lazarus/lazbuild'
85+
dbg2mab: 'dbg2mab'
86+
build-widgetset: 'qt6'
87+
build-os: 'linux'
88+
debug_file: 'ASuite.dbg'
7989

8090
# Steps represent a sequence of tasks that will be executed as part of the job
8191
steps:
8292
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
83-
- uses: actions/checkout@v2
93+
- uses: actions/checkout@v3
8494
with:
8595
submodules: true
8696
path: '${{ env.ASUITE_SOURCE }}'
8797

8898
- name: Install Dependencies (Ubuntu)
89-
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'ubuntu-20.04'
99+
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'ubuntu-22.04' && matrix.config.build-widgetset == 'gtk2'
90100
run: |
91101
sudo apt-get update
92102
sudo apt-get -m -y install libgtk2.0-dev libpango1.0-dev libffi-dev libxtst-dev xvfb
93103
Xvfb :1 &
94104
95105
- name: Install Dependencies (Ubuntu - only GTK3)
96-
if: (matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'ubuntu-20.04') && matrix.config.build-widgetset == 'gtk3'
106+
if: (matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'ubuntu-22.04') && matrix.config.build-widgetset == 'gtk3'
97107
run: sudo apt-get -m -y install libgtk-3-dev
98108

99109
- name: Install Dependencies (Ubuntu - only QT5)
@@ -104,23 +114,44 @@ jobs:
104114
qmake
105115
make
106116
sudo make install
117+
118+
- name: Install Dependencies (Ubuntu - only QT6)
119+
if: (matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'ubuntu-22.04') && matrix.config.build-widgetset == 'qt6'
120+
run: |
121+
wget https://github.com/davidbannon/libqt6pas/releases/download/v6.2.2/libqt6pas6_2_2-1_amd64.deb
122+
wget https://github.com/davidbannon/libqt6pas/releases/download/v6.2.2/libqt6pas-dev_2_2-1_amd64.deb
123+
sudo apt-get -m -y install qt6-base-dev libxcb-keysyms1-dev libgl-dev
124+
sudo dpkg -i libqt6pas6_2_2-1_amd64.deb
125+
sudo dpkg -i libqt6pas-dev_2_2-1_amd64.deb
126+
cd ${{ env.ASUITE_SOURCE }}/3p/AsuiteComps/library/platform/unix/QGHotkeyHookPas
127+
qmake6
128+
make
129+
sudo make install
107130
108131
- name: Generate Cache Hash
109-
run: echo "${{ matrix.config.fpcup-url }}${{ env.FPCUP_OPT }}${{ env.FPC_URL }}${{ env.FPC_BRANCH }}${{ env.LAZ_URL }}${{ env.LAZ_BRANCH }}${{ env.LAZ_PATCH}}${{ matrix.config.name }}" > .cache
132+
run: echo "${{ matrix.config.fpcup-url }}${{ env.FPCUP_OPT }}${{ env.FPC_URL }}${{ env.FPC_BRANCH }}${{ env.LAZ_URL }}${{ env.LAZ_BRANCH }}${{ env.LAZ_REVISION_2_4 }}${{ env.LAZ_PATCH}}${{ matrix.config.name }}" > .cache
110133

111134
- name: Cache
112135
id: cache
113-
uses: actions/cache@v2.1.3
136+
uses: actions/cache@v3.0.11
114137
env:
115-
cache-name: cache-laz-v0.5.4
138+
cache-name: cache-laz-v0.6.0
116139
with:
117140
path: |
118141
${{ env.LAZ_DIR }}
119142
${{ env.ASUITE_SOURCE }}/3p/mORMot2/static
120143
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('.cache') }}
121144

122145
- name: Install Lazarus
123-
if: steps.cache.outputs.cache-hit != 'true'
146+
if: steps.cache.outputs.cache-hit != 'true' && matrix.config.build-widgetset == 'qt6'
147+
run: |
148+
curl --retry 5 -L -o fpcup ${{ matrix.config.fpcup-url }}
149+
chmod +x fpcup
150+
mkdir ${{ env.LAZ_DIR }}
151+
./fpcup --installdir=${{ env.LAZ_DIR }} --fpcURL=${{ env.FPC_URL }} --fpcBranch=${{ env.FPC_BRANCH }} --lazURL=${{ env.LAZ_URL }} --lazRevision=${{ env.LAZ_REVISION_2_4 }} --lazPATCH="${{ env.ASUITE_SOURCE}}${{ env.LAZ_PATCH}}" ${{ env.FPCUP_OPT }} --only=docker --noconfirm --verbose
152+
153+
- name: Install Lazarus
154+
if: steps.cache.outputs.cache-hit != 'true' && matrix.config.build-widgetset != 'qt6'
124155
run: |
125156
curl --retry 5 -L -o fpcup ${{ matrix.config.fpcup-url }}
126157
chmod +x fpcup
@@ -134,7 +165,7 @@ jobs:
134165

135166
- name: Validate Cache
136167
if: steps.cache.outputs.cache-hit == 'true'
137-
run: ${{ matrix.config.lazbuild }} --version && echo "::set-output name=success::true" || echo "::set-output name=success::false"
168+
run: ${{ matrix.config.lazbuild }} --version && echo "success=true" >> $GITHUB_OUTPUT || echo "success=false" >> $GITHUB_OUTPUT
138169

139170
- name: Build ASuite (${{ env.BUILD_MODE }})
140171
run: ${{ matrix.config.lazbuild }} "${{ env.ASUITE_SOURCE }}/ASuite.lpi" --no-write-project --build-mode="${{ env.BUILD_MODE }}" --widgetset=${{ matrix.config.build-widgetset }} --operating-system=${{ matrix.config.build-os }}
@@ -147,7 +178,7 @@ jobs:
147178
run: ${{ env.ASUITE_SOURCE }}/bin/${{ matrix.config.dbg2mab }} ${{ env.ASUITE_SOURCE }}/bin/${{ matrix.config.debug_file }}
148179

149180
- name: Upload the Build Artifact
150-
uses: actions/upload-artifact@v2.2.2
181+
uses: actions/upload-artifact@v3.1.1
151182
with:
152183
name: ASuite ${{ env.BUILD_MODE }} build - ${{ matrix.config.build-widgetset }}
153184
path: |

ASuite.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4141

4242
{$IFDEF LCLQT5}
4343
{$DEFINE QT}
44+
{$ENDIF}
45+
46+
{$IFDEF LCLQT6}
47+
{$DEFINE QT}
4448
{$ENDIF}
4549
{$ENDIF}

DataModules/DataModules.TrayMenu.pas

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ interface
3636
{$IFDEF LINUX}
3737
, x, xlib
3838

39-
{$IFDEF LCLGTK2}
40-
, gdk2, gdk2x
41-
{$ENDIF}
42-
43-
{$IFDEF LCLGTK3}
44-
, LazGdk3, LazGLib2
45-
{$ENDIF}
46-
4739
{$IFDEF QT}
48-
, qt5
40+
{$IFDEF LCLQT5}
41+
, qt5
42+
{$ELSE}
43+
, qt6, qtint
44+
{$ENDIF}
45+
{$ELSE}
46+
{$IFDEF LCLGTK2}
47+
, gdk2, gdk2x
48+
{$ELSE}
49+
, LazGdk3, LazGLib2
50+
{$ENDIF}
4951
{$ENDIF}
5052
{$ENDIF};
5153

@@ -857,14 +859,22 @@ class function TdmTrayMenu.CheckSysTray: Boolean;
857859

858860
{$IFDEF LCLQT5}
859861
XDisplay := QX11Info_display;
862+
{$ENDIF}
863+
864+
{$IFDEF LCLQT6}
865+
XDisplay := QtWidgetSet.x11Display;
860866
{$ENDIF}
861867

862868
{$IFDEF LCLGTK3}
863869
XDisplay := gdk_x11_display_get_xdisplay(gdk_window_get_display(gdk_get_default_root_window));
864870
{$ENDIF}
865871

872+
Result := False;
873+
if XDisplay <> nil then
874+
begin
866875
A := XInternAtom(XDisplay, '_NET_SYSTEM_TRAY_S0', False);
867876
Result := (XGetSelectionOwner(XDisplay, A) <> 0);
877+
end;
868878

869879
if not Result then
870880
Result := TdmTrayMenu.CheckGnomeExtras; // Thats libappindicator3 and an installed and enabled gnome-shell-extension-appindicator

Library/Icons.Manager.pas

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
{$MODE DelphiUnicode}
2323

24+
{$I ASuite.inc}
25+
2426
interface
2527

2628
uses
@@ -68,13 +70,13 @@ TIconsManager = class
6870
function GetIconFromImgList(AImageIndex: Integer; ALargeIcon: Boolean
6971
): TBGRABitmap;
7072
{$IFDEF UNIX}
71-
{$IFDEF LCLQT5}
72-
function GetSystemIconName(const AFileName: String): String;
73-
function CheckSystemIconName(const AIconName: String): Boolean;
74-
{$ELSE}
75-
function GetSystemIconName(const AFileName: AnsiString): AnsiString;
76-
function CheckSystemIconName(const AIconName: AnsiString): Boolean;
77-
{$ENDIF}
73+
{$IFDEF QT}
74+
function GetSystemIconName(const AFileName: String): String;
75+
function CheckSystemIconName(const AIconName: String): Boolean;
76+
{$ELSE}
77+
function GetSystemIconName(const AFileName: AnsiString): AnsiString;
78+
function CheckSystemIconName(const AIconName: AnsiString): Boolean;
79+
{$ENDIF}
7880
{$ENDIF}
7981

8082
property PathTheme: string read GetPathTheme write SetPathTheme;
@@ -87,9 +89,13 @@ implementation
8789
Graphics, DataModules.Icons, mormot.core.log
8890
{$IFDEF UNIX}
8991
, IniFiles, BaseUnix, StrUtils, Utility.FileFolder
90-
{$IFDEF LCLQT5}
91-
, qt5
92-
{$ELSE}
92+
{$IFDEF QT}
93+
{$IFDEF LCLQT5}
94+
, qt5
95+
{$ELSE}
96+
, qt6
97+
{$ENDIF}
98+
{$ELSE}
9399
{$IFDEF LCLGTK2}
94100
, gtk2
95101
{$ELSE}
@@ -252,7 +258,7 @@ function TIconsManager.GetIconFromImgList(AImageIndex: Integer; ALargeIcon: Bool
252258
end;
253259

254260
{$IFDEF UNIX}
255-
{$IFDEF LCLQT5}
261+
{$IFDEF QT}
256262
function TIconsManager.GetSystemIconName(const AFileName: String): String;
257263
{$ELSE}
258264
function TIconsManager.GetSystemIconName(const AFileName: AnsiString): AnsiString;
@@ -302,7 +308,7 @@ function TIconsManager.GetSystemIconName(const AFileName: AnsiString): AnsiStrin
302308
begin
303309
Result := iconList.Strings[I];
304310

305-
{$IFDEF LCLQT5}
311+
{$IFDEF QT}
306312
if QIcon_hasThemeIcon(@Result) then break;
307313
{$ELSE}
308314
if gtk_icon_theme_has_icon(gtk_icon_theme_get_default, PAnsiChar(Result)) then break;
@@ -438,7 +444,7 @@ function TIconsManager.GetIconByDesktopFile(AFileName: String): String;
438444
end;
439445
end;
440446

441-
{$IFDEF LCLQT5}
447+
{$IFDEF QT}
442448
function TIconsManager.CheckSystemIconName(const AIconName: String): Boolean;
443449
begin
444450
//QIcon_fromTheme can load icon name and absolute filepath, too

0 commit comments

Comments
 (0)