Move all the preference pages to PreferencePages subfolder.

This commit is contained in:
Paddle
2023-08-08 11:12:48 +02:00
committed by wwmayer
parent 7c83085491
commit ccb9d7faeb
43 changed files with 1396 additions and 1394 deletions
+1 -1
View File
@@ -48,7 +48,7 @@
#include "BitmapFactory.h" #include "BitmapFactory.h"
#include "Command.h" #include "Command.h"
#include "DlgUndoRedo.h" #include "DlgUndoRedo.h"
#include "DlgSettingsWorkbenchesImp.h" #include "PreferencePages/DlgSettingsWorkbenchesImp.h"
#include "Document.h" #include "Document.h"
#include "EditorView.h" #include "EditorView.h"
#include "FileDialog.h" #include "FileDialog.h"
+1 -1
View File
@@ -65,7 +65,7 @@
#include "CommandActionPy.h" #include "CommandActionPy.h"
#include "CommandPy.h" #include "CommandPy.h"
#include "Control.h" #include "Control.h"
#include "DlgSettingsCacheDirectory.h" #include "PreferencePages/DlgSettingsCacheDirectory.h"
#include "DocumentPy.h" #include "DocumentPy.h"
#include "DocumentRecovery.h" #include "DocumentRecovery.h"
#include "EditorView.h" #include "EditorView.h"
+56 -56
View File
@@ -297,7 +297,6 @@ SET(Gui_UIC_SRCS
DlgCreateNewPreferencePack.ui DlgCreateNewPreferencePack.ui
DlgCustomizeSpNavSettings.ui DlgCustomizeSpNavSettings.ui
DlgDisplayProperties.ui DlgDisplayProperties.ui
DlgSettingsEditor.ui
DlgInputDialog.ui DlgInputDialog.ui
DlgKeyboard.ui DlgKeyboard.ui
DlgMacroExecute.ui DlgMacroExecute.ui
@@ -312,22 +311,23 @@ SET(Gui_UIC_SRCS
DlgProjectInformation.ui DlgProjectInformation.ui
DlgProjectUtility.ui DlgProjectUtility.ui
DlgPropertyLink.ui DlgPropertyLink.ui
DlgSettingsReportView.ui
DlgRevertToBackupConfig.ui DlgRevertToBackupConfig.ui
DlgSettingsGeneral.ui PreferencePages/DlgSettings3DView.ui
DlgSettings3DView.ui PreferencePages/DlgSettingsCacheDirectory.ui
DlgSettingsCacheDirectory.ui
DlgSettingsNavigation.ui
DlgSettingsSelection.ui
DlgSettingsViewColor.ui
DlgSettingsTheme.ui
DlgSettingsColorGradient.ui DlgSettingsColorGradient.ui
DlgSettingsDocument.ui PreferencePages/DlgSettingsDocument.ui
PreferencePages/DlgSettingsEditor.ui
PreferencePages/DlgSettingsGeneral.ui
DlgSettingsImage.ui DlgSettingsImage.ui
DlgSettingsWorkbenches.ui PreferencePages/DlgSettingsMacro.ui
DlgSettingsMacro.ui PreferencePages/DlgSettingsNavigation.ui
DlgSettingsNotificationArea.ui PreferencePages/DlgSettingsNotificationArea.ui
DlgSettingsPythonConsole.ui PreferencePages/DlgSettingsPythonConsole.ui
PreferencePages/DlgSettingsReportView.ui
PreferencePages/DlgSettingsSelection.ui
DlgSettingsTheme.ui
PreferencePages/DlgSettingsViewColor.ui
PreferencePages/DlgSettingsWorkbenches.ui
DlgCheckableMessageBox.ui DlgCheckableMessageBox.ui
DlgToolbars.ui DlgToolbars.ui
DlgTreeWidget.ui DlgTreeWidget.ui
@@ -556,66 +556,66 @@ SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS})
# The settings dialog sources # The settings dialog sources
SET(Dialog_Settings_CPP_SRCS SET(Dialog_Settings_CPP_SRCS
DlgSettingsEditor.cpp
DlgOnlineHelpImp.cpp DlgOnlineHelpImp.cpp
DlgPreferencesImp.cpp DlgPreferencesImp.cpp
DlgSettingsReportView.cpp PreferencePages/DlgSettings3DViewImp.cpp
DlgSettingsGeneral.cpp PreferencePages/DlgSettingsCacheDirectory.cpp
DlgSettings3DViewImp.cpp
DlgSettingsCacheDirectory.cpp
DlgSettingsNavigation.cpp
DlgSettingsSelection.cpp
DlgSettingsViewColor.cpp
DlgSettingsTheme.cpp
DlgSettingsColorGradientImp.cpp DlgSettingsColorGradientImp.cpp
DlgSettingsDocumentImp.cpp PreferencePages/DlgSettingsDocumentImp.cpp
PreferencePages/DlgSettingsEditor.cpp
PreferencePages/DlgSettingsGeneral.cpp
DlgSettingsImageImp.cpp DlgSettingsImageImp.cpp
DlgSettingsWorkbenchesImp.cpp PreferencePages/DlgSettingsMacroImp.cpp
DlgSettingsMacroImp.cpp PreferencePages/DlgSettingsNavigation.cpp
DlgSettingsNotificationArea.cpp PreferencePages/DlgSettingsNotificationArea.cpp
DlgSettingsPythonConsole.cpp PreferencePages/DlgSettingsPythonConsole.cpp
PreferencePages/DlgSettingsReportView.cpp
PreferencePages/DlgSettingsSelection.cpp
DlgSettingsTheme.cpp
PreferencePages/DlgSettingsViewColor.cpp
PreferencePages/DlgSettingsWorkbenchesImp.cpp
) )
SET(Dialog_Settings_HPP_SRCS SET(Dialog_Settings_HPP_SRCS
DlgSettingsEditor.h
DlgSettingsGeneral.h
DlgOnlineHelpImp.h DlgOnlineHelpImp.h
DlgPreferencesImp.h DlgPreferencesImp.h
DlgSettingsReportView.h PreferencePages/DlgSettings3DViewImp.h
DlgSettings3DViewImp.h PreferencePages/DlgSettingsCacheDirectory.h
DlgSettingsCacheDirectory.h
DlgSettingsNavigation.h
DlgSettingsSelection.h
DlgSettingsViewColor.h
DlgSettingsTheme.h
DlgSettingsColorGradientImp.h DlgSettingsColorGradientImp.h
DlgSettingsDocumentImp.h PreferencePages/DlgSettingsDocumentImp.h
PreferencePages/DlgSettingsEditor.h
PreferencePages/DlgSettingsGeneral.h
DlgSettingsImageImp.h DlgSettingsImageImp.h
DlgSettingsWorkbenchesImp.h PreferencePages/DlgSettingsMacroImp.h
DlgSettingsMacroImp.h PreferencePages/DlgSettingsNavigation.h
DlgSettingsNotificationArea.h PreferencePages/DlgSettingsNotificationArea.h
DlgSettingsPythonConsole.h PreferencePages/DlgSettingsPythonConsole.h
PreferencePages/DlgSettingsReportView.h
PreferencePages/DlgSettingsSelection.h
DlgSettingsTheme.h
PreferencePages/DlgSettingsViewColor.h
PreferencePages/DlgSettingsWorkbenchesImp.h
) )
SET(Dialog_Settings_SRCS SET(Dialog_Settings_SRCS
${Dialog_Settings_CPP_SRCS} ${Dialog_Settings_CPP_SRCS}
${Dialog_Settings_HPP_SRCS} ${Dialog_Settings_HPP_SRCS}
DlgSettingsEditor.ui
DlgOnlineHelp.ui DlgOnlineHelp.ui
DlgPreferences.ui DlgPreferences.ui
DlgSettingsReportView.ui PreferencePages/DlgSettings3DView.ui
DlgSettingsGeneral.ui PreferencePages/DlgSettingsCacheDirectory.ui
DlgSettings3DView.ui
DlgSettingsCacheDirectory.ui
DlgSettingsNavigation.ui
DlgSettingsSelection.ui
DlgSettingsViewColor.ui
DlgSettingsTheme.ui
DlgSettingsColorGradient.ui DlgSettingsColorGradient.ui
DlgSettingsDocument.ui PreferencePages/DlgSettingsDocument.ui
PreferencePages/DlgSettingsEditor.ui
PreferencePages/DlgSettingsGeneral.ui
DlgSettingsImage.ui DlgSettingsImage.ui
DlgSettingsWorkbenches.ui PreferencePages/DlgSettingsMacro.ui
DlgSettingsMacro.ui PreferencePages/DlgSettingsNavigation.ui
DlgSettingsNotificationArea.ui PreferencePages/DlgSettingsNotificationArea.ui
DlgSettingsPythonConsole.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}) SOURCE_GROUP("Dialog\\Settings" FILES ${Dialog_Settings_SRCS})
@@ -1,169 +1,169 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#include "PreCompiled.h" #include "PreCompiled.h"
#ifndef _PreComp_ #ifndef _PreComp_
# include <QApplication> # include <QApplication>
# include <QMessageBox> # include <QMessageBox>
#endif #endif
#include <App/Application.h> #include <App/Application.h>
#include <Base/Parameter.h> #include <Base/Parameter.h>
#include <Base/Tools.h> #include <Base/Tools.h>
#include <Gui/View3DInventorViewer.h>
#include "DlgSettings3DViewImp.h"
#include "ui_DlgSettings3DView.h" #include "DlgSettings3DViewImp.h"
#include "View3DInventorViewer.h" #include "ui_DlgSettings3DView.h"
using namespace Gui::Dialog; using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgSettings3DViewImp */ /* TRANSLATOR Gui::Dialog::DlgSettings3DViewImp */
bool DlgSettings3DViewImp::showMsg = true; bool DlgSettings3DViewImp::showMsg = true;
/** /**
* Constructs a DlgSettings3DViewImp which is a child of 'parent', with the * Constructs a DlgSettings3DViewImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f' * name 'name' and widget flags set to 'f'
*/ */
DlgSettings3DViewImp::DlgSettings3DViewImp(QWidget* parent) DlgSettings3DViewImp::DlgSettings3DViewImp(QWidget* parent)
: PreferencePage( parent ) : PreferencePage( parent )
, ui(new Ui_DlgSettings3DView) , ui(new Ui_DlgSettings3DView)
{ {
ui->setupUi(this); ui->setupUi(this);
} }
/** /**
* Destroys the object and frees any allocated resources * Destroys the object and frees any allocated resources
*/ */
DlgSettings3DViewImp::~DlgSettings3DViewImp() DlgSettings3DViewImp::~DlgSettings3DViewImp()
{ {
// no need to delete child widgets, Qt does it all for us // no need to delete child widgets, Qt does it all for us
} }
void DlgSettings3DViewImp::saveSettings() void DlgSettings3DViewImp::saveSettings()
{ {
// must be done as very first because we create a new instance of NavigatorStyle // must be done as very first because we create a new instance of NavigatorStyle
// where we set some attributes afterwards // where we set some attributes afterwards
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View"); ("User parameter:BaseApp/Preferences/View");
int index = ui->comboAliasing->currentIndex(); int index = ui->comboAliasing->currentIndex();
hGrp->SetInt("AntiAliasing", index); hGrp->SetInt("AntiAliasing", index);
index = ui->renderCache->currentIndex(); index = ui->renderCache->currentIndex();
hGrp->SetInt("RenderCache", index); hGrp->SetInt("RenderCache", index);
ui->comboTransparentRender->onSave(); ui->comboTransparentRender->onSave();
QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex()); QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex());
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt()); hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());
ui->CheckBox_CornerCoordSystem->onSave(); ui->CheckBox_CornerCoordSystem->onSave();
ui->SpinBox_CornerCoordSystemSize->onSave(); ui->SpinBox_CornerCoordSystemSize->onSave();
ui->CheckBox_ShowAxisCross->onSave(); ui->CheckBox_ShowAxisCross->onSave();
ui->CheckBox_ShowFPS->onSave(); ui->CheckBox_ShowFPS->onSave();
ui->CheckBox_use_SW_OpenGL->onSave(); ui->CheckBox_use_SW_OpenGL->onSave();
ui->CheckBox_useVBO->onSave(); ui->CheckBox_useVBO->onSave();
ui->FloatSpinBox_EyeDistance->onSave(); ui->FloatSpinBox_EyeDistance->onSave();
ui->checkBoxBacklight->onSave(); ui->checkBoxBacklight->onSave();
ui->backlightColor->onSave(); ui->backlightColor->onSave();
ui->sliderIntensity->onSave(); ui->sliderIntensity->onSave();
ui->radioPerspective->onSave(); ui->radioPerspective->onSave();
ui->radioOrthographic->onSave(); ui->radioOrthographic->onSave();
} }
void DlgSettings3DViewImp::loadSettings() void DlgSettings3DViewImp::loadSettings()
{ {
ui->CheckBox_CornerCoordSystem->onRestore(); ui->CheckBox_CornerCoordSystem->onRestore();
ui->SpinBox_CornerCoordSystemSize->onRestore(); ui->SpinBox_CornerCoordSystemSize->onRestore();
ui->CheckBox_ShowAxisCross->onRestore(); ui->CheckBox_ShowAxisCross->onRestore();
ui->CheckBox_ShowFPS->onRestore(); ui->CheckBox_ShowFPS->onRestore();
ui->CheckBox_use_SW_OpenGL->onRestore(); ui->CheckBox_use_SW_OpenGL->onRestore();
ui->CheckBox_useVBO->onRestore(); ui->CheckBox_useVBO->onRestore();
ui->FloatSpinBox_EyeDistance->onRestore(); ui->FloatSpinBox_EyeDistance->onRestore();
ui->checkBoxBacklight->onRestore(); ui->checkBoxBacklight->onRestore();
ui->backlightColor->onRestore(); ui->backlightColor->onRestore();
ui->sliderIntensity->onRestore(); ui->sliderIntensity->onRestore();
ui->radioPerspective->onRestore(); ui->radioPerspective->onRestore();
ui->radioOrthographic->onRestore(); ui->radioOrthographic->onRestore();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View"); ("User parameter:BaseApp/Preferences/View");
int index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None)); int index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None));
index = Base::clamp(index, 0, ui->comboAliasing->count()-1); index = Base::clamp(index, 0, ui->comboAliasing->count()-1);
ui->comboAliasing->setCurrentIndex(index); ui->comboAliasing->setCurrentIndex(index);
// connect after setting current item of the combo box // connect after setting current item of the combo box
connect(ui->comboAliasing, qOverload<int>(&QComboBox::currentIndexChanged), connect(ui->comboAliasing, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgSettings3DViewImp::onAliasingChanged); this, &DlgSettings3DViewImp::onAliasingChanged);
index = hGrp->GetInt("RenderCache", 0); index = hGrp->GetInt("RenderCache", 0);
ui->renderCache->setCurrentIndex(index); ui->renderCache->setCurrentIndex(index);
ui->comboTransparentRender->onRestore(); ui->comboTransparentRender->onRestore();
int const current = hGrp->GetInt("MarkerSize", 9L); int const current = hGrp->GetInt("MarkerSize", 9L);
ui->boxMarkerSize->addItem(tr("5px"), QVariant(5)); ui->boxMarkerSize->addItem(tr("5px"), QVariant(5));
ui->boxMarkerSize->addItem(tr("7px"), QVariant(7)); ui->boxMarkerSize->addItem(tr("7px"), QVariant(7));
ui->boxMarkerSize->addItem(tr("9px"), QVariant(9)); ui->boxMarkerSize->addItem(tr("9px"), QVariant(9));
ui->boxMarkerSize->addItem(tr("11px"), QVariant(11)); ui->boxMarkerSize->addItem(tr("11px"), QVariant(11));
ui->boxMarkerSize->addItem(tr("13px"), QVariant(13)); ui->boxMarkerSize->addItem(tr("13px"), QVariant(13));
ui->boxMarkerSize->addItem(tr("15px"), QVariant(15)); ui->boxMarkerSize->addItem(tr("15px"), QVariant(15));
index = ui->boxMarkerSize->findData(QVariant(current)); index = ui->boxMarkerSize->findData(QVariant(current));
if (index < 0) index = 2; if (index < 0) index = 2;
ui->boxMarkerSize->setCurrentIndex(index); ui->boxMarkerSize->setCurrentIndex(index);
} }
/** /**
* Sets the strings of the subwidgets using the current language. * Sets the strings of the subwidgets using the current language.
*/ */
void DlgSettings3DViewImp::changeEvent(QEvent *e) void DlgSettings3DViewImp::changeEvent(QEvent *e)
{ {
if (e->type() == QEvent::LanguageChange) { if (e->type() == QEvent::LanguageChange) {
ui->comboAliasing->blockSignals(true); ui->comboAliasing->blockSignals(true);
int aliasing = ui->comboAliasing->currentIndex(); int aliasing = ui->comboAliasing->currentIndex();
ui->retranslateUi(this); ui->retranslateUi(this);
ui->comboAliasing->setCurrentIndex(aliasing); ui->comboAliasing->setCurrentIndex(aliasing);
ui->comboAliasing->blockSignals(false); ui->comboAliasing->blockSignals(false);
} }
else { else {
QWidget::changeEvent(e); QWidget::changeEvent(e);
} }
} }
void DlgSettings3DViewImp::onAliasingChanged(int index) void DlgSettings3DViewImp::onAliasingChanged(int index)
{ {
if (index < 0 || !isVisible()) if (index < 0 || !isVisible())
return; return;
// Show this message only once per application session to reduce // Show this message only once per application session to reduce
// annoyance when showing it too often. // annoyance when showing it too often.
if (showMsg) { if (showMsg) {
showMsg = false; showMsg = false;
QMessageBox::information(this, tr("Anti-aliasing"), QMessageBox::information(this, tr("Anti-aliasing"),
tr("Open a new viewer or restart %1 to apply anti-aliasing changes.").arg(qApp->applicationName())); tr("Open a new viewer or restart %1 to apply anti-aliasing changes.").arg(qApp->applicationName()));
} }
} }
#include "moc_DlgSettings3DViewImp.cpp" #include "moc_DlgSettings3DViewImp.cpp"
@@ -1,66 +1,66 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H #ifndef GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
#define GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H #define GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
class QDoubleSpinBox; class QDoubleSpinBox;
namespace Gui { namespace Gui {
namespace Dialog { namespace Dialog {
class Ui_DlgSettings3DView; class Ui_DlgSettings3DView;
/** /**
* The DlgSettings3DViewImp class implements a preference page to change settings * The DlgSettings3DViewImp class implements a preference page to change settings
* for the Inventor viewer. * for the Inventor viewer.
* \author Jürgen Riegel * \author Jürgen Riegel
*/ */
class DlgSettings3DViewImp : public PreferencePage class DlgSettings3DViewImp : public PreferencePage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DlgSettings3DViewImp(QWidget* parent = nullptr); explicit DlgSettings3DViewImp(QWidget* parent = nullptr);
~DlgSettings3DViewImp() override; ~DlgSettings3DViewImp() override;
void saveSettings() override; void saveSettings() override;
void loadSettings() override; void loadSettings() override;
private Q_SLOTS: private Q_SLOTS:
void onAliasingChanged(int); void onAliasingChanged(int);
protected: protected:
void changeEvent(QEvent *e) override; void changeEvent(QEvent *e) override;
private: private:
std::unique_ptr<Ui_DlgSettings3DView> ui; std::unique_ptr<Ui_DlgSettings3DView> ui;
static bool showMsg; static bool showMsg;
}; };
} // namespace Dialog } // namespace Dialog
} // namespace Gui } // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H #endif // GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
@@ -37,11 +37,11 @@
#include <App/Application.h> #include <App/Application.h>
#include <App/Document.h> #include <App/Document.h>
#include <Gui/DocumentRecovery.h>
#include <Gui/MainWindow.h>
#include "DlgSettingsCacheDirectory.h" #include "DlgSettingsCacheDirectory.h"
#include "ui_DlgSettingsCacheDirectory.h" #include "ui_DlgSettingsCacheDirectory.h"
#include "DocumentRecovery.h"
#include "MainWindow.h"
using namespace Gui::Dialog; using namespace Gui::Dialog;
@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSCACHEDIRECTORY_H #ifndef GUI_DIALOG_DLGSETTINGSCACHEDIRECTORY_H
#define GUI_DIALOG_DLGSETTINGSCACHEDIRECTORY_H #define GUI_DIALOG_DLGSETTINGSCACHEDIRECTORY_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
namespace Gui { namespace Gui {
@@ -1,184 +1,184 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#include "PreCompiled.h" #include "PreCompiled.h"
#include <zlib.h> #include <zlib.h>
#include <App/License.h>
#include "DlgSettingsDocumentImp.h" #include <Gui/AutoSaver.h>
#include "ui_DlgSettingsDocument.h"
#include "AutoSaver.h" #include "DlgSettingsDocumentImp.h"
#include <App/License.h> #include "ui_DlgSettingsDocument.h"
using namespace Gui::Dialog; using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgSettingsDocumentImp */ /* TRANSLATOR Gui::Dialog::DlgSettingsDocumentImp */
/** /**
* Constructs a DlgSettingsDocumentImp which is a child of 'parent', with the * Constructs a DlgSettingsDocumentImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f' * name 'name' and widget flags set to 'f'
*/ */
DlgSettingsDocumentImp::DlgSettingsDocumentImp( QWidget* parent ) DlgSettingsDocumentImp::DlgSettingsDocumentImp( QWidget* parent )
: PreferencePage( parent ) : PreferencePage( parent )
, ui(new Ui_DlgSettingsDocument) , ui(new Ui_DlgSettingsDocument)
{ {
ui->setupUi(this); ui->setupUi(this);
addLicenseTypes(); addLicenseTypes();
ui->prefSaveTransaction->hide(); ui->prefSaveTransaction->hide();
ui->prefDiscardTransaction->hide(); ui->prefDiscardTransaction->hide();
QString tip = QString::fromLatin1("<html><head/><body><p>%1</p>" QString tip = QString::fromLatin1("<html><head/><body><p>%1</p>"
"<p>%2: %Y%m%d-%H%M%S</p>" "<p>%2: %Y%m%d-%H%M%S</p>"
"<p>%3: <a href=\"http://www.cplusplus.com/reference/ctime/strftime/\">C++ strftime</a>" "<p>%3: <a href=\"http://www.cplusplus.com/reference/ctime/strftime/\">C++ strftime</a>"
"</p></body></html>").arg(tr("The format of the date to use."), tr("Default"), tr("Format")); "</p></body></html>").arg(tr("The format of the date to use."), tr("Default"), tr("Format"));
ui->prefSaveBackupDateFormat->setToolTip(tip); ui->prefSaveBackupDateFormat->setToolTip(tip);
ui->prefCountBackupFiles->setMaximum(INT_MAX); ui->prefCountBackupFiles->setMaximum(INT_MAX);
ui->prefCompression->setMinimum(Z_NO_COMPRESSION); ui->prefCompression->setMinimum(Z_NO_COMPRESSION);
ui->prefCompression->setMaximum(Z_BEST_COMPRESSION); ui->prefCompression->setMaximum(Z_BEST_COMPRESSION);
connect(ui->prefLicenseType, qOverload<int>(&QComboBox::currentIndexChanged), connect(ui->prefLicenseType, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgSettingsDocumentImp::onLicenseTypeChanged); this, &DlgSettingsDocumentImp::onLicenseTypeChanged);
} }
/** /**
* Destroys the object and frees any allocated resources * Destroys the object and frees any allocated resources
*/ */
DlgSettingsDocumentImp::~DlgSettingsDocumentImp() DlgSettingsDocumentImp::~DlgSettingsDocumentImp()
{ {
// no need to delete child widgets, Qt does it all for us // no need to delete child widgets, Qt does it all for us
} }
void DlgSettingsDocumentImp::saveSettings() void DlgSettingsDocumentImp::saveSettings()
{ {
ui->prefCheckNewDoc->onSave(); ui->prefCheckNewDoc->onSave();
ui->prefCompression->onSave(); ui->prefCompression->onSave();
ui->prefUndoRedo->onSave(); ui->prefUndoRedo->onSave();
ui->prefUndoRedoSize->onSave(); ui->prefUndoRedoSize->onSave();
ui->prefSaveTransaction->onSave(); ui->prefSaveTransaction->onSave();
ui->prefDiscardTransaction->onSave(); ui->prefDiscardTransaction->onSave();
ui->prefSaveThumbnail->onSave(); ui->prefSaveThumbnail->onSave();
ui->prefThumbnailSize->onSave(); ui->prefThumbnailSize->onSave();
ui->prefAddLogo->onSave(); ui->prefAddLogo->onSave();
ui->prefSaveBackupFiles->onSave(); ui->prefSaveBackupFiles->onSave();
ui->prefCountBackupFiles->onSave(); ui->prefCountBackupFiles->onSave();
ui->prefSaveBackupExtension->onSave(); ui->prefSaveBackupExtension->onSave();
ui->prefSaveBackupDateFormat->onSave(); ui->prefSaveBackupDateFormat->onSave();
ui->prefDuplicateLabel->onSave(); ui->prefDuplicateLabel->onSave();
ui->prefPartialLoading->onSave(); ui->prefPartialLoading->onSave();
ui->prefLicenseType->onSave(); ui->prefLicenseType->onSave();
ui->prefLicenseUrl->onSave(); ui->prefLicenseUrl->onSave();
ui->prefAuthor->onSave(); ui->prefAuthor->onSave();
ui->prefSetAuthorOnSave->onSave(); ui->prefSetAuthorOnSave->onSave();
ui->prefCompany->onSave(); ui->prefCompany->onSave();
ui->prefRecovery->onSave(); ui->prefRecovery->onSave();
ui->prefAutoSaveEnabled->onSave(); ui->prefAutoSaveEnabled->onSave();
ui->prefAutoSaveTimeout->onSave(); ui->prefAutoSaveTimeout->onSave();
ui->prefCanAbortRecompute->onSave(); ui->prefCanAbortRecompute->onSave();
int timeout = ui->prefAutoSaveTimeout->value(); int timeout = ui->prefAutoSaveTimeout->value();
if (!ui->prefAutoSaveEnabled->isChecked()) if (!ui->prefAutoSaveEnabled->isChecked())
timeout = 0; timeout = 0;
AutoSaver::instance()->setTimeout(timeout * 60000); AutoSaver::instance()->setTimeout(timeout * 60000);
} }
void DlgSettingsDocumentImp::loadSettings() void DlgSettingsDocumentImp::loadSettings()
{ {
ui->prefCheckNewDoc->onRestore(); ui->prefCheckNewDoc->onRestore();
ui->prefCompression->onRestore(); ui->prefCompression->onRestore();
ui->prefUndoRedo->onRestore(); ui->prefUndoRedo->onRestore();
ui->prefUndoRedoSize->onRestore(); ui->prefUndoRedoSize->onRestore();
ui->prefSaveTransaction->onRestore(); ui->prefSaveTransaction->onRestore();
ui->prefDiscardTransaction->onRestore(); ui->prefDiscardTransaction->onRestore();
ui->prefSaveThumbnail->onRestore(); ui->prefSaveThumbnail->onRestore();
ui->prefThumbnailSize->onRestore(); ui->prefThumbnailSize->onRestore();
ui->prefAddLogo->onRestore(); ui->prefAddLogo->onRestore();
ui->prefSaveBackupFiles->onRestore(); ui->prefSaveBackupFiles->onRestore();
ui->prefCountBackupFiles->onRestore(); ui->prefCountBackupFiles->onRestore();
ui->prefSaveBackupExtension->onRestore(); ui->prefSaveBackupExtension->onRestore();
ui->prefSaveBackupDateFormat->onRestore(); ui->prefSaveBackupDateFormat->onRestore();
ui->prefDuplicateLabel->onRestore(); ui->prefDuplicateLabel->onRestore();
ui->prefPartialLoading->onRestore(); ui->prefPartialLoading->onRestore();
ui->prefLicenseType->onRestore(); ui->prefLicenseType->onRestore();
ui->prefLicenseUrl->onRestore(); ui->prefLicenseUrl->onRestore();
ui->prefAuthor->onRestore(); ui->prefAuthor->onRestore();
ui->prefSetAuthorOnSave->onRestore(); ui->prefSetAuthorOnSave->onRestore();
ui->prefCompany->onRestore(); ui->prefCompany->onRestore();
ui->prefRecovery->onRestore(); ui->prefRecovery->onRestore();
ui->prefAutoSaveEnabled->onRestore(); ui->prefAutoSaveEnabled->onRestore();
ui->prefAutoSaveTimeout->onRestore(); ui->prefAutoSaveTimeout->onRestore();
ui->prefCanAbortRecompute->onRestore(); ui->prefCanAbortRecompute->onRestore();
} }
/** /**
* Sets the strings of the subwidgets using the current language. * Sets the strings of the subwidgets using the current language.
*/ */
void DlgSettingsDocumentImp::changeEvent(QEvent *e) void DlgSettingsDocumentImp::changeEvent(QEvent *e)
{ {
if (e->type() == QEvent::LanguageChange) { if (e->type() == QEvent::LanguageChange) {
ui->retranslateUi(this); ui->retranslateUi(this);
int index = ui->prefLicenseType->currentIndex(); int index = ui->prefLicenseType->currentIndex();
addLicenseTypes(); addLicenseTypes();
ui->prefLicenseType->setCurrentIndex(index); ui->prefLicenseType->setCurrentIndex(index);
} }
else { else {
QWidget::changeEvent(e); QWidget::changeEvent(e);
} }
} }
void DlgSettingsDocumentImp::addLicenseTypes() void DlgSettingsDocumentImp::addLicenseTypes()
{ {
auto add = [&](const char* what) { auto add = [&](const char* what) {
ui->prefLicenseType->addItem( ui->prefLicenseType->addItem(
QApplication::translate("Gui::Dialog::DlgSettingsDocument", what)); QApplication::translate("Gui::Dialog::DlgSettingsDocument", what));
}; };
ui->prefLicenseType->clear(); ui->prefLicenseType->clear();
for (const auto& licenseItem : App::licenseItems) { for (const auto& licenseItem : App::licenseItems) {
add(licenseItem.at(App::posnOfFullName)); add(licenseItem.at(App::posnOfFullName));
} }
add("Other"); add("Other");
} }
/** /**
* Fix Url according to changed type * Fix Url according to changed type
*/ */
void DlgSettingsDocumentImp::onLicenseTypeChanged(int index) void DlgSettingsDocumentImp::onLicenseTypeChanged(int index)
{ {
if (index >= 0 && index < App::countOfLicenses) { if (index >= 0 && index < App::countOfLicenses) {
// existing license // existing license
const char* url {App::licenseItems.at(index).at(App::posnOfUrl)}; const char* url {App::licenseItems.at(index).at(App::posnOfUrl)};
ui->prefLicenseUrl->setText(QString::fromLatin1(url)); ui->prefLicenseUrl->setText(QString::fromLatin1(url));
ui->prefLicenseUrl->setReadOnly(true); ui->prefLicenseUrl->setReadOnly(true);
} }
else { else {
// Other // Other
ui->prefLicenseUrl->clear(); ui->prefLicenseUrl->clear();
ui->prefLicenseUrl->setReadOnly(false); ui->prefLicenseUrl->setReadOnly(false);
} }
} }
#include "moc_DlgSettingsDocumentImp.cpp" #include "moc_DlgSettingsDocumentImp.cpp"
@@ -1,64 +1,64 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H #ifndef GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
#define GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H #define GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
namespace Gui { namespace Gui {
namespace Dialog { namespace Dialog {
class Ui_DlgSettingsDocument; class Ui_DlgSettingsDocument;
/** /**
* The DlgSettingsDocumentImp class implements a preference page to change settings * The DlgSettingsDocumentImp class implements a preference page to change settings
* for the document. * for the document.
* \author Jürgen Riegel * \author Jürgen Riegel
*/ */
class DlgSettingsDocumentImp : public PreferencePage class DlgSettingsDocumentImp : public PreferencePage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DlgSettingsDocumentImp( QWidget* parent = nullptr ); explicit DlgSettingsDocumentImp( QWidget* parent = nullptr );
~DlgSettingsDocumentImp() override; ~DlgSettingsDocumentImp() override;
void saveSettings() override; void saveSettings() override;
void loadSettings() override; void loadSettings() override;
protected Q_SLOTS: protected Q_SLOTS:
void onLicenseTypeChanged(int index); void onLicenseTypeChanged(int index);
protected: protected:
void changeEvent(QEvent *e) override; void changeEvent(QEvent *e) override;
void addLicenseTypes(); void addLicenseTypes();
private: private:
std::unique_ptr<Ui_DlgSettingsDocument> ui; std::unique_ptr<Ui_DlgSettingsDocument> ui;
}; };
} // namespace Dialog } // namespace Dialog
} // namespace Gui } // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H #endif // GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
@@ -26,11 +26,12 @@
# include <QFontDatabase> # include <QFontDatabase>
#endif #endif
#include <App/Color.h>
#include <Gui/PythonEditor.h>
#include <Gui/Tools.h>
#include "DlgSettingsEditor.h" #include "DlgSettingsEditor.h"
#include "ui_DlgSettingsEditor.h" #include "ui_DlgSettingsEditor.h"
#include "PythonEditor.h"
#include "Tools.h"
#include <App/Color.h>
using namespace Gui; 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' * name 'name' and widget flags set to 'f'
* *
* The dialog will by default be modeless, unless you set 'modal' to * The dialog will by default be modeless, unless you set 'modal' to
* true to construct a modal dialog. * true to construct a modal dialog.
*/ */
DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent ) DlgSettingsEditor::DlgSettingsEditor( QWidget* parent )
: PreferencePage( parent ) : PreferencePage( parent )
, ui(new Ui_DlgSettingsEditor) , ui(new Ui_DlgSettingsEditor)
{ {
@@ -171,29 +172,29 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
} }
/** Destroys the object and frees any allocated resources */ /** Destroys the object and frees any allocated resources */
DlgSettingsEditorImp::~DlgSettingsEditorImp() DlgSettingsEditor::~DlgSettingsEditor()
{ {
// no need to delete child widgets, Qt does it all for us // no need to delete child widgets, Qt does it all for us
delete pythonSyntax; delete pythonSyntax;
delete d; delete d;
} }
void DlgSettingsEditorImp::setupConnections() void DlgSettingsEditor::setupConnections()
{ {
connect(ui->displayItems, &QTreeWidget::currentItemChanged, connect(ui->displayItems, &QTreeWidget::currentItemChanged,
this, &DlgSettingsEditorImp::onDisplayItemsCurrentItemChanged); this, &DlgSettingsEditor::onDisplayItemsCurrentItemChanged);
connect(ui->colorButton, &ColorButton::changed, connect(ui->colorButton, &ColorButton::changed,
this, &DlgSettingsEditorImp::onColorButtonChanged); this, &DlgSettingsEditor::onColorButtonChanged);
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
connect(ui->fontFamily, qOverload<const QString&>(&QComboBox::activated), connect(ui->fontFamily, qOverload<const QString&>(&QComboBox::activated),
this, &DlgSettingsEditorImp::onFontFamilyActivated); this, &DlgSettingsEditor::onFontFamilyActivated);
connect(ui->fontSize, qOverload<const QString&>(&PrefSpinBox::valueChanged), connect(ui->fontSize, qOverload<const QString&>(&PrefSpinBox::valueChanged),
this, &DlgSettingsEditorImp::onFontSizeValueChanged); this, &DlgSettingsEditor::onFontSizeValueChanged);
#else #else
connect(ui->fontFamily, &QComboBox::textActivated, connect(ui->fontFamily, &QComboBox::textActivated,
this, &DlgSettingsEditorImp::onFontFamilyActivated); this, &DlgSettingsEditor::onFontFamilyActivated);
connect(ui->fontSize, &PrefSpinBox::textChanged, connect(ui->fontSize, &PrefSpinBox::textChanged,
this, &DlgSettingsEditorImp::onFontSizeValueChanged); this, &DlgSettingsEditor::onFontSizeValueChanged);
#endif #endif
} }
@@ -201,7 +202,7 @@ void DlgSettingsEditorImp::setupConnections()
* settings ColorMap and assigns it to the color button * settings ColorMap and assigns it to the color button
* @see Gui::ColorButton * @see Gui::ColorButton
*/ */
void DlgSettingsEditorImp::onDisplayItemsCurrentItemChanged(QTreeWidgetItem *item) void DlgSettingsEditor::onDisplayItemsCurrentItemChanged(QTreeWidgetItem *item)
{ {
int index = ui->displayItems->indexOfTopLevelItem(item); int index = ui->displayItems->indexOfTopLevelItem(item);
unsigned int col = d->colormap[index].second; 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 */ /** Updates the color map if a color was changed */
void DlgSettingsEditorImp::onColorButtonChanged() void DlgSettingsEditor::onColorButtonChanged()
{ {
QColor col = ui->colorButton->color(); QColor col = ui->colorButton->color();
unsigned int lcol = App::Color::asPackedRGB<QColor>(col); unsigned int lcol = App::Color::asPackedRGB<QColor>(col);
@@ -219,7 +220,7 @@ void DlgSettingsEditorImp::onColorButtonChanged()
pythonSyntax->setColor( d->colormap[index].first, col ); pythonSyntax->setColor( d->colormap[index].first, col );
} }
void DlgSettingsEditorImp::setEditorTabWidth(int tabWidth) void DlgSettingsEditor::setEditorTabWidth(int tabWidth)
{ {
QFontMetrics metric(font()); QFontMetrics metric(font());
int fontSize = QtTools::horizontalAdvance(metric, QLatin1Char('0')); int fontSize = QtTools::horizontalAdvance(metric, QLatin1Char('0'));
@@ -230,7 +231,7 @@ void DlgSettingsEditorImp::setEditorTabWidth(int tabWidth)
#endif #endif
} }
void DlgSettingsEditorImp::saveSettings() void DlgSettingsEditor::saveSettings()
{ {
ui->EnableLineNumber->onSave(); ui->EnableLineNumber->onSave();
ui->EnableBlockCursor->onSave(); ui->EnableBlockCursor->onSave();
@@ -253,7 +254,7 @@ void DlgSettingsEditorImp::saveSettings()
setEditorTabWidth(ui->tabSize->value()); setEditorTabWidth(ui->tabSize->value());
} }
void DlgSettingsEditorImp::loadSettings() void DlgSettingsEditor::loadSettings()
{ {
ui->EnableLineNumber->onRestore(); ui->EnableLineNumber->onRestore();
ui->EnableBlockCursor->onRestore(); ui->EnableBlockCursor->onRestore();
@@ -325,7 +326,7 @@ void DlgSettingsEditorImp::loadSettings()
/** /**
* Sets the strings of the subwidgets using the current language. * 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) { if (e->type() == QEvent::LanguageChange) {
int index = 0; 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(); int fontSize = ui->fontSize->value();
QFont ft(fontFamily, fontSize); QFont ft(fontFamily, fontSize);
ui->textEdit1->setFont(ft); ui->textEdit1->setFont(ft);
} }
void DlgSettingsEditorImp::onFontSizeValueChanged(const QString&) void DlgSettingsEditor::onFontSizeValueChanged(const QString&)
{ {
onFontFamilyActivated(ui->fontFamily->currentText()); onFontFamilyActivated(ui->fontFamily->currentText());
} }
#include "moc_DlgEditorImp.cpp" #include "moc_DlgSettingsEditor.cpp"
@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSEDITOR_H #ifndef GUI_DIALOG_DLGSETTINGSEDITOR_H
#define GUI_DIALOG_DLGSETTINGSEDITOR_H #define GUI_DIALOG_DLGSETTINGSEDITOR_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
class QTreeWidgetItem; class QTreeWidgetItem;
@@ -40,13 +40,13 @@ class Ui_DlgSettingsEditor;
* @author Werner Mayer * @author Werner Mayer
*/ */
struct DlgSettingsEditorP; struct DlgSettingsEditorP;
class DlgSettingsEditorImp : public PreferencePage class DlgSettingsEditor : public PreferencePage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DlgSettingsEditorImp( QWidget* parent = nullptr ); explicit DlgSettingsEditor( QWidget* parent = nullptr );
~DlgSettingsEditorImp() override; ~DlgSettingsEditor() override;
public: public:
void saveSettings() override; void saveSettings() override;
@@ -68,8 +68,8 @@ private:
DlgSettingsEditorP* d; DlgSettingsEditorP* d;
Gui::PythonSyntaxHighlighter* pythonSyntax; Gui::PythonSyntaxHighlighter* pythonSyntax;
DlgSettingsEditorImp( const DlgSettingsEditorImp & ); DlgSettingsEditor( const DlgSettingsEditor & );
DlgSettingsEditorImp& operator=( const DlgSettingsEditorImp & ); DlgSettingsEditor& operator=( const DlgSettingsEditor & );
}; };
} // namespace Dialog } // namespace Dialog
@@ -38,17 +38,18 @@
#include <Base/Parameter.h> #include <Base/Parameter.h>
#include <Base/UnitsApi.h> #include <Base/UnitsApi.h>
#include <Gui/Action.h>
#include <Gui/Application.h>
#include <Gui/DlgCreateNewPreferencePackImp.h>
#include <Gui/DlgPreferencesImp.h>
#include <Gui/DlgPreferencePackManagementImp.h>
#include <Gui/DlgRevertToBackupConfigImp.h>
#include <Gui/MainWindow.h>
#include <Gui/PreferencePackManager.h>
#include <Gui/Language/Translator.h>
#include "DlgSettingsGeneral.h" #include "DlgSettingsGeneral.h"
#include "ui_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; using namespace Gui::Dialog;
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
@@ -75,7 +76,7 @@ DlgSettingsGeneral::DlgSettingsGeneral( QWidget* parent )
connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::onImportConfigClicked); connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::onImportConfigClicked);
connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgSettingsGeneral::saveAsNewPreferencePack); connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgSettingsGeneral::saveAsNewPreferencePack);
connect(ui->themesCombobox, qOverload<int>(&QComboBox::activated), this, &DlgGeneralImp::onThemeChanged); connect(ui->themesCombobox, qOverload<int>(&QComboBox::activated), this, &DlgSettingsGeneral::onThemeChanged);
ui->ManagePreferencePacks->setToolTip(tr("Manage preference packs")); ui->ManagePreferencePacks->setToolTip(tr("Manage preference packs"));
connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgSettingsGeneral::onManagePreferencePacksClicked); connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgSettingsGeneral::onManagePreferencePacksClicked);
@@ -352,7 +353,7 @@ void DlgSettingsGeneral::loadSettings()
loadThemes(); loadThemes();
} }
void DlgGeneralImp::saveThemes() void DlgSettingsGeneral::saveThemes()
{ {
// First we save the name of the theme // First we save the name of the theme
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow"); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow");
@@ -378,7 +379,7 @@ void DlgGeneralImp::saveThemes()
Application::Instance->setStyleSheet(sheet, tiledBackground); Application::Instance->setStyleSheet(sheet, tiledBackground);
} }
void DlgGeneralImp::loadThemes() void DlgSettingsGeneral::loadThemes()
{ {
ui->themesCombobox->clear(); 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); Q_UNUSED(index);
themeChanged = true; themeChanged = true;
} }
@@ -25,8 +25,8 @@
#ifndef GUI_DIALOG_DLGSETTINGSGENERAL_H #ifndef GUI_DIALOG_DLGSETTINGSGENERAL_H
#define GUI_DIALOG_DLGSETTINGSGENERAL_H #define GUI_DIALOG_DLGSETTINGSGENERAL_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
#include <string> #include <string>
@@ -91,4 +91,4 @@ private:
} // namespace Dialog } // namespace Dialog
} // namespace Gui } // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSGENERAL_H #endif // GUI_DIALOG_DLGSETTINGSGENERAL_H
@@ -1,119 +1,120 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#include "PreCompiled.h" #include "PreCompiled.h"
#include "DlgSettingsMacroImp.h" #include <Gui/Action.h>
#include "ui_DlgSettingsMacro.h" #include <Gui/Application.h>
#include "Action.h" #include <Gui/MainWindow.h>
#include "Application.h"
#include "MainWindow.h" #include "DlgSettingsMacroImp.h"
#include "ui_DlgSettingsMacro.h"
using namespace Gui::Dialog;
using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgSettingsMacroImp */
/* TRANSLATOR Gui::Dialog::DlgSettingsMacroImp */
/**
* Constructs a DlgSettingsMacroImp which is a child of 'parent', with the /**
* name 'name' and widget flags set to 'f' * 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 ) DlgSettingsMacroImp::DlgSettingsMacroImp( QWidget* parent )
, ui(new Ui_DlgSettingsMacro) : PreferencePage( parent )
{ , ui(new Ui_DlgSettingsMacro)
ui->setupUi(this); {
ui->setupUi(this);
// Was never implemented, so hide it
ui->FileLogCheckBox->hide(); // Was never implemented, so hide it
ui->MacroPath_2->hide(); ui->FileLogCheckBox->hide();
ui->MacroPath_2->hide();
if (ui->MacroPath->fileName().isEmpty()) {
QDir d(QString::fromUtf8(App::GetApplication().getUserMacroDir().c_str())); if (ui->MacroPath->fileName().isEmpty()) {
ui->MacroPath->setFileName(d.path()); QDir d(QString::fromUtf8(App::GetApplication().getUserMacroDir().c_str()));
} ui->MacroPath->setFileName(d.path());
} }
}
/**
* Destroys the object and frees any allocated resources /**
*/ * Destroys the object and frees any allocated resources
DlgSettingsMacroImp::~DlgSettingsMacroImp() */
{ DlgSettingsMacroImp::~DlgSettingsMacroImp()
// no need to delete child widgets, Qt does it all for us {
} // 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 /** Sets the size of the recent macros list from the user parameters.
* @see StdCmdRecentMacros * @see RecentMacrosAction
*/ * @see StdCmdRecentMacros
void DlgSettingsMacroImp::setRecentMacroSize() */
{ void DlgSettingsMacroImp::setRecentMacroSize()
auto recent = getMainWindow()->findChild<RecentMacrosAction *>(QLatin1String("recentMacros")); {
if (recent) { auto recent = getMainWindow()->findChild<RecentMacrosAction *>(QLatin1String("recentMacros"));
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); if (recent) {
recent->resizeList(hGrp->GetInt("RecentMacros", 4)); ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
} recent->resizeList(hGrp->GetInt("RecentMacros", 4));
} }
}
void DlgSettingsMacroImp::saveSettings()
{ void DlgSettingsMacroImp::saveSettings()
ui->PrefCheckBox_LocalEnv->onSave(); {
ui->MacroPath->onSave(); ui->PrefCheckBox_LocalEnv->onSave();
ui->PrefCheckBox_RecordGui->onSave(); ui->MacroPath->onSave();
ui->PrefCheckBox_GuiAsComment->onSave(); ui->PrefCheckBox_RecordGui->onSave();
ui->PConsoleCheckBox->onSave(); ui->PrefCheckBox_GuiAsComment->onSave();
ui->FileLogCheckBox->onSave(); ui->PConsoleCheckBox->onSave();
ui->MacroPath_2->onSave(); ui->FileLogCheckBox->onSave();
ui->RecentMacros->onSave(); ui->MacroPath_2->onSave();
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); ui->RecentMacros->onSave();
hGrp->SetASCII("ShortcutModifiers", qPrintable(ui->ShortcutModifiers->text())); ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
ui->ShortcutCount->onSave(); hGrp->SetASCII("ShortcutModifiers", qPrintable(ui->ShortcutModifiers->text()));
setRecentMacroSize(); ui->ShortcutCount->onSave();
} setRecentMacroSize();
}
void DlgSettingsMacroImp::loadSettings()
{ void DlgSettingsMacroImp::loadSettings()
ui->PrefCheckBox_LocalEnv->onRestore(); {
ui->MacroPath->onRestore(); ui->PrefCheckBox_LocalEnv->onRestore();
ui->PrefCheckBox_RecordGui->onRestore(); ui->MacroPath->onRestore();
ui->PrefCheckBox_GuiAsComment->onRestore(); ui->PrefCheckBox_RecordGui->onRestore();
ui->PConsoleCheckBox->onRestore(); ui->PrefCheckBox_GuiAsComment->onRestore();
ui->FileLogCheckBox->onRestore(); ui->PConsoleCheckBox->onRestore();
ui->MacroPath_2->onRestore(); ui->FileLogCheckBox->onRestore();
ui->RecentMacros->onRestore(); ui->MacroPath_2->onRestore();
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros"); ui->RecentMacros->onRestore();
ui->ShortcutModifiers->setText(QString::fromStdString(hGrp->GetASCII("ShortcutModifiers", "Ctrl+Shift+"))); ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
ui->ShortcutCount->onRestore(); ui->ShortcutModifiers->setText(QString::fromStdString(hGrp->GetASCII("ShortcutModifiers", "Ctrl+Shift+")));
} ui->ShortcutCount->onRestore();
}
/**
* Sets the strings of the subwidgets using the current language. /**
*/ * Sets the strings of the subwidgets using the current language.
void DlgSettingsMacroImp::changeEvent(QEvent *e) */
{ void DlgSettingsMacroImp::changeEvent(QEvent *e)
if (e->type() == QEvent::LanguageChange) { {
ui->retranslateUi(this); if (e->type() == QEvent::LanguageChange) {
} ui->retranslateUi(this);
else { }
QWidget::changeEvent(e); else {
} QWidget::changeEvent(e);
} }
}
#include "moc_DlgSettingsMacroImp.cpp"
#include "moc_DlgSettingsMacroImp.cpp"
@@ -1,61 +1,61 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSMACROIMP_H #ifndef GUI_DIALOG_DLGSETTINGSMACROIMP_H
#define GUI_DIALOG_DLGSETTINGSMACROIMP_H #define GUI_DIALOG_DLGSETTINGSMACROIMP_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
namespace Gui { namespace Gui {
namespace Dialog { namespace Dialog {
class Ui_DlgSettingsMacro; class Ui_DlgSettingsMacro;
/** /**
* The DlgSettingsMacroImp class implements a preference page to change settings * The DlgSettingsMacroImp class implements a preference page to change settings
* for macro stuff. * for macro stuff.
* \author Jürgen Riegel * \author Jürgen Riegel
*/ */
class DlgSettingsMacroImp : public PreferencePage class DlgSettingsMacroImp : public PreferencePage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DlgSettingsMacroImp( QWidget* parent = nullptr ); explicit DlgSettingsMacroImp( QWidget* parent = nullptr );
~DlgSettingsMacroImp() override; ~DlgSettingsMacroImp() override;
void saveSettings() override; void saveSettings() override;
void loadSettings() override; void loadSettings() override;
protected: protected:
void changeEvent(QEvent *e) override; void changeEvent(QEvent *e) override;
private: private:
std::unique_ptr<Ui_DlgSettingsMacro> ui; std::unique_ptr<Ui_DlgSettingsMacro> ui;
void setRecentMacroSize(); void setRecentMacroSize();
}; };
} // namespace Dialog } // namespace Dialog
} // namespace Gui } // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSMACROIMP_H #endif // GUI_DIALOG_DLGSETTINGSMACROIMP_H
@@ -1,379 +1,378 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#include "PreCompiled.h" #include "PreCompiled.h"
#ifndef _PreComp_ #ifndef _PreComp_
# include <QApplication> # include <QApplication>
# include <QDoubleSpinBox> # include <QDoubleSpinBox>
# include <QGridLayout> # include <QGridLayout>
# include <memory> # include <memory>
#endif #endif
#include <App/Application.h> #include <App/Application.h>
#include <Base/Parameter.h> #include <Base/Parameter.h>
#include <Base/Tools.h> #include <Base/Tools.h>
#include <Gui/MainWindow.h>
#include "DlgSettingsNavigation.h" #include <Gui/View3DSettings.h>
#include "ui_DlgSettingsNavigation.h" #include <Gui/NavigationStyle.h>
#include "MainWindow.h" #include <Gui/View3DInventor.h>
#include "View3DSettings.h" #include <Gui/View3DInventorViewer.h>
#include "NavigationStyle.h"
#include "View3DInventor.h" #include "DlgSettingsNavigation.h"
#include "View3DInventorViewer.h" #include "ui_DlgSettingsNavigation.h"
#include "ui_MouseButtons.h"
#include "../ui_MouseButtons.h"
using namespace Gui::Dialog; using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgSettingsNavigation */ /* TRANSLATOR Gui::Dialog::DlgSettingsNavigation */
/** /**
* Constructs a DlgSettingsNavigation which is a child of 'parent', with the * Constructs a DlgSettingsNavigation which is a child of 'parent', with the
* name 'name' and widget flags set to 'f' * name 'name' and widget flags set to 'f'
*/ */
DlgSettingsNavigation::DlgSettingsNavigation(QWidget* parent) DlgSettingsNavigation::DlgSettingsNavigation(QWidget* parent)
: PreferencePage( parent ) : PreferencePage( parent )
, ui(new Ui_DlgSettingsNavigation) , ui(new Ui_DlgSettingsNavigation)
, q0(0), q1(0), q2(0), q3(1) , q0(0), q1(0), q2(0), q3(1)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->naviCubeBaseColor->setAllowTransparency(true); ui->naviCubeBaseColor->setAllowTransparency(true);
retranslate(); retranslate();
} }
/** /**
* Destroys the object and frees any allocated resources * Destroys the object and frees any allocated resources
*/ */
DlgSettingsNavigation::~DlgSettingsNavigation() DlgSettingsNavigation::~DlgSettingsNavigation()
{ {
} }
void DlgSettingsNavigation::saveSettings() void DlgSettingsNavigation::saveSettings()
{ {
// must be done as very first because we create a new instance of NavigatorStyle // must be done as very first because we create a new instance of NavigatorStyle
// where we set some attributes afterwards // where we set some attributes afterwards
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View"); ("User parameter:BaseApp/Preferences/View");
QVariant data = ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), QVariant data = ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(),
Qt::UserRole); Qt::UserRole);
hGrp->SetASCII("NavigationStyle", (const char*)data.toByteArray()); hGrp->SetASCII("NavigationStyle", (const char*)data.toByteArray());
int index = ui->comboOrbitStyle->currentIndex(); int index = ui->comboOrbitStyle->currentIndex();
hGrp->SetInt("OrbitStyle", index); hGrp->SetInt("OrbitStyle", index);
index = ui->comboRotationMode->currentIndex(); index = ui->comboRotationMode->currentIndex();
hGrp->SetInt("RotationMode", index); hGrp->SetInt("RotationMode", index);
ui->checkBoxZoomAtCursor->onSave(); ui->checkBoxZoomAtCursor->onSave();
ui->checkBoxInvertZoom->onSave(); ui->checkBoxInvertZoom->onSave();
ui->checkBoxDisableTilt->onSave(); ui->checkBoxDisableTilt->onSave();
ui->checkBoxShowRotationCenter->onSave(); ui->checkBoxShowRotationCenter->onSave();
ui->spinBoxZoomStep->onSave(); ui->spinBoxZoomStep->onSave();
ui->checkBoxUseAutoRotation->onSave(); ui->checkBoxUseAutoRotation->onSave();
ui->qspinNewDocScale->onSave(); ui->qspinNewDocScale->onSave();
ui->prefStepByTurn->onSave(); ui->prefStepByTurn->onSave();
ui->naviCubeCorner->onSave(); ui->naviCubeCorner->onSave();
ui->naviCubeToNearest->onSave(); ui->naviCubeToNearest->onSave();
ui->prefCubeSize->onSave(); ui->prefCubeSize->onSave();
ui->naviCubeBaseColor->onSave(); ui->naviCubeBaseColor->onSave();
bool showNaviCube = ui->groupBoxNaviCube->isChecked(); bool showNaviCube = ui->groupBoxNaviCube->isChecked();
hGrp->SetBool("ShowNaviCube", showNaviCube); hGrp->SetBool("ShowNaviCube", showNaviCube);
QVariant camera = ui->comboNewDocView->itemData(ui->comboNewDocView->currentIndex(), QVariant camera = ui->comboNewDocView->itemData(ui->comboNewDocView->currentIndex(),
Qt::UserRole); Qt::UserRole);
hGrp->SetASCII("NewDocumentCameraOrientation", (const char*)camera.toByteArray()); hGrp->SetASCII("NewDocumentCameraOrientation", (const char*)camera.toByteArray());
if (camera == QByteArray("Custom")) { if (camera == QByteArray("Custom")) {
ParameterGrp::handle hCustom = hGrp->GetGroup("Custom"); ParameterGrp::handle hCustom = hGrp->GetGroup("Custom");
hCustom->SetFloat("Q0", q0); hCustom->SetFloat("Q0", q0);
hCustom->SetFloat("Q1", q1); hCustom->SetFloat("Q1", q1);
hCustom->SetFloat("Q2", q2); hCustom->SetFloat("Q2", q2);
hCustom->SetFloat("Q3", q3); hCustom->SetFloat("Q3", q3);
} }
hGrp = App::GetApplication().GetParameterGroupByPath( hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/NaviCube"); "User parameter:BaseApp/Preferences/NaviCube");
if (ui->naviCubeFontName->currentIndex()) { if (ui->naviCubeFontName->currentIndex()) {
hGrp->SetASCII("FontString", ui->naviCubeFontName->currentText().toLatin1()); hGrp->SetASCII("FontString", ui->naviCubeFontName->currentText().toLatin1());
} else { } else {
hGrp->RemoveASCII("FontString"); hGrp->RemoveASCII("FontString");
} }
} }
void DlgSettingsNavigation::loadSettings() void DlgSettingsNavigation::loadSettings()
{ {
ui->checkBoxZoomAtCursor->onRestore(); ui->checkBoxZoomAtCursor->onRestore();
ui->checkBoxInvertZoom->onRestore(); ui->checkBoxInvertZoom->onRestore();
ui->checkBoxDisableTilt->onRestore(); ui->checkBoxDisableTilt->onRestore();
ui->checkBoxShowRotationCenter->onRestore(); ui->checkBoxShowRotationCenter->onRestore();
ui->spinBoxZoomStep->onRestore(); ui->spinBoxZoomStep->onRestore();
ui->checkBoxUseAutoRotation->onRestore(); ui->checkBoxUseAutoRotation->onRestore();
ui->qspinNewDocScale->onRestore(); ui->qspinNewDocScale->onRestore();
ui->prefStepByTurn->onRestore(); ui->prefStepByTurn->onRestore();
ui->naviCubeCorner->onRestore(); ui->naviCubeCorner->onRestore();
ui->naviCubeToNearest->onRestore(); ui->naviCubeToNearest->onRestore();
ui->prefCubeSize->onRestore(); ui->prefCubeSize->onRestore();
ui->naviCubeBaseColor->onRestore(); ui->naviCubeBaseColor->onRestore();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View"); ("User parameter:BaseApp/Preferences/View");
std::string model = hGrp->GetASCII("NavigationStyle", CADNavigationStyle::getClassTypeId().getName()); std::string model = hGrp->GetASCII("NavigationStyle", CADNavigationStyle::getClassTypeId().getName());
int index = ui->comboNavigationStyle->findData(QByteArray(model.c_str())); int index = ui->comboNavigationStyle->findData(QByteArray(model.c_str()));
if (index > -1) ui->comboNavigationStyle->setCurrentIndex(index); if (index > -1) ui->comboNavigationStyle->setCurrentIndex(index);
index = hGrp->GetInt("OrbitStyle", int(NavigationStyle::Trackball)); index = hGrp->GetInt("OrbitStyle", int(NavigationStyle::Trackball));
index = Base::clamp(index, 0, ui->comboOrbitStyle->count()-1); index = Base::clamp(index, 0, ui->comboOrbitStyle->count()-1);
ui->comboOrbitStyle->setCurrentIndex(index); ui->comboOrbitStyle->setCurrentIndex(index);
index = hGrp->GetInt("RotationMode", 1); index = hGrp->GetInt("RotationMode", 1);
ui->comboRotationMode->setCurrentIndex(index); ui->comboRotationMode->setCurrentIndex(index);
bool showNaviCube = hGrp->GetBool("ShowNaviCube", true); bool showNaviCube = hGrp->GetBool("ShowNaviCube", true);
ui->groupBoxNaviCube->setChecked(showNaviCube); ui->groupBoxNaviCube->setChecked(showNaviCube);
ui->comboNewDocView->addItem(tr("Isometric"), QByteArray("Isometric")); ui->comboNewDocView->addItem(tr("Isometric"), QByteArray("Isometric"));
ui->comboNewDocView->addItem(tr("Dimetric"), QByteArray("Dimetric")); ui->comboNewDocView->addItem(tr("Dimetric"), QByteArray("Dimetric"));
ui->comboNewDocView->addItem(tr("Trimetric"), QByteArray("Trimetric")); ui->comboNewDocView->addItem(tr("Trimetric"), QByteArray("Trimetric"));
ui->comboNewDocView->addItem(tr("Top"), QByteArray("Top")); ui->comboNewDocView->addItem(tr("Top"), QByteArray("Top"));
ui->comboNewDocView->addItem(tr("Front"), QByteArray("Front")); ui->comboNewDocView->addItem(tr("Front"), QByteArray("Front"));
ui->comboNewDocView->addItem(tr("Left"), QByteArray("Left")); ui->comboNewDocView->addItem(tr("Left"), QByteArray("Left"));
ui->comboNewDocView->addItem(tr("Right"), QByteArray("Right")); ui->comboNewDocView->addItem(tr("Right"), QByteArray("Right"));
ui->comboNewDocView->addItem(tr("Rear"), QByteArray("Rear")); ui->comboNewDocView->addItem(tr("Rear"), QByteArray("Rear"));
ui->comboNewDocView->addItem(tr("Bottom"), QByteArray("Bottom")); ui->comboNewDocView->addItem(tr("Bottom"), QByteArray("Bottom"));
ui->comboNewDocView->addItem(tr("Custom"), QByteArray("Custom")); ui->comboNewDocView->addItem(tr("Custom"), QByteArray("Custom"));
std::string camera = hGrp->GetASCII("NewDocumentCameraOrientation", "Trimetric"); std::string camera = hGrp->GetASCII("NewDocumentCameraOrientation", "Trimetric");
index = ui->comboNewDocView->findData(QByteArray(camera.c_str())); index = ui->comboNewDocView->findData(QByteArray(camera.c_str()));
if (index > -1) ui->comboNewDocView->setCurrentIndex(index); if (index > -1) ui->comboNewDocView->setCurrentIndex(index);
if (camera == "Custom") { if (camera == "Custom") {
ParameterGrp::handle hCustom = hGrp->GetGroup("Custom"); ParameterGrp::handle hCustom = hGrp->GetGroup("Custom");
q0 = hCustom->GetFloat("Q0", q0); q0 = hCustom->GetFloat("Q0", q0);
q1 = hCustom->GetFloat("Q1", q1); q1 = hCustom->GetFloat("Q1", q1);
q2 = hCustom->GetFloat("Q2", q2); q2 = hCustom->GetFloat("Q2", q2);
q3 = hCustom->GetFloat("Q3", q3); q3 = hCustom->GetFloat("Q3", q3);
} }
connect(ui->comboNewDocView, qOverload<int>(&QComboBox::currentIndexChanged), connect(ui->comboNewDocView, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgSettingsNavigation::onNewDocViewChanged); this, &DlgSettingsNavigation::onNewDocViewChanged);
connect(ui->mouseButton, &QPushButton::clicked, connect(ui->mouseButton, &QPushButton::clicked,
this, &DlgSettingsNavigation::onMouseButtonClicked); this, &DlgSettingsNavigation::onMouseButtonClicked);
// fill up font styles // fill up font styles
// we purposely allow all available fonts on the system // we purposely allow all available fonts on the system
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QStringList familyNames = QFontDatabase().families(QFontDatabase::Any); QStringList familyNames = QFontDatabase().families(QFontDatabase::Any);
#else #else
QStringList familyNames = QFontDatabase::families(QFontDatabase::Any); QStringList familyNames = QFontDatabase::families(QFontDatabase::Any);
#endif #endif
ui->naviCubeFontName->addItems(familyNames); ui->naviCubeFontName->addItems(familyNames);
hGrp = App::GetApplication().GetParameterGroupByPath( hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/NaviCube"); "User parameter:BaseApp/Preferences/NaviCube");
int indexFamilyNames = familyNames.indexOf( int indexFamilyNames = familyNames.indexOf(
QString::fromStdString(hGrp->GetASCII("FontString"))); QString::fromStdString(hGrp->GetASCII("FontString")));
ui->naviCubeFontName->setCurrentIndex(indexFamilyNames + 1); ui->naviCubeFontName->setCurrentIndex(indexFamilyNames + 1);
} }
void DlgSettingsNavigation::onMouseButtonClicked() void DlgSettingsNavigation::onMouseButtonClicked()
{ {
QDialog dlg(this); QDialog dlg(this);
Ui_MouseButtons uimb; Ui_MouseButtons uimb;
uimb.setupUi(&dlg); uimb.setupUi(&dlg);
QVariant data = QVariant data =
ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), Qt::UserRole); ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), Qt::UserRole);
void* instance = Base::Type::createInstanceByName((const char*)data.toByteArray()); void* instance = Base::Type::createInstanceByName((const char*)data.toByteArray());
std::unique_ptr<UserNavigationStyle> ns(static_cast<UserNavigationStyle*>(instance)); std::unique_ptr<UserNavigationStyle> ns(static_cast<UserNavigationStyle*>(instance));
uimb.groupBox->setTitle(uimb.groupBox->title() + QString::fromLatin1(" ") uimb.groupBox->setTitle(uimb.groupBox->title() + QString::fromLatin1(" ")
+ ui->comboNavigationStyle->currentText()); + ui->comboNavigationStyle->currentText());
QString descr; QString descr;
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::SELECTION)); descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::SELECTION));
descr.replace(QLatin1String("\n"), QLatin1String("<p>")); descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
uimb.selectionLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr)); uimb.selectionLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::PANNING)); descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::PANNING));
descr.replace(QLatin1String("\n"), QLatin1String("<p>")); descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
uimb.panningLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr)); uimb.panningLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::DRAGGING)); descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::DRAGGING));
descr.replace(QLatin1String("\n"), QLatin1String("<p>")); descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
uimb.rotationLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr)); uimb.rotationLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::ZOOMING)); descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::ZOOMING));
descr.replace(QLatin1String("\n"), QLatin1String("<p>")); descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
uimb.zoomingLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr)); uimb.zoomingLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
dlg.exec(); dlg.exec();
} }
/** /**
* Sets the strings of the subwidgets using the current language. * Sets the strings of the subwidgets using the current language.
*/ */
void DlgSettingsNavigation::changeEvent(QEvent *e) void DlgSettingsNavigation::changeEvent(QEvent *e)
{ {
if (e->type() == QEvent::LanguageChange) { if (e->type() == QEvent::LanguageChange) {
int navigation = ui->comboNavigationStyle->currentIndex(); int navigation = ui->comboNavigationStyle->currentIndex();
int orbit = ui->comboOrbitStyle->currentIndex(); int orbit = ui->comboOrbitStyle->currentIndex();
int corner = ui->naviCubeCorner->currentIndex(); int corner = ui->naviCubeCorner->currentIndex();
ui->retranslateUi(this); ui->retranslateUi(this);
retranslate(); retranslate();
ui->comboNavigationStyle->setCurrentIndex(navigation); ui->comboNavigationStyle->setCurrentIndex(navigation);
ui->comboOrbitStyle->setCurrentIndex(orbit); ui->comboOrbitStyle->setCurrentIndex(orbit);
ui->naviCubeCorner->setCurrentIndex(corner); ui->naviCubeCorner->setCurrentIndex(corner);
} }
else { else {
QWidget::changeEvent(e); QWidget::changeEvent(e);
} }
} }
void DlgSettingsNavigation::retranslate() void DlgSettingsNavigation::retranslate()
{ {
ui->comboNavigationStyle->clear(); ui->comboNavigationStyle->clear();
// add submenu at the end to select navigation style // add submenu at the end to select navigation style
std::map<Base::Type, std::string> styles = UserNavigationStyle::getUserFriendlyNames(); std::map<Base::Type, std::string> styles = UserNavigationStyle::getUserFriendlyNames();
for (const auto & style : styles) { for (const auto & style : styles) {
QByteArray data(style.first.getName()); QByteArray data(style.first.getName());
QString name = QApplication::translate(style.first.getName(), style.second.c_str()); QString name = QApplication::translate(style.first.getName(), style.second.c_str());
ui->comboNavigationStyle->addItem(name, data); ui->comboNavigationStyle->addItem(name, data);
} }
} }
void DlgSettingsNavigation::onNewDocViewChanged(int index) void DlgSettingsNavigation::onNewDocViewChanged(int index)
{ {
QVariant camera = ui->comboNewDocView->itemData(index, Qt::UserRole); QVariant camera = ui->comboNewDocView->itemData(index, Qt::UserRole);
if (camera == QByteArray("Custom")) { if (camera == QByteArray("Custom")) {
CameraDialog dlg(this); CameraDialog dlg(this);
dlg.setValues(q0, q1, q2, q3); dlg.setValues(q0, q1, q2, q3);
if (dlg.exec()) { if (dlg.exec()) {
dlg.getValues(q0, q1, q2, q3); dlg.getValues(q0, q1, q2, q3);
} }
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
CameraDialog::CameraDialog(QWidget* parent) CameraDialog::CameraDialog(QWidget* parent)
: QDialog(parent) : QDialog(parent)
{ {
this->setWindowTitle(tr("Camera settings")); this->setWindowTitle(tr("Camera settings"));
QGridLayout *gridLayout; QGridLayout *gridLayout;
gridLayout = new QGridLayout(this); gridLayout = new QGridLayout(this);
QGroupBox *groupBox; QGroupBox *groupBox;
groupBox = new QGroupBox(this); groupBox = new QGroupBox(this);
groupBox->setTitle(tr("Orientation")); groupBox->setTitle(tr("Orientation"));
gridLayout->addWidget(groupBox, 0, 0, 1, 1); gridLayout->addWidget(groupBox, 0, 0, 1, 1);
QDialogButtonBox *buttonBox; QDialogButtonBox *buttonBox;
buttonBox = new QDialogButtonBox(this); buttonBox = new QDialogButtonBox(this);
buttonBox->setOrientation(Qt::Horizontal); buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
gridLayout->addWidget(buttonBox, 3, 0, 1, 1); gridLayout->addWidget(buttonBox, 3, 0, 1, 1);
QGridLayout *layout; QGridLayout *layout;
layout = new QGridLayout(groupBox); layout = new QGridLayout(groupBox);
// Q0 // Q0
auto label0 = new QLabel(groupBox); auto label0 = new QLabel(groupBox);
label0->setText(tr("Q0")); label0->setText(tr("Q0"));
layout->addWidget(label0, 0, 0, 1, 1); layout->addWidget(label0, 0, 0, 1, 1);
sb0 = new QDoubleSpinBox(groupBox); sb0 = new QDoubleSpinBox(groupBox);
sb0->setRange(-1, 1); sb0->setRange(-1, 1);
sb0->setSingleStep(0.1); sb0->setSingleStep(0.1);
layout->addWidget(sb0, 0, 1, 1, 1); layout->addWidget(sb0, 0, 1, 1, 1);
// Q1 // Q1
auto label1 = new QLabel(groupBox); auto label1 = new QLabel(groupBox);
label1->setText(tr("Q1")); label1->setText(tr("Q1"));
layout->addWidget(label1, 1, 0, 1, 1); layout->addWidget(label1, 1, 0, 1, 1);
sb1 = new QDoubleSpinBox(groupBox); sb1 = new QDoubleSpinBox(groupBox);
sb1->setRange(-1, 1); sb1->setRange(-1, 1);
sb1->setSingleStep(0.1); sb1->setSingleStep(0.1);
layout->addWidget(sb1, 1, 1, 1, 1); layout->addWidget(sb1, 1, 1, 1, 1);
// Q2 // Q2
auto label2 = new QLabel(groupBox); auto label2 = new QLabel(groupBox);
label2->setText(tr("Q2")); label2->setText(tr("Q2"));
layout->addWidget(label2, 2, 0, 1, 1); layout->addWidget(label2, 2, 0, 1, 1);
sb2 = new QDoubleSpinBox(groupBox); sb2 = new QDoubleSpinBox(groupBox);
sb2->setRange(-1, 1); sb2->setRange(-1, 1);
sb2->setSingleStep(0.1); sb2->setSingleStep(0.1);
layout->addWidget(sb2, 2, 1, 1, 1); layout->addWidget(sb2, 2, 1, 1, 1);
// Q3 // Q3
auto label3 = new QLabel(groupBox); auto label3 = new QLabel(groupBox);
label3->setText(tr("Q3")); label3->setText(tr("Q3"));
layout->addWidget(label3, 3, 0, 1, 1); layout->addWidget(label3, 3, 0, 1, 1);
sb3 = new QDoubleSpinBox(groupBox); sb3 = new QDoubleSpinBox(groupBox);
sb3->setRange(-1, 1); sb3->setRange(-1, 1);
sb3->setSingleStep(0.1); sb3->setSingleStep(0.1);
layout->addWidget(sb3, 3, 1, 1, 1); layout->addWidget(sb3, 3, 1, 1, 1);
auto currentViewButton = new QPushButton(this); auto currentViewButton = new QPushButton(this);
currentViewButton->setText(tr("Current view")); currentViewButton->setText(tr("Current view"));
currentViewButton->setObjectName(QString::fromLatin1("currentView")); currentViewButton->setObjectName(QString::fromLatin1("currentView"));
layout->addWidget(currentViewButton, 4, 1, 2, 1); layout->addWidget(currentViewButton, 4, 1, 2, 1);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(currentViewButton, &QPushButton::clicked, this, connect(currentViewButton, &QPushButton::clicked, this,
&CameraDialog::onCurrentViewClicked); &CameraDialog::onCurrentViewClicked);
} }
CameraDialog::~CameraDialog() CameraDialog::~CameraDialog()
{ {
} }
void CameraDialog::setValues(double q0, double q1, double q2, double q3) void CameraDialog::setValues(double q0, double q1, double q2, double q3)
{ {
sb0->setValue(q0); sb0->setValue(q0);
sb1->setValue(q1); sb1->setValue(q1);
sb2->setValue(q2); sb2->setValue(q2);
sb3->setValue(q3); sb3->setValue(q3);
} }
void CameraDialog::getValues(double& q0, double& q1, double& q2, double& q3) const void CameraDialog::getValues(double& q0, double& q1, double& q2, double& q3) const
{ {
q0 = sb0->value(); q0 = sb0->value();
q1 = sb1->value(); q1 = sb1->value();
q2 = sb2->value(); q2 = sb2->value();
q3 = sb3->value(); q3 = sb3->value();
} }
void CameraDialog::onCurrentViewClicked() void CameraDialog::onCurrentViewClicked()
{ {
auto mdi = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow()); auto mdi = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
if (mdi) { if (mdi) {
SbRotation rot = mdi->getViewer()->getCameraOrientation(); SbRotation rot = mdi->getViewer()->getCameraOrientation();
const float* q = rot.getValue(); const float* q = rot.getValue();
sb0->setValue(q[0]); sb0->setValue(q[0]);
sb1->setValue(q[1]); sb1->setValue(q[1]);
sb2->setValue(q[2]); sb2->setValue(q[2]);
sb3->setValue(q[3]); sb3->setValue(q[3]);
} }
} }
#include "moc_DlgSettingsNavigation.cpp" #include "moc_DlgSettingsNavigation.cpp"
@@ -1,90 +1,90 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> * * Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSNAVIGATION_H #ifndef GUI_DIALOG_DLGSETTINGSNAVIGATION_H
#define GUI_DIALOG_DLGSETTINGSNAVIGATION_H #define GUI_DIALOG_DLGSETTINGSNAVIGATION_H
#include <memory> #include <memory>
#include "PropertyPage.h" #include "PropertyPage.h"
#include <QDialog> #include <QDialog>
class QDoubleSpinBox; class QDoubleSpinBox;
namespace Gui { namespace Gui {
namespace Dialog { namespace Dialog {
class Ui_DlgSettingsNavigation; class Ui_DlgSettingsNavigation;
/** /**
* The Ui_DlgSettingsNavigation class implements a preference page to change settings * The Ui_DlgSettingsNavigation class implements a preference page to change settings
* for the Inventor viewer. * for the Inventor viewer.
* \author Werner Mayer * \author Werner Mayer
*/ */
class DlgSettingsNavigation : public PreferencePage class DlgSettingsNavigation : public PreferencePage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DlgSettingsNavigation(QWidget* parent = nullptr); explicit DlgSettingsNavigation(QWidget* parent = nullptr);
~DlgSettingsNavigation() override; ~DlgSettingsNavigation() override;
void saveSettings() override; void saveSettings() override;
void loadSettings() override; void loadSettings() override;
private: private:
void onMouseButtonClicked(); void onMouseButtonClicked();
void onNewDocViewChanged(int); void onNewDocViewChanged(int);
protected: protected:
void changeEvent(QEvent *e) override; void changeEvent(QEvent *e) override;
void retranslate(); void retranslate();
private: private:
std::unique_ptr<Ui_DlgSettingsNavigation> ui; std::unique_ptr<Ui_DlgSettingsNavigation> ui;
double q0, q1, q2, q3; double q0, q1, q2, q3;
}; };
class CameraDialog : public QDialog class CameraDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CameraDialog(QWidget* parent=nullptr); explicit CameraDialog(QWidget* parent=nullptr);
~CameraDialog() override; ~CameraDialog() override;
void setValues(double q0, double q1, double q2, double q3); void setValues(double q0, double q1, double q2, double q3);
void getValues(double& q0, double& q1, double& q2, double& q3) const; void getValues(double& q0, double& q1, double& q2, double& q3) const;
private: private:
void onCurrentViewClicked(); void onCurrentViewClicked();
private: private:
QDoubleSpinBox* sb0; QDoubleSpinBox* sb0;
QDoubleSpinBox* sb1; QDoubleSpinBox* sb1;
QDoubleSpinBox* sb2; QDoubleSpinBox* sb2;
QDoubleSpinBox* sb3; QDoubleSpinBox* sb3;
}; };
} // namespace Dialog } // namespace Dialog
} // namespace Gui } // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSNAVIGATION_H #endif // GUI_DIALOG_DLGSETTINGSNAVIGATION_H
@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSNOTIFICATIONAREA_H #ifndef GUI_DIALOG_DLGSETTINGSNOTIFICATIONAREA_H
#define GUI_DIALOG_DLGSETTINGSNOTIFICATIONAREA_H #define GUI_DIALOG_DLGSETTINGSNOTIFICATIONAREA_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
namespace Gui { namespace Gui {
@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSPYTHONCONSOLE_H #ifndef GUI_DIALOG_DLGSETTINGSPYTHONCONSOLE_H
#define GUI_DIALOG_DLGSETTINGSPYTHONCONSOLE_H #define GUI_DIALOG_DLGSETTINGSPYTHONCONSOLE_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
namespace Gui { namespace Gui {
@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLG_SETTINGS_REPORT_VIEW #ifndef GUI_DIALOG_DLG_SETTINGS_REPORT_VIEW
#define GUI_DIALOG_DLG_SETTINGS_REPORT_VIEW #define GUI_DIALOG_DLG_SETTINGS_REPORT_VIEW
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
namespace Gui { namespace Gui {
@@ -82,4 +82,3 @@ void DlgSettingsSelection::changeEvent(QEvent *e)
} }
#include "moc_DlgSettingsSelection.cpp" #include "moc_DlgSettingsSelection.cpp"
@@ -1,62 +1,62 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2021 Werner Mayer <wmayer[at]users.sourceforge.net> * * Copyright (c) 2021 Werner Mayer <wmayer[at]users.sourceforge.net> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSSELECTION_H #ifndef GUI_DIALOG_DLGSETTINGSSELECTION_H
#define GUI_DIALOG_DLGSETTINGSSELECTION_H #define GUI_DIALOG_DLGSETTINGSSELECTION_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
class QDoubleSpinBox; class QDoubleSpinBox;
namespace Gui { namespace Gui {
namespace Dialog { namespace Dialog {
class Ui_DlgSettingsSelection; class Ui_DlgSettingsSelection;
/** /**
* The Ui_DlgSettingsSelection class implements a preference page to change settings * The Ui_DlgSettingsSelection class implements a preference page to change settings
* for the selection. * for the selection.
* \author Werner Mayer * \author Werner Mayer
*/ */
class DlgSettingsSelection : public PreferencePage class DlgSettingsSelection : public PreferencePage
{ {
Q_OBJECT Q_OBJECT
public: public:
DlgSettingsSelection(QWidget* parent = nullptr); DlgSettingsSelection(QWidget* parent = nullptr);
~DlgSettingsSelection() override; ~DlgSettingsSelection() override;
void saveSettings() override; void saveSettings() override;
void loadSettings() override; void loadSettings() override;
protected: protected:
void changeEvent(QEvent *e) override; void changeEvent(QEvent *e) override;
private: private:
std::unique_ptr<Ui_DlgSettingsSelection> ui; std::unique_ptr<Ui_DlgSettingsSelection> ui;
}; };
} // namespace Dialog } // namespace Dialog
} // namespace Gui } // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSSELECTION_H #endif // GUI_DIALOG_DLGSETTINGSSELECTION_H
@@ -165,4 +165,3 @@ void DlgSettingsViewColor::setGradientColorVisibility(bool val)
} }
#include "moc_DlgSettingsViewColor.cpp" #include "moc_DlgSettingsViewColor.cpp"
@@ -1,70 +1,70 @@
/*************************************************************************** /***************************************************************************
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> * * Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
* * * *
* This file is part of the FreeCAD CAx development system. * * This file is part of the FreeCAD CAx development system. *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public * * modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either * * License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. * * version 2 of the License, or (at your option) any later version. *
* * * *
* This library is distributed in the hope that it will be useful, * * This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. * * GNU Library General Public License for more details. *
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, * * License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, * * write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA * * Suite 330, Boston, MA 02111-1307, USA *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H #ifndef GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
#define GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H #define GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
namespace Gui { namespace Gui {
namespace Dialog { namespace Dialog {
class Ui_DlgSettingsViewColor; class Ui_DlgSettingsViewColor;
/** /**
* The DlgSettingsViewColor class implements a preference page to change color settings * The DlgSettingsViewColor class implements a preference page to change color settings
* for the Inventor viewer like background and selection. * for the Inventor viewer like background and selection.
* @author Werner Mayer * @author Werner Mayer
*/ */
class DlgSettingsViewColor : public PreferencePage class DlgSettingsViewColor : public PreferencePage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DlgSettingsViewColor(QWidget* parent = nullptr); explicit DlgSettingsViewColor(QWidget* parent = nullptr);
~DlgSettingsViewColor() override; ~DlgSettingsViewColor() override;
void saveSettings() override; void saveSettings() override;
void loadSettings() override; void loadSettings() override;
protected: protected:
void changeEvent(QEvent *e) override; void changeEvent(QEvent *e) override;
protected Q_SLOTS: protected Q_SLOTS:
void onSwitchGradientColorsPressed(); void onSwitchGradientColorsPressed();
void onRadioButtonSimpleToggled(bool val); void onRadioButtonSimpleToggled(bool val);
void onRadioButtonGradientToggled(bool val); void onRadioButtonGradientToggled(bool val);
void onRadioButtonRadialGradientToggled(bool val); void onRadioButtonRadialGradientToggled(bool val);
void onCheckMidColorToggled(bool val); void onCheckMidColorToggled(bool val);
private: private:
void setGradientColorVisibility(bool val); void setGradientColorVisibility(bool val);
private: private:
std::unique_ptr<Ui_DlgSettingsViewColor> ui; std::unique_ptr<Ui_DlgSettingsViewColor> ui;
}; };
} // namespace Dialog } // namespace Dialog
} // namespace Gui } // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H #endif // GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
@@ -30,12 +30,13 @@
#include <sstream> #include <sstream>
#endif #endif
#include <Gui/Application.h>
#include <Gui/UserSettings.h>
#include <Gui/Workbench.h>
#include <Gui/WorkbenchManager.h>
#include "DlgSettingsWorkbenchesImp.h" #include "DlgSettingsWorkbenchesImp.h"
#include "ui_DlgSettingsWorkbenches.h" #include "ui_DlgSettingsWorkbenches.h"
#include "Application.h"
#include "UserSettings.h"
#include "Workbench.h"
#include "WorkbenchManager.h"
using namespace Gui::Dialog; using namespace Gui::Dialog;
@@ -26,7 +26,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H #ifndef GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H
#define GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H #define GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H
#include "PropertyPage.h" #include <Gui/PropertyPage.h>
#include <memory> #include <memory>
namespace Gui::Dialog { namespace Gui::Dialog {
+15 -14
View File
@@ -30,26 +30,27 @@
// INCLUDE YOUR PREFERENCE PAGES HERE // INCLUDE YOUR PREFERENCE PAGES HERE
// //
#include "DlgPreferencesImp.h" #include "DlgPreferencesImp.h"
#include "DlgSettings3DViewImp.h" #include "PreferencePages/DlgSettings3DViewImp.h"
#include "DlgSettingsNavigation.h" #include "PreferencePages/DlgSettingsCacheDirectory.h"
#include "DlgSettingsSelection.h" #include "PreferencePages/DlgSettingsDocumentImp.h"
#include "DlgSettingsViewColor.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 "DlgSettingsTheme.h"
#include "DlgSettingsGeneral.h" #include "PreferencePages/DlgSettingsViewColor.h"
#include "DlgEditorImp.h" #include "PreferencePages/DlgSettingsWorkbenchesImp.h"
#include "DlgSettingsNotificationArea.h"
#include "DlgSettingsPythonConsole.h"
#include "DlgSettingsMacroImp.h"
#include "DlgSettingsDocumentImp.h"
#include "DlgSettingsReportView.h"
#include "DlgSettingsWorkbenchesImp.h"
#include "DlgToolbarsImp.h" #include "DlgToolbarsImp.h"
#include "DlgActionsImp.h" #include "DlgActionsImp.h"
#include "DlgKeyboardImp.h" #include "DlgKeyboardImp.h"
#include "DlgCustomizeSpaceball.h" #include "DlgCustomizeSpaceball.h"
#include "DlgCustomizeSpNavSettings.h" #include "DlgCustomizeSpNavSettings.h"
#include "DlgSettingsCacheDirectory.h"
#include "InputField.h" #include "InputField.h"
#include "QuantitySpinBox.h" #include "QuantitySpinBox.h"
#include "PrefWidgets.h" #include "PrefWidgets.h"
@@ -78,7 +79,7 @@ WidgetFactorySupplier::WidgetFactorySupplier()
new PrefPageProducer<DlgSettingsWorkbenchesImp> ( QT_TRANSLATE_NOOP("QObject","Workbenches") ); new PrefPageProducer<DlgSettingsWorkbenchesImp> ( QT_TRANSLATE_NOOP("QObject","Workbenches") );
new PrefPageProducer<DlgSettingsMacroImp> ( QT_TRANSLATE_NOOP("QObject", "Python")); new PrefPageProducer<DlgSettingsMacroImp> ( QT_TRANSLATE_NOOP("QObject", "Python"));
new PrefPageProducer<DlgSettingsPythonConsole> ( QT_TRANSLATE_NOOP("QObject", "Python")); new PrefPageProducer<DlgSettingsPythonConsole> ( QT_TRANSLATE_NOOP("QObject", "Python"));
new PrefPageProducer<DlgSettingsEditorImp> ( QT_TRANSLATE_NOOP("QObject", "Python")); new PrefPageProducer<DlgSettingsEditor> ( QT_TRANSLATE_NOOP("QObject", "Python"));
// ADD YOUR CUSTOMIZE PAGES HERE // ADD YOUR CUSTOMIZE PAGES HERE
// //