From 2b558bd79524742f9b88228230e745ed36d6f52e Mon Sep 17 00:00:00 2001 From: wolfseifert Date: Tue, 17 Jan 2023 16:26:22 +0100 Subject: [PATCH 01/76] Reason: --- CMakeLists.txt | 10 +++++----- dep/openssl/openssl | 2 +- dep/scintilla/CMakeLists.txt | 2 +- l10n/CMakeLists.txt | 4 ++-- pack/CMakeLists.txt | 10 +++++----- src/app/CMakeLists.txt | 8 ++++---- src/app/Gittyup.cpp | 2 -- src/cli/CMakeLists.txt | 2 +- src/conf/CMakeLists.txt | 2 +- src/conf/Settings.cpp | 5 +++-- src/cred/CMakeLists.txt | 4 +++- src/dialogs/CMakeLists.txt | 4 +++- src/dialogs/ConfigDialog.cpp | 3 ++- src/dialogs/DeleteBranchDialog.cpp | 3 ++- src/dialogs/DeleteTagDialog.cpp | 3 ++- src/dialogs/DiffPanel.cpp | 19 ++++++++++++++---- src/dialogs/IconLabel.cpp | 3 +-- src/dialogs/SettingsDialog.cpp | 1 + src/editor/PlatQt.cpp | 2 +- src/editor/ScintillaQt.cpp | 15 +++++++------- src/git/CMakeLists.txt | 2 +- src/git/Commit.cpp | 8 +++++--- src/git/Commit.h | 1 + src/git/Diff.cpp | 6 +++--- src/git/Diff.h | 2 +- src/git/Index.cpp | 2 +- src/git/Remote.cpp | 4 ++-- src/git/Repository.cpp | 9 ++++----- src/git/Repository.h | 3 ++- src/git/Signature.cpp | 2 +- src/git/Signature.h | 2 +- src/host/CMakeLists.txt | 2 +- src/host/Repository.h | 1 + src/index/CMakeLists.txt | 6 +++--- src/index/Query.cpp | 18 +++++++---------- src/index/indexer.cpp | 10 +++------- src/log/CMakeLists.txt | 2 +- src/log/LogDelegate.cpp | 4 ++-- src/log/LogModel.cpp | 1 + src/log/LogView.cpp | 9 ++++++--- src/plugins/CMakeLists.txt | 2 +- src/tools/CMakeLists.txt | 2 +- src/tools/DiffTool.cpp | 2 +- src/tools/MergeTool.cpp | 2 +- src/ui/AdvancedSearchWidget.cpp | 3 +-- src/ui/BlameEditor.cpp | 5 ++--- src/ui/BlameMargin.cpp | 14 ++++++------- src/ui/CMakeLists.txt | 6 +++--- src/ui/ColumnView.cpp | 4 ++-- src/ui/CommitList.cpp | 14 +++++++++---- src/ui/CommitToolBar.cpp | 1 + src/ui/DetailView.cpp | 15 +++++++------- src/ui/DiffView/HunkWidget.cpp | 4 ++-- src/ui/DiffView/Images.cpp | 2 +- src/ui/FindWidget.cpp | 2 +- src/ui/MainWindow.cpp | 1 - src/ui/MenuBar.cpp | 2 +- src/ui/ReferenceView.cpp | 3 ++- src/ui/RepoView.cpp | 7 ++++--- src/ui/SpellChecker.cpp | 32 +++++++++++++++++++----------- src/ui/SpellChecker.h | 3 ++- src/ui/ToolBar.cpp | 5 +++-- src/ui/TreeView.cpp | 5 +++-- src/ui/ViewDelegate.cpp | 2 +- src/update/CMakeLists.txt | 6 +++--- src/update/relauncher.cpp | 2 +- src/util/CMakeLists.txt | 2 +- src/watcher/CMakeLists.txt | 2 +- test/CMakeLists.txt | 6 +++--- 69 files changed, 195 insertions(+), 159 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b1d8f32a..acaadab1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,12 +114,12 @@ else() endif() find_package( - Qt5 5.12 + Qt6 COMPONENTS ${QT_MODULES} LinguistTools REQUIRED) if(FLATPAK) find_package( - Qt5 5.15 + Qt6 COMPONENTS XcbQpa REQUIRED) add_compile_definitions(FLATPAK) @@ -135,7 +135,7 @@ endif() include(GNUInstallDirs) # Defines some variables as BINDIR, LIBDIR, ... -set(QT_TRANSLATIONS_DIR "${Qt5_DIR}/../../../translations") +set(QT_TRANSLATIONS_DIR "${Qt6_DIR}/../../../translations") set(QT_TRANSLATIONS_DIR "/usr/share/qt/translations") if(APPLE) @@ -145,8 +145,8 @@ if(APPLE) # dependencies are to the release libraries (e.g. QtGui_debug depends on # QtCore). This causes multiple symbol definition errors at application load # time. - get_target_property(LOCATION Qt5::${QT_MODULE} LOCATION) - set_target_properties(Qt5::${QT_MODULE} PROPERTIES IMPORTED_LOCATION_DEBUG + get_target_property(LOCATION Qt6::${QT_MODULE} LOCATION) + set_target_properties(Qt6::${QT_MODULE} PROPERTIES IMPORTED_LOCATION_DEBUG ${LOCATION}) endforeach() endif() diff --git a/dep/openssl/openssl b/dep/openssl/openssl index 3f499b24f..29708a562 160000 --- a/dep/openssl/openssl +++ b/dep/openssl/openssl @@ -1 +1 @@ -Subproject commit 3f499b24f3bcd66db022074f7e8b4f6ee266a3ae +Subproject commit 29708a562a1887a91de0fa6ca668c71871accde9 diff --git a/dep/scintilla/CMakeLists.txt b/dep/scintilla/CMakeLists.txt index a7a11972c..9de63ddd1 100644 --- a/dep/scintilla/CMakeLists.txt +++ b/dep/scintilla/CMakeLists.txt @@ -54,7 +54,7 @@ target_compile_definitions( target_include_directories(scintilla PUBLIC ${SCINTILLA_DIR}/src) -target_link_libraries(scintilla Qt5::Widgets lexilla) +target_link_libraries(scintilla Qt6::Widgets lexilla) set_target_properties(scintilla PROPERTIES AUTOMOC ON) diff --git a/l10n/CMakeLists.txt b/l10n/CMakeLists.txt index 92f701f53..50512fa5b 100644 --- a/l10n/CMakeLists.txt +++ b/l10n/CMakeLists.txt @@ -20,9 +20,9 @@ endforeach() if(UPDATE_TRANSLATIONS) # FIXME: Clean removes the .ts files. - qt5_create_translation(QM_FILES ${SOURCE_FILES} ${TS_FILES}) + qt6_create_translation(QM_FILES ${SOURCE_FILES} ${TS_FILES}) else() - qt5_add_translation(QM_FILES ${TS_FILES}) + qt6_add_translation(QM_FILES ${TS_FILES}) endif() add_custom_target(translations DEPENDS ${QM_FILES}) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index c9b5f4de4..5b72c6abd 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -28,13 +28,13 @@ if(FLATPAK) qt_import_plugins(gittyup INCLUDE ${QT_PLUGINS}) elseif(NOT USE_SYSTEM_QT) foreach(QT_PLUGIN ${QT_PLUGINS}) - if(NOT TARGET Qt5::${QT_PLUGIN}) + if(NOT TARGET Qt6::${QT_PLUGIN}) if(UNIX OR APPLE) continue() endif() endif() - get_target_property(PLUGIN Qt5::${QT_PLUGIN} LOCATION_${CMAKE_BUILD_TYPE}) + get_target_property(PLUGIN Qt6::${QT_PLUGIN} LOCATION_${CMAKE_BUILD_TYPE}) get_filename_component(FILE_NAME ${PLUGIN} NAME) get_filename_component(DIR ${PLUGIN} DIRECTORY) get_filename_component(DIR_NAME ${DIR} NAME) @@ -78,7 +78,7 @@ elseif(NOT USE_SYSTEM_QT) # Install Qt libraries. foreach(QT_MODULE ${QT_MODULES}) - get_target_property(QT_LIBRARY Qt5::${QT_MODULE} + get_target_property(QT_LIBRARY Qt6::${QT_MODULE} LOCATION_${CMAKE_BUILD_TYPE}) if(APPLE) @@ -131,8 +131,8 @@ endif() # Install XcbQpa library. if(UNIX AND NOT APPLE) - set(LIB_NAME libQt5XcbQpa) - get_target_property(QT_CORE_LIBRARY Qt5::Core LOCATION) + set(LIB_NAME libQt6XcbQpa) + get_target_property(QT_CORE_LIBRARY Qt6::Core LOCATION) get_filename_component(LIB_PATH ${QT_CORE_LIBRARY} PATH) get_filename_component(LIB_EXT ${QT_CORE_LIBRARY} EXT) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 9781eef49..38247e1df 100755 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -22,7 +22,7 @@ file(GLOB SCINTILLUA_LEXERS ${SRC_SCINTILLUA_LEXERS_DIR}/*.lua) file(GLOB LUA_PLUGINS ${CONF_DIR}/plugins/*.lua ${CONF_DIR}/plugins/*.txt) # Build resources. -qt5_add_resources(RESOURCES ${RSRC_DIR}/resources.qrc) +qt6_add_resources(RESOURCES ${RSRC_DIR}/resources.qrc) # Generate acknowledgments. set(DOC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/docs) @@ -67,12 +67,12 @@ target_compile_definitions( PRIVATE QT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}" BUILD_DESCRIPTION="${BUILD_DESCRIPTION}") -target_link_libraries(app conf git ui update Qt5::Widgets) +target_link_libraries(app conf git ui update Qt6::Widgets) set_target_properties(app PROPERTIES AUTOMOC ON) if(UNIX AND NOT APPLE) - target_link_libraries(app Qt5::DBus) + target_link_libraries(app Qt6::DBus) endif() # Add main executable. @@ -164,7 +164,7 @@ install( COMPONENT ${GITTYUP_NAME}) if(APPLE) - get_target_property(QT_LIBRARY Qt5::Core LOCATION) + get_target_property(QT_LIBRARY Qt6::Core LOCATION) get_filename_component(QT_FRAMEWORK ${QT_LIBRARY} DIRECTORY) get_filename_component(RPATH ${QT_FRAMEWORK} DIRECTORY) diff --git a/src/app/Gittyup.cpp b/src/app/Gittyup.cpp index 69649f8c2..5238195e7 100644 --- a/src/app/Gittyup.cpp +++ b/src/app/Gittyup.cpp @@ -13,8 +13,6 @@ #include int main(int argc, char *argv[]) { - Application::setAttribute(Qt::AA_EnableHighDpiScaling); - Application::setAttribute(Qt::AA_UseHighDpiPixmaps); Application app(argc, argv, true); // Check if only one running instance is allowed and already running diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt index 74dcd7e16..156fc39bf 100644 --- a/src/cli/CMakeLists.txt +++ b/src/cli/CMakeLists.txt @@ -7,4 +7,4 @@ endif() add_library(cli Installer.cpp ${INSTALLER_IMPL_FILE}) -target_link_libraries(cli Qt5::Core ${INSTALLER_IMPL_LIBS}) +target_link_libraries(cli Qt6::Core ${INSTALLER_IMPL_LIBS}) diff --git a/src/conf/CMakeLists.txt b/src/conf/CMakeLists.txt index f1c536061..2f49de8c6 100644 --- a/src/conf/CMakeLists.txt +++ b/src/conf/CMakeLists.txt @@ -1,7 +1,7 @@ add_library(conf ConfFile.cpp Settings.cpp Setting.cpp RecentRepositories.cpp RecentRepository.cpp) -target_link_libraries(conf lua Qt5::Core util) +target_link_libraries(conf lua Qt6::Core util) # SRC_ definitions point to the source directly target_compile_definitions( diff --git a/src/conf/Settings.cpp b/src/conf/Settings.cpp index 6c2de3c36..5e5f92291 100644 --- a/src/conf/Settings.cpp +++ b/src/conf/Settings.cpp @@ -13,6 +13,7 @@ #include "qtsupport.h" #include #include +#include #include #include @@ -117,8 +118,8 @@ QString Settings::lexer(const QString &filename) { QVariantMap map(lexers.value(key).toMap()); if (map.contains("patterns")) { foreach (QString pattern, map.value("patterns").toString().split(",")) { - QRegExp regExp(pattern, CS, QRegExp::Wildcard); - if (regExp.exactMatch(name)) + QRegularExpression regExp{QRegularExpression::fromWildcard(pattern, CS)}; + if (regExp.match(name).hasMatch()) return key; } } diff --git a/src/cred/CMakeLists.txt b/src/cred/CMakeLists.txt index e3516b2a6..9f686fde8 100644 --- a/src/cred/CMakeLists.txt +++ b/src/cred/CMakeLists.txt @@ -1,5 +1,7 @@ add_library(cred Cache.cpp Store.cpp CredentialHelper.cpp GitCredential.cpp) -target_link_libraries(cred conf git Qt5::Core) +target_link_libraries(cred conf git Qt6::Core) +add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp + ${CREDENTIAL_IMPL_FILE}) set_target_properties(cred PROPERTIES AUTOMOC ON) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index 0295257e2..65b307b08 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -39,6 +39,8 @@ target_compile_definitions( target_include_directories(dialogs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +find_package(Qt6 COMPONENTS Core5Compat REQUIRED) + target_link_libraries( dialogs cli @@ -46,6 +48,6 @@ target_link_libraries( cred host index - Qt5::Widgets) + Qt6::Widgets) set_target_properties(dialogs PROPERTIES AUTOMOC ON) diff --git a/src/dialogs/ConfigDialog.cpp b/src/dialogs/ConfigDialog.cpp index 7327532f2..a1844c109 100644 --- a/src/dialogs/ConfigDialog.cpp +++ b/src/dialogs/ConfigDialog.cpp @@ -30,6 +30,7 @@ #include "ui/MainWindow.h" #include "ui/RepoView.h" #include +#include #include #include #include @@ -506,7 +507,7 @@ class LfsPanel : public QWidget { watcher->deleteLater(); }); - watcher->setFuture(QtConcurrent::run(repo, &git::Repository::lfsTracked)); + watcher->setFuture(QtConcurrent::run(&git::Repository::lfsTracked, repo)); Footer *footer = new Footer(includedList); connect(footer, &Footer::plusClicked, this, diff --git a/src/dialogs/DeleteBranchDialog.cpp b/src/dialogs/DeleteBranchDialog.cpp index 20741b0c3..79a3f0566 100644 --- a/src/dialogs/DeleteBranchDialog.cpp +++ b/src/dialogs/DeleteBranchDialog.cpp @@ -61,8 +61,9 @@ DeleteBranchDialog::DeleteBranchDialog(const git::Branch &branch, entry->setBusy(true); QStringList refspecs(QString(":%1").arg(upstreamName)); + git::Result (git::Remote::*push)(git::Remote::Callbacks*, const QStringList&) = &git::Remote::push; watcher->setFuture( - QtConcurrent::run(remote, &git::Remote::push, callbacks, refspecs)); + QtConcurrent::run(push, remote, callbacks, refspecs)); connect(watcher, &QFutureWatcher::finished, watcher, [entry, watcher, callbacks, remoteName] { diff --git a/src/dialogs/DeleteTagDialog.cpp b/src/dialogs/DeleteTagDialog.cpp index cd0db7af9..1e46bfe3f 100644 --- a/src/dialogs/DeleteTagDialog.cpp +++ b/src/dialogs/DeleteTagDialog.cpp @@ -53,8 +53,9 @@ DeleteTagDialog::DeleteTagDialog(const git::TagRef &tag, QWidget *parent) entry->setBusy(true); QStringList refspecs(QString(":refs/tags/%1").arg(name)); + git::Result (git::Remote::*push)(git::Remote::Callbacks*, const QStringList&) = &git::Remote::push; watcher->setFuture( - QtConcurrent::run(remote, &git::Remote::push, callbacks, refspecs)); + QtConcurrent::run(push, remote, callbacks, refspecs)); connect(watcher, &QFutureWatcher::finished, watcher, [entry, watcher, callbacks, remoteName] { diff --git a/src/dialogs/DiffPanel.cpp b/src/dialogs/DiffPanel.cpp index ddf55827c..54f31df2f 100644 --- a/src/dialogs/DiffPanel.cpp +++ b/src/dialogs/DiffPanel.cpp @@ -21,7 +21,6 @@ #include #include #include -#include DiffPanel::DiffPanel(const git::Repository &repo, QWidget *parent) : QWidget(parent), @@ -45,12 +44,24 @@ DiffPanel::DiffPanel(const git::Repository &repo, QWidget *parent) }); // encoding + + static std::array encodings{ + "Utf8", + "Utf16", + "Utf16LE", + "Utf16BE", + "Utf32", + "Utf32LE", + "Utf32BE", + "Latin1", + }; + QComboBox *encoding = new QComboBox(this); encoding->addItem(tr("System Locale"), -1); encoding->insertSeparator(encoding->count()); - foreach (int mib, QTextCodec::availableMibs()) - encoding->addItem(QTextCodec::codecForMib(mib)->name(), mib); - + for (int i = 0; i < encodings.size(); i++) { + encoding->addItem(encodings[i], i); + } QString name = mConfig.value("gui.encoding"); if (!name.isEmpty()) encoding->setCurrentIndex(encoding->findText(name)); diff --git a/src/dialogs/IconLabel.cpp b/src/dialogs/IconLabel.cpp index 6bd33e1f0..ac7d418de 100644 --- a/src/dialogs/IconLabel.cpp +++ b/src/dialogs/IconLabel.cpp @@ -22,8 +22,7 @@ QSize IconLabel::minimumSizeHint() const { return sizeHint(); } void IconLabel::paintEvent(QPaintEvent *event) { QSize size = sizeHint(); - QWidget *win = window(); QPainter(this).drawPixmap( QStyle::alignedRect(Qt::LeftToRight, Qt::AlignHCenter, size, rect()), - mIcon.pixmap(win ? win->windowHandle() : nullptr, size)); + mIcon.pixmap(size, window()->devicePixelRatio())); } diff --git a/src/dialogs/SettingsDialog.cpp b/src/dialogs/SettingsDialog.cpp index 882f4cfa3..ecb45f91c 100644 --- a/src/dialogs/SettingsDialog.cpp +++ b/src/dialogs/SettingsDialog.cpp @@ -27,6 +27,7 @@ #include "ui/RepoView.h" #include "update/Updater.h" #include +#include #include #include #include diff --git a/src/editor/PlatQt.cpp b/src/editor/PlatQt.cpp index e054f5cec..f288d2e47 100644 --- a/src/editor/PlatQt.cpp +++ b/src/editor/PlatQt.cpp @@ -329,7 +329,7 @@ void SurfaceImpl::MeasureWidths(Font &font, std::string_view s, XYPOSITION SurfaceImpl::WidthText(Font &font, std::string_view s) { QFontMetricsF metrics(*static_cast(font.GetID()), device); - return metrics.width(QString::fromUtf8(s.data(), s.length())); + return metrics.horizontalAdvance(QString::fromUtf8(s.data(), s.length())); } XYPOSITION SurfaceImpl::Ascent(Font &font) { diff --git a/src/editor/ScintillaQt.cpp b/src/editor/ScintillaQt.cpp index 5df0cc9f9..34fa321f7 100644 --- a/src/editor/ScintillaQt.cpp +++ b/src/editor/ScintillaQt.cpp @@ -327,7 +327,8 @@ void ScintillaQt::keyPressEvent(QKeyEvent *event) { QString text = event->text(); if (input && !text.isEmpty() && text[0].isPrint()) { - InsertCharacter(text.toStdString(), CharacterSource::directInput); + QByteArray utext = text.toUtf8(); + InsertCharacter(std::string_view(utext.data(), utext.size()), CharacterSource::directInput); } else { event->ignore(); } @@ -430,7 +431,7 @@ void ScintillaQt::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasText()) { event->acceptProposedAction(); - Point point = PointFromQPoint(event->pos()); + Point point = PointFromQPoint(event->position().toPoint()); SetDragPosition( SPositionFromLocation(point, false, false, UserVirtualSpace())); } else { @@ -447,7 +448,7 @@ void ScintillaQt::dragMoveEvent(QDragMoveEvent *event) { if (event->mimeData()->hasText()) { event->acceptProposedAction(); - Point point = PointFromQPoint(event->pos()); + Point point = PointFromQPoint(event->position().toPoint()); SetDragPosition( SPositionFromLocation(point, false, false, UserVirtualSpace())); } else { @@ -460,7 +461,7 @@ void ScintillaQt::dropEvent(QDropEvent *event) { event->acceptProposedAction(); const QMimeData *data = event->mimeData(); - Point point = PointFromQPoint(event->pos()); + Point point = PointFromQPoint(event->position().toPoint()); bool move = (event->source() == this && event->proposedAction() == Qt::MoveAction); @@ -520,8 +521,8 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { const unsigned int ucWidth = commitStr.at(i).isHighSurrogate() ? 2 : 1; const QString oneCharUTF16 = commitStr.mid(i, ucWidth); const QByteArray oneChar = oneCharUTF16.toUtf8(); - - InsertCharacter(oneChar.toStdString(), CharacterSource::directInput); + const int oneCharLen = oneChar.length(); + InsertCharacter(std::string_view(oneChar.data(), oneCharLen), CharacterSource::directInput); i += ucWidth; } @@ -604,7 +605,7 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { numBytes += oneCharLen; imeCharPos[i + 1] = numBytes; - InsertCharacter(oneChar.toStdString(), CharacterSource::directInput); + InsertCharacter(std::string_view(oneChar.data(), oneCharLen), CharacterSource::directInput); #ifdef Q_OS_LINUX // Segment marked with imeCaretPos is for target input. diff --git a/src/git/CMakeLists.txt b/src/git/CMakeLists.txt index c9553149b..479eae927 100644 --- a/src/git/CMakeLists.txt +++ b/src/git/CMakeLists.txt @@ -27,6 +27,6 @@ add_library( TagRef.cpp Tree.cpp) -target_link_libraries(git git2 Qt5::Core Qt5::Network util) +target_link_libraries(git git2 Qt6::Core Qt6::Network util) set_target_properties(git PROPERTIES AUTOMOC ON) diff --git a/src/git/Commit.cpp b/src/git/Commit.cpp index 334120c5c..55c60d13c 100644 --- a/src/git/Commit.cpp +++ b/src/git/Commit.cpp @@ -26,7 +26,8 @@ #include #include #include -#include +#include +#include #include namespace git { @@ -291,8 +292,9 @@ void Commit::setStarred(bool starred) { QString Commit::decodeMessage(const char *msg) const { if (const char *encoding = git_commit_message_encoding(*this)) { - if (QTextCodec *codec = QTextCodec::codecForName(encoding)) - return codec->toUnicode(msg); + auto conv = QStringConverter::encodingForName(encoding); + if (conv.has_value()) + return QStringDecoder{conv.value()}.decode(msg); } return msg; diff --git a/src/git/Commit.h b/src/git/Commit.h index 51d02be5c..c3a102807 100644 --- a/src/git/Commit.h +++ b/src/git/Commit.h @@ -15,6 +15,7 @@ #include "git2/revwalk.h" #include "git2/reset.h" #include "Blob.h" +#include class QDateTime; diff --git a/src/git/Diff.cpp b/src/git/Diff.cpp index a85ae545d..519d1a0d3 100644 --- a/src/git/Diff.cpp +++ b/src/git/Diff.cpp @@ -15,11 +15,11 @@ bool containsPath(QString &str, QString &occurence, Qt::CaseSensitivity cs) { if (str.contains(occurence, cs)) { - if (str.count() == occurence.count()) { + if (str.size() == occurence.size()) { // file/folder matches exactly return true; - } else if (str.count() >= occurence.length() + 1 && - str[occurence.length()] == "/") { + } else if (str.size() >= occurence.length() + 1 && + str[occurence.length()] == '/') { // file or folder in occurence return true; } diff --git a/src/git/Diff.h b/src/git/Diff.h index d1f7d278a..042b06156 100644 --- a/src/git/Diff.h +++ b/src/git/Diff.h @@ -59,7 +59,7 @@ class Diff { * \return */ QByteArray print(); - bool isValid() const { return d; } + bool isValid() const { return d ? true : false; } explicit operator bool() const { return isValid(); } bool isConflicted() const; diff --git a/src/git/Index.cpp b/src/git/Index.cpp index b80b81870..95cd8926e 100644 --- a/src/git/Index.cpp +++ b/src/git/Index.cpp @@ -180,7 +180,7 @@ void Index::setStaged(const QStringList &files, bool staged, bool yieldFocus) { if (!smHead.isValid()) continue; - git_time_t time = smHead.committer().date().toTime_t(); + git_time_t time = smHead.committer().date().toSecsSinceEpoch(); entry.ctime.seconds = time; entry.ctime.nanoseconds = 0; entry.mtime.seconds = time; diff --git a/src/git/Remote.cpp b/src/git/Remote.cpp index dfd1013ba..dbbc44c97 100644 --- a/src/git/Remote.cpp +++ b/src/git/Remote.cpp @@ -175,8 +175,8 @@ class ConfigFile { bool matched = false; for (const QString &pattern : host.patterns) { - QRegExp re(pattern, Qt::CaseSensitive, QRegExp::Wildcard); - if (re.exactMatch(hostname)) { + QRegularExpression re{QRegularExpression::wildcardToRegularExpression(pattern)}; + if (re.match(hostname).hasMatch()) { handler(host); matched = true; break; diff --git a/src/git/Repository.cpp b/src/git/Repository.cpp index e224b9464..412138fcc 100644 --- a/src/git/Repository.cpp +++ b/src/git/Repository.cpp @@ -51,7 +51,6 @@ #include #include #include -#include #include #ifdef Q_OS_UNIX @@ -1022,14 +1021,14 @@ void Repository::cleanupState() { } } -QTextCodec *Repository::codec() const { +QStringConverter::Encoding Repository::encoding() const { QString encoding = gitConfig().value("gui.encoding"); - QTextCodec *codec = QTextCodec::codecForName(encoding.toUtf8()); - return codec ? codec : QTextCodec::codecForLocale(); + auto conv = QStringConverter::encodingForName(encoding.toLocal8Bit().data()); + return conv ? conv.value() : QStringConverter::System; } QString Repository::decode(const QByteArray &text) const { - return codec()->toUnicode(text); + return QStringDecoder{encoding()}.decode(text); } bool Repository::lfsIsInitialized() { return dir().exists("hooks/pre-push"); } diff --git a/src/git/Repository.h b/src/git/Repository.h index 875359ed1..33c160c59 100644 --- a/src/git/Repository.h +++ b/src/git/Repository.h @@ -26,6 +26,7 @@ #include #include #include +#include struct git_repository; class QProcess; @@ -225,7 +226,7 @@ class Repository { void cleanupState(); // encoding - QTextCodec *codec() const; + QStringConverter::Encoding encoding() const; QString decode(const QByteArray &text) const; // clean diff --git a/src/git/Signature.cpp b/src/git/Signature.cpp index 55cace9ef..e366de228 100644 --- a/src/git/Signature.cpp +++ b/src/git/Signature.cpp @@ -42,7 +42,7 @@ QString Signature::email() const { return d->email; } QDateTime Signature::date() const { int offset = d->when.offset * 60; // Convert from minutes to seconds. - return QDateTime::fromTime_t(d->when.time, Qt::OffsetFromUTC, offset); + return QDateTime::fromSecsSinceEpoch(d->when.time, Qt::OffsetFromUTC, offset); } git_time Signature::gitDate() const { return d->when; } diff --git a/src/git/Signature.h b/src/git/Signature.h index c3a516e0c..2f916923d 100644 --- a/src/git/Signature.h +++ b/src/git/Signature.h @@ -21,7 +21,7 @@ namespace git { class Signature { public: - bool isValid() const { return d; } + bool isValid() const { return d ? true : false; } explicit operator bool() const { return isValid(); } QString name() const; diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt index 027107356..d189c0aa6 100644 --- a/src/host/CMakeLists.txt +++ b/src/host/CMakeLists.txt @@ -9,7 +9,7 @@ add_library( GitLab.cpp Repository.cpp) -target_link_libraries(host conf cred Qt5::Core Qt5::Gui Qt5::Network) +target_link_libraries(host conf cred Qt6::Core Qt6::Gui Qt6::Network) target_compile_definitions( host diff --git a/src/host/Repository.h b/src/host/Repository.h index 02f389baf..b6011f67a 100644 --- a/src/host/Repository.h +++ b/src/host/Repository.h @@ -10,6 +10,7 @@ #ifndef HOST_REPOSITORY_H #define HOST_REPOSITORY_H +#include #include #include #include diff --git a/src/index/CMakeLists.txt b/src/index/CMakeLists.txt index 26b911754..0fe9b1452 100644 --- a/src/index/CMakeLists.txt +++ b/src/index/CMakeLists.txt @@ -7,8 +7,8 @@ target_link_libraries( git lpeg lua - Qt5::Core - Qt5::Concurrent) + Qt6::Core + Qt6::Concurrent) set_target_properties(index PROPERTIES AUTOMOC ON) @@ -16,7 +16,7 @@ add_executable(lexer_test lexer_test.cpp) target_link_libraries(lexer_test index) add_executable(index_test index_test.cpp) -target_link_libraries(index_test index Qt5::Widgets) +target_link_libraries(index_test index Qt6::Widgets) add_executable(indexer indexer.cpp) target_link_libraries(indexer index) diff --git a/src/index/Query.cpp b/src/index/Query.cpp index 11d143085..6eaaa4326 100644 --- a/src/index/Query.cpp +++ b/src/index/Query.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace { @@ -89,9 +89,9 @@ class WildcardQuery : public TermQuery { WildcardQuery(const Index::Term &term) : TermQuery(term) {} QList commits(const Index *index) const override { - QRegExp re(mTerm.text, Qt::CaseInsensitive, QRegExp::Wildcard); + QRegularExpression re{QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; Index::Predicate pred = [re](const QByteArray &word) { - return re.exactMatch(word); + return re.match(word).hasMatch(); }; return index->commits(index->postings(pred, mTerm.field)); @@ -182,11 +182,9 @@ class BooleanQuery : public Query { QList rhs = mRhs->commits(index); QList commits = mLhs->commits(index); if (mKind == And) { -// Remove commits that don't match the right hand side. -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + // Remove commits that don't match the right hand side. QSet set(rhs.begin(), rhs.end()); #else - QSet set = QSet::fromList(rhs); #endif QMutableListIterator it(commits); while (it.hasNext()) { @@ -194,11 +192,9 @@ class BooleanQuery : public Query { it.remove(); } } else { -// Add commits that aren't already in the result set. -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + // Add commits that aren't already in the result set. QSet set(commits.begin(), commits.end()); #else - QSet set = QSet::fromList(commits); #endif foreach (const git::Commit &commit, rhs) { if (!set.contains(commit)) @@ -222,9 +218,9 @@ class PathspecQuery : public TermQuery { QList commits(const Index *index) const override { QByteArray term = mTerm.text.toUtf8(); QByteArray prefix = term.endsWith('/') ? term : term + '/'; - QRegExp re(mTerm.text, Qt::CaseInsensitive, QRegExp::Wildcard); + QRegularExpression re{QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; Index::Predicate pred = [prefix, re](const QByteArray &word) { - return word.startsWith(prefix) || re.exactMatch(word); + return word.startsWith(prefix) || re.match(word).hasMatch(); }; return index->commits(index->postings(pred, Index::Path)); diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index b6473a171..a660307ba 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -427,12 +427,8 @@ class Indexer : public QObject, public QAbstractNativeEventFilter { int count = 0; QList commits; git::Commit commit = mWalker.next(); - -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QSet ids(mIndex.ids().begin(), mIndex.ids().end()); -#else - QSet ids = QSet::fromList(mIndex.ids()); -#endif + while (commit.isValid() && count < 8192) { // Don't index merge commits. if (!commit.isMerge() && !ids.contains(commit.id())) { @@ -453,7 +449,7 @@ class Indexer : public QObject, public QAbstractNativeEventFilter { using CommitList = QList; mWatcher.setFuture( QtConcurrent::mappedReduced( - commits, Map(mIndex.repo(), mLexers, mOut), + std::move(commits), Map(mIndex.repo(), mLexers, mOut), Reduce(mIndex.ids(), mOut))); return true; } @@ -476,7 +472,7 @@ class Indexer : public QObject, public QAbstractNativeEventFilter { } bool nativeEventFilter(const QByteArray &type, void *message, - long *result) override { + qintptr *result) override { Q_UNUSED(result); #ifdef Q_OS_WIN MSG *msg = static_cast(message); diff --git a/src/log/CMakeLists.txt b/src/log/CMakeLists.txt index 675c3c2f4..a6d385bbe 100644 --- a/src/log/CMakeLists.txt +++ b/src/log/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(loglib LogDelegate.cpp LogEntry.cpp LogModel.cpp LogView.cpp) -target_link_libraries(loglib Qt5::Widgets) +target_link_libraries(loglib Qt6::Widgets) set_target_properties(loglib PROPERTIES AUTOMOC ON) diff --git a/src/log/LogDelegate.cpp b/src/log/LogDelegate.cpp index d461a5989..0a3dd2fb5 100644 --- a/src/log/LogDelegate.cpp +++ b/src/log/LogDelegate.cpp @@ -78,7 +78,7 @@ void LogDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, return; QRect rect = decorationRect(option, index); - if (static_cast(variant.type()) == QMetaType::QChar) { + if (variant.typeId() == QMetaType::QChar) { Badge::paint(painter, {Badge::Label(Badge::Label::Type::Log, variant.toChar())}, rect, &opt); @@ -127,7 +127,7 @@ void LogDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const { QStyledItemDelegate::initStyleOption(option, index); QVariant variant = index.data(Qt::DecorationRole); - if (static_cast(variant.type()) == QMetaType::QChar) { + if (variant.typeId() == QMetaType::QChar) { option->decorationSize = Badge::size(option->font, Badge::Label(Badge::Label::Type::Log)) - ADJUSTMENT_SIZE; diff --git a/src/log/LogModel.cpp b/src/log/LogModel.cpp index 66e4c82fd..9bcf9dbd5 100644 --- a/src/log/LogModel.cpp +++ b/src/log/LogModel.cpp @@ -11,6 +11,7 @@ #include "LogEntry.h" #include #include +#include namespace { diff --git a/src/log/LogView.cpp b/src/log/LogView.cpp index 878611e31..7eed2d249 100644 --- a/src/log/LogView.cpp +++ b/src/log/LogView.cpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace { @@ -94,7 +95,7 @@ void LogView::copy() { QString text = index.data().toString(); plainText += - QString("%1 %2\n").arg(prefix, text.remove(QRegExp("<[^>]*>"))); + QString("%1 %2\n").arg(prefix, text.remove(QRegularExpression("<[^>]*>"))); richText += QString("%1 %2
").arg(prefix, text); } @@ -169,7 +170,8 @@ QString LogView::linkAt(const QModelIndex &index, const QPoint &pos) { return QString(); LogDelegate *delegate = static_cast(itemDelegate()); - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); QPoint docPos = pos - delegate->documentPosition(options, index); return delegate->document(index)->documentLayout()->anchorAt(docPos); @@ -180,7 +182,8 @@ bool LogView::isDecoration(const QModelIndex &index, const QPoint &pos) { return false; LogDelegate *delegate = static_cast(itemDelegate()); - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); return delegate->decorationRect(options, index).contains(pos); } diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index a2246fb84..91538b5e8 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(plugins Plugin.cpp) -target_link_libraries(plugins editor git lua Qt5::Core) +target_link_libraries(plugins editor git lua Qt6::Core) set_target_properties(plugins PROPERTIES AUTOMOC ON) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 6c2dd8055..405ea8543 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(tools DiffTool.cpp EditTool.cpp ExternalTool.cpp MergeTool.cpp ShowTool.cpp) -target_link_libraries(tools conf git Qt5::Gui util) +target_link_libraries(tools conf git Qt6::Gui util) set_target_properties(tools PROPERTIES AUTOMOC ON) diff --git a/src/tools/DiffTool.cpp b/src/tools/DiffTool.cpp index 67019a67d..8ae5a01e1 100644 --- a/src/tools/DiffTool.cpp +++ b/src/tools/DiffTool.cpp @@ -91,7 +91,7 @@ bool DiffTool::start() { if (!bash.isEmpty()) { process->start(bash, {"-c", command}); } else if (!shell) { - process->start(git::Command::substitute(env, command)); + process->start(git::Command::substitute(env, command), QStringList()); } else { emit error(BashNotFound); return false; diff --git a/src/tools/MergeTool.cpp b/src/tools/MergeTool.cpp index 677f679b2..0c03d9173 100644 --- a/src/tools/MergeTool.cpp +++ b/src/tools/MergeTool.cpp @@ -128,7 +128,7 @@ bool MergeTool::start() { if (!bash.isEmpty()) { process->start(bash, {"-c", command}); } else if (!shell) { - process->start(git::Command::substitute(env, command)); + process->start(git::Command::substitute(env, command), QStringList()); } else { emit error(BashNotFound); return false; diff --git a/src/ui/AdvancedSearchWidget.cpp b/src/ui/AdvancedSearchWidget.cpp index a4181ea3f..ad10e269a 100644 --- a/src/ui/AdvancedSearchWidget.cpp +++ b/src/ui/AdvancedSearchWidget.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -144,7 +143,7 @@ void AdvancedSearchWidget::exec(QLineEdit *parent, Index *index) { } // Load completion data in the background. - QtConcurrent::run([this, index] { + std::ignore = QtConcurrent::run([this, index] { QMap fields = index->fieldMap(); foreach (QLineEdit *lineEdit, mLineEdits) { QVariant var = lineEdit->property(kFieldProp); diff --git a/src/ui/BlameEditor.cpp b/src/ui/BlameEditor.cpp index e3a610bb4..53275caae 100644 --- a/src/ui/BlameEditor.cpp +++ b/src/ui/BlameEditor.cpp @@ -157,7 +157,7 @@ bool BlameEditor::load(const QString &name, const git::Blob &blob, // Calculate blame. if (mRepo.isValid() && !content.isEmpty()) { mMargin->startBlame(name); - mBlame.setFuture(QtConcurrent::run(mRepo, &git::Repository::blame, name, + mBlame.setFuture(QtConcurrent::run(&git::Repository::blame, mRepo, name, commit, mCallbacks.data())); } @@ -192,8 +192,7 @@ void BlameEditor::save() { QTextStream out(&file); if (mRepo.isValid()) - out.setCodec(mRepo.codec()); - + out.setEncoding(mRepo.encoding()); out << mEditor->text(); file.commit(); diff --git a/src/ui/BlameMargin.cpp b/src/ui/BlameMargin.cpp index a8b4ea7ec..f09778c97 100644 --- a/src/ui/BlameMargin.cpp +++ b/src/ui/BlameMargin.cpp @@ -67,8 +67,8 @@ void BlameMargin::setBlame(const git::Repository &repo, .toBool()) { git::Commit first = repo.walker(GIT_SORT_TIME | GIT_SORT_REVERSE).next(); git::Commit last = repo.walker(GIT_SORT_TIME).next(); - mMinTime = first ? first.committer().date().toTime_t() : -1; - mMaxTime = last ? last.committer().date().toTime_t() : -1; + mMinTime = first ? first.committer().date().toSecsSinceEpoch() : -1; + mMaxTime = last ? last.committer().date().toSecsSinceEpoch() : -1; } mTimer.stop(); @@ -136,11 +136,11 @@ bool BlameMargin::event(QEvent *event) { } void BlameMargin::mousePressEvent(QMouseEvent *event) { - mIndex = mBlame.isValid() ? index(event->y()) : -1; + mIndex = mBlame.isValid() ? index(event->position().y()) : -1; } void BlameMargin::mouseReleaseEvent(QMouseEvent *event) { - if (mBlame.isValid() && mIndex >= 0 && mIndex == index(event->y())) { + if (mBlame.isValid() && mIndex >= 0 && mIndex == index(event->position().y())) { // Update selection. git::Id id = mBlame.id(mIndex); mSelection = (mSelection != id) ? id : git::Id(); @@ -154,7 +154,7 @@ void BlameMargin::mouseDoubleClickEvent(QMouseEvent *event) { if (!mBlame.isValid()) return; - int index = this->index(event->y()); + int index = this->index(event->position().y()); if (index < 0) return; @@ -172,7 +172,7 @@ void BlameMargin::mouseDoubleClickEvent(QMouseEvent *event) { void BlameMargin::paintEvent(QPaintEvent *event) { // Draw background. QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter painter(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); @@ -225,7 +225,7 @@ void BlameMargin::paintEvent(QPaintEvent *event) { date = (dateTime.date() == today) ? QLocale().toString(dateTime.time(), QLocale::ShortFormat) : QLocale().toString(dateTime.date(), QLocale::ShortFormat); - time = dateTime.toTime_t(); + time = dateTime.toSecsSinceEpoch(); } // Draw background. diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 2e69f48ef..ad2061df0 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -74,8 +74,8 @@ target_link_libraries( tools update watcher - Qt5::Concurrent - Qt5::Network - Qt5::Widgets) + Qt6::Concurrent + Qt6::Network + Qt6::Widgets) set_target_properties(ui PROPERTIES AUTOMOC ON) diff --git a/src/ui/ColumnView.cpp b/src/ui/ColumnView.cpp index da2da30dd..5a67fd4af 100644 --- a/src/ui/ColumnView.cpp +++ b/src/ui/ColumnView.cpp @@ -84,7 +84,7 @@ class PreviewWidget : public QFrame { QWindow *win = window()->windowHandle(); QIcon icon = index.data(Qt::DecorationRole).value(); - mIcon->setPixmap(icon.pixmap(win, QSize(ICON_SIZE, ICON_SIZE))); + mIcon->setPixmap(icon.pixmap(QSize(ICON_SIZE, ICON_SIZE), window()->devicePixelRatio())); mName->setText(kNameFmt.arg(index.data(Qt::DisplayRole).toString())); @@ -139,7 +139,7 @@ void ColumnView::setModel(QAbstractItemModel *model) { bool ColumnView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QWidget *columnViewport = static_cast(obj); - QPoint globalPos = static_cast(event)->globalPos(); + QPoint globalPos = static_cast(event)->globalPosition().toPoint(); QModelIndex index = indexAt(viewport()->mapFromGlobal(globalPos)); if (!columnViewport->hasFocus() && index.row() < 0) { columnViewport->setFocus(); diff --git a/src/ui/CommitList.cpp b/src/ui/CommitList.cpp index e018ee322..823f19019 100644 --- a/src/ui/CommitList.cpp +++ b/src/ui/CommitList.cpp @@ -320,6 +320,8 @@ class CommitModel : public QAbstractListModel { } QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const { + if (index.row() >= mRows.size()) + return QVariant(); const Row &row = mRows.at(index.row()); bool status = !row.commit.isValid(); switch (role) { @@ -1246,8 +1248,10 @@ git::Diff CommitList::selectedDiff() const { if (indexes.isEmpty()) return git::Diff(); - if (indexes.size() == 1) - return indexes.first().data(DiffRole).value(); + if (indexes.size() == 1) { + auto first = indexes.first().data(DiffRole); + return first.isValid() ? first.value() : git::Diff(); + } git::Commit first = indexes.first().data(CommitRole).value(); if (!first.isValid()) @@ -1816,7 +1820,8 @@ bool CommitList::isDecoration(const QModelIndex &index, const QPoint &pos) { return false; CommitDelegate *delegate = static_cast(itemDelegate()); - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); return delegate->decorationRect(options, index).contains(pos); } @@ -1826,7 +1831,8 @@ bool CommitList::isStar(const QModelIndex &index, const QPoint &pos) { return false; CommitDelegate *delegate = static_cast(itemDelegate()); - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); return delegate->starRect(options, index).contains(pos); } diff --git a/src/ui/CommitToolBar.cpp b/src/ui/CommitToolBar.cpp index b6e524eae..cbdabd20a 100644 --- a/src/ui/CommitToolBar.cpp +++ b/src/ui/CommitToolBar.cpp @@ -12,6 +12,7 @@ #include "RepoView.h" #include "conf/Settings.h" #include "git/Config.h" +#include #include #include #include diff --git a/src/ui/DetailView.cpp b/src/ui/DetailView.cpp index 5dbc86af9..169e1f456 100644 --- a/src/ui/DetailView.cpp +++ b/src/ui/DetailView.cpp @@ -23,6 +23,7 @@ #include "git/Signature.h" #include #include +#include #include #include #include @@ -122,8 +123,8 @@ class AuthorCommitterDate : public QWidget { mDate = new QLabel(this); mDate->setTextInteractionFlags(kTextFlags); - mSpacing.setX(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing)); - mSpacing.setY(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing)); + mHorizontalSpacing = style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + mVerticalSpacing = style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing); } void moveEvent(QMoveEvent *event) override { updateLayout(); } @@ -198,13 +199,12 @@ class AuthorCommitterDate : public QWidget { void updateLayout() { mAuthor->move(0, 0); if (mCommitter->isVisible()) - mCommitter->move(0, mAuthor->height() + mSpacing.y()); + mCommitter->move(0, mAuthor->height() + mVerticalSpacing); bool wrapped = (width() < sizeHint().width()); int x = wrapped ? 0 : width() - mDate->width(); int y = wrapped - ? mAuthor->height() + mCommitter->height() + 2 * mSpacing.y() - : 0; + wrapped ? mAuthor->height() + mCommitter->height() + 2 * mVerticalSpacing : 0; mDate->move(x, y); updateGeometry(); } @@ -213,7 +213,8 @@ class AuthorCommitterDate : public QWidget { QLabel *mCommitter; QLabel *mDate; - QPoint mSpacing; + int mHorizontalSpacing; + int mVerticalSpacing; bool mSameAuthorCommitter{false}; }; @@ -306,7 +307,7 @@ class CommitDetail : public QFrame { // Compute description asynchronously. if (commits.size() == 1) mWatcher.setFuture( - QtConcurrent::run(commits.first(), &git::Commit::description)); + QtConcurrent::run(&git::Commit::description, commits.first())); } void setCommits(const QList &commits) { diff --git a/src/ui/DiffView/HunkWidget.cpp b/src/ui/DiffView/HunkWidget.cpp index d21b24411..b511e2a8d 100644 --- a/src/ui/DiffView/HunkWidget.cpp +++ b/src/ui/DiffView/HunkWidget.cpp @@ -270,7 +270,7 @@ HunkWidget::HunkWidget(DiffView *view, const git::Diff &diff, return; QTextStream out(&file); - out.setCodec(repo.codec()); + out.setEncoding(repo.encoding()); out << editor.text(); file.commit(); @@ -397,7 +397,7 @@ HunkWidget::HunkWidget(DiffView *view, const git::Diff &diff, return; QTextStream out(&file); - out.setCodec(repo.codec()); + out.setEncoding(repo.encoding()); out << editor.text(); file.commit(); diff --git a/src/ui/DiffView/Images.cpp b/src/ui/DiffView/Images.cpp index f3098bb93..c51d4c06d 100644 --- a/src/ui/DiffView/Images.cpp +++ b/src/ui/DiffView/Images.cpp @@ -120,7 +120,7 @@ QPixmap Images::loadPixmap(git::Diff::File type, int &size, bool lfs) { QFileIconProvider provider; QString path = mPatch.repo().workdir().filePath(mPatch.name()); QIcon icon = provider.icon(QFileInfo(path)); - return icon.pixmap(windowHandle(), QSize(64, 64)); + return icon.pixmap(QSize(64, 64), window()->devicePixelRatio()); } QVBoxLayout *Images::imageLayout(const QPixmap pixmap, int size) { diff --git a/src/ui/FindWidget.cpp b/src/ui/FindWidget.cpp index 2404599b5..e047417c0 100644 --- a/src/ui/FindWidget.cpp +++ b/src/ui/FindWidget.cpp @@ -227,7 +227,7 @@ void FindWidget::showAndSetFocus() { void FindWidget::paintEvent(QPaintEvent *) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter painter(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); } diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index 2b469c8f4..0f3ef2905 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/src/ui/MenuBar.cpp b/src/ui/MenuBar.cpp index 39f8b3865..5a0158cf4 100644 --- a/src/ui/MenuBar.cpp +++ b/src/ui/MenuBar.cpp @@ -502,7 +502,7 @@ MenuBar::MenuBar(QWidget *parent) : QMenuBar(parent) { mToggleMaximize = new StateAction(tr("Normal"), tr("Maximize"), viewMenu); viewMenu->addAction(mToggleMaximize); toggleMaximizeHotkey.use(mToggleMaximize); - mToggleMaximize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); + mToggleMaximize->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_M)); connect(mToggleMaximize, &QAction::triggered, [this] { bool maximize = mToggleMaximize->isActive(); RepoView *view = this->view(); diff --git a/src/ui/ReferenceView.cpp b/src/ui/ReferenceView.cpp index 84b3b39df..9cab9739a 100644 --- a/src/ui/ReferenceView.cpp +++ b/src/ui/ReferenceView.cpp @@ -40,7 +40,8 @@ class FilterProxyModel : public QSortFilterProxyModel { FilterProxyModel(QObject *parent = nullptr) : QSortFilterProxyModel(parent) {} void setFilter(const QString &filter) { - setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString)); + setFilterCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive); + setFilterFixedString(filter); } protected: diff --git a/src/ui/RepoView.cpp b/src/ui/RepoView.cpp index b9ee24368..d3a5a08b4 100644 --- a/src/ui/RepoView.cpp +++ b/src/ui/RepoView.cpp @@ -1802,7 +1802,8 @@ void RepoView::push(const git::Remote &rmt, const git::Reference &src, &RepoView::notifyReferenceUpdated); entry->setBusy(true); - mWatcher->setFuture(QtConcurrent::run(remote, &git::Remote::push, mCallbacks, + git::Result (git::Remote::*push)(git::Remote::Callbacks*, const git::Reference&, const QString&, bool, bool) = &git::Remote::push; + mWatcher->setFuture(QtConcurrent::run(push, remote, mCallbacks, ref, dst, force, tags)); } @@ -2364,7 +2365,7 @@ void RepoView::resetSubmodulesAsync(const QList &submodules, QString(), mWatcher, repo); entry->setBusy(true); - mWatcher->setFuture(QtConcurrent::run(submodule, &git::Submodule::update, + mWatcher->setFuture(QtConcurrent::run(&git::Submodule::update, submodule, mCallbacks, false, true)); } @@ -2527,7 +2528,7 @@ void RepoView::updateSubmodulesAsync(const QList &submodules, QString(), mWatcher, repo); entry->setBusy(true); - mWatcher->setFuture(QtConcurrent::run(submodule, &git::Submodule::update, + mWatcher->setFuture(QtConcurrent::run(&git::Submodule::update, submodule, mCallbacks, init, checkout_force)); } diff --git a/src/ui/SpellChecker.cpp b/src/ui/SpellChecker.cpp index fb1563e13..9cf2722d1 100644 --- a/src/ui/SpellChecker.cpp +++ b/src/ui/SpellChecker.cpp @@ -4,7 +4,7 @@ #include "SpellChecker.h" #include #include -#include +#include SpellChecker::SpellChecker(const QString &dictionaryPath, const QString &userDictionary) @@ -26,12 +26,13 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, QFile affixFile(affixFileName); if (affixFile.open(QIODevice::ReadOnly)) { QTextStream stream(&affixFile); - QRegExp enc_detector("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", - Qt::CaseInsensitive); + QRegularExpression enc_detector("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", + QRegularExpression::CaseInsensitiveOption); QString line = stream.readLine(); while (!line.isEmpty()) { - if (enc_detector.indexIn(line) >= 0) { - encoding = enc_detector.cap(1); + auto match = enc_detector.match(line); + if (match.hasMatch() >= 0) { + encoding = match.captured(1); break; } line = stream.readLine(); @@ -40,7 +41,8 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, mValid = true; } - mCodec = QTextCodec::codecForName(encoding.toLatin1().constData()); + auto conv = QStringConverter::encodingForName(encoding.toLocal8Bit().data()); + mEncoding = conv ? conv.value() : QStringConverter::System; // Add user dictionary words to spell checker. if (!mUserDictionary.isEmpty()) { @@ -49,7 +51,8 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, QTextStream stream(&userDictonaryFile); QString line = stream.readLine(); while (!line.isEmpty()) { - mHunspell->add(mCodec->fromUnicode(line).constData()); + QByteArray ba = QStringEncoder{mEncoding}.encode(line); + mHunspell->add(ba.toStdString()); line = stream.readLine(); } userDictonaryFile.close(); @@ -62,29 +65,34 @@ SpellChecker::~SpellChecker() { delete mHunspell; } bool SpellChecker::spell(const QString &word) { // Encode from Unicode to the encoding used by current dictionary. - return mHunspell->spell(mCodec->fromUnicode(word).toStdString()); + QByteArray ba = QStringEncoder{mEncoding}.encode(word); + return mHunspell->spell(ba.toStdString()); } QStringList SpellChecker::suggest(const QString &word) { QStringList suggestions; // Retrive suggestions for word. + QByteArray ba = QStringEncoder{mEncoding}.encode(word); std::vector suggestion = - mHunspell->suggest(mCodec->fromUnicode(word).toStdString()); + mHunspell->suggest(ba.toStdString()); // Decode from the encoding used by current dictionary to Unicode. + auto decoder = QStringDecoder{mEncoding}; foreach (const std::string &str, suggestion) - suggestions.append(mCodec->toUnicode(str.data())); + suggestions.append(decoder.decode(str.data())); return suggestions; } void SpellChecker::ignoreWord(const QString &word) { - mHunspell->add(mCodec->fromUnicode(word).constData()); + QByteArray ba = QStringEncoder{mEncoding}.encode(word); + mHunspell->add(ba.toStdString()); } void SpellChecker::addToUserDict(const QString &word) { - mHunspell->add(mCodec->fromUnicode(word).constData()); + QByteArray ba = QStringEncoder{mEncoding}.encode(word); + mHunspell->add(ba.toStdString()); if (!mUserDictionary.isEmpty()) { QFile userDictonaryFile(mUserDictionary); diff --git a/src/ui/SpellChecker.h b/src/ui/SpellChecker.h index f244bee6c..4dd1d88ce 100644 --- a/src/ui/SpellChecker.h +++ b/src/ui/SpellChecker.h @@ -4,6 +4,7 @@ #define SPELLCHECKER_H #include +#include class Hunspell; @@ -24,7 +25,7 @@ class SpellChecker { private: Hunspell *mHunspell = nullptr; - QTextCodec *mCodec; + QStringConverter::Encoding mEncoding; QString mUserDictionary; bool mValid = false; diff --git a/src/ui/ToolBar.cpp b/src/ui/ToolBar.cpp index 2be9e76fe..4ec2a2a89 100644 --- a/src/ui/ToolBar.cpp +++ b/src/ui/ToolBar.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace { @@ -944,7 +945,7 @@ ToolBar::ToolBar(MainWindow *parent) : QToolBar(parent) { // Hook up star button to search field. connect(mStarButton, &QToolButton::toggled, [this](bool checked) { - QStringList terms = mSearchField->text().split(QRegExp("\\s+")); + QStringList terms = mSearchField->text().split(QRegularExpression("\\s+")); if (checked) { terms.append(kStarredQuery); } else { @@ -958,7 +959,7 @@ ToolBar::ToolBar(MainWindow *parent) : QToolBar(parent) { QSignalBlocker blocker(mStarButton); (void)blocker; - QStringList terms = mSearchField->text().split(QRegExp("\\s+")); + QStringList terms = mSearchField->text().split(QRegularExpression("\\s+")); mStarButton->setChecked(terms.contains(kStarredQuery)); }); } diff --git a/src/ui/TreeView.cpp b/src/ui/TreeView.cpp index a7895dd18..9e7343f00 100644 --- a/src/ui/TreeView.cpp +++ b/src/ui/TreeView.cpp @@ -104,7 +104,7 @@ void TreeView::discard(DiffTreeModel *model, const QModelIndex &index) { bool TreeView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QWidget *TreeViewport = static_cast(obj); - QPoint globalPos = static_cast(event)->globalPos(); + QPoint globalPos = static_cast(event)->globalPosition().toPoint(); QModelIndex index = indexAt(viewport()->mapFromGlobal(globalPos)); if (!TreeViewport->hasFocus() && index.row() < 0) { TreeViewport->setFocus(); @@ -267,7 +267,8 @@ void TreeView::deselectAll() { } QRect TreeView::checkRect(const QModelIndex &index) { - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); options.features |= QStyleOptionViewItem::HasCheckIndicator; diff --git a/src/ui/ViewDelegate.cpp b/src/ui/ViewDelegate.cpp index 194a915a8..33301e7dd 100644 --- a/src/ui/ViewDelegate.cpp +++ b/src/ui/ViewDelegate.cpp @@ -52,7 +52,7 @@ void ViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, // Add extra space. opt.rect.adjust(0, 0, -3, 0); - for (int i = 0; i < status.count(); ++i) { + for (int i = 0; i < status.size(); ++i) { int x = opt.rect.x() + opt.rect.width(); int y = opt.rect.y() + (opt.rect.height() / 2); QRect rect(x - width, y - (height / 2), width, height); diff --git a/src/update/CMakeLists.txt b/src/update/CMakeLists.txt index 530376d5b..fb980d3fc 100644 --- a/src/update/CMakeLists.txt +++ b/src/update/CMakeLists.txt @@ -13,14 +13,14 @@ target_link_libraries( conf ${LIBCMARK_LIBRARIES} git - Qt5::Network - Qt5::Widgets + Qt6::Network + Qt6::Widgets ${UPDATER_IMPL_LIBS}) set_target_properties(update PROPERTIES AUTOMOC ON) add_executable(relauncher relauncher.cpp) -target_link_libraries(relauncher Qt5::Core) +target_link_libraries(relauncher Qt6::Core) set_target_properties(relauncher PROPERTIES RUNTIME_OUTPUT_DIRECTORY $) diff --git a/src/update/relauncher.cpp b/src/update/relauncher.cpp index 0e0637c0a..ad14eab91 100644 --- a/src/update/relauncher.cpp +++ b/src/update/relauncher.cpp @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { #endif // Restart from the path argument. - QProcess::startDetached(args.first()); + QProcess::startDetached(args.first(), QStringList()); return 0; } diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 4d039839f..b81930009 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(util Path.cpp Debug.h Debug.cpp) -target_link_libraries(util Qt5::Core) +target_link_libraries(util Qt6::Core) target_include_directories(util INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(util PROPERTIES AUTOMOC ON) diff --git a/src/watcher/CMakeLists.txt b/src/watcher/CMakeLists.txt index 16de10f5b..2818a4f10 100644 --- a/src/watcher/CMakeLists.txt +++ b/src/watcher/CMakeLists.txt @@ -13,6 +13,6 @@ add_library(watcher RepositoryWatcher.cpp ${WATCHER_IMPL_FILE}) target_include_directories(watcher PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries(watcher git Qt5::Core ${WATCHER_IMPL_LIBS}) +target_link_libraries(watcher git Qt6::Core ${WATCHER_IMPL_LIBS}) set_target_properties(watcher PROPERTIES AUTOMOC ON) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 10053099d..3a388f18e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,10 +23,10 @@ macro(test) endif() if(WIN32) - find_package(Qt5Gui) + find_package(Qt6Gui) string(REPLACE ";" "\;" NEWPATH "$ENV{PATH}") string(REPLACE ";" "\;" PLUGIN_PATH - "$") + "$") if(${ARG_NO_WIN32_OFFSCREEN}) set(PLATFORM "windows") @@ -73,7 +73,7 @@ set(CMAKE_DISABLE_TESTING ON) add_subdirectory(dep/zip) add_library(testlib EXCLUDE_FROM_ALL Test.cpp) -target_link_libraries(testlib app git ui Qt5::Test zip) +target_link_libraries(testlib app git ui Qt6::Test zip) target_include_directories(testlib PRIVATE ${CMAKE_SOURCE_DIR}/src) target_compile_definitions( testlib From feadf99dcde4846cde0200d37c9270905751c1e5 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 09:31:04 +0200 Subject: [PATCH 02/76] format --- src/conf/Settings.cpp | 3 ++- src/cred/CMakeLists.txt | 5 ++--- src/dialogs/CMakeLists.txt | 5 ++++- src/dialogs/DeleteBranchDialog.cpp | 6 +++--- src/dialogs/DeleteTagDialog.cpp | 6 +++--- src/dialogs/DiffPanel.cpp | 10 ++-------- src/editor/ScintillaQt.cpp | 9 ++++++--- src/git/Remote.cpp | 3 ++- src/index/Query.cpp | 6 ++++-- src/log/LogView.cpp | 4 ++-- src/ui/BlameMargin.cpp | 3 ++- src/ui/ColumnView.cpp | 6 ++++-- src/ui/DetailView.cpp | 8 +++++--- src/ui/RepoView.cpp | 8 +++++--- src/ui/SpellChecker.cpp | 11 ++++++----- src/ui/TreeView.cpp | 3 ++- 16 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/conf/Settings.cpp b/src/conf/Settings.cpp index 5e5f92291..1d6a87f24 100644 --- a/src/conf/Settings.cpp +++ b/src/conf/Settings.cpp @@ -118,7 +118,8 @@ QString Settings::lexer(const QString &filename) { QVariantMap map(lexers.value(key).toMap()); if (map.contains("patterns")) { foreach (QString pattern, map.value("patterns").toString().split(",")) { - QRegularExpression regExp{QRegularExpression::fromWildcard(pattern, CS)}; + QRegularExpression regExp{ + QRegularExpression::fromWildcard(pattern, CS)}; if (regExp.match(name).hasMatch()) return key; } diff --git a/src/cred/CMakeLists.txt b/src/cred/CMakeLists.txt index 9f686fde8..b21af0535 100644 --- a/src/cred/CMakeLists.txt +++ b/src/cred/CMakeLists.txt @@ -1,7 +1,6 @@ -add_library(cred Cache.cpp Store.cpp CredentialHelper.cpp GitCredential.cpp) - -target_link_libraries(cred conf git Qt6::Core) add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp ${CREDENTIAL_IMPL_FILE}) +target_link_libraries(cred conf git Qt6::Core) + set_target_properties(cred PROPERTIES AUTOMOC ON) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index 65b307b08..beee9a5ac 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -39,7 +39,10 @@ target_compile_definitions( target_include_directories(dialogs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -find_package(Qt6 COMPONENTS Core5Compat REQUIRED) +find_package( + Qt6 + COMPONENTS Core5Compat + REQUIRED) target_link_libraries( dialogs diff --git a/src/dialogs/DeleteBranchDialog.cpp b/src/dialogs/DeleteBranchDialog.cpp index 79a3f0566..4c2e4c49b 100644 --- a/src/dialogs/DeleteBranchDialog.cpp +++ b/src/dialogs/DeleteBranchDialog.cpp @@ -61,9 +61,9 @@ DeleteBranchDialog::DeleteBranchDialog(const git::Branch &branch, entry->setBusy(true); QStringList refspecs(QString(":%1").arg(upstreamName)); - git::Result (git::Remote::*push)(git::Remote::Callbacks*, const QStringList&) = &git::Remote::push; - watcher->setFuture( - QtConcurrent::run(push, remote, callbacks, refspecs)); + git::Result (git::Remote::*push)( + git::Remote::Callbacks *, const QStringList &) = &git::Remote::push; + watcher->setFuture(QtConcurrent::run(push, remote, callbacks, refspecs)); connect(watcher, &QFutureWatcher::finished, watcher, [entry, watcher, callbacks, remoteName] { diff --git a/src/dialogs/DeleteTagDialog.cpp b/src/dialogs/DeleteTagDialog.cpp index 1e46bfe3f..45b1e2be6 100644 --- a/src/dialogs/DeleteTagDialog.cpp +++ b/src/dialogs/DeleteTagDialog.cpp @@ -53,9 +53,9 @@ DeleteTagDialog::DeleteTagDialog(const git::TagRef &tag, QWidget *parent) entry->setBusy(true); QStringList refspecs(QString(":refs/tags/%1").arg(name)); - git::Result (git::Remote::*push)(git::Remote::Callbacks*, const QStringList&) = &git::Remote::push; - watcher->setFuture( - QtConcurrent::run(push, remote, callbacks, refspecs)); + git::Result (git::Remote::*push)( + git::Remote::Callbacks *, const QStringList &) = &git::Remote::push; + watcher->setFuture(QtConcurrent::run(push, remote, callbacks, refspecs)); connect(watcher, &QFutureWatcher::finished, watcher, [entry, watcher, callbacks, remoteName] { diff --git a/src/dialogs/DiffPanel.cpp b/src/dialogs/DiffPanel.cpp index 54f31df2f..8f4d8b8a0 100644 --- a/src/dialogs/DiffPanel.cpp +++ b/src/dialogs/DiffPanel.cpp @@ -46,14 +46,8 @@ DiffPanel::DiffPanel(const git::Repository &repo, QWidget *parent) // encoding static std::array encodings{ - "Utf8", - "Utf16", - "Utf16LE", - "Utf16BE", - "Utf32", - "Utf32LE", - "Utf32BE", - "Latin1", + "Utf8", "Utf16", "Utf16LE", "Utf16BE", + "Utf32", "Utf32LE", "Utf32BE", "Latin1", }; QComboBox *encoding = new QComboBox(this); diff --git a/src/editor/ScintillaQt.cpp b/src/editor/ScintillaQt.cpp index 34fa321f7..1736749ac 100644 --- a/src/editor/ScintillaQt.cpp +++ b/src/editor/ScintillaQt.cpp @@ -328,7 +328,8 @@ void ScintillaQt::keyPressEvent(QKeyEvent *event) { QString text = event->text(); if (input && !text.isEmpty() && text[0].isPrint()) { QByteArray utext = text.toUtf8(); - InsertCharacter(std::string_view(utext.data(), utext.size()), CharacterSource::directInput); + InsertCharacter(std::string_view(utext.data(), utext.size()), + CharacterSource::directInput); } else { event->ignore(); } @@ -522,7 +523,8 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { const QString oneCharUTF16 = commitStr.mid(i, ucWidth); const QByteArray oneChar = oneCharUTF16.toUtf8(); const int oneCharLen = oneChar.length(); - InsertCharacter(std::string_view(oneChar.data(), oneCharLen), CharacterSource::directInput); + InsertCharacter(std::string_view(oneChar.data(), oneCharLen), + CharacterSource::directInput); i += ucWidth; } @@ -605,7 +607,8 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { numBytes += oneCharLen; imeCharPos[i + 1] = numBytes; - InsertCharacter(std::string_view(oneChar.data(), oneCharLen), CharacterSource::directInput); + InsertCharacter(std::string_view(oneChar.data(), oneCharLen), + CharacterSource::directInput); #ifdef Q_OS_LINUX // Segment marked with imeCaretPos is for target input. diff --git a/src/git/Remote.cpp b/src/git/Remote.cpp index dbbc44c97..fd5f0b9cf 100644 --- a/src/git/Remote.cpp +++ b/src/git/Remote.cpp @@ -175,7 +175,8 @@ class ConfigFile { bool matched = false; for (const QString &pattern : host.patterns) { - QRegularExpression re{QRegularExpression::wildcardToRegularExpression(pattern)}; + QRegularExpression re{ + QRegularExpression::wildcardToRegularExpression(pattern)}; if (re.match(hostname).hasMatch()) { handler(host); matched = true; diff --git a/src/index/Query.cpp b/src/index/Query.cpp index 6eaaa4326..d289eca68 100644 --- a/src/index/Query.cpp +++ b/src/index/Query.cpp @@ -89,7 +89,8 @@ class WildcardQuery : public TermQuery { WildcardQuery(const Index::Term &term) : TermQuery(term) {} QList commits(const Index *index) const override { - QRegularExpression re{QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; + QRegularExpression re{ + QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; Index::Predicate pred = [re](const QByteArray &word) { return re.match(word).hasMatch(); }; @@ -218,7 +219,8 @@ class PathspecQuery : public TermQuery { QList commits(const Index *index) const override { QByteArray term = mTerm.text.toUtf8(); QByteArray prefix = term.endsWith('/') ? term : term + '/'; - QRegularExpression re{QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; + QRegularExpression re{ + QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; Index::Predicate pred = [prefix, re](const QByteArray &word) { return word.startsWith(prefix) || re.match(word).hasMatch(); }; diff --git a/src/log/LogView.cpp b/src/log/LogView.cpp index 7eed2d249..3f1fc99d6 100644 --- a/src/log/LogView.cpp +++ b/src/log/LogView.cpp @@ -94,8 +94,8 @@ void LogView::copy() { prefix += isExpanded(index) ? "[-]" : "[+]"; QString text = index.data().toString(); - plainText += - QString("%1 %2\n").arg(prefix, text.remove(QRegularExpression("<[^>]*>"))); + plainText += QString("%1 %2\n").arg( + prefix, text.remove(QRegularExpression("<[^>]*>"))); richText += QString("%1 %2
").arg(prefix, text); } diff --git a/src/ui/BlameMargin.cpp b/src/ui/BlameMargin.cpp index f09778c97..5950c2012 100644 --- a/src/ui/BlameMargin.cpp +++ b/src/ui/BlameMargin.cpp @@ -140,7 +140,8 @@ void BlameMargin::mousePressEvent(QMouseEvent *event) { } void BlameMargin::mouseReleaseEvent(QMouseEvent *event) { - if (mBlame.isValid() && mIndex >= 0 && mIndex == index(event->position().y())) { + if (mBlame.isValid() && mIndex >= 0 && + mIndex == index(event->position().y())) { // Update selection. git::Id id = mBlame.id(mIndex); mSelection = (mSelection != id) ? id : git::Id(); diff --git a/src/ui/ColumnView.cpp b/src/ui/ColumnView.cpp index 5a67fd4af..6d607cdcd 100644 --- a/src/ui/ColumnView.cpp +++ b/src/ui/ColumnView.cpp @@ -84,7 +84,8 @@ class PreviewWidget : public QFrame { QWindow *win = window()->windowHandle(); QIcon icon = index.data(Qt::DecorationRole).value(); - mIcon->setPixmap(icon.pixmap(QSize(ICON_SIZE, ICON_SIZE), window()->devicePixelRatio())); + mIcon->setPixmap( + icon.pixmap(QSize(ICON_SIZE, ICON_SIZE), window()->devicePixelRatio())); mName->setText(kNameFmt.arg(index.data(Qt::DisplayRole).toString())); @@ -139,7 +140,8 @@ void ColumnView::setModel(QAbstractItemModel *model) { bool ColumnView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QWidget *columnViewport = static_cast(obj); - QPoint globalPos = static_cast(event)->globalPosition().toPoint(); + QPoint globalPos = + static_cast(event)->globalPosition().toPoint(); QModelIndex index = indexAt(viewport()->mapFromGlobal(globalPos)); if (!columnViewport->hasFocus() && index.row() < 0) { columnViewport->setFocus(); diff --git a/src/ui/DetailView.cpp b/src/ui/DetailView.cpp index 169e1f456..66d2cce2f 100644 --- a/src/ui/DetailView.cpp +++ b/src/ui/DetailView.cpp @@ -123,7 +123,8 @@ class AuthorCommitterDate : public QWidget { mDate = new QLabel(this); mDate->setTextInteractionFlags(kTextFlags); - mHorizontalSpacing = style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + mHorizontalSpacing = + style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); mVerticalSpacing = style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing); } @@ -203,8 +204,9 @@ class AuthorCommitterDate : public QWidget { bool wrapped = (width() < sizeHint().width()); int x = wrapped ? 0 : width() - mDate->width(); - int y = wrapped - wrapped ? mAuthor->height() + mCommitter->height() + 2 * mVerticalSpacing : 0; + int y = wrapped wrapped ? mAuthor->height() + mCommitter->height() + + 2 * mVerticalSpacing + : 0; mDate->move(x, y); updateGeometry(); } diff --git a/src/ui/RepoView.cpp b/src/ui/RepoView.cpp index d3a5a08b4..8aeaeb0bf 100644 --- a/src/ui/RepoView.cpp +++ b/src/ui/RepoView.cpp @@ -1802,9 +1802,11 @@ void RepoView::push(const git::Remote &rmt, const git::Reference &src, &RepoView::notifyReferenceUpdated); entry->setBusy(true); - git::Result (git::Remote::*push)(git::Remote::Callbacks*, const git::Reference&, const QString&, bool, bool) = &git::Remote::push; - mWatcher->setFuture(QtConcurrent::run(push, remote, mCallbacks, - ref, dst, force, tags)); + git::Result (git::Remote::*push)(git::Remote::Callbacks *, + const git::Reference &, const QString &, + bool, bool) = &git::Remote::push; + mWatcher->setFuture( + QtConcurrent::run(push, remote, mCallbacks, ref, dst, force, tags)); } bool RepoView::commit(const QString &message, diff --git a/src/ui/SpellChecker.cpp b/src/ui/SpellChecker.cpp index 9cf2722d1..d161cf9c4 100644 --- a/src/ui/SpellChecker.cpp +++ b/src/ui/SpellChecker.cpp @@ -26,8 +26,9 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, QFile affixFile(affixFileName); if (affixFile.open(QIODevice::ReadOnly)) { QTextStream stream(&affixFile); - QRegularExpression enc_detector("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", - QRegularExpression::CaseInsensitiveOption); + QRegularExpression enc_detector( + "^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", + QRegularExpression::CaseInsensitiveOption); QString line = stream.readLine(); while (!line.isEmpty()) { auto match = enc_detector.match(line); @@ -41,7 +42,8 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, mValid = true; } - auto conv = QStringConverter::encodingForName(encoding.toLocal8Bit().data()); + auto conv = + QStringConverter::encodingForName(encoding.toLocal8Bit().data()); mEncoding = conv ? conv.value() : QStringConverter::System; // Add user dictionary words to spell checker. @@ -74,8 +76,7 @@ QStringList SpellChecker::suggest(const QString &word) { // Retrive suggestions for word. QByteArray ba = QStringEncoder{mEncoding}.encode(word); - std::vector suggestion = - mHunspell->suggest(ba.toStdString()); + std::vector suggestion = mHunspell->suggest(ba.toStdString()); // Decode from the encoding used by current dictionary to Unicode. auto decoder = QStringDecoder{mEncoding}; diff --git a/src/ui/TreeView.cpp b/src/ui/TreeView.cpp index 9e7343f00..fab8d4807 100644 --- a/src/ui/TreeView.cpp +++ b/src/ui/TreeView.cpp @@ -104,7 +104,8 @@ void TreeView::discard(DiffTreeModel *model, const QModelIndex &index) { bool TreeView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QWidget *TreeViewport = static_cast(obj); - QPoint globalPos = static_cast(event)->globalPosition().toPoint(); + QPoint globalPos = + static_cast(event)->globalPosition().toPoint(); QModelIndex index = indexAt(viewport()->mapFromGlobal(globalPos)); if (!TreeViewport->hasFocus() && index.row() < 0) { TreeViewport->setFocus(); From ad2a2087ba267d302b51ef5a57a691c0ef349cfe Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 09:42:24 +0200 Subject: [PATCH 03/76] fix --- src/cred/CMakeLists.txt | 3 +-- src/dialogs/CMakeLists.txt | 5 ----- src/index/Query.cpp | 4 ---- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/cred/CMakeLists.txt b/src/cred/CMakeLists.txt index b21af0535..d8f1423db 100644 --- a/src/cred/CMakeLists.txt +++ b/src/cred/CMakeLists.txt @@ -1,5 +1,4 @@ -add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp - ${CREDENTIAL_IMPL_FILE}) +add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp) target_link_libraries(cred conf git Qt6::Core) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index beee9a5ac..f306af706 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -39,11 +39,6 @@ target_compile_definitions( target_include_directories(dialogs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -find_package( - Qt6 - COMPONENTS Core5Compat - REQUIRED) - target_link_libraries( dialogs cli diff --git a/src/index/Query.cpp b/src/index/Query.cpp index d289eca68..c293a8b0d 100644 --- a/src/index/Query.cpp +++ b/src/index/Query.cpp @@ -185,8 +185,6 @@ class BooleanQuery : public Query { if (mKind == And) { // Remove commits that don't match the right hand side. QSet set(rhs.begin(), rhs.end()); -#else -#endif QMutableListIterator it(commits); while (it.hasNext()) { if (!set.contains(it.next())) @@ -195,8 +193,6 @@ class BooleanQuery : public Query { } else { // Add commits that aren't already in the result set. QSet set(commits.begin(), commits.end()); -#else -#endif foreach (const git::Commit &commit, rhs) { if (!set.contains(commit)) commits.append(commit); From 7e2fec7150fa81859a8b29d0ea5507047845e9ae Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 09:53:53 +0200 Subject: [PATCH 04/76] update openssl version to 3.0 --- .github/workflows/build.yml | 4 ---- dep/openssl/openssl | 2 +- pack/CMakeLists.txt | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7eb4128a..22904d679 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -259,10 +259,6 @@ jobs: run: | cd dep/openssl/openssl - # this is necessary until https://github.com/openssl/openssl/issues/18720 - # is fixed in OpenSSL 1.1.1r - export CFLAGS=-Wno-error=implicit-function-declaration - ./Configure ${{ matrix.env.openssl_arch }} no-shared make diff --git a/dep/openssl/openssl b/dep/openssl/openssl index 29708a562..1c01dbcbe 160000 --- a/dep/openssl/openssl +++ b/dep/openssl/openssl @@ -1 +1 @@ -Subproject commit 29708a562a1887a91de0fa6ca668c71871accde9 +Subproject commit 1c01dbcbebc08d629d02326d941b8491ae99597d diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 5b72c6abd..1b610f0ce 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -156,12 +156,12 @@ if(NOT APPLE) if(NOT USE_SYSTEM_OPENSSL) if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(SSL_LIB_SUFFIX "-1_1-x64.dll") + set(SSL_LIB_SUFFIX "-3-x64.dll") else() - set(SSL_LIB_SUFFIX "-1_1.dll") + set(SSL_LIB_SUFFIX "-3.dll") endif() else() - set(SSL_LIB_SUFFIX ".so.1.1") + set(SSL_LIB_SUFFIX ".so.3") endif() foreach(SSL_LIB_NAME ssl crypto) From 2b2f5cd8d3805dd12eb59fef67b6b6c74c603658 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:06:13 +0200 Subject: [PATCH 05/76] fix compilation --- src/editor/ScintillaQt.cpp | 1 + src/ui/CommitEditor.cpp | 1 + src/ui/DetailView.cpp | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/editor/ScintillaQt.cpp b/src/editor/ScintillaQt.cpp index 1736749ac..f8e4e7edd 100644 --- a/src/editor/ScintillaQt.cpp +++ b/src/editor/ScintillaQt.cpp @@ -708,6 +708,7 @@ QVariant ScintillaQt::inputMethodQuery(Qt::InputMethodQuery query) const { case Qt::ImPlatformData: // fall through case Qt::ImQueryInput: // fall through case Qt::ImQueryAll: // fall through + case Qt::ImReadOnly: // fall through break; } return QVariant(); diff --git a/src/ui/CommitEditor.cpp b/src/ui/CommitEditor.cpp index c76e76eb7..64af90dfb 100644 --- a/src/ui/CommitEditor.cpp +++ b/src/ui/CommitEditor.cpp @@ -20,6 +20,7 @@ #include #include #include +#include namespace { const QString kDictKey = "commit.spellcheck.dict"; diff --git a/src/ui/DetailView.cpp b/src/ui/DetailView.cpp index 66d2cce2f..3b6f064c0 100644 --- a/src/ui/DetailView.cpp +++ b/src/ui/DetailView.cpp @@ -136,13 +136,13 @@ class AuthorCommitterDate : public QWidget { QSize date = mDate->sizeHint(); QSize author = mAuthor->sizeHint(); QSize committer = mCommitter->sizeHint(); - int width = author.width() + date.width() + mSpacing.x(); + int width = author.width() + date.width() + mHorizontalSpacing; int height; if (mSameAuthorCommitter) height = qMax(qMax(author.height(), committer.height()), date.height()); else height = qMax(author.height(), date.height()) + committer.height() + - mSpacing.y(); + mVerticalSpacing; return QSize(width, height); } @@ -156,7 +156,7 @@ class AuthorCommitterDate : public QWidget { height = qMax(qMax(author.height(), committer.height()), date.height()); else height = qMax(author.height(), date.height()) + committer.height() + - mSpacing.y(); + mVerticalSpacing; return QSize(width, height); } @@ -167,10 +167,11 @@ class AuthorCommitterDate : public QWidget { int author = mAuthor->sizeHint().height(); int committer = mCommitter->sizeHint().height(); bool wrapped = (width < sizeHint().width()); - int unwrappedHeight = mSameAuthorCommitter - ? qMax(committer, qMax(author, date)) - : qMax(author + committer + mSpacing.y(), date); - return wrapped ? (author + committer + date + 2 * mSpacing.y()) + int unwrappedHeight = + mSameAuthorCommitter + ? qMax(committer, qMax(author, date)) + : qMax(author + committer + mVerticalSpacing, date); + return wrapped ? (author + committer + date + 2 * mVerticalSpacing) : unwrappedHeight; } @@ -204,9 +205,9 @@ class AuthorCommitterDate : public QWidget { bool wrapped = (width() < sizeHint().width()); int x = wrapped ? 0 : width() - mDate->width(); - int y = wrapped wrapped ? mAuthor->height() + mCommitter->height() + - 2 * mVerticalSpacing - : 0; + int y = wrapped ? mAuthor->height() + mCommitter->height() + + 2 * mVerticalSpacing + : 0; mDate->move(x, y); updateGeometry(); } From ca253a89f680b18b70aee5c4edf410fae8e976a2 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:17:31 +0200 Subject: [PATCH 06/76] fix compilation --- src/cred/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cred/CMakeLists.txt b/src/cred/CMakeLists.txt index d8f1423db..b4fe01a7d 100644 --- a/src/cred/CMakeLists.txt +++ b/src/cred/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp) +add_library(cred Cache.cpp Store.cpp CredentialHelper.cpp GitCredential.cpp) target_link_libraries(cred conf git Qt6::Core) From c8df519a0b5d68e8c488508e3b56980a533a8899 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:34:49 +0200 Subject: [PATCH 07/76] update github build file to support Qt6 --- .github/workflows/build.yml | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22904d679..92f2a62d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,11 +126,7 @@ jobs: fail-fast: false matrix: qt: - - version: 5.15.2 - check_only: false - - - version: 5.12.0 - check_only: true + - version: 6.5 env: - name: linux @@ -209,7 +205,6 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v2.13.0 timeout-minutes: 10 - if: "!matrix.qt.check_only" with: version: ${{ matrix.qt.version }} target: desktop @@ -218,18 +213,6 @@ jobs: install-deps: true modules: qtwebengine - - name: Install Qt - uses: jurplel/install-qt-action@v2.13.0 - timeout-minutes: 10 - if: matrix.qt.check_only - with: - version: ${{ matrix.qt.version }} - target: desktop - host: ${{ matrix.env.qt_platform }} - arch: ${{ matrix.env.qt_arch_check_only }} - install-deps: true - modules: qtwebengine - - name: Install Ninja uses: seanmiddleditch/gha-setup-ninja@v3 with: @@ -290,7 +273,7 @@ jobs: # Command copied from flathub build process - name: Validate appdata file - if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only + if: matrix.env.ninja_platform == 'linux' run: | echo "Show generated appdata file" cat ./build/release/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml @@ -301,14 +284,14 @@ jobs: flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate ./build/release/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml - name: Publish build artifacts - if: matrix.env.pack && !matrix.qt.check_only + if: matrix.env.pack uses: actions/upload-artifact@v3 with: path: build/release/pack/Gittyup-* name: Gittyup ${{ matrix.env.name }} - name: Publish version file - if: matrix.env.pack && !matrix.qt.check_only + if: matrix.env.pack uses: actions/upload-artifact@v3 with: path: build/release/VERSION.txt From 3986e2ac54582222ceaeb6e021cd68ea03f29ec8 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:41:18 +0200 Subject: [PATCH 08/76] Reason: --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92f2a62d6..91794e1a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,7 +126,7 @@ jobs: fail-fast: false matrix: qt: - - version: 6.5 + - version: 6.5.* env: - name: linux From 7bf3f9a226dc19f5abc92ef127683dbfd566f847 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:42:30 +0200 Subject: [PATCH 09/76] update action --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91794e1a0..6abc1225e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -203,7 +203,7 @@ jobs: perl-version: '5.30' - name: Install Qt - uses: jurplel/install-qt-action@v2.13.0 + uses: jurplel/install-qt-action@v3.3.0 timeout-minutes: 10 with: version: ${{ matrix.qt.version }} From 318760f53612272453a7a4c8d93f97ecb469eb18 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 11:10:17 +0200 Subject: [PATCH 10/76] try to remove xcbqpa --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acaadab1b..46dc04016 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,10 +118,6 @@ find_package( COMPONENTS ${QT_MODULES} LinguistTools REQUIRED) if(FLATPAK) - find_package( - Qt6 - COMPONENTS XcbQpa - REQUIRED) add_compile_definitions(FLATPAK) endif() From 39e0348a35a27c58121cfa6e8af569d4d60302d7 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 11:17:41 +0200 Subject: [PATCH 11/76] use temporarly different branch from flathub with Qt6 upgrade --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6abc1225e..300d907c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,6 +73,12 @@ jobs: owner: 'flathub' repository: 'com.github.Murmele.Gittyup' + # just until the new release is out + - name: Checkout restructureCMake + run: | + cd com.github.Murmele.Gittyup + git checkout Qt6 + - name: Replace git tag by the commit id on which it runs if: github.ref_type != 'tag' run: > From 93e49b3b70cdc6ceb3b34f2ac1dad3cbb63bf5fd Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 12:30:02 +0200 Subject: [PATCH 12/76] Wrong weekday in unittests --- test/amend.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/test/amend.cpp b/test/amend.cpp index 475aebee6..b85a40ed3 100644 --- a/test/amend.cpp +++ b/test/amend.cpp @@ -57,10 +57,12 @@ void TestAmend::testAmend() { auto authorSignature = repo.signature( "New Author", "New Author Email", - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + + QString dateAuthor = "Mon May 23 10:36:26 2022 +0200"; auto committerSignature = repo.signature( "New Committer", "New Committer Email", - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); Tree tree; c.amend(authorSignature, committerSignature, commitMessage, tree); @@ -73,12 +75,12 @@ void TestAmend::testAmend() { QCOMPARE(c.author().name(), "New Author"); QCOMPARE( c.author().date(), - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); QCOMPARE(c.committer().name(), "New Committer"); QCOMPARE(c.committer().email(), "New Committer Email"); QCOMPARE( c.committer().date(), - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); } void TestAmend::testAmendAddFile() { @@ -196,10 +198,10 @@ void TestAmend::testAmendDialog() { Test::ScratchRepository repo; auto authorSignature = repo->signature( "New Author", "New Author Email", - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); auto committerSignature = repo->signature( "New Committer", "New Committer Email", - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); { AmendDialog d(authorSignature, committerSignature, "Test commit message"); @@ -241,7 +243,7 @@ void TestAmend::testAmendDialog() { ContributorInfo::SelectedDateTimeType::Original); QCOMPARE(authorCommitDate->isVisible(), false); QCOMPARE(info.authorInfo.commitDate, - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); // manual @@ -290,7 +292,7 @@ void TestAmend::testAmendDialog() { ContributorInfo::SelectedDateTimeType::Original); QCOMPARE(committerCommitDate->isVisible(), false); QCOMPARE(info.committerInfo.commitDate, - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); // manual @@ -318,10 +320,10 @@ void TestAmend::testAmendDialog2() { Test::ScratchRepository repo; auto authorSignature = repo->signature( "New Author", "New Author Email", - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); auto committerSignature = repo->signature( "New Committer", "New Committer Email", - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); AmendDialog d(authorSignature, committerSignature, "Test commit message"); @@ -373,10 +375,10 @@ void TestAmend::testAmendDialogNewLineInMessage() { Test::ScratchRepository repo; auto authorSignature = repo->signature( "New Author", "New Author Email", - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); auto committerSignature = repo->signature( "New Committer", "New Committer Email", - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); AmendDialog d(authorSignature, committerSignature, "Test commit message\nNewLine"); From e468b2b841f89658af5da1aa913c391b13da74aa Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 12:58:01 +0200 Subject: [PATCH 13/76] remove Win32 support because Qt6 does not support it anymore --- .github/workflows/build.yml | 19 ------------------- test/CMakeLists.txt | 32 ++++++-------------------------- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 300d907c8..9773e150c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -166,23 +166,6 @@ jobs: CXX: clang++ pack: 1 - - name: win32 - os: windows-latest - ninja_platform: win - qt_platform: windows - qt_arch: win32_msvc2019 - qt_arch_check_only: win32_msvc2017 - openssl_arch: VC-WIN32 - msvc_arch: x86 - cmake_flags: "-DUSE_BUNDLED_ZLIB=1" - cmake_env: - CMAKE_RC_FLAGS: "/C 1252" - CC: clang - CXX: clang++ - CMAKE_C_FLAGS: -m32 - CMAKE_CXX_FLAGS: -m32 - pack: 1 - steps: # otherwise the testcases will fail, because signature is invalid - name: Set git name and email @@ -358,7 +341,6 @@ jobs: automatic_release_tag: 'development' files: | **/artifacts/Gittyup win64/Gittyup*.exe - **/artifacts/Gittyup win32/Gittyup*.exe **/artifacts/Gittyup macos/Gittyup*.dmg **/artifacts/Gittyup Flatpak/com.github.Murmele.Gittyup.yml **/Gittyup-x86_64/*.flatpak @@ -373,7 +355,6 @@ jobs: automatic_release_tag: ${{ github.ref_name }} files: | **/artifacts/Gittyup win64/Gittyup*.exe - **/artifacts/Gittyup win32/Gittyup*.exe **/artifacts/Gittyup macos/Gittyup*.dmg **/artifacts/Gittyup Flatpak/com.github.Murmele.Gittyup.yml **/Gittyup-x86_64/*.flatpak diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3a388f18e..d499febb9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ # Define test macro. macro(test) - cmake_parse_arguments(ARG "NO_WIN32_OFFSCREEN" "NAME" "" ${ARGN}) + cmake_parse_arguments(ARG "" "NAME" "" ${ARGN}) add_executable(test_${ARG_NAME} ${ARG_NAME}.cpp) target_link_libraries(test_${ARG_NAME} testlib) @@ -15,24 +15,13 @@ macro(test) add_test(NAME ${ARG_NAME} COMMAND $) add_dependencies(check_build test_${ARG_NAME}) - if(${ARG_NO_WIN32_OFFSCREEN}) - set_property( - TEST ${ARG_NAME} - APPEND - PROPERTY LABELS "NO_WIN32_OFFSCREEN") - endif() - if(WIN32) find_package(Qt6Gui) string(REPLACE ";" "\;" NEWPATH "$ENV{PATH}") string(REPLACE ";" "\;" PLUGIN_PATH "$") - if(${ARG_NO_WIN32_OFFSCREEN}) - set(PLATFORM "windows") - else() - set(PLATFORM "offscreen") - endif() + set(PLATFORM "offscreen") set_tests_properties( ${ARG_NAME} @@ -57,15 +46,6 @@ add_custom_target( COMMENT "Running tests..." USES_TERMINAL) -# Add check target excluding NO_WIN32_OFFSCREEN tests. -add_custom_target( - check_no_win32_offscreen - COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure - --timeout 300 --label-exclude NO_WIN32_OFFSCREEN - DEPENDS check_build - COMMENT "Running tests..." - USES_TERMINAL) - enable_testing() # Add test library. @@ -92,10 +72,10 @@ test(NAME bare_repo) test(NAME init_repo) test(NAME merge) test(NAME external_tools_dialog) -test(NAME branches_panel NO_WIN32_OFFSCREEN) -test(NAME editor NO_WIN32_OFFSCREEN) +test(NAME branches_panel) +test(NAME editor) test(NAME index) -test(NAME line_endings NO_WIN32_OFFSCREEN) +test(NAME line_endings) test(NAME log) test(NAME main_window) test(NAME new_branch_dialog) @@ -110,7 +90,7 @@ test(NAME referencelist) test(NAME amend) test(NAME SshConfig) test(NAME store) -test(NAME fileContextMenu NO_WIN32_OFFSCREEN) +test(NAME fileContextMenu) test(NAME Setting) test(NAME commitMessageTemplate) test(NAME commitEditor) From f9ea3663c2426866e17e28235579fb1169c6a182 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 15:12:23 +0200 Subject: [PATCH 14/76] add includes --- src/app/CustomTheme.cpp | 1 + src/app/Theme.cpp | 1 + src/conf/Settings.cpp | 1 + src/git/Diff.cpp | 1 + src/host/Account.cpp | 1 + src/index/Index.cpp | 2 ++ src/plugins/Plugin.cpp | 2 ++ 7 files changed, 9 insertions(+) diff --git a/src/app/CustomTheme.cpp b/src/app/CustomTheme.cpp index b23138d51..c4ec31c71 100644 --- a/src/app/CustomTheme.cpp +++ b/src/app/CustomTheme.cpp @@ -15,6 +15,7 @@ #include #include #include +#include namespace { diff --git a/src/app/Theme.cpp b/src/app/Theme.cpp index 628842462..b677c3084 100644 --- a/src/app/Theme.cpp +++ b/src/app/Theme.cpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace { diff --git a/src/conf/Settings.cpp b/src/conf/Settings.cpp index 1d6a87f24..84ff3b089 100644 --- a/src/conf/Settings.cpp +++ b/src/conf/Settings.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #ifdef Q_OS_WIN #define CS Qt::CaseInsensitive diff --git a/src/git/Diff.cpp b/src/git/Diff.cpp index 519d1a0d3..2497aa82f 100644 --- a/src/git/Diff.cpp +++ b/src/git/Diff.cpp @@ -12,6 +12,7 @@ #include "Debug.h" #include "git2/patch.h" #include +#include bool containsPath(QString &str, QString &occurence, Qt::CaseSensitivity cs) { if (str.contains(occurence, cs)) { diff --git a/src/host/Account.cpp b/src/host/Account.cpp index 0e2af7030..1abbac572 100644 --- a/src/host/Account.cpp +++ b/src/host/Account.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace { diff --git a/src/index/Index.cpp b/src/index/Index.cpp index d48ad5d8d..d448b2db2 100644 --- a/src/index/Index.cpp +++ b/src/index/Index.cpp @@ -22,6 +22,8 @@ #include #include +#include + namespace { const QString kLogKey = "debug/indexer"; diff --git a/src/plugins/Plugin.cpp b/src/plugins/Plugin.cpp index 54190c1f3..945873dc9 100644 --- a/src/plugins/Plugin.cpp +++ b/src/plugins/Plugin.cpp @@ -15,6 +15,8 @@ #include #include +#include + extern "C" { #include "lua.h" #include "lauxlib.h" From 7afb87cb73061f62ce0d66710d1db8eab6da5f4b Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Tue, 31 Oct 2023 20:18:05 +0100 Subject: [PATCH 15/76] try to fix compilation error on windows --- src/index/indexer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index a660307ba..99c233955 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -53,14 +53,14 @@ static LONG WINAPI exceptionFilter(PEXCEPTION_POINTERS info) { SYSTEMTIME localTime; GetLocalTime(&localTime); - char temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; GetTempPath(MAX_PATH, temp); - char dir[MAX_PATH]; + wchar_t dir[MAX_PATH]; StringCchPrintf(dir, MAX_PATH, "%sGittyup", temp); CreateDirectory(dir, NULL); - char fileName[MAX_PATH]; + wchar_t fileName[MAX_PATH]; StringCchPrintf( fileName, MAX_PATH, "%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", dir, "indexer", GITTYUP_VERSION, localTime.wYear, localTime.wMonth, From b08b6836335482e07e4a8b4d07a05b5edf6d5617 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Tue, 31 Oct 2023 20:22:59 +0100 Subject: [PATCH 16/76] try to fix compilation on mac --- src/app/CustomTheme_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/CustomTheme_mac.mm b/src/app/CustomTheme_mac.mm index 46983231a..46e250d8f 100644 --- a/src/app/CustomTheme_mac.mm +++ b/src/app/CustomTheme_mac.mm @@ -25,7 +25,7 @@ if (color.lightnessF() < 0.5) win.appearance = [NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]; - qreal r,g,b,a; + float r,g,b,a; color.getRgbF(&r,&g,&b,&a); win.backgroundColor = [NSColor colorWithDeviceRed:r green:g blue:b alpha:a]; } From 706f28800927b938f214fa6edb0f1b1c438d9a69 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 18:23:59 +0100 Subject: [PATCH 17/76] fix compilation on win --- src/app/Application.cpp | 21 +++++++++++---------- src/index/indexer.cpp | 13 +++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/app/Application.cpp b/src/app/Application.cpp index fa1178947..d98e55577 100644 --- a/src/app/Application.cpp +++ b/src/app/Application.cpp @@ -62,19 +62,20 @@ static LONG WINAPI exceptionFilter(PEXCEPTION_POINTERS info) { SYSTEMTIME localTime; GetLocalTime(&localTime); - char temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; GetTempPath(MAX_PATH, temp); - char dir[MAX_PATH]; - StringCchPrintf(dir, MAX_PATH, "%sGittyup", temp); + wchar_t dir[MAX_PATH]; + const wchar_t *gittyup_name = L"%sGittyup"; + StringCchPrintf(dir, MAX_PATH, gittyup_name, temp); CreateDirectory(dir, NULL); - char fileName[MAX_PATH]; - StringCchPrintf( - fileName, MAX_PATH, "%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", - dir, GITTYUP_NAME, GITTYUP_VERSION, localTime.wYear, localTime.wMonth, - localTime.wDay, localTime.wHour, localTime.wMinute, localTime.wSecond, - GetCurrentProcessId(), GetCurrentThreadId()); + wchar_t fileName[MAX_PATH]; + const wchar_t *s = L"%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp"; + StringCchPrintf(fileName, MAX_PATH, s, dir, GITTYUP_NAME, GITTYUP_VERSION, + localTime.wYear, localTime.wMonth, localTime.wDay, + localTime.wHour, localTime.wMinute, localTime.wSecond, + GetCurrentProcessId(), GetCurrentThreadId()); HANDLE dumpFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, @@ -352,7 +353,7 @@ class CopyDataWindow : public QWindow { protected: virtual bool nativeEvent(const QByteArray &eventType, void *message, - long *result) Q_DECL_OVERRIDE { + qintptr *result) Q_DECL_OVERRIDE { MSG *msg = (MSG *)message; if (msg->message == WM_COPYDATA) { diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index 99c233955..78220f10b 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -57,15 +57,16 @@ static LONG WINAPI exceptionFilter(PEXCEPTION_POINTERS info) { GetTempPath(MAX_PATH, temp); wchar_t dir[MAX_PATH]; - StringCchPrintf(dir, MAX_PATH, "%sGittyup", temp); + const wchar_t *gittyup_name = L"%sGittyup"; + StringCchPrintf(dir, MAX_PATH, gittyup_name, temp); CreateDirectory(dir, NULL); wchar_t fileName[MAX_PATH]; - StringCchPrintf( - fileName, MAX_PATH, "%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", - dir, "indexer", GITTYUP_VERSION, localTime.wYear, localTime.wMonth, - localTime.wDay, localTime.wHour, localTime.wMinute, localTime.wSecond, - GetCurrentProcessId(), GetCurrentThreadId()); + const wchar_t *s = L"%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp"; + StringCchPrintf(fileName, MAX_PATH, s, dir, "indexer", GITTYUP_VERSION, + localTime.wYear, localTime.wMonth, localTime.wDay, + localTime.wHour, localTime.wMinute, localTime.wSecond, + GetCurrentProcessId(), GetCurrentThreadId()); HANDLE dumpFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, From e99a59f5cc53772ace8176b8f63eb33f6640dd58 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 18:25:52 +0100 Subject: [PATCH 18/76] fix ninja check for windows --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9773e150c..5e8d58077 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -297,7 +297,7 @@ jobs: if: matrix.env.ninja_platform == 'win' run: | cd build/release - ninja check_no_win32_offscreen + ninja check --verbose publish: # https://github.com/marvinpinto/actions/issues/177 From 57cf7c9ffd8b542400a25a6498646c280edb3889 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 19:07:49 +0100 Subject: [PATCH 19/76] use always windows --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d499febb9..3d2e0819a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,7 +21,7 @@ macro(test) string(REPLACE ";" "\;" PLUGIN_PATH "$") - set(PLATFORM "offscreen") + set(PLATFORM "windows") set_tests_properties( ${ARG_NAME} From dfb45a637b1d136248cb9a5cb3f6375a1760fec9 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 22:53:13 +0100 Subject: [PATCH 20/76] revert --- test/CMakeLists.txt | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3d2e0819a..54503d4e4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ # Define test macro. macro(test) - cmake_parse_arguments(ARG "" "NAME" "" ${ARGN}) + cmake_parse_arguments(ARG "NO_WIN32_OFFSCREEN" "NAME" "" ${ARGN}) add_executable(test_${ARG_NAME} ${ARG_NAME}.cpp) target_link_libraries(test_${ARG_NAME} testlib) @@ -15,13 +15,24 @@ macro(test) add_test(NAME ${ARG_NAME} COMMAND $) add_dependencies(check_build test_${ARG_NAME}) + if(${ARG_NO_WIN32_OFFSCREEN}) + set_property( + TEST ${ARG_NAME} + APPEND + PROPERTY LABELS "NO_WIN32_OFFSCREEN") + endif() + if(WIN32) find_package(Qt6Gui) string(REPLACE ";" "\;" NEWPATH "$ENV{PATH}") string(REPLACE ";" "\;" PLUGIN_PATH "$") - set(PLATFORM "windows") + if(${ARG_NO_WIN32_OFFSCREEN}) + set(PLATFORM "windows") + else() + set(PLATFORM "offscreen") + endif() set_tests_properties( ${ARG_NAME} @@ -46,6 +57,16 @@ add_custom_target( COMMENT "Running tests..." USES_TERMINAL) +# Add check target excluding NO_WIN32_OFFSCREEN tests. +add_custom_target( + check_no_win32_offscreen + COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure + --timeout 300 --label-exclude NO_WIN32_OFFSCREEN + DEPENDS check_build + COMMENT "Running tests..." + USES_TERMINAL) + + enable_testing() # Add test library. @@ -90,7 +111,7 @@ test(NAME referencelist) test(NAME amend) test(NAME SshConfig) test(NAME store) -test(NAME fileContextMenu) +test(NAME fileContextMenu NO_WIN32_OFFSCREEN) test(NAME Setting) test(NAME commitMessageTemplate) test(NAME commitEditor) From 8e467ce6c8395004355ae8f39db9f1e615764fe5 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 22:53:19 +0100 Subject: [PATCH 21/76] revert --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e8d58077..04668891e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -297,7 +297,7 @@ jobs: if: matrix.env.ninja_platform == 'win' run: | cd build/release - ninja check --verbose + ninja check check_no_win32_offscreen publish: # https://github.com/marvinpinto/actions/issues/177 From 35680a2561baa04b5911b4bff592312bb7d0683e Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 22:54:29 +0100 Subject: [PATCH 22/76] revert and format --- .github/workflows/build.yml | 2 +- test/CMakeLists.txt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04668891e..9773e150c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -297,7 +297,7 @@ jobs: if: matrix.env.ninja_platform == 'win' run: | cd build/release - ninja check check_no_win32_offscreen + ninja check_no_win32_offscreen publish: # https://github.com/marvinpinto/actions/issues/177 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 54503d4e4..99ba8fe34 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,9 +29,9 @@ macro(test) "$") if(${ARG_NO_WIN32_OFFSCREEN}) - set(PLATFORM "windows") + set(PLATFORM "windows") else() - set(PLATFORM "offscreen") + set(PLATFORM "offscreen") endif() set_tests_properties( @@ -66,7 +66,6 @@ add_custom_target( COMMENT "Running tests..." USES_TERMINAL) - enable_testing() # Add test library. From fe3f6e4ab0095beeab6df8d5cce716fdfe811eaa Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Tue, 21 Nov 2023 22:19:22 +0100 Subject: [PATCH 23/76] fix compilation --- l10n/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n/CMakeLists.txt b/l10n/CMakeLists.txt index a165d44d5..dfd68fc63 100644 --- a/l10n/CMakeLists.txt +++ b/l10n/CMakeLists.txt @@ -38,7 +38,7 @@ add_dependencies(gittyup translations) add_library(translation ${LANGUAGE_SOURCE_FILE}) target_include_directories(translation PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries(translation Qt5::Core) +target_link_libraries(translation Qt6::Core) # install language files From 6cdd2c74accae4abda3dde8b3a83398f15e99d10 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 13 Dec 2023 21:51:19 +0100 Subject: [PATCH 24/76] dirty fix for macos In Qt5 QT_LIBRAY points to the symlink and in Qt6 it points directly to the library --- pack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 1b610f0ce..1e1057ae3 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -85,7 +85,7 @@ elseif(NOT USE_SYSTEM_QT) get_filename_component(QT_FRAMEWORK ${QT_LIBRARY} DIRECTORY) set(DEST_DIR ${CONTENTS_DIR}/Frameworks) install( - DIRECTORY ${QT_FRAMEWORK} + DIRECTORY ${QT_FRAMEWORK}/../.. DESTINATION ${DEST_DIR} COMPONENT ${GITTYUP_NAME} PATTERN "*.prl" EXCLUDE From f1e54d88fda3fa4744d4e588935630811fc194d7 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 15 Dec 2023 10:11:13 +0100 Subject: [PATCH 25/76] dirty fix for macos --- pack/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 1e1057ae3..b37c9ff09 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -83,9 +83,13 @@ elseif(NOT USE_SYSTEM_QT) if(APPLE) get_filename_component(QT_FRAMEWORK ${QT_LIBRARY} DIRECTORY) + + # FIXME: QT_LIBRARY points directly to the library bin instead of the symlink 2 directories above (since qt6) + string(REGEX REPLACE "/Versions/.*" "" QT_FRAMEWORK "${QT_FRAMEWORK}") + set(DEST_DIR ${CONTENTS_DIR}/Frameworks) install( - DIRECTORY ${QT_FRAMEWORK}/../.. + DIRECTORY ${QT_FRAMEWORK} DESTINATION ${DEST_DIR} COMPONENT ${GITTYUP_NAME} PATTERN "*.prl" EXCLUDE From 936125d04ace163b83533d780518b71debbc3519 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 15 Dec 2023 12:05:05 +0100 Subject: [PATCH 26/76] Rebase to upstream master --- CMakeLists.txt | 10 +++++----- dep/openssl/openssl | 2 +- dep/scintilla/CMakeLists.txt | 2 +- l10n/CMakeLists.txt | 4 ++-- pack/CMakeLists.txt | 10 +++++----- src/app/CMakeLists.txt | 8 ++++---- src/app/Gittyup.cpp | 2 -- src/cli/CMakeLists.txt | 2 +- src/conf/CMakeLists.txt | 2 +- src/conf/Settings.cpp | 5 +++-- src/cred/CMakeLists.txt | 4 +++- src/dialogs/CMakeLists.txt | 4 +++- src/dialogs/ConfigDialog.cpp | 3 ++- src/dialogs/DeleteBranchDialog.cpp | 3 ++- src/dialogs/DeleteTagDialog.cpp | 3 ++- src/dialogs/DiffPanel.cpp | 19 ++++++++++++++---- src/dialogs/IconLabel.cpp | 3 +-- src/dialogs/SettingsDialog.cpp | 1 + src/editor/PlatQt.cpp | 2 +- src/editor/ScintillaQt.cpp | 15 +++++++------- src/git/CMakeLists.txt | 2 +- src/git/Commit.cpp | 8 +++++--- src/git/Commit.h | 1 + src/git/Diff.cpp | 6 +++--- src/git/Diff.h | 2 +- src/git/Index.cpp | 2 +- src/git/Remote.cpp | 4 ++-- src/git/Repository.cpp | 9 ++++----- src/git/Repository.h | 3 ++- src/git/Signature.cpp | 2 +- src/git/Signature.h | 2 +- src/host/CMakeLists.txt | 2 +- src/host/Repository.h | 1 + src/index/CMakeLists.txt | 6 +++--- src/index/Query.cpp | 18 +++++++---------- src/index/indexer.cpp | 10 +++------- src/log/CMakeLists.txt | 2 +- src/log/LogDelegate.cpp | 4 ++-- src/log/LogModel.cpp | 1 + src/log/LogView.cpp | 9 ++++++--- src/plugins/CMakeLists.txt | 2 +- src/tools/CMakeLists.txt | 2 +- src/tools/DiffTool.cpp | 2 +- src/tools/MergeTool.cpp | 2 +- src/ui/AdvancedSearchWidget.cpp | 3 +-- src/ui/BlameEditor.cpp | 5 ++--- src/ui/BlameMargin.cpp | 14 ++++++------- src/ui/CMakeLists.txt | 6 +++--- src/ui/ColumnView.cpp | 4 ++-- src/ui/CommitList.cpp | 14 +++++++++---- src/ui/CommitToolBar.cpp | 1 + src/ui/DetailView.cpp | 15 +++++++------- src/ui/DiffView/HunkWidget.cpp | 4 ++-- src/ui/DiffView/Images.cpp | 2 +- src/ui/FindWidget.cpp | 2 +- src/ui/MainWindow.cpp | 1 - src/ui/MenuBar.cpp | 2 +- src/ui/ReferenceView.cpp | 3 ++- src/ui/RepoView.cpp | 7 ++++--- src/ui/SpellChecker.cpp | 32 +++++++++++++++++++----------- src/ui/SpellChecker.h | 3 ++- src/ui/ToolBar.cpp | 5 +++-- src/ui/TreeView.cpp | 5 +++-- src/ui/ViewDelegate.cpp | 2 +- src/update/CMakeLists.txt | 6 +++--- src/update/relauncher.cpp | 2 +- src/util/CMakeLists.txt | 2 +- src/watcher/CMakeLists.txt | 2 +- test/CMakeLists.txt | 6 +++--- 69 files changed, 195 insertions(+), 159 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b1d8f32a..acaadab1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,12 +114,12 @@ else() endif() find_package( - Qt5 5.12 + Qt6 COMPONENTS ${QT_MODULES} LinguistTools REQUIRED) if(FLATPAK) find_package( - Qt5 5.15 + Qt6 COMPONENTS XcbQpa REQUIRED) add_compile_definitions(FLATPAK) @@ -135,7 +135,7 @@ endif() include(GNUInstallDirs) # Defines some variables as BINDIR, LIBDIR, ... -set(QT_TRANSLATIONS_DIR "${Qt5_DIR}/../../../translations") +set(QT_TRANSLATIONS_DIR "${Qt6_DIR}/../../../translations") set(QT_TRANSLATIONS_DIR "/usr/share/qt/translations") if(APPLE) @@ -145,8 +145,8 @@ if(APPLE) # dependencies are to the release libraries (e.g. QtGui_debug depends on # QtCore). This causes multiple symbol definition errors at application load # time. - get_target_property(LOCATION Qt5::${QT_MODULE} LOCATION) - set_target_properties(Qt5::${QT_MODULE} PROPERTIES IMPORTED_LOCATION_DEBUG + get_target_property(LOCATION Qt6::${QT_MODULE} LOCATION) + set_target_properties(Qt6::${QT_MODULE} PROPERTIES IMPORTED_LOCATION_DEBUG ${LOCATION}) endforeach() endif() diff --git a/dep/openssl/openssl b/dep/openssl/openssl index 3f499b24f..1c01dbcbe 160000 --- a/dep/openssl/openssl +++ b/dep/openssl/openssl @@ -1 +1 @@ -Subproject commit 3f499b24f3bcd66db022074f7e8b4f6ee266a3ae +Subproject commit 1c01dbcbebc08d629d02326d941b8491ae99597d diff --git a/dep/scintilla/CMakeLists.txt b/dep/scintilla/CMakeLists.txt index a7a11972c..9de63ddd1 100644 --- a/dep/scintilla/CMakeLists.txt +++ b/dep/scintilla/CMakeLists.txt @@ -54,7 +54,7 @@ target_compile_definitions( target_include_directories(scintilla PUBLIC ${SCINTILLA_DIR}/src) -target_link_libraries(scintilla Qt5::Widgets lexilla) +target_link_libraries(scintilla Qt6::Widgets lexilla) set_target_properties(scintilla PROPERTIES AUTOMOC ON) diff --git a/l10n/CMakeLists.txt b/l10n/CMakeLists.txt index 14543f0bb..a165d44d5 100644 --- a/l10n/CMakeLists.txt +++ b/l10n/CMakeLists.txt @@ -28,9 +28,9 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/languages.cpp.inc" if(UPDATE_TRANSLATIONS) # FIXME: Clean removes the .ts files. - qt5_create_translation(QM_FILES ${SOURCE_FILES} ${TS_FILES}) + qt6_create_translation(QM_FILES ${SOURCE_FILES} ${TS_FILES}) else() - qt5_add_translation(QM_FILES ${TS_FILES}) + qt6_add_translation(QM_FILES ${TS_FILES}) endif() add_custom_target(translations DEPENDS ${QM_FILES}) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index c9b5f4de4..5b72c6abd 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -28,13 +28,13 @@ if(FLATPAK) qt_import_plugins(gittyup INCLUDE ${QT_PLUGINS}) elseif(NOT USE_SYSTEM_QT) foreach(QT_PLUGIN ${QT_PLUGINS}) - if(NOT TARGET Qt5::${QT_PLUGIN}) + if(NOT TARGET Qt6::${QT_PLUGIN}) if(UNIX OR APPLE) continue() endif() endif() - get_target_property(PLUGIN Qt5::${QT_PLUGIN} LOCATION_${CMAKE_BUILD_TYPE}) + get_target_property(PLUGIN Qt6::${QT_PLUGIN} LOCATION_${CMAKE_BUILD_TYPE}) get_filename_component(FILE_NAME ${PLUGIN} NAME) get_filename_component(DIR ${PLUGIN} DIRECTORY) get_filename_component(DIR_NAME ${DIR} NAME) @@ -78,7 +78,7 @@ elseif(NOT USE_SYSTEM_QT) # Install Qt libraries. foreach(QT_MODULE ${QT_MODULES}) - get_target_property(QT_LIBRARY Qt5::${QT_MODULE} + get_target_property(QT_LIBRARY Qt6::${QT_MODULE} LOCATION_${CMAKE_BUILD_TYPE}) if(APPLE) @@ -131,8 +131,8 @@ endif() # Install XcbQpa library. if(UNIX AND NOT APPLE) - set(LIB_NAME libQt5XcbQpa) - get_target_property(QT_CORE_LIBRARY Qt5::Core LOCATION) + set(LIB_NAME libQt6XcbQpa) + get_target_property(QT_CORE_LIBRARY Qt6::Core LOCATION) get_filename_component(LIB_PATH ${QT_CORE_LIBRARY} PATH) get_filename_component(LIB_EXT ${QT_CORE_LIBRARY} EXT) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 82bdc3331..46def17fd 100755 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -22,7 +22,7 @@ file(GLOB SCINTILLUA_LEXERS ${SRC_SCINTILLUA_LEXERS_DIR}/*.lua) file(GLOB LUA_PLUGINS ${CONF_DIR}/plugins/*.lua ${CONF_DIR}/plugins/*.txt) # Build resources. -qt5_add_resources(RESOURCES ${RSRC_DIR}/resources.qrc) +qt6_add_resources(RESOURCES ${RSRC_DIR}/resources.qrc) # Generate acknowledgments. set(DOC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/docs) @@ -74,12 +74,12 @@ target_link_libraries( git ui update - Qt5::Widgets) + Qt6::Widgets) set_target_properties(app PROPERTIES AUTOMOC ON) if(UNIX AND NOT APPLE) - target_link_libraries(app Qt5::DBus) + target_link_libraries(app Qt6::DBus) endif() # Add main executable. @@ -171,7 +171,7 @@ install( COMPONENT ${GITTYUP_NAME}) if(APPLE) - get_target_property(QT_LIBRARY Qt5::Core LOCATION) + get_target_property(QT_LIBRARY Qt6::Core LOCATION) get_filename_component(QT_FRAMEWORK ${QT_LIBRARY} DIRECTORY) get_filename_component(RPATH ${QT_FRAMEWORK} DIRECTORY) diff --git a/src/app/Gittyup.cpp b/src/app/Gittyup.cpp index 69649f8c2..5238195e7 100644 --- a/src/app/Gittyup.cpp +++ b/src/app/Gittyup.cpp @@ -13,8 +13,6 @@ #include int main(int argc, char *argv[]) { - Application::setAttribute(Qt::AA_EnableHighDpiScaling); - Application::setAttribute(Qt::AA_UseHighDpiPixmaps); Application app(argc, argv, true); // Check if only one running instance is allowed and already running diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt index 74dcd7e16..156fc39bf 100644 --- a/src/cli/CMakeLists.txt +++ b/src/cli/CMakeLists.txt @@ -7,4 +7,4 @@ endif() add_library(cli Installer.cpp ${INSTALLER_IMPL_FILE}) -target_link_libraries(cli Qt5::Core ${INSTALLER_IMPL_LIBS}) +target_link_libraries(cli Qt6::Core ${INSTALLER_IMPL_LIBS}) diff --git a/src/conf/CMakeLists.txt b/src/conf/CMakeLists.txt index bbb0f2ce2..e3e06f2cc 100644 --- a/src/conf/CMakeLists.txt +++ b/src/conf/CMakeLists.txt @@ -1,7 +1,7 @@ add_library(conf ConfFile.cpp Settings.cpp Setting.cpp RecentRepositories.cpp RecentRepository.cpp) -target_link_libraries(conf lua Qt5::Core util translation) +target_link_libraries(conf lua Qt6::Core util translation) # SRC_ definitions point to the source directly target_compile_definitions( diff --git a/src/conf/Settings.cpp b/src/conf/Settings.cpp index 184703c3e..e012eb5a5 100644 --- a/src/conf/Settings.cpp +++ b/src/conf/Settings.cpp @@ -14,6 +14,7 @@ #include "languages.h" #include #include +#include #include #include @@ -124,8 +125,8 @@ QString Settings::lexer(const QString &filename) { QVariantMap map(lexers.value(key).toMap()); if (map.contains("patterns")) { foreach (QString pattern, map.value("patterns").toString().split(",")) { - QRegExp regExp(pattern, CS, QRegExp::Wildcard); - if (regExp.exactMatch(name)) + QRegularExpression regExp{QRegularExpression::fromWildcard(pattern, CS)}; + if (regExp.match(name).hasMatch()) return key; } } diff --git a/src/cred/CMakeLists.txt b/src/cred/CMakeLists.txt index e3516b2a6..9f686fde8 100644 --- a/src/cred/CMakeLists.txt +++ b/src/cred/CMakeLists.txt @@ -1,5 +1,7 @@ add_library(cred Cache.cpp Store.cpp CredentialHelper.cpp GitCredential.cpp) -target_link_libraries(cred conf git Qt5::Core) +target_link_libraries(cred conf git Qt6::Core) +add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp + ${CREDENTIAL_IMPL_FILE}) set_target_properties(cred PROPERTIES AUTOMOC ON) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index 0295257e2..65b307b08 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -39,6 +39,8 @@ target_compile_definitions( target_include_directories(dialogs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +find_package(Qt6 COMPONENTS Core5Compat REQUIRED) + target_link_libraries( dialogs cli @@ -46,6 +48,6 @@ target_link_libraries( cred host index - Qt5::Widgets) + Qt6::Widgets) set_target_properties(dialogs PROPERTIES AUTOMOC ON) diff --git a/src/dialogs/ConfigDialog.cpp b/src/dialogs/ConfigDialog.cpp index 7327532f2..a1844c109 100644 --- a/src/dialogs/ConfigDialog.cpp +++ b/src/dialogs/ConfigDialog.cpp @@ -30,6 +30,7 @@ #include "ui/MainWindow.h" #include "ui/RepoView.h" #include +#include #include #include #include @@ -506,7 +507,7 @@ class LfsPanel : public QWidget { watcher->deleteLater(); }); - watcher->setFuture(QtConcurrent::run(repo, &git::Repository::lfsTracked)); + watcher->setFuture(QtConcurrent::run(&git::Repository::lfsTracked, repo)); Footer *footer = new Footer(includedList); connect(footer, &Footer::plusClicked, this, diff --git a/src/dialogs/DeleteBranchDialog.cpp b/src/dialogs/DeleteBranchDialog.cpp index 20741b0c3..79a3f0566 100644 --- a/src/dialogs/DeleteBranchDialog.cpp +++ b/src/dialogs/DeleteBranchDialog.cpp @@ -61,8 +61,9 @@ DeleteBranchDialog::DeleteBranchDialog(const git::Branch &branch, entry->setBusy(true); QStringList refspecs(QString(":%1").arg(upstreamName)); + git::Result (git::Remote::*push)(git::Remote::Callbacks*, const QStringList&) = &git::Remote::push; watcher->setFuture( - QtConcurrent::run(remote, &git::Remote::push, callbacks, refspecs)); + QtConcurrent::run(push, remote, callbacks, refspecs)); connect(watcher, &QFutureWatcher::finished, watcher, [entry, watcher, callbacks, remoteName] { diff --git a/src/dialogs/DeleteTagDialog.cpp b/src/dialogs/DeleteTagDialog.cpp index cd0db7af9..1e46bfe3f 100644 --- a/src/dialogs/DeleteTagDialog.cpp +++ b/src/dialogs/DeleteTagDialog.cpp @@ -53,8 +53,9 @@ DeleteTagDialog::DeleteTagDialog(const git::TagRef &tag, QWidget *parent) entry->setBusy(true); QStringList refspecs(QString(":refs/tags/%1").arg(name)); + git::Result (git::Remote::*push)(git::Remote::Callbacks*, const QStringList&) = &git::Remote::push; watcher->setFuture( - QtConcurrent::run(remote, &git::Remote::push, callbacks, refspecs)); + QtConcurrent::run(push, remote, callbacks, refspecs)); connect(watcher, &QFutureWatcher::finished, watcher, [entry, watcher, callbacks, remoteName] { diff --git a/src/dialogs/DiffPanel.cpp b/src/dialogs/DiffPanel.cpp index ddf55827c..54f31df2f 100644 --- a/src/dialogs/DiffPanel.cpp +++ b/src/dialogs/DiffPanel.cpp @@ -21,7 +21,6 @@ #include #include #include -#include DiffPanel::DiffPanel(const git::Repository &repo, QWidget *parent) : QWidget(parent), @@ -45,12 +44,24 @@ DiffPanel::DiffPanel(const git::Repository &repo, QWidget *parent) }); // encoding + + static std::array encodings{ + "Utf8", + "Utf16", + "Utf16LE", + "Utf16BE", + "Utf32", + "Utf32LE", + "Utf32BE", + "Latin1", + }; + QComboBox *encoding = new QComboBox(this); encoding->addItem(tr("System Locale"), -1); encoding->insertSeparator(encoding->count()); - foreach (int mib, QTextCodec::availableMibs()) - encoding->addItem(QTextCodec::codecForMib(mib)->name(), mib); - + for (int i = 0; i < encodings.size(); i++) { + encoding->addItem(encodings[i], i); + } QString name = mConfig.value("gui.encoding"); if (!name.isEmpty()) encoding->setCurrentIndex(encoding->findText(name)); diff --git a/src/dialogs/IconLabel.cpp b/src/dialogs/IconLabel.cpp index 6bd33e1f0..ac7d418de 100644 --- a/src/dialogs/IconLabel.cpp +++ b/src/dialogs/IconLabel.cpp @@ -22,8 +22,7 @@ QSize IconLabel::minimumSizeHint() const { return sizeHint(); } void IconLabel::paintEvent(QPaintEvent *event) { QSize size = sizeHint(); - QWidget *win = window(); QPainter(this).drawPixmap( QStyle::alignedRect(Qt::LeftToRight, Qt::AlignHCenter, size, rect()), - mIcon.pixmap(win ? win->windowHandle() : nullptr, size)); + mIcon.pixmap(size, window()->devicePixelRatio())); } diff --git a/src/dialogs/SettingsDialog.cpp b/src/dialogs/SettingsDialog.cpp index 81dc303fe..712256c8f 100644 --- a/src/dialogs/SettingsDialog.cpp +++ b/src/dialogs/SettingsDialog.cpp @@ -28,6 +28,7 @@ #include "languages.h" #include "update/Updater.h" #include +#include #include #include #include diff --git a/src/editor/PlatQt.cpp b/src/editor/PlatQt.cpp index e054f5cec..f288d2e47 100644 --- a/src/editor/PlatQt.cpp +++ b/src/editor/PlatQt.cpp @@ -329,7 +329,7 @@ void SurfaceImpl::MeasureWidths(Font &font, std::string_view s, XYPOSITION SurfaceImpl::WidthText(Font &font, std::string_view s) { QFontMetricsF metrics(*static_cast(font.GetID()), device); - return metrics.width(QString::fromUtf8(s.data(), s.length())); + return metrics.horizontalAdvance(QString::fromUtf8(s.data(), s.length())); } XYPOSITION SurfaceImpl::Ascent(Font &font) { diff --git a/src/editor/ScintillaQt.cpp b/src/editor/ScintillaQt.cpp index 5df0cc9f9..34fa321f7 100644 --- a/src/editor/ScintillaQt.cpp +++ b/src/editor/ScintillaQt.cpp @@ -327,7 +327,8 @@ void ScintillaQt::keyPressEvent(QKeyEvent *event) { QString text = event->text(); if (input && !text.isEmpty() && text[0].isPrint()) { - InsertCharacter(text.toStdString(), CharacterSource::directInput); + QByteArray utext = text.toUtf8(); + InsertCharacter(std::string_view(utext.data(), utext.size()), CharacterSource::directInput); } else { event->ignore(); } @@ -430,7 +431,7 @@ void ScintillaQt::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasText()) { event->acceptProposedAction(); - Point point = PointFromQPoint(event->pos()); + Point point = PointFromQPoint(event->position().toPoint()); SetDragPosition( SPositionFromLocation(point, false, false, UserVirtualSpace())); } else { @@ -447,7 +448,7 @@ void ScintillaQt::dragMoveEvent(QDragMoveEvent *event) { if (event->mimeData()->hasText()) { event->acceptProposedAction(); - Point point = PointFromQPoint(event->pos()); + Point point = PointFromQPoint(event->position().toPoint()); SetDragPosition( SPositionFromLocation(point, false, false, UserVirtualSpace())); } else { @@ -460,7 +461,7 @@ void ScintillaQt::dropEvent(QDropEvent *event) { event->acceptProposedAction(); const QMimeData *data = event->mimeData(); - Point point = PointFromQPoint(event->pos()); + Point point = PointFromQPoint(event->position().toPoint()); bool move = (event->source() == this && event->proposedAction() == Qt::MoveAction); @@ -520,8 +521,8 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { const unsigned int ucWidth = commitStr.at(i).isHighSurrogate() ? 2 : 1; const QString oneCharUTF16 = commitStr.mid(i, ucWidth); const QByteArray oneChar = oneCharUTF16.toUtf8(); - - InsertCharacter(oneChar.toStdString(), CharacterSource::directInput); + const int oneCharLen = oneChar.length(); + InsertCharacter(std::string_view(oneChar.data(), oneCharLen), CharacterSource::directInput); i += ucWidth; } @@ -604,7 +605,7 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { numBytes += oneCharLen; imeCharPos[i + 1] = numBytes; - InsertCharacter(oneChar.toStdString(), CharacterSource::directInput); + InsertCharacter(std::string_view(oneChar.data(), oneCharLen), CharacterSource::directInput); #ifdef Q_OS_LINUX // Segment marked with imeCaretPos is for target input. diff --git a/src/git/CMakeLists.txt b/src/git/CMakeLists.txt index c9553149b..479eae927 100644 --- a/src/git/CMakeLists.txt +++ b/src/git/CMakeLists.txt @@ -27,6 +27,6 @@ add_library( TagRef.cpp Tree.cpp) -target_link_libraries(git git2 Qt5::Core Qt5::Network util) +target_link_libraries(git git2 Qt6::Core Qt6::Network util) set_target_properties(git PROPERTIES AUTOMOC ON) diff --git a/src/git/Commit.cpp b/src/git/Commit.cpp index 334120c5c..55c60d13c 100644 --- a/src/git/Commit.cpp +++ b/src/git/Commit.cpp @@ -26,7 +26,8 @@ #include #include #include -#include +#include +#include #include namespace git { @@ -291,8 +292,9 @@ void Commit::setStarred(bool starred) { QString Commit::decodeMessage(const char *msg) const { if (const char *encoding = git_commit_message_encoding(*this)) { - if (QTextCodec *codec = QTextCodec::codecForName(encoding)) - return codec->toUnicode(msg); + auto conv = QStringConverter::encodingForName(encoding); + if (conv.has_value()) + return QStringDecoder{conv.value()}.decode(msg); } return msg; diff --git a/src/git/Commit.h b/src/git/Commit.h index 51d02be5c..c3a102807 100644 --- a/src/git/Commit.h +++ b/src/git/Commit.h @@ -15,6 +15,7 @@ #include "git2/revwalk.h" #include "git2/reset.h" #include "Blob.h" +#include class QDateTime; diff --git a/src/git/Diff.cpp b/src/git/Diff.cpp index a85ae545d..519d1a0d3 100644 --- a/src/git/Diff.cpp +++ b/src/git/Diff.cpp @@ -15,11 +15,11 @@ bool containsPath(QString &str, QString &occurence, Qt::CaseSensitivity cs) { if (str.contains(occurence, cs)) { - if (str.count() == occurence.count()) { + if (str.size() == occurence.size()) { // file/folder matches exactly return true; - } else if (str.count() >= occurence.length() + 1 && - str[occurence.length()] == "/") { + } else if (str.size() >= occurence.length() + 1 && + str[occurence.length()] == '/') { // file or folder in occurence return true; } diff --git a/src/git/Diff.h b/src/git/Diff.h index d1f7d278a..042b06156 100644 --- a/src/git/Diff.h +++ b/src/git/Diff.h @@ -59,7 +59,7 @@ class Diff { * \return */ QByteArray print(); - bool isValid() const { return d; } + bool isValid() const { return d ? true : false; } explicit operator bool() const { return isValid(); } bool isConflicted() const; diff --git a/src/git/Index.cpp b/src/git/Index.cpp index b80b81870..95cd8926e 100644 --- a/src/git/Index.cpp +++ b/src/git/Index.cpp @@ -180,7 +180,7 @@ void Index::setStaged(const QStringList &files, bool staged, bool yieldFocus) { if (!smHead.isValid()) continue; - git_time_t time = smHead.committer().date().toTime_t(); + git_time_t time = smHead.committer().date().toSecsSinceEpoch(); entry.ctime.seconds = time; entry.ctime.nanoseconds = 0; entry.mtime.seconds = time; diff --git a/src/git/Remote.cpp b/src/git/Remote.cpp index dfd1013ba..dbbc44c97 100644 --- a/src/git/Remote.cpp +++ b/src/git/Remote.cpp @@ -175,8 +175,8 @@ class ConfigFile { bool matched = false; for (const QString &pattern : host.patterns) { - QRegExp re(pattern, Qt::CaseSensitive, QRegExp::Wildcard); - if (re.exactMatch(hostname)) { + QRegularExpression re{QRegularExpression::wildcardToRegularExpression(pattern)}; + if (re.match(hostname).hasMatch()) { handler(host); matched = true; break; diff --git a/src/git/Repository.cpp b/src/git/Repository.cpp index 3004501d2..0bb4e93c7 100644 --- a/src/git/Repository.cpp +++ b/src/git/Repository.cpp @@ -51,7 +51,6 @@ #include #include #include -#include #include #ifdef Q_OS_UNIX @@ -1029,14 +1028,14 @@ void Repository::cleanupState() { } } -QTextCodec *Repository::codec() const { +QStringConverter::Encoding Repository::encoding() const { QString encoding = gitConfig().value("gui.encoding"); - QTextCodec *codec = QTextCodec::codecForName(encoding.toUtf8()); - return codec ? codec : QTextCodec::codecForLocale(); + auto conv = QStringConverter::encodingForName(encoding.toLocal8Bit().data()); + return conv ? conv.value() : QStringConverter::System; } QString Repository::decode(const QByteArray &text) const { - return codec()->toUnicode(text); + return QStringDecoder{encoding()}.decode(text); } bool Repository::lfsIsInitialized() { return dir().exists("hooks/pre-push"); } diff --git a/src/git/Repository.h b/src/git/Repository.h index 0abb27794..8b9b65afe 100644 --- a/src/git/Repository.h +++ b/src/git/Repository.h @@ -26,6 +26,7 @@ #include #include #include +#include struct git_repository; class QProcess; @@ -225,7 +226,7 @@ class Repository { void cleanupState(); // encoding - QTextCodec *codec() const; + QStringConverter::Encoding encoding() const; QString decode(const QByteArray &text) const; // clean diff --git a/src/git/Signature.cpp b/src/git/Signature.cpp index 55cace9ef..e366de228 100644 --- a/src/git/Signature.cpp +++ b/src/git/Signature.cpp @@ -42,7 +42,7 @@ QString Signature::email() const { return d->email; } QDateTime Signature::date() const { int offset = d->when.offset * 60; // Convert from minutes to seconds. - return QDateTime::fromTime_t(d->when.time, Qt::OffsetFromUTC, offset); + return QDateTime::fromSecsSinceEpoch(d->when.time, Qt::OffsetFromUTC, offset); } git_time Signature::gitDate() const { return d->when; } diff --git a/src/git/Signature.h b/src/git/Signature.h index c3a516e0c..2f916923d 100644 --- a/src/git/Signature.h +++ b/src/git/Signature.h @@ -21,7 +21,7 @@ namespace git { class Signature { public: - bool isValid() const { return d; } + bool isValid() const { return d ? true : false; } explicit operator bool() const { return isValid(); } QString name() const; diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt index 027107356..d189c0aa6 100644 --- a/src/host/CMakeLists.txt +++ b/src/host/CMakeLists.txt @@ -9,7 +9,7 @@ add_library( GitLab.cpp Repository.cpp) -target_link_libraries(host conf cred Qt5::Core Qt5::Gui Qt5::Network) +target_link_libraries(host conf cred Qt6::Core Qt6::Gui Qt6::Network) target_compile_definitions( host diff --git a/src/host/Repository.h b/src/host/Repository.h index 02f389baf..b6011f67a 100644 --- a/src/host/Repository.h +++ b/src/host/Repository.h @@ -10,6 +10,7 @@ #ifndef HOST_REPOSITORY_H #define HOST_REPOSITORY_H +#include #include #include #include diff --git a/src/index/CMakeLists.txt b/src/index/CMakeLists.txt index 26b911754..0fe9b1452 100644 --- a/src/index/CMakeLists.txt +++ b/src/index/CMakeLists.txt @@ -7,8 +7,8 @@ target_link_libraries( git lpeg lua - Qt5::Core - Qt5::Concurrent) + Qt6::Core + Qt6::Concurrent) set_target_properties(index PROPERTIES AUTOMOC ON) @@ -16,7 +16,7 @@ add_executable(lexer_test lexer_test.cpp) target_link_libraries(lexer_test index) add_executable(index_test index_test.cpp) -target_link_libraries(index_test index Qt5::Widgets) +target_link_libraries(index_test index Qt6::Widgets) add_executable(indexer indexer.cpp) target_link_libraries(indexer index) diff --git a/src/index/Query.cpp b/src/index/Query.cpp index 11d143085..6eaaa4326 100644 --- a/src/index/Query.cpp +++ b/src/index/Query.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace { @@ -89,9 +89,9 @@ class WildcardQuery : public TermQuery { WildcardQuery(const Index::Term &term) : TermQuery(term) {} QList commits(const Index *index) const override { - QRegExp re(mTerm.text, Qt::CaseInsensitive, QRegExp::Wildcard); + QRegularExpression re{QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; Index::Predicate pred = [re](const QByteArray &word) { - return re.exactMatch(word); + return re.match(word).hasMatch(); }; return index->commits(index->postings(pred, mTerm.field)); @@ -182,11 +182,9 @@ class BooleanQuery : public Query { QList rhs = mRhs->commits(index); QList commits = mLhs->commits(index); if (mKind == And) { -// Remove commits that don't match the right hand side. -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + // Remove commits that don't match the right hand side. QSet set(rhs.begin(), rhs.end()); #else - QSet set = QSet::fromList(rhs); #endif QMutableListIterator it(commits); while (it.hasNext()) { @@ -194,11 +192,9 @@ class BooleanQuery : public Query { it.remove(); } } else { -// Add commits that aren't already in the result set. -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + // Add commits that aren't already in the result set. QSet set(commits.begin(), commits.end()); #else - QSet set = QSet::fromList(commits); #endif foreach (const git::Commit &commit, rhs) { if (!set.contains(commit)) @@ -222,9 +218,9 @@ class PathspecQuery : public TermQuery { QList commits(const Index *index) const override { QByteArray term = mTerm.text.toUtf8(); QByteArray prefix = term.endsWith('/') ? term : term + '/'; - QRegExp re(mTerm.text, Qt::CaseInsensitive, QRegExp::Wildcard); + QRegularExpression re{QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; Index::Predicate pred = [prefix, re](const QByteArray &word) { - return word.startsWith(prefix) || re.exactMatch(word); + return word.startsWith(prefix) || re.match(word).hasMatch(); }; return index->commits(index->postings(pred, Index::Path)); diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index b6473a171..a660307ba 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -427,12 +427,8 @@ class Indexer : public QObject, public QAbstractNativeEventFilter { int count = 0; QList commits; git::Commit commit = mWalker.next(); - -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QSet ids(mIndex.ids().begin(), mIndex.ids().end()); -#else - QSet ids = QSet::fromList(mIndex.ids()); -#endif + while (commit.isValid() && count < 8192) { // Don't index merge commits. if (!commit.isMerge() && !ids.contains(commit.id())) { @@ -453,7 +449,7 @@ class Indexer : public QObject, public QAbstractNativeEventFilter { using CommitList = QList; mWatcher.setFuture( QtConcurrent::mappedReduced( - commits, Map(mIndex.repo(), mLexers, mOut), + std::move(commits), Map(mIndex.repo(), mLexers, mOut), Reduce(mIndex.ids(), mOut))); return true; } @@ -476,7 +472,7 @@ class Indexer : public QObject, public QAbstractNativeEventFilter { } bool nativeEventFilter(const QByteArray &type, void *message, - long *result) override { + qintptr *result) override { Q_UNUSED(result); #ifdef Q_OS_WIN MSG *msg = static_cast(message); diff --git a/src/log/CMakeLists.txt b/src/log/CMakeLists.txt index 675c3c2f4..a6d385bbe 100644 --- a/src/log/CMakeLists.txt +++ b/src/log/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(loglib LogDelegate.cpp LogEntry.cpp LogModel.cpp LogView.cpp) -target_link_libraries(loglib Qt5::Widgets) +target_link_libraries(loglib Qt6::Widgets) set_target_properties(loglib PROPERTIES AUTOMOC ON) diff --git a/src/log/LogDelegate.cpp b/src/log/LogDelegate.cpp index d461a5989..0a3dd2fb5 100644 --- a/src/log/LogDelegate.cpp +++ b/src/log/LogDelegate.cpp @@ -78,7 +78,7 @@ void LogDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, return; QRect rect = decorationRect(option, index); - if (static_cast(variant.type()) == QMetaType::QChar) { + if (variant.typeId() == QMetaType::QChar) { Badge::paint(painter, {Badge::Label(Badge::Label::Type::Log, variant.toChar())}, rect, &opt); @@ -127,7 +127,7 @@ void LogDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const { QStyledItemDelegate::initStyleOption(option, index); QVariant variant = index.data(Qt::DecorationRole); - if (static_cast(variant.type()) == QMetaType::QChar) { + if (variant.typeId() == QMetaType::QChar) { option->decorationSize = Badge::size(option->font, Badge::Label(Badge::Label::Type::Log)) - ADJUSTMENT_SIZE; diff --git a/src/log/LogModel.cpp b/src/log/LogModel.cpp index 66e4c82fd..9bcf9dbd5 100644 --- a/src/log/LogModel.cpp +++ b/src/log/LogModel.cpp @@ -11,6 +11,7 @@ #include "LogEntry.h" #include #include +#include namespace { diff --git a/src/log/LogView.cpp b/src/log/LogView.cpp index 878611e31..7eed2d249 100644 --- a/src/log/LogView.cpp +++ b/src/log/LogView.cpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace { @@ -94,7 +95,7 @@ void LogView::copy() { QString text = index.data().toString(); plainText += - QString("%1 %2\n").arg(prefix, text.remove(QRegExp("<[^>]*>"))); + QString("%1 %2\n").arg(prefix, text.remove(QRegularExpression("<[^>]*>"))); richText += QString("%1 %2
").arg(prefix, text); } @@ -169,7 +170,8 @@ QString LogView::linkAt(const QModelIndex &index, const QPoint &pos) { return QString(); LogDelegate *delegate = static_cast(itemDelegate()); - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); QPoint docPos = pos - delegate->documentPosition(options, index); return delegate->document(index)->documentLayout()->anchorAt(docPos); @@ -180,7 +182,8 @@ bool LogView::isDecoration(const QModelIndex &index, const QPoint &pos) { return false; LogDelegate *delegate = static_cast(itemDelegate()); - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); return delegate->decorationRect(options, index).contains(pos); } diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index a2246fb84..91538b5e8 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(plugins Plugin.cpp) -target_link_libraries(plugins editor git lua Qt5::Core) +target_link_libraries(plugins editor git lua Qt6::Core) set_target_properties(plugins PROPERTIES AUTOMOC ON) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 6c2dd8055..405ea8543 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(tools DiffTool.cpp EditTool.cpp ExternalTool.cpp MergeTool.cpp ShowTool.cpp) -target_link_libraries(tools conf git Qt5::Gui util) +target_link_libraries(tools conf git Qt6::Gui util) set_target_properties(tools PROPERTIES AUTOMOC ON) diff --git a/src/tools/DiffTool.cpp b/src/tools/DiffTool.cpp index 67019a67d..8ae5a01e1 100644 --- a/src/tools/DiffTool.cpp +++ b/src/tools/DiffTool.cpp @@ -91,7 +91,7 @@ bool DiffTool::start() { if (!bash.isEmpty()) { process->start(bash, {"-c", command}); } else if (!shell) { - process->start(git::Command::substitute(env, command)); + process->start(git::Command::substitute(env, command), QStringList()); } else { emit error(BashNotFound); return false; diff --git a/src/tools/MergeTool.cpp b/src/tools/MergeTool.cpp index 677f679b2..0c03d9173 100644 --- a/src/tools/MergeTool.cpp +++ b/src/tools/MergeTool.cpp @@ -128,7 +128,7 @@ bool MergeTool::start() { if (!bash.isEmpty()) { process->start(bash, {"-c", command}); } else if (!shell) { - process->start(git::Command::substitute(env, command)); + process->start(git::Command::substitute(env, command), QStringList()); } else { emit error(BashNotFound); return false; diff --git a/src/ui/AdvancedSearchWidget.cpp b/src/ui/AdvancedSearchWidget.cpp index a4181ea3f..ad10e269a 100644 --- a/src/ui/AdvancedSearchWidget.cpp +++ b/src/ui/AdvancedSearchWidget.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -144,7 +143,7 @@ void AdvancedSearchWidget::exec(QLineEdit *parent, Index *index) { } // Load completion data in the background. - QtConcurrent::run([this, index] { + std::ignore = QtConcurrent::run([this, index] { QMap fields = index->fieldMap(); foreach (QLineEdit *lineEdit, mLineEdits) { QVariant var = lineEdit->property(kFieldProp); diff --git a/src/ui/BlameEditor.cpp b/src/ui/BlameEditor.cpp index e3a610bb4..53275caae 100644 --- a/src/ui/BlameEditor.cpp +++ b/src/ui/BlameEditor.cpp @@ -157,7 +157,7 @@ bool BlameEditor::load(const QString &name, const git::Blob &blob, // Calculate blame. if (mRepo.isValid() && !content.isEmpty()) { mMargin->startBlame(name); - mBlame.setFuture(QtConcurrent::run(mRepo, &git::Repository::blame, name, + mBlame.setFuture(QtConcurrent::run(&git::Repository::blame, mRepo, name, commit, mCallbacks.data())); } @@ -192,8 +192,7 @@ void BlameEditor::save() { QTextStream out(&file); if (mRepo.isValid()) - out.setCodec(mRepo.codec()); - + out.setEncoding(mRepo.encoding()); out << mEditor->text(); file.commit(); diff --git a/src/ui/BlameMargin.cpp b/src/ui/BlameMargin.cpp index a8b4ea7ec..f09778c97 100644 --- a/src/ui/BlameMargin.cpp +++ b/src/ui/BlameMargin.cpp @@ -67,8 +67,8 @@ void BlameMargin::setBlame(const git::Repository &repo, .toBool()) { git::Commit first = repo.walker(GIT_SORT_TIME | GIT_SORT_REVERSE).next(); git::Commit last = repo.walker(GIT_SORT_TIME).next(); - mMinTime = first ? first.committer().date().toTime_t() : -1; - mMaxTime = last ? last.committer().date().toTime_t() : -1; + mMinTime = first ? first.committer().date().toSecsSinceEpoch() : -1; + mMaxTime = last ? last.committer().date().toSecsSinceEpoch() : -1; } mTimer.stop(); @@ -136,11 +136,11 @@ bool BlameMargin::event(QEvent *event) { } void BlameMargin::mousePressEvent(QMouseEvent *event) { - mIndex = mBlame.isValid() ? index(event->y()) : -1; + mIndex = mBlame.isValid() ? index(event->position().y()) : -1; } void BlameMargin::mouseReleaseEvent(QMouseEvent *event) { - if (mBlame.isValid() && mIndex >= 0 && mIndex == index(event->y())) { + if (mBlame.isValid() && mIndex >= 0 && mIndex == index(event->position().y())) { // Update selection. git::Id id = mBlame.id(mIndex); mSelection = (mSelection != id) ? id : git::Id(); @@ -154,7 +154,7 @@ void BlameMargin::mouseDoubleClickEvent(QMouseEvent *event) { if (!mBlame.isValid()) return; - int index = this->index(event->y()); + int index = this->index(event->position().y()); if (index < 0) return; @@ -172,7 +172,7 @@ void BlameMargin::mouseDoubleClickEvent(QMouseEvent *event) { void BlameMargin::paintEvent(QPaintEvent *event) { // Draw background. QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter painter(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); @@ -225,7 +225,7 @@ void BlameMargin::paintEvent(QPaintEvent *event) { date = (dateTime.date() == today) ? QLocale().toString(dateTime.time(), QLocale::ShortFormat) : QLocale().toString(dateTime.date(), QLocale::ShortFormat); - time = dateTime.toTime_t(); + time = dateTime.toSecsSinceEpoch(); } // Draw background. diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 2e69f48ef..ad2061df0 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -74,8 +74,8 @@ target_link_libraries( tools update watcher - Qt5::Concurrent - Qt5::Network - Qt5::Widgets) + Qt6::Concurrent + Qt6::Network + Qt6::Widgets) set_target_properties(ui PROPERTIES AUTOMOC ON) diff --git a/src/ui/ColumnView.cpp b/src/ui/ColumnView.cpp index da2da30dd..5a67fd4af 100644 --- a/src/ui/ColumnView.cpp +++ b/src/ui/ColumnView.cpp @@ -84,7 +84,7 @@ class PreviewWidget : public QFrame { QWindow *win = window()->windowHandle(); QIcon icon = index.data(Qt::DecorationRole).value(); - mIcon->setPixmap(icon.pixmap(win, QSize(ICON_SIZE, ICON_SIZE))); + mIcon->setPixmap(icon.pixmap(QSize(ICON_SIZE, ICON_SIZE), window()->devicePixelRatio())); mName->setText(kNameFmt.arg(index.data(Qt::DisplayRole).toString())); @@ -139,7 +139,7 @@ void ColumnView::setModel(QAbstractItemModel *model) { bool ColumnView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QWidget *columnViewport = static_cast(obj); - QPoint globalPos = static_cast(event)->globalPos(); + QPoint globalPos = static_cast(event)->globalPosition().toPoint(); QModelIndex index = indexAt(viewport()->mapFromGlobal(globalPos)); if (!columnViewport->hasFocus() && index.row() < 0) { columnViewport->setFocus(); diff --git a/src/ui/CommitList.cpp b/src/ui/CommitList.cpp index e018ee322..823f19019 100644 --- a/src/ui/CommitList.cpp +++ b/src/ui/CommitList.cpp @@ -320,6 +320,8 @@ class CommitModel : public QAbstractListModel { } QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const { + if (index.row() >= mRows.size()) + return QVariant(); const Row &row = mRows.at(index.row()); bool status = !row.commit.isValid(); switch (role) { @@ -1246,8 +1248,10 @@ git::Diff CommitList::selectedDiff() const { if (indexes.isEmpty()) return git::Diff(); - if (indexes.size() == 1) - return indexes.first().data(DiffRole).value(); + if (indexes.size() == 1) { + auto first = indexes.first().data(DiffRole); + return first.isValid() ? first.value() : git::Diff(); + } git::Commit first = indexes.first().data(CommitRole).value(); if (!first.isValid()) @@ -1816,7 +1820,8 @@ bool CommitList::isDecoration(const QModelIndex &index, const QPoint &pos) { return false; CommitDelegate *delegate = static_cast(itemDelegate()); - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); return delegate->decorationRect(options, index).contains(pos); } @@ -1826,7 +1831,8 @@ bool CommitList::isStar(const QModelIndex &index, const QPoint &pos) { return false; CommitDelegate *delegate = static_cast(itemDelegate()); - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); return delegate->starRect(options, index).contains(pos); } diff --git a/src/ui/CommitToolBar.cpp b/src/ui/CommitToolBar.cpp index b6e524eae..cbdabd20a 100644 --- a/src/ui/CommitToolBar.cpp +++ b/src/ui/CommitToolBar.cpp @@ -12,6 +12,7 @@ #include "RepoView.h" #include "conf/Settings.h" #include "git/Config.h" +#include #include #include #include diff --git a/src/ui/DetailView.cpp b/src/ui/DetailView.cpp index 95b280f12..5f5a48f71 100644 --- a/src/ui/DetailView.cpp +++ b/src/ui/DetailView.cpp @@ -23,6 +23,7 @@ #include "git/Signature.h" #include #include +#include #include #include #include @@ -122,8 +123,8 @@ class AuthorCommitterDate : public QWidget { mDate = new QLabel(this); mDate->setTextInteractionFlags(kTextFlags); - mSpacing.setX(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing)); - mSpacing.setY(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing)); + mHorizontalSpacing = style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + mVerticalSpacing = style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing); } void moveEvent(QMoveEvent *event) override { updateLayout(); } @@ -198,13 +199,12 @@ class AuthorCommitterDate : public QWidget { void updateLayout() { mAuthor->move(0, 0); if (mCommitter->isVisible()) - mCommitter->move(0, mAuthor->height() + mSpacing.y()); + mCommitter->move(0, mAuthor->height() + mVerticalSpacing); bool wrapped = (width() < sizeHint().width()); int x = wrapped ? 0 : width() - mDate->width(); int y = wrapped - ? mAuthor->height() + mCommitter->height() + 2 * mSpacing.y() - : 0; + wrapped ? mAuthor->height() + mCommitter->height() + 2 * mVerticalSpacing : 0; mDate->move(x, y); updateGeometry(); } @@ -213,7 +213,8 @@ class AuthorCommitterDate : public QWidget { QLabel *mCommitter; QLabel *mDate; - QPoint mSpacing; + int mHorizontalSpacing; + int mVerticalSpacing; bool mSameAuthorCommitter{false}; }; @@ -306,7 +307,7 @@ class CommitDetail : public QFrame { // Compute description asynchronously. if (commits.size() == 1) mWatcher.setFuture( - QtConcurrent::run(commits.first(), &git::Commit::description)); + QtConcurrent::run(&git::Commit::description, commits.first())); } void setCommits(const QList &commits) { diff --git a/src/ui/DiffView/HunkWidget.cpp b/src/ui/DiffView/HunkWidget.cpp index d21b24411..b511e2a8d 100644 --- a/src/ui/DiffView/HunkWidget.cpp +++ b/src/ui/DiffView/HunkWidget.cpp @@ -270,7 +270,7 @@ HunkWidget::HunkWidget(DiffView *view, const git::Diff &diff, return; QTextStream out(&file); - out.setCodec(repo.codec()); + out.setEncoding(repo.encoding()); out << editor.text(); file.commit(); @@ -397,7 +397,7 @@ HunkWidget::HunkWidget(DiffView *view, const git::Diff &diff, return; QTextStream out(&file); - out.setCodec(repo.codec()); + out.setEncoding(repo.encoding()); out << editor.text(); file.commit(); diff --git a/src/ui/DiffView/Images.cpp b/src/ui/DiffView/Images.cpp index f3098bb93..c51d4c06d 100644 --- a/src/ui/DiffView/Images.cpp +++ b/src/ui/DiffView/Images.cpp @@ -120,7 +120,7 @@ QPixmap Images::loadPixmap(git::Diff::File type, int &size, bool lfs) { QFileIconProvider provider; QString path = mPatch.repo().workdir().filePath(mPatch.name()); QIcon icon = provider.icon(QFileInfo(path)); - return icon.pixmap(windowHandle(), QSize(64, 64)); + return icon.pixmap(QSize(64, 64), window()->devicePixelRatio()); } QVBoxLayout *Images::imageLayout(const QPixmap pixmap, int size) { diff --git a/src/ui/FindWidget.cpp b/src/ui/FindWidget.cpp index 2404599b5..e047417c0 100644 --- a/src/ui/FindWidget.cpp +++ b/src/ui/FindWidget.cpp @@ -227,7 +227,7 @@ void FindWidget::showAndSetFocus() { void FindWidget::paintEvent(QPaintEvent *) { QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter painter(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); } diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index ed04212be..91b825e18 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/src/ui/MenuBar.cpp b/src/ui/MenuBar.cpp index 77c76dae6..89763fe5b 100644 --- a/src/ui/MenuBar.cpp +++ b/src/ui/MenuBar.cpp @@ -502,7 +502,7 @@ MenuBar::MenuBar(QWidget *parent) : QMenuBar(parent) { mToggleMaximize = new StateAction(tr("Normal"), tr("Maximize"), viewMenu); viewMenu->addAction(mToggleMaximize); toggleMaximizeHotkey.use(mToggleMaximize); - mToggleMaximize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); + mToggleMaximize->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_M)); connect(mToggleMaximize, &QAction::triggered, [this] { bool maximize = mToggleMaximize->isActive(); RepoView *view = this->view(); diff --git a/src/ui/ReferenceView.cpp b/src/ui/ReferenceView.cpp index 84b3b39df..9cab9739a 100644 --- a/src/ui/ReferenceView.cpp +++ b/src/ui/ReferenceView.cpp @@ -40,7 +40,8 @@ class FilterProxyModel : public QSortFilterProxyModel { FilterProxyModel(QObject *parent = nullptr) : QSortFilterProxyModel(parent) {} void setFilter(const QString &filter) { - setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString)); + setFilterCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive); + setFilterFixedString(filter); } protected: diff --git a/src/ui/RepoView.cpp b/src/ui/RepoView.cpp index 1f4866c69..65535a175 100644 --- a/src/ui/RepoView.cpp +++ b/src/ui/RepoView.cpp @@ -1805,7 +1805,8 @@ void RepoView::push(const git::Remote &rmt, const git::Reference &src, &RepoView::notifyReferenceUpdated); entry->setBusy(true); - mWatcher->setFuture(QtConcurrent::run(remote, &git::Remote::push, mCallbacks, + git::Result (git::Remote::*push)(git::Remote::Callbacks*, const git::Reference&, const QString&, bool, bool) = &git::Remote::push; + mWatcher->setFuture(QtConcurrent::run(push, remote, mCallbacks, ref, dst, force, tags)); } @@ -2367,7 +2368,7 @@ void RepoView::resetSubmodulesAsync(const QList &submodules, QString(), mWatcher, repo); entry->setBusy(true); - mWatcher->setFuture(QtConcurrent::run(submodule, &git::Submodule::update, + mWatcher->setFuture(QtConcurrent::run(&git::Submodule::update, submodule, mCallbacks, false, true)); } @@ -2530,7 +2531,7 @@ void RepoView::updateSubmodulesAsync(const QList &submodules, QString(), mWatcher, repo); entry->setBusy(true); - mWatcher->setFuture(QtConcurrent::run(submodule, &git::Submodule::update, + mWatcher->setFuture(QtConcurrent::run(&git::Submodule::update, submodule, mCallbacks, init, checkout_force)); } diff --git a/src/ui/SpellChecker.cpp b/src/ui/SpellChecker.cpp index fb1563e13..9cf2722d1 100644 --- a/src/ui/SpellChecker.cpp +++ b/src/ui/SpellChecker.cpp @@ -4,7 +4,7 @@ #include "SpellChecker.h" #include #include -#include +#include SpellChecker::SpellChecker(const QString &dictionaryPath, const QString &userDictionary) @@ -26,12 +26,13 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, QFile affixFile(affixFileName); if (affixFile.open(QIODevice::ReadOnly)) { QTextStream stream(&affixFile); - QRegExp enc_detector("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", - Qt::CaseInsensitive); + QRegularExpression enc_detector("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", + QRegularExpression::CaseInsensitiveOption); QString line = stream.readLine(); while (!line.isEmpty()) { - if (enc_detector.indexIn(line) >= 0) { - encoding = enc_detector.cap(1); + auto match = enc_detector.match(line); + if (match.hasMatch() >= 0) { + encoding = match.captured(1); break; } line = stream.readLine(); @@ -40,7 +41,8 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, mValid = true; } - mCodec = QTextCodec::codecForName(encoding.toLatin1().constData()); + auto conv = QStringConverter::encodingForName(encoding.toLocal8Bit().data()); + mEncoding = conv ? conv.value() : QStringConverter::System; // Add user dictionary words to spell checker. if (!mUserDictionary.isEmpty()) { @@ -49,7 +51,8 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, QTextStream stream(&userDictonaryFile); QString line = stream.readLine(); while (!line.isEmpty()) { - mHunspell->add(mCodec->fromUnicode(line).constData()); + QByteArray ba = QStringEncoder{mEncoding}.encode(line); + mHunspell->add(ba.toStdString()); line = stream.readLine(); } userDictonaryFile.close(); @@ -62,29 +65,34 @@ SpellChecker::~SpellChecker() { delete mHunspell; } bool SpellChecker::spell(const QString &word) { // Encode from Unicode to the encoding used by current dictionary. - return mHunspell->spell(mCodec->fromUnicode(word).toStdString()); + QByteArray ba = QStringEncoder{mEncoding}.encode(word); + return mHunspell->spell(ba.toStdString()); } QStringList SpellChecker::suggest(const QString &word) { QStringList suggestions; // Retrive suggestions for word. + QByteArray ba = QStringEncoder{mEncoding}.encode(word); std::vector suggestion = - mHunspell->suggest(mCodec->fromUnicode(word).toStdString()); + mHunspell->suggest(ba.toStdString()); // Decode from the encoding used by current dictionary to Unicode. + auto decoder = QStringDecoder{mEncoding}; foreach (const std::string &str, suggestion) - suggestions.append(mCodec->toUnicode(str.data())); + suggestions.append(decoder.decode(str.data())); return suggestions; } void SpellChecker::ignoreWord(const QString &word) { - mHunspell->add(mCodec->fromUnicode(word).constData()); + QByteArray ba = QStringEncoder{mEncoding}.encode(word); + mHunspell->add(ba.toStdString()); } void SpellChecker::addToUserDict(const QString &word) { - mHunspell->add(mCodec->fromUnicode(word).constData()); + QByteArray ba = QStringEncoder{mEncoding}.encode(word); + mHunspell->add(ba.toStdString()); if (!mUserDictionary.isEmpty()) { QFile userDictonaryFile(mUserDictionary); diff --git a/src/ui/SpellChecker.h b/src/ui/SpellChecker.h index f244bee6c..4dd1d88ce 100644 --- a/src/ui/SpellChecker.h +++ b/src/ui/SpellChecker.h @@ -4,6 +4,7 @@ #define SPELLCHECKER_H #include +#include class Hunspell; @@ -24,7 +25,7 @@ class SpellChecker { private: Hunspell *mHunspell = nullptr; - QTextCodec *mCodec; + QStringConverter::Encoding mEncoding; QString mUserDictionary; bool mValid = false; diff --git a/src/ui/ToolBar.cpp b/src/ui/ToolBar.cpp index 2be9e76fe..4ec2a2a89 100644 --- a/src/ui/ToolBar.cpp +++ b/src/ui/ToolBar.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace { @@ -944,7 +945,7 @@ ToolBar::ToolBar(MainWindow *parent) : QToolBar(parent) { // Hook up star button to search field. connect(mStarButton, &QToolButton::toggled, [this](bool checked) { - QStringList terms = mSearchField->text().split(QRegExp("\\s+")); + QStringList terms = mSearchField->text().split(QRegularExpression("\\s+")); if (checked) { terms.append(kStarredQuery); } else { @@ -958,7 +959,7 @@ ToolBar::ToolBar(MainWindow *parent) : QToolBar(parent) { QSignalBlocker blocker(mStarButton); (void)blocker; - QStringList terms = mSearchField->text().split(QRegExp("\\s+")); + QStringList terms = mSearchField->text().split(QRegularExpression("\\s+")); mStarButton->setChecked(terms.contains(kStarredQuery)); }); } diff --git a/src/ui/TreeView.cpp b/src/ui/TreeView.cpp index 22a760be9..d15acab8d 100644 --- a/src/ui/TreeView.cpp +++ b/src/ui/TreeView.cpp @@ -129,7 +129,7 @@ void TreeView::discard(DiffTreeModel *model, const QModelIndex &index) { bool TreeView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QWidget *TreeViewport = static_cast(obj); - QPoint globalPos = static_cast(event)->globalPos(); + QPoint globalPos = static_cast(event)->globalPosition().toPoint(); QModelIndex index = indexAt(viewport()->mapFromGlobal(globalPos)); if (!TreeViewport->hasFocus() && index.row() < 0) { TreeViewport->setFocus(); @@ -292,7 +292,8 @@ void TreeView::deselectAll() { } QRect TreeView::checkRect(const QModelIndex &index) { - QStyleOptionViewItem options = viewOptions(); + QStyleOptionViewItem options; + initViewItemOption(&options); options.rect = visualRect(index); options.features |= QStyleOptionViewItem::HasCheckIndicator; diff --git a/src/ui/ViewDelegate.cpp b/src/ui/ViewDelegate.cpp index 8e69662ef..af130cdc2 100644 --- a/src/ui/ViewDelegate.cpp +++ b/src/ui/ViewDelegate.cpp @@ -31,7 +31,7 @@ void ViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, // Add extra space. opt.rect.adjust(leftAdjust, 0, rightAdjust, 0); - for (int i = 0; i < status.count(); ++i) { + for (int i = 0; i < status.size(); ++i) { int x = opt.rect.x() + opt.rect.width(); int y = opt.rect.y() + (opt.rect.height() / 2); QRect rect(mMultiColumn ? opt.rect.x() : x - width, y - (height / 2), diff --git a/src/update/CMakeLists.txt b/src/update/CMakeLists.txt index 530376d5b..fb980d3fc 100644 --- a/src/update/CMakeLists.txt +++ b/src/update/CMakeLists.txt @@ -13,14 +13,14 @@ target_link_libraries( conf ${LIBCMARK_LIBRARIES} git - Qt5::Network - Qt5::Widgets + Qt6::Network + Qt6::Widgets ${UPDATER_IMPL_LIBS}) set_target_properties(update PROPERTIES AUTOMOC ON) add_executable(relauncher relauncher.cpp) -target_link_libraries(relauncher Qt5::Core) +target_link_libraries(relauncher Qt6::Core) set_target_properties(relauncher PROPERTIES RUNTIME_OUTPUT_DIRECTORY $) diff --git a/src/update/relauncher.cpp b/src/update/relauncher.cpp index 0e0637c0a..ad14eab91 100644 --- a/src/update/relauncher.cpp +++ b/src/update/relauncher.cpp @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { #endif // Restart from the path argument. - QProcess::startDetached(args.first()); + QProcess::startDetached(args.first(), QStringList()); return 0; } diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 4d039839f..b81930009 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(util Path.cpp Debug.h Debug.cpp) -target_link_libraries(util Qt5::Core) +target_link_libraries(util Qt6::Core) target_include_directories(util INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(util PROPERTIES AUTOMOC ON) diff --git a/src/watcher/CMakeLists.txt b/src/watcher/CMakeLists.txt index 16de10f5b..2818a4f10 100644 --- a/src/watcher/CMakeLists.txt +++ b/src/watcher/CMakeLists.txt @@ -13,6 +13,6 @@ add_library(watcher RepositoryWatcher.cpp ${WATCHER_IMPL_FILE}) target_include_directories(watcher PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries(watcher git Qt5::Core ${WATCHER_IMPL_LIBS}) +target_link_libraries(watcher git Qt6::Core ${WATCHER_IMPL_LIBS}) set_target_properties(watcher PROPERTIES AUTOMOC ON) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 10053099d..3a388f18e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,10 +23,10 @@ macro(test) endif() if(WIN32) - find_package(Qt5Gui) + find_package(Qt6Gui) string(REPLACE ";" "\;" NEWPATH "$ENV{PATH}") string(REPLACE ";" "\;" PLUGIN_PATH - "$") + "$") if(${ARG_NO_WIN32_OFFSCREEN}) set(PLATFORM "windows") @@ -73,7 +73,7 @@ set(CMAKE_DISABLE_TESTING ON) add_subdirectory(dep/zip) add_library(testlib EXCLUDE_FROM_ALL Test.cpp) -target_link_libraries(testlib app git ui Qt5::Test zip) +target_link_libraries(testlib app git ui Qt6::Test zip) target_include_directories(testlib PRIVATE ${CMAKE_SOURCE_DIR}/src) target_compile_definitions( testlib From 3a38653221f15aa0b4cdbcecb3b70fd3f8b7f86b Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 09:31:04 +0200 Subject: [PATCH 27/76] format --- src/conf/Settings.cpp | 3 ++- src/cred/CMakeLists.txt | 5 ++--- src/dialogs/CMakeLists.txt | 5 ++++- src/dialogs/DeleteBranchDialog.cpp | 6 +++--- src/dialogs/DeleteTagDialog.cpp | 6 +++--- src/dialogs/DiffPanel.cpp | 10 ++-------- src/editor/ScintillaQt.cpp | 9 ++++++--- src/git/Remote.cpp | 3 ++- src/index/Query.cpp | 6 ++++-- src/log/LogView.cpp | 4 ++-- src/ui/BlameMargin.cpp | 3 ++- src/ui/ColumnView.cpp | 6 ++++-- src/ui/DetailView.cpp | 8 +++++--- src/ui/RepoView.cpp | 8 +++++--- src/ui/SpellChecker.cpp | 11 ++++++----- src/ui/TreeView.cpp | 3 ++- 16 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/conf/Settings.cpp b/src/conf/Settings.cpp index e012eb5a5..e6fd8176a 100644 --- a/src/conf/Settings.cpp +++ b/src/conf/Settings.cpp @@ -125,7 +125,8 @@ QString Settings::lexer(const QString &filename) { QVariantMap map(lexers.value(key).toMap()); if (map.contains("patterns")) { foreach (QString pattern, map.value("patterns").toString().split(",")) { - QRegularExpression regExp{QRegularExpression::fromWildcard(pattern, CS)}; + QRegularExpression regExp{ + QRegularExpression::fromWildcard(pattern, CS)}; if (regExp.match(name).hasMatch()) return key; } diff --git a/src/cred/CMakeLists.txt b/src/cred/CMakeLists.txt index 9f686fde8..b21af0535 100644 --- a/src/cred/CMakeLists.txt +++ b/src/cred/CMakeLists.txt @@ -1,7 +1,6 @@ -add_library(cred Cache.cpp Store.cpp CredentialHelper.cpp GitCredential.cpp) - -target_link_libraries(cred conf git Qt6::Core) add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp ${CREDENTIAL_IMPL_FILE}) +target_link_libraries(cred conf git Qt6::Core) + set_target_properties(cred PROPERTIES AUTOMOC ON) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index 65b307b08..beee9a5ac 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -39,7 +39,10 @@ target_compile_definitions( target_include_directories(dialogs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -find_package(Qt6 COMPONENTS Core5Compat REQUIRED) +find_package( + Qt6 + COMPONENTS Core5Compat + REQUIRED) target_link_libraries( dialogs diff --git a/src/dialogs/DeleteBranchDialog.cpp b/src/dialogs/DeleteBranchDialog.cpp index 79a3f0566..4c2e4c49b 100644 --- a/src/dialogs/DeleteBranchDialog.cpp +++ b/src/dialogs/DeleteBranchDialog.cpp @@ -61,9 +61,9 @@ DeleteBranchDialog::DeleteBranchDialog(const git::Branch &branch, entry->setBusy(true); QStringList refspecs(QString(":%1").arg(upstreamName)); - git::Result (git::Remote::*push)(git::Remote::Callbacks*, const QStringList&) = &git::Remote::push; - watcher->setFuture( - QtConcurrent::run(push, remote, callbacks, refspecs)); + git::Result (git::Remote::*push)( + git::Remote::Callbacks *, const QStringList &) = &git::Remote::push; + watcher->setFuture(QtConcurrent::run(push, remote, callbacks, refspecs)); connect(watcher, &QFutureWatcher::finished, watcher, [entry, watcher, callbacks, remoteName] { diff --git a/src/dialogs/DeleteTagDialog.cpp b/src/dialogs/DeleteTagDialog.cpp index 1e46bfe3f..45b1e2be6 100644 --- a/src/dialogs/DeleteTagDialog.cpp +++ b/src/dialogs/DeleteTagDialog.cpp @@ -53,9 +53,9 @@ DeleteTagDialog::DeleteTagDialog(const git::TagRef &tag, QWidget *parent) entry->setBusy(true); QStringList refspecs(QString(":refs/tags/%1").arg(name)); - git::Result (git::Remote::*push)(git::Remote::Callbacks*, const QStringList&) = &git::Remote::push; - watcher->setFuture( - QtConcurrent::run(push, remote, callbacks, refspecs)); + git::Result (git::Remote::*push)( + git::Remote::Callbacks *, const QStringList &) = &git::Remote::push; + watcher->setFuture(QtConcurrent::run(push, remote, callbacks, refspecs)); connect(watcher, &QFutureWatcher::finished, watcher, [entry, watcher, callbacks, remoteName] { diff --git a/src/dialogs/DiffPanel.cpp b/src/dialogs/DiffPanel.cpp index 54f31df2f..8f4d8b8a0 100644 --- a/src/dialogs/DiffPanel.cpp +++ b/src/dialogs/DiffPanel.cpp @@ -46,14 +46,8 @@ DiffPanel::DiffPanel(const git::Repository &repo, QWidget *parent) // encoding static std::array encodings{ - "Utf8", - "Utf16", - "Utf16LE", - "Utf16BE", - "Utf32", - "Utf32LE", - "Utf32BE", - "Latin1", + "Utf8", "Utf16", "Utf16LE", "Utf16BE", + "Utf32", "Utf32LE", "Utf32BE", "Latin1", }; QComboBox *encoding = new QComboBox(this); diff --git a/src/editor/ScintillaQt.cpp b/src/editor/ScintillaQt.cpp index 34fa321f7..1736749ac 100644 --- a/src/editor/ScintillaQt.cpp +++ b/src/editor/ScintillaQt.cpp @@ -328,7 +328,8 @@ void ScintillaQt::keyPressEvent(QKeyEvent *event) { QString text = event->text(); if (input && !text.isEmpty() && text[0].isPrint()) { QByteArray utext = text.toUtf8(); - InsertCharacter(std::string_view(utext.data(), utext.size()), CharacterSource::directInput); + InsertCharacter(std::string_view(utext.data(), utext.size()), + CharacterSource::directInput); } else { event->ignore(); } @@ -522,7 +523,8 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { const QString oneCharUTF16 = commitStr.mid(i, ucWidth); const QByteArray oneChar = oneCharUTF16.toUtf8(); const int oneCharLen = oneChar.length(); - InsertCharacter(std::string_view(oneChar.data(), oneCharLen), CharacterSource::directInput); + InsertCharacter(std::string_view(oneChar.data(), oneCharLen), + CharacterSource::directInput); i += ucWidth; } @@ -605,7 +607,8 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { numBytes += oneCharLen; imeCharPos[i + 1] = numBytes; - InsertCharacter(std::string_view(oneChar.data(), oneCharLen), CharacterSource::directInput); + InsertCharacter(std::string_view(oneChar.data(), oneCharLen), + CharacterSource::directInput); #ifdef Q_OS_LINUX // Segment marked with imeCaretPos is for target input. diff --git a/src/git/Remote.cpp b/src/git/Remote.cpp index dbbc44c97..fd5f0b9cf 100644 --- a/src/git/Remote.cpp +++ b/src/git/Remote.cpp @@ -175,7 +175,8 @@ class ConfigFile { bool matched = false; for (const QString &pattern : host.patterns) { - QRegularExpression re{QRegularExpression::wildcardToRegularExpression(pattern)}; + QRegularExpression re{ + QRegularExpression::wildcardToRegularExpression(pattern)}; if (re.match(hostname).hasMatch()) { handler(host); matched = true; diff --git a/src/index/Query.cpp b/src/index/Query.cpp index 6eaaa4326..d289eca68 100644 --- a/src/index/Query.cpp +++ b/src/index/Query.cpp @@ -89,7 +89,8 @@ class WildcardQuery : public TermQuery { WildcardQuery(const Index::Term &term) : TermQuery(term) {} QList commits(const Index *index) const override { - QRegularExpression re{QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; + QRegularExpression re{ + QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; Index::Predicate pred = [re](const QByteArray &word) { return re.match(word).hasMatch(); }; @@ -218,7 +219,8 @@ class PathspecQuery : public TermQuery { QList commits(const Index *index) const override { QByteArray term = mTerm.text.toUtf8(); QByteArray prefix = term.endsWith('/') ? term : term + '/'; - QRegularExpression re{QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; + QRegularExpression re{ + QRegularExpression::fromWildcard(mTerm.text, Qt::CaseInsensitive)}; Index::Predicate pred = [prefix, re](const QByteArray &word) { return word.startsWith(prefix) || re.match(word).hasMatch(); }; diff --git a/src/log/LogView.cpp b/src/log/LogView.cpp index 7eed2d249..3f1fc99d6 100644 --- a/src/log/LogView.cpp +++ b/src/log/LogView.cpp @@ -94,8 +94,8 @@ void LogView::copy() { prefix += isExpanded(index) ? "[-]" : "[+]"; QString text = index.data().toString(); - plainText += - QString("%1 %2\n").arg(prefix, text.remove(QRegularExpression("<[^>]*>"))); + plainText += QString("%1 %2\n").arg( + prefix, text.remove(QRegularExpression("<[^>]*>"))); richText += QString("%1 %2
").arg(prefix, text); } diff --git a/src/ui/BlameMargin.cpp b/src/ui/BlameMargin.cpp index f09778c97..5950c2012 100644 --- a/src/ui/BlameMargin.cpp +++ b/src/ui/BlameMargin.cpp @@ -140,7 +140,8 @@ void BlameMargin::mousePressEvent(QMouseEvent *event) { } void BlameMargin::mouseReleaseEvent(QMouseEvent *event) { - if (mBlame.isValid() && mIndex >= 0 && mIndex == index(event->position().y())) { + if (mBlame.isValid() && mIndex >= 0 && + mIndex == index(event->position().y())) { // Update selection. git::Id id = mBlame.id(mIndex); mSelection = (mSelection != id) ? id : git::Id(); diff --git a/src/ui/ColumnView.cpp b/src/ui/ColumnView.cpp index 5a67fd4af..6d607cdcd 100644 --- a/src/ui/ColumnView.cpp +++ b/src/ui/ColumnView.cpp @@ -84,7 +84,8 @@ class PreviewWidget : public QFrame { QWindow *win = window()->windowHandle(); QIcon icon = index.data(Qt::DecorationRole).value(); - mIcon->setPixmap(icon.pixmap(QSize(ICON_SIZE, ICON_SIZE), window()->devicePixelRatio())); + mIcon->setPixmap( + icon.pixmap(QSize(ICON_SIZE, ICON_SIZE), window()->devicePixelRatio())); mName->setText(kNameFmt.arg(index.data(Qt::DisplayRole).toString())); @@ -139,7 +140,8 @@ void ColumnView::setModel(QAbstractItemModel *model) { bool ColumnView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QWidget *columnViewport = static_cast(obj); - QPoint globalPos = static_cast(event)->globalPosition().toPoint(); + QPoint globalPos = + static_cast(event)->globalPosition().toPoint(); QModelIndex index = indexAt(viewport()->mapFromGlobal(globalPos)); if (!columnViewport->hasFocus() && index.row() < 0) { columnViewport->setFocus(); diff --git a/src/ui/DetailView.cpp b/src/ui/DetailView.cpp index 5f5a48f71..586e06b78 100644 --- a/src/ui/DetailView.cpp +++ b/src/ui/DetailView.cpp @@ -123,7 +123,8 @@ class AuthorCommitterDate : public QWidget { mDate = new QLabel(this); mDate->setTextInteractionFlags(kTextFlags); - mHorizontalSpacing = style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); + mHorizontalSpacing = + style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); mVerticalSpacing = style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing); } @@ -203,8 +204,9 @@ class AuthorCommitterDate : public QWidget { bool wrapped = (width() < sizeHint().width()); int x = wrapped ? 0 : width() - mDate->width(); - int y = wrapped - wrapped ? mAuthor->height() + mCommitter->height() + 2 * mVerticalSpacing : 0; + int y = wrapped wrapped ? mAuthor->height() + mCommitter->height() + + 2 * mVerticalSpacing + : 0; mDate->move(x, y); updateGeometry(); } diff --git a/src/ui/RepoView.cpp b/src/ui/RepoView.cpp index 65535a175..493ed5a21 100644 --- a/src/ui/RepoView.cpp +++ b/src/ui/RepoView.cpp @@ -1805,9 +1805,11 @@ void RepoView::push(const git::Remote &rmt, const git::Reference &src, &RepoView::notifyReferenceUpdated); entry->setBusy(true); - git::Result (git::Remote::*push)(git::Remote::Callbacks*, const git::Reference&, const QString&, bool, bool) = &git::Remote::push; - mWatcher->setFuture(QtConcurrent::run(push, remote, mCallbacks, - ref, dst, force, tags)); + git::Result (git::Remote::*push)(git::Remote::Callbacks *, + const git::Reference &, const QString &, + bool, bool) = &git::Remote::push; + mWatcher->setFuture( + QtConcurrent::run(push, remote, mCallbacks, ref, dst, force, tags)); } bool RepoView::commit(const QString &message, diff --git a/src/ui/SpellChecker.cpp b/src/ui/SpellChecker.cpp index 9cf2722d1..d161cf9c4 100644 --- a/src/ui/SpellChecker.cpp +++ b/src/ui/SpellChecker.cpp @@ -26,8 +26,9 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, QFile affixFile(affixFileName); if (affixFile.open(QIODevice::ReadOnly)) { QTextStream stream(&affixFile); - QRegularExpression enc_detector("^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", - QRegularExpression::CaseInsensitiveOption); + QRegularExpression enc_detector( + "^\\s*SET\\s+([A-Z0-9\\-]+)\\s*", + QRegularExpression::CaseInsensitiveOption); QString line = stream.readLine(); while (!line.isEmpty()) { auto match = enc_detector.match(line); @@ -41,7 +42,8 @@ SpellChecker::SpellChecker(const QString &dictionaryPath, mValid = true; } - auto conv = QStringConverter::encodingForName(encoding.toLocal8Bit().data()); + auto conv = + QStringConverter::encodingForName(encoding.toLocal8Bit().data()); mEncoding = conv ? conv.value() : QStringConverter::System; // Add user dictionary words to spell checker. @@ -74,8 +76,7 @@ QStringList SpellChecker::suggest(const QString &word) { // Retrive suggestions for word. QByteArray ba = QStringEncoder{mEncoding}.encode(word); - std::vector suggestion = - mHunspell->suggest(ba.toStdString()); + std::vector suggestion = mHunspell->suggest(ba.toStdString()); // Decode from the encoding used by current dictionary to Unicode. auto decoder = QStringDecoder{mEncoding}; diff --git a/src/ui/TreeView.cpp b/src/ui/TreeView.cpp index d15acab8d..770847e3e 100644 --- a/src/ui/TreeView.cpp +++ b/src/ui/TreeView.cpp @@ -129,7 +129,8 @@ void TreeView::discard(DiffTreeModel *model, const QModelIndex &index) { bool TreeView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QWidget *TreeViewport = static_cast(obj); - QPoint globalPos = static_cast(event)->globalPosition().toPoint(); + QPoint globalPos = + static_cast(event)->globalPosition().toPoint(); QModelIndex index = indexAt(viewport()->mapFromGlobal(globalPos)); if (!TreeViewport->hasFocus() && index.row() < 0) { TreeViewport->setFocus(); From b8f96443dabe5de78304bc29ad85f2057c38de22 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 09:42:24 +0200 Subject: [PATCH 28/76] fix --- src/cred/CMakeLists.txt | 3 +-- src/dialogs/CMakeLists.txt | 5 ----- src/index/Query.cpp | 4 ---- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/cred/CMakeLists.txt b/src/cred/CMakeLists.txt index b21af0535..d8f1423db 100644 --- a/src/cred/CMakeLists.txt +++ b/src/cred/CMakeLists.txt @@ -1,5 +1,4 @@ -add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp - ${CREDENTIAL_IMPL_FILE}) +add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp) target_link_libraries(cred conf git Qt6::Core) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index beee9a5ac..f306af706 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -39,11 +39,6 @@ target_compile_definitions( target_include_directories(dialogs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -find_package( - Qt6 - COMPONENTS Core5Compat - REQUIRED) - target_link_libraries( dialogs cli diff --git a/src/index/Query.cpp b/src/index/Query.cpp index d289eca68..c293a8b0d 100644 --- a/src/index/Query.cpp +++ b/src/index/Query.cpp @@ -185,8 +185,6 @@ class BooleanQuery : public Query { if (mKind == And) { // Remove commits that don't match the right hand side. QSet set(rhs.begin(), rhs.end()); -#else -#endif QMutableListIterator it(commits); while (it.hasNext()) { if (!set.contains(it.next())) @@ -195,8 +193,6 @@ class BooleanQuery : public Query { } else { // Add commits that aren't already in the result set. QSet set(commits.begin(), commits.end()); -#else -#endif foreach (const git::Commit &commit, rhs) { if (!set.contains(commit)) commits.append(commit); From 1373928064d6035da395e5b7d47337eba75a8c7a Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 09:53:53 +0200 Subject: [PATCH 29/76] update openssl version to 3.0 --- .github/workflows/build.yml | 4 ---- pack/CMakeLists.txt | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa2771ab8..081f60b29 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -262,10 +262,6 @@ jobs: run: | cd dep/openssl/openssl - # this is necessary until https://github.com/openssl/openssl/issues/18720 - # is fixed in OpenSSL 1.1.1r - export CFLAGS=-Wno-error=implicit-function-declaration - ./Configure ${{ matrix.env.openssl_arch }} no-shared make diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 5b72c6abd..1b610f0ce 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -156,12 +156,12 @@ if(NOT APPLE) if(NOT USE_SYSTEM_OPENSSL) if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(SSL_LIB_SUFFIX "-1_1-x64.dll") + set(SSL_LIB_SUFFIX "-3-x64.dll") else() - set(SSL_LIB_SUFFIX "-1_1.dll") + set(SSL_LIB_SUFFIX "-3.dll") endif() else() - set(SSL_LIB_SUFFIX ".so.1.1") + set(SSL_LIB_SUFFIX ".so.3") endif() foreach(SSL_LIB_NAME ssl crypto) From f99eb4ac7133fc91625e81f4d922e4debeeacc30 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:06:13 +0200 Subject: [PATCH 30/76] fix compilation --- src/editor/ScintillaQt.cpp | 1 + src/ui/CommitEditor.cpp | 1 + src/ui/DetailView.cpp | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/editor/ScintillaQt.cpp b/src/editor/ScintillaQt.cpp index 1736749ac..f8e4e7edd 100644 --- a/src/editor/ScintillaQt.cpp +++ b/src/editor/ScintillaQt.cpp @@ -708,6 +708,7 @@ QVariant ScintillaQt::inputMethodQuery(Qt::InputMethodQuery query) const { case Qt::ImPlatformData: // fall through case Qt::ImQueryInput: // fall through case Qt::ImQueryAll: // fall through + case Qt::ImReadOnly: // fall through break; } return QVariant(); diff --git a/src/ui/CommitEditor.cpp b/src/ui/CommitEditor.cpp index c885c235e..816e2721c 100644 --- a/src/ui/CommitEditor.cpp +++ b/src/ui/CommitEditor.cpp @@ -20,6 +20,7 @@ #include #include #include +#include namespace { const QString kDictKey = "commit.spellcheck.dict"; diff --git a/src/ui/DetailView.cpp b/src/ui/DetailView.cpp index 586e06b78..bb57f1201 100644 --- a/src/ui/DetailView.cpp +++ b/src/ui/DetailView.cpp @@ -136,13 +136,13 @@ class AuthorCommitterDate : public QWidget { QSize date = mDate->sizeHint(); QSize author = mAuthor->sizeHint(); QSize committer = mCommitter->sizeHint(); - int width = author.width() + date.width() + mSpacing.x(); + int width = author.width() + date.width() + mHorizontalSpacing; int height; if (mSameAuthorCommitter) height = qMax(qMax(author.height(), committer.height()), date.height()); else height = qMax(author.height(), date.height()) + committer.height() + - mSpacing.y(); + mVerticalSpacing; return QSize(width, height); } @@ -156,7 +156,7 @@ class AuthorCommitterDate : public QWidget { height = qMax(qMax(author.height(), committer.height()), date.height()); else height = qMax(author.height(), date.height()) + committer.height() + - mSpacing.y(); + mVerticalSpacing; return QSize(width, height); } @@ -167,10 +167,11 @@ class AuthorCommitterDate : public QWidget { int author = mAuthor->sizeHint().height(); int committer = mCommitter->sizeHint().height(); bool wrapped = (width < sizeHint().width()); - int unwrappedHeight = mSameAuthorCommitter - ? qMax(committer, qMax(author, date)) - : qMax(author + committer + mSpacing.y(), date); - return wrapped ? (author + committer + date + 2 * mSpacing.y()) + int unwrappedHeight = + mSameAuthorCommitter + ? qMax(committer, qMax(author, date)) + : qMax(author + committer + mVerticalSpacing, date); + return wrapped ? (author + committer + date + 2 * mVerticalSpacing) : unwrappedHeight; } @@ -204,9 +205,9 @@ class AuthorCommitterDate : public QWidget { bool wrapped = (width() < sizeHint().width()); int x = wrapped ? 0 : width() - mDate->width(); - int y = wrapped wrapped ? mAuthor->height() + mCommitter->height() + - 2 * mVerticalSpacing - : 0; + int y = wrapped ? mAuthor->height() + mCommitter->height() + + 2 * mVerticalSpacing + : 0; mDate->move(x, y); updateGeometry(); } From a7bb1ded64bef230d0e5e3ae153c804e5c2a1ba0 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:17:31 +0200 Subject: [PATCH 31/76] fix compilation --- src/cred/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cred/CMakeLists.txt b/src/cred/CMakeLists.txt index d8f1423db..b4fe01a7d 100644 --- a/src/cred/CMakeLists.txt +++ b/src/cred/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(cred Cache.cpp CredentialHelper.cpp GitCredential.cpp) +add_library(cred Cache.cpp Store.cpp CredentialHelper.cpp GitCredential.cpp) target_link_libraries(cred conf git Qt6::Core) From 5ba277e399f3e9cb8fa553a749a83cc6fa64a217 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:34:49 +0200 Subject: [PATCH 32/76] rebase --- .github/workflows/build.yml | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 081f60b29..b32b83425 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,11 +126,7 @@ jobs: fail-fast: false matrix: qt: - - version: 5.15.2 - check_only: false - - - version: 5.12.0 - check_only: true + - version: 6.5 env: - name: linux @@ -212,7 +208,6 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v3.3.0 timeout-minutes: 10 - if: "!matrix.qt.check_only" with: version: ${{ matrix.qt.version }} target: desktop @@ -221,18 +216,6 @@ jobs: install-deps: true modules: qtwebengine - - name: Install Qt - uses: jurplel/install-qt-action@v3.3.0 - timeout-minutes: 10 - if: matrix.qt.check_only - with: - version: ${{ matrix.qt.version }} - target: desktop - host: ${{ matrix.env.qt_platform }} - arch: ${{ matrix.env.qt_arch_check_only }} - install-deps: true - modules: qtwebengine - - name: Install Ninja uses: seanmiddleditch/gha-setup-ninja@v3 with: @@ -293,7 +276,7 @@ jobs: # Command copied from flathub build process - name: Validate appdata file - if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only + if: matrix.env.ninja_platform == 'linux' run: | echo "Show generated appdata file" cat ./build/release/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml @@ -304,14 +287,14 @@ jobs: flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate ./build/release/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml - name: Publish build artifacts - if: matrix.env.pack && !matrix.qt.check_only + if: matrix.env.pack uses: actions/upload-artifact@v3 with: path: build/release/pack/Gittyup-* name: Gittyup ${{ matrix.env.name }} - name: Publish version file - if: matrix.env.pack && !matrix.qt.check_only + if: matrix.env.pack uses: actions/upload-artifact@v3 with: path: build/release/Version.txt From 4c33bcd8cd99a7ed48a1f8b0969695702f019381 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 10:41:18 +0200 Subject: [PATCH 33/76] Reason: --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b32b83425..4f09f3c1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,7 +126,7 @@ jobs: fail-fast: false matrix: qt: - - version: 6.5 + - version: 6.5.* env: - name: linux From feac7e63d3a3cdd2a7b8c0a4d7b0916d8e3baecf Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 11:10:17 +0200 Subject: [PATCH 34/76] try to remove xcbqpa --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acaadab1b..46dc04016 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,10 +118,6 @@ find_package( COMPONENTS ${QT_MODULES} LinguistTools REQUIRED) if(FLATPAK) - find_package( - Qt6 - COMPONENTS XcbQpa - REQUIRED) add_compile_definitions(FLATPAK) endif() From 6a77845469b0f962b90cc57366f41c27b9b94214 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 11:17:41 +0200 Subject: [PATCH 35/76] use temporarly different branch from flathub with Qt6 upgrade --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f09f3c1e..e9cb2c31b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,6 +73,12 @@ jobs: owner: 'flathub' repository: 'com.github.Murmele.Gittyup' + # just until the new release is out + - name: Checkout restructureCMake + run: | + cd com.github.Murmele.Gittyup + git checkout Qt6 + - name: Replace git tag by the commit id on which it runs if: github.ref_type != 'tag' run: > From 00ccbc3b520d242f9dc2373392834c4c8a114228 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 12:30:02 +0200 Subject: [PATCH 36/76] Wrong weekday in unittests --- test/amend.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/test/amend.cpp b/test/amend.cpp index 475aebee6..b85a40ed3 100644 --- a/test/amend.cpp +++ b/test/amend.cpp @@ -57,10 +57,12 @@ void TestAmend::testAmend() { auto authorSignature = repo.signature( "New Author", "New Author Email", - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + + QString dateAuthor = "Mon May 23 10:36:26 2022 +0200"; auto committerSignature = repo.signature( "New Committer", "New Committer Email", - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); Tree tree; c.amend(authorSignature, committerSignature, commitMessage, tree); @@ -73,12 +75,12 @@ void TestAmend::testAmend() { QCOMPARE(c.author().name(), "New Author"); QCOMPARE( c.author().date(), - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); QCOMPARE(c.committer().name(), "New Committer"); QCOMPARE(c.committer().email(), "New Committer Email"); QCOMPARE( c.committer().date(), - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); } void TestAmend::testAmendAddFile() { @@ -196,10 +198,10 @@ void TestAmend::testAmendDialog() { Test::ScratchRepository repo; auto authorSignature = repo->signature( "New Author", "New Author Email", - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); auto committerSignature = repo->signature( "New Committer", "New Committer Email", - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); { AmendDialog d(authorSignature, committerSignature, "Test commit message"); @@ -241,7 +243,7 @@ void TestAmend::testAmendDialog() { ContributorInfo::SelectedDateTimeType::Original); QCOMPARE(authorCommitDate->isVisible(), false); QCOMPARE(info.authorInfo.commitDate, - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); // manual @@ -290,7 +292,7 @@ void TestAmend::testAmendDialog() { ContributorInfo::SelectedDateTimeType::Original); QCOMPARE(committerCommitDate->isVisible(), false); QCOMPARE(info.committerInfo.commitDate, - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); // manual @@ -318,10 +320,10 @@ void TestAmend::testAmendDialog2() { Test::ScratchRepository repo; auto authorSignature = repo->signature( "New Author", "New Author Email", - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); auto committerSignature = repo->signature( "New Committer", "New Committer Email", - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); AmendDialog d(authorSignature, committerSignature, "Test commit message"); @@ -373,10 +375,10 @@ void TestAmend::testAmendDialogNewLineInMessage() { Test::ScratchRepository repo; auto authorSignature = repo->signature( "New Author", "New Author Email", - QDateTime::fromString("Sun May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 10:36:26 2022 +0200", Qt::RFC2822Date)); auto committerSignature = repo->signature( "New Committer", "New Committer Email", - QDateTime::fromString("Sun May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); + QDateTime::fromString("Mon May 23 11:36:26 2022 +0200", Qt::RFC2822Date)); AmendDialog d(authorSignature, committerSignature, "Test commit message\nNewLine"); From 73fb2812e1a4ff2793421ea66b6eae07246299b2 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 12:58:01 +0200 Subject: [PATCH 37/76] remove Win32 support because Qt6 does not support it anymore --- .github/workflows/build.yml | 19 ------------------- test/CMakeLists.txt | 32 ++++++-------------------------- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e9cb2c31b..d550edeb6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -169,23 +169,6 @@ jobs: CXX: clang++ pack: 1 - - name: win32 - os: windows-latest - ninja_platform: win - qt_platform: windows - qt_arch: win32_msvc2019 - qt_arch_check_only: win32_msvc2017 - openssl_arch: VC-WIN32 - msvc_arch: x86 - cmake_flags: "-DUSE_BUNDLED_ZLIB=1" - cmake_env: - CMAKE_RC_FLAGS: "/C 1252" - CC: clang - CXX: clang++ - CMAKE_C_FLAGS: -m32 - CMAKE_CXX_FLAGS: -m32 - pack: 1 - steps: # otherwise the testcases will fail, because signature is invalid - name: Set git name and email @@ -404,7 +387,6 @@ jobs: automatic_release_tag: 'development' files: | **/artifacts/Gittyup win64/Gittyup*.exe - **/artifacts/Gittyup win32/Gittyup*.exe **/artifacts/Gittyup macos/Gittyup*.dmg **/artifacts/Gittyup Flatpak/com.github.Murmele.Gittyup.yml **/Gittyup-x86_64/*.flatpak @@ -420,7 +402,6 @@ jobs: automatic_release_tag: ${{ github.ref_name }} files: | **/artifacts/Gittyup win64/Gittyup*.exe - **/artifacts/Gittyup win32/Gittyup*.exe **/artifacts/Gittyup macos/Gittyup*.dmg **/artifacts/Gittyup Flatpak/com.github.Murmele.Gittyup.yml **/Gittyup-x86_64/*.flatpak diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3a388f18e..d499febb9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ # Define test macro. macro(test) - cmake_parse_arguments(ARG "NO_WIN32_OFFSCREEN" "NAME" "" ${ARGN}) + cmake_parse_arguments(ARG "" "NAME" "" ${ARGN}) add_executable(test_${ARG_NAME} ${ARG_NAME}.cpp) target_link_libraries(test_${ARG_NAME} testlib) @@ -15,24 +15,13 @@ macro(test) add_test(NAME ${ARG_NAME} COMMAND $) add_dependencies(check_build test_${ARG_NAME}) - if(${ARG_NO_WIN32_OFFSCREEN}) - set_property( - TEST ${ARG_NAME} - APPEND - PROPERTY LABELS "NO_WIN32_OFFSCREEN") - endif() - if(WIN32) find_package(Qt6Gui) string(REPLACE ";" "\;" NEWPATH "$ENV{PATH}") string(REPLACE ";" "\;" PLUGIN_PATH "$") - if(${ARG_NO_WIN32_OFFSCREEN}) - set(PLATFORM "windows") - else() - set(PLATFORM "offscreen") - endif() + set(PLATFORM "offscreen") set_tests_properties( ${ARG_NAME} @@ -57,15 +46,6 @@ add_custom_target( COMMENT "Running tests..." USES_TERMINAL) -# Add check target excluding NO_WIN32_OFFSCREEN tests. -add_custom_target( - check_no_win32_offscreen - COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure - --timeout 300 --label-exclude NO_WIN32_OFFSCREEN - DEPENDS check_build - COMMENT "Running tests..." - USES_TERMINAL) - enable_testing() # Add test library. @@ -92,10 +72,10 @@ test(NAME bare_repo) test(NAME init_repo) test(NAME merge) test(NAME external_tools_dialog) -test(NAME branches_panel NO_WIN32_OFFSCREEN) -test(NAME editor NO_WIN32_OFFSCREEN) +test(NAME branches_panel) +test(NAME editor) test(NAME index) -test(NAME line_endings NO_WIN32_OFFSCREEN) +test(NAME line_endings) test(NAME log) test(NAME main_window) test(NAME new_branch_dialog) @@ -110,7 +90,7 @@ test(NAME referencelist) test(NAME amend) test(NAME SshConfig) test(NAME store) -test(NAME fileContextMenu NO_WIN32_OFFSCREEN) +test(NAME fileContextMenu) test(NAME Setting) test(NAME commitMessageTemplate) test(NAME commitEditor) From f216d4d1a21ec6aed810fc773479283fab074bb4 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 8 Oct 2023 15:12:23 +0200 Subject: [PATCH 38/76] add includes --- src/app/CustomTheme.cpp | 1 + src/app/Theme.cpp | 1 + src/conf/Settings.cpp | 1 + src/git/Diff.cpp | 1 + src/host/Account.cpp | 1 + src/index/Index.cpp | 2 ++ src/plugins/Plugin.cpp | 2 ++ 7 files changed, 9 insertions(+) diff --git a/src/app/CustomTheme.cpp b/src/app/CustomTheme.cpp index b23138d51..c4ec31c71 100644 --- a/src/app/CustomTheme.cpp +++ b/src/app/CustomTheme.cpp @@ -15,6 +15,7 @@ #include #include #include +#include namespace { diff --git a/src/app/Theme.cpp b/src/app/Theme.cpp index 628842462..b677c3084 100644 --- a/src/app/Theme.cpp +++ b/src/app/Theme.cpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace { diff --git a/src/conf/Settings.cpp b/src/conf/Settings.cpp index e6fd8176a..37f1c87c9 100644 --- a/src/conf/Settings.cpp +++ b/src/conf/Settings.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #ifdef Q_OS_WIN #define CS Qt::CaseInsensitive diff --git a/src/git/Diff.cpp b/src/git/Diff.cpp index 519d1a0d3..2497aa82f 100644 --- a/src/git/Diff.cpp +++ b/src/git/Diff.cpp @@ -12,6 +12,7 @@ #include "Debug.h" #include "git2/patch.h" #include +#include bool containsPath(QString &str, QString &occurence, Qt::CaseSensitivity cs) { if (str.contains(occurence, cs)) { diff --git a/src/host/Account.cpp b/src/host/Account.cpp index 0e2af7030..1abbac572 100644 --- a/src/host/Account.cpp +++ b/src/host/Account.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace { diff --git a/src/index/Index.cpp b/src/index/Index.cpp index d48ad5d8d..d448b2db2 100644 --- a/src/index/Index.cpp +++ b/src/index/Index.cpp @@ -22,6 +22,8 @@ #include #include +#include + namespace { const QString kLogKey = "debug/indexer"; diff --git a/src/plugins/Plugin.cpp b/src/plugins/Plugin.cpp index 54190c1f3..945873dc9 100644 --- a/src/plugins/Plugin.cpp +++ b/src/plugins/Plugin.cpp @@ -15,6 +15,8 @@ #include #include +#include + extern "C" { #include "lua.h" #include "lauxlib.h" From 2df645bd470bc46b95554e69b23c63aee76d4793 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Tue, 31 Oct 2023 20:18:05 +0100 Subject: [PATCH 39/76] try to fix compilation error on windows --- src/index/indexer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index a660307ba..99c233955 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -53,14 +53,14 @@ static LONG WINAPI exceptionFilter(PEXCEPTION_POINTERS info) { SYSTEMTIME localTime; GetLocalTime(&localTime); - char temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; GetTempPath(MAX_PATH, temp); - char dir[MAX_PATH]; + wchar_t dir[MAX_PATH]; StringCchPrintf(dir, MAX_PATH, "%sGittyup", temp); CreateDirectory(dir, NULL); - char fileName[MAX_PATH]; + wchar_t fileName[MAX_PATH]; StringCchPrintf( fileName, MAX_PATH, "%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", dir, "indexer", GITTYUP_VERSION, localTime.wYear, localTime.wMonth, From 9660d980ff79e5161a4bfc8aa56fa93dff0d0950 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Tue, 31 Oct 2023 20:22:59 +0100 Subject: [PATCH 40/76] try to fix compilation on mac --- src/app/CustomTheme_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/CustomTheme_mac.mm b/src/app/CustomTheme_mac.mm index 46983231a..46e250d8f 100644 --- a/src/app/CustomTheme_mac.mm +++ b/src/app/CustomTheme_mac.mm @@ -25,7 +25,7 @@ if (color.lightnessF() < 0.5) win.appearance = [NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]; - qreal r,g,b,a; + float r,g,b,a; color.getRgbF(&r,&g,&b,&a); win.backgroundColor = [NSColor colorWithDeviceRed:r green:g blue:b alpha:a]; } From cec89ce1d21d3ea0227b980aacd87af3adbc6a05 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 18:23:59 +0100 Subject: [PATCH 41/76] fix compilation on win --- src/app/Application.cpp | 21 +++++++++++---------- src/index/indexer.cpp | 13 +++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/app/Application.cpp b/src/app/Application.cpp index fc948333a..dac82df53 100644 --- a/src/app/Application.cpp +++ b/src/app/Application.cpp @@ -63,19 +63,20 @@ static LONG WINAPI exceptionFilter(PEXCEPTION_POINTERS info) { SYSTEMTIME localTime; GetLocalTime(&localTime); - char temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; GetTempPath(MAX_PATH, temp); - char dir[MAX_PATH]; - StringCchPrintf(dir, MAX_PATH, "%sGittyup", temp); + wchar_t dir[MAX_PATH]; + const wchar_t *gittyup_name = L"%sGittyup"; + StringCchPrintf(dir, MAX_PATH, gittyup_name, temp); CreateDirectory(dir, NULL); - char fileName[MAX_PATH]; - StringCchPrintf( - fileName, MAX_PATH, "%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", - dir, GITTYUP_NAME, GITTYUP_VERSION, localTime.wYear, localTime.wMonth, - localTime.wDay, localTime.wHour, localTime.wMinute, localTime.wSecond, - GetCurrentProcessId(), GetCurrentThreadId()); + wchar_t fileName[MAX_PATH]; + const wchar_t *s = L"%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp"; + StringCchPrintf(fileName, MAX_PATH, s, dir, GITTYUP_NAME, GITTYUP_VERSION, + localTime.wYear, localTime.wMonth, localTime.wDay, + localTime.wHour, localTime.wMinute, localTime.wSecond, + GetCurrentProcessId(), GetCurrentThreadId()); HANDLE dumpFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, @@ -359,7 +360,7 @@ class CopyDataWindow : public QWindow { protected: virtual bool nativeEvent(const QByteArray &eventType, void *message, - long *result) Q_DECL_OVERRIDE { + qintptr *result) Q_DECL_OVERRIDE { MSG *msg = (MSG *)message; if (msg->message == WM_COPYDATA) { diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index 99c233955..78220f10b 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -57,15 +57,16 @@ static LONG WINAPI exceptionFilter(PEXCEPTION_POINTERS info) { GetTempPath(MAX_PATH, temp); wchar_t dir[MAX_PATH]; - StringCchPrintf(dir, MAX_PATH, "%sGittyup", temp); + const wchar_t *gittyup_name = L"%sGittyup"; + StringCchPrintf(dir, MAX_PATH, gittyup_name, temp); CreateDirectory(dir, NULL); wchar_t fileName[MAX_PATH]; - StringCchPrintf( - fileName, MAX_PATH, "%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", - dir, "indexer", GITTYUP_VERSION, localTime.wYear, localTime.wMonth, - localTime.wDay, localTime.wHour, localTime.wMinute, localTime.wSecond, - GetCurrentProcessId(), GetCurrentThreadId()); + const wchar_t *s = L"%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp"; + StringCchPrintf(fileName, MAX_PATH, s, dir, "indexer", GITTYUP_VERSION, + localTime.wYear, localTime.wMonth, localTime.wDay, + localTime.wHour, localTime.wMinute, localTime.wSecond, + GetCurrentProcessId(), GetCurrentThreadId()); HANDLE dumpFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, From 82f09b93b05e246310637825b92d9283aa349782 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 18:25:52 +0100 Subject: [PATCH 42/76] fix ninja check for windows --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d550edeb6..d885a679f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -305,7 +305,7 @@ jobs: if: matrix.env.ninja_platform == 'win' run: | cd build/release - ninja check_no_win32_offscreen + ninja check --verbose - name: Build Appimage if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only From c9f0db632b437ac7fd87f5d16cbe1600b05fdaee Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 19:07:49 +0100 Subject: [PATCH 43/76] use always windows --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d499febb9..3d2e0819a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,7 +21,7 @@ macro(test) string(REPLACE ";" "\;" PLUGIN_PATH "$") - set(PLATFORM "offscreen") + set(PLATFORM "windows") set_tests_properties( ${ARG_NAME} From 2c93534b51fdb86d15adfecd73bbb49ec69667d7 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 22:53:13 +0100 Subject: [PATCH 44/76] revert --- test/CMakeLists.txt | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3d2e0819a..54503d4e4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ # Define test macro. macro(test) - cmake_parse_arguments(ARG "" "NAME" "" ${ARGN}) + cmake_parse_arguments(ARG "NO_WIN32_OFFSCREEN" "NAME" "" ${ARGN}) add_executable(test_${ARG_NAME} ${ARG_NAME}.cpp) target_link_libraries(test_${ARG_NAME} testlib) @@ -15,13 +15,24 @@ macro(test) add_test(NAME ${ARG_NAME} COMMAND $) add_dependencies(check_build test_${ARG_NAME}) + if(${ARG_NO_WIN32_OFFSCREEN}) + set_property( + TEST ${ARG_NAME} + APPEND + PROPERTY LABELS "NO_WIN32_OFFSCREEN") + endif() + if(WIN32) find_package(Qt6Gui) string(REPLACE ";" "\;" NEWPATH "$ENV{PATH}") string(REPLACE ";" "\;" PLUGIN_PATH "$") - set(PLATFORM "windows") + if(${ARG_NO_WIN32_OFFSCREEN}) + set(PLATFORM "windows") + else() + set(PLATFORM "offscreen") + endif() set_tests_properties( ${ARG_NAME} @@ -46,6 +57,16 @@ add_custom_target( COMMENT "Running tests..." USES_TERMINAL) +# Add check target excluding NO_WIN32_OFFSCREEN tests. +add_custom_target( + check_no_win32_offscreen + COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure + --timeout 300 --label-exclude NO_WIN32_OFFSCREEN + DEPENDS check_build + COMMENT "Running tests..." + USES_TERMINAL) + + enable_testing() # Add test library. @@ -90,7 +111,7 @@ test(NAME referencelist) test(NAME amend) test(NAME SshConfig) test(NAME store) -test(NAME fileContextMenu) +test(NAME fileContextMenu NO_WIN32_OFFSCREEN) test(NAME Setting) test(NAME commitMessageTemplate) test(NAME commitEditor) From 16503acedf09db54b2addc6803ba920b89f93edb Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 22:53:19 +0100 Subject: [PATCH 45/76] revert --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d885a679f..0d3764db6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -305,7 +305,7 @@ jobs: if: matrix.env.ninja_platform == 'win' run: | cd build/release - ninja check --verbose + ninja check check_no_win32_offscreen - name: Build Appimage if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only From 2bb70a215425aa4ad4dad3bc81d31113700ec3a4 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 1 Nov 2023 22:54:29 +0100 Subject: [PATCH 46/76] revert and format --- .github/workflows/build.yml | 2 +- test/CMakeLists.txt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d3764db6..d550edeb6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -305,7 +305,7 @@ jobs: if: matrix.env.ninja_platform == 'win' run: | cd build/release - ninja check check_no_win32_offscreen + ninja check_no_win32_offscreen - name: Build Appimage if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 54503d4e4..99ba8fe34 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,9 +29,9 @@ macro(test) "$") if(${ARG_NO_WIN32_OFFSCREEN}) - set(PLATFORM "windows") + set(PLATFORM "windows") else() - set(PLATFORM "offscreen") + set(PLATFORM "offscreen") endif() set_tests_properties( @@ -66,7 +66,6 @@ add_custom_target( COMMENT "Running tests..." USES_TERMINAL) - enable_testing() # Add test library. From dac85deb3027055b65b309599f98b3af0c9646a9 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Tue, 21 Nov 2023 22:19:22 +0100 Subject: [PATCH 47/76] fix compilation --- l10n/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n/CMakeLists.txt b/l10n/CMakeLists.txt index a165d44d5..dfd68fc63 100644 --- a/l10n/CMakeLists.txt +++ b/l10n/CMakeLists.txt @@ -38,7 +38,7 @@ add_dependencies(gittyup translations) add_library(translation ${LANGUAGE_SOURCE_FILE}) target_include_directories(translation PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries(translation Qt5::Core) +target_link_libraries(translation Qt6::Core) # install language files From d05094b43befa9481c700ec343c1268191be30b4 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Wed, 13 Dec 2023 21:51:19 +0100 Subject: [PATCH 48/76] dirty fix for macos In Qt5 QT_LIBRAY points to the symlink and in Qt6 it points directly to the library --- pack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 1b610f0ce..1e1057ae3 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -85,7 +85,7 @@ elseif(NOT USE_SYSTEM_QT) get_filename_component(QT_FRAMEWORK ${QT_LIBRARY} DIRECTORY) set(DEST_DIR ${CONTENTS_DIR}/Frameworks) install( - DIRECTORY ${QT_FRAMEWORK} + DIRECTORY ${QT_FRAMEWORK}/../.. DESTINATION ${DEST_DIR} COMPONENT ${GITTYUP_NAME} PATTERN "*.prl" EXCLUDE From 0552f318cf3258e1215b2a2b865a5a34a9aae506 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 15 Dec 2023 10:11:13 +0100 Subject: [PATCH 49/76] dirty fix for macos --- pack/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 1e1057ae3..b37c9ff09 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -83,9 +83,13 @@ elseif(NOT USE_SYSTEM_QT) if(APPLE) get_filename_component(QT_FRAMEWORK ${QT_LIBRARY} DIRECTORY) + + # FIXME: QT_LIBRARY points directly to the library bin instead of the symlink 2 directories above (since qt6) + string(REGEX REPLACE "/Versions/.*" "" QT_FRAMEWORK "${QT_FRAMEWORK}") + set(DEST_DIR ${CONTENTS_DIR}/Frameworks) install( - DIRECTORY ${QT_FRAMEWORK}/../.. + DIRECTORY ${QT_FRAMEWORK} DESTINATION ${DEST_DIR} COMPONENT ${GITTYUP_NAME} PATTERN "*.prl" EXCLUDE From 271c7a52d6036a64a28278cf8db5e08b9be073cf Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 15 Dec 2023 13:56:00 +0100 Subject: [PATCH 50/76] Appimage build fix --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d550edeb6..9b539e10a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -308,12 +308,12 @@ jobs: ninja check_no_win32_offscreen - name: Build Appimage - if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only + if: matrix.env.ninja_platform == 'linux' run: | cd build/release sudo apt -y install appstream sudo apt -y install libfuse2 - sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 + sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 sudo apt -y install libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb-xrm0 libxcb-xv0 libxcb-xvmc0 libxcb1 mkdir -p AppDir @@ -339,7 +339,7 @@ jobs: #ls -lh Gittyup-* - name: Publish Appimage - if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only + if: matrix.env.ninja_platform == 'linux' uses: actions/upload-artifact@v3 with: path: build/release/*.AppImage From 2fe4f03d0e684369c118982ed16d3c2166c2675d Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 15 Dec 2023 15:38:56 +0100 Subject: [PATCH 51/76] Potential Appimage fix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b539e10a..2996406d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -313,7 +313,7 @@ jobs: cd build/release sudo apt -y install appstream sudo apt -y install libfuse2 - sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 + sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 libxcb-util1 sudo apt -y install libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb-xrm0 libxcb-xv0 libxcb-xvmc0 libxcb1 mkdir -p AppDir From bf8fb2591f4e2566e97ed8b5d3dd423d427c125e Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 15 Dec 2023 16:32:17 +0100 Subject: [PATCH 52/76] Adds listing of plugins dir in appimage build step for debugging --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2996406d5..a5a5e4753 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -310,10 +310,12 @@ jobs: - name: Build Appimage if: matrix.env.ninja_platform == 'linux' run: | + find /home/runner/work/Gittyup/Qt/6.5.*/gcc_64/plugins + cd build/release sudo apt -y install appstream sudo apt -y install libfuse2 - sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 libxcb-util1 + sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 sudo apt -y install libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb-xrm0 libxcb-xv0 libxcb-xvmc0 libxcb1 mkdir -p AppDir From 27698dfe275c24fe4550b496047e0ad595932e88 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 15 Dec 2023 22:07:10 +0100 Subject: [PATCH 53/76] Potential appimage build fix --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5a5e4753..1cb8771b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -310,12 +310,10 @@ jobs: - name: Build Appimage if: matrix.env.ninja_platform == 'linux' run: | - find /home/runner/work/Gittyup/Qt/6.5.*/gcc_64/plugins - cd build/release sudo apt -y install appstream sudo apt -y install libfuse2 - sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 + sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 libxkbcommon0 sudo apt -y install libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb-xrm0 libxcb-xv0 libxcb-xvmc0 libxcb1 mkdir -p AppDir From 29e192593d1639fab51fe296a5806b5d6cd7b2a9 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Sat, 16 Dec 2023 15:34:52 +0100 Subject: [PATCH 54/76] potential appimage build fix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cb8771b0..da3207dbe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -313,7 +313,7 @@ jobs: cd build/release sudo apt -y install appstream sudo apt -y install libfuse2 - sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 libxkbcommon0 + sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 libxkbcommon0 libx11-xcb1 sudo apt -y install libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb-xrm0 libxcb-xv0 libxcb-xvmc0 libxcb1 mkdir -p AppDir From 08989732d84644b3025c38f28d90896c71384e11 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sat, 23 Dec 2023 10:01:58 +0100 Subject: [PATCH 55/76] try lowercase --- pack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index b37c9ff09..9f3eab1dc 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -38,7 +38,7 @@ elseif(NOT USE_SYSTEM_QT) get_filename_component(FILE_NAME ${PLUGIN} NAME) get_filename_component(DIR ${PLUGIN} DIRECTORY) get_filename_component(DIR_NAME ${DIR} NAME) - set(PLUGIN_PATH Plugins/${DIR_NAME}/${FILE_NAME}) + set(PLUGIN_PATH plugins/${DIR_NAME}/${FILE_NAME}) install( FILES ${PLUGIN} From c6cbc83aee10e86e0dc79ea254e3a9dba3f9a98a Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sat, 23 Dec 2023 10:03:36 +0100 Subject: [PATCH 56/76] forgotten at another place as well --- pack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 9f3eab1dc..6e1d63073 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -42,7 +42,7 @@ elseif(NOT USE_SYSTEM_QT) install( FILES ${PLUGIN} - DESTINATION ${INSTALL_LIBDIR}/Plugins/${DIR_NAME} + DESTINATION ${INSTALL_LIBDIR}/plugins/${DIR_NAME} PERMISSIONS OWNER_READ OWNER_WRITE From e516467eb9f07248a1e36fbb085a3d2154a796df Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sat, 23 Dec 2023 10:01:58 +0100 Subject: [PATCH 57/76] Revert "try lowercase" This reverts commit 08989732d84644b3025c38f28d90896c71384e11. --- pack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 6e1d63073..4624dec8b 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -38,7 +38,7 @@ elseif(NOT USE_SYSTEM_QT) get_filename_component(FILE_NAME ${PLUGIN} NAME) get_filename_component(DIR ${PLUGIN} DIRECTORY) get_filename_component(DIR_NAME ${DIR} NAME) - set(PLUGIN_PATH plugins/${DIR_NAME}/${FILE_NAME}) + set(PLUGIN_PATH Plugins/${DIR_NAME}/${FILE_NAME}) install( FILES ${PLUGIN} From a697e0678b56313ae95213805df9938c8c0596ea Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sat, 23 Dec 2023 10:03:36 +0100 Subject: [PATCH 58/76] Revert "forgotten at another place as well" This reverts commit c6cbc83aee10e86e0dc79ea254e3a9dba3f9a98a. --- pack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 4624dec8b..b37c9ff09 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -42,7 +42,7 @@ elseif(NOT USE_SYSTEM_QT) install( FILES ${PLUGIN} - DESTINATION ${INSTALL_LIBDIR}/plugins/${DIR_NAME} + DESTINATION ${INSTALL_LIBDIR}/Plugins/${DIR_NAME} PERMISSIONS OWNER_READ OWNER_WRITE From b624c25bc05c0d8fe397235d052203c79da4eabd Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 21 Jan 2024 11:36:25 +0100 Subject: [PATCH 59/76] update license date --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 76c1c1674..4722beb8b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ MIT License Copyright (c) 2018 Scientific Toolworks, Inc. -Copyright (c) 2021-2023 Gittyup contributors +Copyright (c) 2021-2024 Gittyup contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 6281b1ffabe52ff6cdcf7323b23ac3931e2ceb69 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 21 Jan 2024 11:36:32 +0100 Subject: [PATCH 60/76] list folders --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da3207dbe..0d2f3f6bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -326,6 +326,8 @@ jobs: wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) chmod +x appimagetool-*.AppImage + ls $QTDIR + ls $QTDIR/plugins QTDIR=$QTDIR ./appimagetool-*.AppImage -s deploy ./AppDir/usr/share/applications/*.desktop --appimage-extract-and-run # Bundle EVERYTHING # Modify the AppDir: move ld-linux into the same directory as the payload application From 8b0ec9c33a1539aa32889ccbf8837cf71b1984a7 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 21 Jan 2024 11:37:31 +0100 Subject: [PATCH 61/76] Reason: --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d2f3f6bb..87a4240bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -328,6 +328,7 @@ jobs: chmod +x appimagetool-*.AppImage ls $QTDIR ls $QTDIR/plugins + ls $QTDIR/plugins/platforms QTDIR=$QTDIR ./appimagetool-*.AppImage -s deploy ./AppDir/usr/share/applications/*.desktop --appimage-extract-and-run # Bundle EVERYTHING # Modify the AppDir: move ld-linux into the same directory as the payload application From 9c349e5dc2e7ce49bce548019987c4a1b36d8f8d Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 21 Jan 2024 11:47:54 +0100 Subject: [PATCH 62/76] format --- pack/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index b37c9ff09..5dc1611a1 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -84,7 +84,8 @@ elseif(NOT USE_SYSTEM_QT) if(APPLE) get_filename_component(QT_FRAMEWORK ${QT_LIBRARY} DIRECTORY) - # FIXME: QT_LIBRARY points directly to the library bin instead of the symlink 2 directories above (since qt6) + # FIXME: QT_LIBRARY points directly to the library bin instead of the + # symlink 2 directories above (since qt6) string(REGEX REPLACE "/Versions/.*" "" QT_FRAMEWORK "${QT_FRAMEWORK}") set(DEST_DIR ${CONTENTS_DIR}/Frameworks) From a4efa04d014016be768dc17daa028885b4daf170 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 21 Jan 2024 11:59:37 +0100 Subject: [PATCH 63/76] WIP --- .github/workflows/build.yml | 3 +++ pack/CMakeLists.txt | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87a4240bf..34200cfe4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -326,8 +326,11 @@ jobs: wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) chmod +x appimagetool-*.AppImage + echo Show QTDIR ls $QTDIR + echo Show QTDIR plugins ls $QTDIR/plugins + echo Show QTDIR plugins platforms ls $QTDIR/plugins/platforms QTDIR=$QTDIR ./appimagetool-*.AppImage -s deploy ./AppDir/usr/share/applications/*.desktop --appimage-extract-and-run # Bundle EVERYTHING diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 5dc1611a1..3a437f62e 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -24,7 +24,7 @@ else() set(INSTALL_LIBDIR ${CONTENTS_DIR}) endif() -if(FLATPAK) +if(FLATPAK OR UNIX) qt_import_plugins(gittyup INCLUDE ${QT_PLUGINS}) elseif(NOT USE_SYSTEM_QT) foreach(QT_PLUGIN ${QT_PLUGINS}) @@ -153,7 +153,7 @@ if(UNIX AND NOT APPLE) WORLD_READ WORLD_EXECUTE COMPONENT ${GITTYUP_NAME} - RENAME ${LIB_NAME}.so.5) + RENAME ${LIB_NAME}.so.6) endif() # Install SSL libraries. From 6a04614e60d148d740da6993b9359bd9c6751828 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 21 Jan 2024 12:01:48 +0100 Subject: [PATCH 64/76] Must be so.6 --- pack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index 3a437f62e..ed7a29f01 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -107,7 +107,7 @@ elseif(NOT USE_SYSTEM_QT) else() # Strip minor and patch version extensions. get_filename_component(TARGET_NAME_WE ${QT_LIBRARY} NAME_WE) - set(TARGET_NAME ${TARGET_NAME_WE}.so.5) + set(TARGET_NAME ${TARGET_NAME_WE}.so.6) endif() install( From 7b1216860ed06926d0b9bbc9e03ed9e6ff730d6e Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 21 Jan 2024 12:05:36 +0100 Subject: [PATCH 65/76] Disable using qt_import_plugins for UNIX again --- pack/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/CMakeLists.txt b/pack/CMakeLists.txt index ed7a29f01..fac5dac7f 100644 --- a/pack/CMakeLists.txt +++ b/pack/CMakeLists.txt @@ -24,7 +24,7 @@ else() set(INSTALL_LIBDIR ${CONTENTS_DIR}) endif() -if(FLATPAK OR UNIX) +if(FLATPAK) qt_import_plugins(gittyup INCLUDE ${QT_PLUGINS}) elseif(NOT USE_SYSTEM_QT) foreach(QT_PLUGIN ${QT_PLUGINS}) From 00675a77f7eef715e00c2b5bd6b603a8d9a7eb96 Mon Sep 17 00:00:00 2001 From: Murmele Date: Tue, 6 Feb 2024 10:01:51 +0100 Subject: [PATCH 66/76] Try to change qt version without wildcard --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 34200cfe4..bd3a1f38e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,7 +132,7 @@ jobs: fail-fast: false matrix: qt: - - version: 6.5.* + - version: 6.5.3 env: - name: linux From 37cf41099dbda187a652b6770bbf25a2adf741d1 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 14 Jun 2024 15:23:18 +0200 Subject: [PATCH 67/76] - Use qt 6.7.1 to build the project - cleanup - Fix usage of deprecated functions --- .github/workflows/build.yml | 2 +- src/conf/Settings.cpp | 1 - src/editor/PlatQt.cpp | 4 ++-- src/editor/ScintillaQt.cpp | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd3a1f38e..a4382312d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,7 +132,7 @@ jobs: fail-fast: false matrix: qt: - - version: 6.5.3 + - version: 6.7.1 env: - name: linux diff --git a/src/conf/Settings.cpp b/src/conf/Settings.cpp index 37f1c87c9..314239a7b 100644 --- a/src/conf/Settings.cpp +++ b/src/conf/Settings.cpp @@ -9,7 +9,6 @@ #include "Settings.h" #include "ConfFile.h" -#include "Debug.h" #include "qtsupport.h" #include "languages.h" #include diff --git a/src/editor/PlatQt.cpp b/src/editor/PlatQt.cpp index f288d2e47..c9f6fdf5b 100644 --- a/src/editor/PlatQt.cpp +++ b/src/editor/PlatQt.cpp @@ -629,14 +629,14 @@ void Platform::DebugPrintf(const char *format, ...) { char buffer[2000]; va_list pArguments; va_start(pArguments, format); - vsprintf(buffer, format, pArguments); + vsnprintf(buffer, sizeof(buffer), format, pArguments); va_end(pArguments); Platform::DebugDisplay(buffer); } void Platform::Assert(const char *c, const char *file, int line) { char buffer[2000]; - sprintf(buffer, "Assertion [%s] failed at %s %d\n", c, file, line); + snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\n", c, file, line); Platform::DebugDisplay(buffer); } diff --git a/src/editor/ScintillaQt.cpp b/src/editor/ScintillaQt.cpp index f8e4e7edd..1ced345a8 100644 --- a/src/editor/ScintillaQt.cpp +++ b/src/editor/ScintillaQt.cpp @@ -632,7 +632,7 @@ void ScintillaQt::inputMethodEvent(QInputMethodEvent *event) { MoveImeCarets(-imeCharPos[preeditStrLen] + imeCharPos[imeCaretPos]); } - // Set candidate box position for Qt::ImMicroFocus. + // Set candidate box position for Qt::ImCursorRectangle. preeditPos = CurrentPosition(); EnsureCaretVisible(); updateMicroFocus(); @@ -1026,7 +1026,7 @@ bool ScintillaQt::SetIdle(bool on) { idler.state = false; QTimer *timer = static_cast(idler.idlerID); timer->stop(); - disconnect(timer, &QTimer::timeout, 0, 0); + disconnect(timer, &QTimer::timeout, nullptr, nullptr); delete timer; idler.idlerID = nullptr; } From c63b67db3c6dc6540e45fb9f33946e871b9820c6 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 14 Jun 2024 17:31:20 +0200 Subject: [PATCH 68/76] Fix formatting --- src/editor/PlatQt.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/editor/PlatQt.cpp b/src/editor/PlatQt.cpp index c9f6fdf5b..630acfab5 100644 --- a/src/editor/PlatQt.cpp +++ b/src/editor/PlatQt.cpp @@ -636,7 +636,8 @@ void Platform::DebugPrintf(const char *format, ...) { void Platform::Assert(const char *c, const char *file, int line) { char buffer[2000]; - snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\n", c, file, line); + snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\n", c, file, + line); Platform::DebugDisplay(buffer); } From 57c84d74c7b960abeaffbab21c046b063f93bd80 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 14 Jun 2024 17:47:10 +0200 Subject: [PATCH 69/76] Update insall-qt-action for the github workflows --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e70b55351..6026c4bf1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -195,7 +195,7 @@ jobs: perl-version: '5.30' - name: Install Qt - uses: jurplel/install-qt-action@v3.3.0 + uses: jurplel/install-qt-action@v4.0.0 timeout-minutes: 10 with: version: ${{ matrix.qt.version }} From 51e22ce92b74b4f81f4b08f16a7fb14a3b5696ca Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 14 Jun 2024 18:28:17 +0200 Subject: [PATCH 70/76] Downgrade qt again because aqt-install is broken with qt 6.7.x --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6026c4bf1..1f54d21fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,7 +132,7 @@ jobs: fail-fast: false matrix: qt: - - version: 6.7.1 + - version: 6.5.4 env: - name: linux From fb8390816eb104fe9a24de79b54942b17f32398a Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 14 Jun 2024 18:35:37 +0200 Subject: [PATCH 71/76] Downgrade install-qt-action to match qt version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f54d21fa..6d7f7de1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -195,7 +195,7 @@ jobs: perl-version: '5.30' - name: Install Qt - uses: jurplel/install-qt-action@v4.0.0 + uses: jurplel/install-qt-action@v3.3.0 timeout-minutes: 10 with: version: ${{ matrix.qt.version }} From 5fb5d66a295f21d4f1b930c15ecc39b40dff2abb Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Fri, 14 Jun 2024 18:40:48 +0200 Subject: [PATCH 72/76] qt downgrade --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d7f7de1b..b5d04bbe2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,7 +132,7 @@ jobs: fail-fast: false matrix: qt: - - version: 6.5.4 + - version: 6.5.3 env: - name: linux From 3803be2cf4eb0296b9b196e14c3f5cd126f5747c Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sat, 15 Jun 2024 09:37:45 +0200 Subject: [PATCH 73/76] fix flatpak manifest qt version --- com.github.Murmele.Gittyup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.github.Murmele.Gittyup.yml b/com.github.Murmele.Gittyup.yml index 32f8b0f11..dfa892ec9 100644 --- a/com.github.Murmele.Gittyup.yml +++ b/com.github.Murmele.Gittyup.yml @@ -1,6 +1,6 @@ app-id: com.github.Murmele.Gittyup runtime: org.kde.Platform -runtime-version: 5.15-23.08 +runtime-version: 6.7 sdk: org.kde.Sdk command: gittyup desktop-file-name-suffix: "" # used to create development version From 6bbcfdddb378c86cf08eea497cd39f4da0b10865 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sat, 15 Jun 2024 09:49:23 +0200 Subject: [PATCH 74/76] add missing Q_OBJECT --- src/dialogs/AmendDialog.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dialogs/AmendDialog.h b/src/dialogs/AmendDialog.h index 670be074f..10e6f846e 100644 --- a/src/dialogs/AmendDialog.h +++ b/src/dialogs/AmendDialog.h @@ -26,6 +26,7 @@ struct AmendInfo { }; class AmendDialog : public QDialog { + Q_OBJECT public: AmendDialog(const git::Signature &author, const git::Signature &committer, const QString &commitMessage, QWidget *parent = nullptr); From 918df6586d197ae7c377d27d18ee6ac6c079bd2d Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sat, 15 Jun 2024 10:15:19 +0200 Subject: [PATCH 75/76] Add missing Q_OBJECT --- src/dialogs/HotkeysPanel.cpp | 1 + src/ui/IgnoreDialog.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/dialogs/HotkeysPanel.cpp b/src/dialogs/HotkeysPanel.cpp index a31d98fc6..5f0306adf 100644 --- a/src/dialogs/HotkeysPanel.cpp +++ b/src/dialogs/HotkeysPanel.cpp @@ -308,6 +308,7 @@ class SimpleKeyEdit : public QKeySequenceEdit { }; class KeybindDialog : public QDialog { + Q_OBJECT public: KeybindDialog(QWidget *parent, HotkeyModel *hotkeys, Hotkey hotkey) : QDialog(parent) { diff --git a/src/ui/IgnoreDialog.h b/src/ui/IgnoreDialog.h index 4c4235d16..3557fcefc 100644 --- a/src/ui/IgnoreDialog.h +++ b/src/ui/IgnoreDialog.h @@ -7,6 +7,7 @@ class QDialogButtonBox; class QTextEdit; class IgnoreDialog : public QDialog { + Q_OBJECT public: IgnoreDialog(const QString &ignore, QWidget *parent = nullptr); QString ignoreText() const; From c33a6c2f1e1752f03d85d35b0c2d9cdaaad9235e Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sat, 15 Jun 2024 10:15:19 +0200 Subject: [PATCH 76/76] Revert "Add missing Q_OBJECT" This reverts commit 918df6586d197ae7c377d27d18ee6ac6c079bd2d. --- src/dialogs/HotkeysPanel.cpp | 1 - src/ui/IgnoreDialog.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/dialogs/HotkeysPanel.cpp b/src/dialogs/HotkeysPanel.cpp index 5f0306adf..a31d98fc6 100644 --- a/src/dialogs/HotkeysPanel.cpp +++ b/src/dialogs/HotkeysPanel.cpp @@ -308,7 +308,6 @@ class SimpleKeyEdit : public QKeySequenceEdit { }; class KeybindDialog : public QDialog { - Q_OBJECT public: KeybindDialog(QWidget *parent, HotkeyModel *hotkeys, Hotkey hotkey) : QDialog(parent) { diff --git a/src/ui/IgnoreDialog.h b/src/ui/IgnoreDialog.h index 3557fcefc..4c4235d16 100644 --- a/src/ui/IgnoreDialog.h +++ b/src/ui/IgnoreDialog.h @@ -7,7 +7,6 @@ class QDialogButtonBox; class QTextEdit; class IgnoreDialog : public QDialog { - Q_OBJECT public: IgnoreDialog(const QString &ignore, QWidget *parent = nullptr); QString ignoreText() const;