Remove Qt5 support

Co-authored-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
sithlord48
2024-10-03 22:29:05 -04:00
committed by Povilas Kanapickas
parent 56fb20015e
commit dca18564bb
19 changed files with 17 additions and 120 deletions

View File

@@ -156,8 +156,7 @@ jobs:
- name: Run build
if: env.B_BUILD_TYPE != 'Release'
run: |
cmake -DCMAKE_BUILD_TYPE="${B_BUILD_TYPE}" -S input-leap -B build \
-DQT_DEFAULT_MAJOR_VERSION=5 \
cmake -DCMAKE_BUILD_TYPE="${B_BUILD_TYPE}" -S input-leap -B build -G Ninja \
-DCMAKE_CXX_FLAGS:STRING="-Wall -Wextra -Wno-unused-parameter" \
-DCMAKE_CXX_FLAGS_DEBUG:STRING="-g -Werror" \
-DINPUTLEAP_BUILD_LIBEI:BOOL=${{ matrix.wayland }} \
@@ -261,8 +260,8 @@ jobs:
include:
- name: macOS-x86_64
os: macos-12
qt-version: 5.15
min-macOS-version: 10.9
qt-version: 6.6
min-macOS-version: 10.15
arch: 'x86_64'
- name: macOS-Universal
os: macos-12
@@ -331,7 +330,7 @@ jobs:
run: |
cmake -DCMAKE_BUILD_TYPE="${B_BUILD_TYPE}" -S input-leap -B build -G Ninja -DOpenSSL_ROOT=${{env.OpenSSL_Install_Path}} \
-DCMAKE_OSX_SYSROOT=$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${{matrix.min-macOS-version}} -DCMAKE_UNITY_BUILD=1 -DQT_DEFAULT_MAJOR_VERSION=$(echo ${{matrix.qt-version}} | cut -c -1) \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${{matrix.min-macOS-version}} -DCMAKE_UNITY_BUILD=1 \
-DCMAKE_OSX_ARCHITECTURES="${{matrix.arch}}"
- name: Run the build
@@ -364,14 +363,9 @@ jobs:
fail-fast: false
matrix:
include:
- name: Windows Qt5
os: windows-2019
qt-version: 5.15
qt-major: 5
- name: Windows Qt6
os: windows-2022
qt-version: 6.6
qt-major: 6
steps:
- uses: actions/checkout@v4
@@ -406,7 +400,6 @@ jobs:
cd build
cmake -S ..\input-leap -G "$env:CMAKE_GEN" -A x64 -D CMAKE_BUILD_TYPE=$B_BUILD_TYPE `
-DQT_DEFAULT_MAJOR_VERSION=${{matrix.qt-major}} `
-DDNSSD_LIB="$env:BONJOUR_SDK_HOME\Lib\x64\dnssd.lib" -D CMAKE_INSTALL_PREFIX=input-leap-install
env:
VS_PATH: ${{ matrix.os == 'windows-2019' && '%ProgramFiles(x86)%\Microsoft Visual Studio\2019' || '%ProgramFiles%\Microsoft Visual Studio\2022' }}

View File

@@ -24,6 +24,7 @@ option(INPUTLEAP_USE_EXTERNAL_GTEST "Use external installation of Google Test fr
option(INPUTLEAP_BUILD_X11 "Build with XWindows support" ON)
option(INPUTLEAP_BUILD_LIBEI "Build with libei support" OFF)
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
@@ -33,16 +34,6 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions (-DNDEBUG)
endif()
if(NOT QT_DEFAULT_MAJOR_VERSION)
set(QT_DEFAULT_MAJOR_VERSION 6)
endif()
if(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif()
include (cmake/Version.cmake)
include (cmake/Package.cmake)
@@ -68,14 +59,9 @@ if (HAVE_WFORMAT)
endif()
if (INPUTLEAP_BUILD_GUI)
if (QT_DEFAULT_MAJOR_VERSION EQUAL 5)
set(REQUIRED_QT_VERSION 5.9)
elseif (QT_DEFAULT_MAJOR_VERSION EQUAL 6)
set(REQUIRED_QT_VERSION 6.2)
endif()
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Core REQUIRED)
get_target_property(qmake_executable Qt${QT_DEFAULT_MAJOR_VERSION}::qmake IMPORTED_LOCATION)
find_package(Qt6 COMPONENTS Core REQUIRED)
get_target_property(qmake_executable Qt6::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY)
if(WIN32)
set(deployqtapp windeployqt)

View File

@@ -54,11 +54,7 @@ $build_type = 'Release';
if ($env:B_BUILD_TYPE -ne $null) {
$build_type = $env:B_BUILD_TYPE;
}
$qt_major_version = '6';
if ($env:B_QT_MAJOR_VERSION -ne $null) {
$qt_major_version = $env:B_QT_MAJOR_VERSION;
}
$qt_root = (Resolve-Path C:\Qt\$qt_major_version*\* 2>$null).Path;
$qt_root = (Resolve-Path C:\Qt\6*\* 2>$null).Path;
if ($env:B_QT_ROOT -ne $null) {
$qt_root = $env:B_QT_ROOT;
} elseif ($qt_root -eq $null) {
@@ -79,7 +75,6 @@ try {
cmake .. -G "$vs_version" -A x64 `
"-DCMAKE_BUILD_TYPE=$build_type" `
"-DCMAKE_PREFIX_PATH=$qt_root" `
"-DQT_DEFAULT_MAJOR_VERSION=$qt_major_version" `
-DDNSSD_LIB="$bonjour_path\Lib\x64\dnssd.lib" `
-DCMAKE_INSTALL_PREFIX=input-leap-install

1
dist/debian/rules vendored
View File

@@ -15,7 +15,6 @@ ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
else ifeq (,$(filter amd64 i386,$(DEB_HOST_ARCH)))
CONFIGURE_FLAGS += -DINPUTLEAP_BUILD_TESTS=no
endif
CONFIGURE_FLAGS += -DQT_DEFAULT_MAJOR_VERSION=6
%:
dh $@ --builddirectory=builddir

View File

@@ -119,7 +119,6 @@ modules:
- name: input-leap
buildsystem: cmake
config-opts:
- -DQT_DEFAULT_MAJOR_VERSION=6
- -DINPUTLEAP_BUILD_GUI=ON
- -DINPUTLEAP_BUILD_TESTS=OFF
- -DINPUTLEAP_BUILD_X11=ON # FIXME: undefined reference to `XWindowsUtil::mapKeySymToKeyID otherwise

View File

@@ -0,0 +1 @@
Minimum MacOS version has been increased to 10.15.

View File

@@ -1,7 +1,5 @@
find_package (Qt${QT_DEFAULT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} COMPONENTS Core Widgets Network LinguistTools REQUIRED)
message(STATUS "Using Qt ${QT_DEFAULT_MAJOR_VERSION}")
find_package (Qt6 ${REQUIRED_QT_VERSION} COMPONENTS Core Widgets Network LinguistTools REQUIRED)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON)
@@ -164,11 +162,7 @@ set(TS_FILES
)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/res/lang")
if (QT_DEFAULT_MAJOR_VERSION EQUAL 5)
qt5_add_translation(QM_FILES ${TS_FILES} OPTIONS -silent)
else()
qt_add_translation(QM_FILES ${TS_FILES} OPTIONS -silent)
endif()
qt_add_translation(QM_FILES ${TS_FILES} OPTIONS -silent)
# The following file includes X11 headers that later break Qt headers.
set_source_files_properties("src/DisplayIsValid.cpp" PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
@@ -195,9 +189,9 @@ target_link_libraries(input-leap
arch
base
io
Qt${QT_DEFAULT_MAJOR_VERSION}::Core
Qt${QT_DEFAULT_MAJOR_VERSION}::Widgets
Qt${QT_DEFAULT_MAJOR_VERSION}::Network
Qt6::Core
Qt6::Widgets
Qt6::Network
)
target_link_libraries(input-leap OpenSSL::SSL OpenSSL::Crypto)
@@ -266,5 +260,5 @@ if(INPUTLEAP_BUILD_TESTS)
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
target_include_directories(guiunittests PUBLIC ../../ext)
target_link_libraries(guiunittests gtest gmock Qt${QT_DEFAULT_MAJOR_VERSION}::Core Qt${QT_DEFAULT_MAJOR_VERSION}::Widgets Qt${QT_DEFAULT_MAJOR_VERSION}::Network ${libs})
target_link_libraries(guiunittests gtest gmock Qt6::Core Qt6::Widgets Qt6::Network ${libs})
endif()

View File

@@ -31,11 +31,7 @@ m_Enabled(false)
{
m_Socket = new QTcpSocket(this);
connect(m_Socket, &QTcpSocket::connected, this, &IpcClient::connected);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
connect(m_Socket, &QTcpSocket::errorOccurred, this, &IpcClient::error);
#else
connect(m_Socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError)));
#endif
m_Reader = new IpcReader(m_Socket);
connect(m_Reader, &IpcReader::readLogLine, this, &IpcClient::handleReadLogLine);

View File

@@ -191,11 +191,7 @@ QString KeySequence::keyToString(int key)
{
case Qt::LeftButton: return "1";
case Qt::RightButton: return "2";
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
case Qt::MiddleButton: return "3";
#else
case Qt::MidButton: return "3";
#endif
default:
break;
}

View File

@@ -390,11 +390,7 @@ void MainWindow::logOutput()
if (cmd_app_process_)
{
QString text(cmd_app_process_->readAllStandardOutput());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const auto results = text.split(QRegularExpression("\r|\n|\r\n"));
#else
const auto results = text.split(QRegExp("\r|\n|\r\n"));
#endif
for (const auto& line : results) {
if (!line.isEmpty())
{
@@ -1245,11 +1241,7 @@ bool MainWindow::isServiceRunning(QString name)
auto array = name.toLocal8Bit();
#if QT_VERSION_MAJOR < 6
SC_HANDLE hService = OpenService(hSCManager, array.data(), SERVICE_QUERY_STATUS);
#else
SC_HANDLE hService = OpenService(hSCManager, reinterpret_cast<LPCWSTR>(array.data()), SERVICE_QUERY_STATUS);
#endif
if (hService == nullptr) {
appendLogDebug("failed to open service: " + name);
return false;
@@ -1335,12 +1327,7 @@ void MainWindow::downloadBonjour()
void MainWindow::installBonjour()
{
#if defined(Q_OS_WIN)
#if QT_VERSION >= 0x050000
QString tempLocation = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
#else
QString tempLocation = QDesktopServices::storageLocation(
QDesktopServices::TempLocation);
#endif
QString filename = tempLocation;
filename.append("\\").append(bonjourTargetFilename);
QFile file(filename);

View File

@@ -43,10 +43,8 @@ void NewScreenWidget::mousePressEvent(QMouseEvent* event)
pDrag->setPixmap(
#if QT_VERSION >= QT_VERSION_CHECK(6,6,0)
pixmap()
#elif QT_VERSION >= QT_VERSION_CHECK(5,15,0)
pixmap(Qt::ReturnByValue)
#else
*pixmap()
pixmap(Qt::ReturnByValue)
#endif
);
pDrag->setHotSpot(event->pos());

View File

@@ -56,7 +56,7 @@ void QInputLeapApplication::switchTranslator(QString lang)
QResource locale(":/res/lang/gui_" + lang + ".qm");
translator_ = std::make_unique<QTranslator>();
translator_->load(locale.data(), locale.size());
std::ignore = translator_->load(locale.data(), locale.size());
installTranslator(translator_.get());
}

View File

@@ -163,11 +163,7 @@ QDataStream& operator>>(QDataStream& inStream, Screen& screen)
;
screen.m_Modifiers.clear();
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
auto const mods = std::as_const(modifiers);
#else
auto const mods = qAsConst(modifiers);
#endif
for (auto mod : mods) {
screen.m_Modifiers.push_back(static_cast<Screen::Modifier>(mod));
}

View File

@@ -38,11 +38,7 @@ static QString check_name_param(QString name)
// be translated with spaces (or other chars). let's replace the spaces
// with dashes and just give up if that doesn't pass the regexp
name.replace(' ', '-');
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (ValidScreenName.match(name).isValid())
#else
if (ValidScreenName.exactMatch(name))
#endif
return name;
return "";
}
@@ -55,18 +51,10 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) :
ui_->setupUi(this);
ui_->m_pLineEditName->setText(check_name_param(m_pScreen->name()));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
ui_->m_pLineEditName->setValidator(new QRegularExpressionValidator(ValidScreenName, ui_->m_pLineEditName));
#else
ui_->m_pLineEditName->setValidator(new QRegExpValidator(ValidScreenName, ui_->m_pLineEditName));
#endif
ui_->m_pLineEditName->selectAll();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
ui_->m_pLineEditAlias->setValidator(new QRegularExpressionValidator(ValidScreenName, ui_->m_pLineEditName));
#else
ui_->m_pLineEditAlias->setValidator(new QRegExpValidator(ValidScreenName, ui_->m_pLineEditName));
#endif
for (int i = 0; i < m_pScreen->aliases().count(); i++)
new QListWidgetItem(m_pScreen->aliases()[i], ui_->m_pListAliases);

View File

@@ -68,11 +68,7 @@ QVariant ScreenSetupModel::data(const QModelIndex& index, int role) const
Qt::ItemFlags ScreenSetupModel::flags(const QModelIndex& index) const
{
if (!index.isValid() || index.row() >= m_NumRows || index.column() >= m_NumColumns) {
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
return Qt::ItemFlags();
#else
return nullptr;
#endif
}
if (!screen(index).isNull())

View File

@@ -171,13 +171,8 @@ void ScreenSetupView::dragMoveEvent(QDragMoveEvent* event)
}
else
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
int col = columnAt(event->position().x());
int row = rowAt(event->position().y());
#else
int col = columnAt(event->pos().x());
int row = rowAt(event->pos().y());
#endif
// a drop from outside is not allowed if there's a screen already there.
if (!model()->screen(col, row).isNull())
event->ignore();
@@ -220,7 +215,6 @@ void ScreenSetupView::startDrag(Qt::DropActions)
}
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void ScreenSetupView::initViewItemOption(QStyleOptionViewItem *option) const
{
option->showDecorationSelected = true;
@@ -228,14 +222,3 @@ void ScreenSetupView::initViewItemOption(QStyleOptionViewItem *option) const
option->displayAlignment = Qt::AlignCenter;
option->textElideMode = Qt::ElideMiddle;
}
#else
QStyleOptionViewItem ScreenSetupView::viewOptions() const
{
QStyleOptionViewItem option = QTableView::viewOptions();
option.showDecorationSelected = true;
option.decorationPosition = QStyleOptionViewItem::Top;
option.displayAlignment = Qt::AlignCenter;
option.textElideMode = Qt::ElideMiddle;
return option;
}
#endif

View File

@@ -48,11 +48,7 @@ class ScreenSetupView : public QTableView
void dragEnterEvent(QDragEnterEvent* event) override;
void dragMoveEvent(QDragMoveEvent* event) override;
void startDrag(Qt::DropActions supportedActions) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void initViewItemOption(QStyleOptionViewItem *option) const override;
#else
QStyleOptionViewItem viewOptions() const override;
#endif
void scrollTo(const QModelIndex&, ScrollHint) override {}
private:
void enter(const QModelIndex&);

View File

@@ -53,11 +53,7 @@ static void silence_avahi_warning()
const char *name = "AVAHI_COMPAT_NOWARN";
const char *value = "1";
#ifdef _WIN32
#if QT_VERSION_MAJOR < 6
SetEnvironmentVariable(name, value);
#else
SetEnvironmentVariable(reinterpret_cast<LPCWSTR>(name), reinterpret_cast<LPCWSTR>(value));
#endif
#else
setenv(name, value, 1);
#endif

View File

@@ -88,9 +88,7 @@ int main(int argc, char* argv[])
QInputLeapApplication app(argc, argv);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
app.setDesktopFileName(QStringLiteral("io.github.input_leap.InputLeap"));
#endif
#if defined(Q_OS_MAC)
if (app.applicationDirPath().startsWith("/Volumes/")) {