diff options
| author | Qudix <17361645+Qudix@users.noreply.github.com> | 2020-11-14 19:45:23 -0600 |
|---|---|---|
| committer | Qudix <17361645+Qudix@users.noreply.github.com> | 2020-11-14 19:45:23 -0600 |
| commit | 67188a39cb6aa9d1cad172aec6aac9977af8e79a (patch) | |
| tree | 3e4e31887a57b49747c31c342077a164025f9066 /src | |
| parent | b9ec979b4c884b35981d0d6fe0abe914e00daa54 (diff) | |
| parent | 4833e494d56b351e52423f2835a7a91ab8c284b6 (diff) | |
Merge branch 'master' of https://github.com/ModOrganizer2/modorganizer into tracking_integration
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/aboutdialog.ui | 5 | ||||
| -rw-r--r-- | src/createinstancedialog.cpp | 10 | ||||
| -rw-r--r-- | src/dlls.manifest (renamed from src/dlls.manifest.qt5) | 58 | ||||
| -rw-r--r-- | src/instancemanager.cpp | 6 | ||||
| -rw-r--r-- | src/instancemanager.h | 5 | ||||
| -rw-r--r-- | src/instancemanagerdialog.cpp | 6 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 13 | ||||
| -rw-r--r-- | src/moapplication.cpp | 18 | ||||
| -rw-r--r-- | src/modlist.cpp | 8 | ||||
| -rw-r--r-- | src/qt.conf | 6 | ||||
| -rw-r--r-- | src/settingsdialoggeneral.cpp | 6 | ||||
| -rw-r--r-- | src/shared/appconfig.inc | 3 | ||||
| -rw-r--r-- | src/tutorials/TutorialOverlay.qml | 4 |
14 files changed, 104 insertions, 54 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb4b151f..50ce4178 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -231,15 +231,17 @@ target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt5 +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest DESTINATION bin/dlls RENAME dlls.manifest) -install(FILES ${qm_files} DESTINATION bin/translations) +install(FILES ${qm_files} DESTINATION bin/resources/translations) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stylesheets - ${CMAKE_CURRENT_SOURCE_DIR}/tutorials - DESTINATION bin) + DESTINATION bin) + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tutorials + DESTINATION bin/resources) deploy_qt(BINARIES ModOrganizer.exe uibase.dll plugins/bsa_packer.dll) diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui index 88cc96e3..f4cb29d5 100644 --- a/src/aboutdialog.ui +++ b/src/aboutdialog.ui @@ -496,6 +496,11 @@ </item>
<item>
<property name="text">
+ <string notr="true">Qudix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
<string notr="true">reedts</string>
</property>
</item>
diff --git a/src/createinstancedialog.cpp b/src/createinstancedialog.cpp index 47cb9d5c..a4e3c336 100644 --- a/src/createinstancedialog.cpp +++ b/src/createinstancedialog.cpp @@ -131,7 +131,7 @@ CreateInstanceDialog::CreateInstanceDialog( ui->pages->setCurrentIndex(0); ui->launch->setChecked(true); - if (!m_settings) + if (!InstanceManager::singleton().hasAnyInstances()) { // first run of MO, there are no instances yet, force launch ui->launch->setEnabled(false); @@ -314,6 +314,10 @@ void CreateInstanceDialog::finish() }; + // don't restart if this is the first instance, it'll be selected and opened + const bool mustRestart = InstanceManager::singleton().hasAnyInstances(); + + try { std::vector<std::unique_ptr<DirectoryCreator>> dirs; @@ -396,9 +400,7 @@ void CreateInstanceDialog::finish() if (ui->launch->isChecked()) { InstanceManager::singleton().setCurrentInstance(ci.instanceName); - if (m_settings) { - // don't restart without settings, it happens on startup when there are - // no instances + if (mustRestart) { ExitModOrganizer(Exit::Restart); m_switching = true; } diff --git a/src/dlls.manifest.qt5 b/src/dlls.manifest index cae74df1..846a02ae 100644 --- a/src/dlls.manifest.qt5 +++ b/src/dlls.manifest @@ -1,29 +1,29 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <assemblyIdentity type="win32" name="dlls" version="1.0.0.0" processorArchitecture="x86"/>
- <file name="7z.dll"/>
- <file name="archive.dll"/>
- <file name="d3dcompiler_47.dll"/>
- <file name="libEGL.dll"/>
- <file name="libGLESV2.dll"/>
- <file name="liblz4.dll"/>
- <file name="opengl32sw.dll"/>
- <file name="Qt5Core.dll"/>
- <file name="Qt5Gui.dll"/>
- <file name="Qt5Network.dll"/>
- <file name="Qt5Positioning.dll"/>
- <file name="Qt5PrintSupport.dll"/>
- <file name="Qt5Qml.dll"/>
- <file name="Qt5QmlModels.dll"/>
- <file name="Qt5QmlWorkerScript.dll"/>
- <file name="Qt5Quick.dll"/>
- <file name="Qt5QuickWidgets.dll"/>
- <file name="Qt5SerialPort.dll"/>
- <file name="Qt5Svg.dll"/>
- <file name="Qt5WebChannel.dll"/>
- <file name="Qt5WebEngineCore.dll"/>
- <file name="Qt5WebEngineWidgets.dll"/>
- <file name="Qt5WebSockets.dll"/>
- <file name="Qt5Widgets.dll"/>
- <file name="Qt5WinExtras.dll"/>
-</assembly>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity type="win32" name="dlls" version="1.0.0.0" processorArchitecture="x86"/> + <file name="7z.dll"/> + <file name="archive.dll"/> + <file name="d3dcompiler_47.dll"/> + <file name="libEGL.dll"/> + <file name="libGLESV2.dll"/> + <file name="liblz4.dll"/> + <file name="opengl32sw.dll"/> + <file name="Qt5Core.dll"/> + <file name="Qt5Gui.dll"/> + <file name="Qt5Network.dll"/> + <file name="Qt5Positioning.dll"/> + <file name="Qt5PrintSupport.dll"/> + <file name="Qt5Qml.dll"/> + <file name="Qt5QmlModels.dll"/> + <file name="Qt5QmlWorkerScript.dll"/> + <file name="Qt5Quick.dll"/> + <file name="Qt5QuickWidgets.dll"/> + <file name="Qt5SerialPort.dll"/> + <file name="Qt5Svg.dll"/> + <file name="Qt5WebChannel.dll"/> + <file name="Qt5WebEngineCore.dll"/> + <file name="Qt5WebEngineWidgets.dll"/> + <file name="Qt5WebSockets.dll"/> + <file name="Qt5Widgets.dll"/> + <file name="Qt5WinExtras.dll"/> +</assembly> diff --git a/src/instancemanager.cpp b/src/instancemanager.cpp index 4191f850..2753fc4c 100644 --- a/src/instancemanager.cpp +++ b/src/instancemanager.cpp @@ -538,6 +538,12 @@ void InstanceManager::overrideProfile(const QString& profileName) m_overrideProfileName = profileName; } +void InstanceManager::clearOverrides() +{ + m_overrideInstanceName = {}; + m_overrideProfileName = {}; +} + std::optional<Instance> InstanceManager::currentInstance() const { const QString profile = m_overrideProfileName ? diff --git a/src/instancemanager.h b/src/instancemanager.h index 4f8b01c7..981aed43 100644 --- a/src/instancemanager.h +++ b/src/instancemanager.h @@ -232,6 +232,11 @@ public: // void overrideProfile(const QString& profileName); + // clears instance and profile overrides, used when restarting MO to select + // another instance + // + void clearOverrides(); + // returns a game plugin that considers the given directory valid // // this will check for an INI file in the directory and use its game name diff --git a/src/instancemanagerdialog.cpp b/src/instancemanagerdialog.cpp index ff76e121..2497d8d8 100644 --- a/src/instancemanagerdialog.cpp +++ b/src/instancemanagerdialog.cpp @@ -580,13 +580,17 @@ void InstanceManagerDialog::onSelection() void InstanceManagerDialog::createNew() { - CreateInstanceDialog dlg(m_pc, &Settings::instance(), this); + // there might not be settings available; the dialog can be shown when the + // last selected instance doesn't exist anymore + CreateInstanceDialog dlg(m_pc, Settings::maybeInstance(), this); + if (dlg.exec() != QDialog::Accepted) { return; } if (dlg.switching()) { // restarting MO + accept(); return; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d7549a4d..4e78f5dd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1204,7 +1204,9 @@ void MainWindow::createHelpMenu() ActionList tutorials; - QDirIterator dirIter(QApplication::applicationDirPath() + "/tutorials", QStringList("*.js"), QDir::Files); + QString tutorialPath = QApplication::applicationDirPath() + + "/" + QString::fromStdWString(AppConfig::tutorialsPath()) + "/"; + QDirIterator dirIter(tutorialPath, QStringList("*.js"), QDir::Files); while (dirIter.hasNext()) { dirIter.next(); QString fileName = dirIter.fileName(); @@ -1316,7 +1318,8 @@ bool MainWindow::addProfile() void MainWindow::hookUpWindowTutorials() { - QDirIterator dirIter(QApplication::applicationDirPath() + "/tutorials", QStringList("*.js"), QDir::Files); + QString tutorialPath = QApplication::applicationDirPath() + "/" + QString::fromStdWString(AppConfig::tutorialsPath()) + "/"; + QDirIterator dirIter(tutorialPath, QStringList("*.js"), QDir::Files); while (dirIter.hasNext()) { dirIter.next(); QString fileName = dirIter.fileName(); @@ -1963,7 +1966,7 @@ void MainWindow::refreshSaveList() 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); + return lhs.fileTime(QFileDevice::FileModificationTime) > rhs.fileTime(QFileDevice::FileModificationTime); }); for (const QFileInfo &file : files) { @@ -5209,7 +5212,9 @@ void MainWindow::installTranslator(const QString &name) { QTranslator *translator = new QTranslator(this); QString fileName = name + "_" + m_CurrentLanguage; - if (!translator->load(fileName, qApp->applicationDirPath() + "/translations")) { + QString translationsPath = qApp->applicationDirPath() + + "/" + QString::fromStdWString(AppConfig::translationsPath()); + if (!translator->load(fileName, translationsPath)) { if (m_CurrentLanguage.contains(QRegularExpression("^.*_(EN|en)(-.*)?$"))) { log::debug("localization file %s not found", fileName); } // we don't actually expect localization files for English (en, en-us, en-uk, and any variation thereof) diff --git a/src/moapplication.cpp b/src/moapplication.cpp index 9139acbb..e7ac3926 100644 --- a/src/moapplication.cpp +++ b/src/moapplication.cpp @@ -170,12 +170,13 @@ int MOApplication::run(MOMultiProcess& multiProcess) {
try
{
- // resets things when MO is "restarted"
- resetForRestart();
-
tt.stop();
+
const auto r = doOneRun(multiProcess);
+
if (r == RestartExitCode) {
+ // resets things when MO is "restarted"
+ resetForRestart();
continue;
}
@@ -396,6 +397,10 @@ std::optional<Instance> MOApplication::getCurrentInstance() if (!currentInstance)
{
+ // clear any overrides that might have been given on the command line
+ m.clearOverrides();
+ m_cl.clear();
+
currentInstance = selectInstance();
}
else
@@ -403,6 +408,10 @@ std::optional<Instance> MOApplication::getCurrentInstance() if (!QDir(currentInstance->directory()).exists()) {
// the previously used instance doesn't exist anymore
+ // clear any overrides that might have been given on the command line
+ m.clearOverrides();
+ m_cl.clear();
+
if (m.hasAnyInstances()) {
MOShared::criticalOnTop(QObject::tr(
"Instance at '%1' not found. Select another instance.")
@@ -466,6 +475,9 @@ void MOApplication::resetForRestart() // don't reprocess command line
m_cl.clear();
+
+ // clear instance and profile overrides
+ InstanceManager::singleton().clearOverrides();
}
bool MOApplication::setStyleFile(const QString& styleName)
diff --git a/src/modlist.cpp b/src/modlist.cpp index 04abfb01..d7324e7f 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -860,9 +860,11 @@ void ModList::highlightMods(const QItemSelectionModel *selection, const MOShared if (fileEntry.get() != nullptr) { QString originName = QString::fromStdWString(directoryEntry.getOriginByID(fileEntry->getOrigin()).getName()); - - auto modInfo = ModInfo::getByName(originName); - modInfo->setPluginSelected(true); + const auto index = ModInfo::getIndex(originName); + if (index != UINT_MAX) { + auto modInfo = ModInfo::getByIndex(index); + modInfo->setPluginSelected(true); + } } } notifyChange(0, rowCount() - 1); diff --git a/src/qt.conf b/src/qt.conf index f834a22a..5e070fa3 100644 --- a/src/qt.conf +++ b/src/qt.conf @@ -1,3 +1,7 @@ [Paths]
-Prefix=.
+Libraries=dlls
+LibraryExecutables=resources
Plugins=dlls
+Imports=dlls
+Qml2Imports=dlls
+Translations=resources/translations
\ No newline at end of file diff --git a/src/settingsdialoggeneral.cpp b/src/settingsdialoggeneral.cpp index f29e1d24..9eae2ba1 100644 --- a/src/settingsdialoggeneral.cpp +++ b/src/settingsdialoggeneral.cpp @@ -81,9 +81,9 @@ void GeneralSettingsTab::addLanguages() const QRegExp exp(pattern); - QDirIterator iter( - QCoreApplication::applicationDirPath() + "/translations", - QDir::Files); + QString translationsPath = qApp->applicationDirPath() + + "/" + QString::fromStdWString(AppConfig::translationsPath()); + QDirIterator iter(translationsPath, QDir::Files); std::vector<std::pair<QString, QString>> languages; diff --git a/src/shared/appconfig.inc b/src/shared/appconfig.inc index 5839c2f4..8d4125cf 100644 --- a/src/shared/appconfig.inc +++ b/src/shared/appconfig.inc @@ -6,7 +6,8 @@ APPPARAM(std::wstring, downloadPath, L"downloads") APPPARAM(std::wstring, overwritePath, L"overwrite")
APPPARAM(std::wstring, stylesheetsPath, L"stylesheets")
APPPARAM(std::wstring, cachePath, L"webcache")
-APPPARAM(std::wstring, tutorialsPath, L"tutorials")
+APPPARAM(std::wstring, tutorialsPath, L"resources/tutorials")
+APPPARAM(std::wstring, translationsPath, L"resources/translations")
APPPARAM(std::wstring, logPath, L"logs")
APPPARAM(std::wstring, dumpsDir, L"crashDumps")
APPPARAM(std::wstring, defaultProfileName, L"Default")
diff --git a/src/tutorials/TutorialOverlay.qml b/src/tutorials/TutorialOverlay.qml index 47e5065d..0a31ef0e 100644 --- a/src/tutorials/TutorialOverlay.qml +++ b/src/tutorials/TutorialOverlay.qml @@ -55,7 +55,9 @@ Rectangle { Connections {
target: manager
- onTabChanged: tabChanged(index)
+ function onTabChanged() {
+ tabChanged(index)
+ }
}
Tooltip {
|
