diff options
| author | Tannin <devnull@localhost> | 2013-05-23 20:03:35 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-05-23 20:03:35 +0200 |
| commit | daf8bab1367334bb7f2332d4256f31c9db5ecec8 (patch) | |
| tree | 5b687b2d57f03fea7c8158c80fcaf22cc88fcb73 /src/mainwindow.cpp | |
| parent | f0ba6ce95c1f30524453ce996fa536a888f018da (diff) | |
- bugfix: installation using custom installer always created mod directory
- batch installer now displays progress during mod installation
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
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(); } |
