From f7d7661d58d9b0d158fd959978b29c9c1a3a8de7 Mon Sep 17 00:00:00 2001
From: Seth Riley <17361645+Qudix@users.noreply.github.com>
Date: Mon, 2 Nov 2020 13:20:05 -0600
Subject: Changing the location of several directories
---
src/CMakeLists.txt | 14 ++++----
src/dlls.manifest | 29 ++++++++++++++++
src/dlls.manifest.qt5 | 29 ----------------
src/env.cpp | 7 ++++
src/env.h | 1 +
src/main.cpp | 91 ++++++++++++++-------------------------------------
src/qt.conf | 8 +++--
7 files changed, 76 insertions(+), 103 deletions(-)
create mode 100644 src/dlls.manifest
delete mode 100644 src/dlls.manifest.qt5
(limited to 'src')
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e95179b8..79389e42 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -223,17 +223,19 @@ 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/dlls/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/dlls)
deploy_qt(BINARIES ModOrganizer.exe uibase.dll plugins/bsa_packer.dll)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll DESTINATION bin/dlls/imageformats)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html DESTINATION bin/resources)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll DESTINATION bin/dlls/QtPlugins/imageformats)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html DESTINATION bin/dlls/resources)
diff --git a/src/dlls.manifest b/src/dlls.manifest
new file mode 100644
index 00000000..846a02ae
--- /dev/null
+++ b/src/dlls.manifest
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/dlls.manifest.qt5 b/src/dlls.manifest.qt5
deleted file mode 100644
index cae74df1..00000000
--- a/src/dlls.manifest.qt5
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/env.cpp b/src/env.cpp
index 2862aa95..4e5ad196 100644
--- a/src/env.cpp
+++ b/src/env.cpp
@@ -394,6 +394,13 @@ QString path()
return get("PATH");
}
+QString prependToPath(const QString& s)
+{
+ auto old = path();
+ set("PATH", s + ";" + old);
+ return old;
+}
+
QString addPath(const QString& s)
{
auto old = path();
diff --git a/src/env.h b/src/env.h
index 5c7492c6..954c7bb0 100644
--- a/src/env.h
+++ b/src/env.h
@@ -236,6 +236,7 @@ QString get(const QString& name);
QString set(const QString& name, const QString& value);
QString path();
+QString prependToPath(const QString& s);
QString addPath(const QString& s);
QString setPath(const QString& s);
diff --git a/src/main.cpp b/src/main.cpp
index a81ae962..60b06817 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -464,69 +464,6 @@ MOBase::IPluginGame *determineCurrentGame(
return nullptr;
}
-
-// extend path to include dll directory so plugins don't need a manifest
-// (using AddDllDirectory would be an alternative to this but it seems fairly
-// complicated esp.
-// since it isn't easily accessible on Windows < 8
-// SetDllDirectory replaces other search directories and this seems to
-// propagate to child processes)
-void setupPath()
-{
- static const int BUFSIZE = 4096;
-
- QCoreApplication::setLibraryPaths(QStringList(QCoreApplication::applicationDirPath() + "/dlls") + QCoreApplication::libraryPaths());
-
- boost::scoped_array oldPath(new TCHAR[BUFSIZE]);
- DWORD offset = ::GetEnvironmentVariable(TEXT("PATH"), oldPath.get(), BUFSIZE);
- if (offset > BUFSIZE) {
- oldPath.reset(new TCHAR[offset]);
- ::GetEnvironmentVariable(TEXT("PATH"), oldPath.get(), offset);
- }
-
- std::wstring newPath(ToWString(QDir::toNativeSeparators(
- QCoreApplication::applicationDirPath())) + L"\\dlls");
- newPath += L";";
- newPath += oldPath.get();
-
- ::SetEnvironmentVariableW(L"PATH", newPath.c_str());
-}
-
-void preloadDll(const QString& filename)
-{
- if (GetModuleHandleW(filename.toStdWString().c_str())) {
- // already loaded, this can happen when "restarting" MO by switching
- // instances, for example
- return;
- }
-
- const auto appPath = QDir::toNativeSeparators(
- QCoreApplication::applicationDirPath());
-
- const auto dllPath = appPath + "\\" + filename;
-
- if (!QFile::exists(dllPath)) {
- log::warn("{} not found", dllPath);
- return;
- }
-
- if (!LoadLibraryW(dllPath.toStdWString().c_str())) {
- const auto e = GetLastError();
- log::warn("failed to load {}: {}", dllPath, formatSystemMessage(e));
- }
-}
-
-void preloadSsl()
-{
-#if Q_PROCESSOR_WORDSIZE == 8
- preloadDll("libcrypto-1_1-x64.dll");
- preloadDll("libssl-1_1-x64.dll");
-#elif Q_PROCESSOR_WORDSIZE == 4
- preloadDll("libcrypto-1_1.dll");
- preloadDll("libssl-1_1.dll");
-#endif
-}
-
static QString getVersionDisplayString()
{
return createVersionInfo().displayString(3);
@@ -543,7 +480,6 @@ int runApplication(MOApplication &application, SingleInstance &instance,
getVersionDisplayString(), GITID, QCoreApplication::applicationDirPath(),
MOShared::getUsvfsVersionString());
- preloadSsl();
if (!QSslSocket::supportsSsl()) {
log::warn("no ssl support");
}
@@ -889,6 +825,25 @@ void initLogging()
qInstallMessageHandler(qtLogCallback);
}
+void preloadDll(const QString& filename)
+{
+ if (GetModuleHandleW(filename.toStdWString().c_str()))
+ return;
+
+ const auto appPath = QDir::toNativeSeparators(QDir::currentPath());
+ const auto dllPath = appPath + "\\dlls\\" + filename;
+
+ if (!QFile::exists(dllPath)) {
+ log::warn("{} not found", dllPath);
+ return;
+ }
+
+ if (!LoadLibraryW(dllPath.toStdWString().c_str())) {
+ const auto e = GetLastError();
+ log::warn("failed to load {}: {}", dllPath, formatSystemMessage(e));
+ }
+}
+
int main(int argc, char *argv[])
{
@@ -905,6 +860,9 @@ int main(int argc, char *argv[])
}
}
+ preloadDll("libcrypto-1_1-x64.dll");
+ preloadDll("libssl-1_1-x64.dll");
+
initLogging();
//Make sure the configured temp folder exists
@@ -925,9 +883,10 @@ int main(int argc, char *argv[])
MOApplication application(argc, argv);
QStringList arguments = application.arguments();
- SetThisThreadName("main");
+ env::prependToPath(QDir::toNativeSeparators(
+ QCoreApplication::applicationDirPath() + "/dlls"));
- setupPath();
+ SetThisThreadName("main");
bool forcePrimary = false;
if (arguments.contains("update")) {
diff --git a/src/qt.conf b/src/qt.conf
index f834a22a..d5a3f6ac 100644
--- a/src/qt.conf
+++ b/src/qt.conf
@@ -1,3 +1,7 @@
[Paths]
-Prefix=.
-Plugins=dlls
+Prefix=dlls
+Libraries=.
+LibraryExecutables=.
+Plugins=QtPlugins
+Imports=QtImports
+Qml2Imports=QtImports
\ No newline at end of file
--
cgit v1.3.1
From 5bad8f903205fb0e21c60fafd0d6913d3143a477 Mon Sep 17 00:00:00 2001
From: Seth Riley <17361645+Qudix@users.noreply.github.com>
Date: Mon, 2 Nov 2020 19:13:04 -0600
Subject: Fixed tutorials
---
src/main.cpp | 6 ++----
src/mainwindow.cpp | 4 ++--
src/qt.conf | 3 ++-
3 files changed, 6 insertions(+), 7 deletions(-)
(limited to 'src')
diff --git a/src/main.cpp b/src/main.cpp
index 60b06817..a3e30fa0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -693,10 +693,8 @@ int runApplication(MOApplication &application, SingleInstance &instance,
}
log::debug("initializing tutorials");
- TutorialManager::init(
- qApp->applicationDirPath() + "/"
- + QString::fromStdWString(AppConfig::tutorialsPath()) + "/",
- &organizer);
+ QString tutorialsPath = QCoreApplication::applicationDirPath() + "/dlls/tutorials/";
+ TutorialManager::init(tutorialsPath, &organizer);
if (!application.setStyleFile(settings.interface().styleName().value_or(""))) {
// disable invalid stylesheet
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 65c1d65c..650f5db3 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1203,7 +1203,7 @@ void MainWindow::createHelpMenu()
ActionList tutorials;
- QDirIterator dirIter(QApplication::applicationDirPath() + "/tutorials", QStringList("*.js"), QDir::Files);
+ QDirIterator dirIter(QApplication::applicationDirPath() + "/dlls/tutorials", QStringList("*.js"), QDir::Files);
while (dirIter.hasNext()) {
dirIter.next();
QString fileName = dirIter.fileName();
@@ -1315,7 +1315,7 @@ bool MainWindow::addProfile()
void MainWindow::hookUpWindowTutorials()
{
- QDirIterator dirIter(QApplication::applicationDirPath() + "/tutorials", QStringList("*.js"), QDir::Files);
+ QDirIterator dirIter(QApplication::applicationDirPath() + "/dlls/tutorials", QStringList("*.js"), QDir::Files);
while (dirIter.hasNext()) {
dirIter.next();
QString fileName = dirIter.fileName();
diff --git a/src/qt.conf b/src/qt.conf
index d5a3f6ac..6a9d56ae 100644
--- a/src/qt.conf
+++ b/src/qt.conf
@@ -4,4 +4,5 @@ Libraries=.
LibraryExecutables=.
Plugins=QtPlugins
Imports=QtImports
-Qml2Imports=QtImports
\ No newline at end of file
+Qml2Imports=QtImports
+Translations=translations
\ No newline at end of file
--
cgit v1.3.1
From 7cc76f7cea3445f4081477e91721a922d69fdb9b Mon Sep 17 00:00:00 2001
From: Seth Riley <17361645+Qudix@users.noreply.github.com>
Date: Mon, 2 Nov 2020 19:40:13 -0600
Subject: Fix for deprecated implicit function definition
---
src/tutorials/TutorialOverlay.qml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'src')
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 {
--
cgit v1.3.1
From 68750575d2f28c873b0d68391a7940e61c2ad2d4 Mon Sep 17 00:00:00 2001
From: Seth Riley <17361645+Qudix@users.noreply.github.com>
Date: Tue, 3 Nov 2020 18:12:23 -0600
Subject: Implement suggestions
---
src/CMakeLists.txt | 8 ++++----
src/main.cpp | 2 +-
src/mainwindow.cpp | 6 +++---
src/qt.conf | 14 +++++++-------
src/settingsdialoggeneral.cpp | 2 +-
5 files changed, 16 insertions(+), 16 deletions(-)
(limited to 'src')
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79389e42..782d6589 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -227,15 +227,15 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest
DESTINATION bin/dlls
RENAME dlls.manifest)
-install(FILES ${qm_files} DESTINATION bin/dlls/translations)
+install(FILES ${qm_files} DESTINATION bin/resources/translations)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stylesheets
DESTINATION bin)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tutorials
- DESTINATION bin/dlls)
+ DESTINATION bin/resources)
deploy_qt(BINARIES ModOrganizer.exe uibase.dll plugins/bsa_packer.dll)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll DESTINATION bin/dlls/QtPlugins/imageformats)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html DESTINATION bin/dlls/resources)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll DESTINATION bin/dlls/imageformats)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html DESTINATION bin/resources)
diff --git a/src/main.cpp b/src/main.cpp
index a3e30fa0..6b1ec482 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -693,7 +693,7 @@ int runApplication(MOApplication &application, SingleInstance &instance,
}
log::debug("initializing tutorials");
- QString tutorialsPath = QCoreApplication::applicationDirPath() + "/dlls/tutorials/";
+ QString tutorialsPath = QCoreApplication::applicationDirPath() + "/resources/tutorials/";
TutorialManager::init(tutorialsPath, &organizer);
if (!application.setStyleFile(settings.interface().styleName().value_or(""))) {
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 650f5db3..522657fb 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1203,7 +1203,7 @@ void MainWindow::createHelpMenu()
ActionList tutorials;
- QDirIterator dirIter(QApplication::applicationDirPath() + "/dlls/tutorials", QStringList("*.js"), QDir::Files);
+ QDirIterator dirIter(QApplication::applicationDirPath() + "/resources/tutorials", QStringList("*.js"), QDir::Files);
while (dirIter.hasNext()) {
dirIter.next();
QString fileName = dirIter.fileName();
@@ -1315,7 +1315,7 @@ bool MainWindow::addProfile()
void MainWindow::hookUpWindowTutorials()
{
- QDirIterator dirIter(QApplication::applicationDirPath() + "/dlls/tutorials", QStringList("*.js"), QDir::Files);
+ QDirIterator dirIter(QApplication::applicationDirPath() + "/resources/tutorials", QStringList("*.js"), QDir::Files);
while (dirIter.hasNext()) {
dirIter.next();
QString fileName = dirIter.fileName();
@@ -5185,7 +5185,7 @@ void MainWindow::installTranslator(const QString &name)
{
QTranslator *translator = new QTranslator(this);
QString fileName = name + "_" + m_CurrentLanguage;
- if (!translator->load(fileName, qApp->applicationDirPath() + "/translations")) {
+ if (!translator->load(fileName, qApp->applicationDirPath() + "/resources/translations")) {
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/qt.conf b/src/qt.conf
index 6a9d56ae..2b659e87 100644
--- a/src/qt.conf
+++ b/src/qt.conf
@@ -1,8 +1,8 @@
[Paths]
-Prefix=dlls
-Libraries=.
-LibraryExecutables=.
-Plugins=QtPlugins
-Imports=QtImports
-Qml2Imports=QtImports
-Translations=translations
\ No newline at end of file
+Prefix=.
+Libraries=dlls
+LibraryExecutables=dlls
+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 3d14d521..072764c9 100644
--- a/src/settingsdialoggeneral.cpp
+++ b/src/settingsdialoggeneral.cpp
@@ -82,7 +82,7 @@ void GeneralSettingsTab::addLanguages()
const QRegExp exp(pattern);
QDirIterator iter(
- QCoreApplication::applicationDirPath() + "/translations",
+ QCoreApplication::applicationDirPath() + "/resources/translations",
QDir::Files);
std::vector> languages;
--
cgit v1.3.1
From 92f3694acdf3b576d61e454a00c7a40ab877bed9 Mon Sep 17 00:00:00 2001
From: Seth Riley <17361645+Qudix@users.noreply.github.com>
Date: Fri, 6 Nov 2020 12:16:37 -0600
Subject: Fixed bad merge
---
src/main.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/main.cpp b/src/main.cpp
index bfd23103..a905df5d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -708,8 +708,7 @@ int main(int argc, char *argv[])
TimeThis tt("main() to doOneRun()");
- env::prependToPath(QDir::toNativeSeparators(
- QCoreApplication::applicationDirPath() + "/dlls"));
+ SetThisThreadName("main");
initLogging();
auto application = MOApplication::create(argc, argv);
--
cgit v1.3.1
From b9bc1a2d56be5efc4478f1487c3e7dfb3529102d Mon Sep 17 00:00:00 2001
From: Qudix <17361645+Qudix@users.noreply.github.com>
Date: Mon, 9 Nov 2020 14:10:50 -0600
Subject: Using AppConfig
---
src/mainwindow.cpp | 11 ++++++++---
src/settingsdialoggeneral.cpp | 6 +++---
src/shared/appconfig.inc | 3 ++-
3 files changed, 13 insertions(+), 7 deletions(-)
(limited to 'src')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 74885e28..52d97270 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1204,7 +1204,9 @@ void MainWindow::createHelpMenu()
ActionList tutorials;
- QDirIterator dirIter(QApplication::applicationDirPath() + "/resources/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() + "/resources/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();
@@ -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() + "/resources/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/settingsdialoggeneral.cpp b/src/settingsdialoggeneral.cpp
index 87489ab4..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() + "/resources/translations",
- QDir::Files);
+ QString translationsPath = qApp->applicationDirPath()
+ + "/" + QString::fromStdWString(AppConfig::translationsPath());
+ QDirIterator iter(translationsPath, QDir::Files);
std::vector> 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")
--
cgit v1.3.1
From f43b2284dd873761f9d0cd781df7db6f197cbfc9 Mon Sep 17 00:00:00 2001
From: Qudix <17361645+Qudix@users.noreply.github.com>
Date: Wed, 11 Nov 2020 20:58:38 -0600
Subject: QtWebEngine does not respect built-in qt.conf
---
src/qt.conf | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/qt.conf b/src/qt.conf
index 2b659e87..5e070fa3 100644
--- a/src/qt.conf
+++ b/src/qt.conf
@@ -1,7 +1,6 @@
[Paths]
-Prefix=.
Libraries=dlls
-LibraryExecutables=dlls
+LibraryExecutables=resources
Plugins=dlls
Imports=dlls
Qml2Imports=dlls
--
cgit v1.3.1