diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/archivefiletree.cpp | 19 | ||||
| -rw-r--r-- | src/createinstancedialogpages.cpp | 7 | ||||
| -rw-r--r-- | src/downloadmanager.cpp | 5 | ||||
| -rw-r--r-- | src/installationmanager.cpp | 2 | ||||
| -rw-r--r-- | src/instancemanager.cpp | 32 | ||||
| -rw-r--r-- | src/instancemanager.h | 10 | ||||
| -rw-r--r-- | src/instancemanagerdialog.cpp | 7 | ||||
| -rw-r--r-- | src/modlist.cpp | 2 | ||||
| -rw-r--r-- | src/modlistview.cpp | 2 | ||||
| -rw-r--r-- | src/modlistviewactions.cpp | 2 | ||||
| -rw-r--r-- | src/profile.cpp | 2 | ||||
| -rw-r--r-- | src/profileinputdialog.cpp | 2 | ||||
| -rw-r--r-- | src/profilesdialog.cpp | 2 | ||||
| -rw-r--r-- | src/tutorials/TutorialOverlay.qml | 5 | ||||
| -rw-r--r-- | src/tutorials/tutorial_conflictresolution_main.js | 2 | ||||
| -rw-r--r-- | src/tutorials/tutorial_firststeps_main.js | 4 | ||||
| -rw-r--r-- | src/tutorials/tutorial_primer_main.js | 4 |
17 files changed, 43 insertions, 66 deletions
diff --git a/src/archivefiletree.cpp b/src/archivefiletree.cpp index 1fbf3195..11e165b8 100644 --- a/src/archivefiletree.cpp +++ b/src/archivefiletree.cpp @@ -158,14 +158,14 @@ protected: currentName = std::get<0>(p)[0]; } - // If the name is different, we need to create a directory from what we have + // If the name is different, we need to create a directory from what we have // accumulated: if (currentName != std::get<0>(p)[0]) { // We may or may not have an index here, it depends on the type of archive (some archives list // intermediate non-empty folders, some don't): entries.push_back(std::make_shared<ArchiveFileTreeImpl>(parent, currentName, currentIndex, std::move(currentFiles))); - + currentFiles.clear(); // Back to a valid state. // Reset the index: @@ -200,7 +200,7 @@ protected: if (currentName != "") { entries.push_back(std::make_shared<ArchiveFileTreeImpl>(parent, currentName, currentIndex, std::move(currentFiles))); } - + // Let the parent class sort the entries: return false; } @@ -214,7 +214,7 @@ private: mutable std::vector<File> m_Files; }; -std::shared_ptr<ArchiveFileTree> ArchiveFileTree::makeTree(Archive const& archive) +std::shared_ptr<ArchiveFileTree> ArchiveFileTree::makeTree(Archive const& archive) { auto const& data = archive.getFileList(); @@ -222,9 +222,16 @@ std::shared_ptr<ArchiveFileTree> ArchiveFileTree::makeTree(Archive const& archiv files.reserve(data.size()); for (size_t i = 0; i < data.size(); ++i) { + // Ignore "." and ".." as they're useless and muck things up + if (data[i]->getArchiveFilePath().compare(L".") == 0 || + data[i]->getArchiveFilePath().compare(L"..") == 0) + { + continue; + } + files.push_back(std::make_tuple( - QString::fromStdWString(data[i]->getArchiveFilePath()).replace("\\", "/").split("/", Qt::SkipEmptyParts), - data[i]->isDirectory(), + QString::fromStdWString(data[i]->getArchiveFilePath()).replace("\\", "/").split("/", Qt::SkipEmptyParts), + data[i]->isDirectory(), (int) i)); } diff --git a/src/createinstancedialogpages.cpp b/src/createinstancedialogpages.cpp index c337ba86..09026fa4 100644 --- a/src/createinstancedialogpages.cpp +++ b/src/createinstancedialogpages.cpp @@ -8,6 +8,7 @@ #include <iplugingame.h> #include <report.h> #include <utility.h> +#include "filesystemutilities.h" namespace cid { @@ -856,7 +857,7 @@ QString NamePage::selectedInstanceName() const } const auto text = ui->instanceName->text().trimmed(); - return InstanceManager::singleton().sanitizeInstanceName(text); + return MOBase::sanitizeFileName(text); } void NamePage::onChanged() @@ -883,7 +884,7 @@ bool NamePage::checkName(QString parentDir, QString name) if (name.isEmpty()) { empty = true; } else { - if (InstanceManager::singleton().validInstanceName(name)) { + if (MOBase::validFileName(name)) { exists = QDir(parentDir).exists(name); } else { invalid = true; @@ -1108,7 +1109,7 @@ bool PathsPage::checkPath( } else { const QDir d(path); - if (m.validInstanceName(d.dirName())) { + if (MOBase::validFileName(d.dirName())) { if (m_dlg.rawCreationInfo().type == CreateInstanceDialog::Portable) { // the default data path for a portable instance is the application // directory, so it's not an error if it exists diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 676b43de..4c8e820f 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -33,6 +33,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "shared/util.h" #include <utility.h> #include <report.h> +#include "filesystemutilities.h" #include <QTimer> #include <QFileInfo> @@ -1456,7 +1457,7 @@ void DownloadManager::markUninstalled(QString fileName) QString DownloadManager::getDownloadFileName(const QString &baseName, bool rename) const { - QString fullPath = m_OutputDirectory + "/" + baseName; + QString fullPath = m_OutputDirectory + "/" + MOBase::sanitizeFileName(baseName); if (QFile::exists(fullPath) && rename) { int i = 1; while (QFile::exists(QString("%1/%2_%3").arg(m_OutputDirectory).arg(i).arg(baseName))) { @@ -1476,7 +1477,7 @@ QString DownloadManager::getFileNameFromNetworkReply(QNetworkReply *reply) std::cmatch result; if (std::regex_search(reply->rawHeader("Content-Disposition").constData(), result, exp)) { - return QString::fromUtf8(result.str(1).c_str()); + return MOBase::sanitizeFileName(QString::fromUtf8(result.str(1).c_str())); } } diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index ad7cdcd5..0ba82a5c 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -21,7 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "installationmanager.h" -#include "utility.h" +#include "filesystemutilities.h" #include "report.h" #include "categories.h" #include "questionboxmemory.h" diff --git a/src/instancemanager.cpp b/src/instancemanager.cpp index a1b17577..e7474584 100644 --- a/src/instancemanager.cpp +++ b/src/instancemanager.cpp @@ -32,6 +32,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <iplugingame.h> #include <utility.h> #include <log.h> +#include "filesystemutilities.h" #include <QCoreApplication> #include <QDir> @@ -721,7 +722,7 @@ const MOBase::IPluginGame* InstanceManager::gamePluginForDirectory( QString InstanceManager::makeUniqueName(const QString& instanceName) const { - const QString sanitized = sanitizeInstanceName(instanceName); + const QString sanitized = MOBase::sanitizeFileName(instanceName); // trying "name (N)" QString name = sanitized; @@ -742,35 +743,6 @@ bool InstanceManager::instanceExists(const QString& instanceName) const return root.exists(instanceName); } -QString InstanceManager::sanitizeInstanceName(const QString &name) const -{ - QString new_name = name; - - // Restrict the allowed characters - new_name = new_name.remove(QRegExp("[^A-Za-z0-9 _=+;!@#$%^'\\-\\.\\[\\]\\{\\}\\(\\)]")); - - // Don't end in spaces and periods - new_name = new_name.remove(QRegExp("\\.*$")); - new_name = new_name.remove(QRegExp(" *$")); - - // Recurse until stuff stops changing - if (new_name != name) { - return sanitizeInstanceName(new_name); - } - return new_name; -} - -bool InstanceManager::validInstanceName(const QString& instanceName) const -{ - if (instanceName.isEmpty()) { - return false; - } - - return (instanceName == sanitizeInstanceName(instanceName)); -} - - - std::unique_ptr<Instance> selectInstance() { auto& m = InstanceManager::singleton(); diff --git a/src/instancemanager.h b/src/instancemanager.h index f1781a70..7174ec3a 100644 --- a/src/instancemanager.h +++ b/src/instancemanager.h @@ -305,10 +305,6 @@ public: // std::vector<QString> globalInstancePaths() const; - // returns `name` modified so that it is a valid instance name - // - QString sanitizeInstanceName(const QString &name) const; - // sanitizes the given instance name and either // 1) returns it if there is no instance with this name // 2) tries to add " (N)" at the end until it works @@ -321,12 +317,6 @@ public: // bool instanceExists(const QString& instanceName) const; - // returns whether the given instance name would be a valid name; this does - // not check whether the instance already exists, it's basiscally just a check - // against what sanitizeInstanceName() returns - // - bool validInstanceName(const QString& instanceName) const; - // returns the absolute path of a global instance with the given name; this // does not check if the name is valid or if exists // diff --git a/src/instancemanagerdialog.cpp b/src/instancemanagerdialog.cpp index 1fd43128..f21ff695 100644 --- a/src/instancemanagerdialog.cpp +++ b/src/instancemanagerdialog.cpp @@ -10,6 +10,7 @@ #include <utility.h> #include <report.h> #include <iplugingame.h> +#include "filesystemutilities.h" using namespace MOBase; @@ -109,10 +110,10 @@ QString getInstanceName( if (text->text().isEmpty()) { error->setText(""); - } else if (!m.validInstanceName(text->text())) { + } else if (!MOBase::validFileName(text->text())) { error->setText(QObject::tr("The instance name must be a valid folder name.")); } else { - const auto name = m.sanitizeInstanceName(text->text()); + const auto name = MOBase::sanitizeFileName(text->text()); if ((name != oldName) && m.instanceExists(text->text())) { error->setText(QObject::tr("An instance with this name already exists.")); @@ -136,7 +137,7 @@ QString getInstanceName( return {}; } - return m.sanitizeInstanceName(text->text()); + return MOBase::sanitizeFileName(text->text()); } diff --git a/src/modlist.cpp b/src/modlist.cpp index 48f65d3a..eccba831 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -34,7 +34,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "shared/filesorigin.h" #include "shared/appconfig.h" -#include <utility.h> +#include "filesystemutilities.h" #include <report.h> #include <QFileInfo> diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 2dcd9f92..80ac5c28 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -5,7 +5,7 @@ #include <widgetutility.h>
-#include <utility.h>
+#include "filesystemutilities.h"
#include <report.h>
#include "ui_mainwindow.h"
diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index acf765f6..f72e8d0c 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -8,7 +8,7 @@ #include <log.h> #include <report.h> -#include <utility.h> +#include "filesystemutilities.h" #include "categories.h" #include "filedialogmemory.h" diff --git a/src/profile.cpp b/src/profile.cpp index f43ac3a1..42a2ad16 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -21,7 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "modinfo.h" #include "settings.h" -#include <utility.h> +#include "filesystemutilities.h" #include "shared/appconfig.h" #include <iplugingame.h> #include <report.h> diff --git a/src/profileinputdialog.cpp b/src/profileinputdialog.cpp index 5a1fd03c..48b35b82 100644 --- a/src/profileinputdialog.cpp +++ b/src/profileinputdialog.cpp @@ -19,7 +19,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "profileinputdialog.h"
#include "ui_profileinputdialog.h"
-#include <utility.h>
+#include "filesystemutilities.h"
ProfileInputDialog::ProfileInputDialog(QWidget *parent) :
QDialog(parent),
diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp index d71a4531..3ab70936 100644 --- a/src/profilesdialog.cpp +++ b/src/profilesdialog.cpp @@ -28,7 +28,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "profileinputdialog.h"
#include "report.h"
#include "transfersavesdialog.h"
-#include "utility.h"
+#include "filesystemutilities.h"
#include "settings.h"
#include "localsavegames.h"
diff --git a/src/tutorials/TutorialOverlay.qml b/src/tutorials/TutorialOverlay.qml index 47e5065d..8c2a36e7 100644 --- a/src/tutorials/TutorialOverlay.qml +++ b/src/tutorials/TutorialOverlay.qml @@ -55,7 +55,10 @@ Rectangle { Connections {
target: manager
- onTabChanged: tabChanged(index)
+ function onTabChanged(index)
+ {
+ tabChanged(index)
+ }
}
Tooltip {
diff --git a/src/tutorials/tutorial_conflictresolution_main.js b/src/tutorials/tutorial_conflictresolution_main.js index a2aa278d..46518a93 100644 --- a/src/tutorials/tutorial_conflictresolution_main.js +++ b/src/tutorials/tutorial_conflictresolution_main.js @@ -76,7 +76,7 @@ function getTutorialSteps() { tutorial.text = qsTr("... here, if you mark the highlighted control, the tree will only display files in conflict. "
+"In the right column, it says which mod currently provides the mod (because it has highest priority) "
+"and if you hover your mouse over that info, it will list which other mods contains it.")
- highlightItem("conflictsCheckBox", false)
+ highlightItem("dataTabShowOnlyConflicts", false)
waitForClick()
},
function() {
diff --git a/src/tutorials/tutorial_firststeps_main.js b/src/tutorials/tutorial_firststeps_main.js index 96bfd0e7..76faf973 100644 --- a/src/tutorials/tutorial_firststeps_main.js +++ b/src/tutorials/tutorial_firststeps_main.js @@ -72,8 +72,10 @@ function getTutorialSteps() tutorial.text = qsTr("There are a few ways to get mods into ModOrganizer. "
+ "If you associated MO with NXM links in the settings you can now use your regular browser to send downloads from Nexus to MO. "
+ "Click on \"Nexus\" to open nexus, find a mod and click the green download buttons on Nexus saying \"Download with Manager\".")
- if (tutorialControl.waitForAction("actionNexus")) {
+ if (tutorialControl.waitForAction("actionNexus") &&
+ tutorialControl.waitForAction("actionModPage")) {
highlightAction("actionNexus", true)
+ highlightAction("actionModPage", true)
} else {
console.error("browser action broken")
waitForClick()
diff --git a/src/tutorials/tutorial_primer_main.js b/src/tutorials/tutorial_primer_main.js index 95faa33d..640364cb 100644 --- a/src/tutorials/tutorial_primer_main.js +++ b/src/tutorials/tutorial_primer_main.js @@ -90,7 +90,9 @@ function setupTooptips() { tooltipAction("actionChange_Game", qsTr("Change/manage MO2 instances or switch to portable mode."))
tooltipAction("actionInstallMod", qsTr("Browse to and manually install a mod from an archive on your computer."))
tooltipAction("actionNexus", qsTr("Automatically open NexusMods to browse and install mods via the API."))
+ tooltipAction("actionModPage", qsTr("Automatically open NexusMods to browse and install mods via the API."))
tooltipAction("actionAdd_Profile", qsTr("Manage your MO2 profiles."))
+ tooltipAction("action_Refresh", qsTr("Refresh everything."))
tooltipAction("actionModify_Executables", qsTr("Open the executable editor to add and modify applications you wish to run with MO2."))
tooltipAction("actionTool", qsTr("Select from a collection of additional tools, such as an INI editor, integrated FNIS updater, and more."))
tooltipAction("actionSettings", qsTr("Configure Mod Organizer."))
@@ -136,5 +138,3 @@ function getTutorialSteps() { }
]
}
-
-
|
