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->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);
}

View File

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

View File

@@ -155,76 +155,6 @@
</item>
</layout>
</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">
<property name="title">
<string>Simulator</string>
@@ -279,6 +209,12 @@
</property>
<item row="1" column="0">
<widget class="BlackGui::Components::CInstallXSwiftBusComponent" name="comp_XSwiftBus">
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -317,18 +253,27 @@
<number>4</number>
</property>
<item>
<widget class="BlackGui::Components::CSettingsHotkeyComponent" name="comp_Hotkeys"/>
<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>
<widget class="BlackGui::Components::CSettingsHotkeyComponent" name="comp_Hotkeys"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>BlackGui::Components::CCopyConfigurationComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/copyconfigurationcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CConfigSimulatorComponent</class>
<extends>QFrame</extends>
@@ -341,12 +286,6 @@
<header>blackgui/components/configsimulatorcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CCopyConfigurationWizardPage</class>
<extends>QWizardPage</extends>
<header>blackgui/components/copyconfigurationcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CInitialDataLoadWizardPage</class>
<extends>QWizardPage</extends>

View File

@@ -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

View File

@@ -25,16 +25,13 @@
#include <QWizardPage>
#include <QScopedPointer>
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::CSettingsHotkeyComponent> ui;
BlackGui::Models::CActionHotkeyListModel m_model;
BlackMisc::CSetting<BlackCore::Application::TActionHotkeys> m_actionHotkeys { this };
Models::CActionHotkeyListModel m_model; //!< hotkeys model
BlackMisc::CSetting<BlackCore::Application::TActionHotkeys> 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;
};

View File

@@ -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);
}

View File

@@ -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::CSetupLoadingDialog> ui;
QScopedPointer<CCopyConfigurationDialog> m_copyFromOtherSwiftVersion;
QScopedPointer<CCopyModelsFromOtherSwiftVersionsDialog> m_copyFromOtherSwiftVersion;
//! Cached setup available?
bool hasCachedSetup() const;