From 11ec5cf2e28fd5ab6dd2a155539cd17474f9bf51 Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Tue, 28 Feb 2012 22:35:29 +0100 Subject: [PATCH] Stylesheet location changed in CMakeLists and some minor fixes to the launcher --- CMakeLists.txt | 2 -- apps/launcher/CMakeLists.txt | 8 ++++++-- apps/launcher/datafilespage.cpp | 14 ++++++++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e62391c74..4c686733b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -329,7 +329,6 @@ if(WIN32) FILE(GLOB files "${OpenMW_BINARY_DIR}/Release/*.*") INSTALL(FILES ${files} DESTINATION ".") INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg") - INSTALL(FILES "${OpenMW_BINARY_DIR}/launcher.qss" "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION ".") INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".") SET(CPACK_GENERATOR "NSIS") @@ -428,7 +427,6 @@ if (APPLE) install(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" RENAME "openmw.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) install(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) - install(FILES "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) set(CPACK_GENERATOR "DragNDrop") set(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) set(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR}) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index d648f4674..3a5ccdd04 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -72,10 +72,14 @@ endif() if (APPLE) configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss - "${APP_BUNDLE_DIR}/../launcher.qss") - configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss + "${APP_BUNDLE_DIR}/../resources/launcher.qss") + configure_file(${CMAKE_SOURCE_DIR}/files/launcher.cfg "${APP_BUNDLE_DIR}/../launcher.cfg") else() + configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/launcher.qss") + + # Fallback in case getGlobalDataPath does not point to resources configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.qss") diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index b0d9779d5..b88664f0c 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -987,8 +987,8 @@ void DataFilesPage::readConfig() void DataFilesPage::writeConfig(QString profile) { - // Don't overwrite the config if no plugins are found - if (mPluginsModel->rowCount() < 1) { + // Don't overwrite the config if no masters are found + if (mMastersWidget->rowCount() < 1) { return; } @@ -1001,9 +1001,15 @@ void DataFilesPage::writeConfig(QString profile) } // Prepare the OpenMW config + QString config = QString::fromStdString((mCfgMgr.getLocalPath() / "openmw.cfg").string()); + QFile file(config); + + if (!file.exists()) { + config = QString::fromStdString((mCfgMgr.getUserPath() / "openmw.cfg").string()); + } // Open the config as a QFile - QFile file(QString::fromStdString((mCfgMgr.getUserPath()/"openmw.cfg").string())); + file.setFileName(config); if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) { // File cannot be opened or created @@ -1086,5 +1092,5 @@ void DataFilesPage::writeConfig(QString profile) file.close(); mLauncherConfig->endGroup(); mLauncherConfig->endGroup(); - + mLauncherConfig->sync(); }