summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-05-23 20:03:35 +0200
committerTannin <devnull@localhost>2013-05-23 20:03:35 +0200
commitdaf8bab1367334bb7f2332d4256f31c9db5ecec8 (patch)
tree5b687b2d57f03fea7c8158c80fcaf22cc88fcb73 /src
parentf0ba6ce95c1f30524453ce996fa536a888f018da (diff)
- bugfix: installation using custom installer always created mod directory
- batch installer now displays progress during mod installation
Diffstat (limited to 'src')
-rw-r--r--src/installationmanager.cpp4
-rw-r--r--src/mainwindow.cpp39
-rw-r--r--src/mainwindow.h3
3 files changed, 29 insertions, 17 deletions
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp
index fee6361a..98a8a760 100644
--- a/src/installationmanager.cpp
+++ b/src/installationmanager.cpp
@@ -716,9 +716,7 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString>
((filesTree == NULL) && installerCustom->isArchiveSupported(fileName)))) {
std::set<QString> installerExtensions = installerCustom->supportedExtensions();
if (installerExtensions.find(fileInfo.suffix()) != installerExtensions.end()) {
- if (testOverwrite(modName)) {
- installResult = installerCustom->install(modName, fileName);
- }
+ installResult = installerCustom->install(modName, fileName);
}
}
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4ba3f2dc..cf7ed487 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1059,9 +1059,13 @@ IModInterface *MainWindow::getMod(const QString &name)
}
-IModInterface *MainWindow::createMod(const QString &name)
+IModInterface *MainWindow::createMod(GuessedValue<QString> &name)
{
- QString fixedName = name;
+ if (!m_InstallationManager.testOverwrite(name)) {
+ return NULL;
+ }
+
+/* QString fixedName = name;
fixDirectoryName(fixedName);
unsigned int index = ModInfo::getIndex(fixedName);
if (index != UINT_MAX) {
@@ -1070,8 +1074,8 @@ IModInterface *MainWindow::createMod(const QString &name)
throw MyException(tr("The mod \"%1\" already exists!").arg(fixedName));
}
return result.data();
- } else {
- QString targetDirectory = QDir::fromNativeSeparators(m_Settings.getModDirectory()).append("/").append(fixedName.trimmed());
+ } else {*/
+ QString targetDirectory = QDir::fromNativeSeparators(m_Settings.getModDirectory()).append("/").append(name);
QSettings settingsFile(targetDirectory.mid(0).append("/meta.ini"), QSettings::IniFormat);
@@ -1081,7 +1085,7 @@ IModInterface *MainWindow::createMod(const QString &name)
settingsFile.setValue("category", 0);
settingsFile.setValue("installationFile", 0);
return ModInfo::createFrom(QDir(targetDirectory), &m_DirectoryStructure).data();
- }
+// }
}
bool MainWindow::removeMod(IModInterface *mod)
@@ -2795,14 +2799,21 @@ void MainWindow::syncOverwrite()
void MainWindow::createModFromOverwrite()
{
- QString name = QInputDialog::getText(this, tr("Create Mod..."),
- tr("This will move all files from overwrite into a new, regular mod."
- "Please enter a name: "));
- QString fixedName = fixDirectoryName(name);
- if (fixedName.isEmpty()) {
- reportError(tr("Invalid name"));
- return;
- } else if (getMod(fixedName) != NULL) {
+ GuessedValue<QString> name;
+ name.setFilter(&fixDirectoryName);
+
+ while (name->isEmpty()) {
+ bool ok;
+ name.update(QInputDialog::getText(this, tr("Create Mod..."),
+ tr("This will move all files from overwrite into a new, regular mod.\n"
+ "Please enter a name: "), QLineEdit::Normal, "", &ok),
+ GUESS_USER);
+ if (!ok) {
+ return;
+ }
+ }
+
+ if (getMod(name) != NULL) {
reportError(tr("A mod with this name already exists"));
return;
}
@@ -2812,6 +2823,8 @@ void MainWindow::createModFromOverwrite()
ModInfo::Ptr overwriteInfo = ModInfo::getByIndex(m_ContextRow);
shellMove(QStringList(overwriteInfo->absolutePath() + "\\*"), QStringList(newMod->absolutePath()), this);
+
+ refreshModList();
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 24cdb91e..9626c5ba 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -50,6 +50,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "pluginlistsortproxy.h"
#include "tutorialcontrol.h"
#include "savegameinfowidgetgamebryo.h"
+#include <guessedvalue.h>
namespace Ui {
class MainWindow;
@@ -100,7 +101,7 @@ public:
virtual QString downloadsPath() const;
virtual MOBase::VersionInfo appVersion() const;
virtual MOBase::IModInterface *getMod(const QString &name);
- virtual MOBase::IModInterface *createMod(const QString &name);
+ virtual MOBase::IModInterface *createMod(MOBase::GuessedValue<QString> &name);
virtual bool removeMod(MOBase::IModInterface *mod);
virtual void modDataChanged(MOBase::IModInterface *mod);
virtual QVariant pluginSetting(const QString &pluginName, const QString &key) const;