Ref T286, copy settings/cache improvements

* removed old copy component from wizard and setup component
* using new copy component
* reloading in hotkey component
This commit is contained in:
Klaus Basan
2018-07-13 02:22:57 +02:00
parent 64d153b10b
commit e90eb06f44
7 changed files with 45 additions and 111 deletions

View File

@@ -25,8 +25,6 @@ namespace BlackGui
{ {
ui->setupUi(this); ui->setupUi(this);
ui->wp_CopyModels->setConfigComponent(ui->comp_CopyModels); 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_Simulator->setConfigComponent(ui->comp_Simulator);
ui->wp_XSwiftBus->setConfigComponent(ui->comp_XSwiftBus); ui->wp_XSwiftBus->setConfigComponent(ui->comp_XSwiftBus);
ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad); ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad);
@@ -95,19 +93,11 @@ namespace BlackGui
m_previousId = id; // update m_previousId = id; // update
m_skipped = false; // reset m_skipped = false; // reset
Q_UNUSED(skipped); Q_UNUSED(skipped);
Q_UNUSED(backward);
this->setParentOpacity(0.5); this->setParentOpacity(0.5);
const QWizardPage *page = this->currentPage(); const QWizardPage *page = this->currentPage();
if (backward && page == ui->wp_CopyCaches) Q_UNUSED(page);
{
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);
}
this->setOption(HaveCustomButton1, id != m_maxId); this->setOption(HaveCustomButton1, id != m_maxId);
} }

View File

@@ -37,8 +37,6 @@ namespace BlackGui
CopyModels, CopyModels,
CopySettingsAndCaches, CopySettingsAndCaches,
FirstModelSet, FirstModelSet,
CopySettings, //!< deprecated
CopyCaches, //!< deprecated
ConfigSimulator, ConfigSimulator,
XSwiftBus, XSwiftBus,
ConfigHotkeys ConfigHotkeys

View File

@@ -155,76 +155,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="BlackGui::Components::CCopyConfigurationWizardPage" name="wp_CopySettings">
<property name="title">
<string>Copy configuration from another installation</string>
</property>
<property name="subTitle">
<string>Copy settings</string>
</property>
<layout class="QVBoxLayout" name="vl_CopySettings">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="BlackGui::Components::CCopyConfigurationComponent" name="comp_CopySettings">
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="BlackGui::Components::CCopyConfigurationWizardPage" name="wp_CopyCaches">
<property name="title">
<string>Copy configuration from another installation</string>
</property>
<property name="subTitle">
<string>Cache data</string>
</property>
<layout class="QVBoxLayout" name="vl_CopyCaches">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="BlackGui::Components::CCopyConfigurationComponent" name="comp_CopyCaches">
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="BlackGui::Components::CConfigSimulatorWizardPage" name="wp_Simulator"> <widget class="BlackGui::Components::CConfigSimulatorWizardPage" name="wp_Simulator">
<property name="title"> <property name="title">
<string>Simulator</string> <string>Simulator</string>
@@ -279,6 +209,12 @@
</property> </property>
<item row="1" column="0"> <item row="1" column="0">
<widget class="BlackGui::Components::CInstallXSwiftBusComponent" name="comp_XSwiftBus"> <widget class="BlackGui::Components::CInstallXSwiftBusComponent" name="comp_XSwiftBus">
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
@@ -316,19 +252,28 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<item>
<widget class="QGroupBox" name="gb_Hotkeys">
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
<property name="title">
<string>Hotkeys</string>
</property>
<layout class="QVBoxLayout" name="vl_GroupBoxHotkey">
<item> <item>
<widget class="BlackGui::Components::CSettingsHotkeyComponent" name="comp_Hotkeys"/> <widget class="BlackGui::Components::CSettingsHotkeyComponent" name="comp_Hotkeys"/>
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
</layout>
</widget>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>BlackGui::Components::CCopyConfigurationComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/copyconfigurationcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>BlackGui::Components::CConfigSimulatorComponent</class> <class>BlackGui::Components::CConfigSimulatorComponent</class>
<extends>QFrame</extends> <extends>QFrame</extends>
@@ -341,12 +286,6 @@
<header>blackgui/components/configsimulatorcomponent.h</header> <header>blackgui/components/configsimulatorcomponent.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>BlackGui::Components::CCopyConfigurationWizardPage</class>
<extends>QWizardPage</extends>
<header>blackgui/components/copyconfigurationcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>BlackGui::Components::CInitialDataLoadWizardPage</class> <class>BlackGui::Components::CInitialDataLoadWizardPage</class>
<extends>QWizardPage</extends> <extends>QWizardPage</extends>

View File

@@ -188,9 +188,16 @@ namespace BlackGui
bool CConfigHotkeyWizardPage::validatePage() bool CConfigHotkeyWizardPage::validatePage()
{ {
Q_ASSERT_X(m_config, Q_FUNC_INFO, "Missing configuration");
if (CConfigurationWizard::lastWizardStepSkipped(this->wizard())) { return true; } if (CConfigurationWizard::lastWizardStepSkipped(this->wizard())) { return true; }
m_config->saveSettings(); m_config->saveSettings();
return true; return true;
} }
void CConfigHotkeyWizardPage::initializePage()
{
Q_ASSERT_X(m_config, Q_FUNC_INFO, "Missing configuration");
m_config->reloadHotkeysFromSettings();
}
} // ns } // ns
} // ns } // ns

View File

@@ -25,16 +25,13 @@
#include <QWizardPage> #include <QWizardPage>
#include <QScopedPointer> #include <QScopedPointer>
class QWidget;
namespace Ui { class CSettingsHotkeyComponent; } namespace Ui { class CSettingsHotkeyComponent; }
namespace BlackGui namespace BlackGui
{ {
namespace Components namespace Components
{ {
//! Configure hotkeys //! Configure hotkeys
class BLACKGUI_EXPORT CSettingsHotkeyComponent : class BLACKGUI_EXPORT CSettingsHotkeyComponent : public QFrame
public QFrame
{ {
Q_OBJECT Q_OBJECT
@@ -51,6 +48,9 @@ namespace BlackGui
//! Create dummy/emtpy Ptt entry for wizard //! Create dummy/emtpy Ptt entry for wizard
void registerDummyPttEntry(); void registerDummyPttEntry();
//! Reload keys from settings
void reloadHotkeysFromSettings();
private: private:
void addEntry(); void addEntry();
void editEntry(); void editEntry();
@@ -60,12 +60,11 @@ namespace BlackGui
void updateHotkeyInSettings(const BlackMisc::Input::CActionHotkey &oldValue, const BlackMisc::Input::CActionHotkey &newValue); void updateHotkeyInSettings(const BlackMisc::Input::CActionHotkey &oldValue, const BlackMisc::Input::CActionHotkey &newValue);
void removeHotkeyFromSettings(const BlackMisc::Input::CActionHotkey &actionHotkey); void removeHotkeyFromSettings(const BlackMisc::Input::CActionHotkey &actionHotkey);
bool checkAndConfirmConflicts(const BlackMisc::Input::CActionHotkey &actionHotkey, const BlackMisc::Input::CActionHotkeyList &ignore = {}); bool checkAndConfirmConflicts(const BlackMisc::Input::CActionHotkey &actionHotkey, const BlackMisc::Input::CActionHotkeyList &ignore = {});
void reloadHotkeysFromSettings();
BlackMisc::CIdentifierList getAllIdentifiers() const; BlackMisc::CIdentifierList getAllIdentifiers() const;
QScopedPointer<Ui::CSettingsHotkeyComponent> ui; QScopedPointer<Ui::CSettingsHotkeyComponent> ui;
BlackGui::Models::CActionHotkeyListModel m_model; Models::CActionHotkeyListModel m_model; //!< hotkeys model
BlackMisc::CSetting<BlackCore::Application::TActionHotkeys> m_actionHotkeys { this }; BlackMisc::CSetting<BlackCore::Application::TActionHotkeys> m_actionHotkeys { this, &CSettingsHotkeyComponent::reloadHotkeysFromSettings };
BlackCore::CActionBind m_action { "/Test/Message", BlackMisc::CIcons::wrench16(), this, &CSettingsHotkeyComponent::hotkeySlot }; BlackCore::CActionBind m_action { "/Test/Message", BlackMisc::CIcons::wrench16(), this, &CSettingsHotkeyComponent::hotkeySlot };
}; };
@@ -84,6 +83,9 @@ namespace BlackGui
//! \copydoc QWizardPage::validatePage //! \copydoc QWizardPage::validatePage
virtual bool validatePage() override; virtual bool validatePage() override;
//! \copydoc QWizardPage::initializePage
virtual void initializePage() override;
private: private:
CSettingsHotkeyComponent *m_config = nullptr; CSettingsHotkeyComponent *m_config = nullptr;
}; };

View File

@@ -8,7 +8,7 @@
*/ */
#include "setuploadingdialog.h" #include "setuploadingdialog.h"
#include "copyconfigurationdialog.h" #include "copymodelsfromotherswiftversionsdialog.h"
#include "ui_setuploadingdialog.h" #include "ui_setuploadingdialog.h"
#include "blackgui/guiapplication.h" #include "blackgui/guiapplication.h"
#include "blackcore/setupreader.h" #include "blackcore/setupreader.h"
@@ -164,10 +164,8 @@ namespace BlackGui
{ {
if (!m_copyFromOtherSwiftVersion) if (!m_copyFromOtherSwiftVersion)
{ {
CCopyConfigurationDialog *d = new CCopyConfigurationDialog(this); CCopyModelsFromOtherSwiftVersionsDialog *d = new CCopyModelsFromOtherSwiftVersionsDialog(this);
d->setWithBootstrapFile(true);
d->setModal(true); d->setModal(true);
d->setCacheMode();
m_copyFromOtherSwiftVersion.reset(d); m_copyFromOtherSwiftVersion.reset(d);
} }

View File

@@ -20,10 +20,10 @@ namespace BlackGui
{ {
namespace Components 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 class CSetupLoadingDialog : public QDialog
{ {
@@ -41,7 +41,7 @@ namespace BlackGui
private: private:
QScopedPointer<Ui::CSetupLoadingDialog> ui; QScopedPointer<Ui::CSetupLoadingDialog> ui;
QScopedPointer<CCopyConfigurationDialog> m_copyFromOtherSwiftVersion; QScopedPointer<CCopyModelsFromOtherSwiftVersionsDialog> m_copyFromOtherSwiftVersion;
//! Cached setup available? //! Cached setup available?
bool hasCachedSetup() const; bool hasCachedSetup() const;