summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorBrian Munro <brian.alexander.munro@gmail.com>2018-08-21 12:23:47 +0200
committerGitHub <noreply@github.com>2018-08-21 12:23:47 +0200
commit364289db72ca452e7af56dbf6ff43d0573656e57 (patch)
tree176e8c349fffe87996fbe4708937bc4bd587c86b /src/mainwindow.cpp
parent7b1821a5189f0187ea776c150f29e3bd7446724a (diff)
parentef771fd8ca262a136c95c5141bb0de95712d14c2 (diff)
Merge pull request #495 from Modorganizer2/Develop
Release 2.1.5
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp65
1 files changed, 54 insertions, 11 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index f6cfbfbd..3c749bf5 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -162,6 +162,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
#include <boost/assign.hpp>
+#include <boost/range/adaptor/reversed.hpp>
#endif
#include <shlobj.h>
@@ -440,6 +441,11 @@ MainWindow::MainWindow(QSettings &initSettings
refreshExecutablesList();
updateToolBar();
+
+ for (QAction *action : ui->toolBar->actions()) {
+ // set the name of the widget to the name of the action to allow styling
+ ui->toolBar->widgetForAction(action)->setObjectName(action->objectName());
+ }
}
@@ -1955,8 +1961,7 @@ void MainWindow::on_actionInstallMod_triggered()
void MainWindow::on_actionAdd_Profile_triggered()
{
for (;;) {
- //Note: Calling this with an invalid profile name. Not quite sure why
- ProfilesDialog profilesDialog(m_OrganizerCore.managedGame()->gameDirectory().absolutePath(),
+ ProfilesDialog profilesDialog(m_OrganizerCore.currentProfile()->name(),
m_OrganizerCore.managedGame(),
this);
// workaround: need to disable monitoring of the saves directory, otherwise the active
@@ -3557,7 +3562,7 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos)
menu->addAction(tr("Create Mod..."), this, SLOT(createModFromOverwrite()));
menu->addAction(tr("Clear Overwrite..."), this, SLOT(clearOverwrite()));
}
- menu->addAction(tr("Open in explorer"), this, SLOT(openExplorer_clicked()));
+ menu->addAction(tr("Open in Explorer"), this, SLOT(openExplorer_clicked()));
} else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_BACKUP) != flags.end()) {
menu->addAction(tr("Restore Backup"), this, SLOT(restoreBackup_clicked()));
menu->addAction(tr("Remove Backup..."), this, SLOT(removeMod_clicked()));
@@ -3592,13 +3597,19 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos)
menu->addAction(tr("Ignore update"), this, SLOT(ignoreUpdate()));
}
}
+
+ menu->addSeparator();
+
+ menu->addAction(tr("Enable selected"), this, SLOT(enableSelectedMods_clicked()));
+ menu->addAction(tr("Disable selected"), this, SLOT(disableSelectedMods_clicked()));
+
menu->addSeparator();
menu->addAction(tr("Rename Mod..."), this, SLOT(renameMod_clicked()));
menu->addAction(tr("Reinstall Mod"), this, SLOT(reinstallMod_clicked()));
- menu->addAction(tr("Remove Mod..."), this, SLOT(removeMod_clicked()));
+ menu->addAction(tr("Remove Mod..."), this, SLOT(removeMod_clicked()));
- menu->addSeparator();
+ menu->addSeparator();
if (info->getNexusID() > 0) {
switch (info->endorsedState()) {
@@ -3637,7 +3648,7 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos)
menu->addAction(tr("Visit web page"), this, SLOT(visitWebPage_clicked()));
}
- menu->addAction(tr("Open in explorer"), this, SLOT(openExplorer_clicked()));
+ menu->addAction(tr("Open in Explorer"), this, SLOT(openExplorer_clicked()));
}
if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_FOREIGN) == flags.end()) {
@@ -4165,6 +4176,31 @@ void MainWindow::unhideFile()
}
}
+
+void MainWindow::enableSelectedPlugins_clicked()
+{
+ m_OrganizerCore.pluginList()->enableSelected(ui->espList->selectionModel());
+}
+
+
+void MainWindow::disableSelectedPlugins_clicked()
+{
+ m_OrganizerCore.pluginList()->disableSelected(ui->espList->selectionModel());
+}
+
+
+void MainWindow::enableSelectedMods_clicked()
+{
+ m_OrganizerCore.modList()->enableSelected(ui->modList->selectionModel());
+}
+
+
+void MainWindow::disableSelectedMods_clicked()
+{
+ m_OrganizerCore.modList()->disableSelected(ui->modList->selectionModel());
+}
+
+
void MainWindow::previewDataFile()
{
QString fileName = QDir::fromNativeSeparators(m_ContextItem->data(0, Qt::UserRole).toString());
@@ -4373,6 +4409,7 @@ void MainWindow::updateDownloadListDelegate()
connect(ui->downloadView->itemDelegate(), SIGNAL(installDownload(int)), &m_OrganizerCore, SLOT(installDownload(int)));
connect(ui->downloadView->itemDelegate(), SIGNAL(queryInfo(int)), m_OrganizerCore.downloadManager(), SLOT(queryInfo(int)));
connect(ui->downloadView->itemDelegate(), SIGNAL(visitOnNexus(int)), m_OrganizerCore.downloadManager(), SLOT(visitOnNexus(int)));
+ connect(ui->downloadView->itemDelegate(), SIGNAL(openFile(int)), m_OrganizerCore.downloadManager(), SLOT(openFile(int)));
connect(ui->downloadView->itemDelegate(), SIGNAL(openInDownloadsFolder(int)), m_OrganizerCore.downloadManager(), SLOT(openInDownloadsFolder(int)));
connect(ui->downloadView->itemDelegate(), SIGNAL(removeDownload(int, bool)), m_OrganizerCore.downloadManager(), SLOT(removeDownload(int, bool)));
connect(ui->downloadView->itemDelegate(), SIGNAL(restoreDownload(int)), m_OrganizerCore.downloadManager(), SLOT(restoreDownload(int)));
@@ -4410,8 +4447,7 @@ void MainWindow::nxmUpdatesAvailable(const std::vector<int> &modIDs, QVariant us
if (game
&& result["id"].toInt() == game->nexusModOrganizerID()
&& result["game_id"].toInt() == game->nexusGameID()) {
- if (result["voted_by_user"].type() != QVariant::Invalid &&
- !result["voted_by_user"].toBool()) {
+ if (!result["voted_by_user"].toBool()) {
ui->actionEndorseMO->setVisible(true);
}
} else {
@@ -4435,8 +4471,7 @@ void MainWindow::nxmUpdatesAvailable(const std::vector<int> &modIDs, QVariant us
(*iter)->setNewestVersion(result["version"].toString());
(*iter)->setNexusDescription(result["description"].toString());
if (NexusInterface::instance(&m_PluginContainer)->getAccessManager()->loggedIn() &&
- result.contains("voted_by_user") &&
- result["voted_by_user"].type() != QVariant::Invalid) {
+ result.contains("voted_by_user")) {
// don't use endorsement info if we're not logged in or if the response doesn't contain it
(*iter)->setIsEndorsed(result["voted_by_user"].toBool());
}
@@ -4757,6 +4792,11 @@ void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos)
m_ContextRow = m_PluginListSortProxy->mapToSource(ui->espList->indexAt(pos)).row();
QMenu menu;
+ menu.addAction(tr("Enable selected"), this, SLOT(enableSelectedPlugins_clicked()));
+ menu.addAction(tr("Disable selected"), this, SLOT(disableSelectedPlugins_clicked()));
+
+ menu.addSeparator();
+
menu.addAction(tr("Enable all"), m_OrganizerCore.pluginList(), SLOT(enableAll()));
menu.addAction(tr("Disable all"), m_OrganizerCore.pluginList(), SLOT(disableAll()));
@@ -4972,6 +5012,9 @@ void MainWindow::on_bossButton_clicked()
createStdoutPipe(&stdOutRead, &stdOutWrite);
try {
m_OrganizerCore.prepareVFS();
+ } catch (const UsvfsConnectorException &e) {
+ qDebug(e.what());
+ return;
} catch (const std::exception &e) {
QMessageBox::warning(qApp->activeWindow(), tr("Error"), e.what());
return;
@@ -5135,7 +5178,7 @@ QString MainWindow::queryRestore(const QString &filePath)
SelectionDialog dialog(tr("Choose backup to restore"), this);
QRegExp exp(pluginFileInfo.fileName() + PATTERN_BACKUP_REGEX);
QRegExp exp2(pluginFileInfo.fileName() + "\\.(.*)");
- for(const QFileInfo &info : files) {
+ for(const QFileInfo &info : boost::adaptors::reverse(files)) {
if (exp.exactMatch(info.fileName())) {
QDateTime time = QDateTime::fromString(exp.cap(1), PATTERN_BACKUP_DATE);
dialog.addChoice(time.toString(), "", exp.cap(1));