From ccb9d7faeb85efab2508a73ac3108290f4aefb97 Mon Sep 17 00:00:00 2001 From: Paddle Date: Mon, 31 Jul 2023 14:19:50 +0200 Subject: [PATCH] Move all the preference pages to PreferencePages subfolder. --- src/Gui/Action.cpp | 2 +- src/Gui/Application.cpp | 2 +- src/Gui/CMakeLists.txt | 112 +-- .../DlgSettings3DView.ui | 0 .../DlgSettings3DViewImp.cpp | 338 ++++---- .../DlgSettings3DViewImp.h | 132 +-- .../DlgSettingsCacheDirectory.cpp | 4 +- .../DlgSettingsCacheDirectory.h | 2 +- .../DlgSettingsCacheDirectory.ui | 0 .../DlgSettingsDocument.ui | 0 .../DlgSettingsDocumentImp.cpp | 368 ++++----- .../DlgSettingsDocumentImp.h | 128 +-- .../DlgSettingsEditor.cpp | 47 +- .../{ => PreferencePages}/DlgSettingsEditor.h | 12 +- .../DlgSettingsEditor.ui | 0 .../DlgSettingsGeneral.cpp | 27 +- .../DlgSettingsGeneral.h | 6 +- .../DlgSettingsGeneral.ui | 0 .../{ => PreferencePages}/DlgSettingsMacro.ui | 0 .../DlgSettingsMacroImp.cpp | 239 +++--- .../DlgSettingsMacroImp.h | 122 +-- .../DlgSettingsNavigation.cpp | 757 +++++++++--------- .../DlgSettingsNavigation.h | 180 ++--- .../DlgSettingsNavigation.ui | 0 .../DlgSettingsNotificationArea.cpp | 0 .../DlgSettingsNotificationArea.h | 2 +- .../DlgSettingsNotificationArea.ui | 0 .../DlgSettingsPythonConsole.cpp | 0 .../DlgSettingsPythonConsole.h | 2 +- .../DlgSettingsPythonConsole.ui | 0 .../DlgSettingsReportView.cpp | 0 .../DlgSettingsReportView.h | 2 +- .../DlgSettingsReportView.ui | 0 .../DlgSettingsSelection.cpp | 1 - .../DlgSettingsSelection.h | 124 +-- .../DlgSettingsSelection.ui | 0 .../DlgSettingsViewColor.cpp | 1 - .../DlgSettingsViewColor.h | 140 ++-- .../DlgSettingsViewColor.ui | 0 .../DlgSettingsWorkbenches.ui | 0 .../DlgSettingsWorkbenchesImp.cpp | 9 +- .../DlgSettingsWorkbenchesImp.h | 2 +- src/Gui/resource.cpp | 29 +- 43 files changed, 1396 insertions(+), 1394 deletions(-) rename src/Gui/{ => PreferencePages}/DlgSettings3DView.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettings3DViewImp.cpp (96%) rename src/Gui/{ => PreferencePages}/DlgSettings3DViewImp.h (96%) rename src/Gui/{ => PreferencePages}/DlgSettingsCacheDirectory.cpp (99%) rename src/Gui/{ => PreferencePages}/DlgSettingsCacheDirectory.h (99%) rename src/Gui/{ => PreferencePages}/DlgSettingsCacheDirectory.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsDocument.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsDocumentImp.cpp (96%) rename src/Gui/{ => PreferencePages}/DlgSettingsDocumentImp.h (96%) rename src/Gui/{ => PreferencePages}/DlgSettingsEditor.cpp (91%) rename src/Gui/{ => PreferencePages}/DlgSettingsEditor.h (89%) rename src/Gui/{ => PreferencePages}/DlgSettingsEditor.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsGeneral.cpp (95%) rename src/Gui/{ => PreferencePages}/DlgSettingsGeneral.h (95%) rename src/Gui/{ => PreferencePages}/DlgSettingsGeneral.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsMacro.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsMacroImp.cpp (95%) rename src/Gui/{ => PreferencePages}/DlgSettingsMacroImp.h (96%) rename src/Gui/{ => PreferencePages}/DlgSettingsNavigation.cpp (96%) rename src/Gui/{ => PreferencePages}/DlgSettingsNavigation.h (97%) rename src/Gui/{ => PreferencePages}/DlgSettingsNavigation.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsNotificationArea.cpp (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsNotificationArea.h (98%) rename src/Gui/{ => PreferencePages}/DlgSettingsNotificationArea.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsPythonConsole.cpp (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsPythonConsole.h (98%) rename src/Gui/{ => PreferencePages}/DlgSettingsPythonConsole.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsReportView.cpp (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsReportView.h (98%) rename src/Gui/{ => PreferencePages}/DlgSettingsReportView.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsSelection.cpp (97%) rename src/Gui/{ => PreferencePages}/DlgSettingsSelection.h (96%) rename src/Gui/{ => PreferencePages}/DlgSettingsSelection.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsViewColor.cpp (97%) rename src/Gui/{ => PreferencePages}/DlgSettingsViewColor.h (96%) rename src/Gui/{ => PreferencePages}/DlgSettingsViewColor.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsWorkbenches.ui (100%) rename src/Gui/{ => PreferencePages}/DlgSettingsWorkbenchesImp.cpp (99%) rename src/Gui/{ => PreferencePages}/DlgSettingsWorkbenchesImp.h (99%) diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index df663617b9..471ea224ac 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -48,7 +48,7 @@ #include "BitmapFactory.h" #include "Command.h" #include "DlgUndoRedo.h" -#include "DlgSettingsWorkbenchesImp.h" +#include "PreferencePages/DlgSettingsWorkbenchesImp.h" #include "Document.h" #include "EditorView.h" #include "FileDialog.h" diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index a39c4ddef5..29cf290af6 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -65,7 +65,7 @@ #include "CommandActionPy.h" #include "CommandPy.h" #include "Control.h" -#include "DlgSettingsCacheDirectory.h" +#include "PreferencePages/DlgSettingsCacheDirectory.h" #include "DocumentPy.h" #include "DocumentRecovery.h" #include "EditorView.h" diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 76a2b441d8..4b4abdefd5 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -297,7 +297,6 @@ SET(Gui_UIC_SRCS DlgCreateNewPreferencePack.ui DlgCustomizeSpNavSettings.ui DlgDisplayProperties.ui - DlgSettingsEditor.ui DlgInputDialog.ui DlgKeyboard.ui DlgMacroExecute.ui @@ -312,22 +311,23 @@ SET(Gui_UIC_SRCS DlgProjectInformation.ui DlgProjectUtility.ui DlgPropertyLink.ui - DlgSettingsReportView.ui DlgRevertToBackupConfig.ui - DlgSettingsGeneral.ui - DlgSettings3DView.ui - DlgSettingsCacheDirectory.ui - DlgSettingsNavigation.ui - DlgSettingsSelection.ui - DlgSettingsViewColor.ui - DlgSettingsTheme.ui + PreferencePages/DlgSettings3DView.ui + PreferencePages/DlgSettingsCacheDirectory.ui DlgSettingsColorGradient.ui - DlgSettingsDocument.ui + PreferencePages/DlgSettingsDocument.ui + PreferencePages/DlgSettingsEditor.ui + PreferencePages/DlgSettingsGeneral.ui DlgSettingsImage.ui - DlgSettingsWorkbenches.ui - DlgSettingsMacro.ui - DlgSettingsNotificationArea.ui - DlgSettingsPythonConsole.ui + PreferencePages/DlgSettingsMacro.ui + PreferencePages/DlgSettingsNavigation.ui + PreferencePages/DlgSettingsNotificationArea.ui + PreferencePages/DlgSettingsPythonConsole.ui + PreferencePages/DlgSettingsReportView.ui + PreferencePages/DlgSettingsSelection.ui + DlgSettingsTheme.ui + PreferencePages/DlgSettingsViewColor.ui + PreferencePages/DlgSettingsWorkbenches.ui DlgCheckableMessageBox.ui DlgToolbars.ui DlgTreeWidget.ui @@ -556,66 +556,66 @@ SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS}) # The settings dialog sources SET(Dialog_Settings_CPP_SRCS - DlgSettingsEditor.cpp DlgOnlineHelpImp.cpp DlgPreferencesImp.cpp - DlgSettingsReportView.cpp - DlgSettingsGeneral.cpp - DlgSettings3DViewImp.cpp - DlgSettingsCacheDirectory.cpp - DlgSettingsNavigation.cpp - DlgSettingsSelection.cpp - DlgSettingsViewColor.cpp - DlgSettingsTheme.cpp + PreferencePages/DlgSettings3DViewImp.cpp + PreferencePages/DlgSettingsCacheDirectory.cpp DlgSettingsColorGradientImp.cpp - DlgSettingsDocumentImp.cpp + PreferencePages/DlgSettingsDocumentImp.cpp + PreferencePages/DlgSettingsEditor.cpp + PreferencePages/DlgSettingsGeneral.cpp DlgSettingsImageImp.cpp - DlgSettingsWorkbenchesImp.cpp - DlgSettingsMacroImp.cpp - DlgSettingsNotificationArea.cpp - DlgSettingsPythonConsole.cpp + PreferencePages/DlgSettingsMacroImp.cpp + PreferencePages/DlgSettingsNavigation.cpp + PreferencePages/DlgSettingsNotificationArea.cpp + PreferencePages/DlgSettingsPythonConsole.cpp + PreferencePages/DlgSettingsReportView.cpp + PreferencePages/DlgSettingsSelection.cpp + DlgSettingsTheme.cpp + PreferencePages/DlgSettingsViewColor.cpp + PreferencePages/DlgSettingsWorkbenchesImp.cpp ) SET(Dialog_Settings_HPP_SRCS - DlgSettingsEditor.h - DlgSettingsGeneral.h DlgOnlineHelpImp.h DlgPreferencesImp.h - DlgSettingsReportView.h - DlgSettings3DViewImp.h - DlgSettingsCacheDirectory.h - DlgSettingsNavigation.h - DlgSettingsSelection.h - DlgSettingsViewColor.h - DlgSettingsTheme.h + PreferencePages/DlgSettings3DViewImp.h + PreferencePages/DlgSettingsCacheDirectory.h DlgSettingsColorGradientImp.h - DlgSettingsDocumentImp.h + PreferencePages/DlgSettingsDocumentImp.h + PreferencePages/DlgSettingsEditor.h + PreferencePages/DlgSettingsGeneral.h DlgSettingsImageImp.h - DlgSettingsWorkbenchesImp.h - DlgSettingsMacroImp.h - DlgSettingsNotificationArea.h - DlgSettingsPythonConsole.h + PreferencePages/DlgSettingsMacroImp.h + PreferencePages/DlgSettingsNavigation.h + PreferencePages/DlgSettingsNotificationArea.h + PreferencePages/DlgSettingsPythonConsole.h + PreferencePages/DlgSettingsReportView.h + PreferencePages/DlgSettingsSelection.h + DlgSettingsTheme.h + PreferencePages/DlgSettingsViewColor.h + PreferencePages/DlgSettingsWorkbenchesImp.h ) SET(Dialog_Settings_SRCS ${Dialog_Settings_CPP_SRCS} ${Dialog_Settings_HPP_SRCS} - DlgSettingsEditor.ui DlgOnlineHelp.ui DlgPreferences.ui - DlgSettingsReportView.ui - DlgSettingsGeneral.ui - DlgSettings3DView.ui - DlgSettingsCacheDirectory.ui - DlgSettingsNavigation.ui - DlgSettingsSelection.ui - DlgSettingsViewColor.ui - DlgSettingsTheme.ui + PreferencePages/DlgSettings3DView.ui + PreferencePages/DlgSettingsCacheDirectory.ui DlgSettingsColorGradient.ui - DlgSettingsDocument.ui + PreferencePages/DlgSettingsDocument.ui + PreferencePages/DlgSettingsEditor.ui + PreferencePages/DlgSettingsGeneral.ui DlgSettingsImage.ui - DlgSettingsWorkbenches.ui - DlgSettingsMacro.ui - DlgSettingsNotificationArea.ui - DlgSettingsPythonConsole.ui + PreferencePages/DlgSettingsMacro.ui + PreferencePages/DlgSettingsNavigation.ui + PreferencePages/DlgSettingsNotificationArea.ui + PreferencePages/DlgSettingsPythonConsole.ui + PreferencePages/DlgSettingsReportView.ui + PreferencePages/DlgSettingsSelection.ui + DlgSettingsTheme.ui + PreferencePages/DlgSettingsViewColor.ui + PreferencePages/DlgSettingsWorkbenches.ui ) SOURCE_GROUP("Dialog\\Settings" FILES ${Dialog_Settings_SRCS}) diff --git a/src/Gui/DlgSettings3DView.ui b/src/Gui/PreferencePages/DlgSettings3DView.ui similarity index 100% rename from src/Gui/DlgSettings3DView.ui rename to src/Gui/PreferencePages/DlgSettings3DView.ui diff --git a/src/Gui/DlgSettings3DViewImp.cpp b/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp similarity index 96% rename from src/Gui/DlgSettings3DViewImp.cpp rename to src/Gui/PreferencePages/DlgSettings3DViewImp.cpp index d6d60cc8b9..54da5b482e 100644 --- a/src/Gui/DlgSettings3DViewImp.cpp +++ b/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp @@ -1,169 +1,169 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - -#include "PreCompiled.h" - -#ifndef _PreComp_ -# include -# include -#endif - -#include -#include -#include - -#include "DlgSettings3DViewImp.h" -#include "ui_DlgSettings3DView.h" -#include "View3DInventorViewer.h" - - -using namespace Gui::Dialog; - -/* TRANSLATOR Gui::Dialog::DlgSettings3DViewImp */ - -bool DlgSettings3DViewImp::showMsg = true; - -/** - * Constructs a DlgSettings3DViewImp which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - */ -DlgSettings3DViewImp::DlgSettings3DViewImp(QWidget* parent) - : PreferencePage( parent ) - , ui(new Ui_DlgSettings3DView) -{ - ui->setupUi(this); -} - -/** - * Destroys the object and frees any allocated resources - */ -DlgSettings3DViewImp::~DlgSettings3DViewImp() -{ - // no need to delete child widgets, Qt does it all for us -} - -void DlgSettings3DViewImp::saveSettings() -{ - // must be done as very first because we create a new instance of NavigatorStyle - // where we set some attributes afterwards - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/View"); - - int index = ui->comboAliasing->currentIndex(); - hGrp->SetInt("AntiAliasing", index); - - index = ui->renderCache->currentIndex(); - hGrp->SetInt("RenderCache", index); - - ui->comboTransparentRender->onSave(); - - QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex()); - hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt()); - - ui->CheckBox_CornerCoordSystem->onSave(); - ui->SpinBox_CornerCoordSystemSize->onSave(); - ui->CheckBox_ShowAxisCross->onSave(); - ui->CheckBox_ShowFPS->onSave(); - ui->CheckBox_use_SW_OpenGL->onSave(); - ui->CheckBox_useVBO->onSave(); - ui->FloatSpinBox_EyeDistance->onSave(); - ui->checkBoxBacklight->onSave(); - ui->backlightColor->onSave(); - ui->sliderIntensity->onSave(); - ui->radioPerspective->onSave(); - ui->radioOrthographic->onSave(); -} - -void DlgSettings3DViewImp::loadSettings() -{ - ui->CheckBox_CornerCoordSystem->onRestore(); - ui->SpinBox_CornerCoordSystemSize->onRestore(); - ui->CheckBox_ShowAxisCross->onRestore(); - ui->CheckBox_ShowFPS->onRestore(); - ui->CheckBox_use_SW_OpenGL->onRestore(); - ui->CheckBox_useVBO->onRestore(); - ui->FloatSpinBox_EyeDistance->onRestore(); - ui->checkBoxBacklight->onRestore(); - ui->backlightColor->onRestore(); - ui->sliderIntensity->onRestore(); - ui->radioPerspective->onRestore(); - ui->radioOrthographic->onRestore(); - - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/View"); - - int index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None)); - index = Base::clamp(index, 0, ui->comboAliasing->count()-1); - ui->comboAliasing->setCurrentIndex(index); - // connect after setting current item of the combo box - connect(ui->comboAliasing, qOverload(&QComboBox::currentIndexChanged), - this, &DlgSettings3DViewImp::onAliasingChanged); - - index = hGrp->GetInt("RenderCache", 0); - ui->renderCache->setCurrentIndex(index); - - ui->comboTransparentRender->onRestore(); - - int const current = hGrp->GetInt("MarkerSize", 9L); - ui->boxMarkerSize->addItem(tr("5px"), QVariant(5)); - ui->boxMarkerSize->addItem(tr("7px"), QVariant(7)); - ui->boxMarkerSize->addItem(tr("9px"), QVariant(9)); - ui->boxMarkerSize->addItem(tr("11px"), QVariant(11)); - ui->boxMarkerSize->addItem(tr("13px"), QVariant(13)); - ui->boxMarkerSize->addItem(tr("15px"), QVariant(15)); - index = ui->boxMarkerSize->findData(QVariant(current)); - if (index < 0) index = 2; - ui->boxMarkerSize->setCurrentIndex(index); -} - -/** - * Sets the strings of the subwidgets using the current language. - */ -void DlgSettings3DViewImp::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) { - ui->comboAliasing->blockSignals(true); - int aliasing = ui->comboAliasing->currentIndex(); - ui->retranslateUi(this); - ui->comboAliasing->setCurrentIndex(aliasing); - ui->comboAliasing->blockSignals(false); - } - else { - QWidget::changeEvent(e); - } -} - -void DlgSettings3DViewImp::onAliasingChanged(int index) -{ - if (index < 0 || !isVisible()) - return; - // Show this message only once per application session to reduce - // annoyance when showing it too often. - if (showMsg) { - showMsg = false; - QMessageBox::information(this, tr("Anti-aliasing"), - tr("Open a new viewer or restart %1 to apply anti-aliasing changes.").arg(qApp->applicationName())); - } -} - -#include "moc_DlgSettings3DViewImp.cpp" - +/*************************************************************************** + * Copyright (c) 2002 Jürgen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#include "PreCompiled.h" + +#ifndef _PreComp_ +# include +# include +#endif + +#include +#include +#include +#include + +#include "DlgSettings3DViewImp.h" +#include "ui_DlgSettings3DView.h" + + +using namespace Gui::Dialog; + +/* TRANSLATOR Gui::Dialog::DlgSettings3DViewImp */ + +bool DlgSettings3DViewImp::showMsg = true; + +/** + * Constructs a DlgSettings3DViewImp which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgSettings3DViewImp::DlgSettings3DViewImp(QWidget* parent) + : PreferencePage( parent ) + , ui(new Ui_DlgSettings3DView) +{ + ui->setupUi(this); +} + +/** + * Destroys the object and frees any allocated resources + */ +DlgSettings3DViewImp::~DlgSettings3DViewImp() +{ + // no need to delete child widgets, Qt does it all for us +} + +void DlgSettings3DViewImp::saveSettings() +{ + // must be done as very first because we create a new instance of NavigatorStyle + // where we set some attributes afterwards + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View"); + + int index = ui->comboAliasing->currentIndex(); + hGrp->SetInt("AntiAliasing", index); + + index = ui->renderCache->currentIndex(); + hGrp->SetInt("RenderCache", index); + + ui->comboTransparentRender->onSave(); + + QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex()); + hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt()); + + ui->CheckBox_CornerCoordSystem->onSave(); + ui->SpinBox_CornerCoordSystemSize->onSave(); + ui->CheckBox_ShowAxisCross->onSave(); + ui->CheckBox_ShowFPS->onSave(); + ui->CheckBox_use_SW_OpenGL->onSave(); + ui->CheckBox_useVBO->onSave(); + ui->FloatSpinBox_EyeDistance->onSave(); + ui->checkBoxBacklight->onSave(); + ui->backlightColor->onSave(); + ui->sliderIntensity->onSave(); + ui->radioPerspective->onSave(); + ui->radioOrthographic->onSave(); +} + +void DlgSettings3DViewImp::loadSettings() +{ + ui->CheckBox_CornerCoordSystem->onRestore(); + ui->SpinBox_CornerCoordSystemSize->onRestore(); + ui->CheckBox_ShowAxisCross->onRestore(); + ui->CheckBox_ShowFPS->onRestore(); + ui->CheckBox_use_SW_OpenGL->onRestore(); + ui->CheckBox_useVBO->onRestore(); + ui->FloatSpinBox_EyeDistance->onRestore(); + ui->checkBoxBacklight->onRestore(); + ui->backlightColor->onRestore(); + ui->sliderIntensity->onRestore(); + ui->radioPerspective->onRestore(); + ui->radioOrthographic->onRestore(); + + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View"); + + int index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None)); + index = Base::clamp(index, 0, ui->comboAliasing->count()-1); + ui->comboAliasing->setCurrentIndex(index); + // connect after setting current item of the combo box + connect(ui->comboAliasing, qOverload(&QComboBox::currentIndexChanged), + this, &DlgSettings3DViewImp::onAliasingChanged); + + index = hGrp->GetInt("RenderCache", 0); + ui->renderCache->setCurrentIndex(index); + + ui->comboTransparentRender->onRestore(); + + int const current = hGrp->GetInt("MarkerSize", 9L); + ui->boxMarkerSize->addItem(tr("5px"), QVariant(5)); + ui->boxMarkerSize->addItem(tr("7px"), QVariant(7)); + ui->boxMarkerSize->addItem(tr("9px"), QVariant(9)); + ui->boxMarkerSize->addItem(tr("11px"), QVariant(11)); + ui->boxMarkerSize->addItem(tr("13px"), QVariant(13)); + ui->boxMarkerSize->addItem(tr("15px"), QVariant(15)); + index = ui->boxMarkerSize->findData(QVariant(current)); + if (index < 0) index = 2; + ui->boxMarkerSize->setCurrentIndex(index); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgSettings3DViewImp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->comboAliasing->blockSignals(true); + int aliasing = ui->comboAliasing->currentIndex(); + ui->retranslateUi(this); + ui->comboAliasing->setCurrentIndex(aliasing); + ui->comboAliasing->blockSignals(false); + } + else { + QWidget::changeEvent(e); + } +} + +void DlgSettings3DViewImp::onAliasingChanged(int index) +{ + if (index < 0 || !isVisible()) + return; + // Show this message only once per application session to reduce + // annoyance when showing it too often. + if (showMsg) { + showMsg = false; + QMessageBox::information(this, tr("Anti-aliasing"), + tr("Open a new viewer or restart %1 to apply anti-aliasing changes.").arg(qApp->applicationName())); + } +} + +#include "moc_DlgSettings3DViewImp.cpp" + diff --git a/src/Gui/DlgSettings3DViewImp.h b/src/Gui/PreferencePages/DlgSettings3DViewImp.h similarity index 96% rename from src/Gui/DlgSettings3DViewImp.h rename to src/Gui/PreferencePages/DlgSettings3DViewImp.h index 5c8ade7c74..03f402aaa1 100644 --- a/src/Gui/DlgSettings3DViewImp.h +++ b/src/Gui/PreferencePages/DlgSettings3DViewImp.h @@ -1,66 +1,66 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H -#define GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H - -#include "PropertyPage.h" -#include - -class QDoubleSpinBox; - -namespace Gui { -namespace Dialog { -class Ui_DlgSettings3DView; - -/** - * The DlgSettings3DViewImp class implements a preference page to change settings - * for the Inventor viewer. - * \author Jürgen Riegel - */ -class DlgSettings3DViewImp : public PreferencePage -{ - Q_OBJECT - -public: - explicit DlgSettings3DViewImp(QWidget* parent = nullptr); - ~DlgSettings3DViewImp() override; - - void saveSettings() override; - void loadSettings() override; - -private Q_SLOTS: - void onAliasingChanged(int); - -protected: - void changeEvent(QEvent *e) override; - -private: - std::unique_ptr ui; - static bool showMsg; -}; - -} // namespace Dialog -} // namespace Gui - -#endif // GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H +/*************************************************************************** + * Copyright (c) 2002 Jürgen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H +#define GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H + +#include +#include + +class QDoubleSpinBox; + +namespace Gui { +namespace Dialog { +class Ui_DlgSettings3DView; + +/** + * The DlgSettings3DViewImp class implements a preference page to change settings + * for the Inventor viewer. + * \author Jürgen Riegel + */ +class DlgSettings3DViewImp : public PreferencePage +{ + Q_OBJECT + +public: + explicit DlgSettings3DViewImp(QWidget* parent = nullptr); + ~DlgSettings3DViewImp() override; + + void saveSettings() override; + void loadSettings() override; + +private Q_SLOTS: + void onAliasingChanged(int); + +protected: + void changeEvent(QEvent *e) override; + +private: + std::unique_ptr ui; + static bool showMsg; +}; + +} // namespace Dialog +} // namespace Gui + +#endif // GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H diff --git a/src/Gui/DlgSettingsCacheDirectory.cpp b/src/Gui/PreferencePages/DlgSettingsCacheDirectory.cpp similarity index 99% rename from src/Gui/DlgSettingsCacheDirectory.cpp rename to src/Gui/PreferencePages/DlgSettingsCacheDirectory.cpp index eda5e9f2cb..2bd7b63049 100644 --- a/src/Gui/DlgSettingsCacheDirectory.cpp +++ b/src/Gui/PreferencePages/DlgSettingsCacheDirectory.cpp @@ -37,11 +37,11 @@ #include #include +#include +#include #include "DlgSettingsCacheDirectory.h" #include "ui_DlgSettingsCacheDirectory.h" -#include "DocumentRecovery.h" -#include "MainWindow.h" using namespace Gui::Dialog; diff --git a/src/Gui/DlgSettingsCacheDirectory.h b/src/Gui/PreferencePages/DlgSettingsCacheDirectory.h similarity index 99% rename from src/Gui/DlgSettingsCacheDirectory.h rename to src/Gui/PreferencePages/DlgSettingsCacheDirectory.h index 19fcf17ab4..e8bffe5154 100644 --- a/src/Gui/DlgSettingsCacheDirectory.h +++ b/src/Gui/PreferencePages/DlgSettingsCacheDirectory.h @@ -24,7 +24,7 @@ #ifndef GUI_DIALOG_DLGSETTINGSCACHEDIRECTORY_H #define GUI_DIALOG_DLGSETTINGSCACHEDIRECTORY_H -#include "PropertyPage.h" +#include #include namespace Gui { diff --git a/src/Gui/DlgSettingsCacheDirectory.ui b/src/Gui/PreferencePages/DlgSettingsCacheDirectory.ui similarity index 100% rename from src/Gui/DlgSettingsCacheDirectory.ui rename to src/Gui/PreferencePages/DlgSettingsCacheDirectory.ui diff --git a/src/Gui/DlgSettingsDocument.ui b/src/Gui/PreferencePages/DlgSettingsDocument.ui similarity index 100% rename from src/Gui/DlgSettingsDocument.ui rename to src/Gui/PreferencePages/DlgSettingsDocument.ui diff --git a/src/Gui/DlgSettingsDocumentImp.cpp b/src/Gui/PreferencePages/DlgSettingsDocumentImp.cpp similarity index 96% rename from src/Gui/DlgSettingsDocumentImp.cpp rename to src/Gui/PreferencePages/DlgSettingsDocumentImp.cpp index 7c788bb2df..7653d19f5c 100644 --- a/src/Gui/DlgSettingsDocumentImp.cpp +++ b/src/Gui/PreferencePages/DlgSettingsDocumentImp.cpp @@ -1,184 +1,184 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - -#include "PreCompiled.h" - -#include - -#include "DlgSettingsDocumentImp.h" -#include "ui_DlgSettingsDocument.h" -#include "AutoSaver.h" -#include - - -using namespace Gui::Dialog; - -/* TRANSLATOR Gui::Dialog::DlgSettingsDocumentImp */ - -/** - * Constructs a DlgSettingsDocumentImp which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - */ -DlgSettingsDocumentImp::DlgSettingsDocumentImp( QWidget* parent ) - : PreferencePage( parent ) - , ui(new Ui_DlgSettingsDocument) -{ - ui->setupUi(this); - addLicenseTypes(); - - ui->prefSaveTransaction->hide(); - ui->prefDiscardTransaction->hide(); - - QString tip = QString::fromLatin1("

%1

" - "

%2: %Y%m%d-%H%M%S

" - "

%3: C++ strftime" - "

").arg(tr("The format of the date to use."), tr("Default"), tr("Format")); - ui->prefSaveBackupDateFormat->setToolTip(tip); - - ui->prefCountBackupFiles->setMaximum(INT_MAX); - ui->prefCompression->setMinimum(Z_NO_COMPRESSION); - ui->prefCompression->setMaximum(Z_BEST_COMPRESSION); - connect(ui->prefLicenseType, qOverload(&QComboBox::currentIndexChanged), - this, &DlgSettingsDocumentImp::onLicenseTypeChanged); -} - -/** - * Destroys the object and frees any allocated resources - */ -DlgSettingsDocumentImp::~DlgSettingsDocumentImp() -{ - // no need to delete child widgets, Qt does it all for us -} - - -void DlgSettingsDocumentImp::saveSettings() -{ - ui->prefCheckNewDoc->onSave(); - ui->prefCompression->onSave(); - - ui->prefUndoRedo->onSave(); - ui->prefUndoRedoSize->onSave(); - ui->prefSaveTransaction->onSave(); - ui->prefDiscardTransaction->onSave(); - ui->prefSaveThumbnail->onSave(); - ui->prefThumbnailSize->onSave(); - ui->prefAddLogo->onSave(); - ui->prefSaveBackupFiles->onSave(); - ui->prefCountBackupFiles->onSave(); - ui->prefSaveBackupExtension->onSave(); - ui->prefSaveBackupDateFormat->onSave(); - ui->prefDuplicateLabel->onSave(); - ui->prefPartialLoading->onSave(); - ui->prefLicenseType->onSave(); - ui->prefLicenseUrl->onSave(); - ui->prefAuthor->onSave(); - ui->prefSetAuthorOnSave->onSave(); - ui->prefCompany->onSave(); - ui->prefRecovery->onSave(); - ui->prefAutoSaveEnabled->onSave(); - ui->prefAutoSaveTimeout->onSave(); - ui->prefCanAbortRecompute->onSave(); - - int timeout = ui->prefAutoSaveTimeout->value(); - if (!ui->prefAutoSaveEnabled->isChecked()) - timeout = 0; - AutoSaver::instance()->setTimeout(timeout * 60000); -} - -void DlgSettingsDocumentImp::loadSettings() -{ - ui->prefCheckNewDoc->onRestore(); - ui->prefCompression->onRestore(); - - ui->prefUndoRedo->onRestore(); - ui->prefUndoRedoSize->onRestore(); - ui->prefSaveTransaction->onRestore(); - ui->prefDiscardTransaction->onRestore(); - ui->prefSaveThumbnail->onRestore(); - ui->prefThumbnailSize->onRestore(); - ui->prefAddLogo->onRestore(); - ui->prefSaveBackupFiles->onRestore(); - ui->prefCountBackupFiles->onRestore(); - ui->prefSaveBackupExtension->onRestore(); - ui->prefSaveBackupDateFormat->onRestore(); - ui->prefDuplicateLabel->onRestore(); - ui->prefPartialLoading->onRestore(); - ui->prefLicenseType->onRestore(); - ui->prefLicenseUrl->onRestore(); - ui->prefAuthor->onRestore(); - ui->prefSetAuthorOnSave->onRestore(); - ui->prefCompany->onRestore(); - ui->prefRecovery->onRestore(); - ui->prefAutoSaveEnabled->onRestore(); - ui->prefAutoSaveTimeout->onRestore(); - ui->prefCanAbortRecompute->onRestore(); -} - -/** - * Sets the strings of the subwidgets using the current language. - */ -void DlgSettingsDocumentImp::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) { - ui->retranslateUi(this); - int index = ui->prefLicenseType->currentIndex(); - addLicenseTypes(); - ui->prefLicenseType->setCurrentIndex(index); - } - else { - QWidget::changeEvent(e); - } -} - -void DlgSettingsDocumentImp::addLicenseTypes() -{ - auto add = [&](const char* what) { - ui->prefLicenseType->addItem( - QApplication::translate("Gui::Dialog::DlgSettingsDocument", what)); - }; - - ui->prefLicenseType->clear(); - for (const auto& licenseItem : App::licenseItems) { - add(licenseItem.at(App::posnOfFullName)); - } - add("Other"); -} - -/** - * Fix Url according to changed type - */ -void DlgSettingsDocumentImp::onLicenseTypeChanged(int index) -{ - if (index >= 0 && index < App::countOfLicenses) { - // existing license - const char* url {App::licenseItems.at(index).at(App::posnOfUrl)}; - ui->prefLicenseUrl->setText(QString::fromLatin1(url)); - ui->prefLicenseUrl->setReadOnly(true); - } - else { - // Other - ui->prefLicenseUrl->clear(); - ui->prefLicenseUrl->setReadOnly(false); - } -} - -#include "moc_DlgSettingsDocumentImp.cpp" +/*************************************************************************** + * Copyright (c) 2002 Jürgen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#include "PreCompiled.h" + +#include +#include +#include + +#include "DlgSettingsDocumentImp.h" +#include "ui_DlgSettingsDocument.h" + + +using namespace Gui::Dialog; + +/* TRANSLATOR Gui::Dialog::DlgSettingsDocumentImp */ + +/** + * Constructs a DlgSettingsDocumentImp which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgSettingsDocumentImp::DlgSettingsDocumentImp( QWidget* parent ) + : PreferencePage( parent ) + , ui(new Ui_DlgSettingsDocument) +{ + ui->setupUi(this); + addLicenseTypes(); + + ui->prefSaveTransaction->hide(); + ui->prefDiscardTransaction->hide(); + + QString tip = QString::fromLatin1("

%1

" + "

%2: %Y%m%d-%H%M%S

" + "

%3: C++ strftime" + "

").arg(tr("The format of the date to use."), tr("Default"), tr("Format")); + ui->prefSaveBackupDateFormat->setToolTip(tip); + + ui->prefCountBackupFiles->setMaximum(INT_MAX); + ui->prefCompression->setMinimum(Z_NO_COMPRESSION); + ui->prefCompression->setMaximum(Z_BEST_COMPRESSION); + connect(ui->prefLicenseType, qOverload(&QComboBox::currentIndexChanged), + this, &DlgSettingsDocumentImp::onLicenseTypeChanged); +} + +/** + * Destroys the object and frees any allocated resources + */ +DlgSettingsDocumentImp::~DlgSettingsDocumentImp() +{ + // no need to delete child widgets, Qt does it all for us +} + + +void DlgSettingsDocumentImp::saveSettings() +{ + ui->prefCheckNewDoc->onSave(); + ui->prefCompression->onSave(); + + ui->prefUndoRedo->onSave(); + ui->prefUndoRedoSize->onSave(); + ui->prefSaveTransaction->onSave(); + ui->prefDiscardTransaction->onSave(); + ui->prefSaveThumbnail->onSave(); + ui->prefThumbnailSize->onSave(); + ui->prefAddLogo->onSave(); + ui->prefSaveBackupFiles->onSave(); + ui->prefCountBackupFiles->onSave(); + ui->prefSaveBackupExtension->onSave(); + ui->prefSaveBackupDateFormat->onSave(); + ui->prefDuplicateLabel->onSave(); + ui->prefPartialLoading->onSave(); + ui->prefLicenseType->onSave(); + ui->prefLicenseUrl->onSave(); + ui->prefAuthor->onSave(); + ui->prefSetAuthorOnSave->onSave(); + ui->prefCompany->onSave(); + ui->prefRecovery->onSave(); + ui->prefAutoSaveEnabled->onSave(); + ui->prefAutoSaveTimeout->onSave(); + ui->prefCanAbortRecompute->onSave(); + + int timeout = ui->prefAutoSaveTimeout->value(); + if (!ui->prefAutoSaveEnabled->isChecked()) + timeout = 0; + AutoSaver::instance()->setTimeout(timeout * 60000); +} + +void DlgSettingsDocumentImp::loadSettings() +{ + ui->prefCheckNewDoc->onRestore(); + ui->prefCompression->onRestore(); + + ui->prefUndoRedo->onRestore(); + ui->prefUndoRedoSize->onRestore(); + ui->prefSaveTransaction->onRestore(); + ui->prefDiscardTransaction->onRestore(); + ui->prefSaveThumbnail->onRestore(); + ui->prefThumbnailSize->onRestore(); + ui->prefAddLogo->onRestore(); + ui->prefSaveBackupFiles->onRestore(); + ui->prefCountBackupFiles->onRestore(); + ui->prefSaveBackupExtension->onRestore(); + ui->prefSaveBackupDateFormat->onRestore(); + ui->prefDuplicateLabel->onRestore(); + ui->prefPartialLoading->onRestore(); + ui->prefLicenseType->onRestore(); + ui->prefLicenseUrl->onRestore(); + ui->prefAuthor->onRestore(); + ui->prefSetAuthorOnSave->onRestore(); + ui->prefCompany->onRestore(); + ui->prefRecovery->onRestore(); + ui->prefAutoSaveEnabled->onRestore(); + ui->prefAutoSaveTimeout->onRestore(); + ui->prefCanAbortRecompute->onRestore(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgSettingsDocumentImp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + int index = ui->prefLicenseType->currentIndex(); + addLicenseTypes(); + ui->prefLicenseType->setCurrentIndex(index); + } + else { + QWidget::changeEvent(e); + } +} + +void DlgSettingsDocumentImp::addLicenseTypes() +{ + auto add = [&](const char* what) { + ui->prefLicenseType->addItem( + QApplication::translate("Gui::Dialog::DlgSettingsDocument", what)); + }; + + ui->prefLicenseType->clear(); + for (const auto& licenseItem : App::licenseItems) { + add(licenseItem.at(App::posnOfFullName)); + } + add("Other"); +} + +/** + * Fix Url according to changed type + */ +void DlgSettingsDocumentImp::onLicenseTypeChanged(int index) +{ + if (index >= 0 && index < App::countOfLicenses) { + // existing license + const char* url {App::licenseItems.at(index).at(App::posnOfUrl)}; + ui->prefLicenseUrl->setText(QString::fromLatin1(url)); + ui->prefLicenseUrl->setReadOnly(true); + } + else { + // Other + ui->prefLicenseUrl->clear(); + ui->prefLicenseUrl->setReadOnly(false); + } +} + +#include "moc_DlgSettingsDocumentImp.cpp" diff --git a/src/Gui/DlgSettingsDocumentImp.h b/src/Gui/PreferencePages/DlgSettingsDocumentImp.h similarity index 96% rename from src/Gui/DlgSettingsDocumentImp.h rename to src/Gui/PreferencePages/DlgSettingsDocumentImp.h index 0ccee6b560..80f2357034 100644 --- a/src/Gui/DlgSettingsDocumentImp.h +++ b/src/Gui/PreferencePages/DlgSettingsDocumentImp.h @@ -1,64 +1,64 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H -#define GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H - -#include "PropertyPage.h" -#include - -namespace Gui { -namespace Dialog { -class Ui_DlgSettingsDocument; - -/** - * The DlgSettingsDocumentImp class implements a preference page to change settings - * for the document. - * \author Jürgen Riegel - */ -class DlgSettingsDocumentImp : public PreferencePage -{ - Q_OBJECT - -public: - explicit DlgSettingsDocumentImp( QWidget* parent = nullptr ); - ~DlgSettingsDocumentImp() override; - - void saveSettings() override; - void loadSettings() override; - -protected Q_SLOTS: - void onLicenseTypeChanged(int index); - -protected: - void changeEvent(QEvent *e) override; - void addLicenseTypes(); - -private: - std::unique_ptr ui; -}; - -} // namespace Dialog -} // namespace Gui - -#endif // GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H +/*************************************************************************** + * Copyright (c) 2002 Jürgen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H +#define GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H + +#include +#include + +namespace Gui { +namespace Dialog { +class Ui_DlgSettingsDocument; + +/** + * The DlgSettingsDocumentImp class implements a preference page to change settings + * for the document. + * \author Jürgen Riegel + */ +class DlgSettingsDocumentImp : public PreferencePage +{ + Q_OBJECT + +public: + explicit DlgSettingsDocumentImp( QWidget* parent = nullptr ); + ~DlgSettingsDocumentImp() override; + + void saveSettings() override; + void loadSettings() override; + +protected Q_SLOTS: + void onLicenseTypeChanged(int index); + +protected: + void changeEvent(QEvent *e) override; + void addLicenseTypes(); + +private: + std::unique_ptr ui; +}; + +} // namespace Dialog +} // namespace Gui + +#endif // GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H diff --git a/src/Gui/DlgSettingsEditor.cpp b/src/Gui/PreferencePages/DlgSettingsEditor.cpp similarity index 91% rename from src/Gui/DlgSettingsEditor.cpp rename to src/Gui/PreferencePages/DlgSettingsEditor.cpp index 00021e3f61..4dd9734c49 100644 --- a/src/Gui/DlgSettingsEditor.cpp +++ b/src/Gui/PreferencePages/DlgSettingsEditor.cpp @@ -26,11 +26,12 @@ # include #endif +#include +#include +#include + #include "DlgSettingsEditor.h" #include "ui_DlgSettingsEditor.h" -#include "PythonEditor.h" -#include "Tools.h" -#include using namespace Gui; @@ -72,16 +73,16 @@ QFont getMonospaceFont() } } -/* TRANSLATOR Gui::Dialog::DlgSettingsEditorImp */ +/* TRANSLATOR Gui::Dialog::DlgSettingsEditor */ /** - * Constructs a DlgSettingsEditorImp which is a child of 'parent', with the + * Constructs a DlgSettingsEditor 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. */ -DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent ) +DlgSettingsEditor::DlgSettingsEditor( QWidget* parent ) : PreferencePage( parent ) , ui(new Ui_DlgSettingsEditor) { @@ -171,29 +172,29 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent ) } /** Destroys the object and frees any allocated resources */ -DlgSettingsEditorImp::~DlgSettingsEditorImp() +DlgSettingsEditor::~DlgSettingsEditor() { // no need to delete child widgets, Qt does it all for us delete pythonSyntax; delete d; } -void DlgSettingsEditorImp::setupConnections() +void DlgSettingsEditor::setupConnections() { connect(ui->displayItems, &QTreeWidget::currentItemChanged, - this, &DlgSettingsEditorImp::onDisplayItemsCurrentItemChanged); + this, &DlgSettingsEditor::onDisplayItemsCurrentItemChanged); connect(ui->colorButton, &ColorButton::changed, - this, &DlgSettingsEditorImp::onColorButtonChanged); + this, &DlgSettingsEditor::onColorButtonChanged); #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) connect(ui->fontFamily, qOverload(&QComboBox::activated), - this, &DlgSettingsEditorImp::onFontFamilyActivated); + this, &DlgSettingsEditor::onFontFamilyActivated); connect(ui->fontSize, qOverload(&PrefSpinBox::valueChanged), - this, &DlgSettingsEditorImp::onFontSizeValueChanged); + this, &DlgSettingsEditor::onFontSizeValueChanged); #else connect(ui->fontFamily, &QComboBox::textActivated, - this, &DlgSettingsEditorImp::onFontFamilyActivated); + this, &DlgSettingsEditor::onFontFamilyActivated); connect(ui->fontSize, &PrefSpinBox::textChanged, - this, &DlgSettingsEditorImp::onFontSizeValueChanged); + this, &DlgSettingsEditor::onFontSizeValueChanged); #endif } @@ -201,7 +202,7 @@ void DlgSettingsEditorImp::setupConnections() * settings ColorMap and assigns it to the color button * @see Gui::ColorButton */ -void DlgSettingsEditorImp::onDisplayItemsCurrentItemChanged(QTreeWidgetItem *item) +void DlgSettingsEditor::onDisplayItemsCurrentItemChanged(QTreeWidgetItem *item) { int index = ui->displayItems->indexOfTopLevelItem(item); unsigned int col = d->colormap[index].second; @@ -209,7 +210,7 @@ void DlgSettingsEditorImp::onDisplayItemsCurrentItemChanged(QTreeWidgetItem *ite } /** Updates the color map if a color was changed */ -void DlgSettingsEditorImp::onColorButtonChanged() +void DlgSettingsEditor::onColorButtonChanged() { QColor col = ui->colorButton->color(); unsigned int lcol = App::Color::asPackedRGB(col); @@ -219,7 +220,7 @@ void DlgSettingsEditorImp::onColorButtonChanged() pythonSyntax->setColor( d->colormap[index].first, col ); } -void DlgSettingsEditorImp::setEditorTabWidth(int tabWidth) +void DlgSettingsEditor::setEditorTabWidth(int tabWidth) { QFontMetrics metric(font()); int fontSize = QtTools::horizontalAdvance(metric, QLatin1Char('0')); @@ -230,7 +231,7 @@ void DlgSettingsEditorImp::setEditorTabWidth(int tabWidth) #endif } -void DlgSettingsEditorImp::saveSettings() +void DlgSettingsEditor::saveSettings() { ui->EnableLineNumber->onSave(); ui->EnableBlockCursor->onSave(); @@ -253,7 +254,7 @@ void DlgSettingsEditorImp::saveSettings() setEditorTabWidth(ui->tabSize->value()); } -void DlgSettingsEditorImp::loadSettings() +void DlgSettingsEditor::loadSettings() { ui->EnableLineNumber->onRestore(); ui->EnableBlockCursor->onRestore(); @@ -325,7 +326,7 @@ void DlgSettingsEditorImp::loadSettings() /** * Sets the strings of the subwidgets using the current language. */ -void DlgSettingsEditorImp::changeEvent(QEvent *e) +void DlgSettingsEditor::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { int index = 0; @@ -337,16 +338,16 @@ void DlgSettingsEditorImp::changeEvent(QEvent *e) } } -void DlgSettingsEditorImp::onFontFamilyActivated(const QString& fontFamily) +void DlgSettingsEditor::onFontFamilyActivated(const QString& fontFamily) { int fontSize = ui->fontSize->value(); QFont ft(fontFamily, fontSize); ui->textEdit1->setFont(ft); } -void DlgSettingsEditorImp::onFontSizeValueChanged(const QString&) +void DlgSettingsEditor::onFontSizeValueChanged(const QString&) { onFontFamilyActivated(ui->fontFamily->currentText()); } -#include "moc_DlgEditorImp.cpp" +#include "moc_DlgSettingsEditor.cpp" diff --git a/src/Gui/DlgSettingsEditor.h b/src/Gui/PreferencePages/DlgSettingsEditor.h similarity index 89% rename from src/Gui/DlgSettingsEditor.h rename to src/Gui/PreferencePages/DlgSettingsEditor.h index 2f80910f0e..cf6e7ecb6d 100644 --- a/src/Gui/DlgSettingsEditor.h +++ b/src/Gui/PreferencePages/DlgSettingsEditor.h @@ -24,7 +24,7 @@ #ifndef GUI_DIALOG_DLGSETTINGSEDITOR_H #define GUI_DIALOG_DLGSETTINGSEDITOR_H -#include "PropertyPage.h" +#include #include class QTreeWidgetItem; @@ -40,13 +40,13 @@ class Ui_DlgSettingsEditor; * @author Werner Mayer */ struct DlgSettingsEditorP; -class DlgSettingsEditorImp : public PreferencePage +class DlgSettingsEditor : public PreferencePage { Q_OBJECT public: - explicit DlgSettingsEditorImp( QWidget* parent = nullptr ); - ~DlgSettingsEditorImp() override; + explicit DlgSettingsEditor( QWidget* parent = nullptr ); + ~DlgSettingsEditor() override; public: void saveSettings() override; @@ -68,8 +68,8 @@ private: DlgSettingsEditorP* d; Gui::PythonSyntaxHighlighter* pythonSyntax; - DlgSettingsEditorImp( const DlgSettingsEditorImp & ); - DlgSettingsEditorImp& operator=( const DlgSettingsEditorImp & ); + DlgSettingsEditor( const DlgSettingsEditor & ); + DlgSettingsEditor& operator=( const DlgSettingsEditor & ); }; } // namespace Dialog diff --git a/src/Gui/DlgSettingsEditor.ui b/src/Gui/PreferencePages/DlgSettingsEditor.ui similarity index 100% rename from src/Gui/DlgSettingsEditor.ui rename to src/Gui/PreferencePages/DlgSettingsEditor.ui diff --git a/src/Gui/DlgSettingsGeneral.cpp b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp similarity index 95% rename from src/Gui/DlgSettingsGeneral.cpp rename to src/Gui/PreferencePages/DlgSettingsGeneral.cpp index b73e9cb8fc..18f6113f75 100644 --- a/src/Gui/DlgSettingsGeneral.cpp +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp @@ -38,17 +38,18 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "DlgSettingsGeneral.h" #include "ui_DlgSettingsGeneral.h" -#include "Action.h" -#include "Application.h" -#include "DlgCreateNewPreferencePackImp.h" -#include "DlgPreferencesImp.h" -#include "DlgPreferencePackManagementImp.h" -#include "DlgRevertToBackupConfigImp.h" -#include "MainWindow.h" -#include "PreferencePackManager.h" -#include "Language/Translator.h" using namespace Gui::Dialog; namespace fs = boost::filesystem; @@ -75,7 +76,7 @@ DlgSettingsGeneral::DlgSettingsGeneral( QWidget* parent ) connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::onImportConfigClicked); connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgSettingsGeneral::saveAsNewPreferencePack); - connect(ui->themesCombobox, qOverload(&QComboBox::activated), this, &DlgGeneralImp::onThemeChanged); + connect(ui->themesCombobox, qOverload(&QComboBox::activated), this, &DlgSettingsGeneral::onThemeChanged); ui->ManagePreferencePacks->setToolTip(tr("Manage preference packs")); connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgSettingsGeneral::onManagePreferencePacksClicked); @@ -352,7 +353,7 @@ void DlgSettingsGeneral::loadSettings() loadThemes(); } -void DlgGeneralImp::saveThemes() +void DlgSettingsGeneral::saveThemes() { // First we save the name of the theme ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow"); @@ -378,7 +379,7 @@ void DlgGeneralImp::saveThemes() Application::Instance->setStyleSheet(sheet, tiledBackground); } -void DlgGeneralImp::loadThemes() +void DlgSettingsGeneral::loadThemes() { ui->themesCombobox->clear(); @@ -574,7 +575,7 @@ void DlgSettingsGeneral::onUnitSystemIndexChanged(int index) } } -void DlgGeneralImp::onThemeChanged(int index) { +void DlgSettingsGeneral::onThemeChanged(int index) { Q_UNUSED(index); themeChanged = true; } diff --git a/src/Gui/DlgSettingsGeneral.h b/src/Gui/PreferencePages/DlgSettingsGeneral.h similarity index 95% rename from src/Gui/DlgSettingsGeneral.h rename to src/Gui/PreferencePages/DlgSettingsGeneral.h index 631017546e..2b7313335b 100644 --- a/src/Gui/DlgSettingsGeneral.h +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.h @@ -25,8 +25,8 @@ #ifndef GUI_DIALOG_DLGSETTINGSGENERAL_H #define GUI_DIALOG_DLGSETTINGSGENERAL_H - -#include "PropertyPage.h" + +#include #include #include @@ -91,4 +91,4 @@ private: } // namespace Dialog } // namespace Gui -#endif // GUI_DIALOG_DLGSETTINGSGENERAL_H \ No newline at end of file +#endif // GUI_DIALOG_DLGSETTINGSGENERAL_H diff --git a/src/Gui/DlgSettingsGeneral.ui b/src/Gui/PreferencePages/DlgSettingsGeneral.ui similarity index 100% rename from src/Gui/DlgSettingsGeneral.ui rename to src/Gui/PreferencePages/DlgSettingsGeneral.ui diff --git a/src/Gui/DlgSettingsMacro.ui b/src/Gui/PreferencePages/DlgSettingsMacro.ui similarity index 100% rename from src/Gui/DlgSettingsMacro.ui rename to src/Gui/PreferencePages/DlgSettingsMacro.ui diff --git a/src/Gui/DlgSettingsMacroImp.cpp b/src/Gui/PreferencePages/DlgSettingsMacroImp.cpp similarity index 95% rename from src/Gui/DlgSettingsMacroImp.cpp rename to src/Gui/PreferencePages/DlgSettingsMacroImp.cpp index bf57d012d3..fb548c6666 100644 --- a/src/Gui/DlgSettingsMacroImp.cpp +++ b/src/Gui/PreferencePages/DlgSettingsMacroImp.cpp @@ -1,119 +1,120 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - -#include "PreCompiled.h" - -#include "DlgSettingsMacroImp.h" -#include "ui_DlgSettingsMacro.h" -#include "Action.h" -#include "Application.h" -#include "MainWindow.h" - -using namespace Gui::Dialog; - -/* TRANSLATOR Gui::Dialog::DlgSettingsMacroImp */ - -/** - * Constructs a DlgSettingsMacroImp which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - */ -DlgSettingsMacroImp::DlgSettingsMacroImp( QWidget* parent ) - : PreferencePage( parent ) - , ui(new Ui_DlgSettingsMacro) -{ - ui->setupUi(this); - - // Was never implemented, so hide it - ui->FileLogCheckBox->hide(); - ui->MacroPath_2->hide(); - - if (ui->MacroPath->fileName().isEmpty()) { - QDir d(QString::fromUtf8(App::GetApplication().getUserMacroDir().c_str())); - ui->MacroPath->setFileName(d.path()); - } -} - -/** - * Destroys the object and frees any allocated resources - */ -DlgSettingsMacroImp::~DlgSettingsMacroImp() -{ - // no need to delete child widgets, Qt does it all for us -} -/** Sets the size of the recent macros list from the user parameters. - * @see RecentMacrosAction - * @see StdCmdRecentMacros - */ -void DlgSettingsMacroImp::setRecentMacroSize() -{ - auto recent = getMainWindow()->findChild(QLatin1String("recentMacros")); - if (recent) { - ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); - recent->resizeList(hGrp->GetInt("RecentMacros", 4)); - } -} - -void DlgSettingsMacroImp::saveSettings() -{ - ui->PrefCheckBox_LocalEnv->onSave(); - ui->MacroPath->onSave(); - ui->PrefCheckBox_RecordGui->onSave(); - ui->PrefCheckBox_GuiAsComment->onSave(); - ui->PConsoleCheckBox->onSave(); - ui->FileLogCheckBox->onSave(); - ui->MacroPath_2->onSave(); - ui->RecentMacros->onSave(); - ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); - hGrp->SetASCII("ShortcutModifiers", qPrintable(ui->ShortcutModifiers->text())); - ui->ShortcutCount->onSave(); - setRecentMacroSize(); -} - -void DlgSettingsMacroImp::loadSettings() -{ - ui->PrefCheckBox_LocalEnv->onRestore(); - ui->MacroPath->onRestore(); - ui->PrefCheckBox_RecordGui->onRestore(); - ui->PrefCheckBox_GuiAsComment->onRestore(); - ui->PConsoleCheckBox->onRestore(); - ui->FileLogCheckBox->onRestore(); - ui->MacroPath_2->onRestore(); - ui->RecentMacros->onRestore(); - ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); - ui->ShortcutModifiers->setText(QString::fromStdString(hGrp->GetASCII("ShortcutModifiers", "Ctrl+Shift+"))); - ui->ShortcutCount->onRestore(); -} - -/** - * Sets the strings of the subwidgets using the current language. - */ -void DlgSettingsMacroImp::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) { - ui->retranslateUi(this); - } - else { - QWidget::changeEvent(e); - } -} - -#include "moc_DlgSettingsMacroImp.cpp" +/*************************************************************************** + * Copyright (c) 2002 Jürgen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#include "PreCompiled.h" + +#include +#include +#include + +#include "DlgSettingsMacroImp.h" +#include "ui_DlgSettingsMacro.h" + +using namespace Gui::Dialog; + +/* TRANSLATOR Gui::Dialog::DlgSettingsMacroImp */ + +/** + * Constructs a DlgSettingsMacroImp which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgSettingsMacroImp::DlgSettingsMacroImp( QWidget* parent ) + : PreferencePage( parent ) + , ui(new Ui_DlgSettingsMacro) +{ + ui->setupUi(this); + + // Was never implemented, so hide it + ui->FileLogCheckBox->hide(); + ui->MacroPath_2->hide(); + + if (ui->MacroPath->fileName().isEmpty()) { + QDir d(QString::fromUtf8(App::GetApplication().getUserMacroDir().c_str())); + ui->MacroPath->setFileName(d.path()); + } +} + +/** + * Destroys the object and frees any allocated resources + */ +DlgSettingsMacroImp::~DlgSettingsMacroImp() +{ + // no need to delete child widgets, Qt does it all for us +} +/** Sets the size of the recent macros list from the user parameters. + * @see RecentMacrosAction + * @see StdCmdRecentMacros + */ +void DlgSettingsMacroImp::setRecentMacroSize() +{ + auto recent = getMainWindow()->findChild(QLatin1String("recentMacros")); + if (recent) { + ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); + recent->resizeList(hGrp->GetInt("RecentMacros", 4)); + } +} + +void DlgSettingsMacroImp::saveSettings() +{ + ui->PrefCheckBox_LocalEnv->onSave(); + ui->MacroPath->onSave(); + ui->PrefCheckBox_RecordGui->onSave(); + ui->PrefCheckBox_GuiAsComment->onSave(); + ui->PConsoleCheckBox->onSave(); + ui->FileLogCheckBox->onSave(); + ui->MacroPath_2->onSave(); + ui->RecentMacros->onSave(); + ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); + hGrp->SetASCII("ShortcutModifiers", qPrintable(ui->ShortcutModifiers->text())); + ui->ShortcutCount->onSave(); + setRecentMacroSize(); +} + +void DlgSettingsMacroImp::loadSettings() +{ + ui->PrefCheckBox_LocalEnv->onRestore(); + ui->MacroPath->onRestore(); + ui->PrefCheckBox_RecordGui->onRestore(); + ui->PrefCheckBox_GuiAsComment->onRestore(); + ui->PConsoleCheckBox->onRestore(); + ui->FileLogCheckBox->onRestore(); + ui->MacroPath_2->onRestore(); + ui->RecentMacros->onRestore(); + ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); + ui->ShortcutModifiers->setText(QString::fromStdString(hGrp->GetASCII("ShortcutModifiers", "Ctrl+Shift+"))); + ui->ShortcutCount->onRestore(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgSettingsMacroImp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + } + else { + QWidget::changeEvent(e); + } +} + +#include "moc_DlgSettingsMacroImp.cpp" diff --git a/src/Gui/DlgSettingsMacroImp.h b/src/Gui/PreferencePages/DlgSettingsMacroImp.h similarity index 96% rename from src/Gui/DlgSettingsMacroImp.h rename to src/Gui/PreferencePages/DlgSettingsMacroImp.h index cff2bbdfa3..9ebb246d41 100644 --- a/src/Gui/DlgSettingsMacroImp.h +++ b/src/Gui/PreferencePages/DlgSettingsMacroImp.h @@ -1,61 +1,61 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_DIALOG_DLGSETTINGSMACROIMP_H -#define GUI_DIALOG_DLGSETTINGSMACROIMP_H - -#include "PropertyPage.h" -#include - -namespace Gui { -namespace Dialog { -class Ui_DlgSettingsMacro; - -/** - * The DlgSettingsMacroImp class implements a preference page to change settings - * for macro stuff. - * \author Jürgen Riegel - */ -class DlgSettingsMacroImp : public PreferencePage -{ - Q_OBJECT - -public: - explicit DlgSettingsMacroImp( QWidget* parent = nullptr ); - ~DlgSettingsMacroImp() override; - - void saveSettings() override; - void loadSettings() override; - -protected: - void changeEvent(QEvent *e) override; - -private: - std::unique_ptr ui; - void setRecentMacroSize(); -}; - -} // namespace Dialog -} // namespace Gui - -#endif // GUI_DIALOG_DLGSETTINGSMACROIMP_H +/*************************************************************************** + * Copyright (c) 2002 Jürgen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_DIALOG_DLGSETTINGSMACROIMP_H +#define GUI_DIALOG_DLGSETTINGSMACROIMP_H + +#include +#include + +namespace Gui { +namespace Dialog { +class Ui_DlgSettingsMacro; + +/** + * The DlgSettingsMacroImp class implements a preference page to change settings + * for macro stuff. + * \author Jürgen Riegel + */ +class DlgSettingsMacroImp : public PreferencePage +{ + Q_OBJECT + +public: + explicit DlgSettingsMacroImp( QWidget* parent = nullptr ); + ~DlgSettingsMacroImp() override; + + void saveSettings() override; + void loadSettings() override; + +protected: + void changeEvent(QEvent *e) override; + +private: + std::unique_ptr ui; + void setRecentMacroSize(); +}; + +} // namespace Dialog +} // namespace Gui + +#endif // GUI_DIALOG_DLGSETTINGSMACROIMP_H diff --git a/src/Gui/DlgSettingsNavigation.cpp b/src/Gui/PreferencePages/DlgSettingsNavigation.cpp similarity index 96% rename from src/Gui/DlgSettingsNavigation.cpp rename to src/Gui/PreferencePages/DlgSettingsNavigation.cpp index bd5df7e8ca..3defa2a97c 100644 --- a/src/Gui/DlgSettingsNavigation.cpp +++ b/src/Gui/PreferencePages/DlgSettingsNavigation.cpp @@ -1,379 +1,378 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - -#include "PreCompiled.h" - -#ifndef _PreComp_ -# include -# include -# include -# include -#endif - -#include -#include -#include - -#include "DlgSettingsNavigation.h" -#include "ui_DlgSettingsNavigation.h" -#include "MainWindow.h" -#include "View3DSettings.h" -#include "NavigationStyle.h" -#include "View3DInventor.h" -#include "View3DInventorViewer.h" -#include "ui_MouseButtons.h" - - -using namespace Gui::Dialog; - -/* TRANSLATOR Gui::Dialog::DlgSettingsNavigation */ - -/** - * Constructs a DlgSettingsNavigation which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - */ -DlgSettingsNavigation::DlgSettingsNavigation(QWidget* parent) - : PreferencePage( parent ) - , ui(new Ui_DlgSettingsNavigation) - , q0(0), q1(0), q2(0), q3(1) -{ - ui->setupUi(this); - ui->naviCubeBaseColor->setAllowTransparency(true); - retranslate(); -} - -/** - * Destroys the object and frees any allocated resources - */ -DlgSettingsNavigation::~DlgSettingsNavigation() -{ -} - -void DlgSettingsNavigation::saveSettings() -{ - // must be done as very first because we create a new instance of NavigatorStyle - // where we set some attributes afterwards - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/View"); - QVariant data = ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), - Qt::UserRole); - hGrp->SetASCII("NavigationStyle", (const char*)data.toByteArray()); - - int index = ui->comboOrbitStyle->currentIndex(); - hGrp->SetInt("OrbitStyle", index); - index = ui->comboRotationMode->currentIndex(); - hGrp->SetInt("RotationMode", index); - - ui->checkBoxZoomAtCursor->onSave(); - ui->checkBoxInvertZoom->onSave(); - ui->checkBoxDisableTilt->onSave(); - ui->checkBoxShowRotationCenter->onSave(); - ui->spinBoxZoomStep->onSave(); - ui->checkBoxUseAutoRotation->onSave(); - ui->qspinNewDocScale->onSave(); - ui->prefStepByTurn->onSave(); - ui->naviCubeCorner->onSave(); - ui->naviCubeToNearest->onSave(); - ui->prefCubeSize->onSave(); - ui->naviCubeBaseColor->onSave(); - - bool showNaviCube = ui->groupBoxNaviCube->isChecked(); - hGrp->SetBool("ShowNaviCube", showNaviCube); - - QVariant camera = ui->comboNewDocView->itemData(ui->comboNewDocView->currentIndex(), - Qt::UserRole); - hGrp->SetASCII("NewDocumentCameraOrientation", (const char*)camera.toByteArray()); - if (camera == QByteArray("Custom")) { - ParameterGrp::handle hCustom = hGrp->GetGroup("Custom"); - hCustom->SetFloat("Q0", q0); - hCustom->SetFloat("Q1", q1); - hCustom->SetFloat("Q2", q2); - hCustom->SetFloat("Q3", q3); - } - hGrp = App::GetApplication().GetParameterGroupByPath( - "User parameter:BaseApp/Preferences/NaviCube"); - if (ui->naviCubeFontName->currentIndex()) { - hGrp->SetASCII("FontString", ui->naviCubeFontName->currentText().toLatin1()); - } else { - hGrp->RemoveASCII("FontString"); - } -} - -void DlgSettingsNavigation::loadSettings() -{ - ui->checkBoxZoomAtCursor->onRestore(); - ui->checkBoxInvertZoom->onRestore(); - ui->checkBoxDisableTilt->onRestore(); - ui->checkBoxShowRotationCenter->onRestore(); - ui->spinBoxZoomStep->onRestore(); - ui->checkBoxUseAutoRotation->onRestore(); - ui->qspinNewDocScale->onRestore(); - ui->prefStepByTurn->onRestore(); - ui->naviCubeCorner->onRestore(); - ui->naviCubeToNearest->onRestore(); - ui->prefCubeSize->onRestore(); - ui->naviCubeBaseColor->onRestore(); - - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/View"); - std::string model = hGrp->GetASCII("NavigationStyle", CADNavigationStyle::getClassTypeId().getName()); - int index = ui->comboNavigationStyle->findData(QByteArray(model.c_str())); - if (index > -1) ui->comboNavigationStyle->setCurrentIndex(index); - - index = hGrp->GetInt("OrbitStyle", int(NavigationStyle::Trackball)); - index = Base::clamp(index, 0, ui->comboOrbitStyle->count()-1); - ui->comboOrbitStyle->setCurrentIndex(index); - - index = hGrp->GetInt("RotationMode", 1); - ui->comboRotationMode->setCurrentIndex(index); - - bool showNaviCube = hGrp->GetBool("ShowNaviCube", true); - ui->groupBoxNaviCube->setChecked(showNaviCube); - - ui->comboNewDocView->addItem(tr("Isometric"), QByteArray("Isometric")); - ui->comboNewDocView->addItem(tr("Dimetric"), QByteArray("Dimetric")); - ui->comboNewDocView->addItem(tr("Trimetric"), QByteArray("Trimetric")); - ui->comboNewDocView->addItem(tr("Top"), QByteArray("Top")); - ui->comboNewDocView->addItem(tr("Front"), QByteArray("Front")); - ui->comboNewDocView->addItem(tr("Left"), QByteArray("Left")); - ui->comboNewDocView->addItem(tr("Right"), QByteArray("Right")); - ui->comboNewDocView->addItem(tr("Rear"), QByteArray("Rear")); - ui->comboNewDocView->addItem(tr("Bottom"), QByteArray("Bottom")); - ui->comboNewDocView->addItem(tr("Custom"), QByteArray("Custom")); - std::string camera = hGrp->GetASCII("NewDocumentCameraOrientation", "Trimetric"); - index = ui->comboNewDocView->findData(QByteArray(camera.c_str())); - if (index > -1) ui->comboNewDocView->setCurrentIndex(index); - if (camera == "Custom") { - ParameterGrp::handle hCustom = hGrp->GetGroup("Custom"); - q0 = hCustom->GetFloat("Q0", q0); - q1 = hCustom->GetFloat("Q1", q1); - q2 = hCustom->GetFloat("Q2", q2); - q3 = hCustom->GetFloat("Q3", q3); - } - - connect(ui->comboNewDocView, qOverload(&QComboBox::currentIndexChanged), - this, &DlgSettingsNavigation::onNewDocViewChanged); - connect(ui->mouseButton, &QPushButton::clicked, - this, &DlgSettingsNavigation::onMouseButtonClicked); - - // fill up font styles - - // we purposely allow all available fonts on the system -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QStringList familyNames = QFontDatabase().families(QFontDatabase::Any); -#else - QStringList familyNames = QFontDatabase::families(QFontDatabase::Any); -#endif - ui->naviCubeFontName->addItems(familyNames); - - hGrp = App::GetApplication().GetParameterGroupByPath( - "User parameter:BaseApp/Preferences/NaviCube"); - int indexFamilyNames = familyNames.indexOf( - QString::fromStdString(hGrp->GetASCII("FontString"))); - ui->naviCubeFontName->setCurrentIndex(indexFamilyNames + 1); - -} - -void DlgSettingsNavigation::onMouseButtonClicked() -{ - QDialog dlg(this); - Ui_MouseButtons uimb; - uimb.setupUi(&dlg); - - QVariant data = - ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), Qt::UserRole); - void* instance = Base::Type::createInstanceByName((const char*)data.toByteArray()); - std::unique_ptr ns(static_cast(instance)); - uimb.groupBox->setTitle(uimb.groupBox->title() + QString::fromLatin1(" ") - + ui->comboNavigationStyle->currentText()); - QString descr; - descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::SELECTION)); - descr.replace(QLatin1String("\n"), QLatin1String("

")); - uimb.selectionLabel->setText(QString::fromLatin1("%1").arg(descr)); - descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::PANNING)); - descr.replace(QLatin1String("\n"), QLatin1String("

")); - uimb.panningLabel->setText(QString::fromLatin1("%1").arg(descr)); - descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::DRAGGING)); - descr.replace(QLatin1String("\n"), QLatin1String("

")); - uimb.rotationLabel->setText(QString::fromLatin1("%1").arg(descr)); - descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::ZOOMING)); - descr.replace(QLatin1String("\n"), QLatin1String("

")); - uimb.zoomingLabel->setText(QString::fromLatin1("%1").arg(descr)); - dlg.exec(); -} - -/** - * Sets the strings of the subwidgets using the current language. - */ -void DlgSettingsNavigation::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) { - int navigation = ui->comboNavigationStyle->currentIndex(); - int orbit = ui->comboOrbitStyle->currentIndex(); - int corner = ui->naviCubeCorner->currentIndex(); - ui->retranslateUi(this); - retranslate(); - ui->comboNavigationStyle->setCurrentIndex(navigation); - ui->comboOrbitStyle->setCurrentIndex(orbit); - ui->naviCubeCorner->setCurrentIndex(corner); - } - else { - QWidget::changeEvent(e); - } -} - -void DlgSettingsNavigation::retranslate() -{ - ui->comboNavigationStyle->clear(); - - // add submenu at the end to select navigation style - std::map styles = UserNavigationStyle::getUserFriendlyNames(); - for (const auto & style : styles) { - QByteArray data(style.first.getName()); - QString name = QApplication::translate(style.first.getName(), style.second.c_str()); - - ui->comboNavigationStyle->addItem(name, data); - } -} - -void DlgSettingsNavigation::onNewDocViewChanged(int index) -{ - QVariant camera = ui->comboNewDocView->itemData(index, Qt::UserRole); - if (camera == QByteArray("Custom")) { - CameraDialog dlg(this); - dlg.setValues(q0, q1, q2, q3); - if (dlg.exec()) { - dlg.getValues(q0, q1, q2, q3); - } - } -} - -// ---------------------------------------------------------------------------- - -CameraDialog::CameraDialog(QWidget* parent) - : QDialog(parent) -{ - this->setWindowTitle(tr("Camera settings")); - - QGridLayout *gridLayout; - gridLayout = new QGridLayout(this); - - QGroupBox *groupBox; - groupBox = new QGroupBox(this); - groupBox->setTitle(tr("Orientation")); - gridLayout->addWidget(groupBox, 0, 0, 1, 1); - - QDialogButtonBox *buttonBox; - buttonBox = new QDialogButtonBox(this); - buttonBox->setOrientation(Qt::Horizontal); - buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); - gridLayout->addWidget(buttonBox, 3, 0, 1, 1); - - QGridLayout *layout; - layout = new QGridLayout(groupBox); - - // Q0 - auto label0 = new QLabel(groupBox); - label0->setText(tr("Q0")); - layout->addWidget(label0, 0, 0, 1, 1); - - sb0 = new QDoubleSpinBox(groupBox); - sb0->setRange(-1, 1); - sb0->setSingleStep(0.1); - layout->addWidget(sb0, 0, 1, 1, 1); - - // Q1 - auto label1 = new QLabel(groupBox); - label1->setText(tr("Q1")); - layout->addWidget(label1, 1, 0, 1, 1); - - sb1 = new QDoubleSpinBox(groupBox); - sb1->setRange(-1, 1); - sb1->setSingleStep(0.1); - layout->addWidget(sb1, 1, 1, 1, 1); - - // Q2 - auto label2 = new QLabel(groupBox); - label2->setText(tr("Q2")); - layout->addWidget(label2, 2, 0, 1, 1); - - sb2 = new QDoubleSpinBox(groupBox); - sb2->setRange(-1, 1); - sb2->setSingleStep(0.1); - layout->addWidget(sb2, 2, 1, 1, 1); - - // Q3 - auto label3 = new QLabel(groupBox); - label3->setText(tr("Q3")); - layout->addWidget(label3, 3, 0, 1, 1); - - sb3 = new QDoubleSpinBox(groupBox); - sb3->setRange(-1, 1); - sb3->setSingleStep(0.1); - layout->addWidget(sb3, 3, 1, 1, 1); - - auto currentViewButton = new QPushButton(this); - currentViewButton->setText(tr("Current view")); - currentViewButton->setObjectName(QString::fromLatin1("currentView")); - layout->addWidget(currentViewButton, 4, 1, 2, 1); - - connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); - connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - connect(currentViewButton, &QPushButton::clicked, this, - &CameraDialog::onCurrentViewClicked); -} - -CameraDialog::~CameraDialog() -{ -} - -void CameraDialog::setValues(double q0, double q1, double q2, double q3) -{ - sb0->setValue(q0); - sb1->setValue(q1); - sb2->setValue(q2); - sb3->setValue(q3); -} - -void CameraDialog::getValues(double& q0, double& q1, double& q2, double& q3) const -{ - q0 = sb0->value(); - q1 = sb1->value(); - q2 = sb2->value(); - q3 = sb3->value(); -} - -void CameraDialog::onCurrentViewClicked() -{ - auto mdi = qobject_cast(getMainWindow()->activeWindow()); - if (mdi) { - SbRotation rot = mdi->getViewer()->getCameraOrientation(); - const float* q = rot.getValue(); - sb0->setValue(q[0]); - sb1->setValue(q[1]); - sb2->setValue(q[2]); - sb3->setValue(q[3]); - } -} - -#include "moc_DlgSettingsNavigation.cpp" - +/*************************************************************************** + * Copyright (c) 2002 Jürgen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#include "PreCompiled.h" + +#ifndef _PreComp_ +# include +# include +# include +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "DlgSettingsNavigation.h" +#include "ui_DlgSettingsNavigation.h" + +#include "../ui_MouseButtons.h" + +using namespace Gui::Dialog; + +/* TRANSLATOR Gui::Dialog::DlgSettingsNavigation */ + +/** + * Constructs a DlgSettingsNavigation which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgSettingsNavigation::DlgSettingsNavigation(QWidget* parent) + : PreferencePage( parent ) + , ui(new Ui_DlgSettingsNavigation) + , q0(0), q1(0), q2(0), q3(1) +{ + ui->setupUi(this); + ui->naviCubeBaseColor->setAllowTransparency(true); + retranslate(); +} + +/** + * Destroys the object and frees any allocated resources + */ +DlgSettingsNavigation::~DlgSettingsNavigation() +{ +} + +void DlgSettingsNavigation::saveSettings() +{ + // must be done as very first because we create a new instance of NavigatorStyle + // where we set some attributes afterwards + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View"); + QVariant data = ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), + Qt::UserRole); + hGrp->SetASCII("NavigationStyle", (const char*)data.toByteArray()); + + int index = ui->comboOrbitStyle->currentIndex(); + hGrp->SetInt("OrbitStyle", index); + index = ui->comboRotationMode->currentIndex(); + hGrp->SetInt("RotationMode", index); + + ui->checkBoxZoomAtCursor->onSave(); + ui->checkBoxInvertZoom->onSave(); + ui->checkBoxDisableTilt->onSave(); + ui->checkBoxShowRotationCenter->onSave(); + ui->spinBoxZoomStep->onSave(); + ui->checkBoxUseAutoRotation->onSave(); + ui->qspinNewDocScale->onSave(); + ui->prefStepByTurn->onSave(); + ui->naviCubeCorner->onSave(); + ui->naviCubeToNearest->onSave(); + ui->prefCubeSize->onSave(); + ui->naviCubeBaseColor->onSave(); + + bool showNaviCube = ui->groupBoxNaviCube->isChecked(); + hGrp->SetBool("ShowNaviCube", showNaviCube); + + QVariant camera = ui->comboNewDocView->itemData(ui->comboNewDocView->currentIndex(), + Qt::UserRole); + hGrp->SetASCII("NewDocumentCameraOrientation", (const char*)camera.toByteArray()); + if (camera == QByteArray("Custom")) { + ParameterGrp::handle hCustom = hGrp->GetGroup("Custom"); + hCustom->SetFloat("Q0", q0); + hCustom->SetFloat("Q1", q1); + hCustom->SetFloat("Q2", q2); + hCustom->SetFloat("Q3", q3); + } + hGrp = App::GetApplication().GetParameterGroupByPath( + "User parameter:BaseApp/Preferences/NaviCube"); + if (ui->naviCubeFontName->currentIndex()) { + hGrp->SetASCII("FontString", ui->naviCubeFontName->currentText().toLatin1()); + } else { + hGrp->RemoveASCII("FontString"); + } +} + +void DlgSettingsNavigation::loadSettings() +{ + ui->checkBoxZoomAtCursor->onRestore(); + ui->checkBoxInvertZoom->onRestore(); + ui->checkBoxDisableTilt->onRestore(); + ui->checkBoxShowRotationCenter->onRestore(); + ui->spinBoxZoomStep->onRestore(); + ui->checkBoxUseAutoRotation->onRestore(); + ui->qspinNewDocScale->onRestore(); + ui->prefStepByTurn->onRestore(); + ui->naviCubeCorner->onRestore(); + ui->naviCubeToNearest->onRestore(); + ui->prefCubeSize->onRestore(); + ui->naviCubeBaseColor->onRestore(); + + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View"); + std::string model = hGrp->GetASCII("NavigationStyle", CADNavigationStyle::getClassTypeId().getName()); + int index = ui->comboNavigationStyle->findData(QByteArray(model.c_str())); + if (index > -1) ui->comboNavigationStyle->setCurrentIndex(index); + + index = hGrp->GetInt("OrbitStyle", int(NavigationStyle::Trackball)); + index = Base::clamp(index, 0, ui->comboOrbitStyle->count()-1); + ui->comboOrbitStyle->setCurrentIndex(index); + + index = hGrp->GetInt("RotationMode", 1); + ui->comboRotationMode->setCurrentIndex(index); + + bool showNaviCube = hGrp->GetBool("ShowNaviCube", true); + ui->groupBoxNaviCube->setChecked(showNaviCube); + + ui->comboNewDocView->addItem(tr("Isometric"), QByteArray("Isometric")); + ui->comboNewDocView->addItem(tr("Dimetric"), QByteArray("Dimetric")); + ui->comboNewDocView->addItem(tr("Trimetric"), QByteArray("Trimetric")); + ui->comboNewDocView->addItem(tr("Top"), QByteArray("Top")); + ui->comboNewDocView->addItem(tr("Front"), QByteArray("Front")); + ui->comboNewDocView->addItem(tr("Left"), QByteArray("Left")); + ui->comboNewDocView->addItem(tr("Right"), QByteArray("Right")); + ui->comboNewDocView->addItem(tr("Rear"), QByteArray("Rear")); + ui->comboNewDocView->addItem(tr("Bottom"), QByteArray("Bottom")); + ui->comboNewDocView->addItem(tr("Custom"), QByteArray("Custom")); + std::string camera = hGrp->GetASCII("NewDocumentCameraOrientation", "Trimetric"); + index = ui->comboNewDocView->findData(QByteArray(camera.c_str())); + if (index > -1) ui->comboNewDocView->setCurrentIndex(index); + if (camera == "Custom") { + ParameterGrp::handle hCustom = hGrp->GetGroup("Custom"); + q0 = hCustom->GetFloat("Q0", q0); + q1 = hCustom->GetFloat("Q1", q1); + q2 = hCustom->GetFloat("Q2", q2); + q3 = hCustom->GetFloat("Q3", q3); + } + + connect(ui->comboNewDocView, qOverload(&QComboBox::currentIndexChanged), + this, &DlgSettingsNavigation::onNewDocViewChanged); + connect(ui->mouseButton, &QPushButton::clicked, + this, &DlgSettingsNavigation::onMouseButtonClicked); + + // fill up font styles + + // we purposely allow all available fonts on the system +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QStringList familyNames = QFontDatabase().families(QFontDatabase::Any); +#else + QStringList familyNames = QFontDatabase::families(QFontDatabase::Any); +#endif + ui->naviCubeFontName->addItems(familyNames); + + hGrp = App::GetApplication().GetParameterGroupByPath( + "User parameter:BaseApp/Preferences/NaviCube"); + int indexFamilyNames = familyNames.indexOf( + QString::fromStdString(hGrp->GetASCII("FontString"))); + ui->naviCubeFontName->setCurrentIndex(indexFamilyNames + 1); + +} + +void DlgSettingsNavigation::onMouseButtonClicked() +{ + QDialog dlg(this); + Ui_MouseButtons uimb; + uimb.setupUi(&dlg); + + QVariant data = + ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), Qt::UserRole); + void* instance = Base::Type::createInstanceByName((const char*)data.toByteArray()); + std::unique_ptr ns(static_cast(instance)); + uimb.groupBox->setTitle(uimb.groupBox->title() + QString::fromLatin1(" ") + + ui->comboNavigationStyle->currentText()); + QString descr; + descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::SELECTION)); + descr.replace(QLatin1String("\n"), QLatin1String("

")); + uimb.selectionLabel->setText(QString::fromLatin1("%1").arg(descr)); + descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::PANNING)); + descr.replace(QLatin1String("\n"), QLatin1String("

")); + uimb.panningLabel->setText(QString::fromLatin1("%1").arg(descr)); + descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::DRAGGING)); + descr.replace(QLatin1String("\n"), QLatin1String("

")); + uimb.rotationLabel->setText(QString::fromLatin1("%1").arg(descr)); + descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::ZOOMING)); + descr.replace(QLatin1String("\n"), QLatin1String("

")); + uimb.zoomingLabel->setText(QString::fromLatin1("%1").arg(descr)); + dlg.exec(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgSettingsNavigation::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + int navigation = ui->comboNavigationStyle->currentIndex(); + int orbit = ui->comboOrbitStyle->currentIndex(); + int corner = ui->naviCubeCorner->currentIndex(); + ui->retranslateUi(this); + retranslate(); + ui->comboNavigationStyle->setCurrentIndex(navigation); + ui->comboOrbitStyle->setCurrentIndex(orbit); + ui->naviCubeCorner->setCurrentIndex(corner); + } + else { + QWidget::changeEvent(e); + } +} + +void DlgSettingsNavigation::retranslate() +{ + ui->comboNavigationStyle->clear(); + + // add submenu at the end to select navigation style + std::map styles = UserNavigationStyle::getUserFriendlyNames(); + for (const auto & style : styles) { + QByteArray data(style.first.getName()); + QString name = QApplication::translate(style.first.getName(), style.second.c_str()); + + ui->comboNavigationStyle->addItem(name, data); + } +} + +void DlgSettingsNavigation::onNewDocViewChanged(int index) +{ + QVariant camera = ui->comboNewDocView->itemData(index, Qt::UserRole); + if (camera == QByteArray("Custom")) { + CameraDialog dlg(this); + dlg.setValues(q0, q1, q2, q3); + if (dlg.exec()) { + dlg.getValues(q0, q1, q2, q3); + } + } +} + +// ---------------------------------------------------------------------------- + +CameraDialog::CameraDialog(QWidget* parent) + : QDialog(parent) +{ + this->setWindowTitle(tr("Camera settings")); + + QGridLayout *gridLayout; + gridLayout = new QGridLayout(this); + + QGroupBox *groupBox; + groupBox = new QGroupBox(this); + groupBox->setTitle(tr("Orientation")); + gridLayout->addWidget(groupBox, 0, 0, 1, 1); + + QDialogButtonBox *buttonBox; + buttonBox = new QDialogButtonBox(this); + buttonBox->setOrientation(Qt::Horizontal); + buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); + gridLayout->addWidget(buttonBox, 3, 0, 1, 1); + + QGridLayout *layout; + layout = new QGridLayout(groupBox); + + // Q0 + auto label0 = new QLabel(groupBox); + label0->setText(tr("Q0")); + layout->addWidget(label0, 0, 0, 1, 1); + + sb0 = new QDoubleSpinBox(groupBox); + sb0->setRange(-1, 1); + sb0->setSingleStep(0.1); + layout->addWidget(sb0, 0, 1, 1, 1); + + // Q1 + auto label1 = new QLabel(groupBox); + label1->setText(tr("Q1")); + layout->addWidget(label1, 1, 0, 1, 1); + + sb1 = new QDoubleSpinBox(groupBox); + sb1->setRange(-1, 1); + sb1->setSingleStep(0.1); + layout->addWidget(sb1, 1, 1, 1, 1); + + // Q2 + auto label2 = new QLabel(groupBox); + label2->setText(tr("Q2")); + layout->addWidget(label2, 2, 0, 1, 1); + + sb2 = new QDoubleSpinBox(groupBox); + sb2->setRange(-1, 1); + sb2->setSingleStep(0.1); + layout->addWidget(sb2, 2, 1, 1, 1); + + // Q3 + auto label3 = new QLabel(groupBox); + label3->setText(tr("Q3")); + layout->addWidget(label3, 3, 0, 1, 1); + + sb3 = new QDoubleSpinBox(groupBox); + sb3->setRange(-1, 1); + sb3->setSingleStep(0.1); + layout->addWidget(sb3, 3, 1, 1, 1); + + auto currentViewButton = new QPushButton(this); + currentViewButton->setText(tr("Current view")); + currentViewButton->setObjectName(QString::fromLatin1("currentView")); + layout->addWidget(currentViewButton, 4, 1, 2, 1); + + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + connect(currentViewButton, &QPushButton::clicked, this, + &CameraDialog::onCurrentViewClicked); +} + +CameraDialog::~CameraDialog() +{ +} + +void CameraDialog::setValues(double q0, double q1, double q2, double q3) +{ + sb0->setValue(q0); + sb1->setValue(q1); + sb2->setValue(q2); + sb3->setValue(q3); +} + +void CameraDialog::getValues(double& q0, double& q1, double& q2, double& q3) const +{ + q0 = sb0->value(); + q1 = sb1->value(); + q2 = sb2->value(); + q3 = sb3->value(); +} + +void CameraDialog::onCurrentViewClicked() +{ + auto mdi = qobject_cast(getMainWindow()->activeWindow()); + if (mdi) { + SbRotation rot = mdi->getViewer()->getCameraOrientation(); + const float* q = rot.getValue(); + sb0->setValue(q[0]); + sb1->setValue(q[1]); + sb2->setValue(q[2]); + sb3->setValue(q[3]); + } +} + +#include "moc_DlgSettingsNavigation.cpp" diff --git a/src/Gui/DlgSettingsNavigation.h b/src/Gui/PreferencePages/DlgSettingsNavigation.h similarity index 97% rename from src/Gui/DlgSettingsNavigation.h rename to src/Gui/PreferencePages/DlgSettingsNavigation.h index 41ec66f8f3..95edfc7def 100644 --- a/src/Gui/DlgSettingsNavigation.h +++ b/src/Gui/PreferencePages/DlgSettingsNavigation.h @@ -1,90 +1,90 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_DIALOG_DLGSETTINGSNAVIGATION_H -#define GUI_DIALOG_DLGSETTINGSNAVIGATION_H - -#include -#include "PropertyPage.h" -#include - -class QDoubleSpinBox; - -namespace Gui { -namespace Dialog { -class Ui_DlgSettingsNavigation; - -/** - * The Ui_DlgSettingsNavigation class implements a preference page to change settings - * for the Inventor viewer. - * \author Werner Mayer - */ -class DlgSettingsNavigation : public PreferencePage -{ - Q_OBJECT - -public: - explicit DlgSettingsNavigation(QWidget* parent = nullptr); - ~DlgSettingsNavigation() override; - - void saveSettings() override; - void loadSettings() override; - -private: - void onMouseButtonClicked(); - void onNewDocViewChanged(int); - -protected: - void changeEvent(QEvent *e) override; - void retranslate(); - -private: - std::unique_ptr ui; - double q0, q1, q2, q3; -}; - -class CameraDialog : public QDialog -{ - Q_OBJECT - -public: - explicit CameraDialog(QWidget* parent=nullptr); - ~CameraDialog() override; - void setValues(double q0, double q1, double q2, double q3); - void getValues(double& q0, double& q1, double& q2, double& q3) const; - - -private: - void onCurrentViewClicked(); - -private: - QDoubleSpinBox* sb0; - QDoubleSpinBox* sb1; - QDoubleSpinBox* sb2; - QDoubleSpinBox* sb3; -}; - -} // namespace Dialog -} // namespace Gui - -#endif // GUI_DIALOG_DLGSETTINGSNAVIGATION_H +/*************************************************************************** + * Copyright (c) 2002 Jürgen Riegel * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_DIALOG_DLGSETTINGSNAVIGATION_H +#define GUI_DIALOG_DLGSETTINGSNAVIGATION_H + +#include +#include "PropertyPage.h" +#include + +class QDoubleSpinBox; + +namespace Gui { +namespace Dialog { +class Ui_DlgSettingsNavigation; + +/** + * The Ui_DlgSettingsNavigation class implements a preference page to change settings + * for the Inventor viewer. + * \author Werner Mayer + */ +class DlgSettingsNavigation : public PreferencePage +{ + Q_OBJECT + +public: + explicit DlgSettingsNavigation(QWidget* parent = nullptr); + ~DlgSettingsNavigation() override; + + void saveSettings() override; + void loadSettings() override; + +private: + void onMouseButtonClicked(); + void onNewDocViewChanged(int); + +protected: + void changeEvent(QEvent *e) override; + void retranslate(); + +private: + std::unique_ptr ui; + double q0, q1, q2, q3; +}; + +class CameraDialog : public QDialog +{ + Q_OBJECT + +public: + explicit CameraDialog(QWidget* parent=nullptr); + ~CameraDialog() override; + void setValues(double q0, double q1, double q2, double q3); + void getValues(double& q0, double& q1, double& q2, double& q3) const; + + +private: + void onCurrentViewClicked(); + +private: + QDoubleSpinBox* sb0; + QDoubleSpinBox* sb1; + QDoubleSpinBox* sb2; + QDoubleSpinBox* sb3; +}; + +} // namespace Dialog +} // namespace Gui + +#endif // GUI_DIALOG_DLGSETTINGSNAVIGATION_H diff --git a/src/Gui/DlgSettingsNavigation.ui b/src/Gui/PreferencePages/DlgSettingsNavigation.ui similarity index 100% rename from src/Gui/DlgSettingsNavigation.ui rename to src/Gui/PreferencePages/DlgSettingsNavigation.ui diff --git a/src/Gui/DlgSettingsNotificationArea.cpp b/src/Gui/PreferencePages/DlgSettingsNotificationArea.cpp similarity index 100% rename from src/Gui/DlgSettingsNotificationArea.cpp rename to src/Gui/PreferencePages/DlgSettingsNotificationArea.cpp diff --git a/src/Gui/DlgSettingsNotificationArea.h b/src/Gui/PreferencePages/DlgSettingsNotificationArea.h similarity index 98% rename from src/Gui/DlgSettingsNotificationArea.h rename to src/Gui/PreferencePages/DlgSettingsNotificationArea.h index 75e1395fe2..94a675b2c1 100644 --- a/src/Gui/DlgSettingsNotificationArea.h +++ b/src/Gui/PreferencePages/DlgSettingsNotificationArea.h @@ -24,7 +24,7 @@ #ifndef GUI_DIALOG_DLGSETTINGSNOTIFICATIONAREA_H #define GUI_DIALOG_DLGSETTINGSNOTIFICATIONAREA_H -#include "PropertyPage.h" +#include #include namespace Gui { diff --git a/src/Gui/DlgSettingsNotificationArea.ui b/src/Gui/PreferencePages/DlgSettingsNotificationArea.ui similarity index 100% rename from src/Gui/DlgSettingsNotificationArea.ui rename to src/Gui/PreferencePages/DlgSettingsNotificationArea.ui diff --git a/src/Gui/DlgSettingsPythonConsole.cpp b/src/Gui/PreferencePages/DlgSettingsPythonConsole.cpp similarity index 100% rename from src/Gui/DlgSettingsPythonConsole.cpp rename to src/Gui/PreferencePages/DlgSettingsPythonConsole.cpp diff --git a/src/Gui/DlgSettingsPythonConsole.h b/src/Gui/PreferencePages/DlgSettingsPythonConsole.h similarity index 98% rename from src/Gui/DlgSettingsPythonConsole.h rename to src/Gui/PreferencePages/DlgSettingsPythonConsole.h index 4afaebf92e..ab514c8718 100644 --- a/src/Gui/DlgSettingsPythonConsole.h +++ b/src/Gui/PreferencePages/DlgSettingsPythonConsole.h @@ -24,7 +24,7 @@ #ifndef GUI_DIALOG_DLGSETTINGSPYTHONCONSOLE_H #define GUI_DIALOG_DLGSETTINGSPYTHONCONSOLE_H -#include "PropertyPage.h" +#include #include namespace Gui { diff --git a/src/Gui/DlgSettingsPythonConsole.ui b/src/Gui/PreferencePages/DlgSettingsPythonConsole.ui similarity index 100% rename from src/Gui/DlgSettingsPythonConsole.ui rename to src/Gui/PreferencePages/DlgSettingsPythonConsole.ui diff --git a/src/Gui/DlgSettingsReportView.cpp b/src/Gui/PreferencePages/DlgSettingsReportView.cpp similarity index 100% rename from src/Gui/DlgSettingsReportView.cpp rename to src/Gui/PreferencePages/DlgSettingsReportView.cpp diff --git a/src/Gui/DlgSettingsReportView.h b/src/Gui/PreferencePages/DlgSettingsReportView.h similarity index 98% rename from src/Gui/DlgSettingsReportView.h rename to src/Gui/PreferencePages/DlgSettingsReportView.h index 98ba04b669..2486c26438 100644 --- a/src/Gui/DlgSettingsReportView.h +++ b/src/Gui/PreferencePages/DlgSettingsReportView.h @@ -24,7 +24,7 @@ #ifndef GUI_DIALOG_DLG_SETTINGS_REPORT_VIEW #define GUI_DIALOG_DLG_SETTINGS_REPORT_VIEW -#include "PropertyPage.h" +#include #include namespace Gui { diff --git a/src/Gui/DlgSettingsReportView.ui b/src/Gui/PreferencePages/DlgSettingsReportView.ui similarity index 100% rename from src/Gui/DlgSettingsReportView.ui rename to src/Gui/PreferencePages/DlgSettingsReportView.ui diff --git a/src/Gui/DlgSettingsSelection.cpp b/src/Gui/PreferencePages/DlgSettingsSelection.cpp similarity index 97% rename from src/Gui/DlgSettingsSelection.cpp rename to src/Gui/PreferencePages/DlgSettingsSelection.cpp index ad90da3e3e..a079c37312 100644 --- a/src/Gui/DlgSettingsSelection.cpp +++ b/src/Gui/PreferencePages/DlgSettingsSelection.cpp @@ -82,4 +82,3 @@ void DlgSettingsSelection::changeEvent(QEvent *e) } #include "moc_DlgSettingsSelection.cpp" - diff --git a/src/Gui/DlgSettingsSelection.h b/src/Gui/PreferencePages/DlgSettingsSelection.h similarity index 96% rename from src/Gui/DlgSettingsSelection.h rename to src/Gui/PreferencePages/DlgSettingsSelection.h index fd56ced3e9..60c54be4c1 100644 --- a/src/Gui/DlgSettingsSelection.h +++ b/src/Gui/PreferencePages/DlgSettingsSelection.h @@ -1,62 +1,62 @@ -/*************************************************************************** - * Copyright (c) 2021 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_DIALOG_DLGSETTINGSSELECTION_H -#define GUI_DIALOG_DLGSETTINGSSELECTION_H - -#include "PropertyPage.h" -#include - -class QDoubleSpinBox; - -namespace Gui { -namespace Dialog { -class Ui_DlgSettingsSelection; - -/** - * The Ui_DlgSettingsSelection class implements a preference page to change settings - * for the selection. - * \author Werner Mayer - */ -class DlgSettingsSelection : public PreferencePage -{ - Q_OBJECT - -public: - DlgSettingsSelection(QWidget* parent = nullptr); - ~DlgSettingsSelection() override; - - void saveSettings() override; - void loadSettings() override; - -protected: - void changeEvent(QEvent *e) override; - -private: - std::unique_ptr ui; -}; - -} // namespace Dialog -} // namespace Gui - -#endif // GUI_DIALOG_DLGSETTINGSSELECTION_H +/*************************************************************************** + * Copyright (c) 2021 Werner Mayer * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_DIALOG_DLGSETTINGSSELECTION_H +#define GUI_DIALOG_DLGSETTINGSSELECTION_H + +#include +#include + +class QDoubleSpinBox; + +namespace Gui { +namespace Dialog { +class Ui_DlgSettingsSelection; + +/** + * The Ui_DlgSettingsSelection class implements a preference page to change settings + * for the selection. + * \author Werner Mayer + */ +class DlgSettingsSelection : public PreferencePage +{ + Q_OBJECT + +public: + DlgSettingsSelection(QWidget* parent = nullptr); + ~DlgSettingsSelection() override; + + void saveSettings() override; + void loadSettings() override; + +protected: + void changeEvent(QEvent *e) override; + +private: + std::unique_ptr ui; +}; + +} // namespace Dialog +} // namespace Gui + +#endif // GUI_DIALOG_DLGSETTINGSSELECTION_H diff --git a/src/Gui/DlgSettingsSelection.ui b/src/Gui/PreferencePages/DlgSettingsSelection.ui similarity index 100% rename from src/Gui/DlgSettingsSelection.ui rename to src/Gui/PreferencePages/DlgSettingsSelection.ui diff --git a/src/Gui/DlgSettingsViewColor.cpp b/src/Gui/PreferencePages/DlgSettingsViewColor.cpp similarity index 97% rename from src/Gui/DlgSettingsViewColor.cpp rename to src/Gui/PreferencePages/DlgSettingsViewColor.cpp index e00418a56b..1e36731f87 100644 --- a/src/Gui/DlgSettingsViewColor.cpp +++ b/src/Gui/PreferencePages/DlgSettingsViewColor.cpp @@ -165,4 +165,3 @@ void DlgSettingsViewColor::setGradientColorVisibility(bool val) } #include "moc_DlgSettingsViewColor.cpp" - diff --git a/src/Gui/DlgSettingsViewColor.h b/src/Gui/PreferencePages/DlgSettingsViewColor.h similarity index 96% rename from src/Gui/DlgSettingsViewColor.h rename to src/Gui/PreferencePages/DlgSettingsViewColor.h index bed4835a2c..5809270ec8 100644 --- a/src/Gui/DlgSettingsViewColor.h +++ b/src/Gui/PreferencePages/DlgSettingsViewColor.h @@ -1,70 +1,70 @@ -/*************************************************************************** - * Copyright (c) 2009 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H -#define GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H - -#include "PropertyPage.h" -#include - -namespace Gui { -namespace Dialog { -class Ui_DlgSettingsViewColor; - -/** - * The DlgSettingsViewColor class implements a preference page to change color settings - * for the Inventor viewer like background and selection. - * @author Werner Mayer - */ -class DlgSettingsViewColor : public PreferencePage -{ - Q_OBJECT - -public: - explicit DlgSettingsViewColor(QWidget* parent = nullptr); - ~DlgSettingsViewColor() override; - - void saveSettings() override; - void loadSettings() override; - -protected: - void changeEvent(QEvent *e) override; - -protected Q_SLOTS: - void onSwitchGradientColorsPressed(); - void onRadioButtonSimpleToggled(bool val); - void onRadioButtonGradientToggled(bool val); - void onRadioButtonRadialGradientToggled(bool val); - void onCheckMidColorToggled(bool val); - -private: - void setGradientColorVisibility(bool val); - -private: - std::unique_ptr ui; -}; - -} // namespace Dialog -} // namespace Gui - -#endif // GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H +/*************************************************************************** + * Copyright (c) 2009 Werner Mayer * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H +#define GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H + +#include +#include + +namespace Gui { +namespace Dialog { +class Ui_DlgSettingsViewColor; + +/** + * The DlgSettingsViewColor class implements a preference page to change color settings + * for the Inventor viewer like background and selection. + * @author Werner Mayer + */ +class DlgSettingsViewColor : public PreferencePage +{ + Q_OBJECT + +public: + explicit DlgSettingsViewColor(QWidget* parent = nullptr); + ~DlgSettingsViewColor() override; + + void saveSettings() override; + void loadSettings() override; + +protected: + void changeEvent(QEvent *e) override; + +protected Q_SLOTS: + void onSwitchGradientColorsPressed(); + void onRadioButtonSimpleToggled(bool val); + void onRadioButtonGradientToggled(bool val); + void onRadioButtonRadialGradientToggled(bool val); + void onCheckMidColorToggled(bool val); + +private: + void setGradientColorVisibility(bool val); + +private: + std::unique_ptr ui; +}; + +} // namespace Dialog +} // namespace Gui + +#endif // GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H diff --git a/src/Gui/DlgSettingsViewColor.ui b/src/Gui/PreferencePages/DlgSettingsViewColor.ui similarity index 100% rename from src/Gui/DlgSettingsViewColor.ui rename to src/Gui/PreferencePages/DlgSettingsViewColor.ui diff --git a/src/Gui/DlgSettingsWorkbenches.ui b/src/Gui/PreferencePages/DlgSettingsWorkbenches.ui similarity index 100% rename from src/Gui/DlgSettingsWorkbenches.ui rename to src/Gui/PreferencePages/DlgSettingsWorkbenches.ui diff --git a/src/Gui/DlgSettingsWorkbenchesImp.cpp b/src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.cpp similarity index 99% rename from src/Gui/DlgSettingsWorkbenchesImp.cpp rename to src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.cpp index aea9e7b60c..89fa6bb717 100644 --- a/src/Gui/DlgSettingsWorkbenchesImp.cpp +++ b/src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.cpp @@ -30,12 +30,13 @@ #include #endif +#include +#include +#include +#include + #include "DlgSettingsWorkbenchesImp.h" #include "ui_DlgSettingsWorkbenches.h" -#include "Application.h" -#include "UserSettings.h" -#include "Workbench.h" -#include "WorkbenchManager.h" using namespace Gui::Dialog; diff --git a/src/Gui/DlgSettingsWorkbenchesImp.h b/src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.h similarity index 99% rename from src/Gui/DlgSettingsWorkbenchesImp.h rename to src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.h index ce91a31034..13c3b4ba65 100644 --- a/src/Gui/DlgSettingsWorkbenchesImp.h +++ b/src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.h @@ -26,7 +26,7 @@ #ifndef GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H #define GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H -#include "PropertyPage.h" +#include #include namespace Gui::Dialog { diff --git a/src/Gui/resource.cpp b/src/Gui/resource.cpp index 88793733dd..8bf0a7eb59 100644 --- a/src/Gui/resource.cpp +++ b/src/Gui/resource.cpp @@ -30,26 +30,27 @@ // INCLUDE YOUR PREFERENCE PAGES HERE // #include "DlgPreferencesImp.h" -#include "DlgSettings3DViewImp.h" -#include "DlgSettingsNavigation.h" -#include "DlgSettingsSelection.h" -#include "DlgSettingsViewColor.h" +#include "PreferencePages/DlgSettings3DViewImp.h" +#include "PreferencePages/DlgSettingsCacheDirectory.h" +#include "PreferencePages/DlgSettingsDocumentImp.h" +#include "PreferencePages/DlgSettingsEditor.h" +#include "PreferencePages/DlgSettingsGeneral.h" +#include "PreferencePages/DlgSettingsMacroImp.h" +#include "PreferencePages/DlgSettingsNavigation.h" +#include "PreferencePages/DlgSettingsNotificationArea.h" +#include "PreferencePages/DlgSettingsPythonConsole.h" +#include "PreferencePages/DlgSettingsReportView.h" +#include "PreferencePages/DlgSettingsSelection.h" #include "DlgSettingsTheme.h" -#include "DlgSettingsGeneral.h" -#include "DlgEditorImp.h" -#include "DlgSettingsNotificationArea.h" -#include "DlgSettingsPythonConsole.h" -#include "DlgSettingsMacroImp.h" -#include "DlgSettingsDocumentImp.h" -#include "DlgSettingsReportView.h" -#include "DlgSettingsWorkbenchesImp.h" +#include "PreferencePages/DlgSettingsViewColor.h" +#include "PreferencePages/DlgSettingsWorkbenchesImp.h" + #include "DlgToolbarsImp.h" #include "DlgActionsImp.h" #include "DlgKeyboardImp.h" #include "DlgCustomizeSpaceball.h" #include "DlgCustomizeSpNavSettings.h" -#include "DlgSettingsCacheDirectory.h" #include "InputField.h" #include "QuantitySpinBox.h" #include "PrefWidgets.h" @@ -78,7 +79,7 @@ WidgetFactorySupplier::WidgetFactorySupplier() new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Workbenches") ); new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject", "Python")); new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject", "Python")); - new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject", "Python")); + new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject", "Python")); // ADD YOUR CUSTOMIZE PAGES HERE //