Compare commits

...
Author SHA1 Message Date
Tannin c57b172204 - removed some obsolete code
- MO will no longer start an application while the directory structure is being refreshed because MO may need to access profile files afterwards
- bugfix: the overwrite info-dialog was not destroyed and could thus keep a lock on files thus preventing those files from being moved/deleted
2013-09-22 13:10:21 +02:00
Tannin dfca8be71b - esp reader now handles invalid files more gracefully
- files moved will now also be treated as "deleted" in the old location so a newly created file with that same name is not created in overwrite
- introduced a mechanism by which MO can recognize if it crashed before when attempting to load a plugin. That plugin can be blacklisted so it doesn't get loaded again
- plugins can now programaticaly change their settings
- plugins can now store data persistently without exposing that data as settings
- requesting an unset-setting from a plugin is no longer treated as a bug
- clarified warning message for when files are in overwrite directory
- the proxyPython plugin will now discover if python initialization crashed MO on a previous session and give the user a chance to fix it or disable the plugin
- bugfix: GetModuleFileName modified the buffer past the zero termination. While this doesn't violate the API documentation it is different from the regular windows implementation
- bugfix: proxy plugins couldn't access the parent widget
- bugfix: when moving a file from overwrite to a mod the in-memory file structure wasn't updated
- bugfix: name input dialog for profiles allowed names that weren't valid directory names
- bugfix: profile dialog wasn't able to delete profiles if the name started or ended in whitespaces
- bugfix: The name-cells for plugin settings could be changed (without effect)
- removed a few obsolete files from the repository
2013-09-21 19:25:33 +02:00
Tannin 08037bf876 Added tag release v1.0.1 for changeset b90a2e9174c0 2013-09-21 18:59:47 +02:00
Tannin 500ab7f706 - bugfix: testing for missing masters at the wrong time seems to have caused crashes
- bugfix: mod list is now written to a temporary file first. Only on success is the original file overwritten
- bugfix: moving a mod priority to just above the overwrite could cause a crash or error message
- bugfix: versions with a release candidate number weren't sorted correctly (woops)
- bugfix: staging script didn't include archive.dll and dlls.manifest
- installation time on overwrite no longer updates constantly
2013-09-16 22:32:42 +02:00
Tannin 08309b71ba Added tag release v1.0.0rc1 for changeset 438584941a82 2013-09-15 16:11:16 +02:00
Tannin dce78b62b8 - bugfix: when installing mods through the nmm importer if no other mods were previously installed
the correct installation directory was never set
- bugfix: the nmm importer didn't "sanitize" mod names and potentially tried to create invalid directories
- bugfix: 0.99.x packages didn't contain qt plugins to handle certain image formats
2013-09-12 21:45:57 +02:00
Tannin af6e1c3ab4 - when installing mods from outside the download directory the absolute path is now stored
- added a context menu to the toolbar buttons so tool icons can be removed directly
- initweaks modinfo tab is now always available and allows new ini tweaks to be created
- fake esms are now treated as masters (as they should)
- MO will now display a warning if not all masters of an esp are enabled. The tooltip gives a list of required masters
- bugfix: path returned by getfullpathname was sometimes not correctly terminated
- bugfix: path after reverse-rerouting was sometimes incorrect, missing a path separator
- bugfix: change of current directory sometimes used a fake directory without need
- bugfix: icons in shortcut menu were not alwayscorrectly updated
2013-09-11 22:54:45 +02:00
Tannin 50325c8fc2 Added tag release v0.99.6 for changeset d9dedb857683 2013-09-05 21:14:19 +02:00
Tannin 7a382eab75 updated versions 2013-09-05 21:14:08 +02:00
Tannin 8e6868bf88 - bugfix: automatically removes a file from old NCC release that was interfering with the current version
- bugfix: fomod installer didn't find fomod files in nested folder
- bugfix: python proxy will now not even try to initialize python if python_dir contains no python.
This is necessary because the python interpreter crashes the application if the path is invalid
2013-09-05 21:04:20 +02:00
Tannin a891146446 Added tag release v0.99.5 for changeset f75473410ed3 2013-09-02 19:28:24 +02:00
43 changed files with 759 additions and 624 deletions
+2 -1
View File
@@ -13,7 +13,8 @@ SUBDIRS = bsatk \
proxydll \
nxmhandler \
BossDummy \
pythonRunner
pythonRunner \
esptk
hookdll.depends = shared
organizer.depends = shared, uibase, plugins
-5
View File
@@ -65,11 +65,6 @@ ActivateModsDialog::~ActivateModsDialog()
}
void ActivateModsDialog::on_buttonBox_accepted()
{
}
std::set<QString> ActivateModsDialog::getModsToActivate()
{
std::set<QString> result;
-1
View File
@@ -62,7 +62,6 @@ public:
std::set<QString> getESPsToActivate();
private slots:
void on_buttonBox_accepted();
private:
Ui::ActivateModsDialog *ui;
-98
View File
@@ -1,98 +0,0 @@
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "archivetree.h"
#include <QDragMoveEvent>
ArchiveTree::ArchiveTree(QWidget *parent) :
QTreeWidget(parent)
{
}
bool ArchiveTree::testMovePossible(QTreeWidgetItem *source, QTreeWidgetItem *target)
{
if ((target == NULL) ||
(source == NULL)) {
return false;
}
if ((source == target) ||
(source->parent() == target)) {
return false;
}
return true;
}
void ArchiveTree::dragEnterEvent(QDragEnterEvent *event)
{
QTreeWidgetItem *source = this->currentItem();
if ((source == NULL) || (source->parent() == NULL)) {
// can't change top level
event->ignore();
return;
} else {
QTreeWidget::dragEnterEvent(event);
}
}
void ArchiveTree::dragMoveEvent(QDragMoveEvent *event)
{
if (!testMovePossible(this->currentItem(), itemAt(event->pos()))) {
event->ignore();
} else {
QTreeWidget::dragMoveEvent(event);
}
}
void ArchiveTree::dropEvent(QDropEvent *event)
{
event->ignore();
QTreeWidgetItem *target = itemAt(event->pos());
QList<QTreeWidgetItem*> sourceItems = this->selectedItems();
for (QList<QTreeWidgetItem*>::iterator iter = sourceItems.begin();
iter != sourceItems.end(); ++iter) {
QTreeWidgetItem *source = *iter;
if ((source->parent() != NULL) &&
testMovePossible(source, target)) {
source->parent()->removeChild(source);
if (target->data(0, Qt::UserRole).toInt() != 0) {
// target is a file
if (target->parent() == NULL) {
// this should really not happen, how should a
// file get to the top level?
return;
}
int index = target->parent()->indexOfChild(target);
target->parent()->insertChild(index, source);
emit changed();
} else {
// target is a directory
target->insertChild(target->childCount(), source);
emit changed();
}
}
}
}
-55
View File
@@ -1,55 +0,0 @@
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ARCHIVETREE_H
#define ARCHIVETREE_H
#include <QTreeWidget>
/**
* @brief QT tree widget used to display the content of an archive in the manual installation dialog
**/
class ArchiveTree : public QTreeWidget
{
Q_OBJECT
public:
explicit ArchiveTree(QWidget *parent = 0);
signals:
void changed();
public slots:
protected:
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dragMoveEvent(QDragMoveEvent *event);
virtual void dropEvent(QDropEvent *event);
private:
bool testMovePossible(QTreeWidgetItem *source, QTreeWidgetItem *target);
};
#endif // ARCHIVETREE_H
+1 -1
View File
@@ -150,7 +150,7 @@ void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionView
}
m_InstallLabel->setPalette(labelPalette);
if (m_Manager->isInfoIncomplete(downloadIndex)) {
m_NameLabel->setText("<img src=\":/MO/gui/resources/dialog-warning_16.png\" /> " + m_NameLabel->text());
m_NameLabel->setText("<img src=\":/MO/gui/warning_16\" /> " + m_NameLabel->text());
}
} else {
m_InstallLabel->setVisible(false);
+1 -1
View File
@@ -137,7 +137,7 @@ void DownloadListWidgetCompactDelegate::paint(QPainter *painter, const QStyleOpt
m_DoneLabel->setForegroundRole(QPalette::WindowText);
}
if (m_Manager->isInfoIncomplete(downloadIndex)) {
m_NameLabel->setText("<img src=\":/MO/gui/resources/dialog-warning_16.png\"/> " + m_NameLabel->text());
m_NameLabel->setText("<img src=\":/MO/gui/warning_16\"/> " + m_NameLabel->text());
}
} else {
m_DoneLabel->setVisible(false);
-10
View File
@@ -172,16 +172,6 @@ void ExecutablesList::addExecutable(const QString &title, const QString &executa
}
}
/*void ExecutablesList::remove(const QString &executableName)
{
for (std::vector<Executable>::iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) {
if (iter->m_Custom && (iter->m_BinaryInfo.absoluteFilePath() == executableName)) {
m_Executables.erase(iter);
break;
}
}
}*/
void ExecutablesList::remove(const QString &title)
{
-48
View File
@@ -1,48 +0,0 @@
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "finddialog.h"
#include "ui_finddialog.h"
FindDialog::FindDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::FindDialog)
{
ui->setupUi(this);
}
FindDialog::~FindDialog()
{
delete ui;
}
void FindDialog::on_nextBtn_clicked()
{
emit findNext();
}
void FindDialog::on_patternEdit_textChanged(const QString &pattern)
{
emit patternChanged(pattern);
}
void FindDialog::on_closeBtn_clicked()
{
this->close();
}
-73
View File
@@ -1,73 +0,0 @@
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FINDDIALOG_H
#define FINDDIALOG_H
#include <QDialog>
namespace Ui {
class FindDialog;
}
/**
* @brief Find dialog used in the TextView dialog
**/
class FindDialog : public QDialog
{
Q_OBJECT
public:
/**
* @brief constructor
*
* @param parent parent widget
**/
explicit FindDialog(QWidget *parent = 0);
~FindDialog();
signals:
/**
* @brief emitted when the user wants to jump to the next location matching the pattern
**/
void findNext();
/**
* @brief emitted when the user changes the pattern to search for
*
* @param pattern the new search pattern
**/
void patternChanged(const QString &pattern);
private slots:
void on_nextBtn_clicked();
void on_patternEdit_textChanged(const QString &arg1);
void on_closeBtn_clicked();
private:
Ui::FindDialog *ui;
};
#endif // FINDDIALOG_H
+6 -3
View File
@@ -431,7 +431,7 @@ QString InstallationManager::generateBackupName(const QString &directoryName) co
bool InstallationManager::testOverwrite(GuessedValue<QString> &modName) const
{
QString targetDirectory = QDir::fromNativeSeparators(m_ModsDirectory.mid(0).append("\\").append(modName));
QString targetDirectory = QDir::fromNativeSeparators(m_ModsDirectory + "\\" + modName);
while (QDir(targetDirectory).exists()) {
QueryOverwriteDialog overwriteDialog(m_ParentWidget);
@@ -664,8 +664,11 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString>
modName.update(guessedModName, GUESS_GOOD);
}
qDebug("using mod name \"%s\" (id %d)", modName->toUtf8().constData(), modID);
m_CurrentFile = fileInfo.fileName();
m_CurrentFile = fileInfo.absoluteFilePath();
if (fileInfo.dir() == QDir(ToQString(GameInfo::instance().getDownloadDir()))) {
m_CurrentFile = fileInfo.fileName();
}
qDebug("using mod name \"%s\" (id %d) -> %s", modName->toUtf8().constData(), modID, qPrintable(m_CurrentFile));
// open the archive and construct the directory tree the installers work on
bool archiveOpen = m_CurrentArchive->open(ToWString(QDir::toNativeSeparators(fileName)).c_str(),
+5
View File
@@ -57,6 +57,11 @@ public:
~InstallationManager();
/**
* @brief update the directory where mods are to be installed
* @param modsDirectory the mod directory
* @note this is called a lot, probably redundantly
*/
void setModsDirectory(const QString &modsDirectory) { m_ModsDirectory = modsDirectory; }
/**
+2 -11
View File
@@ -182,16 +182,7 @@ void cleanupDir()
"QtXml4.dll",
"QtWebKit4.dll",
"qjpeg4.dll",
/* "dlls/phonon4.dll",
"dlls/QtCore4.dll",
"dlls/QtGui4.dll",
"dlls/QtNetwork4.dll",
"dlls/QtXml4.dll",
"dlls/QtXmlPatterns4.dll",
"dlls/QtWebKit4.dll",
"dlls/QtDeclarative4.dll",
"dlls/QtScript4.dll",
"dlls/QtSql4.dll"*/
"NCC/GamebryoBase.dll"
};
static const int NUM_FILES = sizeof(fileNames) / sizeof(QString);
@@ -352,7 +343,7 @@ int main(int argc, char *argv[])
bool done = false;
while (!done) {
if (!GameInfo::init(moPath, ToWString(gamePath))) {
if (!GameInfo::init(moPath, ToWString(QDir::toNativeSeparators(gamePath)))) {
if (!gamePath.isEmpty()) {
reportError(QObject::tr("No game identified in \"%1\". The directory is required to contain "
"the game binary and its launcher.").arg(gamePath));
+154 -28
View File
@@ -98,6 +98,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QNetworkInterface>
#include <QNetworkProxy>
#include <QtConcurrentRun>
#include <QCoreApplication>
#ifdef TEST_MODELS
@@ -144,7 +145,7 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget
m_InstallationManager(this), m_Translator(NULL), m_TranslatorQt(NULL),
m_Updater(NexusInterface::instance(), this), m_CategoryFactory(CategoryFactory::instance()),
m_CurrentProfile(NULL), m_AskForNexusPW(false), m_LoginAttempted(false),
m_ArchivesInit(false), m_ContextItem(NULL), m_CurrentSaveView(NULL),
m_ArchivesInit(false), m_ContextItem(NULL), m_ContextAction(NULL), m_CurrentSaveView(NULL),
m_GameInfo(new GameInfoImpl())
{
ui->setupUi(this);
@@ -213,6 +214,8 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget
NexusInterface::instance()->setCacheDirectory(m_Settings.getCacheDirectory());
NexusInterface::instance()->setNMMVersion(m_Settings.getNMMVersion());
m_InstallationManager.setModsDirectory(m_Settings.getModDirectory());
updateDownloadListDelegate();
ui->savegameList->installEventFilter(this);
@@ -231,6 +234,7 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget
connect(&m_ModList, SIGNAL(modlist_changed(QModelIndex, int)), this, SLOT(modlistChanged(QModelIndex, int)));
connect(&m_ModList, SIGNAL(removeSelectedMods()), this, SLOT(removeMod_clicked()));
connect(&m_ModList, SIGNAL(requestColumnSelect(QPoint)), this, SLOT(displayColumnSelection(QPoint)));
connect(&m_ModList, SIGNAL(fileMoved(QString, QString, QString)), this, SLOT(fileMoved(QString, QString, QString)));
connect(ui->modList, SIGNAL(dropModeUpdate(bool)), &m_ModList, SLOT(dropModeUpdate(bool)));
connect(m_ModListSortProxy, SIGNAL(filterActive(bool)), this, SLOT(modFilterActive(bool)));
connect(ui->modFilterEdit, SIGNAL(textChanged(QString)), m_ModListSortProxy, SLOT(updateFilter(QString)));
@@ -261,6 +265,8 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget
connect(&TutorialManager::instance(), SIGNAL(windowTutorialFinished(QString)), this, SLOT(windowTutorialFinished(QString)));
connect(ui->toolBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(toolBar_customContextMenuRequested(QPoint)));
connect(this, SIGNAL(styleChanged(QString)), this, SLOT(updateStyle(QString)));
m_CheckBSATimer.setSingleShot(true);
@@ -993,6 +999,7 @@ bool MainWindow::registerPlugin(QObject *plugin)
{ // proxy plugins
IPluginProxy *proxy = qobject_cast<IPluginProxy*>(plugin);
if (verifyPlugin(proxy)) {
proxy->setParentWidget(this);
QStringList pluginNames = proxy->pluginList(QCoreApplication::applicationDirPath() + "/" + ToQString(AppConfig::pluginPath()));
foreach (const QString &pluginName, pluginNames) {
try {
@@ -1036,11 +1043,38 @@ void MainWindow::loadPlugins()
registerPlugin(plugin);
}
QFile loadCheck(QCoreApplication::applicationDirPath() + "/plugin_loadcheck.tmp");
if (loadCheck.exists() && loadCheck.open(QIODevice::ReadOnly)) {
// oh, there was a failed plugin load last time. Find out which plugin was loaded last
QString fileName;
while (!loadCheck.atEnd()) {
fileName = QString::fromUtf8(loadCheck.readLine().constData()).trimmed();
}
if (QMessageBox::question(this, tr("Plugin error"),
tr("It appears the plugin \"%1\" failed to load last startup and caused MO to crash. Do you want to disable it?\n"
"(Please note: If this is the first time you see this message for this plugin you may want to give it another try. "
"The plugin may be able to recover from the problem)").arg(fileName),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
m_Settings.addBlacklistPlugin(fileName);
}
loadCheck.close();
}
loadCheck.open(QIODevice::WriteOnly);
QString pluginPath = QDir::fromNativeSeparators(ToQString(GameInfo::instance().getOrganizerDirectory())) + "/" + ToQString(AppConfig::pluginPath());
qDebug("looking for plugins in %s", QDir::toNativeSeparators(pluginPath).toUtf8().constData());
QDirIterator iter(pluginPath, QDir::Files | QDir::NoDotAndDotDot);
while (iter.hasNext()) {
iter.next();
if (m_Settings.pluginBlacklisted(iter.fileName())) {
qDebug("plugin \"%s\" blacklisted", qPrintable(iter.fileName()));
continue;
}
loadCheck.write(iter.fileName().toUtf8());
loadCheck.write("\n");
loadCheck.flush();
QString pluginName = iter.filePath();
if (QLibrary::isLibrary(pluginName)) {
QPluginLoader pluginLoader(pluginName);
@@ -1059,6 +1093,9 @@ void MainWindow::loadPlugins()
}
}
// remove the load check file on success
loadCheck.remove();
m_DownloadManager.setSupportedExtensions(m_InstallationManager.getSupportedExtensions());
m_DiagnosisPlugins.push_back(this);
@@ -1122,6 +1159,8 @@ IModInterface *MainWindow::createMod(GuessedValue<QString> &name)
return NULL;
}
m_InstallationManager.setModsDirectory(m_Settings.getModDirectory());
/* QString fixedName = name;
fixDirectoryName(fixedName);
unsigned int index = ModInfo::getIndex(fixedName);
@@ -1166,6 +1205,21 @@ QVariant MainWindow::pluginSetting(const QString &pluginName, const QString &key
return m_Settings.pluginSetting(pluginName, key);
}
void MainWindow::setPluginSetting(const QString &pluginName, const QString &key, const QVariant &value)
{
m_Settings.setPluginSetting(pluginName, key, value);
}
QVariant MainWindow::persistent(const QString &pluginName, const QString &key, const QVariant &def) const
{
return m_Settings.pluginPersistent(pluginName, key, def);
}
void MainWindow::setPersistent(const QString &pluginName, const QString &key, const QVariant &value, bool sync)
{
m_Settings.setPluginPersistent(pluginName, key, value, sync);
}
QString MainWindow::pluginDataPath() const
{
QString pluginPath = QDir::fromNativeSeparators(ToQString(GameInfo::instance().getOrganizerDirectory())) + "/" + ToQString(AppConfig::pluginPath());
@@ -1218,6 +1272,11 @@ HANDLE MainWindow::spawnBinaryDirect(const QFileInfo &binary, const QString &arg
}
}
while (m_RefreshProgress->isVisible()) {
::Sleep(1000);
QCoreApplication::processEvents();
}
return startBinary(binary, arguments, profileName, m_Settings.logLevel(), currentDirectory, true);
}
@@ -1267,11 +1326,9 @@ void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments,
this->setEnabled(true);
refreshDirectoryStructure();
refreshDataTree();
if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) {
QFile::remove(m_CurrentProfile->getLoadOrderFileName());
}
refreshLists();
dialog->hide();
}
}
@@ -1325,17 +1382,6 @@ void MainWindow::setExecutableIndex(int index)
executableBox->setCurrentIndex(1);
}
const Executable &selectedExecutable = executableBox->itemData(executableBox->currentIndex()).value<Executable>();
QIcon addIcon(":/MO/gui/link");
QIcon removeIcon(":/MO/gui/remove");
QFileInfo linkDesktopFile(QDir::fromNativeSeparators(getDesktopDirectory()) + "/" + selectedExecutable.m_Title + ".lnk");
QFileInfo linkMenuFile(QDir::fromNativeSeparators(getStartMenuDirectory()) + "/" + selectedExecutable.m_Title + ".lnk");
ui->linkButton->menu()->actions().at(0)->setIcon(selectedExecutable.m_Toolbar ? removeIcon : addIcon);
ui->linkButton->menu()->actions().at(1)->setIcon(linkDesktopFile.exists() ? removeIcon : addIcon);
ui->linkButton->menu()->actions().at(2)->setIcon(linkMenuFile.exists() ? removeIcon : addIcon);
}
@@ -1627,11 +1673,15 @@ void MainWindow::refreshESPList()
m_CurrentProfile->writeModlist();
// clear list
m_PluginList.refresh(m_CurrentProfile->getName(),
*m_DirectoryStructure,
m_CurrentProfile->getPluginsFileName(),
m_CurrentProfile->getLoadOrderFileName(),
m_CurrentProfile->getLockedOrderFileName());
try {
m_PluginList.refresh(m_CurrentProfile->getName(),
*m_DirectoryStructure,
m_CurrentProfile->getPluginsFileName(),
m_CurrentProfile->getLoadOrderFileName(),
m_CurrentProfile->getLockedOrderFileName());
} catch (const std::exception &e) {
reportError(tr("Failed to refresh list of esps: %s").arg(e.what()));
}
}
@@ -1768,14 +1818,14 @@ void MainWindow::checkBSAList()
if (item->checkState(0) == Qt::Unchecked) {
if (m_DefaultArchives.contains(filename)) {
item->setIcon(0, QIcon(":/MO/gui/resources/dialog-warning.png"));
item->setIcon(0, QIcon(":/MO/gui/warning"));
item->setToolTip(0, tr("This bsa is enabled in the ini file so it may be required!"));
modWarning = true;
} else {
QString espName = filename.mid(0, filename.length() - 3).append("esp").toLower();
QString esmName = filename.mid(0, filename.length() - 3).append("esm").toLower();
if (m_PluginList.isEnabled(espName) || m_PluginList.isEnabled(esmName)) {
item->setIcon(0, QIcon(":/MO/gui/resources/dialog-warning.png"));
item->setIcon(0, QIcon(":/MO/gui/warning"));
item->setToolTip(0, tr("This archive will still be loaded since there is a plugin of the same name but "
"its files will not follow installation order!"));
modWarning = true;
@@ -1790,7 +1840,7 @@ void MainWindow::checkBSAList()
}
if (warning) {
ui->tabWidget->setTabIcon(1, QIcon(":/MO/gui/resources/dialog-warning.png"));
ui->tabWidget->setTabIcon(1, QIcon(":/MO/gui/warning"));
} else {
ui->tabWidget->setTabIcon(1, QIcon());
}
@@ -1931,7 +1981,6 @@ void MainWindow::on_btnRefreshData_clicked()
{
if (!m_DirectoryUpdate) {
refreshDirectoryStructure();
refreshDataTree();
} else {
qDebug("directory update");
}
@@ -2336,8 +2385,12 @@ void MainWindow::directory_refreshed()
{
DirectoryEntry *newStructure = m_DirectoryRefresher.getDirectoryStructure();
if (newStructure != NULL) {
delete m_DirectoryStructure;
DirectoryEntry *oldStructure = m_DirectoryStructure;
m_DirectoryStructure = newStructure;
delete oldStructure;
refreshDataTree();
refreshLists();
} else {
// TODO: don't know why this happens, this slot seems to get called twice with only one emit
return;
@@ -2546,6 +2599,29 @@ void MainWindow::modlistChanged(int)
}
void MainWindow::fileMoved(const QString &filePath, const QString &oldOriginName, const QString &newOriginName)
{
const FileEntry::Ptr filePtr = m_DirectoryStructure->findFile(ToWString(filePath));
if (filePtr.get() != NULL) {
try {
FilesOrigin &oldOrigin = m_DirectoryStructure->getOriginByName(ToWString(oldOriginName));
FilesOrigin &newOrigin = m_DirectoryStructure->getOriginByName(ToWString(newOriginName));
QString fullNewPath = ToQString(newOrigin.getPath()) + "\\" + filePath;
WIN32_FIND_DATAW findData;
::FindFirstFileW(ToWString(fullNewPath).c_str(), &findData);
filePtr->addOrigin(newOrigin.getID(), findData.ftCreationTime, L"");
filePtr->removeOrigin(oldOrigin.getID());
} catch (const std::exception &e) {
reportError(tr("Failed to move \"%1\" from mod \"%2\" to \"%3\": %4").arg(filePath).arg(oldOriginName).arg(newOriginName).arg(e.what()));
}
} else {
// this is probably not an error, the specified path is likely a directory
}
}
QTreeWidgetItem *MainWindow::addFilterItem(QTreeWidgetItem *root, const QString &name, int categoryID)
{
QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(name));
@@ -2735,8 +2811,13 @@ void MainWindow::reinstallMod_clicked()
QString installationFile = modInfo->getInstallationFile();
if (installationFile.length() != 0) {
QString fullInstallationFile;
if (QFileInfo(installationFile).isAbsolute()) {
fullInstallationFile = installationFile;
QFileInfo fileInfo(installationFile);
if (fileInfo.isAbsolute()) {
if (fileInfo.exists()) {
fullInstallationFile = installationFile;
} else {
fullInstallationFile = m_DownloadManager.getOutputDirectory().append("/").append(fileInfo.fileName());
}
} else {
fullInstallationFile = m_DownloadManager.getOutputDirectory().append("/").append(installationFile);
}
@@ -2795,6 +2876,15 @@ void MainWindow::unendorse_clicked()
}
void MainWindow::overwriteClosed(int)
{
QDialog *dialog = this->findChild<QDialog*>("__overwriteDialog");
if (dialog != NULL) {
dialog->deleteLater();
}
}
void MainWindow::displayModInformation(ModInfo::Ptr modInfo, unsigned int index, int tab)
{
std::vector<ModInfo::EFlag> flags = modInfo->getFlags();
@@ -2807,6 +2897,7 @@ void MainWindow::displayModInformation(ModInfo::Ptr modInfo, unsigned int index,
dialog->show();
dialog->raise();
dialog->activateWindow();
connect(dialog, SIGNAL(finished(int)), this, SLOT(overwriteClosed(int)));
} else {
ModInfoDialog dialog(modInfo, m_DirectoryStructure, this);
connect(&dialog, SIGNAL(nexusLinkActivated(QString)), this, SLOT(nexusLinkActivated(QString)));
@@ -3024,8 +3115,8 @@ void MainWindow::createModFromOverwrite()
}
ModInfo::Ptr overwriteInfo = ModInfo::getByIndex(m_ContextRow);
shellMove(QStringList(overwriteInfo->absolutePath() + "\\*"), QStringList(newMod->absolutePath()), this);
shellMove(QStringList(QDir::toNativeSeparators(overwriteInfo->absolutePath()) + "\\*"),
QStringList(QDir::toNativeSeparators(newMod->absolutePath())), this);
refreshModList();
}
@@ -3625,6 +3716,7 @@ void MainWindow::on_actionSettings_triggered()
QString oldCacheDirectory(m_Settings.getCacheDirectory());
bool proxy = m_Settings.useProxy();
m_Settings.query(this);
m_InstallationManager.setModsDirectory(m_Settings.getModDirectory());
fixCategories();
refreshFilters();
if (QDir::fromNativeSeparators(m_DownloadManager.getOutputDirectory()) != QDir::fromNativeSeparators(m_Settings.getDownloadDirectory())) {
@@ -4494,6 +4586,25 @@ void MainWindow::unlockESPIndex()
}
void MainWindow::removeFromToolbar()
{
Executable &exe = m_ExecutablesList.find(m_ContextAction->text());
exe.m_Toolbar = false;
updateToolBar();
}
void MainWindow::toolBar_customContextMenuRequested(const QPoint &point)
{
QAction *action = ui->toolBar->actionAt(point);
if (action->objectName().startsWith("custom_")) {
m_ContextAction = action;
QMenu menu;
menu.addAction(tr("Remove"), this, SLOT(removeFromToolbar()));
menu.exec(ui->toolBar->mapToGlobal(point));
}
}
void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos)
{
m_ContextRow = m_PluginListSortProxy->mapToSource(ui->espList->indexAt(pos)).row();
@@ -4565,3 +4676,18 @@ void MainWindow::on_groupCombo_currentIndexChanged(int index)
m_ModListSortProxy->setSourceModel(&m_ModList);
}
}
void MainWindow::on_linkButton_pressed()
{
const Executable &selectedExecutable = ui->executablesListBox->itemData(ui->executablesListBox->currentIndex()).value<Executable>();
QIcon addIcon(":/MO/gui/link");
QIcon removeIcon(":/MO/gui/remove");
QFileInfo linkDesktopFile(QDir::fromNativeSeparators(getDesktopDirectory()) + "/" + selectedExecutable.m_Title + ".lnk");
QFileInfo linkMenuFile(QDir::fromNativeSeparators(getStartMenuDirectory()) + "/" + selectedExecutable.m_Title + ".lnk");
ui->linkButton->menu()->actions().at(0)->setIcon(selectedExecutable.m_Toolbar ? removeIcon : addIcon);
ui->linkButton->menu()->actions().at(1)->setIcon(linkDesktopFile.exists() ? removeIcon : addIcon);
ui->linkButton->menu()->actions().at(2)->setIcon(linkMenuFile.exists() ? removeIcon : addIcon);
}
+13
View File
@@ -105,6 +105,9 @@ public:
virtual bool removeMod(MOBase::IModInterface *mod);
virtual void modDataChanged(MOBase::IModInterface *mod);
virtual QVariant pluginSetting(const QString &pluginName, const QString &key) const;
virtual void setPluginSetting(const QString &pluginName, const QString &key, const QVariant &value);
virtual QVariant persistent(const QString &pluginName, const QString &key, const QVariant &def = QVariant()) const;
virtual void setPersistent(const QString &pluginName, const QString &key, const QVariant &value, bool sync = true);
virtual QString pluginDataPath() const;
virtual void installMod(const QString &fileName);
virtual QString resolvePath(const QString &fileName) const;
@@ -276,6 +279,8 @@ private:
int m_ContextRow;
QTreeWidgetItem *m_ContextItem;
QAction *m_ContextAction;
int m_SelectedSaveGame;
Settings m_Settings;
@@ -313,6 +318,8 @@ private:
std::vector<MOBase::IPluginDiagnose*> m_DiagnosisPlugins;
std::vector<QString> m_UnloadedPlugins;
QFile m_PluginsCheck;
private slots:
void showMessage(const QString &message);
@@ -433,6 +440,7 @@ private slots:
void updateStyle(const QString &style);
void modlistChanged(const QModelIndex &index, int role);
void fileMoved(const QString &filePath, const QString &oldOriginName, const QString &newOriginName);
void savePluginList();
@@ -454,6 +462,10 @@ private slots:
void downloadSpeed(const QString &serverName, int bytesPerSecond);
void toolBar_customContextMenuRequested(const QPoint &point);
void removeFromToolbar();
void overwriteClosed(int);
private slots: // ui slots
// actions
void on_actionAdd_Profile_triggered();
@@ -485,6 +497,7 @@ private slots: // ui slots
void on_displayCategoriesBtn_toggled(bool checked);
void on_groupCombo_currentIndexChanged(int index);
void on_categoriesList_itemSelectionChanged();
void on_linkButton_pressed();
};
#endif // MAINWINDOW_H
+8 -53
View File
@@ -31,16 +31,7 @@
<property name="spacing">
<number>4</number>
</property>
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>6</number>
</property>
<item>
@@ -730,16 +721,7 @@ p, li { white-space: pre-wrap; }
<string notr="true">Archives</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>6</number>
</property>
<item>
@@ -804,7 +786,7 @@ BSAs checked here are loaded in such a way that your installation order is obeye
<item>
<widget class="QLabel" name="bsaWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Marked Archives (&lt;img src=&quot;:/MO/gui/resources/dialog-warning_16.png&quot;/&gt;) are still loaded on Skyrim but the &lt;a href=&quot;http://forums.bethsoft.com/topic/1354395-update-bsas-and-you/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;regular file override&lt;/span&gt;&lt;/a&gt; mechanism will apply: Loose files override BSAs, no matter the mod/plugin priority.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Marked Archives (&lt;img src=&quot;:/MO/gui/warning_16&quot;/&gt;) are still loaded on Skyrim but the &lt;a href=&quot;http://forums.bethsoft.com/topic/1354395-update-bsas-and-you/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;regular file override&lt;/span&gt;&lt;/a&gt; mechanism will apply: Loose files override BSAs, no matter the mod/plugin priority.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -818,16 +800,7 @@ BSAs checked here are loaded in such a way that your installation order is obeye
<string>Data</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>6</number>
</property>
<item>
@@ -897,16 +870,7 @@ BSAs checked here are loaded in such a way that your installation order is obeye
<string>Saves</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>6</number>
</property>
<item>
@@ -935,16 +899,7 @@ p, li { white-space: pre-wrap; }
<string>Downloads</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>
@@ -1045,7 +1000,7 @@ p, li { white-space: pre-wrap; }
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="windowTitle">
<string>Tool Bar</string>
@@ -1210,7 +1165,7 @@ p, li { white-space: pre-wrap; }
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/MO/gui/resources/dialog-warning.png</normaloff>:/MO/gui/resources/dialog-warning.png</iconset>
<normaloff>:/MO/gui/warning</normaloff>:/MO/gui/warning</iconset>
</property>
<property name="text">
<string>No Problems</string>
+1 -1
View File
@@ -792,9 +792,9 @@ ModInfoBackup::ModInfoBackup(const QDir &path, DirectoryEntry **directoryStructu
ModInfoOverwrite::ModInfoOverwrite()
: m_StartupTime(QDateTime::currentDateTime())
{
testValid();
}
+5 -1
View File
@@ -811,7 +811,7 @@ public:
virtual void endorse(bool) {}
virtual QString name() const { return "Overwrite"; }
virtual QString notes() const { return ""; }
virtual QDateTime creationTime() const { return QDateTime::currentDateTime(); }
virtual QDateTime creationTime() const { return m_StartupTime; }
virtual QString absolutePath() const;
virtual MOBase::VersionInfo getNewestVersion() const { return ""; }
virtual QString getInstallationFile() const { return ""; }
@@ -828,6 +828,10 @@ private:
ModInfoOverwrite();
private:
QDateTime m_StartupTime;
};
#endif // MODINFO_H
+31 -5
View File
@@ -38,6 +38,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QFileSystemModel>
#include <Shlwapi.h>
#include <sstream>
#include <QInputDialog>
using QtJson::Json;
@@ -146,7 +147,7 @@ ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directo
QTabWidget *tabWidget = findChild<QTabWidget*>("tabWidget");
tabWidget->setTabEnabled(TAB_TEXTFILES, textFileList->count() != 0);
tabWidget->setTabEnabled(TAB_INIFILES, (iniFileList->count() != 0) || (iniTweaksList->count() != 0));
//tabWidget->setTabEnabled(TAB_INIFILES, (iniFileList->count() != 0) || (iniTweaksList->count() != 0));
tabWidget->setTabEnabled(TAB_IMAGES, thumbnailArea->count() != 0);
tabWidget->setTabEnabled(TAB_ESPS, (inactiveESPList->count() != 0) || (activeESPList->count() != 0));
tabWidget->setTabEnabled(TAB_CONFLICTS, m_Origin != NULL);
@@ -409,8 +410,6 @@ void ModInfoDialog::openTextFile(const QString &fileName)
void ModInfoDialog::openIniFile(const QString &fileName)
{
QPushButton* saveButton = findChild<QPushButton*>("saveButton");
QFile iniFile(fileName);
iniFile.open(QIODevice::ReadOnly);
QByteArray buffer = iniFile.readAll();
@@ -421,7 +420,7 @@ void ModInfoDialog::openIniFile(const QString &fileName)
iniFileView->setProperty("encoding", codec->name());
iniFile.close();
saveButton->setEnabled(false);
ui->saveButton->setEnabled(false);
}
@@ -515,8 +514,9 @@ void ModInfoDialog::saveCurrentIniFile()
{
QVariant fileNameVar = ui->iniFileView->property("currentFile");
QVariant encodingVar = ui->iniFileView->property("encoding");
if (fileNameVar.isValid()) {
if (fileNameVar.isValid() && !fileNameVar.toString().isEmpty()) {
QString fileName = fileNameVar.toString();
QDir().mkpath(QFileInfo(fileName).absolutePath());
QFile txtFile(fileName);
txtFile.open(QIODevice::WriteOnly);
txtFile.resize(0);
@@ -1171,3 +1171,29 @@ void ModInfoDialog::on_prevButton_clicked()
emit modOpenPrev();
this->accept();
}
void ModInfoDialog::createTweak()
{
QString name = QInputDialog::getText(this, tr("Name"), tr("Please enter a name"));
if (!fixDirectoryName(name)) {
QMessageBox::critical(this, tr("Error"), tr("Invalid name. Must be a valid file name"));
return;
} else if (name.isEmpty()) {
return;
} else if (ui->iniTweaksList->findItems(name, Qt::MatchFixedString).count() != 0) {
QMessageBox::critical(this, tr("Error"), tr("A tweak by that name exists"));
return;
}
QListWidgetItem *newTweak = new QListWidgetItem(name);
newTweak->setData(Qt::UserRole, "INI Tweaks/" + name + ".ini");
ui->iniTweaksList->addItem(newTweak);
}
void ModInfoDialog::on_iniTweaksList_customContextMenuRequested(const QPoint &pos)
{
QMenu menu;
menu.addAction(tr("Create Tweak"), this, SLOT(createTweak()));
menu.exec(ui->iniTweaksList->mapToGlobal(pos));
}
+3
View File
@@ -186,6 +186,9 @@ private slots:
void on_prevButton_clicked();
void on_iniTweaksList_customContextMenuRequested(const QPoint &pos);
void createTweak();
private:
Ui::ModInfoDialog *ui;

Some files were not shown because too many files have changed in this diff Show More