summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-09-11 22:54:45 +0200
committerTannin <devnull@localhost>2013-09-11 22:54:45 +0200
commitaf6e1c3ab4f3687c88715dffff8b1bf2f38a15d6 (patch)
tree414f43c931e2e040344e87d2f6317196c1cea108 /src/mainwindow.cpp
parent50325c8fc23fdeed6e1acb90917e8e2889a1140f (diff)
- 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
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp64
1 files changed, 47 insertions, 17 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2988c602..c37f0743 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -144,7 +144,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);
@@ -261,6 +261,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);
@@ -1325,17 +1327,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);
}
@@ -1768,14 +1759,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 +1781,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());
}
@@ -2735,8 +2726,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);
}
@@ -4494,6 +4490,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 +4580,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);
+}