From e90eb06f44222f5a8ab9dc8be76beb716b5ee6ad Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 13 Jul 2018 02:22:57 +0200 Subject: [PATCH] Ref T286, copy settings/cache improvements * removed old copy component from wizard and setup component * using new copy component * reloading in hotkey component --- .../components/configurationwizard.cpp | 14 +-- src/blackgui/components/configurationwizard.h | 2 - .../components/configurationwizard.ui | 105 ++++-------------- .../components/settingshotkeycomponent.cpp | 7 ++ .../components/settingshotkeycomponent.h | 16 +-- .../components/setuploadingdialog.cpp | 6 +- src/blackgui/components/setuploadingdialog.h | 6 +- 7 files changed, 45 insertions(+), 111 deletions(-) diff --git a/src/blackgui/components/configurationwizard.cpp b/src/blackgui/components/configurationwizard.cpp index dfbb588da..0dbe5886a 100644 --- a/src/blackgui/components/configurationwizard.cpp +++ b/src/blackgui/components/configurationwizard.cpp @@ -25,8 +25,6 @@ namespace BlackGui { ui->setupUi(this); ui->wp_CopyModels->setConfigComponent(ui->comp_CopyModels); - ui->wp_CopyCaches->setConfigComponent(ui->comp_CopyCaches); - ui->wp_CopySettings->setConfigComponent(ui->comp_CopySettings); ui->wp_Simulator->setConfigComponent(ui->comp_Simulator); ui->wp_XSwiftBus->setConfigComponent(ui->comp_XSwiftBus); ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad); @@ -95,19 +93,11 @@ namespace BlackGui m_previousId = id; // update m_skipped = false; // reset Q_UNUSED(skipped); + Q_UNUSED(backward); this->setParentOpacity(0.5); const QWizardPage *page = this->currentPage(); - if (backward && page == ui->wp_CopyCaches) - { - ui->comp_CopyCaches->setCacheMode(); - ui->comp_CopyCaches->initCurrentDirectories(true); - } - else if (backward && page == ui->wp_CopySettings) - { - ui->comp_CopySettings->setSettingsMode(); - ui->comp_CopySettings->initCurrentDirectories(true); - } + Q_UNUSED(page); this->setOption(HaveCustomButton1, id != m_maxId); } diff --git a/src/blackgui/components/configurationwizard.h b/src/blackgui/components/configurationwizard.h index 6c7e7ec38..06e25f7c2 100644 --- a/src/blackgui/components/configurationwizard.h +++ b/src/blackgui/components/configurationwizard.h @@ -37,8 +37,6 @@ namespace BlackGui CopyModels, CopySettingsAndCaches, FirstModelSet, - CopySettings, //!< deprecated - CopyCaches, //!< deprecated ConfigSimulator, XSwiftBus, ConfigHotkeys diff --git a/src/blackgui/components/configurationwizard.ui b/src/blackgui/components/configurationwizard.ui index ee05ee173..7af068c4c 100644 --- a/src/blackgui/components/configurationwizard.ui +++ b/src/blackgui/components/configurationwizard.ui @@ -155,76 +155,6 @@ - - - Copy configuration from another installation - - - Copy settings - - - - 4 - - - 4 - - - 4 - - - 4 - - - - - - 0 - 100 - - - - - - - - - Copy configuration from another installation - - - Cache data - - - - 4 - - - 4 - - - 4 - - - 4 - - - - - - 0 - 100 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - Simulator @@ -279,6 +209,12 @@ + + + 0 + 100 + + QFrame::StyledPanel @@ -317,18 +253,27 @@ 4 - + + + + 0 + 200 + + + + Hotkeys + + + + + + + - - BlackGui::Components::CCopyConfigurationComponent - QFrame -
blackgui/components/copyconfigurationcomponent.h
- 1 -
BlackGui::Components::CConfigSimulatorComponent QFrame @@ -341,12 +286,6 @@
blackgui/components/configsimulatorcomponent.h
1
- - BlackGui::Components::CCopyConfigurationWizardPage - QWizardPage -
blackgui/components/copyconfigurationcomponent.h
- 1 -
BlackGui::Components::CInitialDataLoadWizardPage QWizardPage diff --git a/src/blackgui/components/settingshotkeycomponent.cpp b/src/blackgui/components/settingshotkeycomponent.cpp index 9e28c6e52..1b3d64b76 100644 --- a/src/blackgui/components/settingshotkeycomponent.cpp +++ b/src/blackgui/components/settingshotkeycomponent.cpp @@ -188,9 +188,16 @@ namespace BlackGui bool CConfigHotkeyWizardPage::validatePage() { + Q_ASSERT_X(m_config, Q_FUNC_INFO, "Missing configuration"); if (CConfigurationWizard::lastWizardStepSkipped(this->wizard())) { return true; } m_config->saveSettings(); return true; } + + void CConfigHotkeyWizardPage::initializePage() + { + Q_ASSERT_X(m_config, Q_FUNC_INFO, "Missing configuration"); + m_config->reloadHotkeysFromSettings(); + } } // ns } // ns diff --git a/src/blackgui/components/settingshotkeycomponent.h b/src/blackgui/components/settingshotkeycomponent.h index 20ba8e337..7a2560861 100644 --- a/src/blackgui/components/settingshotkeycomponent.h +++ b/src/blackgui/components/settingshotkeycomponent.h @@ -25,16 +25,13 @@ #include #include -class QWidget; - namespace Ui { class CSettingsHotkeyComponent; } namespace BlackGui { namespace Components { //! Configure hotkeys - class BLACKGUI_EXPORT CSettingsHotkeyComponent : - public QFrame + class BLACKGUI_EXPORT CSettingsHotkeyComponent : public QFrame { Q_OBJECT @@ -51,6 +48,9 @@ namespace BlackGui //! Create dummy/emtpy Ptt entry for wizard void registerDummyPttEntry(); + //! Reload keys from settings + void reloadHotkeysFromSettings(); + private: void addEntry(); void editEntry(); @@ -60,12 +60,11 @@ namespace BlackGui void updateHotkeyInSettings(const BlackMisc::Input::CActionHotkey &oldValue, const BlackMisc::Input::CActionHotkey &newValue); void removeHotkeyFromSettings(const BlackMisc::Input::CActionHotkey &actionHotkey); bool checkAndConfirmConflicts(const BlackMisc::Input::CActionHotkey &actionHotkey, const BlackMisc::Input::CActionHotkeyList &ignore = {}); - void reloadHotkeysFromSettings(); BlackMisc::CIdentifierList getAllIdentifiers() const; QScopedPointer ui; - BlackGui::Models::CActionHotkeyListModel m_model; - BlackMisc::CSetting m_actionHotkeys { this }; + Models::CActionHotkeyListModel m_model; //!< hotkeys model + BlackMisc::CSetting m_actionHotkeys { this, &CSettingsHotkeyComponent::reloadHotkeysFromSettings }; BlackCore::CActionBind m_action { "/Test/Message", BlackMisc::CIcons::wrench16(), this, &CSettingsHotkeyComponent::hotkeySlot }; }; @@ -84,6 +83,9 @@ namespace BlackGui //! \copydoc QWizardPage::validatePage virtual bool validatePage() override; + //! \copydoc QWizardPage::initializePage + virtual void initializePage() override; + private: CSettingsHotkeyComponent *m_config = nullptr; }; diff --git a/src/blackgui/components/setuploadingdialog.cpp b/src/blackgui/components/setuploadingdialog.cpp index 4e9d91117..adc5f60e1 100644 --- a/src/blackgui/components/setuploadingdialog.cpp +++ b/src/blackgui/components/setuploadingdialog.cpp @@ -8,7 +8,7 @@ */ #include "setuploadingdialog.h" -#include "copyconfigurationdialog.h" +#include "copymodelsfromotherswiftversionsdialog.h" #include "ui_setuploadingdialog.h" #include "blackgui/guiapplication.h" #include "blackcore/setupreader.h" @@ -164,10 +164,8 @@ namespace BlackGui { if (!m_copyFromOtherSwiftVersion) { - CCopyConfigurationDialog *d = new CCopyConfigurationDialog(this); - d->setWithBootstrapFile(true); + CCopyModelsFromOtherSwiftVersionsDialog *d = new CCopyModelsFromOtherSwiftVersionsDialog(this); d->setModal(true); - d->setCacheMode(); m_copyFromOtherSwiftVersion.reset(d); } diff --git a/src/blackgui/components/setuploadingdialog.h b/src/blackgui/components/setuploadingdialog.h index 4da499d02..d116b5518 100644 --- a/src/blackgui/components/setuploadingdialog.h +++ b/src/blackgui/components/setuploadingdialog.h @@ -20,10 +20,10 @@ namespace BlackGui { namespace Components { - class CCopyConfigurationDialog; + class CCopyModelsFromOtherSwiftVersionsDialog; /** - * Setup dialog, if something goes wrong + * Setup dialog, if something goes wrong allows to copy bootstrap file */ class CSetupLoadingDialog : public QDialog { @@ -41,7 +41,7 @@ namespace BlackGui private: QScopedPointer ui; - QScopedPointer m_copyFromOtherSwiftVersion; + QScopedPointer m_copyFromOtherSwiftVersion; //! Cached setup available? bool hasCachedSetup() const;