diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/dlls.manifest (renamed from src/dlls.manifest.qt5) | 58 | ||||
| -rw-r--r-- | src/env.cpp | 7 | ||||
| -rw-r--r-- | src/env.h | 1 | ||||
| -rw-r--r-- | src/main.cpp | 97 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 6 | ||||
| -rw-r--r-- | src/qt.conf | 5 | ||||
| -rw-r--r-- | src/settingsdialoggeneral.cpp | 2 | ||||
| -rw-r--r-- | src/tutorials/TutorialOverlay.qml | 4 |
9 files changed, 82 insertions, 108 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e95179b8..782d6589 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -223,15 +223,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/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/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(); @@ -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..6b1ec482 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<TCHAR> 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"); } @@ -757,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() + "/resources/tutorials/"; + TutorialManager::init(tutorialsPath, &organizer); if (!application.setStyleFile(settings.interface().styleName().value_or(""))) { // disable invalid stylesheet @@ -889,6 +823,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 +858,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 +881,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/mainwindow.cpp b/src/mainwindow.cpp index 65c1d65c..522657fb 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() + "/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() + "/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 f834a22a..2b659e87 100644 --- a/src/qt.conf +++ b/src/qt.conf @@ -1,3 +1,8 @@ [Paths]
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<std::pair<QString, QString>> languages; 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 {
|
