diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/commandline.h | 6 | ||||
| -rw-r--r-- | src/createinstancedialog.h | 2 | ||||
| -rw-r--r-- | src/instancemanager.h | 26 | ||||
| -rw-r--r-- | src/instancemanagerdialog.cpp | 9 | ||||
| -rw-r--r-- | src/main.cpp | 14 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 31 | ||||
| -rw-r--r-- | src/moshortcut.h | 31 | ||||
| -rw-r--r-- | src/pluginlistview.cpp | 2 | ||||
| -rw-r--r-- | src/shared/error_report.h | 8 | ||||
| -rw-r--r-- | src/uilocker.h | 5 |
10 files changed, 41 insertions, 93 deletions
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 <vector> #include <memory> @@ -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 <http://www.gnu.org/licenses/>. -*/ - - -#pragma once - +#ifndef MODORGANIZER_INSTANCEMANAGER_INCLUDED +#define MODORGANIZER_INSTANCEMANAGER_INCLUDED #include <QString> #include <QSettings> @@ -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 <http://www.gnu.org/licenses/>. #include "statusbar.h" #include "filterlist.h" #include "datatab.h" +#include "instancemanagerdialog.h" #include <utility.h> #include <dataarchives.h> #include <bsainvalidation.h> @@ -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<std::pair<QString, std::set<QSharedPointer<ModInfo>>>> *watcher = static_cast<QFutureWatcher<std::pair<QString, std::set<QSharedPointer<ModInfo>>>> *>(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 <http://www.gnu.org/licenses/>. -*/ - - -#pragma once - +#ifndef MODORGANIZER_MOSHORTCUT_INCLUDED +#define MODORGANIZER_MOSHORTCUT_INCLUDED #include <QString> - -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 <http://www.gnu.org/licenses/>.
*/
-#pragma once
+#ifndef MODORGANIZER_SHARED_ERROR_REPORT_INCLUDED
+#define MODORGANIZER_SHARED_ERROR_REPORT_INCLUDED
#include <tchar.h>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <string>
-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 <QMainWindow> #include <mutex> @@ -94,3 +95,5 @@ private: void enableAll(); void disable(QWidget* w); }; + +#endif // MODORGANIZER_UILOCKER_INCLUDED |
