From 1b85cda62682d084ea7bc335713131334955d497 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Sun, 4 Mar 2018 11:59:18 +0100 Subject: Added open logs folder to open folder toolbar dropdown. --- src/mainwindow.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fe93b546..71df8acf 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3035,6 +3035,12 @@ void MainWindow::openInstanceFolder() ::ShellExecuteW(nullptr, L"explore", ToWString(m_OrganizerCore.settings().getBaseDirectory()).c_str(), nullptr, nullptr, SW_SHOWNORMAL); } +void MainWindow::openLogsFolder() +{ + QString logsPath = qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::logPath()); + ::ShellExecuteW(nullptr, L"explore", ToWString(logsPath).c_str(), nullptr, nullptr, SW_SHOWNORMAL); +} + void MainWindow::openInstallFolder() { ::ShellExecuteW(nullptr, L"explore", ToWString(qApp->applicationDirPath()).c_str(), nullptr, nullptr, SW_SHOWNORMAL); @@ -3231,6 +3237,11 @@ QMenu *MainWindow::openFolderMenu() QMenu *FolderMenu = new QMenu(this); + FolderMenu->addAction(tr("Open Game folder"), this, SLOT(openGameFolder())); + + FolderMenu->addAction(tr("Open MyGames folder"), this, SLOT(openMyGamesFolder())); + + FolderMenu->addSeparator(); FolderMenu->addAction(tr("Open Instance folder"), this, SLOT(openInstanceFolder())); @@ -3238,13 +3249,19 @@ QMenu *MainWindow::openFolderMenu() FolderMenu->addAction(tr("Open Downloads folder"), this, SLOT(openDownloadsFolder())); - FolderMenu->addAction(tr("Open MO Install folder"), this, SLOT(openInstallFolder())); - FolderMenu->addSeparator(); - FolderMenu->addAction(tr("Open Game folder"), this, SLOT(openGameFolder())); + FolderMenu->addAction(tr("Open MO2 Install folder"), this, SLOT(openInstallFolder())); - FolderMenu->addAction(tr("Open MyGames folder"), this, SLOT(openMyGamesFolder())); + FolderMenu->addAction(tr("Open MO2 Logs folder"), this, SLOT(openLogsFolder())); + + + + + + + + return FolderMenu; -- cgit v1.3.1 From a873f7cfe2581716fd908062831d5d5c8f56392f Mon Sep 17 00:00:00 2001 From: Al12rs Date: Sun, 4 Mar 2018 12:52:28 +0100 Subject: Removed "Repace category" menu option from the modlist as it was redundant and cluttering the menu. --- src/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 71df8acf..eb612b6b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3326,10 +3326,13 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) connect(addRemoveCategoriesMenu, SIGNAL(aboutToHide()), this, SLOT(addRemoveCategories_MenuHandler())); addMenuAsPushButton(menu, addRemoveCategoriesMenu); + //Removed as it was redundant, just making the categories look more complicated. + /* QMenu *replaceCategoriesMenu = new QMenu(tr("Replace Categories")); populateMenuCategories(replaceCategoriesMenu, 0); connect(replaceCategoriesMenu, SIGNAL(aboutToHide()), this, SLOT(replaceCategories_MenuHandler())); addMenuAsPushButton(menu, replaceCategoriesMenu); + */ QMenu *primaryCategoryMenu = new QMenu(tr("Primary Category")); connect(primaryCategoryMenu, SIGNAL(aboutToShow()), this, SLOT(addPrimaryCategoryCandidates())); -- cgit v1.3.1 From 513c0629323c066a7b1d5df5ce81f3b9beac85bd Mon Sep 17 00:00:00 2001 From: Al12rs Date: Mon, 5 Mar 2018 15:16:55 +0100 Subject: Inverted position of reinstall and remove mod, as per user request. --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index eb612b6b..ddd7ef92 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3352,8 +3352,8 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) menu->addSeparator(); menu->addAction(tr("Rename Mod..."), this, SLOT(renameMod_clicked())); - menu->addAction(tr("Remove Mod..."), this, SLOT(removeMod_clicked())); menu->addAction(tr("Reinstall Mod"), this, SLOT(reinstallMod_clicked())); + menu->addAction(tr("Remove Mod..."), this, SLOT(removeMod_clicked())); menu->addSeparator(); -- cgit v1.3.1 From 7c87e9a64556c588a66482ea9acace52c76af7cd Mon Sep 17 00:00:00 2001 From: Al12rs Date: Sun, 4 Mar 2018 19:12:06 +0100 Subject: Edited "Add/Remove category" menu entry text to "Change Category". --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ddd7ef92..f5be22f0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3321,7 +3321,7 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) } else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_FOREIGN) != flags.end()) { // nop, nothing to do with this mod } else { - QMenu *addRemoveCategoriesMenu = new QMenu(tr("Add/Remove Categories")); + QMenu *addRemoveCategoriesMenu = new QMenu(tr("Change Categories")); populateMenuCategories(addRemoveCategoriesMenu, 0); connect(addRemoveCategoriesMenu, SIGNAL(aboutToHide()), this, SLOT(addRemoveCategories_MenuHandler())); addMenuAsPushButton(menu, addRemoveCategoriesMenu); -- cgit v1.3.1 From c7f660e061f92901b80558c2bfe7640944fc1840 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Thu, 8 Mar 2018 15:55:24 -0600 Subject: Remove outdated namespacing and correct the PATH setting to appends dlls --- src/categories.cpp | 2 +- src/categories.h | 2 +- src/main.cpp | 10 +++++----- src/mainwindow.cpp | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/categories.cpp b/src/categories.cpp index d8cd49fb..4d89eff9 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -167,7 +167,7 @@ void CategoryFactory::saveCategories() } -unsigned int CategoryFactory::countCategories(std::tr1::function filter) +unsigned int CategoryFactory::countCategories(std::function filter) { unsigned int result = 0; for (const Category &cat : m_Categories) { diff --git a/src/categories.h b/src/categories.h index 66299c30..474a1440 100644 --- a/src/categories.h +++ b/src/categories.h @@ -99,7 +99,7 @@ public: * @param filter the filter to test * @return number of matching categories */ - unsigned int countCategories(std::tr1::function filter); + unsigned int countCategories(std::function filter); /** * @brief get the id of the parent category diff --git a/src/main.cpp b/src/main.cpp index 935b7404..0464ca9a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -402,6 +402,8 @@ void setupPath() qDebug("MO at: %s", qPrintable(QDir::toNativeSeparators( QCoreApplication::applicationDirPath()))); + QCoreApplication::setLibraryPaths(QStringList(QCoreApplication::applicationDirPath() + "/dlls") + QCoreApplication::libraryPaths()); + boost::scoped_array oldPath(new TCHAR[BUFSIZE]); DWORD offset = ::GetEnvironmentVariable(TEXT("PATH"), oldPath.get(), BUFSIZE); if (offset > BUFSIZE) { @@ -409,12 +411,10 @@ void setupPath() ::GetEnvironmentVariable(TEXT("PATH"), oldPath.get(), offset); } - std::wstring newPath(oldPath.get()); + std::wstring newPath(ToWString(QDir::toNativeSeparators( + QCoreApplication::applicationDirPath())) + L"\\dlls"); newPath += L";"; - newPath += ToWString(QDir::toNativeSeparators( - QCoreApplication::applicationDirPath())) - .c_str(); - newPath += L"\\dlls"; + newPath += oldPath.get(); ::SetEnvironmentVariableW(L"PATH", newPath.c_str()); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f5be22f0..83a12437 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4596,8 +4596,8 @@ void MainWindow::processLOOTOut(const std::string &lootOut, std::string &errorMe std::vector lines; boost::split(lines, lootOut, boost::is_any_of("\r\n")); - std::tr1::regex exRequires("\"([^\"]*)\" requires \"([^\"]*)\", but it is missing\\."); - std::tr1::regex exIncompatible("\"([^\"]*)\" is incompatible with \"([^\"]*)\", but both are present\\."); + std::regex exRequires("\"([^\"]*)\" requires \"([^\"]*)\", but it is missing\\."); + std::regex exIncompatible("\"([^\"]*)\" is incompatible with \"([^\"]*)\", but both are present\\."); for (const std::string &line : lines) { if (line.length() > 0) { @@ -4609,12 +4609,12 @@ void MainWindow::processLOOTOut(const std::string &lootOut, std::string &errorMe qWarning("%s", line.c_str()); errorMessages.append(boost::algorithm::trim_copy(line.substr(erroridx + 8)) + "\n"); } else { - std::tr1::smatch match; - if (std::tr1::regex_match(line, match, exRequires)) { + std::smatch match; + if (std::regex_match(line, match, exRequires)) { std::string modName(match[1].first, match[1].second); std::string dependency(match[2].first, match[2].second); m_OrganizerCore.pluginList()->addInformation(modName.c_str(), tr("depends on missing \"%1\"").arg(dependency.c_str())); - } else if (std::tr1::regex_match(line, match, exIncompatible)) { + } else if (std::regex_match(line, match, exIncompatible)) { std::string modName(match[1].first, match[1].second); std::string dependency(match[2].first, match[2].second); m_OrganizerCore.pluginList()->addInformation(modName.c_str(), tr("incompatible with \"%1\"").arg(dependency.c_str())); -- cgit v1.3.1 From 9f61ef5c9e6c8884a14b7d6f1507199f61a64377 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Mon, 12 Mar 2018 19:53:43 +0100 Subject: Added a check to the preview function to handle tha case of the file beeing from the actual data folder instead of a mod. --- src/mainwindow.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 83a12437..bdf79bd5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3929,10 +3929,22 @@ void MainWindow::previewDataFile() // what we have is an absolute path to the file in its actual location (for the primary origin) // what we want is the path relative to the virtual data directory - // crude: we search for the next slash after the base mod directory to skip everything up to the data-relative directory - int offset = m_OrganizerCore.settings().getModDirectory().size() + 1; - offset = fileName.indexOf("/", offset); - fileName = fileName.mid(offset + 1); + // we need to look in the virtual directory for the file to make sure the info is up to date. + + // check if the file comes from the actual data folder instead of a mod + QDir gameDirectory = m_OrganizerCore.managedGame()->dataDirectory().absolutePath(); + QString relativePath = gameDirectory.relativeFilePath(fileName); + if (!relativePath.startsWith("..")) { + fileName = relativePath; + } + else { + // crude: we search for the next slash after the base mod directory to skip everything up to the data-relative directory + int offset = m_OrganizerCore.settings().getModDirectory().size() + 1; + offset = fileName.indexOf("/", offset); + fileName = fileName.mid(offset + 1); + } + + const FileEntry::Ptr file = m_OrganizerCore.directoryStructure()->searchFile(ToWString(fileName), nullptr); -- cgit v1.3.1 From ccb5ad53e22e54f416c4cc3f33c2b57d0b1b672a Mon Sep 17 00:00:00 2001 From: Al12rs Date: Mon, 12 Mar 2018 23:18:03 +0100 Subject: Fixed wrong Nexus page url in CSV export. --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bdf79bd5..5be5cef3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3201,7 +3201,7 @@ void MainWindow::exportModListCSV() if (nexus_ID->isChecked()) builder.setRowField("#Nexus_ID", info->getNexusID()); if (mod_Nexus_URL->isChecked()) - builder.setRowField("#Mod_Nexus_URL", info->getURL()); + builder.setRowField("#Mod_Nexus_URL",(info->getNexusID()>0)? NexusInterface::instance()->getModURL(info->getNexusID()) : ""); if (mod_Version->isChecked()) builder.setRowField("#Mod_Version", info->getVersion().canonicalString()); if (install_Date->isChecked()) -- cgit v1.3.1 From 2fa1b04cd430315f3abf45dcdd4975c0117ac98a Mon Sep 17 00:00:00 2001 From: Al12rs Date: Fri, 16 Mar 2018 18:02:57 +0100 Subject: Various text and ui changes: Added description to CSV export. Added line to delete instance error message. Changed delete instance icon for the list of instances. Added red X in the resources, thanks to twizz0r. --- src/instancemanager.cpp | 4 ++-- src/mainwindow.cpp | 4 ++++ src/resources.qrc | 1 + src/resources/multiply-red.png | Bin 0 -> 16018 bytes 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 src/resources/multiply-red.png (limited to 'src/mainwindow.cpp') diff --git a/src/instancemanager.cpp b/src/instancemanager.cpp index d12ec119..43ae152b 100644 --- a/src/instancemanager.cpp +++ b/src/instancemanager.cpp @@ -105,7 +105,7 @@ QString InstanceManager::manageInstances(const QStringList &instanceList) const nullptr); for (const QString &instance : instanceList) { - selection.addChoice(instance, "", instance); + selection.addChoice(QIcon(":/MO/gui/multiply_red"), instance, "", instance); } if (selection.exec() == QDialog::Rejected) { @@ -120,7 +120,7 @@ QString InstanceManager::manageInstances(const QStringList &instanceList) const if (!deleteLocalInstance(choice)) { QMessageBox::warning(nullptr, QObject::tr("Failed to delete Instance"), - QObject::tr("Could not delete Instance \"%1\"").arg(choice), QMessageBox::Ok); + QObject::tr("Could not delete Instance \"%1\". \nIf the folder was still in use, restart MO and try again.").arg(choice), QMessageBox::Ok); } } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5be5cef3..2bf25b05 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3079,6 +3079,10 @@ void MainWindow::exportModListCSV() QGridLayout *grid = new QGridLayout; selection.setWindowTitle(tr("Export to csv")); + QLabel *csvDescription = new QLabel(); + csvDescription->setText(tr("CSV (Comma Separated Values) is a format that can be imported in programs like Excel to create a spreadsheet.\nYou can also use online editors and converters instead.")); + grid->addWidget(csvDescription); + QGroupBox *groupBoxRows = new QGroupBox(tr("Select what mods you want export:")); QRadioButton *all = new QRadioButton(tr("All installed mods")); QRadioButton *active = new QRadioButton(tr("Only active (checked) mods from your current profile")); diff --git a/src/resources.qrc b/src/resources.qrc index 618d3cfc..1cfc58a3 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -72,6 +72,7 @@ resources/package.png resources/switch-instance-icon.png resources/open-Folder-Icon.png + resources/multiply-red.png resources/contents/jigsaw-piece.png diff --git a/src/resources/multiply-red.png b/src/resources/multiply-red.png new file mode 100644 index 00000000..c238f07f Binary files /dev/null and b/src/resources/multiply-red.png differ -- cgit v1.3.1 From 336216ba9a7e07aad972708c862c1e7306f1c67d Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Tue, 20 Mar 2018 01:29:31 -0500 Subject: Various save game improvements related to script extender files * Improve handling of SE save transfers and deletes with main save * Add indicator in save popup dialog if SE save file is present --- src/mainwindow.cpp | 12 ++++++++---- src/transfersavesdialog.cpp | 30 ++++++++++-------------------- 2 files changed, 18 insertions(+), 24 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2bf25b05..8bb40072 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4667,9 +4667,13 @@ void MainWindow::on_bossButton_clicked() QStringList parameters; parameters << "--game" << m_OrganizerCore.managedGame()->gameShortName() - << "--gamePath" << QString("\"%1\"").arg(m_OrganizerCore.managedGame()->gameDirectory().absolutePath()) - << "--pluginListPath" << QString("\"%1/loadorder.txt\"").arg(m_OrganizerCore.profilePath()) - << "--out" << QString("\"%1\"").arg(outPath); + << "--gamePath" << QString("\"%1\"").arg(m_OrganizerCore.managedGame()->gameDirectory().absolutePath()) + << "--out" << QString("\"%1\"").arg(outPath); + + if (m_OrganizerCore.managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) + parameters << "--pluginListPath" << QString("\"%1/loadorder.txt\"").arg(m_OrganizerCore.profilePath()); + else + parameters << "--pluginListPath" << QString("\"%1/plugins.txt\"").arg(m_OrganizerCore.profilePath()); if (m_DidUpdateMasterList) { parameters << "--skipUpdateMasterlist"; @@ -4802,7 +4806,7 @@ void MainWindow::on_bossButton_clicked() // if the game specifies load order by file time, our own load order file needs to be removed because it's outdated. // refreshESPList will then use the file time as the load order. - if (m_OrganizerCore.managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { + if (m_OrganizerCore.managedGame()->loadOrderMechanism() != IPluginGame::LoadOrderMechanism::FileTime) { qDebug("removing loadorder.txt"); QFile::remove(m_OrganizerCore.currentProfile()->getLoadOrderFileName()); } diff --git a/src/transfersavesdialog.cpp b/src/transfersavesdialog.cpp index b8dda056..61dab6e5 100644 --- a/src/transfersavesdialog.cpp +++ b/src/transfersavesdialog.cpp @@ -74,6 +74,11 @@ public: return { m_File }; } + virtual bool hasScriptExtenderFile() const override + { + return false; + } + private: QString m_File; }; @@ -95,6 +100,11 @@ public: { return nullptr; } + + virtual bool hasScriptExtenderSave(QString const &file) const override + { + return false; + } }; } //end anonymous namespace @@ -334,26 +344,6 @@ bool TransferSavesDialog::transferCharacters( sourceFile.absoluteFilePath().toUtf8().constData(), destinationFile.toUtf8().constData()); } - - QFileInfo sourceFileSE(sourceFile.absolutePath() + "/" + sourceFile.completeBaseName() + "." + m_GamePlugin->savegameSEExtension()); - if (sourceFileSE.exists()) { - QString destinationFileSE(destination.absoluteFilePath(sourceFileSE.fileName())); - - //If the file is already there, let them skip (or not). - if (QFile::exists(destinationFileSE)) { - if (!testOverwrite(overwriteMode, destinationFileSE)) { - continue; - } - //OK, they want to remove it. - QFile::remove(destinationFileSE); - } - - if (!method(sourceFileSE.absoluteFilePath(), destinationFileSE)) { - qCritical(errmsg, - sourceFileSE.absoluteFilePath().toUtf8().constData(), - destinationFileSE.toUtf8().constData()); - } - } } } return true; -- cgit v1.3.1 From 0c792d548f44f71cdd358b5811f5ed06196430d9 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Tue, 20 Mar 2018 17:10:35 -0500 Subject: Fix lootcli destroying loadorder on newer games --- src/mainwindow.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8bb40072..e562b2f2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4668,13 +4668,9 @@ void MainWindow::on_bossButton_clicked() QStringList parameters; parameters << "--game" << m_OrganizerCore.managedGame()->gameShortName() << "--gamePath" << QString("\"%1\"").arg(m_OrganizerCore.managedGame()->gameDirectory().absolutePath()) + << "--pluginListPath" << QString("\"%1/loadorder.txt\"").arg(m_OrganizerCore.profilePath()) << "--out" << QString("\"%1\"").arg(outPath); - if (m_OrganizerCore.managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) - parameters << "--pluginListPath" << QString("\"%1/loadorder.txt\"").arg(m_OrganizerCore.profilePath()); - else - parameters << "--pluginListPath" << QString("\"%1/plugins.txt\"").arg(m_OrganizerCore.profilePath()); - if (m_DidUpdateMasterList) { parameters << "--skipUpdateMasterlist"; } @@ -4793,7 +4789,7 @@ void MainWindow::on_bossButton_clicked() if (success) { m_DidUpdateMasterList = true; - /*if (reportURL.length() > 0) { + if (reportURL.length() > 0) { m_IntegratedBrowser.setWindowTitle("LOOT Report"); QString report(reportURL.c_str()); QStringList temp = report.split("?"); @@ -4802,13 +4798,6 @@ void MainWindow::on_bossButton_clicked() url.setQuery(temp.at(1).toUtf8()); } m_IntegratedBrowser.openUrl(url); - }*/ - - // if the game specifies load order by file time, our own load order file needs to be removed because it's outdated. - // refreshESPList will then use the file time as the load order. - if (m_OrganizerCore.managedGame()->loadOrderMechanism() != IPluginGame::LoadOrderMechanism::FileTime) { - qDebug("removing loadorder.txt"); - QFile::remove(m_OrganizerCore.currentProfile()->getLoadOrderFileName()); } m_OrganizerCore.refreshESPList(); m_OrganizerCore.savePluginList(); -- cgit v1.3.1 From 92a8a3dce863c80f540537162e7c7e415cdfd57d Mon Sep 17 00:00:00 2001 From: Al12rs Date: Wed, 21 Mar 2018 00:12:39 +0100 Subject: Fixed preview "file not found" error if the mod folder containing the file was on a different drive. --- src/mainwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2bf25b05..f38ddf15 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3938,7 +3938,9 @@ void MainWindow::previewDataFile() // check if the file comes from the actual data folder instead of a mod QDir gameDirectory = m_OrganizerCore.managedGame()->dataDirectory().absolutePath(); QString relativePath = gameDirectory.relativeFilePath(fileName); - if (!relativePath.startsWith("..")) { + QDir direRelativePath = gameDirectory.relativeFilePath(fileName); + // if the file is on a different drive the dirRelativePath will actually be an absolute path so we make sure that is not the case + if (!direRelativePath.isAbsolute() && !relativePath.startsWith("..")) { fileName = relativePath; } else { -- cgit v1.3.1 From 82d4742e2814755a4aa812fadb382b2831680692 Mon Sep 17 00:00:00 2001 From: Sandro Jäckel Date: Wed, 21 Mar 2018 08:23:03 +0100 Subject: Proper variable naming and fixed Sandros OCD --- src/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e5eacc41..cae5ee52 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3938,9 +3938,9 @@ void MainWindow::previewDataFile() // check if the file comes from the actual data folder instead of a mod QDir gameDirectory = m_OrganizerCore.managedGame()->dataDirectory().absolutePath(); QString relativePath = gameDirectory.relativeFilePath(fileName); - QDir direRelativePath = gameDirectory.relativeFilePath(fileName); + QDir dirRelativePath = gameDirectory.relativeFilePath(fileName); // if the file is on a different drive the dirRelativePath will actually be an absolute path so we make sure that is not the case - if (!direRelativePath.isAbsolute() && !relativePath.startsWith("..")) { + if (!dirRelativePath.isAbsolute() && !relativePath.startsWith("..")) { fileName = relativePath; } else { -- cgit v1.3.1 From ba0a1bd50191fb6387489c6562a2e1fe8e0451d0 Mon Sep 17 00:00:00 2001 From: LePresidente Date: Thu, 22 Mar 2018 09:41:35 +0200 Subject: Updater and Issue reports now point to Modorganizer2/modorganizer --- src/mainwindow.cpp | 17 ++++++++--------- src/selfupdater.cpp | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e5eacc41..a79e42ba 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1886,7 +1886,7 @@ void MainWindow::wikiTriggered() void MainWindow::issueTriggered() { - ::ShellExecuteW(nullptr, L"open", L"http://github.com/LePresidente/modorganizer/issues", nullptr, nullptr, SW_SHOWNORMAL); + ::ShellExecuteW(nullptr, L"open", L"http://github.com/Modorganizer2/modorganizer/issues", nullptr, nullptr, SW_SHOWNORMAL); } void MainWindow::tutorialTriggered() @@ -3036,7 +3036,7 @@ void MainWindow::openInstanceFolder() } void MainWindow::openLogsFolder() -{ +{ QString logsPath = qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::logPath()); ::ShellExecuteW(nullptr, L"explore", ToWString(logsPath).c_str(), nullptr, nullptr, SW_SHOWNORMAL); } @@ -3237,7 +3237,7 @@ static void addMenuAsPushButton(QMenu *menu, QMenu *subMenu) } QMenu *MainWindow::openFolderMenu() -{ +{ QMenu *FolderMenu = new QMenu(this); @@ -3261,11 +3261,11 @@ QMenu *MainWindow::openFolderMenu() - - - + + + return FolderMenu; @@ -3950,7 +3950,7 @@ void MainWindow::previewDataFile() fileName = fileName.mid(offset + 1); } - + const FileEntry::Ptr file = m_OrganizerCore.directoryStructure()->searchFile(ToWString(fileName), nullptr); @@ -4666,7 +4666,7 @@ void MainWindow::on_bossButton_clicked() dialog.show(); QString outPath = QDir::temp().absoluteFilePath("lootreport.json"); - + QStringList parameters; parameters << "--game" << m_OrganizerCore.managedGame()->gameShortName() << "--gamePath" << QString("\"%1\"").arg(m_OrganizerCore.managedGame()->gameDirectory().absolutePath()) @@ -5076,4 +5076,3 @@ void MainWindow::on_clearFiltersButton_clicked() { deselectFilters(); } - diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index 273e9b45..8f962ba4 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -125,7 +125,7 @@ void SelfUpdater::testForUpdate() // TODO: if prereleases are disabled we could just request the latest release // directly try { - m_GitHub.releases(GitHub::Repository("LePresidente", "modorganizer"), + m_GitHub.releases(GitHub::Repository("Modorganizer2", "modorganizer"), [this](const QJsonArray &releases) { QJsonObject newest; for (const QJsonValue &releaseVal : releases) { -- cgit v1.3.1 From 74dd2bb914a1f2a31506c3544b6ee198f65e2b6b Mon Sep 17 00:00:00 2001 From: Silarn Date: Thu, 5 Apr 2018 23:57:24 -0500 Subject: Return extraction context menu to archive list --- src/mainwindow.cpp | 12 ++++++++++++ src/mainwindow.h | 1 + 2 files changed, 13 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0dbe4d53..faa4b880 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4345,6 +4345,18 @@ void MainWindow::displayColumnSelection(const QPoint &pos) } } +void MainWindow::on_bsaList_customContextMenuRequested(const QPoint &pos) +{ + m_ContextItem = ui->bsaList->itemAt(pos); + +// m_ContextRow = ui->bsaList->indexOfTopLevelItem(ui->bsaList->itemAt(pos)); + + QMenu menu; + menu.addAction(tr("Extract..."), this, SLOT(extractBSATriggered())); + + menu.exec(ui->bsaList->mapToGlobal(pos)); +} + void MainWindow::on_bsaList_itemChanged(QTreeWidgetItem*, int) { m_ArchiveListWriter.write(); diff --git a/src/mainwindow.h b/src/mainwindow.h index f84931ca..d0957305 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -553,6 +553,7 @@ private slots: // ui slots void on_actionUpdate_triggered(); void on_actionEndorseMO_triggered(); + void on_bsaList_customContextMenuRequested(const QPoint &pos); void on_clearFiltersButton_clicked(); void on_btnRefreshData_clicked(); void on_categoriesList_customContextMenuRequested(const QPoint &pos); -- cgit v1.3.1 From fd9eb032b6df5eafa89a60a515963ba7d4652f24 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Fri, 23 Mar 2018 17:48:00 +0100 Subject: Added file preview in conflicts tab in the mod information dialog. The preview is not working for the lower file list for some reason but I left the setup of the context menu and all in case somebody else can figure out what I'm missing. --- src/mainwindow.cpp | 2 +- src/modinfodialog.cpp | 98 +++++++++++++++++++++++++++++++++++++++++++++++++-- src/modinfodialog.h | 8 ++++- src/modinfodialog.ui | 6 ++++ 4 files changed, 110 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index faa4b880..d9d83231 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2450,7 +2450,7 @@ void MainWindow::displayModInformation(ModInfo::Ptr modInfo, unsigned int index, } } else { modInfo->saveMeta(); - ModInfoDialog dialog(modInfo, m_OrganizerCore.directoryStructure(), modInfo->hasFlag(ModInfo::FLAG_FOREIGN), this); + ModInfoDialog dialog(modInfo, m_OrganizerCore.directoryStructure(), modInfo->hasFlag(ModInfo::FLAG_FOREIGN), &m_OrganizerCore, &m_PluginContainer,this); connect(&dialog, SIGNAL(nexusLinkActivated(QString)), this, SLOT(nexusLinkActivated(QString))); connect(&dialog, SIGNAL(downloadRequest(QString)), &m_OrganizerCore, SLOT(downloadRequestedNXM(QString))); connect(&dialog, SIGNAL(modOpen(QString, int)), this, SLOT(displayModInformation(QString, int)), Qt::QueuedConnection); diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index ccd2a122..f2042d15 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -30,6 +30,10 @@ along with Mod Organizer. If not, see . #include "questionboxmemory.h" #include "settings.h" #include "categories.h" +#include "organizercore.h" +#include "pluginlistsortproxy.h" +#include "previewgenerator.h" +#include "previewdialog.h" #include #include @@ -66,11 +70,12 @@ static bool operator<(const ModFileListWidget &LHS, const ModFileListWidget &RHS } -ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directory, bool unmanaged, QWidget *parent) +ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directory, bool unmanaged, OrganizerCore *organizerCore, PluginContainer *pluginContainer, QWidget *parent) : TutorableDialog("ModInfoDialog", parent), ui(new Ui::ModInfoDialog), m_ModInfo(modInfo), m_ThumbnailMapper(this), m_RequestStarted(false), m_DeleteAction(nullptr), m_RenameAction(nullptr), m_OpenAction(nullptr), - m_Directory(directory), m_Origin(nullptr) + m_Directory(directory), m_Origin(nullptr), + m_OrganizerCore(organizerCore), m_PluginContainer(pluginContainer) { ui->setupUi(this); this->setWindowTitle(modInfo->name()); @@ -1198,6 +1203,69 @@ void ModInfoDialog::unhideConflictFile() } +void ModInfoDialog::previewDataFile() +{ + QString fileName = QDir::fromNativeSeparators(m_ConflictsContextItem->data(0, Qt::UserRole).toString()); + + // what we have is an absolute path to the file in its actual location (for the primary origin) + // what we want is the path relative to the virtual data directory + + // we need to look in the virtual directory for the file to make sure the info is up to date. + + // check if the file comes from the actual data folder instead of a mod + QDir gameDirectory = m_OrganizerCore->managedGame()->dataDirectory().absolutePath(); + QString relativePath = gameDirectory.relativeFilePath(fileName); + QDir direRelativePath = gameDirectory.relativeFilePath(fileName); + // if the file is on a different drive the dirRelativePath will actually be an absolute path so we make sure that is not the case + if (!direRelativePath.isAbsolute() && !relativePath.startsWith("..")) { + fileName = relativePath; + } + else { + // crude: we search for the next slash after the base mod directory to skip everything up to the data-relative directory + int offset = m_OrganizerCore->settings().getModDirectory().size() + 1; + offset = fileName.indexOf("/", offset); + fileName = fileName.mid(offset + 1); + } + + + + const FileEntry::Ptr file = m_OrganizerCore->directoryStructure()->searchFile(ToWString(fileName), nullptr); + + if (file.get() == nullptr) { + reportError(tr("file not found: %1").arg(fileName)); + return; + } + + // set up preview dialog + PreviewDialog preview(fileName); + auto addFunc = [&](int originId) { + FilesOrigin &origin = m_OrganizerCore->directoryStructure()->getOriginByID(originId); + QString filePath = QDir::fromNativeSeparators(ToQString(origin.getPath())) + "/" + fileName; + if (QFile::exists(filePath)) { + // it's very possible the file doesn't exist, because it's inside an archive. we don't support that + QWidget *wid = m_PluginContainer->previewGenerator().genPreview(filePath); + if (wid == nullptr) { + reportError(tr("failed to generate preview for %1").arg(filePath)); + } + else { + preview.addVariant(ToQString(origin.getName()), wid); + } + } + }; + + addFunc(file->getOrigin()); + for (auto alt : file->getAlternatives()) { + addFunc(alt.first); + } + if (preview.numVariants() > 0) { + preview.exec(); + } + else { + QMessageBox::information(this, tr("Sorry"), tr("Sorry, can't preview anything. This function currently does not support extracting from bsas.")); + } +} + + void ModInfoDialog::on_overwriteTree_customContextMenuRequested(const QPoint &pos) { m_ConflictsContextItem = ui->overwriteTree->itemAt(pos.x(), pos.y()); @@ -1211,11 +1279,37 @@ void ModInfoDialog::on_overwriteTree_customContextMenuRequested(const QPoint &po } else { menu.addAction(tr("Hide"), this, SLOT(hideConflictFile())); } + + QString fileName = m_ConflictsContextItem->data(0, Qt::UserRole).toString(); + if (m_PluginContainer->previewGenerator().previewSupported(QFileInfo(fileName).suffix())) { + menu.addAction(tr("Preview"), this, SLOT(previewDataFile())); + } + menu.exec(ui->overwriteTree->mapToGlobal(pos)); } } } +void ModInfoDialog::on_overwrittenTree_customContextMenuRequested(const QPoint &pos) +{ + //For some reason the m_ConflictsContextItem does not pick up valid data from the overwrittenTree. + //TODO: find out what is going wrong. + /*m_ConflictsContextItem = ui->overwrittenTree->itemAt(pos.x(), pos.y()); + + if (m_ConflictsContextItem != nullptr) { + if (!m_ConflictsContextItem->data(1, Qt::UserRole + 2).toBool()) { + QMenu menu; + + QString fileName = m_ConflictsContextItem->data(0, Qt::UserRole).toString(); + if (m_PluginContainer->previewGenerator().previewSupported(QFileInfo(fileName).suffix())) { + menu.addAction(tr("Preview"), this, SLOT(previewDataFile())); + } + + menu.exec(ui->overwrittenTree->mapToGlobal(pos)); + } + }*/ +} + void ModInfoDialog::on_overwrittenTree_itemDoubleClicked(QTreeWidgetItem *item, int) { diff --git a/src/modinfodialog.h b/src/modinfodialog.h index e7c70762..ab878cf9 100644 --- a/src/modinfodialog.h +++ b/src/modinfodialog.h @@ -24,6 +24,7 @@ along with Mod Organizer. If not, see . #include "modinfo.h" #include "tutorabledialog.h" #include "plugincontainer.h" +#include "organizercore.h" #include #include @@ -77,7 +78,7 @@ public: * @param modInfo info structure about the mod to display * @param parent parend widget **/ - explicit ModInfoDialog(ModInfo::Ptr modInfo, const MOShared::DirectoryEntry *directory, bool unmanaged, QWidget *parent = 0); + explicit ModInfoDialog(ModInfo::Ptr modInfo, const MOShared::DirectoryEntry *directory, bool unmanaged, OrganizerCore *organizerCore, PluginContainer *pluginContainer,QWidget *parent = 0); ~ModInfoDialog(); /** @@ -156,6 +157,7 @@ private slots: void hideConflictFile(); void unhideConflictFile(); + void previewDataFile(); void thumbnailClicked(const QString &fileName); void linkClicked(const QUrl &url); @@ -186,6 +188,7 @@ private slots: void on_overwriteTree_itemDoubleClicked(QTreeWidgetItem *item, int column); void on_overwrittenTree_itemDoubleClicked(QTreeWidgetItem *item, int column); void on_overwriteTree_customContextMenuRequested(const QPoint &pos); + void on_overwrittenTree_customContextMenuRequested(const QPoint &pos); void on_fileTree_customContextMenuRequested(const QPoint &pos); void on_refreshButton_clicked(); @@ -209,6 +212,9 @@ private: QSignalMapper m_ThumbnailMapper; QString m_RootPath; + OrganizerCore *m_OrganizerCore; + PluginContainer *m_PluginContainer; + QFileSystemModel *m_FileSystemModel; QTreeView *m_FileTree; QModelIndexList m_FileSelection; diff --git a/src/modinfodialog.ui b/src/modinfodialog.ui index b5331424..05415445 100644 --- a/src/modinfodialog.ui +++ b/src/modinfodialog.ui @@ -489,6 +489,9 @@ Most mods do not have optional esps, so chances are good you are looking at an e + + Qt::CustomContextMenu + Qt::ElideLeft @@ -498,6 +501,9 @@ Most mods do not have optional esps, so chances are good you are looking at an e true + + 2 + 365 -- cgit v1.3.1 From 0f8852f487cb1f8b993141042da4196db965e038 Mon Sep 17 00:00:00 2001 From: Silarn Date: Sun, 8 Apr 2018 03:58:08 -0500 Subject: Also mark hidden downloads as uninstalled; refresh plugins after files --- src/downloadmanager.cpp | 20 ++++++++++++++++++++ src/downloadmanager.h | 3 +++ src/mainwindow.cpp | 6 ++---- 3 files changed, 25 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 45070885..161656b2 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -918,6 +918,10 @@ void DownloadManager::markInstalled(int index) setState(m_ActiveDownloads.at(index), STATE_INSTALLED); } +DownloadManager::DownloadInfo* DownloadManager::getDownloadInfo(QString fileName) +{ + return DownloadInfo::createFromMeta(fileName, true); +} void DownloadManager::markUninstalled(int index) { @@ -933,6 +937,22 @@ void DownloadManager::markUninstalled(int index) } +void DownloadManager::markUninstalled(QString fileName) +{ + int index = indexByName(fileName); + if (index >= 0) { + markUninstalled(index); + } else { + DownloadInfo *info = getDownloadInfo(fileName); + if (info != nullptr) { + QSettings metaFile(info->m_Output.fileName() + ".meta", QSettings::IniFormat); + metaFile.setValue("uninstalled", true); + setState(info, STATE_UNINSTALLED); + } + } +} + + QString DownloadManager::getDownloadFileName(const QString &baseName) const { QString fullPath = m_OutputDirectory + "/" + baseName; diff --git a/src/downloadmanager.h b/src/downloadmanager.h index e63a0113..059c6cb5 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -314,6 +314,8 @@ public: */ void markUninstalled(int index); + void markUninstalled(QString download); + /** * @brief refreshes the list of downloads */ @@ -431,6 +433,7 @@ private slots: private: void createMetaFile(DownloadInfo *info); + DownloadManager::DownloadInfo* getDownloadInfo(QString fileName); public: diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d9d83231..48a09718 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1980,6 +1980,7 @@ void MainWindow::directory_refreshed() refreshDataTree(); updateProblemsButton(); statusBar()->hide(); + m_OrganizerCore.refreshESPList(); } void MainWindow::modorder_changed() @@ -2307,10 +2308,7 @@ void MainWindow::removeMod_clicked() void MainWindow::modRemoved(const QString &fileName) { if (!fileName.isEmpty() && !QFileInfo(fileName).isAbsolute()) { - int index = m_OrganizerCore.downloadManager()->indexByName(fileName); - if (index >= 0) { - m_OrganizerCore.downloadManager()->markUninstalled(index); - } + m_OrganizerCore.downloadManager()->markUninstalled(fileName); } } -- cgit v1.3.1 From 208eaccbf7f1fc0441861d55c68c4b66e5c7d387 Mon Sep 17 00:00:00 2001 From: Silarn Date: Sun, 8 Apr 2018 14:56:46 -0500 Subject: Updates to allow a full plugin data refresh in certain circumstances --- src/mainwindow.cpp | 5 ++--- src/organizercore.cpp | 16 ++++++++-------- src/organizercore.h | 2 +- src/pluginlist.cpp | 9 ++++++++- src/pluginlist.h | 3 ++- 5 files changed, 21 insertions(+), 14 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 48a09718..85e96993 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1980,7 +1980,6 @@ void MainWindow::directory_refreshed() refreshDataTree(); updateProblemsButton(); statusBar()->hide(); - m_OrganizerCore.refreshESPList(); } void MainWindow::modorder_changed() @@ -4811,7 +4810,7 @@ void MainWindow::on_bossButton_clicked() } m_IntegratedBrowser.openUrl(url); } - m_OrganizerCore.refreshESPList(); + m_OrganizerCore.refreshESPList(false); m_OrganizerCore.savePluginList(); } } @@ -4888,7 +4887,7 @@ void MainWindow::on_restoreButton_clicked() QMessageBox::critical(this, tr("Restore failed"), tr("Failed to restore the backup. Errorcode: %1").arg(windowsErrorString(::GetLastError()))); } - m_OrganizerCore.refreshESPList(); + m_OrganizerCore.refreshESPList(true); } } diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 0398e9ac..895b3b9c 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1107,7 +1107,7 @@ void OrganizerCore::spawnBinary(const QFileInfo &binary, const QString &argument } refreshDirectoryStructure(); - refreshESPList(); + refreshESPList(true); savePluginList(); //These callbacks should not fiddle with directoy structure and ESPs. @@ -1559,13 +1559,13 @@ void OrganizerCore::refreshModList(bool saveChanges) refreshDirectoryStructure(); } -void OrganizerCore::refreshESPList() +void OrganizerCore::refreshESPList(bool force) { if (m_DirectoryUpdate) { // don't mess up the esp list if we're currently updating the directory // structure - m_PostRefreshTasks.append([this]() { - this->refreshESPList(); + m_PostRefreshTasks.append([=]() { + this->refreshESPList(force); }); return; } @@ -1574,7 +1574,7 @@ void OrganizerCore::refreshESPList() // clear list try { m_PluginList.refresh(m_CurrentProfile->name(), *m_DirectoryStructure, - m_CurrentProfile->getLockedOrderFileName()); + m_CurrentProfile->getLockedOrderFileName(), force); } catch (const std::exception &e) { reportError(tr("Failed to refresh list of esps: %1").arg(e.what())); } @@ -1615,7 +1615,7 @@ void OrganizerCore::refreshBSAList() void OrganizerCore::refreshLists() { if ((m_CurrentProfile != nullptr) && m_DirectoryStructure->isPopulated()) { - refreshESPList(); + refreshESPList(true); refreshBSAList(); } // no point in refreshing lists if no files have been added to the directory // tree @@ -1678,7 +1678,7 @@ void OrganizerCore::updateModInDirectoryStructure(unsigned int index, modInfo->stealFiles()); DirectoryRefresher::cleanStructure(m_DirectoryStructure); // need to refresh plugin list now so we can activate esps - refreshESPList(); + refreshESPList(true); // activate all esps of the specified mod so the bsas get activated along with // it updateModActiveState(index, true); @@ -1839,7 +1839,7 @@ void OrganizerCore::modStatusChanged(unsigned int index) updateModInDirectoryStructure(index, modInfo); } else { updateModActiveState(index, false); - refreshESPList(); + refreshESPList(true); if (m_DirectoryStructure->originExists(ToWString(modInfo->name()))) { FilesOrigin &origin = m_DirectoryStructure->getOriginByName(ToWString(modInfo->name())); diff --git a/src/organizercore.h b/src/organizercore.h index 9e81f0c3..54d9dd6d 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -130,7 +130,7 @@ public: void prepareStart(); - void refreshESPList(); + void refreshESPList(bool force = false); void refreshBSAList(); void refreshDirectoryStructure(); diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 8bf438f1..9bbcdc11 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -140,8 +140,15 @@ void PluginList::highlightPlugins(const QItemSelection &selected, const MOShared void PluginList::refresh(const QString &profileName , const DirectoryEntry &baseDirectory - , const QString &lockedOrderFile) + , const QString &lockedOrderFile + , bool force) { + if (force) { + m_ESPs.clear(); + m_ESPsByName.clear(); + m_ESPsByPriority.clear(); + } + ChangeBracket layoutChange(this); QStringList primaryPlugins = m_GamePlugin->primaryPlugins(); diff --git a/src/pluginlist.h b/src/pluginlist.h index 4762f79f..f9173810 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -116,7 +116,8 @@ public: **/ void refresh(const QString &profileName , const MOShared::DirectoryEntry &baseDirectory - , const QString &lockedOrderFile); + , const QString &lockedOrderFile + , bool refresh); /** * @brief enable a plugin based on its name -- cgit v1.3.1 From 9465966b2c782a3b86ed933e868b306194289bbd Mon Sep 17 00:00:00 2001 From: Silarn Date: Mon, 9 Apr 2018 12:18:22 -0500 Subject: Created threaded process for writing mod meta files to prevent hangs --- src/mainwindow.cpp | 14 +++++++++----- src/mainwindow.h | 3 +++ src/nexusinterface.cpp | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 85e96993..1e2ec68b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -153,8 +153,6 @@ along with Mod Organizer. If not, see . #include #include -#include - #ifndef Q_MOC_RUN #include #include @@ -901,6 +899,8 @@ void MainWindow::cleanup() QWebEngineProfile::defaultProfile()->clearAllVisitedLinks(); m_IntegratedBrowser.close(); + m_SaveMetaTimer.stop(); + m_MetaSave.waitForFinished(); } @@ -1568,9 +1568,13 @@ void MainWindow::checkBSAList() void MainWindow::saveModMetas() { - for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) { - ModInfo::Ptr modInfo = ModInfo::getByIndex(i); - modInfo->saveMeta(); + if (m_MetaSave.isFinished()) { + m_MetaSave = QtConcurrent::run([this]() { + for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) { + ModInfo::Ptr modInfo = ModInfo::getByIndex(i); + modInfo->saveMeta(); + } + }); } } diff --git a/src/mainwindow.h b/src/mainwindow.h index d0957305..ef6eb262 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -63,6 +63,7 @@ namespace MOShared { class DirectoryEntry; } #include #include #include +#include class QAction; class QAbstractItemModel; @@ -336,6 +337,8 @@ private: QTimer m_SaveMetaTimer; QTimer m_UpdateProblemsTimer; + QFuture m_MetaSave; + QTime m_StartTime; //SaveGameInfoWidget *m_CurrentSaveView; MOBase::ISaveGameInfoWidget *m_CurrentSaveView; diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index eba02a6f..97186e8b 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -500,7 +500,7 @@ void NexusInterface::requestFinished(std::list::iterator iter) iter->m_URL = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toString(); iter->m_Reroute = true; m_RequestQueue.enqueue(*iter); - nextRequest(); + //nextRequest(); return; } QByteArray data = reply->readAll(); -- cgit v1.3.1 From c4bfee0089512e37a84742cf3981545bc0072413 Mon Sep 17 00:00:00 2001 From: Silarn Date: Tue, 10 Apr 2018 23:28:33 -0500 Subject: Prep for Qt 5.11 (backward-compatible) --- src/CMakeLists.txt | 8 ++++---- src/downloadmanager.cpp | 2 +- src/mainwindow.cpp | 1 + src/queryoverwritedialog.cpp | 2 ++ 4 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef009e03..fef640b3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED (VERSION 2.8) +CMAKE_MINIMUM_REQUIRED (VERSION 2.8.11) CMAKE_POLICY(SET CMP0020 NEW) #CMAKE_POLICY(SET CMP0043 NEW) @@ -249,6 +249,8 @@ FIND_PACKAGE(Qt5Quick REQUIRED) FIND_PACKAGE(Qt5Network REQUIRED) FIND_PACKAGE(Qt5WinExtras REQUIRED) FIND_PACKAGE(Qt5WebEngineWidgets REQUIRED) +FIND_PACKAGE(Qt5Script REQUIRED) +FIND_PACKAGE(Qt5Qml REQUIRED) FIND_PACKAGE(Qt5LinguistTools) QT5_WRAP_UI(organizer_UIHDRS ${organizer_UIS}) QT5_ADD_RESOURCES(organizer_RCCPPS ${organizer_QRCS}) @@ -314,6 +316,7 @@ ENDIF() ADD_EXECUTABLE(ModOrganizer WIN32 ${organizer_HDRS} ${organizer_SRCS} ${organizer_UIHDRS} ${organizer_RCS} ${organizer_RCCPPS} ${organizer_translations_qm}) TARGET_LINK_LIBRARIES(ModOrganizer Qt5::Widgets Qt5::WinExtras Qt5::WebEngineWidgets Qt5::Quick + Qt5::Script Qt5::Qml Qt5::QuickWidgets Qt5::Network ${Boost_LIBRARIES} zlibstatic uibase esptk bsatk githubpp @@ -327,9 +330,6 @@ SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/LARGEADDRESSAWARE ${OPTIMIZE_LINK_FLAGS}") -QT5_USE_MODULES(ModOrganizer Widgets Script Qml QuickWidgets Quick Network WebEngineWidgets) - - ############### ## Installation diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 8977492c..c935d20b 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -462,7 +462,7 @@ void DownloadManager::addNXMDownload(const QString &url) for (auto pair : m_PendingDownloads) { if (pair.first == nxmInfo.modId() && pair.second == nxmInfo.fileId()) { - qDebug("download requested is already started (mod id: %s, file id: %s)", qPrintable(nxmInfo.modId()), qPrintable(nxmInfo.fileId())); + qDebug("download requested is already started (mod id: %s, file id: %s)", qPrintable(QString(nxmInfo.modId())), qPrintable(QString(nxmInfo.fileId()))); QMessageBox::information(nullptr, tr("Already Started"), tr("A download for this mod file has already been queued."), QMessageBox::Ok); return; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1e2ec68b..0f66e505 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -89,6 +89,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include #include #include diff --git a/src/queryoverwritedialog.cpp b/src/queryoverwritedialog.cpp index 932b2637..eb67719d 100644 --- a/src/queryoverwritedialog.cpp +++ b/src/queryoverwritedialog.cpp @@ -20,6 +20,8 @@ along with Mod Organizer. If not, see . #include "queryoverwritedialog.h" #include "ui_queryoverwritedialog.h" +#include + QueryOverwriteDialog::QueryOverwriteDialog(QWidget *parent, Backup b) : QDialog(parent), ui(new Ui::QueryOverwriteDialog), m_Action(ACT_NONE) -- cgit v1.3.1 From e33da8402c9f843b2efe3883fba518bdd42bcdd3 Mon Sep 17 00:00:00 2001 From: Silarn Date: Wed, 11 Apr 2018 00:55:52 -0500 Subject: Allow multi-extract via archive origin entry in the BSA tab --- src/mainwindow.cpp | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0f66e505..abcb5312 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4290,27 +4290,40 @@ bool MainWindow::extractProgress(QProgressDialog &progress, int percentage, std: void MainWindow::extractBSATriggered() { QTreeWidgetItem *item = m_ContextItem; + QString origin; QString targetFolder = FileDialogMemory::getExistingDirectory("extractBSA", this, tr("Extract BSA")); + QStringList archives = {}; if (!targetFolder.isEmpty()) { - BSA::Archive archive; - QString originPath = QDir::fromNativeSeparators(ToQString(m_OrganizerCore.directoryStructure()->getOriginByName(ToWString(item->text(1))).getPath())); - QString archivePath = QString("%1\\%2").arg(originPath).arg(item->text(0)); - - BSA::EErrorCode result = archive.read(archivePath.toLocal8Bit().constData(), true); - if ((result != BSA::ERROR_NONE) && (result != BSA::ERROR_INVALIDHASHES)) { - reportError(tr("failed to read %1: %2").arg(archivePath).arg(result)); - return; + if (!item->parent()) { + for (int i = 0; i < item->childCount(); ++i) { + archives.append(item->child(i)->text(0)); + } + origin = QDir::fromNativeSeparators(ToQString(m_OrganizerCore.directoryStructure()->getOriginByName(ToWString(item->text(0))).getPath())); + } else { + origin = QDir::fromNativeSeparators(ToQString(m_OrganizerCore.directoryStructure()->getOriginByName(ToWString(item->text(1))).getPath())); + archives = QStringList({ item->text(0) }); } - QProgressDialog progress(this); - progress.setMaximum(100); - progress.setValue(0); - progress.show(); - archive.extractAll(QDir::toNativeSeparators(targetFolder).toLocal8Bit().constData(), - boost::bind(&MainWindow::extractProgress, this, boost::ref(progress), _1, _2)); - if (result == BSA::ERROR_INVALIDHASHES) { - reportError(tr("This archive contains invalid hashes. Some files may be broken.")); + for (auto archiveName : archives) { + BSA::Archive archive; + QString archivePath = QString("%1\\%2").arg(origin).arg(archiveName); + BSA::EErrorCode result = archive.read(archivePath.toLocal8Bit().constData(), true); + if ((result != BSA::ERROR_NONE) && (result != BSA::ERROR_INVALIDHASHES)) { + reportError(tr("failed to read %1: %2").arg(archivePath).arg(result)); + return; + } + + QProgressDialog progress(this); + progress.setMaximum(100); + progress.setValue(0); + progress.show(); + archive.extractAll(QDir::toNativeSeparators(targetFolder).toLocal8Bit().constData(), + boost::bind(&MainWindow::extractProgress, this, boost::ref(progress), _1, _2)); + if (result == BSA::ERROR_INVALIDHASHES) { + reportError(tr("This archive contains invalid hashes. Some files may be broken.")); + } + archive.close(); } } } -- cgit v1.3.1