diff options
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a7d187c2..551f4494 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -132,7 +132,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QPushButton> #include <QRadioButton> #include <QRect> -#include <QRegExp> #include <QResizeEvent> #include <QScopedPointer> #include <QSizePolicy> @@ -387,8 +386,8 @@ MainWindow::MainWindow(Settings &settings connect(&m_OrganizerCore, &OrganizerCore::directoryStructureReady, this, &MainWindow::onDirectoryStructureChanged); - connect(m_OrganizerCore.directoryRefresher(), &DirectoryRefresher::progress, - this, &MainWindow::refresherProgress); + connect(m_OrganizerCore.directoryRefresher(), SIGNAL(progress(const DirectoryRefreshProgress*)), + this, SLOT(refresherProgress(const DirectoryRefreshProgress*))); connect(m_OrganizerCore.directoryRefresher(), SIGNAL(error(QString)), this, SLOT(showError(QString))); connect(&m_OrganizerCore.settings(), SIGNAL(languageChanged(QString)), this, SLOT(languageChange(QString))); @@ -2957,7 +2956,7 @@ void MainWindow::nxmUpdatesAvailable(QString gameName, int modID, QVariant userD for (auto mod : modsList) { QString validNewVersion; int newModStatus = -1; - QString installedFile = mod->installationFile(); + QString installedFile = QFileInfo(mod->installationFile()).fileName(); if (!installedFile.isEmpty()) { QVariantMap foundFileData; @@ -3236,9 +3235,9 @@ void MainWindow::nxmDownloadURLs(QString, int, int, QVariant, QVariant resultDat m_OrganizerCore.settings().network().updateServers(servers); } -void MainWindow::nxmRequestFailed(QString gameName, int modID, int, QVariant, int, QNetworkReply::NetworkError error, const QString &errorString) +void MainWindow::nxmRequestFailed(QString gameName, int modID, int, QVariant, int, int errorCode, const QString &errorString) { - if (error == QNetworkReply::ContentAccessDenied || error == QNetworkReply::ContentNotFoundError) { + if (errorCode == QNetworkReply::ContentAccessDenied || errorCode == QNetworkReply::ContentNotFoundError) { log::debug("{}", tr("Mod ID %1 no longer seems to be available on Nexus.").arg(modID)); // update last checked timestamp on orphaned mods as well to avoid repeating requests @@ -3255,7 +3254,7 @@ void MainWindow::nxmRequestFailed(QString gameName, int modID, int, QVariant, in mod->setLastNexusQuery(QDateTime::currentDateTimeUtc()); } } else { - MessageDialog::showMessage(tr("Request to Nexus failed: %1").arg(errorString), this); + MessageDialog::showMessage(tr("Error %1: Request to Nexus failed: %2").arg(errorCode).arg(errorString), this); } } @@ -3490,14 +3489,16 @@ QString MainWindow::queryRestore(const QString &filePath) QFileInfoList files = pluginFileInfo.absoluteDir().entryInfoList(QStringList(pattern), QDir::Files, QDir::Name); SelectionDialog dialog(tr("Choose backup to restore"), this); - QRegExp exp(pluginFileInfo.fileName() + PATTERN_BACKUP_REGEX); - QRegExp exp2(pluginFileInfo.fileName() + "\\.(.*)"); + QRegularExpression exp(QRegularExpression::anchoredPattern(pluginFileInfo.fileName() + PATTERN_BACKUP_REGEX)); + QRegularExpression exp2(QRegularExpression::anchoredPattern(pluginFileInfo.fileName() + "\\.(.*)")); for(const QFileInfo &info : boost::adaptors::reverse(files)) { - if (exp.exactMatch(info.fileName())) { - QDateTime time = QDateTime::fromString(exp.cap(1), PATTERN_BACKUP_DATE); - dialog.addChoice(time.toString(), "", exp.cap(1)); - } else if (exp2.exactMatch(info.fileName())) { - dialog.addChoice(exp2.cap(1), "", exp2.cap(1)); + auto match = exp.match(info.fileName()); + auto match2 = exp2.match(info.fileName()); + if (match.hasMatch()) { + QDateTime time = QDateTime::fromString(match.captured(1), PATTERN_BACKUP_DATE); + dialog.addChoice(time.toString(), "", match.captured(1)); + } else if (match2.hasMatch()) { + dialog.addChoice(match2.captured(1), "", match2.captured(1)); } } |
