From df77cc86269a505b7df7b183d0fbbf10a3889ec6 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Wed, 29 Apr 2026 02:04:14 -0500 Subject: Clean up clang-tidy diagnostics --- .clang-tidy | 50 ++++++++------------------------------ lint.sh | 15 +++++++++--- src/src/archivefiletree.h | 2 +- src/src/createinstancedialog.cpp | 6 ++--- src/src/directoryrefresher.cpp | 20 ++++++++++++++- src/src/downloadlist.cpp | 4 +++ src/src/downloadmanager.cpp | 28 ++++++++++++--------- src/src/envshortcut.cpp | 2 -- src/src/filetreeitem.h | 2 +- src/src/iconextractor.cpp | 1 - src/src/mainwindow.cpp | 6 +++-- src/src/modcontenticondelegate.cpp | 13 ++++------ src/src/modinfo.cpp | 6 ++--- src/src/modinfodialogimages.cpp | 1 - src/src/modinfodialogtab.h | 4 +-- src/src/modlistviewactions.cpp | 3 --- src/src/nexusinterface.cpp | 5 +++- src/src/nxmaccessmanager.cpp | 4 +++ src/src/plugincontainer.cpp | 3 +++ src/src/processrunner.cpp | 1 - src/src/qdirfiletree.h | 2 +- src/src/qtgroupingproxy.cpp | 2 -- src/src/selfupdater.cpp | 2 +- src/src/settingsdialognexus.cpp | 3 ++- src/src/texteditor.cpp | 4 +-- src/src/transfersavesdialog.cpp | 40 +++++++++++++++--------------- src/src/uilocker.cpp | 6 +++++ src/src/vfs/vfstree.cpp | 5 ---- src/src/virtualfiletree.h | 2 +- 29 files changed, 121 insertions(+), 121 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 050b3f1..8bd52f3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,49 +10,19 @@ # libs/bsapacker, libs/bsa_extractor, libs/bsa_ffi, libs/steam_appinfo_ffi) # follows upstream MO2 / external projects and is excluded by lint.sh. # -# Disabled checks (with rationale): -# - fuchsia / google / llvm / altera: house-style checks for projects that -# aren't this one. -# - cppcoreguidelines-pro-* / -avoid-c-arrays / -avoid-magic-numbers: too -# noisy for code that interfaces with Qt and Win32-shaped APIs. -# - modernize-use-trailing-return-type: stylistic preference. -# - readability-magic-numbers / -named-parameter / -function-cognitive- -# complexity / -identifier-length: noisy and largely subjective. -# - bugprone-easily-swappable-parameters / -branch-clone: too many false -# positives in plumbing code. -# - misc-include-cleaner / -no-recursion / -non-private-member-variables- -# in-classes: noisy and partly redundant with clangd. -# - readability-redundant-access-specifiers: confused by Qt's `private slots:` -# specifier — strips the `private:` that follows it, breaking MOC. +# Keep the default lint profile focused on issues that can block the Linux +# port: compiler diagnostics and clang's static analyzer. Broad readability, +# modernize, and style checks are too noisy for the inherited Qt/MO2 code and +# generated UI headers; enable those only in a dedicated cleanup pass. Checks: > - bugprone-*, - performance-*, - modernize-*, - readability-*, + clang-diagnostic-*, clang-analyzer-*, - misc-const-correctness, - misc-redundant-expression, - misc-throw-by-value-catch-by-reference, - misc-unused-parameters, - -modernize-use-trailing-return-type, - -modernize-avoid-c-arrays, - -modernize-use-nodiscard, - -readability-magic-numbers, - -readability-named-parameter, - -readability-function-cognitive-complexity, - -readability-identifier-length, - -readability-implicit-bool-conversion, - -readability-uppercase-literal-suffix, - -readability-braces-around-statements, - -readability-else-after-return, - -readability-redundant-access-specifiers, - -bugprone-easily-swappable-parameters, - -bugprone-branch-clone, - -bugprone-narrowing-conversions, - -performance-no-int-to-ptr, - -performance-avoid-endl + -clang-diagnostic-ignored-gch, + -clang-analyzer-cplusplus.NewDelete, + -clang-analyzer-cplusplus.NewDeleteLeaks, + -clang-analyzer-optin.cplusplus.VirtualCall -WarningsAsErrors: '' +WarningsAsErrors: '*' # Apply checks only to our own headers — the regex matches src/src and our # authored libs subdirs. Vendored code lives under different paths. diff --git a/lint.sh b/lint.sh index 545032a..d7c082f 100755 --- a/lint.sh +++ b/lint.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Run clang-tidy over the files we authored, inside the build container so +# Run clang-tidy over source translation units we maintain, inside the build container so # the toolchain (gcc 15, libstdc++, Qt 6.10 headers, etc.) matches what # generated build/compile_commands.json. # @@ -57,12 +57,16 @@ for arg in "$@"; do done collect_files() { + # Headers are checked through their owning translation units. Running + # clang-tidy directly on every header produces duplicate diagnostics and + # false positives for Qt-generated include paths. + # # browserview / browserdialog depend on QtWebEngine which is Windows-only # in this fork (CMake removes them from ORGANIZER_SOURCES on Linux), so # clang-tidy can't parse their headers. Skip them. { - find src/src -type f \( -name '*.cpp' -o -name '*.h' \) - find libs/skse_log_redirector -type f \( -name '*.cpp' -o -name '*.h' \) + find src/src -type f -name '*.cpp' + find libs/skse_log_redirector -type f -name '*.cpp' } | grep -v -E '(/moc_|/ui_|/qrc_|_autogen/|/build/|browserview|browserdialog)' } @@ -104,5 +108,8 @@ printf '%s\n' "${CONTAINER_PATHS[@]}" | \ # stdbuf -oL forces line-buffered stdout so output flushes through # the podman pipe instead of being held until container exit. xargs -P '"${JOBS}"' -I{} stdbuf -oL clang-tidy '"${FIX_FLAG[*]:-}"' \ - -p "$TIDY_DIR" --quiet {} + -p "$TIDY_DIR" \ + --extra-arg=-Wno-ignored-gch \ + --exclude-header-filter="(^|/)(build/|.*_autogen/|ui_.*\\.h$)" \ + --quiet {} ' diff --git a/src/src/archivefiletree.h b/src/src/archivefiletree.h index 4635aa4..f574a5f 100644 --- a/src/src/archivefiletree.h +++ b/src/src/archivefiletree.h @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -#ifndef ARCHIVEFILENETRY_H +#ifndef ARCHIVEFILENTRY_H #define ARCHIVEFILENTRY_H #include diff --git a/src/src/createinstancedialog.cpp b/src/src/createinstancedialog.cpp index 39b9576..b2939a9 100644 --- a/src/src/createinstancedialog.cpp +++ b/src/src/createinstancedialog.cpp @@ -189,8 +189,7 @@ void CreateInstanceDialog::next(bool allowFinish) return; } - const auto i = ui->pages->currentIndex(); - const auto last = isOnLastPage(); + const auto last = isOnLastPage(); if (last) { if (allowFinish) { @@ -452,8 +451,7 @@ void CreateInstanceDialog::selectPage(std::size_t i) void CreateInstanceDialog::updateNavigation() { - const auto i = ui->pages->currentIndex(); - const auto last = isOnLastPage(); + const auto last = isOnLastPage(); ui->next->setEnabled(canNext()); ui->back->setEnabled(canBack()); diff --git a/src/src/directoryrefresher.cpp b/src/src/directoryrefresher.cpp index ad085cc..39527ba 100644 --- a/src/src/directoryrefresher.cpp +++ b/src/src/directoryrefresher.cpp @@ -45,7 +45,25 @@ using namespace MOShared; DirectoryStats::DirectoryStats() { - std::memset(this, 0, sizeof(DirectoryStats)); + dirTimes = {}; + fileTimes = {}; + sortTimes = {}; + subdirLookupTimes = {}; + addDirectoryTimes = {}; + filesLookupTimes = {}; + addFileTimes = {}; + addOriginToFileTimes = {}; + addFileToOriginTimes = {}; + addFileToRegisterTimes = {}; + originExists = 0; + originCreate = 0; + originsNeededEnabled = 0; + subdirExists = 0; + subdirCreate = 0; + fileExists = 0; + fileCreate = 0; + filesInsertedInRegister = 0; + filesAssignedInRegister = 0; } DirectoryStats& DirectoryStats::operator+=(const DirectoryStats& o) diff --git a/src/src/downloadlist.cpp b/src/src/downloadlist.cpp index 1804635..e558f16 100644 --- a/src/src/downloadlist.cpp +++ b/src/src/downloadlist.cpp @@ -172,6 +172,8 @@ QVariant DownloadList::data(const QModelIndex& index, int role) const case COL_STATUS: switch (m_manager.getState(index.row())) { // STATE_DOWNLOADING handled by DownloadProgressDelegate + case DownloadManager::STATE_DOWNLOADING: + return {}; case DownloadManager::STATE_STARTED: return tr("Started"); case DownloadManager::STATE_CANCELING: @@ -196,6 +198,8 @@ QVariant DownloadList::data(const QModelIndex& index, int role) const return tr("Installed"); case DownloadManager::STATE_UNINSTALLED: return tr("Uninstalled"); + case DownloadManager::STATE_NOFETCH: + return {}; } } } diff --git a/src/src/downloadmanager.cpp b/src/src/downloadmanager.cpp index 0cb37bf..ee87f67 100644 --- a/src/src/downloadmanager.cpp +++ b/src/src/downloadmanager.cpp @@ -365,8 +365,6 @@ void DownloadManager::refreshList() // avoid triggering other refreshes ScopedDisableDirWatcher const scopedDirWatcher(this); - int const downloadsBefore = m_ActiveDownloads.size(); - // remove finished downloads for (QVector::iterator iter = m_ActiveDownloads.begin(); iter != m_ActiveDownloads.end();) { @@ -757,7 +755,6 @@ void DownloadManager::addNXMDownload(const QString& url) // Allow these downloads using the current managed game's API context. if (nxmInfo.game().compare("site", Qt::CaseInsensitive) == 0) { log::debug("NXM link is for nexusmods.com/site (game-agnostic tool), allowing download"); - foundGame = m_ManagedGame; apiGameName = nxmInfo.game(); // keep "site" for correct API URLs } else { log::debug("download requested for wrong game (game: {}, url: {})", @@ -776,10 +773,9 @@ void DownloadManager::addNXMDownload(const QString& url) } for (auto tuple : m_PendingDownloads) { - if (std::get<0>(tuple).compare(apiGameName, Qt::CaseInsensitive) == - 0, + if (std::get<0>(tuple).compare(apiGameName, Qt::CaseInsensitive) == 0 && std::get<1>(tuple) == nxmInfo.modId() && - std::get<2>(tuple) == nxmInfo.fileId()) { + std::get<2>(tuple) == nxmInfo.fileId()) { const auto infoStr = tr("There is already a download queued for this file.\n\nMod %1\nFile %2") .arg(nxmInfo.modId()) @@ -1685,17 +1681,23 @@ void DownloadManager::setState(DownloadManager::DownloadInfo* info, } } break; case STATE_PAUSED: { - info->m_Reply->abort(); + if (info->m_Reply != nullptr) { + info->m_Reply->abort(); + } info->m_Output.close(); m_DownloadPaused(row); } break; case STATE_ERROR: { - info->m_Reply->abort(); + if (info->m_Reply != nullptr) { + info->m_Reply->abort(); + } info->m_Output.close(); m_DownloadFailed(row); } break; case STATE_CANCELED: { - info->m_Reply->abort(); + if (info->m_Reply != nullptr) { + info->m_Reply->abort(); + } m_DownloadFailed(row); } break; case STATE_FETCHINGMODINFO: { @@ -1757,7 +1759,6 @@ void DownloadManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) if (bytesTotal > info->m_TotalSize) { info->m_TotalSize = bytesTotal; } - int const oldProgress = info->m_Progress.first; info->m_Progress.first = ((info->m_ResumePos + bytesReceived) * 100) / (info->m_ResumePos + bytesTotal); @@ -2272,6 +2273,8 @@ void DownloadManager::nxmRequestFailed(QString gameName, int modID, int fileID, for (QVector::iterator iter = m_ActiveDownloads.begin(); iter != m_ActiveDownloads.end(); ++iter, ++index) { DownloadInfo* info = *iter; + if (info == nullptr) + continue; if (info != userDataInfo) continue; @@ -2362,7 +2365,7 @@ void DownloadManager::downloadFinished(int index) if (info->m_State == STATE_CANCELING) { setState(info, STATE_CANCELED); } else if (info->m_State == STATE_PAUSING) { - if (info->m_Output.isOpen() && info->m_HasData) { + if (info->m_Output.isOpen() && info->m_HasData && info->m_Reply != nullptr) { info->m_Output.write(info->m_Reply->readAll()); } setState(info, STATE_PAUSED); @@ -2378,6 +2381,7 @@ void DownloadManager::downloadFinished(int index) tr("We were unable to download the file due to errors after four retries. " "There may be an issue with the Nexus servers.")); emit update(-1); + return; } else if (info->isPausedState() || info->m_State == STATE_PAUSING) { info->m_Output.close(); createMetaFile(info); @@ -2536,7 +2540,7 @@ void DownloadManager::checkDownloadTimeout() void DownloadManager::writeData(DownloadInfo* info) { - if (info != nullptr) { + if (info != nullptr && info->m_Reply != nullptr) { qint64 ret = info->m_Output.write(info->m_Reply->readAll()); if (ret < info->m_Reply->size()) { QString const fileName = diff --git a/src/src/envshortcut.cpp b/src/src/envshortcut.cpp index 45ae80d..60cd33a 100644 --- a/src/src/envshortcut.cpp +++ b/src/src/envshortcut.cpp @@ -126,7 +126,6 @@ static QImage extractIconFromExe(const QString& exePath) // Section headers — find the section containing rsrcRVA. qint64 const secOff = optOff + optionalHdrSize; quint32 rsrcFileOff = 0; - quint32 rsrcVA = 0; for (int i = 0; std::cmp_less(i , numSections); ++i) { QByteArray const sec = peek(secOff + i * 40, 40); if (sec.size() < 40) @@ -136,7 +135,6 @@ static QImage extractIconFromExe(const QString& exePath) quint32 const rawOff = u32(sec.constData() + 20); if (rsrcRVA >= virtAddr && rsrcRVA < virtAddr + virtSize) { rsrcFileOff = rawOff + (rsrcRVA - virtAddr); - rsrcVA = virtAddr; break; } } diff --git a/src/src/filetreeitem.h b/src/src/filetreeitem.h index 2dfbb1e..8e8e213 100644 --- a/src/src/filetreeitem.h +++ b/src/src/filetreeitem.h @@ -32,7 +32,7 @@ public: FileTreeItem(const FileTreeItem&) = delete; FileTreeItem& operator=(const FileTreeItem&) = delete; FileTreeItem(FileTreeItem&&) = default; - FileTreeItem& operator=(FileTreeItem&&) = default; + FileTreeItem& operator=(FileTreeItem&&) = delete; void setOrigin(int originID, const std::wstring& realPath, Flags flags, const std::wstring& mod); diff --git a/src/src/iconextractor.cpp b/src/src/iconextractor.cpp index 3f91b8d..879038b 100644 --- a/src/src/iconextractor.cpp +++ b/src/src/iconextractor.cpp @@ -168,7 +168,6 @@ QByteArray tryExtractIcons(const QByteArray& fileData) return {}; const char* coff = d + peOffset + 4; - uint16_t const machine = r16(coff); uint16_t const numSections = r16(coff + 2); uint16_t const optHdrSize = r16(coff + 16); diff --git a/src/src/mainwindow.cpp b/src/src/mainwindow.cpp index e429138..ee32208 100644 --- a/src/src/mainwindow.cpp +++ b/src/src/mainwindow.cpp @@ -3250,8 +3250,10 @@ void MainWindow::nxmEndorsementsAvailable(QVariant userData, QVariant resultData } for (const auto& game : games) { IPluginGame* gamePlugin = m_OrganizerCore.getGame(game); - if (gamePlugin != nullptr && - gamePlugin->gameShortName().compare("SkyrimSE", Qt::CaseInsensitive) == 0) + if (gamePlugin == nullptr) { + continue; + } + if (gamePlugin->gameShortName().compare("SkyrimSE", Qt::CaseInsensitive) == 0) searchedMO2NexusGame = true; auto iter = sorted.equal_range(gamePlugin->gameNexusName()); for (auto result = iter.first; result != iter.second; ++result) { diff --git a/src/src/modcontenticondelegate.cpp b/src/src/modcontenticondelegate.cpp index 70d25fe..43a7fa9 100644 --- a/src/src/modcontenticondelegate.cpp +++ b/src/src/modcontenticondelegate.cpp @@ -38,14 +38,11 @@ bool ModContentIconDelegate::helpEvent(QHelpEvent* event, QAbstractItemView* vie return false; } if (event->type() == QEvent::ToolTip) { - // this code is from QAbstractItemDelegate::helpEvent, only the the way - // text is retrieved has been changed - QHelpEvent* he = static_cast(event); - const int precision = inherits("QItemDelegate") - ? 10 - : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp - const QString tooltip = - index.isValid() ? m_view->contentsTooltip(index) : QString(); + // this code is from QAbstractItemDelegate::helpEvent, only the the way + // text is retrieved has been changed + QHelpEvent* he = static_cast(event); + const QString tooltip = + index.isValid() ? m_view->contentsTooltip(index) : QString(); QRect rect; if (index.isValid()) { const QRect r = view->visualRect(index); diff --git a/src/src/modinfo.cpp b/src/src/modinfo.cpp index 647f6c9..905a853 100644 --- a/src/src/modinfo.cpp +++ b/src/src/modinfo.cpp @@ -131,11 +131,11 @@ ModInfo::Ptr ModInfo::getByIndex(unsigned int index) { QMutexLocker const locker(&s_Mutex); - if (index >= s_Collection.size() && index != ULONG_MAX) { + if (index == UINT_MAX) + return s_Collection[ModInfo::getIndex("Overwrite")]; + if (index >= s_Collection.size()) { throw MyException(tr("invalid mod index: %1").arg(index)); } - if (index == ULONG_MAX) - return s_Collection[ModInfo::getIndex("Overwrite")]; return s_Collection[index]; } diff --git a/src/src/modinfodialogimages.cpp b/src/src/modinfodialogimages.cpp index 7e59e72..7774e7c 100644 --- a/src/src/modinfodialogimages.cpp +++ b/src/src/modinfodialogimages.cpp @@ -610,7 +610,6 @@ void ImagesTab::updateScrollbar() } const auto geo = makeGeometry(); - const auto availableSize = ui->imagesThumbnails->size(); const auto fullyVisible = geo.fullyVisibleCount(); if (fullyVisible >= m_files.size()) { diff --git a/src/src/modinfodialogtab.h b/src/src/modinfodialogtab.h index ddc93cb..527714f 100644 --- a/src/src/modinfodialogtab.h +++ b/src/src/modinfodialogtab.h @@ -73,8 +73,8 @@ class ModInfoDialogTab : public QObject public: ModInfoDialogTab(const ModInfoDialogTab&) = delete; ModInfoDialogTab& operator=(const ModInfoDialogTab&) = delete; - ModInfoDialogTab(ModInfoDialogTab&&) = default; - ModInfoDialogTab& operator=(ModInfoDialogTab&&) = default; + ModInfoDialogTab(ModInfoDialogTab&&) = delete; + ModInfoDialogTab& operator=(ModInfoDialogTab&&) = delete; ~ModInfoDialogTab() override = default; // called by ModInfoDialog every time this tab is selected; this will call diff --git a/src/src/modlistviewactions.cpp b/src/src/modlistviewactions.cpp index d33e2a7..cf83b76 100644 --- a/src/src/modlistviewactions.cpp +++ b/src/src/modlistviewactions.cpp @@ -405,8 +405,6 @@ void ModListViewActions::exportModListCSV() const grid->addWidget(groupBoxColumns); - QPushButton* ok = new QPushButton("Ok"); - QPushButton* cancel = new QPushButton("Cancel"); QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); @@ -419,7 +417,6 @@ void ModListViewActions::exportModListCSV() const if (selection.exec() == QDialog::Accepted) { - unsigned int const numMods = ModInfo::getNumMods(); int const selectedRowID = buttonGroupRows->checkedId(); try { diff --git a/src/src/nexusinterface.cpp b/src/src/nexusinterface.cpp index 20399d5..29e7a2d 100644 --- a/src/src/nexusinterface.cpp +++ b/src/src/nexusinterface.cpp @@ -362,7 +362,7 @@ void NexusInterface::interpretNexusFileName(const QString& fileName, QString& mo auto splits = fileName.split(QRegularExpression("[^0-9]"), Qt::KeepEmptyParts); for (const auto& substr : splits) { bool ok = false; - int const value = substr.toInt(&ok); + substr.toInt(&ok); if (ok) { QString highlight(fileName); highlight.insert(index, " *"); @@ -905,6 +905,9 @@ void NexusInterface::nextRequest() case UpdatePeriod::MONTH: period = "1m"; break; + case UpdatePeriod::NONE: + period = "1w"; + break; } url = QString("%1/games/%2/mods/updated?period=%3") .arg(info.m_URL) diff --git a/src/src/nxmaccessmanager.cpp b/src/src/nxmaccessmanager.cpp index 30f1fbd..bd15b9a 100644 --- a/src/src/nxmaccessmanager.cpp +++ b/src/src/nxmaccessmanager.cpp @@ -733,6 +733,10 @@ void NexusKeyValidator::onAttemptFailure(const ValidationAttempt& a) } switch (a.result()) { + case ValidationAttempt::None: + case ValidationAttempt::Success: + break; + case ValidationAttempt::SoftError: { if (!nextTry()) { setFinished(a.result(), a.message(), {}); diff --git a/src/src/plugincontainer.cpp b/src/src/plugincontainer.cpp index 2e2ac45..a309001 100644 --- a/src/src/plugincontainer.cpp +++ b/src/src/plugincontainer.cpp @@ -1213,6 +1213,9 @@ void PluginContainer::loadPlugins() case Load: log::warn("user wants to load plugin '{}' anyway", fileName); break; + + default: + break; } loadCheck.close(); diff --git a/src/src/processrunner.cpp b/src/src/processrunner.cpp index e5430b1..ac3ab67 100644 --- a/src/src/processrunner.cpp +++ b/src/src/processrunner.cpp @@ -629,7 +629,6 @@ ProcessRunner::Results waitForPid(pid_t pid, LPDWORD exitCode, rescanned, rescanName.toStdString()); lastTrackedPid = rescanned; useKillPoll = true; - displayPid = rescanned; displayName = rescanName; continue; } diff --git a/src/src/qdirfiletree.h b/src/src/qdirfiletree.h index d956b7a..e22f7da 100644 --- a/src/src/qdirfiletree.h +++ b/src/src/qdirfiletree.h @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -#ifndef ARCHIVEFILENETRY_H +#ifndef ARCHIVEFILENTRY_H #define ARCHIVEFILENTRY_H #include diff --git a/src/src/qtgroupingproxy.cpp b/src/src/qtgroupingproxy.cpp index f261d63..f62e1e5 100644 --- a/src/src/qtgroupingproxy.cpp +++ b/src/src/qtgroupingproxy.cpp @@ -868,12 +868,10 @@ void QtGroupingProxy::modelRowsRemoved(const QModelIndex& parent, int start, int iter.toBack(); while (iter.hasPrevious()) { iter.previous(); - int groupIndex = iter.key(); // has to be a modifiable reference for remove and replace operations QList& groupList = iter.value(); int rowIndex = groupList.indexOf(start); if (rowIndex != -1) { - QModelIndex proxyParent = index(groupIndex, 0); groupList.removeAt(rowIndex); } // Now decrement all source rows that are after the removed row diff --git a/src/src/selfupdater.cpp b/src/src/selfupdater.cpp index 9243084..56af1aa 100644 --- a/src/src/selfupdater.cpp +++ b/src/src/selfupdater.cpp @@ -187,7 +187,7 @@ void SelfUpdater::startUpdate() // it: dialog.setChangeLogs(details); - int res = dialog.exec(); + dialog.exec(); if (dialog.result() == QDialog::Accepted) { bool found = false; diff --git a/src/src/settingsdialognexus.cpp b/src/src/settingsdialognexus.cpp index 5ca69a1..59c5dad 100644 --- a/src/src/settingsdialognexus.cpp +++ b/src/src/settingsdialognexus.cpp @@ -19,7 +19,8 @@ public: virtual bool operator<(const QListWidgetItem& other) const { - return this->data(m_SortRole).value() < other.data(m_SortRole).value(); + return this->data(m_SortRole).template value() < + other.data(m_SortRole).template value(); } private: diff --git a/src/src/texteditor.cpp b/src/src/texteditor.cpp index b01d6d9..22c5fbd 100644 --- a/src/src/texteditor.cpp +++ b/src/src/texteditor.cpp @@ -323,9 +323,7 @@ void TextEditor::highlightCurrentLine() if (!isReadOnly()) { QTextEdit::ExtraSelection selection; - QColor lineColor = QColor(Qt::yellow).lighter(160); - - selection.format.setBackground(m_highlightBackground); + selection.format.setBackground(m_highlightBackground); selection.format.setProperty(QTextFormat::FullWidthSelection, true); selection.cursor = textCursor(); selection.cursor.clearSelection(); diff --git a/src/src/transfersavesdialog.cpp b/src/src/transfersavesdialog.cpp index e4f8810..f17ac82 100644 --- a/src/src/transfersavesdialog.cpp +++ b/src/src/transfersavesdialog.cpp @@ -115,11 +115,11 @@ void TransferSavesDialog::on_moveToLocalBtn_clicked() { QString character = ui->globalCharacterList->currentItem()->text(); if (transferCharacters( - character, MOVE_SAVES TO_PROFILE, m_GamePlugin->savesDirectory(), - m_GlobalSaves[character], m_Profile.savePath(), - [this](const QString& source, const QString& destination) -> bool { - return shellMove(source, destination, this); - }, + character, MOVE_SAVES TO_PROFILE, m_GamePlugin->savesDirectory(), + m_GlobalSaves[character], m_Profile.savePath(), + [this](const QString& source, const QString& destination) -> bool { + return shellMove(source, destination, false, this); + }, "Failed to move {} to {}")) { refreshGlobalSaves(); refreshGlobalCharacters(); @@ -132,11 +132,11 @@ void TransferSavesDialog::on_copyToLocalBtn_clicked() { QString character = ui->globalCharacterList->currentItem()->text(); if (transferCharacters( - character, COPY_SAVES TO_PROFILE, m_GamePlugin->savesDirectory(), - m_GlobalSaves[character], m_Profile.savePath(), - [this](const QString& source, const QString& destination) -> bool { - return shellCopy(source, destination, this); - }, + character, COPY_SAVES TO_PROFILE, m_GamePlugin->savesDirectory(), + m_GlobalSaves[character], m_Profile.savePath(), + [this](const QString& source, const QString& destination) -> bool { + return shellCopy(source, destination, false, this); + }, "Failed to copy {} to {}")) { refreshLocalSaves(); refreshLocalCharacters(); @@ -147,11 +147,11 @@ void TransferSavesDialog::on_moveToGlobalBtn_clicked() { QString character = ui->localCharacterList->currentItem()->text(); if (transferCharacters( - character, MOVE_SAVES TO_GLOBAL, m_Profile.savePath(), - m_LocalSaves[character], m_GamePlugin->savesDirectory().absolutePath(), - [this](const QString& source, const QString& destination) -> bool { - return shellMove(source, destination, this); - }, + character, MOVE_SAVES TO_GLOBAL, m_Profile.savePath(), + m_LocalSaves[character], m_GamePlugin->savesDirectory().absolutePath(), + [this](const QString& source, const QString& destination) -> bool { + return shellMove(source, destination, false, this); + }, "Failed to move {} to {}")) { refreshGlobalSaves(); refreshGlobalCharacters(); @@ -164,11 +164,11 @@ void TransferSavesDialog::on_copyToGlobalBtn_clicked() { QString character = ui->localCharacterList->currentItem()->text(); if (transferCharacters( - character, COPY_SAVES TO_GLOBAL, m_Profile.savePath(), - m_LocalSaves[character], m_GamePlugin->savesDirectory().absolutePath(), - [this](const QString& source, const QString& destination) -> bool { - return shellCopy(source, destination, this); - }, + character, COPY_SAVES TO_GLOBAL, m_Profile.savePath(), + m_LocalSaves[character], m_GamePlugin->savesDirectory().absolutePath(), + [this](const QString& source, const QString& destination) -> bool { + return shellCopy(source, destination, false, this); + }, "Failed to copy {} to {}")) { refreshGlobalSaves(); refreshGlobalCharacters(); diff --git a/src/src/uilocker.cpp b/src/src/uilocker.cpp index ce984e6..eefaa09 100644 --- a/src/src/uilocker.cpp +++ b/src/src/uilocker.cpp @@ -287,6 +287,9 @@ private: void updateMessage(UILocker::Reasons reason) { switch (reason) { + case UILocker::NoReason: + break; + case UILocker::LockUI: { QString s; @@ -324,6 +327,9 @@ private: auto* ly = m_buttons->layout(); switch (reason) { + case UILocker::NoReason: + break; + case UILocker::LockUI: // fall-through case UILocker::OutputRequired: { auto* unlock = new QPushButton(QObject::tr("Unlock")); diff --git a/src/src/vfs/vfstree.cpp b/src/src/vfs/vfstree.cpp index 303537d..89c6f4b 100644 --- a/src/src/vfs/vfstree.cpp +++ b/src/src/vfs/vfstree.cpp @@ -6,7 +6,6 @@ #include #include #include -#include namespace { @@ -493,10 +492,6 @@ VfsTree buildDataDirVfs(const std::vector& cached_files, // Scan mod directories in parallel — each mod is independent. // Use a bounded number of threads to avoid overwhelming the IO subsystem. { - const size_t numThreads = - std::min(static_cast(std::thread::hardware_concurrency()), - std::max(mods.size(), size_t{1})); - // Launch parallel scans std::vector> futures; futures.reserve(mods.size()); diff --git a/src/src/virtualfiletree.h b/src/src/virtualfiletree.h index aa056ff..b88739f 100644 --- a/src/src/virtualfiletree.h +++ b/src/src/virtualfiletree.h @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -#ifndef ARCHIVEFILENETRY_H +#ifndef ARCHIVEFILENTRY_H #define ARCHIVEFILENTRY_H #include -- cgit v1.3.1