From ccab9eae8df3cf5367ce5cf164c98d1534ac13cb Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sat, 18 Jul 2020 05:07:32 -0400
Subject: add warning when profile given with -p doesn't exist implemented
moshortcut, nxm links and executable names as command line options
---
src/moshortcut.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
(limited to 'src/moshortcut.h')
diff --git a/src/moshortcut.h b/src/moshortcut.h
index 2ce54910..0067b3bc 100644
--- a/src/moshortcut.h
+++ b/src/moshortcut.h
@@ -27,19 +27,21 @@ along with Mod Organizer. If not, see .
class MOShortcut {
public:
- MOShortcut(const QString& link);
+ MOShortcut(const QString& link={});
/// true iff intialized using a valid moshortcut link
- operator bool() const { return m_valid; }
+ bool isValid() const { return m_valid; }
bool hasInstance() const { return m_hasInstance; }
-
+
bool hasExecutable() const { return m_hasExecutable; }
const QString& instance() const { return m_instance; }
const QString& executable() const { return m_executable; }
+ QString toString() const;
+
private:
QString m_instance;
QString m_executable;
--
cgit v1.3.1
From 38d2f87b31ba4af8f6ecb73e0432460778e26f82 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Tue, 3 Nov 2020 13:35:02 -0500
Subject: replaced #pragma once by ifdefs changed pointer to ref to
NexusInterface on_actionChange_Game_triggered() now creates the dialog itself
instead of calling test code fixed broken command line options, they'd be
reset before they were used removed useless explicit
---
src/commandline.h | 6 ++++--
src/createinstancedialog.h | 2 +-
src/instancemanager.h | 26 ++++----------------------
src/instancemanagerdialog.cpp | 9 ---------
src/main.cpp | 14 +++++++-------
src/mainwindow.cpp | 31 +++++++++----------------------
src/moshortcut.h | 31 ++++++-------------------------
src/pluginlistview.cpp | 2 --
src/shared/error_report.h | 8 ++++++--
src/uilocker.h | 5 ++++-
10 files changed, 41 insertions(+), 93 deletions(-)
(limited to 'src/moshortcut.h')
diff --git a/src/commandline.h b/src/commandline.h
index 0e300327..72018ba3 100644
--- a/src/commandline.h
+++ b/src/commandline.h
@@ -1,5 +1,5 @@
-#pragma once
-
+#ifndef MODORGANIZER_COMMANDLINE_INCLUDED
+#define MODORGANIZER_COMMANDLINE_INCLUDED
#include "moshortcut.h"
#include
#include
@@ -149,3 +149,5 @@ private:
};
} // namespace
+
+#endif // MODORGANIZER_COMMANDLINE_INCLUDED
diff --git a/src/createinstancedialog.h b/src/createinstancedialog.h
index f05495c6..25e383eb 100644
--- a/src/createinstancedialog.h
+++ b/src/createinstancedialog.h
@@ -47,7 +47,7 @@ public:
};
- explicit CreateInstanceDialog(
+ CreateInstanceDialog(
const PluginContainer& pc, Settings* s, QWidget *parent = nullptr);
~CreateInstanceDialog();
diff --git a/src/instancemanager.h b/src/instancemanager.h
index ddab4a2e..69536650 100644
--- a/src/instancemanager.h
+++ b/src/instancemanager.h
@@ -1,25 +1,5 @@
-/*
-Copyright (C) 2016 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 .
-*/
-
-
-#pragma once
-
+#ifndef MODORGANIZER_INSTANCEMANAGER_INCLUDED
+#define MODORGANIZER_INSTANCEMANAGER_INCLUDED
#include
#include
@@ -112,3 +92,5 @@ private:
bool m_overrideProfile{false};
QString m_overrideProfileName;
};
+
+#endif // MODORGANIZER_INSTANCEMANAGER_INCLUDED
diff --git a/src/instancemanagerdialog.cpp b/src/instancemanagerdialog.cpp
index f2e9a928..231835ba 100644
--- a/src/instancemanagerdialog.cpp
+++ b/src/instancemanagerdialog.cpp
@@ -13,15 +13,6 @@
using namespace MOBase;
-void openInstanceManager(PluginContainer& pc, QWidget* parent)
-{
- //CreateInstanceDialog dlg(pc, parent);
- //dlg.exec();
- InstanceManagerDialog dlg(pc, parent);
- dlg.exec();
-}
-
-
class InstanceInfo
{
public:
diff --git a/src/main.cpp b/src/main.cpp
index bd7f8303..8f7af77d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -650,13 +650,6 @@ int doOneRun(
// resets things when MO is "restarted"
resetForRestart(cl);
- if (cl.instance())
- InstanceManager::instance().overrideInstance(*cl.instance());
-
- if (cl.profile()) {
- InstanceManager::instance().overrideProfile(*cl.profile());
- }
-
auto currentInstance = InstanceManager::instance().currentInstance();
if (!currentInstance)
@@ -707,6 +700,13 @@ int main(int argc, char *argv[])
tt.stop();
+ if (cl.instance())
+ InstanceManager::instance().overrideInstance(*cl.instance());
+
+ if (cl.profile()) {
+ InstanceManager::instance().overrideProfile(*cl.profile());
+ }
+
for (;;)
{
const auto r = doOneRun(cl, application, instance);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 6a648512..02900571 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -76,6 +76,7 @@ along with Mod Organizer. If not, see .
#include "statusbar.h"
#include "filterlist.h"
#include "datatab.h"
+#include "instancemanagerdialog.h"
#include
#include
#include
@@ -291,7 +292,7 @@ MainWindow::MainWindow(Settings &settings
ui->statusBar->setup(ui, settings);
{
- auto* ni = &NexusInterface::instance();
+ auto& ni = NexusInterface::instance();
// there are two ways to get here:
// 1) the user just started MO, and
@@ -311,8 +312,8 @@ MainWindow::MainWindow(Settings &settings
//
// in the rare case where the user restarts MO through the settings, this
// will correctly pick up the previous values
- updateWindowTitle(ni->getAPIUserAccount());
- ui->statusBar->setAPI(ni->getAPIStats(), ni->getAPIUserAccount());
+ updateWindowTitle(ni.getAPIUserAccount());
+ ui->statusBar->setAPI(ni.getAPIStats(), ni.getAPIUserAccount());
}
m_Filters.reset(new FilterList(ui, &m_OrganizerCore, m_CategoryFactory));
@@ -1961,8 +1962,8 @@ void MainWindow::refreshSaveList()
it.next();
files.append(it.fileInfo());
}
- std::sort(files.begin(), files.end(), [](auto const& lhs, auto const& rhs) {
- return lhs.fileTime(QFileDevice::FileModificationTime) < rhs.fileTime(QFileDevice::FileModificationTime);
+ std::sort(files.begin(), files.end(), [](auto const& lhs, auto const& rhs) {
+ return lhs.fileTime(QFileDevice::FileModificationTime) < rhs.fileTime(QFileDevice::FileModificationTime);
});
for (const QFileInfo &file : files) {
@@ -5569,7 +5570,7 @@ void MainWindow::nxmUpdateInfoAvailable(QString gameName, QVariant userData, QVa
void MainWindow::finishUpdateInfo()
{
QFutureWatcher>>> *watcher = static_cast>>> *>(sender());
-
+
QString game = watcher->result().first;
auto finalMods = watcher->result().second;
@@ -5974,24 +5975,10 @@ void MainWindow::on_actionNotifications_triggered()
scheduleCheckForProblems();
}
-void openInstanceManager(PluginContainer& pc, QWidget* parent);
-
void MainWindow::on_actionChange_Game_triggered()
{
- openInstanceManager(m_PluginContainer, this);
-
- //if (m_OrganizerCore.settings().interface().showChangeGameConfirmation()) {
- // const auto r = QMessageBox::question(
- // this, tr("Are you sure?"), tr("This will restart MO, continue?"),
- // QMessageBox::Yes | QMessageBox::Cancel);
- //
- // if (r != QMessageBox::Yes) {
- // return;
- // }
- //}
- //
- //InstanceManager::instance().clearCurrentInstance();
- //ExitModOrganizer(Exit::Restart);
+ InstanceManagerDialog dlg(m_PluginContainer, this);
+ dlg.exec();
}
void MainWindow::setCategoryListVisible(bool visible)
diff --git a/src/moshortcut.h b/src/moshortcut.h
index 0067b3bc..33346bb9 100644
--- a/src/moshortcut.h
+++ b/src/moshortcut.h
@@ -1,31 +1,10 @@
-/*
-Copyright (C) 2016 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 .
-*/
-
-
-#pragma once
-
+#ifndef MODORGANIZER_MOSHORTCUT_INCLUDED
+#define MODORGANIZER_MOSHORTCUT_INCLUDED
#include
-
-class MOShortcut {
-
+class MOShortcut
+{
public:
MOShortcut(const QString& link={});
@@ -49,3 +28,5 @@ private:
bool m_hasInstance;
bool m_hasExecutable;
};
+
+#endif // MODORGANIZER_MOSHORTCUT_INCLUDED
diff --git a/src/pluginlistview.cpp b/src/pluginlistview.cpp
index 4217971d..a265d5d4 100644
--- a/src/pluginlistview.cpp
+++ b/src/pluginlistview.cpp
@@ -56,5 +56,3 @@ void PluginListView::setModel(QAbstractItemModel *model)
QTreeView::setModel(model);
setVerticalScrollBar(new ViewMarkingScrollBar(model, this));
}
-
-#pragma once
diff --git a/src/shared/error_report.h b/src/shared/error_report.h
index 17b25645..da07c728 100644
--- a/src/shared/error_report.h
+++ b/src/shared/error_report.h
@@ -17,16 +17,20 @@ You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see .
*/
-#pragma once
+#ifndef MODORGANIZER_SHARED_ERROR_REPORT_INCLUDED
+#define MODORGANIZER_SHARED_ERROR_REPORT_INCLUDED
#include
#define WIN32_LEAN_AND_MEAN
#include
#include
-namespace MOShared {
+namespace MOShared
+{
void reportError(LPCSTR format, ...);
void reportError(LPCWSTR format, ...);
} // namespace MOShared
+
+#endif // MODORGANIZER_SHARED_ERROR_REPORT_INCLUDED
diff --git a/src/uilocker.h b/src/uilocker.h
index cc467184..44d9d8a2 100644
--- a/src/uilocker.h
+++ b/src/uilocker.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef MODORGANIZER_UILOCKER_INCLUDED
+#define MODORGANIZER_UILOCKER_INCLUDED
#include
#include
@@ -94,3 +95,5 @@ private:
void enableAll();
void disable(QWidget* w);
};
+
+#endif // MODORGANIZER_UILOCKER_INCLUDED
--
cgit v1.3.1