]> Some of my projects - localmylist.git/commitdiff
Fix some clazy warnings
authorAPTX <redacted>
Sat, 7 Feb 2026 08:05:43 +0000 (17:05 +0900)
committerAPTX <redacted>
Sat, 7 Mar 2026 03:43:55 +0000 (12:43 +0900)
CMakeLists.txt
localmylist-management/tabs/dynamicmodeltab.cpp
localmylist-management/tabs/pendingrequesttab.cpp
localmylist/mylist.cpp

index f12f33bedd8f9e7332b3d8e3fcae8ab90311a9c6..ab9a3cd086d108da72b5a630123654ef7750de95 100644 (file)
@@ -24,6 +24,7 @@ set(QT_PACKAGE "Qt6")
 set(QtScript_COMPONENT "")
 
 set(QT_MIN_VERSION "6.10.0")
+# Held back due to QSqlQuery
 add_compile_definitions("QT_DISABLE_DEPRECATED_UP_TO=QT_VERSION_CHECK(6, 1, 0)")
 
 add_subdirectory(localmylist)
index c7629e47c77d5ea9affef7dc1a0278999f5481bc..9ff9512423a03b365b3f418f51ae142ade06d8d4 100644 (file)
@@ -194,7 +194,6 @@ void DynamicModelTab::on_myListView_renameFilesRequested(const QModelIndex &inde
        if (!node->id())
                return;
 
-       QString path;
        QSqlQuery q(MyList::instance()->database()->connection());
 
        QChar typeLetter;
index 0de5bb64da82ef0da21e91421832fbe2a492930e..81c80d5a2a0114c4787f262a522e3be5f53b302e 100644 (file)
@@ -74,15 +74,14 @@ void PendingRequestTab::clearSelection()
 
 void PendingRequestTab::resetFailCount()
 {
-       QList<LocalMyList::PendingRequest> requests = selectionToPendingRequestList();
+       const auto &requests = selectionToPendingRequestList();
 
        if (!requests.count())
                return;
 
        {
                LocalMyList::RaiiTransaction t(LocalMyList::instance()->database());
-               for (const LocalMyList::PendingRequest &request :
-                        std::as_const(requests))
+               for (const LocalMyList::PendingRequest &request : requests)
                {
                        LocalMyList::instance()->database()->resetPendingRequest(request);
                }
@@ -94,9 +93,10 @@ void PendingRequestTab::resetFailCount()
 QList<LocalMyList::PendingRequest> PendingRequestTab::selectionToPendingRequestList()
 {
        QList<LocalMyList::PendingRequest> ret;
-       QModelIndexList selection = ui->view->selectionModel()->selectedRows();
+       const QModelIndexList selection =
+               ui->view->selectionModel()->selectedRows();
 
-       for (const QModelIndex &idx : std::as_const(selection))
+       for (const QModelIndex &idx : selection)
        {
                LocalMyList::PendingRequest pr;
                pr.aid = idx.data().toInt();
index ef13cf10b8f333d3f7eb18134770ffe4d70ec005..521e3f7317b3d7cb88e209b1a066ccef45972395 100644 (file)
@@ -409,7 +409,7 @@ QString MyList::mapPathFromSource(const QString &path, int sourceHost)
 
                if (!ret.endsWith(QChar('/')))
                        ret.append(QChar('/'));
-               ret.append(path.mid(prefix.length()));
+               ret.append(QStringView{path}.mid(prefix.length()));
 
                return ret;
        }
@@ -433,7 +433,7 @@ QString MyList::mapPathToSource(const QString &path, int *sourceHost)
 
                if (!ret.endsWith(QChar('/')))
                        ret.append(QChar('/'));
-               ret.append(path.mid(prefix.length()));
+               ret.append(QStringView{path}.mid(prefix.length()));
 
                if (sourceHost)
                        *sourceHost = pm.sourceHost;