From 6131ada0babd02d12cafc7fe6d16ab3059f44585 Mon Sep 17 00:00:00 2001 From: Koncord Date: Mon, 2 Apr 2018 14:04:39 +0800 Subject: [PATCH] [Browser] Add compatibility compilation mode --- apps/browser/CMakeLists.txt | 7 +++++++ apps/browser/MainWindow.cpp | 11 +++++++++++ apps/browser/Settings.cpp | 9 +++++++++ files/tes3mp/ui/Main.ui | 8 ++++---- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/apps/browser/CMakeLists.txt b/apps/browser/CMakeLists.txt index 0f094ed4c..9b6636393 100644 --- a/apps/browser/CMakeLists.txt +++ b/apps/browser/CMakeLists.txt @@ -1,3 +1,5 @@ +option(OPTION_TES3MP_PRE07 "Temporary. Pre 0.7.0 compatible mode." OFF) + set(BROWSER_UI ${CMAKE_SOURCE_DIR}/files/tes3mp/ui/Main.ui ${CMAKE_SOURCE_DIR}/files/tes3mp/ui/ServerInfo.ui @@ -76,6 +78,11 @@ add_executable(tes3mp-browser set_property(TARGET tes3mp-browser PROPERTY CXX_STANDARD 14) +if (OPTION_TES3MP_PRE07) + target_compile_definitions(tes3mp-browser PRIVATE TES3MP_PRE07) +endif (OPTION_TES3MP_PRE07) + + if (WIN32) INSTALL(TARGETS tes3mp-browser RUNTIME DESTINATION ".") endif (WIN32) diff --git a/apps/browser/MainWindow.cpp b/apps/browser/MainWindow.cpp index 04b2e2a37..9b81c9628 100644 --- a/apps/browser/MainWindow.cpp +++ b/apps/browser/MainWindow.cpp @@ -65,6 +65,17 @@ MainWindow::MainWindow(QWidget *parent) loadFavorites(); queryHelper->refresh(); settingsMgr.loadBrowserSettings(*this); + +#ifdef TES3MP_PRE07 + gbModules->setTitle(tr("Plugins Path")); + chbAutosort->setVisible(false); + listModules->setVisible(false); + leAddModule->setVisible(false); + pbAddModule->setVisible(false); + pbUpModule->setVisible(false); + pbDownModule->setVisible(false); + pbRemModule->setVisible(false); +#endif } MainWindow::~MainWindow() diff --git a/apps/browser/Settings.cpp b/apps/browser/Settings.cpp index 964a30983..a298a613e 100644 --- a/apps/browser/Settings.cpp +++ b/apps/browser/Settings.cpp @@ -138,8 +138,12 @@ void SettingsMgr::loadServerSettings(Ui::MainWindow &mw) mw.leServerMPort->setText(QString::fromStdString(serverMgr.getString("port", "MasterServer"))); mw.sbRate->setValue(serverMgr.getInt("rate", "MasterServer")); +#ifndef TES3MP_PRE07 mw.leModulePath->setText(QString::fromStdString(serverMgr.getString("home", "Modules"))); mw.chbAutosort->setCheckState(serverMgr.getBool("autoSort", "Modules") ? Qt::Checked : Qt::Unchecked); +#else + mw.leModulePath->setText(QString::fromStdString(serverMgr.getString("home", "Plugins"))); +#endif } @@ -157,8 +161,13 @@ void SettingsMgr::saveServerSettings(Ui::MainWindow &mw) serverMgr.setString("port", "MasterServer", mw.leServerMPort->text().toStdString()); serverMgr.setInt("rate", "MasterServer", mw.sbRate->value()); +#ifndef TES3MP_PRE07 serverMgr.setString("home", "Modules", mw.leModulePath->text().toStdString()); serverMgr.setBool("autoSort", "Modules", mw.chbAutosort->checkState() == Qt::Checked); +#else + serverMgr.setString("home", "Plugins", mw.leModulePath->text().toStdString()); +#endif + serverMgr.saveUser(serverCfg); } diff --git a/files/tes3mp/ui/Main.ui b/files/tes3mp/ui/Main.ui index 981740018..cf0204c4d 100644 --- a/files/tes3mp/ui/Main.ui +++ b/files/tes3mp/ui/Main.ui @@ -564,7 +564,7 @@ - + true @@ -589,7 +589,7 @@ - + @@ -608,14 +608,14 @@ - + Up - + Down