diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e987cfd..6193e2d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,27 +22,39 @@ on: jobs: build: - name: Build (Linux, Ubuntu 22.04 LTS) + name: Build (Linux, Qt ${{ matrix.qt_major }}, Ubuntu 22.04 LTS) runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + include: + - qt_major: 5 + packages: qtbase5-dev + - qt_major: 6 + packages: libgl1-mesa-dev libglx-dev libqt6core5compat6-dev qt6-base-dev steps: - name: 'Install build dependencies' + env: + packages: ${{ matrix.packages }} run: |- set -e sudo apt-get update sudo apt-get install --yes --no-install-recommends \ build-essential \ cmake \ - qtbase5-dev + ${packages} - name: 'Checkout Git branch' uses: actions/checkout@v2.0.0 - name: 'Configure' + env: + qt_major: ${{ matrix.qt_major }} run: |- set -e mkdir build cd build - cmake .. + cmake -DQT_PACKAGE="Qt${qt_major}" .. - name: 'Build' run: |- diff --git a/CMakeLists.txt b/CMakeLists.txt index 16354ff..1950fc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,30 +17,49 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) -option(UseQt5 "Use Qt5?" ON) - if (UseQt5) - set(QT_MIN_VERSION 5.11.0) - find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Gui Widgets) - set(QT_LIBRARIES Qt5::Widgets) - - macro(qt_wrap_ui) - qt5_wrap_ui(${ARGN}) - endmacro() - macro(qt_add_resources) - qt5_add_resources(${ARGN}) - endmacro() - else() - find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui) - include(${QT_USE_FILE}) - - macro(qt_wrap_ui) - qt4_wrap_ui(${ARGN}) - endmacro() - macro(qt_add_resources) - qt4_add_resources(${ARGN}) - endmacro() - endif() +# Select the Qt major version and its dependencies\ +set(QT_PACKAGE "Qt6" CACHE STRING "Major Qt version") +set_property(CACHE QT_PACKAGE PROPERTY STRINGS "Qt6" "Qt5" "Qt4") + +find_package(QT NAMES ${QT_PACKAGE} REQUIRED) +set(QT Qt${QT_VERSION_MAJOR}) +message(STATUS "Using ${QT}") + +if (QT_VERSION_MAJOR EQUAL 6) + set(QT_MIN_VERSION 6.2.4) + set(QT_MODULES Core Gui Widgets Core5Compat) + set(QT_LIBRARIES Qt6::Widgets Qt6::Core5Compat) +elseif (QT_VERSION_MAJOR EQUAL 5) + set(QT_MIN_VERSION 5.11.0) + set(QT_MODULES Core Gui Widgets) + set(QT_LIBRARIES Qt5::Widgets) +elseif (QT_MAJOR_VERSION EQUAL 4) + set(QT_MODULES QtCore QtGui) + include(${QT_USE_FILE}) +endif() + +find_package(${QT} ${QT_MIN_VERSION} REQUIRED COMPONENTS ${QT_MODULES}) + +if (QT_VERSION VERSION_LESS 5.15) + if (QT_VERSION_MAJOR EQUAL 4) + macro(qt_wrap_ui) + qt4_wrap_ui(${ARGN}) + endmacro() + macro(qt_add_resources) + qt4_add_resources(${ARGN}) + endmacro() + elseif(QT_VERSION_MAJOR EQUAL 5) + macro(qt_wrap_ui) + qt5_wrap_ui(${ARGN}) + endmacro() + macro(qt_add_resources) + qt5_add_resources(${ARGN}) + endmacro() + endif() +endif() + +# Sources include_directories( ${CMAKE_SOURCE_DIR}/src ) diff --git a/src/FileHistory.cc b/src/FileHistory.cc index 290228e..d479116 100644 --- a/src/FileHistory.cc +++ b/src/FileHistory.cc @@ -122,7 +122,11 @@ void FileHistory::clear(bool complete) { rowData.clear(); if (testFlag(REL_DATE_F)) { +#if QT_VERSION >= 0x06000 + secs = QDateTime::currentDateTime().toSecsSinceEpoch(); +#else secs = QDateTime::currentDateTime().toTime_t(); +#endif #ifdef HAVE_COLUMNTYPE headerInfo[ColumnType::TIME_COL] = "Last Change"; #else diff --git a/src/commit.ui b/src/commit.ui index 4055499..ce88e1a 100644 --- a/src/commit.ui +++ b/src/commit.ui @@ -1,7 +1,8 @@ - + + CommitBase - - + + 0 0 @@ -9,106 +10,107 @@ 531 - + Commit changes - - :/icons/resources/svn-commit.svg + + + :/icons/resources/svn-commit.svg:/icons/resources/svn-commit.svg - - + + 0 - + 0 - + 0 - + 0 - + 0 - - + + 6 - + 0 - + 0 - + 0 - + 0 - - - Qt::Vertical + + + Qt::Orientation::Vertical - - - Qt::CustomContextMenu + + + Qt::ContextMenuPolicy::CustomContextMenu - + Check files to commit - + false - + false - + true - + 2 - + File - + Index status - - - + + + 0 - + 0 - + 0 - + 0 - + 0 - - + + Commit message (first line is the sub&ject): - + false - + textEditMsg @@ -119,13 +121,13 @@ Lines starting with '#' will be ignored Press <Ctrl+Enter> to commit changes - - QTextEdit::NoWrap + + QTextEdit::LineWrapMode::NoWrap - + false - + false @@ -135,55 +137,55 @@ Press <Ctrl+Enter> to commit changes - - + + 6 - + 0 - + 0 - + 0 - + 0 - - + + 150 24 - + Monospace - - QFrame::Sunken + + QFrame::Shadow::Sunken - + Line: %1 Col: %2 - + false - - Qt::Horizontal + + Qt::Orientation::Horizontal - - QSizePolicy::Expanding + + QSizePolicy::Policy::Expanding - + 30 20 @@ -192,80 +194,80 @@ Press <Ctrl+Enter> to commit changes - - - + + + 0 0 - + Settin&gs - + Alt+G - + false - + false - - - + + + 0 0 - + Canc&el - + Alt+E - + false - + true - - - + + + 0 0 - + Update index for selected files - + Update &Index - - - + + + 0 0 - + Commit selected files - + &Commit - + Alt+C @@ -276,14 +278,14 @@ Press <Ctrl+Enter> to commit changes - + pushButtonCancel pushButtonUpdateCache pushButtonOk - + @@ -292,11 +294,11 @@ Press <Ctrl+Enter> to commit changes CommitBase pushButtonCancel_clicked() - - 20 - 20 + + 375 + 511 - + 20 20 @@ -308,11 +310,11 @@ Press <Ctrl+Enter> to commit changes CommitBase pushButtonUpdateCache_clicked() - - 20 - 20 + + 465 + 511 - + 20 20 @@ -324,15 +326,20 @@ Press <Ctrl+Enter> to commit changes CommitBase pushButtonSettings_clicked() - - 20 - 20 + + 285 + 511 - + 20 20 + + pushButtonCancel_clicked() + pushButtonUpdateCache_clicked() + pushButtonSettings_clicked() + diff --git a/src/commitimpl.cpp b/src/commitimpl.cpp index afd1834..d69024f 100644 --- a/src/commitimpl.cpp +++ b/src/commitimpl.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -191,8 +191,8 @@ bool CommitImpl::checkFiles(SList selFiles) { bool CommitImpl::checkMsg(QString& msg) { msg = textEditMsg->toPlainText(); - msg.remove(QRegExp("(^|\\n)\\s*#[^\\n]*")); // strip comments - msg.replace(QRegExp("[ \\t\\r\\f\\v]+\\n"), "\n"); // strip line trailing cruft + msg.remove(QRegularExpression("(^|\\n)\\s*#[^\\n]*")); // strip comments + msg.replace(QRegularExpression("[ \\t\\r\\f\\v]+\\n"), "\n"); // strip line trailing cruft msg = msg.trimmed(); if (msg.isEmpty()) { QMessageBox::warning(this, "Commit changes - QGit", diff --git a/src/console.ui b/src/console.ui index 7a4b10d..e9542d2 100644 --- a/src/console.ui +++ b/src/console.ui @@ -48,7 +48,6 @@ Sans Serif 9 - 75 false true false @@ -62,10 +61,10 @@ ... - Qt::PlainText + Qt::TextFormat::PlainText - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop true @@ -75,7 +74,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -277,7 +276,7 @@ - QDialogButtonBox::Close + QDialogButtonBox::StandardButton::Close @@ -330,4 +329,8 @@ + + pushButtonTerminate_clicked() + pushButtonOk_clicked() + diff --git a/src/consoleimpl.cpp b/src/consoleimpl.cpp index 7d1d7ea..c59f004 100644 --- a/src/consoleimpl.cpp +++ b/src/consoleimpl.cpp @@ -46,14 +46,19 @@ void ConsoleImpl::pushButtonTerminate_clicked() { void ConsoleImpl::closeEvent(QCloseEvent* ce) { - if (proc && proc->state() == QProcess::Running) - if (QMessageBox::question(this, "Action output window - QGit", - "Action is still running.\nAre you sure you want to close " - "the window and leave the action running in background?", - "&Yes", "&No", QString(), 1, 1) == 1) { + if (proc && proc->state() == QProcess::Running) { + QMessageBox q(QMessageBox::Question, + "Action output window - QGit", + "Action is still running.\nAre you sure you want to close " + "the window and leave the action running in background?", + QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, + this + ); + if (q.exec() == QMessageBox::StandardButton::No) { ce->ignore(); return; } + } if (QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); diff --git a/src/customaction.ui b/src/customaction.ui index 875029e..4befff8 100644 --- a/src/customaction.ui +++ b/src/customaction.ui @@ -6,7 +6,7 @@ 0 0 - 579 + 604 492 @@ -27,10 +27,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -78,7 +78,7 @@ - Qt::LeftToRight + Qt::LayoutDirection::LeftToRight Move &up @@ -118,14 +118,14 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -145,10 +145,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -200,7 +200,7 @@ variables <code>$CURRENT_BRANCH</code> and <code>$SHA</code - QDialogButtonBox::Ok + QDialogButtonBox::StandardButton::Ok @@ -356,4 +356,15 @@ variables <code>$CURRENT_BRANCH</code> and <code>$SHA</code + + pushButtonNew_clicked() + pushButtonRename_clicked() + pushButtonRemove_clicked() + checkBoxRefreshAfterAction_toggled(bool) + pushButtonMoveUp_clicked() + pushButtonMoveDown_clicked() + textEditAction_textChanged() + listWidgetNames_currentItemChanged(QListWidgetItem*,QListWidgetItem*) + pushButtonOk_clicked() + diff --git a/src/fileview.cpp b/src/fileview.cpp index 561419a..5a851ce 100644 --- a/src/fileview.cpp +++ b/src/fileview.cpp @@ -98,7 +98,7 @@ bool FileView::eventFilter(QObject* obj, QEvent* e) { if (e->type() == QEvent::ToolTip && obj == lw) { QHelpEvent* h = static_cast(e); int id = fileTab->textEditFile->itemAnnId(lw->itemAt(h->pos())); - QRegExp re; + QRegularExpression re; SCRef sha(fileTab->histListView->shaFromAnnId(id)); SCRef d(git->getDesc(sha, re, re, false, model())); lw->setToolTip(d); diff --git a/src/fileview.ui b/src/fileview.ui index c9de01d..e4b1881 100644 --- a/src/fileview.ui +++ b/src/fileview.ui @@ -230,10 +230,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Expanding + QSizePolicy::Policy::Expanding @@ -246,10 +246,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -321,11 +321,11 @@ - Qt::Vertical + Qt::Orientation::Vertical - Qt::CustomContextMenu + Qt::ContextMenuPolicy::CustomContextMenu true @@ -345,10 +345,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Sunken + QFrame::Shadow::Sunken @@ -386,32 +386,32 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame - Qt::ScrollBarAlwaysOff + Qt::ScrollBarPolicy::ScrollBarAlwaysOff - Qt::ScrollBarAlwaysOff + Qt::ScrollBarPolicy::ScrollBarAlwaysOff - QAbstractItemView::ScrollPerPixel + QAbstractItemView::ScrollMode::ScrollPerPixel - QAbstractItemView::ScrollPerPixel + QAbstractItemView::ScrollMode::ScrollPerPixel - QFrame::NoFrame + QFrame::Shape::NoFrame false - QTextEdit::NoWrap + QTextEdit::LineWrapMode::NoWrap true diff --git a/src/git.cpp b/src/git.cpp index 576ae7f..f125bb8 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include //#include //CT TODO remove #include #include @@ -426,8 +426,7 @@ const QString Git::getTagMsg(SCRef sha) { if (!rf.tagMsg.isEmpty()) return rf.tagMsg; - QRegExp pgp("-----BEGIN PGP SIGNATURE*END PGP SIGNATURE-----", - Qt::CaseSensitive, QRegExp::Wildcard); + QRegularExpression pgp("-----BEGIN PGP SIGNATURE.*END PGP SIGNATURE-----", QRegularExpression::DotMatchesEverythingOption); if (!rf.tagObj.isEmpty()) { QString ro; @@ -1007,7 +1006,7 @@ const QString Git::getNewCommitMsg() { return ""; } QString status = c->longLog(); - status.prepend('\n').replace(QRegExp("\\n([^#\\n]?)"), "\n#\\1"); // comment all the lines + status.prepend('\n').replace(QRegularExpression("\\n([^#\\n]?)"), "\n#\\1"); // comment all the lines if (isMergeHead) { QFile file(QDir(gitDir).absoluteFilePath("MERGE_MSG")); @@ -1024,19 +1023,20 @@ const QString Git::getNewCommitMsg() { } //CT TODO utility function; can go elsewhere -const QString Git::colorMatch(SCRef txt, QRegExp& regExp) { +const QString Git::colorMatch(SCRef txt, QRegularExpression& regExp) { QString text = qt4and5escaping(txt); - if (regExp.isEmpty()) + if (regExp.pattern().isEmpty()) return text; SCRef startCol(QString::fromLatin1("")); SCRef endCol(QString::fromLatin1("")); int pos = 0; - while ((pos = text.indexOf(regExp, pos)) != -1) { + QRegularExpressionMatch regExpMatch; + while ((pos = text.indexOf(regExp, pos, ®ExpMatch)) != -1) { - SCRef match(regExp.cap(0)); + SCRef match(regExpMatch.captured(0)); const QString coloredText(startCol + match + endCol); text.replace(pos, match.length(), coloredText); pos += coloredText.length(); @@ -1057,7 +1057,7 @@ const QString Git::formatList(SCList sl, SCRef name, bool inOneLine) { return ls; } -const QString Git::getDesc(SCRef sha, QRegExp& shortLogRE, QRegExp& longLogRE, +const QString Git::getDesc(SCRef sha, QRegularExpression& shortLogRE, QRegularExpression& longLogRE, bool showHeader, FileHistory* fh) { if (sha.isEmpty()) @@ -1122,12 +1122,12 @@ const QString Git::getDesc(SCRef sha, QRegExp& shortLogRE, QRegExp& longLogRE, // sha if there isn't a leading trailing space or an open parenthesis and, // in that case, before the space must not be a ':' character. // It's an ugly heuristic, but seems to work in most cases. - QRegExp reSHA("..[0-9a-f]{21,40}|[^:][\\s(][0-9a-f]{6,20}", Qt::CaseInsensitive); - reSHA.setMinimal(false); + QRegularExpression reSHA("..[0-9a-f]{21,40}|[^:][\\s(][0-9a-f]{6,20}", QRegularExpression::CaseInsensitiveOption); int pos = 0; - while ((pos = text.indexOf(reSHA, pos)) != -1) { + QRegularExpressionMatch match; + while ((pos = text.indexOf(reSHA, pos, &match)) != -1) { - SCRef ref = reSHA.cap(0).mid(2); + SCRef ref = match.captured(0).mid(2); const Rev* r = (ref.length() == 40 ? revLookup(ref) : revLookup(getRefSha(ref))); if (r && r->sha() != ZERO_SHA_RAW) { QString slog(r->shortLog()); @@ -1140,7 +1140,7 @@ const QString Git::getDesc(SCRef sha, QRegExp& shortLogRE, QRegExp& longLogRE, text.replace(pos + 2, ref.length(), link); pos += link.length(); } else - pos += reSHA.cap(0).length(); + pos += match.captured(0).length(); } return text; } @@ -1299,7 +1299,11 @@ const QString Git::getNewestFileName(SCList branches, SCRef fileName) { void Git::getFileFilter(SCRef path, ShaSet& shaSet) const { shaSet.clear(); - QRegExp rx(path, Qt::CaseInsensitive, QRegExp::Wildcard); +#if QT_VERSION >= 0x060000 + QRegularExpression rx = QRegularExpression::fromWildcard(path, Qt::CaseInsensitive); +#else + QRegExp rx(path, Qt::CaseInsensitive, QRegExp::Wildcard); +#endif FOREACH (ShaVect, it, revData->revOrder) { if (!revsFiles.contains(*it)) @@ -1669,7 +1673,7 @@ const QString Git::getLocalDate(SCRef gitDate) { // cache miss if (localDate.isEmpty()) { static QDateTime d; - d.setTime_t(gitDate.toUInt()); + d.setSecsSinceEpoch(gitDate.toUInt()); localDate = QLocale::system().toString(d, QLocale::ShortFormat); // save to cache @@ -1977,7 +1981,7 @@ const Rev* Git::fakeWorkDirRev(SCRef parent, SCRef log, SCRef longLog, int idx, if (!isMainHistory(fh)) patch = getWorkDirDiff(fh->fileNames().first()); - QString date(QString::number(QDateTime::currentDateTime().toTime_t())); + QString date(QString::number(QDateTime::currentDateTime().toSecsSinceEpoch())); QString author("-"); QStringList parents(parent); Rev* c = fakeRevData(ZERO_SHA, parents, author, date, log, longLog, patch, idx, fh); @@ -2442,7 +2446,7 @@ void Git::on_loaded(FileHistory* fh, ulong byteSize, int loadTime, ulong kb = byteSize / 1024; double mbs = (double)byteSize / fh->loadTime / 1000; QString tmp; - tmp.QT_ASPRINTF("Loaded %i revisions (%li KB), " + tmp.QT_ASPRINTF("Loaded %lli revisions (%li KB), " "time elapsed: %i ms (%.2f MB/s)", fh->revs.count(), kb, fh->loadTime, mbs); diff --git a/src/git.h b/src/git.h index a0e20c8..2cbb876 100644 --- a/src/git.h +++ b/src/git.h @@ -10,8 +10,7 @@ #include "exceptionmanager.h" #include "common.h" -template struct QPair; -class QRegExp; +class QRegularExpression; class QTextCodec; class Annotate; //class DataLoader; @@ -98,7 +97,7 @@ Q_OBJECT bool getTree(SCRef ts, TreeInfo& ti, bool wd, SCRef treePath); static const QString getLocalDate(SCRef gitDate); const QString getCurrentBranchName() const {return curBranchName;} - const QString getDesc(SCRef sha, QRegExp& slogRE, QRegExp& lLogRE, bool showH, FileHistory* fh); + const QString getDesc(SCRef sha, QRegularExpression& slogRE, QRegularExpression& lLogRE, bool showH, FileHistory* fh); const QString getLastCommitMsg(); const QString getNewCommitMsg(); const QString getLaneParent(SCRef fromSHA, int laneNum); @@ -247,7 +246,7 @@ private slots: const QStringList getOthersFiles(); const QStringList getOtherFiles(SCList selFiles, bool onlyInIndex); const QString getNewestFileName(SCList args, SCRef fileName); - static const QString colorMatch(SCRef txt, QRegExp& regExp); + static const QString colorMatch(SCRef txt, QRegularExpression& regExp); void appendFileName(RevFile& rf, SCRef name, FileNamesLoader& fl); void flushFileNames(FileNamesLoader& fl); void populateFileNamesMap(); diff --git a/src/help.ui b/src/help.ui index 754b002..c5ab7d4 100644 --- a/src/help.ui +++ b/src/help.ui @@ -21,7 +21,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -36,7 +36,7 @@ - QDialogButtonBox::Close + QDialogButtonBox::StandardButton::Close diff --git a/src/inputdialog.cpp b/src/inputdialog.cpp index 5244e46..9b6e449 100644 --- a/src/inputdialog.cpp +++ b/src/inputdialog.cpp @@ -47,7 +47,7 @@ class RefNameValidator : public QValidator { void fixup(QString& input) const; State validate(QString & input, int & pos) const; private: - const QRegExp invalid; + const QRegularExpression invalid; bool allowEmpty; }; @@ -89,14 +89,15 @@ InputDialog::InputDialog(const QString &cmd, const VariableMap &variables, this->setWindowTitle(title); QGridLayout *layout = new QGridLayout(this); - QRegExp re("%(([a-z_]+)([[]([a-z ,]+)[]])?:)?([^%=]+)(=[^%]+)?%"); + QRegularExpression re("%(([a-z_]+)([[]([a-z ,]+)[]])?:)?([^%=]+)(=[^%]+)?%"); int start = 0; int row = 0; - while ((start = re.indexIn(cmd, start)) != -1) { - const QString type = re.cap(2); - const QStringList opts = re.cap(4).split(',', QGIT_SPLITBEHAVIOR(SkipEmptyParts)); - const QString name = re.cap(5); - const QString value = re.cap(6).mid(1); + QRegularExpressionMatch match; + while ((start = cmd.indexOf(re, start, &match)) != -1) { + const QString type = match.captured(2); + const QStringList opts = match.captured(4).split(',', QGIT_SPLITBEHAVIOR(SkipEmptyParts)); + const QString name = match.captured(5); + const QString value = match.captured(6).mid(1); if (widgets.count(name)) { // widget already created if (!type.isEmpty()) dbs("token must not be redefined: " + name); continue; @@ -104,7 +105,7 @@ InputDialog::InputDialog(const QString &cmd, const VariableMap &variables, WidgetItemPtr item (new WidgetItem()); item->start = start; - item->end = start = start + re.matchedLength(); + item->end = start = start + match.capturedLength(); if (type == "combobox") { QComboBox *w = new QComboBox(this); @@ -205,8 +206,14 @@ QString InputDialog::replace(const VariableMap &variables) const } for (VariableMap::const_iterator it=variables.begin(), end=variables.end(); it != end; ++it) { QString token = "$" + it.key(); - QString val = it.value().type() == QVariant::StringList ? it.value().toStringList().join(" ") - : it.value().toString(); + QString val = +#if QT_VERSION >= 0x060000 + it.value().metaType().id() == QMetaType::QStringList ? +#else + it.value().type() == QVariant::StringList ? +#endif + it.value().toStringList().join(" ") + : it.value().toString(); result.replace(token, val); } return result; diff --git a/src/lanes.h b/src/lanes.h index 85e1f66..af3e6d4 100644 --- a/src/lanes.h +++ b/src/lanes.h @@ -10,8 +10,6 @@ #include #include -class QStringList; - // // At any given time, the Lanes class represents a single revision (row) of the history graph. diff --git a/src/listview.cpp b/src/listview.cpp index 576c836..3223d61 100644 --- a/src/listview.cpp +++ b/src/listview.cpp @@ -336,7 +336,11 @@ void ListView::mouseReleaseEvent(QMouseEvent* e) { QPixmap ListView::pixmapFromSelection(const QStringList &revs, const QString &ref) const { +#if QT_VERSION >= 0x060000 + const qsizetype maxRows = 10; +#else const int maxRows = 10; +#endif const int dotdotRow = 5; QStyleOptionViewItem opt; opt.initFrom(this); // ListViewDelegate *lvd = dynamic_cast(itemDelegate()); @@ -530,9 +534,21 @@ void ListView::dragEnterEvent(QDragEnterEvent* e) { void ListView::dragMoveEvent(QDragMoveEvent* e) { // When getting here, dragEnterEvent already accepted the drag in general - SCRef targetRef = refNameAt(e->pos()); + SCRef targetRef = refNameAt(e-> +#if QT_VERSION >= 0x060000 + position().toPoint() +#else + pos() +#endif + ); uint targetRefType = refTypeFromName(targetRef); - QModelIndex idx = indexAt(e->pos()); + QModelIndex idx = indexAt(e-> +#if QT_VERSION >= 0x060000 + position().toPoint() +#else + pos() +#endif + ); SCRef targetSHA = sha(idx.row()); uint accepted_actions = DropInfo::PatchAction; // applying patches is always allowed DropInfo::Action action, default_action = DropInfo::PatchAction; @@ -577,7 +593,11 @@ void ListView::dragMoveEvent(QDragMoveEvent* e) { e->accept(); // check whether modifier keys enforce an action +#if QT_VERSION >= 0x060000 + switch (e->modifiers()) { +#else switch (e->keyboardModifiers()) { +#endif case Qt::ControlModifier: action = DropInfo::PatchAction; break; case Qt::ShiftModifier: action = DropInfo::RebaseAction; break; case Qt::AltModifier: action = DropInfo::MergeAction; break; @@ -632,9 +652,21 @@ void ListView::dropEvent(QDropEvent *e) { return; } - SCRef targetRef = refNameAt(e->pos()); + SCRef targetRef = refNameAt(e-> +#if QT_VERSION >= 0x060000 + position().toPoint() +#else + pos() +#endif + ); // uint targetRefType = refTypeFromName(targetRef); - SCRef targetSHA = sha(indexAt(e->pos()).row()); + SCRef targetSHA = sha(indexAt(e-> +#if QT_VERSION >= 0x060000 + position().toPoint() +#else + pos() +#endif + ).row()); switch(dropInfo->action) { case DropInfo::PatchAction: emit applyRevisions(dropInfo->shas, dropInfo->sourceRepo); @@ -1288,7 +1320,11 @@ bool ListViewProxy::filterAcceptsRow(int source_row, const QModelIndex&) const { int ListViewProxy::setFilter(bool isOn, bool h, SCRef fl, int cn, ShaSet* s) { +#if QT_VERSION >= 0x060000 + filter = QRegularExpression::fromWildcard(fl, Qt::CaseInsensitive); +#else filter = QRegExp(fl, Qt::CaseInsensitive, QRegExp::Wildcard); +#endif colNum = cn; if (s) shaSet = *s; diff --git a/src/listview.h b/src/listview.h index dc1e06b..2b8dd3f 100644 --- a/src/listview.h +++ b/src/listview.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include "common.h" class Git; @@ -139,7 +139,11 @@ Q_OBJECT Domain* d; Git* git; bool isHighLight; +#if QT_VERSION >= 0x060000 + QRegularExpression filter; +#else QRegExp filter; +#endif int colNum; ShaSet shaSet; }; diff --git a/src/mainimpl.cpp b/src/mainimpl.cpp index 6353c32..4b1e988 100644 --- a/src/mainimpl.cpp +++ b/src/mainimpl.cpp @@ -74,10 +74,8 @@ MainImpl::MainImpl(SCRef cd, QWidget* p) : QMainWindow(p) { setRepositoryBusy = false; // init filter match highlighters - shortLogRE.setMinimal(true); - shortLogRE.setCaseSensitivity(Qt::CaseInsensitive); - longLogRE.setMinimal(true); - longLogRE.setCaseSensitivity(Qt::CaseInsensitive); + shortLogRE.setPatternOptions(QRegularExpression::CaseInsensitiveOption); + longLogRE.setPatternOptions(QRegularExpression::CaseInsensitiveOption); // set-up standard revisions and files list font QSettings settings; @@ -293,10 +291,10 @@ void MainImpl::ActExternalDiff_activated() { } } -const QRegExp MainImpl::emptySha("0*"); +const QRegularExpression MainImpl::emptySha("0*"); QString MainImpl::copyFileToDiffIfNeeded(QStringList* filenames, QString sha) { - if (emptySha.exactMatch(sha)) + if (emptySha.match(sha).hasMatch()) { return QString(curDir + "/" + rv->st.fileName()); } @@ -784,7 +782,7 @@ void MainImpl::applyRevisions(SCList remoteRevs, SCRef remoteRepo) { dr.refresh(); if (dr.count() != 1) { - qDebug("ASSERT in on_droppedRevisions: found %i files " + qDebug("ASSERT in on_droppedRevisions: found %lli files " "in %s", dr.count(), qPrintable(dr.absolutePath())); break; } @@ -1649,16 +1647,30 @@ bool MainImpl::askApplyPatchParameters(bool* workDirOnly, bool* fold) { int ret = 0; if (!git->isStGITStack()) { - ret = QMessageBox::question(this, "Apply Patch", - "Do you want to commit or just to apply changes to " - "working directory?", "&Cancel", "&Working directory", "&Commit", 0, 0); - *workDirOnly = (ret == 1); + QMessageBox ret(QMessageBox::Question, + "Apply Patch", + "Do you want to commit or just to apply changes to " + "working directory?", + {}, this); + ret.addButton("&Cancel", QMessageBox::ButtonRole::RejectRole); + QAbstractButton* wdbtn = ret.addButton( + "&Working directory", QMessageBox::ButtonRole::AcceptRole); + ret.addButton("Commm&it", QMessageBox::ButtonRole::AcceptRole); + ret.exec(); + *workDirOnly = (ret.clickedButton() == wdbtn); *fold = false; } else { - ret = QMessageBox::question(this, "Apply Patch", "Do you want to " - "import or fold the patch?", "&Cancel", "&Fold", "&Import", 0, 0); + QMessageBox ret(QMessageBox::Question, + "Apply Patch", + "Do you want to import or fold the patch?", + {}, this); + ret.addButton("&Cancel", QMessageBox::ButtonRole::RejectRole); + QAbstractButton* fbtn = ret.addButton( + "&Fold", QMessageBox::ButtonRole::AcceptRole); + ret.addButton("&Import", QMessageBox::ButtonRole::AcceptRole); + ret.exec(); *workDirOnly = false; - *fold = (ret == 1); + *fold = (ret.clickedButton() == fbtn); } return (ret != 0); } @@ -2139,13 +2151,19 @@ void MainImpl::ActFindNext_activated() { return; if (endOfDocument) { - QMessageBox::warning(this, "Find text - QGit", "Text \"" + - textToFind + "\" not found!", QMessageBox::Ok, 0); + QMessageBox(QMessageBox::Warning, + "Find text - QGit", + "Text \"" + textToFind + "\" not found!", + QMessageBox::StandardButton::Ok, + this); return; } - if (QMessageBox::question(this, "Find text - QGit", "End of document " - "reached\n\nDo you want to continue from beginning?", QMessageBox::Yes, - QMessageBox::No | QMessageBox::Escape) == QMessageBox::No) + QMessageBox q(QMessageBox::Question, + "Find text - QGit", + "End of document reached\n\nDo you want to continue from beginning?", + QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, + this); + if (q.exec() == QMessageBox::No) return; endOfDocument = true; @@ -2248,7 +2266,7 @@ void MainImpl::ActAbout_activated() { "2016-2018 Robert Haschke, " "2018-2024 Filipe Rinaldi, " "2018 Mateusz Balbus, " - "2019-2022 Sebastian Pipping, " + "2019-2025 Sebastian Pipping, " "2019-2020 Matthias von Faber, " "2019 Kevin Kofler, " "2020 Matthieu Muffato, " diff --git a/src/mainimpl.h b/src/mainimpl.h index 3089a95..77a44aa 100644 --- a/src/mainimpl.h +++ b/src/mainimpl.h @@ -8,7 +8,7 @@ #define MAINIMPL_H #include -#include +#include #include #include "exceptionmanager.h" #include "common.h" @@ -185,9 +185,9 @@ protected slots: QString startUpDir; QString startUpFile; QString textToFind; - QRegExp shortLogRE; - QRegExp longLogRE; - static const QRegExp emptySha; + QRegularExpression shortLogRE; + QRegularExpression longLogRE; + static const QRegularExpression emptySha; QMap revision_variables; // variables used in generic input dialogs bool setRepositoryBusy; diff --git a/src/mainview.ui b/src/mainview.ui index d3fdff2..ccedb75 100644 --- a/src/mainview.ui +++ b/src/mainview.ui @@ -40,14 +40,14 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - Qt::CustomContextMenu + Qt::ContextMenuPolicy::CustomContextMenu - QAbstractItemView::ExtendedSelection + QAbstractItemView::SelectionMode::ExtendedSelection false @@ -80,7 +80,7 @@ Toolbar - Qt::Horizontal + Qt::Orientation::Horizontal @@ -113,7 +113,7 @@ 0 0 905 - 20 + 34 @@ -286,7 +286,7 @@ Settings - QAction::PreferencesRole + QAction::MenuRole::PreferencesRole @@ -450,7 +450,7 @@ false - View file + Vie&w file View file @@ -497,7 +497,7 @@ :/icons/resources/autocorrection.svg:/icons/resources/autocorrection.svg - Toggle filter by tree + To&ggle filter by tree Filter by tree @@ -518,7 +518,7 @@ :/icons/resources/view-list-tree.svg:/icons/resources/view-list-tree.svg - Toggle tree view + &Toggle tree view Archive tree @@ -611,7 +611,7 @@ false - View revision + &View revision View revision @@ -629,7 +629,7 @@ :/icons/resources/view-split-top-bottom.svg:/icons/resources/view-split-top-bottom.svg - Toggle split view + T&oggle split view Toggle split view @@ -717,7 +717,7 @@ Setup actions... - QAction::NoRole + QAction::MenuRole::NoRole @@ -728,7 +728,7 @@ - View file in new tab + View file &in new tab View file in new tab @@ -745,7 +745,7 @@ - View patch in new tab + View patch in &new tab View patch in new tab @@ -812,7 +812,7 @@ - Toggle message/diff + Toggle message/&diff Toggle message/diff @@ -830,7 +830,7 @@ :/icons/resources/join.svg:/icons/resources/join.svg - Select range... + &Select range... Show 'Select range' dialog @@ -866,7 +866,7 @@ - &Checkout... + Ch&eckout... Checkout @@ -1564,4 +1564,48 @@ + + ActAbout_activated() + ActCheckWorkDir_toggled(bool) + ActCheckout_activated() + ActClose_activated() + ActCommit_activated() + ActExit_activated() + ActExternalDiff_activated() + ActExternalEditor_activated() + ActFilterTree_toggled(bool) + ActHelp_activated() + ActMailApplyPatch_activated() + ActMailFormatPatch_activated() + ActOpenRepo_activated() + ActOpenRepoNewWindow_activated() + ActPop_activated() + ActPush_activated() + ActRefresh_activated() + ActSaveFile_activated() + ActSettings_activated() + ActShowTree_toggled(bool) + ActBranch_activated() + ActTag_activated() + ActDelete_activated() + ActViewFile_activated() + ActViewDiff_activated() + ActViewRev_activated() + ActSplitView_activated() + ActFind_activated() + ActFindNext_activated() + ActBack_activated() + ActForward_activated() + ActCustomActionSetup_activated() + ActViewFileNewTab_activated() + ActViewDiffNewTab_activated() + tabWdg_currentChanged(int) + ActSearchAndFilter_toggled(bool) + ActSearchAndHighlight_toggled(bool) + ActShowDescHeader_activated() + ActToggleLogsDiff_activated() + ActRangeDlg_activated() + ActAmend_activated() + ActMarkDiffToSha_activated() + diff --git a/src/patchcontent.cpp b/src/patchcontent.cpp index 831d950..3fab645 100644 --- a/src/patchcontent.cpp +++ b/src/patchcontent.cpp @@ -96,8 +96,7 @@ PatchContent::PatchContent(QWidget* parent) : QTextEdit(parent) { diffLoaded = seekTarget = false; curFilter = prevFilter = VIEW_ALL; - pickAxeRE.setMinimal(true); - pickAxeRE.setCaseSensitivity(Qt::CaseInsensitive); + pickAxeRE.setPatternOptions(QRegularExpression::CaseInsensitiveOption); setFont(QGit::TYPE_WRITER_FONT); diffHighlighter = new DiffHighlighter(this); @@ -316,25 +315,18 @@ void PatchContent::procFinished() { } } -int PatchContent::doSearch(SCRef txt, int pos) { - - if (isRegExp) - return txt.indexOf(pickAxeRE, pos); - - return txt.indexOf(pickAxeRE.pattern(), pos, Qt::CaseInsensitive); -} - bool PatchContent::computeMatches() { matches.clear(); - if (pickAxeRE.isEmpty()) + if (pickAxeRE.pattern().isEmpty()) return false; SCRef txt = toPlainText(); int pos, lastPos = 0, lastPara = 0; // must be at the end to catch patterns across more the one chunk - while ((pos = doSearch(txt, lastPos)) != -1) { + QRegularExpressionMatch match; + while ((pos = txt.indexOf(pickAxeRE, pos, &match)) != -1) { matches.append(MatchSelection()); MatchSelection& s = matches.last(); @@ -344,7 +336,7 @@ bool PatchContent::computeMatches() { s.indexFrom = pos - txt.lastIndexOf('\n', pos) - 1; // index starts from 0 lastPos = pos; - pos += (isRegExp ? pickAxeRE.matchedLength() : pickAxeRE.pattern().length()); + pos += match.capturedLength(); pos--; s.paraTo = s.paraFrom + txt.mid(lastPos, pos - lastPos).count('\n'); @@ -370,9 +362,7 @@ bool PatchContent::getMatch(int para, int* indexFrom, int* indexTo) { } void PatchContent::on_highlightPatch(const QString& exp, bool re) { - - pickAxeRE.setPattern(exp); - isRegExp = re; + pickAxeRE.setPattern(re ? exp : QRegularExpression::escape(exp)); if (diffLoaded) procFinished(); } diff --git a/src/patchcontent.h b/src/patchcontent.h index f9f1912..df9ff7d 100644 --- a/src/patchcontent.h +++ b/src/patchcontent.h @@ -8,6 +8,7 @@ #define PATCHCONTENT_H #include +#include #include #include #include "common.h" @@ -57,7 +58,6 @@ public slots: int positionToLineNum(int pos); int topToLineNum(); void saveRestoreSizes(bool startup = false); - int doSearch(const QString& txt, int pos); bool computeMatches(); bool getMatch(int para, int* indexFrom, int* indexTo); void centerMatch(int id = 0); @@ -70,8 +70,7 @@ public slots: bool diffLoaded; QByteArray patchRowData; QString halfLine; - bool isRegExp; - QRegExp pickAxeRE; + QRegularExpression pickAxeRE; QString target; bool seekTarget; diff --git a/src/patchview.ui b/src/patchview.ui index b4d3081..cc8d444 100644 --- a/src/patchview.ui +++ b/src/patchview.ui @@ -1,7 +1,8 @@ - + + TabPatch - - + + 0 0 @@ -9,126 +10,126 @@ 449 - + Patch - - + + 0 - + 0 - + 0 - + 0 - + 0 - - + + 0 - + 0 - + 0 - + 0 - + 0 - - + + 6 - + 2 - + 2 - + 2 - + 2 - - + + Diff to: - + false - - - Qt::StrongFocus + + + Qt::FocusPolicy::StrongFocus - + Check to diff against parent - - P&arent + + Paren&t - + Alt+A - + true - - - Qt::ClickFocus + + + Qt::FocusPolicy::ClickFocus - + Check to diff against HEAD - + H&EAD - + Alt+E - - - Qt::ClickFocus + + + Qt::FocusPolicy::ClickFocus - + Use CTRL + right click to select a revision to diff against - + &SHA - + Alt+S - - Qt::Horizontal + + Qt::Orientation::Horizontal - + 20 0 @@ -137,24 +138,24 @@ - - - + + + 1 0 - + SHA value of selected revision. Use CTRL + right click to select. - - + + Toggle view of added and removed lines (CTRL+H) - + Ctrl+H @@ -162,55 +163,55 @@ - - - + + + 0 0 - - Qt::Horizontal + + Qt::Orientation::Horizontal - - - + + + 5 0 - - Qt::Vertical + + Qt::Orientation::Vertical - - - QTextEdit::NoWrap + + + QTextEdit::LineWrapMode::NoWrap - - + + false - - QTextEdit::NoWrap + + QTextEdit::LineWrapMode::NoWrap - + true - - Qt::TextSelectableByMouse + + Qt::TextInteractionFlag::TextSelectableByMouse - - - + + + 1 0 - - Qt::CustomContextMenu + + Qt::ContextMenuPolicy::CustomContextMenu @@ -219,7 +220,7 @@ - + FileList @@ -238,10 +239,10 @@ - revdesc.h + revdesc.h - + diff --git a/src/qgit.cpp b/src/qgit.cpp index 1fa3d02..8960cb8 100644 --- a/src/qgit.cpp +++ b/src/qgit.cpp @@ -29,10 +29,10 @@ using namespace QGit; int main(int argc, char* argv[]) { QApplication app(argc, argv); -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); +#if QT_VERSION_CHECK(5, 6, 0) <= QT_VERSION && QT_VERSION < QT_VERSION_CHECK(6,0,0) + app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); #endif - QCoreApplication::setOrganizationName(ORG_KEY); + QCoreApplication::setOrganizationName(ORG_KEY); QCoreApplication::setApplicationName(APP_KEY); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) diff --git a/src/rangeselect.ui b/src/rangeselect.ui index 1905f9d..e9b798a 100644 --- a/src/rangeselect.ui +++ b/src/rangeselect.ui @@ -1,137 +1,136 @@ - + + RangeSelectBase - - + + 0 0 - 415 - 235 + 441 + 267 - + Range select - - :/icons/resources/join.svg + + + :/icons/resources/join.svg:/icons/resources/join.svg - + true - - + + 0 - + 4 - + 4 - + 4 - + 4 - - + + 6 - + 0 - + 0 - + 0 - + 0 - - + + 0 - + 0 - + 0 - + 0 - + 2 - - 2 - - - - - + + + + 0 0 - + Select a tag or paste/write a rev - + true - - QComboBox::NoInsert + + QComboBox::InsertPolicy::NoInsert - - - - Top: + + + + &Top: - + false - + comboBoxTo - - - + + + &Bottom: - + false - + comboBoxFrom - - - - + + + + 0 0 - + Select a tag or paste/write a rev - + true - - QComboBox::NoInsert + + QComboBox::InsertPolicy::NoInsert @@ -139,13 +138,13 @@ - - Qt::Vertical + + Qt::Orientation::Vertical - - QSizePolicy::Expanding + + QSizePolicy::Policy::Expanding - + 395 16 @@ -154,81 +153,81 @@ - - - QFrame::StyledPanel + + + QFrame::Shape::StyledPanel - - QFrame::Raised + + QFrame::Shadow::Raised - - + + 6 - + 9 - + 9 - + 9 - + 9 - - + + 6 - + 0 - + 0 - + 0 - + 0 - - + + Check to see git status. Necessary for committing. - + &Working dir - + Alt+W - - + + Check to enable '--all' option - + All branch&es - + Alt+E - - + + Check to view all the revisions - + Whole histor&y - + Alt+Y @@ -240,13 +239,13 @@ - - Qt::Vertical + + Qt::Orientation::Vertical - - QSizePolicy::Expanding + + QSizePolicy::Policy::Expanding - + 395 16 @@ -255,50 +254,50 @@ - - + + 6 - + 0 - + 0 - + 0 - + 0 - - - + + + 0 0 - - &Additional options: + + Additiona&l options: - + false - + lineEditOptions - - - + + + 0 0 - + Extra options to feed 'git log' @@ -306,50 +305,50 @@ - - + + 6 - + 0 - + 0 - + 0 - + 0 - - - + + + 0 0 - + You can always re-enable the dialog from settings. - + S&how this dialog when opening a repository - + Alt+H - - Qt::Horizontal + + Qt::Orientation::Horizontal - - QSizePolicy::Expanding + + QSizePolicy::Policy::Expanding - + 80 20 @@ -358,20 +357,20 @@ - - - + + + 0 0 - + O&k - + Alt+K - + true @@ -382,9 +381,9 @@ - + - + @@ -393,11 +392,11 @@ RangeSelectBase pushButtonOk_clicked() - + 20 20 - + 20 20 @@ -409,11 +408,11 @@ RangeSelectBase checkBoxShowDialog_toggled(bool) - + 20 20 - + 20 20 @@ -425,11 +424,11 @@ RangeSelectBase checkBoxDiffCache_toggled(bool) - + 78 98 - + 207 117 @@ -441,11 +440,11 @@ RangeSelectBase checkBoxShowAll_toggled(bool) - + 207 98 - + 207 117 @@ -457,15 +456,22 @@ RangeSelectBase checkBoxShowWholeHistory_toggled(bool) - + 336 98 - + 207 117 + + pushButtonOk_clicked() + checkBoxShowDialog_toggled(bool) + checkBoxDiffCache_toggled(bool) + checkBoxShowAll_toggled(bool) + checkBoxShowWholeHistory_toggled(bool) + diff --git a/src/rangeselectimpl.cpp b/src/rangeselectimpl.cpp index a55a338..a60fccd 100644 --- a/src/rangeselectimpl.cpp +++ b/src/rangeselectimpl.cpp @@ -7,7 +7,7 @@ */ #include -#include +#include #include "common.h" #include "git.h" #include "rangeselectimpl.h" @@ -84,7 +84,7 @@ void RangeSelectImpl::orderRefs(const QStringList& src, QStringList& dst) { // releases as example v.2.6.18-rc4 before v.2.6.18 // match a (dotted) number + something else + a number + EOL - QRegExp re("[\\d\\.]+([^\\d\\.]+\\d+$)"); + QRegularExpression re("[\\d\\.]+([^\\d\\.]+\\d+$)"); // in ASCII the space ' ' (32) comes before '!' (33) and both // before the rest, we need this to correctly order a sequence like @@ -95,15 +95,16 @@ void RangeSelectImpl::orderRefs(const QStringList& src, QStringList& dst) { const QString noRcMark("!$$%%"); // an impossible to find string starting with a '!' typedef QMap OrderedMap; - QRegExp verRE("([^\\d])(\\d{1,2})(?=[^\\d])"); + QRegularExpression verRE("([^\\d])(\\d{1,2})(?=[^\\d])"); OrderedMap map; FOREACH_SL (it, src) { QString tmpStr(*it); - if (re.indexIn(tmpStr) != -1) - tmpStr.insert(re.pos(1), rcMark); + QRegularExpressionMatch match; + if (tmpStr.indexOf(re, 0, &match) != -1) + tmpStr.insert(match.capturedStart(1), rcMark); else tmpStr += noRcMark; diff --git a/src/revdesc.cpp b/src/revdesc.cpp index e1dcd15..185d2dd 100644 --- a/src/revdesc.cpp +++ b/src/revdesc.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include "domain.h" #include "revdesc.h" @@ -22,8 +22,8 @@ RevDesc::RevDesc(QWidget* p) : QTextBrowser(p), d(NULL) { void RevDesc::on_anchorClicked(const QUrl& link) { - QRegExp re("[0-9a-f]{40}", Qt::CaseInsensitive); - if (re.exactMatch(link.toString())) { + QRegularExpression re("[0-9a-f]{40}", QRegularExpression::CaseInsensitiveOption); + if (re.match(link.toString()).hasMatch()) { setSource(QUrl()); // override default navigation behavior d->st.setSha(link.toString()); diff --git a/src/revsview.ui b/src/revsview.ui index 14d10aa..65b0e8f 100644 --- a/src/revsview.ui +++ b/src/revsview.ui @@ -1,7 +1,8 @@ - + + TabRev - - + + 0 0 @@ -9,129 +10,105 @@ 523 - + Rev list - - + + 0 - + 0 - - - Qt::Vertical + + + Qt::Orientation::Vertical - - - Qt::CustomContextMenu + + + Qt::ContextMenuPolicy::CustomContextMenu - + true - + true - + false - + true - + false - + true - - - Qt::Horizontal + + + Qt::Orientation::Horizontal - - + + 0 - - - - 0 - 0 - 346 - 249 - + + + QTabWidget::TabPosition::East - - QTabWidget::East + + QTabWidget::TabShape::Triangular - - QTabWidget::Triangular - - + 0 - - - - 0 - 0 - 317 - 243 - - - + + Log - - + + 0 - + 0 - - - QTextEdit::WidgetWidth + + + QTextEdit::LineWrapMode::WidgetWidth - - - - 0 - 0 - 317 - 243 - - - + + Diff - - + + 0 - + 0 - - - test + + + test - + false - - QTextEdit::NoWrap + + QTextEdit::LineWrapMode::NoWrap - + true @@ -140,9 +117,9 @@ - - - Qt::CustomContextMenu + + + Qt::ContextMenuPolicy::CustomContextMenu @@ -150,7 +127,7 @@ - + ListView @@ -174,7 +151,7 @@ - revdesc.h + revdesc.h diff --git a/src/settings.ui b/src/settings.ui index ce09c76..06864a5 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -7,7 +7,7 @@ 0 0 513 - 377 + 504 @@ -75,10 +75,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -217,7 +217,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -383,7 +383,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -485,10 +485,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -584,7 +584,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -608,10 +608,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -680,7 +680,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -784,10 +784,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -824,7 +824,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -938,10 +938,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -1017,7 +1017,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -1093,7 +1093,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -1126,7 +1126,7 @@ Ms&g template - Qt::PlainText + Qt::TextFormat::PlainText false @@ -1181,7 +1181,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1240,7 +1240,7 @@ - QDialogButtonBox::Ok + QDialogButtonBox::StandardButton::Ok @@ -1752,6 +1752,48 @@ toggled(bool) settingsBase checkBoxShowShortRef_toggled(bool) + + + 20 + 20 + + + 20 + 20 + + + + checkBoxNumbers_toggled(bool) + lineEditFormatPatchExtraOptions_textChanged(QString) + checkBoxDiffCache_toggled(bool) + lineEditExcludePerDir_textChanged(QString) + lineEditExcludeFile_textChanged(QString) + checkBoxSign_toggled(bool) + lineEditTemplate_textChanged(QString) + lineEditCommitExtraOptions_textChanged(QString) + checkBoxRelativeDate_toggled(bool) + checkBoxRangeSelectDialog_toggled(bool) + checkBoxReopenLastRepo_toggled(bool) + comboBoxDoubleClickAction_activated(int) + comboBoxCodecs_activated(int) + checkBoxCommitVerify_toggled(bool) + checkBoxCommitSign_toggled(bool) + checkBoxCommitUseDefMsg_toggled(bool) + lineEditExternalDiffViewer_textChanged(QString) + lineEditExternalEditor_textChanged(QString) + pushButtonExtDiff_clicked() + pushButtonExtEditor_clicked() + pushButtonFont_clicked() + comboBoxUserSrc_activated(int) + checkBoxMsgOnNewSHA_toggled(bool) + checkBoxLogDiffTab_toggled(bool) + checkBoxSmartLabels_toggled(bool) + lineEditApplyPatchExtraOptions_textChanged(QString) + comboBoxGitConfigSource_activated(int) + treeWidgetGitConfig_itemChanged(QTreeWidgetItem*, int) + checkBoxEnableDragnDrop_toggled(bool) + checkBoxShowShortRef_toggled(bool) + diff --git a/src/settingsimpl.cpp b/src/settingsimpl.cpp index 3fd9621..6ed65d6 100644 --- a/src/settingsimpl.cpp +++ b/src/settingsimpl.cpp @@ -212,7 +212,7 @@ void SettingsImpl::setupCodecsCombo() { return; } const QString curCodec(tc != 0 ? tc->name() : "Latin1"); - QRegExp re("*" + curCodec + "*", Qt::CaseInsensitive, QRegExp::Wildcard); + QRegularExpression re("^.*" + QRegularExpression::escape(curCodec) + ".*$", QRegularExpression::CaseInsensitiveOption); int idx = codecs.indexOf(re); if (idx == -1) { dbp("ASSERT: codec <%1> not available, using local codec", curCodec);