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

Improve qt6 #1110

Merged
merged 5 commits into from
May 3, 2024
Merged
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
14 changes: 4 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
# CMP0000: Call the cmake_minimum_required() command at the beginning of the top-level
# CMakeLists.txt file even before calling the project() command.
# The cmake_minimum_required(VERSION) command implicitly invokes the cmake_policy(VERSION)
Expand All @@ -9,7 +9,7 @@ project(qterminal)
include(GNUInstallDirs)

# qterminal version
set(QTERMINAL_VERSION "1.4.0")
set(QTERMINAL_VERSION "2.0.0")

option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
option(BUILD_TESTS "Builds tests" ON)
Expand All @@ -22,7 +22,7 @@ endif()

# Minimum Versions
set(LXQTBT_MINIMUM_VERSION "2.0.0")
set(QT_MINIMUM_VERSION "6.3.0")
set(QT_MINIMUM_VERSION "6.6.0")
set(QT_MAJOR_VERSION "6")

find_package(Qt6Core ${QT_MINIMUM_VERSION} REQUIRED)
Expand All @@ -31,7 +31,7 @@ find_package(Qt6LinguistTools ${QT_MINIMUM_VERSION} REQUIRED)
find_package(Qt6Widgets ${QT_MINIMUM_VERSION} REQUIRED)
if(UNIX)
find_package(Qt6DBus ${QT_MINIMUM_VERSION} REQUIRED)
find_package(Qt6 COMPONENTS Core Core5Compat REQUIRED)
find_package(Qt6 COMPONENTS Core REQUIRED)
endif()
find_package(QTermWidget6 ${QTERMWIDGET_MINIMUM_VERSION} REQUIRED)
find_package(lxqt2-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
Expand All @@ -52,11 +52,6 @@ message(STATUS "Qt version: ${Qt6Core_VERSION}")
message(STATUS "Using bundled Qxt...")
set(QXT_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/third-party")


find_path(QTERMWIDGET6_INCLUDE_DIR NAMES qtermwidget6/qtermwidget.h)
add_definitions(-DUSE_QTERMWIDGET6)
include_directories(${QTERMWIDGET6_INCLUDE_DIR})

if(APPLE)
find_library(CARBON_LIBRARY Carbon REQUIRED)
message(STATUS "CARBON_LIBRARY: ${CARBON_LIBRARY}")
Expand Down Expand Up @@ -211,7 +206,6 @@ target_link_libraries(${EXE_NAME}
Qt6::Gui
Qt6::Widgets
qtermwidget6
util
)
if(QXT_FOUND)
target_link_libraries(${EXE_NAME} ${QXT_CORE_LIB} ${QXT_GUI_LIB})
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ This project is licensed under the terms of the [GPLv2](https://www.gnu.org/lice

### Compiling sources

Dependencies are qtx11extras ≥ 5.2 and [QTermWidget](https://github.com/lxqt/qtermwidget).
Dependencies Qt ≥ 6.6.0 and [QTermWidget](https://github.com/lxqt/qtermwidget).
Optional dependencies include [libcanberra](https://0pointer.net/lennart/projects/libcanberra/) for playing bells.
In order to build CMake ≥ 3.1.0 and [lxqt-build-tools](https://github.com/lxqt/lxqt-build-tools) are needed as well as optionally Git to pull latest VCS checkouts.
In order to build CMake ≥ 3.16.0 and [lxqt-build-tools](https://github.com/lxqt/lxqt-build-tools) are needed as well as optionally Git to pull latest VCS checkouts.

Code configuration is handled by CMake. Building out of source is required. CMake variable `CMAKE_INSTALL_PREFIX` will normally have to be set to `/usr`.

Expand Down
8 changes: 5 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <getopt.h>
#include <cstdlib>
#include <unistd.h>
#include <utility>

#ifdef HAVE_QDBUS
#include <QtDBus/QtDBus>
#include "processadaptor.h"
Expand Down Expand Up @@ -175,8 +177,8 @@ int main(int argc, char *argv[])

// install the translations built-into Qt itself
QTranslator qtTranslator;
qtTranslator.load(QStringLiteral("qt_") + QLocale::system().name(), QLibraryInfo::path(QLibraryInfo::TranslationsPath));
app->installTranslator(&qtTranslator);
if (qtTranslator.load(QStringLiteral("qt_") + QLocale::system().name(), QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
app->installTranslator(&qtTranslator);

QTranslator translator;
QString fname = QString::fromLatin1("qterminal_%1.qm").arg(QLocale::system().name().left(5));
Expand Down Expand Up @@ -297,7 +299,7 @@ void QTerminalApp::registerOnDbus()
QList<QDBusObjectPath> QTerminalApp::getWindows()
{
QList<QDBusObjectPath> windows;
for (MainWindow *wnd : qAsConst(m_windowList))
for (MainWindow *wnd : std::as_const(m_windowList))
{
windows.push_back(wnd->getDbusPath());
}
Expand Down
6 changes: 1 addition & 5 deletions src/termwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
#ifndef TERMWIDGET_H
#define TERMWIDGET_H

#ifdef USE_QTERMWIDGET5
#include <qtermwidget5/qtermwidget.h>
#elif defined(USE_QTERMWIDGET6)
#include <qtermwidget6/qtermwidget.h>
#endif
#include <qtermwidget6/qtermwidget.h>

#include "terminalconfig.h"

Expand Down
4 changes: 2 additions & 2 deletions src/termwidgetholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void TermWidgetHolder::directionalNavigation(NavigationDirection dir) {
// Find an active widget
QList<TermWidget*> l = findChildren<TermWidget*>();
int ix = -1;
for (TermWidget * w : qAsConst(l))
for (TermWidget * w : std::as_const(l))
{
++ix;
if (w->impl()->hasFocus())
Expand Down Expand Up @@ -231,7 +231,7 @@ void TermWidgetHolder::directionalNavigation(NavigationDirection dir) {
int lowestX = INT_MAX;
int lowestMidpointDistance = INT_MAX;
TermWidget *fittest = nullptr;
for (TermWidget * w : qAsConst(l))
for (TermWidget * w : std::as_const(l))
{
NavigationData contenderDims = getNormalizedDimensions(w, dir);
int midpointDistance = std::min(
Expand Down
4 changes: 3 additions & 1 deletion src/third-party/qxtglobalshortcut_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <xcb/xcb.h>
#include <X11/Xlib.h>

#include <utility>

namespace {

const QVector<quint32> maskModifiers = QVector<quint32>()
Expand Down Expand Up @@ -135,7 +137,7 @@ class QxtX11Data {
{
QxtX11ErrorHandler errorHandler;

for (const quint32& maskMods : qAsConst(maskModifiers)) {
for (const quint32& maskMods : std::as_const(maskModifiers)) {
XUngrabKey(display(), keycode, modifiers | maskMods, window);
}

Expand Down
Loading