Preference: Move workbench selector position to the workbench preference page.

This commit is contained in:
Paddle
2023-03-25 08:49:21 +01:00
parent 4b60df5ced
commit 9f904ae04f
6 changed files with 62 additions and 62 deletions

View File

@@ -508,43 +508,6 @@ this according to your screen size or personal taste</string>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="WorkbenchSelectorPositionLabel">
<property name="text">
<string>Workbench selector position :</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="WorkbenchSelectorPosition">
<property name="toolTip">
<string>Customize where the workbench selector appears (restart required).
'Toolbar': In the toolbars, as a movable toolbar.
'Left Corner': In the menu bar, on the left corner.
'Right Corner': In the menu bar, on the right corner.</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@@ -41,7 +41,6 @@
#include "DlgRevertToBackupConfigImp.h"
#include "MainWindow.h"
#include "PreferencePackManager.h"
#include "UserSettings.h"
#include "Language/Translator.h"
using namespace Gui::Dialog;
@@ -223,8 +222,6 @@ void DlgGeneralImp::saveSettings()
hGrp->GetGroup("TreeView")->SetBool("Enabled",treeView);
hGrp->GetGroup("PropertyView")->SetBool("Enabled",propertyView);
saveWorkbenchSelector();
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow");
hGrp->SetBool("TiledBackground", ui->tiledBackground->isChecked());
@@ -310,9 +307,6 @@ void DlgGeneralImp::loadSettings()
}
ui->treeMode->setCurrentIndex(index);
//workbench selector position combobox setup
loadWorkbenchSelector();
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow");
ui->tiledBackground->setChecked(hGrp->GetBool("TiledBackground", false));
@@ -509,21 +503,4 @@ void DlgGeneralImp::onLoadPreferencePackClicked(const std::string& packName)
}
}
void DlgGeneralImp::saveWorkbenchSelector()
{
//save workbench selector position
auto index = ui->WorkbenchSelectorPosition->currentIndex();
WorkbenchSwitcher::setIndex(index);
}
void DlgGeneralImp::loadWorkbenchSelector()
{
//workbench selector position combobox setup
ui->WorkbenchSelectorPosition->clear();
ui->WorkbenchSelectorPosition->addItem(tr("Toolbar"));
ui->WorkbenchSelectorPosition->addItem(tr("Left corner"));
ui->WorkbenchSelectorPosition->addItem(tr("Right corner"));
ui->WorkbenchSelectorPosition->setCurrentIndex(WorkbenchSwitcher::getIndex());
}
#include "moc_DlgGeneralImp.cpp"

View File

@@ -69,8 +69,6 @@ private:
bool setLanguage(); //Returns true if language has been changed
void setNumberLocale(bool force = false);
void setDecimalPointConversion(bool on);
void saveWorkbenchSelector();
void loadWorkbenchSelector();
private:
int localeIndex;

View File

@@ -40,6 +40,43 @@ Your currently system has the following workbenches:&lt;/p&gt;&lt;/body&gt;&lt;/
<item row="1" column="0">
<widget class="QListWidgetDragBugFix" name="wbList"/>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="WorkbenchSelectorPositionLabel">
<property name="text">
<string>Workbench selector position :</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="WorkbenchSelectorPosition">
<property name="toolTip">
<string>Customize where the workbench selector appears (restart required).
'Toolbar': In the toolbars, as a movable toolbar.
'Left Corner': In the menu bar, on the left corner.
'Right Corner': In the menu bar, on the right corner.</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>

View File

@@ -30,6 +30,7 @@
#include "DlgSettingsWorkbenchesImp.h"
#include "ui_DlgSettingsWorkbenches.h"
#include "Application.h"
#include "UserSettings.h"
#include "Workbench.h"
#include "WorkbenchManager.h"
@@ -111,10 +112,14 @@ void DlgSettingsWorkbenchesImp::saveSettings()
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")->
SetASCII("BackgroundAutoloadModules", autoloadStr.str().c_str());
saveWorkbenchSelector();
}
void DlgSettingsWorkbenchesImp::loadSettings()
{
loadWorkbenchSelector();
// There are two different "autoload" settings: the first, in FreeCAD since 2004,
// controls the module the user sees first when starting FreeCAD, and defaults to the Start workbench
std::string start = App::Application::Config()["StartWorkbench"];
@@ -372,4 +377,21 @@ void DlgSettingsWorkbenchesImp::changeEvent(QEvent *e)
}
}
void DlgSettingsWorkbenchesImp::saveWorkbenchSelector()
{
//save workbench selector position
auto index = ui->WorkbenchSelectorPosition->currentIndex();
WorkbenchSwitcher::setIndex(index);
}
void DlgSettingsWorkbenchesImp::loadWorkbenchSelector()
{
//workbench selector position combobox setup
ui->WorkbenchSelectorPosition->clear();
ui->WorkbenchSelectorPosition->addItem(tr("Toolbar"));
ui->WorkbenchSelectorPosition->addItem(tr("Left corner"));
ui->WorkbenchSelectorPosition->addItem(tr("Right corner"));
ui->WorkbenchSelectorPosition->setCurrentIndex(WorkbenchSwitcher::getIndex());
}
#include "moc_DlgSettingsWorkbenchesImp.cpp"

View File

@@ -65,6 +65,9 @@ private:
void addWorkbench(const QString& it, bool enabled);
QWidget* createWorkbenchWidget(const QString& it, bool enabled);
void saveWorkbenchSelector();
void loadWorkbenchSelector();
std::unique_ptr<Ui_DlgSettingsWorkbenches> ui;
static const QString iconLabelStr;
static const QString nameLabelStr;