summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/createinstancedialog.cpp6
-rw-r--r--src/createinstancedialogpages.cpp18
-rw-r--r--src/envshortcut.cpp2
-rw-r--r--src/instancemanager.cpp2
-rw-r--r--src/instancemanager.h2
-rw-r--r--src/instancemanagerdialog.cpp20
-rw-r--r--src/main.cpp14
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/processrunner.cpp2
-rw-r--r--src/statusbar.cpp2
10 files changed, 35 insertions, 35 deletions
diff --git a/src/createinstancedialog.cpp b/src/createinstancedialog.cpp
index c976ee13..2ff8adf3 100644
--- a/src/createinstancedialog.cpp
+++ b/src/createinstancedialog.cpp
@@ -244,7 +244,7 @@ void CreateInstanceDialog::finish()
ui->creationLog->clear();
logCreation(tr("Creating instance..."));
- const auto& m = InstanceManager::instance();
+ const auto& m = InstanceManager::singleton();
const auto ci = creationInfo();
auto logger = [&](QString s) {
@@ -332,7 +332,7 @@ void CreateInstanceDialog::finish()
}
if (ui->launch->isChecked()) {
- InstanceManager::instance().setCurrentInstance(ci.instanceName);
+ InstanceManager::singleton().setCurrentInstance(ci.instanceName);
if (m_settings) {
// don't restart without settings, it happens on startup when there are
@@ -445,7 +445,7 @@ QString CreateInstanceDialog::dataPath() const
if (instanceType() == Portable) {
s = QDir(InstanceManager::portablePath()).absolutePath();
} else {
- s = InstanceManager::instance().instancePath(instanceName());
+ s = InstanceManager::singleton().instancePath(instanceName());
}
return QDir::toNativeSeparators(s);
diff --git a/src/createinstancedialogpages.cpp b/src/createinstancedialogpages.cpp
index 00d49b99..26f2f61d 100644
--- a/src/createinstancedialogpages.cpp
+++ b/src/createinstancedialogpages.cpp
@@ -136,13 +136,13 @@ TypePage::TypePage(CreateInstanceDialog& dlg)
{
ui->createGlobal->setDescription(
ui->createGlobal->description()
- .arg(InstanceManager::instance().instancesPath()));
+ .arg(InstanceManager::singleton().instancesPath()));
ui->createPortable->setDescription(
ui->createPortable->description()
.arg(InstanceManager::portablePath()));
- if (InstanceManager::instance().portableInstanceExists()) {
+ if (InstanceManager::singleton().portableInstanceExists()) {
ui->createPortable->setEnabled(false);
ui->portableExistsLabel->setVisible(true);
} else {
@@ -722,7 +722,7 @@ void NamePage::activated()
m_label.setText(g->gameName());
if (!m_modified || ui->instanceName->text().isEmpty()) {
- const auto n = InstanceManager::instance().makeUniqueName(g->gameName());
+ const auto n = InstanceManager::singleton().makeUniqueName(g->gameName());
ui->instanceName->setText(n);
m_modified = false;
}
@@ -737,7 +737,7 @@ QString NamePage::selectedInstanceName() const
}
const auto text = ui->instanceName->text().trimmed();
- return InstanceManager::instance().sanitizeInstanceName(text);
+ return InstanceManager::singleton().sanitizeInstanceName(text);
}
void NamePage::onChanged()
@@ -748,7 +748,7 @@ void NamePage::onChanged()
void NamePage::updateWarnings()
{
- const auto root = InstanceManager::instance().instancesPath();
+ const auto root = InstanceManager::singleton().instancesPath();
m_okay = checkName(root, ui->instanceName->text());
updateNavigation();
@@ -765,7 +765,7 @@ bool NamePage::checkName(QString parentDir, QString name)
if (name.isEmpty()) {
empty = true;
} else {
- if (InstanceManager::instance().validInstanceName(name)) {
+ if (InstanceManager::singleton().validInstanceName(name)) {
exists = QDir(parentDir).exists(name);
} else {
invalid = true;
@@ -901,7 +901,7 @@ void PathsPage::setPaths(const QString& name, bool force)
if (m_dlg.instanceType() == CreateInstanceDialog::Portable) {
path = InstanceManager::portablePath();
} else {
- const auto root = InstanceManager::instance().instancesPath();
+ const auto root = InstanceManager::singleton().instancesPath();
path = root + "/" + name;
}
@@ -938,11 +938,11 @@ bool PathsPage::checkPath(
} else {
const QDir d(path);
- if (InstanceManager::instance().validInstanceName(d.dirName())) {
+ if (InstanceManager::singleton().validInstanceName(d.dirName())) {
if (m_dlg.instanceType() == CreateInstanceDialog::Portable) {
// the default data path for a portable instance is the application
// directory, so it's not an error if it exists
- if (QDir(path) != InstanceManager::instance().portablePath()) {
+ if (QDir(path) != InstanceManager::singleton().portablePath()) {
exists = QDir(path).exists();
}
} else {
diff --git a/src/envshortcut.cpp b/src/envshortcut.cpp
index 5222665b..b13a7d9f 100644
--- a/src/envshortcut.cpp
+++ b/src/envshortcut.cpp
@@ -149,7 +149,7 @@ Shortcut::Shortcut(const Executable& exe)
m_target = QFileInfo(qApp->applicationFilePath()).absoluteFilePath();
m_arguments = QString("\"moshortcut://%1:%2\"")
- .arg(InstanceManager::instance().currentInstance()->name())
+ .arg(InstanceManager::singleton().currentInstance()->name())
.arg(exe.title());
m_description = QString("Run %1 with ModOrganizer").arg(exe.title());
diff --git a/src/instancemanager.cpp b/src/instancemanager.cpp
index 61c442be..8163149b 100644
--- a/src/instancemanager.cpp
+++ b/src/instancemanager.cpp
@@ -290,7 +290,7 @@ InstanceManager::InstanceManager()
GlobalSettings::updateRegistryKey();
}
-InstanceManager &InstanceManager::instance()
+InstanceManager &InstanceManager::singleton()
{
static InstanceManager s_Instance;
return s_Instance;
diff --git a/src/instancemanager.h b/src/instancemanager.h
index 69536650..79f1f30b 100644
--- a/src/instancemanager.h
+++ b/src/instancemanager.h
@@ -54,7 +54,7 @@ private:
class InstanceManager
{
public:
- static InstanceManager &instance();
+ static InstanceManager& singleton();
void overrideInstance(const QString& instanceName);
void overrideProfile(const QString& profileName);
diff --git a/src/instancemanagerdialog.cpp b/src/instancemanagerdialog.cpp
index 282329a5..3b6daeb8 100644
--- a/src/instancemanagerdialog.cpp
+++ b/src/instancemanagerdialog.cpp
@@ -101,7 +101,7 @@ public:
QIcon icon(const PluginContainer& plugins) const
{
- const auto* game = InstanceManager::instance().gamePluginForDirectory(
+ const auto* game = InstanceManager::singleton().gamePluginForDirectory(
m_dir, plugins);
if (game)
@@ -119,7 +119,7 @@ public:
bool isActive() const
{
- auto& m = InstanceManager::instance();
+ auto& m = InstanceManager::singleton();
if (auto i=m.currentInstance())
{
@@ -347,7 +347,7 @@ InstanceManagerDialog::InstanceManagerDialog(
void InstanceManagerDialog::updateInstances()
{
- auto& m = InstanceManager::instance();
+ auto& m = InstanceManager::singleton();
m_instances.clear();
@@ -437,7 +437,7 @@ void InstanceManagerDialog::select(const QString& name)
void InstanceManagerDialog::selectActiveInstance()
{
- const auto active = InstanceManager::instance().currentInstance();
+ const auto active = InstanceManager::singleton().currentInstance();
if (active) {
for (std::size_t i=0; i<m_instances.size(); ++i) {
@@ -463,9 +463,9 @@ void InstanceManagerDialog::openSelectedInstance()
}
if (m_instances[i]->isPortable()) {
- InstanceManager::instance().setCurrentInstance("");
+ InstanceManager::singleton().setCurrentInstance("");
} else {
- InstanceManager::instance().setCurrentInstance(m_instances[i]->name());
+ InstanceManager::singleton().setCurrentInstance(m_instances[i]->name());
}
if (m_restartOnSelect) {
@@ -479,7 +479,7 @@ QString getInstanceName(
QWidget* parent, const QString& title, const QString& moreText,
const QString& label, const QString& oldName={})
{
- auto& m = InstanceManager::instance();
+ auto& m = InstanceManager::singleton();
QDialog dlg(parent);
dlg.setWindowTitle(title);
@@ -554,7 +554,7 @@ void InstanceManagerDialog::rename()
const auto selIndex = singleSelectionIndex();
- auto& m = InstanceManager::instance();
+ auto& m = InstanceManager::singleton();
if (i->isActive()) {
QMessageBox::information(this,
tr("Rename instance"), tr("The active instance cannot be renamed."));
@@ -622,7 +622,7 @@ void InstanceManagerDialog::deleteInstance()
return;
}
- auto& m = InstanceManager::instance();
+ auto& m = InstanceManager::singleton();
if (i->isActive()) {
QMessageBox::information(this,
tr("Deleting instance"), tr("The active instance cannot be deleted."));
@@ -800,7 +800,7 @@ void InstanceManagerDialog::fillData(const InstanceInfo& ii)
ui->gameDir->setText(ii.gamePath());
setButtonsEnabled(true);
- const auto& m = InstanceManager::instance();
+ const auto& m = InstanceManager::singleton();
ui->rename->setEnabled(!ii.isPortable());
diff --git a/src/main.cpp b/src/main.cpp
index 7005d374..e56197c9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -274,7 +274,7 @@ std::optional<int> handleCommandLine(
std::optional<Instance> selectInstance()
{
- auto& m = InstanceManager::instance();
+ auto& m = InstanceManager::singleton();
NexusInterface ni(nullptr);
PluginContainer pc(nullptr);
@@ -505,7 +505,7 @@ int runApplication(
OrganizerCore organizer(settings);
if (!organizer.bootstrap()) {
reportError("failed to set up data paths");
- InstanceManager::instance().clearCurrentInstance();
+ InstanceManager::singleton().clearCurrentInstance();
return 1;
}
@@ -522,7 +522,7 @@ int runApplication(
} else if (setupResult == SetupInstanceResults::TryAgain) {
continue;
} else if (setupResult == SetupInstanceResults::SelectAnother) {
- InstanceManager::instance().clearCurrentInstance();
+ InstanceManager::singleton().clearCurrentInstance();
return RestartExitCode;
} else {
return 1;
@@ -650,7 +650,7 @@ int doOneRun(
// resets things when MO is "restarted"
resetForRestart(cl);
- auto& m = InstanceManager::instance();
+ auto& m = InstanceManager::singleton();
auto currentInstance = m.currentInstance();
if (!currentInstance)
@@ -689,7 +689,7 @@ int doOneRun(
if (!setLogDirectory(dataPath)) {
reportError("Failed to create log folder");
- InstanceManager::instance().clearCurrentInstance();
+ InstanceManager::singleton().clearCurrentInstance();
return 1;
}
@@ -724,10 +724,10 @@ int main(int argc, char *argv[])
tt.stop();
if (cl.instance())
- InstanceManager::instance().overrideInstance(*cl.instance());
+ InstanceManager::singleton().overrideInstance(*cl.instance());
if (cl.profile()) {
- InstanceManager::instance().overrideProfile(*cl.profile());
+ InstanceManager::singleton().overrideProfile(*cl.profile());
}
// makes plugin data path available to plugins, see
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 02900571..ea8a0efe 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -837,7 +837,7 @@ void MainWindow::setupToolbar()
log::warn("no separator found on the toolbar, icons won't be right-aligned");
}
- if (!InstanceManager::instance().allowedToChangeInstance()) {
+ if (!InstanceManager::singleton().allowedToChangeInstance()) {
ui->actionChange_Game->setVisible(false);
}
}
diff --git a/src/processrunner.cpp b/src/processrunner.cpp
index 8ee0914b..bc4e6227 100644
--- a/src/processrunner.cpp
+++ b/src/processrunner.cpp
@@ -586,7 +586,7 @@ ProcessRunner& ProcessRunner::setFromExecutable(const Executable& exe)
ProcessRunner& ProcessRunner::setFromShortcut(const MOShortcut& shortcut)
{
- const auto currentInstance = InstanceManager::instance().currentInstance();
+ const auto currentInstance = InstanceManager::singleton().currentInstance();
if (currentInstance)
{
diff --git a/src/statusbar.cpp b/src/statusbar.cpp
index aefabc73..8fa43d5b 100644
--- a/src/statusbar.cpp
+++ b/src/statusbar.cpp
@@ -154,7 +154,7 @@ void StatusBar::updateNormalMessage(OrganizerCore& core)
}
QString instance = "?";
- if (auto i=InstanceManager::instance().currentInstance())
+ if (auto i=InstanceManager::singleton().currentInstance())
instance = i->name();
QString profile = core.profileName();