Replace DlgGeneralImp by DlgSettingsGeneral.

This commit is contained in:
Paddle
2023-07-31 07:45:55 +02:00
committed by wwmayer
parent ec73caa40e
commit 7ae3f6be8b
6 changed files with 48 additions and 47 deletions

View File

@@ -298,7 +298,6 @@ SET(Gui_UIC_SRCS
DlgCustomizeSpNavSettings.ui
DlgDisplayProperties.ui
DlgEditor.ui
DlgGeneral.ui
DlgInputDialog.ui
DlgKeyboard.ui
DlgMacroExecute.ui
@@ -315,6 +314,7 @@ SET(Gui_UIC_SRCS
DlgPropertyLink.ui
DlgReportView.ui
DlgRevertToBackupConfig.ui
DlgSettingsGeneral.ui
DlgSettings3DView.ui
DlgSettingsCacheDirectory.ui
DlgSettingsNavigation.ui
@@ -557,10 +557,10 @@ SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS})
# The settings dialog sources
SET(Dialog_Settings_CPP_SRCS
DlgEditorImp.cpp
DlgGeneralImp.cpp
DlgOnlineHelpImp.cpp
DlgPreferencesImp.cpp
DlgReportViewImp.cpp
DlgSettingsGeneral.cpp
DlgSettings3DViewImp.cpp
DlgSettingsCacheDirectory.cpp
DlgSettingsNavigation.cpp
@@ -577,7 +577,7 @@ SET(Dialog_Settings_CPP_SRCS
)
SET(Dialog_Settings_HPP_SRCS
DlgEditorImp.h
DlgGeneralImp.h
DlgSettingsGeneral.h
DlgOnlineHelpImp.h
DlgPreferencesImp.h
DlgReportViewImp.h
@@ -599,10 +599,10 @@ SET(Dialog_Settings_SRCS
${Dialog_Settings_CPP_SRCS}
${Dialog_Settings_HPP_SRCS}
DlgEditor.ui
DlgGeneral.ui
DlgOnlineHelp.ui
DlgPreferences.ui
DlgReportView.ui
DlgSettingsGeneral.ui
DlgSettings3DView.ui
DlgSettingsCacheDirectory.ui
DlgSettingsNavigation.ui

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Gui::Dialog::DlgGeneral</class>
<widget class="QWidget" name="Gui::Dialog::DlgGeneral">
<class>Gui::Dialog::DlgSettingsGeneral</class>
<widget class="QWidget" name="Gui::Dialog::DlgSettingsGeneral">
<property name="geometry">
<rect>
<x>0</x>

View File

@@ -38,8 +38,8 @@
#include <Base/Parameter.h>
#include <Base/UnitsApi.h>
#include "DlgGeneralImp.h"
#include "ui_DlgGeneral.h"
#include "DlgSettingsGeneral.h"
#include "ui_DlgSettingsGeneral.h"
#include "Action.h"
#include "Application.h"
#include "DlgCreateNewPreferencePackImp.h"
@@ -54,38 +54,38 @@ using namespace Gui::Dialog;
namespace fs = boost::filesystem;
using namespace Base;
/* TRANSLATOR Gui::Dialog::DlgGeneralImp */
/* TRANSLATOR Gui::Dialog::DlgSettingsGeneral */
/**
* Constructs a DlgGeneralImp which is a child of 'parent', with the
* Constructs a DlgSettingsGeneral which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* true to construct a modal dialog.
*/
DlgGeneralImp::DlgGeneralImp( QWidget* parent )
DlgSettingsGeneral::DlgSettingsGeneral( QWidget* parent )
: PreferencePage(parent)
, localeIndex(0)
, themeChanged(false)
, ui(new Ui_DlgGeneral)
, ui(new Ui_DlgSettingsGeneral)
{
ui->setupUi(this);
recreatePreferencePackMenu();
connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgGeneralImp::onImportConfigClicked);
connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgGeneralImp::saveAsNewPreferencePack);
connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::onImportConfigClicked);
connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgSettingsGeneral::saveAsNewPreferencePack);
connect(ui->themesCombobox, qOverload<int>(&QComboBox::activated), this, &DlgGeneralImp::onThemeChanged);
ui->ManagePreferencePacks->setToolTip(tr("Manage preference packs"));
connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgGeneralImp::onManagePreferencePacksClicked);
connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgSettingsGeneral::onManagePreferencePacksClicked);
// If there are any saved config file backs, show the revert button, otherwise hide it:
const auto & backups = Application::Instance->prefPackManager()->configBackups();
ui->RevertToSavedConfig->setEnabled(backups.empty());
connect(ui->RevertToSavedConfig, &QPushButton::clicked, this, &DlgGeneralImp::revertToSavedConfig);
connect(ui->RevertToSavedConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::revertToSavedConfig);
connect(ui->comboBox_UnitSystem, qOverload<int>(&QComboBox::currentIndexChanged), this, &DlgGeneralImp::onUnitSystemIndexChanged);
connect(ui->comboBox_UnitSystem, qOverload<int>(&QComboBox::currentIndexChanged), this, &DlgSettingsGeneral::onUnitSystemIndexChanged);
ui->spinBoxDecimals->setMaximum(std::numeric_limits<double>::digits10 + 1);
int num = static_cast<int>(Base::UnitSystem::NumUnitSystemTypes);
@@ -110,7 +110,7 @@ DlgGeneralImp::DlgGeneralImp( QWidget* parent )
/**
* Destroys the object and frees any allocated resources
*/
DlgGeneralImp::~DlgGeneralImp()
DlgSettingsGeneral::~DlgSettingsGeneral()
{
}
@@ -118,7 +118,7 @@ DlgGeneralImp::~DlgGeneralImp()
* @see RecentFilesAction
* @see StdCmdRecentFiles
*/
void DlgGeneralImp::setRecentFileSize()
void DlgSettingsGeneral::setRecentFileSize()
{
auto recent = getMainWindow()->findChild<RecentFilesAction *>
(QLatin1String("recentFiles"));
@@ -128,7 +128,7 @@ void DlgGeneralImp::setRecentFileSize()
}
}
bool DlgGeneralImp::setLanguage()
bool DlgSettingsGeneral::setLanguage()
{
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General");
QString lang = QLocale::languageToString(QLocale().language());
@@ -142,7 +142,7 @@ bool DlgGeneralImp::setLanguage()
return false;
}
void DlgGeneralImp::setNumberLocale(bool force/* = false*/)
void DlgSettingsGeneral::setNumberLocale(bool force/* = false*/)
{
int localeFormat = ui->UseLocaleFormatting->currentIndex();
@@ -168,14 +168,14 @@ void DlgGeneralImp::setNumberLocale(bool force/* = false*/)
localeIndex = localeFormat;
}
void DlgGeneralImp::setDecimalPointConversion(bool on)
void DlgSettingsGeneral::setDecimalPointConversion(bool on)
{
if (Translator::instance()->isEnabledDecimalPointConversion() != on) {
Translator::instance()->enableDecimalPointConversion(on);
}
}
void DlgGeneralImp::saveSettings()
void DlgSettingsGeneral::saveSettings()
{
// must be done as very first because we create a new instance of NavigatorStyle
// where we set some attributes afterwards
@@ -252,7 +252,7 @@ void DlgGeneralImp::saveSettings()
saveThemes();
}
void DlgGeneralImp::loadSettings()
void DlgSettingsGeneral::loadSettings()
{
int FracInch;
int cbIndex;
@@ -400,7 +400,7 @@ void DlgGeneralImp::loadThemes()
}
}
void DlgGeneralImp::changeEvent(QEvent *event)
void DlgSettingsGeneral::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange) {
int index = ui->UseLocaleFormatting->currentIndex();
@@ -414,7 +414,7 @@ void DlgGeneralImp::changeEvent(QEvent *event)
}
}
void DlgGeneralImp::recreatePreferencePackMenu()
void DlgSettingsGeneral::recreatePreferencePackMenu()
{
ui->PreferencePacks->setRowCount(0); // Begin by clearing whatever is there
ui->PreferencePacks->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
@@ -471,18 +471,18 @@ void DlgGeneralImp::recreatePreferencePackMenu()
}
}
void DlgGeneralImp::saveAsNewPreferencePack()
void DlgSettingsGeneral::saveAsNewPreferencePack()
{
// Create and run a modal New PreferencePack dialog box
auto packs = Application::Instance->prefPackManager()->preferencePackNames();
newPreferencePackDialog = std::make_unique<DlgCreateNewPreferencePackImp>(this);
newPreferencePackDialog->setPreferencePackTemplates(Application::Instance->prefPackManager()->templateFiles());
newPreferencePackDialog->setPreferencePackNames(packs);
connect(newPreferencePackDialog.get(), &DlgCreateNewPreferencePackImp::accepted, this, &DlgGeneralImp::newPreferencePackDialogAccepted);
connect(newPreferencePackDialog.get(), &DlgCreateNewPreferencePackImp::accepted, this, &DlgSettingsGeneral::newPreferencePackDialogAccepted);
newPreferencePackDialog->open();
}
void DlgGeneralImp::revertToSavedConfig()
void DlgSettingsGeneral::revertToSavedConfig()
{
revertToBackupConfigDialog = std::make_unique<DlgRevertToBackupConfigImp>(this);
connect(revertToBackupConfigDialog.get(), &DlgRevertToBackupConfigImp::accepted, this, [this]() {
@@ -494,7 +494,7 @@ void DlgGeneralImp::revertToSavedConfig()
revertToBackupConfigDialog->open();
}
void DlgGeneralImp::newPreferencePackDialogAccepted()
void DlgSettingsGeneral::newPreferencePackDialogAccepted()
{
auto preferencePackTemplates = Application::Instance->prefPackManager()->templateFiles();
auto selection = newPreferencePackDialog->selectedTemplates();
@@ -512,17 +512,17 @@ void DlgGeneralImp::newPreferencePackDialogAccepted()
recreatePreferencePackMenu();
}
void DlgGeneralImp::onManagePreferencePacksClicked()
void DlgSettingsGeneral::onManagePreferencePacksClicked()
{
if (!this->preferencePackManagementDialog) {
this->preferencePackManagementDialog = std::make_unique<DlgPreferencePackManagementImp>(this);
connect(this->preferencePackManagementDialog.get(), &DlgPreferencePackManagementImp::packVisibilityChanged,
this, &DlgGeneralImp::recreatePreferencePackMenu);
this, &DlgSettingsGeneral::recreatePreferencePackMenu);
}
this->preferencePackManagementDialog->show();
}
void DlgGeneralImp::onImportConfigClicked()
void DlgSettingsGeneral::onImportConfigClicked()
{
auto path = fs::path(QFileDialog::getOpenFileName(this,
tr("Choose a FreeCAD config file to import"),
@@ -547,7 +547,7 @@ void DlgGeneralImp::onImportConfigClicked()
}
}
void DlgGeneralImp::onLoadPreferencePackClicked(const std::string& packName)
void DlgSettingsGeneral::onLoadPreferencePackClicked(const std::string& packName)
{
if (Application::Instance->prefPackManager()->apply(packName)) {
auto parentDialog = qobject_cast<DlgPreferencesImp*> (this->window());
@@ -556,7 +556,7 @@ void DlgGeneralImp::onLoadPreferencePackClicked(const std::string& packName)
}
}
void DlgGeneralImp::onUnitSystemIndexChanged(int index)
void DlgSettingsGeneral::onUnitSystemIndexChanged(int index)
{
if (index < 0)
return; // happens when clearing the combo box in retranslateUi()
@@ -579,4 +579,5 @@ void DlgGeneralImp::onThemeChanged(int index) {
themeChanged = true;
}
#include "moc_DlgGeneralImp.cpp"
#include "moc_DlgSettingsGeneral.cpp"

View File

@@ -23,8 +23,8 @@
***************************************************************************/
#ifndef GUI_DIALOG_DLGGENERALIMP_H
#define GUI_DIALOG_DLGGENERALIMP_H
#ifndef GUI_DIALOG_DLGSETTINGSGENERAL_H
#define GUI_DIALOG_DLGSETTINGSGENERAL_H
#include "PropertyPage.h"
#include <memory>
@@ -34,7 +34,7 @@ class QTabWidget;
namespace Gui {
namespace Dialog {
class Ui_DlgGeneral;
class Ui_DlgSettingsGeneral;
class DlgCreateNewPreferencePackImp;
class DlgPreferencePackManagementImp;
class DlgRevertToBackupConfigImp;
@@ -43,13 +43,13 @@ class DlgRevertToBackupConfigImp;
* You can change window style, size of pixmaps, size of recent file list and so on
* \author Werner Mayer
*/
class DlgGeneralImp : public PreferencePage
class DlgSettingsGeneral : public PreferencePage
{
Q_OBJECT
public:
explicit DlgGeneralImp( QWidget* parent = nullptr );
~DlgGeneralImp() override;
explicit DlgSettingsGeneral( QWidget* parent = nullptr );
~DlgSettingsGeneral() override;
void saveSettings() override;
void loadSettings() override;
@@ -82,7 +82,7 @@ private:
private:
int localeIndex;
bool themeChanged;
std::unique_ptr<Ui_DlgGeneral> ui;
std::unique_ptr<Ui_DlgSettingsGeneral> ui;
std::unique_ptr<DlgCreateNewPreferencePackImp> newPreferencePackDialog;
std::unique_ptr<DlgPreferencePackManagementImp> preferencePackManagementDialog;
std::unique_ptr<DlgRevertToBackupConfigImp> revertToBackupConfigDialog;
@@ -91,4 +91,4 @@ private:
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGGENERALIMP_H
#endif // GUI_DIALOG_DLGSETTINGSGENERAL_H

View File

@@ -2554,6 +2554,6 @@ Gui--StatefulLabel[state="fully_constrained"] {
/*==================================================================================================
PREFERENCES PACKS
==================================================================================================*/
Gui--Dialog--DlgGeneralImp > QGroupBox > QGroupBox > QTableWidget > QWidget > QPushButton {
Gui--Dialog--DlgSettingsGeneral > QGroupBox > QGroupBox > QTableWidget > QWidget > QPushButton {
margin: 0px;
}

View File

@@ -35,7 +35,7 @@
#include "DlgSettingsSelection.h"
#include "DlgSettingsViewColor.h"
#include "DlgSettingsTheme.h"
#include "DlgGeneralImp.h"
#include "DlgSettingsGeneral.h"
#include "DlgEditorImp.h"
#include "DlgSettingsNotificationArea.h"
#include "DlgSettingsPythonConsole.h"
@@ -65,7 +65,7 @@ WidgetFactorySupplier::WidgetFactorySupplier()
// ADD YOUR PREFERENCE PAGES HERE
//
//
new PrefPageProducer<DlgGeneralImp> ( QT_TRANSLATE_NOOP("QObject","General") );
new PrefPageProducer<DlgSettingsGeneral> ( QT_TRANSLATE_NOOP("QObject","General") );
new PrefPageProducer<DlgSettingsDocumentImp> ( QT_TRANSLATE_NOOP("QObject","General") );
new PrefPageProducer<DlgSettingsSelection> ( QT_TRANSLATE_NOOP("QObject","General") );
new PrefPageProducer<DlgSettingsCacheDirectory> ( QT_TRANSLATE_NOOP("QObject","General") );