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

Fix the CI #609

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
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
10 changes: 5 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp, python
- name: Install Qt ${{ matrix.qt_version }}
uses: jurplel/install-qt-action@v3
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 5.14.1
version: 6.8.0
cache: true
dir: ${{ runner.temp }}/Qt
- name: Install additional dependencies
shell: bash
run: |
sudo apt-get update -qq;
sudo apt install -qq libx11-dev libqt5svg5-dev libx11-xcb-dev
sudo apt install -qq libx11-dev libx11-xcb-dev
- name: Create build environment
run: cmake -E make_directory ${{ runner.workspace }}/build
- name: Configure CMake
Expand Down
47 changes: 13 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,32 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
arch: [x86, x64]
qt_version: [5.9.9, 5.15.2]
qt_version: [6.2.4, 6.8.0]
include:
- os: windows-latest
arch: x86
qt_compile_suite: win32_msvc2019
- os: windows-latest
arch: x64
qt_compile_suite: win64_msvc2019_64
qt_compile_suite: win64_msvc2022_64
exclude:
# We only want to test for the latest version of Qt on Windows
- os: windows-latest
qt_version: 5.9.9
# We only compile for the current architecture of the runner for Linux
- os: ubuntu-latest
arch: x86
qt_version: 6.2.4
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Qt ${{ matrix.qt_version }}
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt_version }}
arch: ${{ matrix.qt_compile_suite }}
cache: true
dir: ${{ runner.temp }}/Qt
- name: Install additional dependencies
shell: bash
env:
ARCH: ${{ matrix.arch }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update -qq;
sudo apt install -qq libx11-dev libqt5svg5-dev libx11-xcb-dev desktop-file-utils
sudo apt install -qq libx11-dev libx11-xcb-dev desktop-file-utils
elif [ "$RUNNER_OS" == "Windows" ]; then
if [ "$ARCH" == "x86" ]; then
echo "CMAKE_PLATFORM_ARG=-A Win32" >> $GITHUB_ENV
export archParam="--forcex86"
else
echo "CMAKE_PLATFORM_ARG=-A x64" >> $GITHUB_ENV
fi
choco install -y --force $archParam openssl.light --version=1.1.1
choco install -y --force openssl.light --version=1.1.1
echo "C:\\Program Files\\OpenSSL" >> $GITHUB_PATH
else
echo "$RUNNER_OS not supported"
Expand All @@ -61,7 +45,7 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: ${{ runner.workspace }}/build
run: cmake $GITHUB_WORKSPACE $CMAKE_PLATFORM_ARG -DCMAKE_BUILD_TYPE=Release -DCOMPILER_WARNINGS_AS_ERRORS=ON -DBUILD_WITH_TESTS=ON -DDONT_EXECUTE_INSTALLER=ON
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCOMPILER_WARNINGS_AS_ERRORS=ON -DBUILD_WITH_TESTS=ON -DDONT_EXECUTE_INSTALLER=ON
- name: Register build problem matchers
run: |
echo "::add-matcher::.github/problem-matchers/linguist.json"
Expand Down Expand Up @@ -116,10 +100,10 @@ jobs:
mkdir installer/cache
mv installer/$installerFile installer/cache
- name: Cache installer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: steps.check-deploy.outputs.is_deploy == 'true'
with:
name: installer-${{ runner.os }}-${{ matrix.arch }}-${{ github.sha }}
name: installer-${{ runner.os }}-${{ github.sha }}
path: installer/cache/${{ steps.find_installer_file.outputs.installer_file }}

release:
Expand All @@ -129,7 +113,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check if this is a deployment build
id: deploy_check
shell: bash
Expand All @@ -141,16 +125,11 @@ jobs:
echo "Tag does not match: ${{ github.event.ref }}"
exit 1
fi
- name: Download installer (x86)
uses: actions/download-artifact@v4.1.7
with:
name: installer-Windows-x86-${{ github.sha }}
path: installer-x86
- name: Download installer (x64)
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: installer-Windows-x64-${{ github.sha }}
path: installer-x64
path: installer
- name: Create Release
uses: ncipollo/release-action@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Check translation filenames
Expand Down
19 changes: 9 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ if(WIN32)
src/processhandle.cpp)
set(PLATFORM_EXE_SOURCES src/res/birdtray.rc)
set(PLATFORM_HEADERS src/windowtools_win.h src/birdtrayeventfilter.h src/processhandle.h)
find_package(Qt5WinExtras CONFIG REQUIRED)
list(APPEND REQUIRED_MODULES Qt6::WinExtras)
else()
find_library(X11 X11)
list(APPEND REQUIRED_MODULES X11)
set(PLATFORM_SOURCES src/windowtools_x11.cpp)
set(PLATFORM_HEADERS src/windowtools_x11.h)
endif(WIN32)
Expand Down Expand Up @@ -117,7 +116,7 @@ source_group("Resources" FILES ${RESOURCES})
qt6_add_resources(RESOURCES_SOURCES ${RESOURCES})
set_source_files_properties(${RESOURCES_SOURCES} PROPERTIES GENERATED ON)

if(Qt5LinguistTools_FOUND)
if(Qt6LinguistTools_FOUND)
set(MAIN_TRANSLATION_FILES
src/translations/main_en.ts
src/translations/main_fr.ts
Expand Down Expand Up @@ -156,13 +155,13 @@ if(Qt5LinguistTools_FOUND)
set_source_files_properties(${DYN_TRANSLATION_FILES} PROPERTIES OUTPUT_LOCATION
${CMAKE_CURRENT_BINARY_DIR}/translations)

qt5_create_translation(GEN_TRANSLATION_FILES
qt6_create_translation(GEN_TRANSLATION_FILES
${MAIN_TRANSLATION_FILES}
${SOURCES} ${PLATFORM_SOURCES} ${HEADERS} ${PLATFORM_HEADERS}
OPTIONS -locations none)
qt5_add_translation(GEN_DYN_TRANSLATION_FILES ${DYN_TRANSLATION_FILES})
qt6_add_translation(GEN_DYN_TRANSLATION_FILES ${DYN_TRANSLATION_FILES})
list(APPEND GEN_TRANSLATION_FILES ${GEN_DYN_TRANSLATION_FILES})
endif(Qt5LinguistTools_FOUND)
endif(Qt6LinguistTools_FOUND)

add_library(birdtray_lib STATIC
${SOURCES} ${PLATFORM_SOURCES} ${RESOURCES_SOURCES} ${GEN_TRANSLATION_FILES}
Expand All @@ -173,7 +172,7 @@ target_link_libraries(birdtray_lib PUBLIC ${REQUIRED_MODULES})
add_executable(birdtray
${EXECUTABLE_OPTIONS} src/main.cpp ${PLATFORM_EXE_SOURCES} ${RESOURCES_SOURCES}
${HEADERS} ${PLATFORM_HEADERS})
target_link_libraries(birdtray birdtray_lib X11)
target_link_libraries(birdtray birdtray_lib)

if(MSVC)
target_compile_options(birdtray_lib PUBLIC /utf-8)
Expand Down Expand Up @@ -247,13 +246,13 @@ else()
install(FILES src/res/birdtray.svg
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps
RENAME com.ulduzsoft.Birdtray.svg)
if(Qt5LinguistTools_FOUND)
if(Qt6LinguistTools_FOUND)
install(DIRECTORY ${CMAKE_BINARY_DIR}/translations
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ulduzsoft/birdtray)
endif()
endif()

if(Qt5LinguistTools_FOUND)
if(Qt6LinguistTools_FOUND)
add_custom_target(clean_translations COMMENT "Remove obsolete translation entries")
foreach(TRANSLATION_FILE ${MAIN_TRANSLATION_FILES})
get_filename_component(TRANSLATION_NAME ${TRANSLATION_FILE} NAME)
Expand All @@ -265,7 +264,7 @@ if(Qt5LinguistTools_FOUND)
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${TRANSLATION_NAME}_lst_file")
endif()
add_custom_command(TARGET clean_translations
COMMAND ${Qt5_LUPDATE_EXECUTABLE}
COMMAND ${Qt6_LUPDATE_EXECUTABLE}
ARGS -locations none -no-obsolete "@${TRANSLATION_LST_FILE}"
-ts ${CMAKE_CURRENT_SOURCE_DIR}/${TRANSLATION_FILE}
DEPENDS ${TRANSLATION_LST_FILE})
Expand Down
2 changes: 1 addition & 1 deletion src/birdtrayapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool BirdtrayApp::loadTranslations() {
[](QString path) { return path.append("/translations"); });
QLocale locale = QLocale::system();
bool success = loadTranslation(
qtTranslator, locale, "qt", {QLibraryInfo::location(QLibraryInfo::TranslationsPath)});
qtTranslator, locale, "qt", {QLibraryInfo::path(QLibraryInfo::TranslationsPath)});
success &= loadTranslation(dynamicTranslator, locale, "dynamic", locations);
success &= loadTranslation(mainTranslator, locale, "main", locations);
return success;
Expand Down
2 changes: 1 addition & 1 deletion src/birdtrayeventfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


bool BirdtrayEventFilter::nativeEventFilter(
const QByteArray &eventType, void *message, long *result) {
const QByteArray &eventType, void *message, qintptr *result) {
if (eventType == "windows_generic_MSG") {
MSG* messageEvent = static_cast<MSG*>(message);
if (messageEvent->message == WM_CLOSE && QApplication::activeWindow() == nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion src/birdtrayeventfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class BirdtrayEventFilter: public QAbstractNativeEventFilter {
public:
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
};


Expand Down
30 changes: 1 addition & 29 deletions src/updatedownloaddialog.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#include "updatedownloaddialog.h"
#include "ui_updatedownloaddialog.h"

#ifdef Q_OS_WIN
# include <QtWinExtras/QWinTaskbarProgress>
#endif

UpdateDownloadDialog::UpdateDownloadDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::UpdateDownloadDialog) {
#ifdef Q_OS_WIN
taskBarButton = new QWinTaskbarButton(this);
#endif
ui->setupUi(this);
actionButton = new QPushButton(tr("Background"), this);
ui->buttonBox->addButton(actionButton, QDialogButtonBox::ButtonRole::ActionRole);
Expand All @@ -20,9 +13,6 @@ UpdateDownloadDialog::UpdateDownloadDialog(QWidget* parent) :
}

UpdateDownloadDialog::~UpdateDownloadDialog() {
#ifdef Q_OS_WIN
delete taskBarButton;
#endif
delete ui;
actionButton->deleteLater();
}
Expand All @@ -33,20 +23,12 @@ void UpdateDownloadDialog::reset() {
ui->label->setText(tr("Downloading Birdtray installer..."));
ui->progressBar->setValue(0);
ui->progressBar->show();
#ifdef Q_OS_WIN
taskBarButton->progress()->reset();
taskBarButton->progress()->show();
#endif
}

void UpdateDownloadDialog::onDownloadComplete() {
downloadCompleted = true;
ui->progressBar->hide();
#ifdef Q_OS_WIN
taskBarButton->progress()->setRange(0, 100);
taskBarButton->progress()->setValue(100);
#endif
actionButton->setText( QCoreApplication::translate("UpdateDialog", "Update and restart"));
actionButton->setText(QCoreApplication::translate("UpdateDialog", "Update and restart"));
ui->label->setText(tr("Download finished. Restart and update Birdtray?"));
show();
raise();
Expand All @@ -57,9 +39,6 @@ void UpdateDownloadDialog::onDownloadProgress(qint64 bytesReceived, qint64 bytes
if (bytesTotal <= 0) {
ui->label->setText(tr("Downloading Birdtray installer..."));
ui->progressBar->setRange(0, 0);
#ifdef Q_OS_WIN
taskBarButton->progress()->setRange(0, 0);
#endif
return;
}
ui->label->setText(
Expand All @@ -69,10 +48,6 @@ void UpdateDownloadDialog::onDownloadProgress(qint64 bytesReceived, qint64 bytes
int percent = qRound((bytesReceived / (double) bytesTotal) * 100.0);
ui->progressBar->setRange(0, 100);
ui->progressBar->setValue(percent);
#ifdef Q_OS_WIN
taskBarButton->progress()->setRange(0, 100);
taskBarButton->progress()->setValue(percent);
#endif
}

bool UpdateDownloadDialog::wasCanceled() const {
Expand All @@ -89,7 +64,4 @@ void UpdateDownloadDialog::onActionPressed() {

void UpdateDownloadDialog::showEvent(QShowEvent* event) {
QDialog::showEvent(event);
#ifdef Q_OS_WIN
taskBarButton->setWindow(windowHandle());
#endif
}
10 changes: 0 additions & 10 deletions src/updatedownloaddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#include <QDialog>
#include <QPushButton>

#ifdef Q_OS_WIN
# include <QtWinExtras/QWinTaskbarButton>
#endif

namespace Ui {
class UpdateDownloadDialog;
Expand Down Expand Up @@ -71,13 +68,6 @@ private Q_SLOTS:
* The first action button.
*/
QPushButton* actionButton;

#ifdef Q_OS_WIN
/**
* The windows task-bar button.
*/
QWinTaskbarButton* taskBarButton = nullptr;
#endif
};

#endif // UPDATE_DOWNLOAD_DIALOG_H
Loading