Move all the preference pages to PreferencePages subfolder.

This commit is contained in:
Paddle
2023-07-31 14:19:50 +02:00
committed by wwmayer
parent 7c83085491
commit ccb9d7faeb
43 changed files with 1396 additions and 1394 deletions

View File

@@ -48,7 +48,7 @@
#include "BitmapFactory.h"
#include "Command.h"
#include "DlgUndoRedo.h"
#include "DlgSettingsWorkbenchesImp.h"
#include "PreferencePages/DlgSettingsWorkbenchesImp.h"
#include "Document.h"
#include "EditorView.h"
#include "FileDialog.h"

View File

@@ -65,7 +65,7 @@
#include "CommandActionPy.h"
#include "CommandPy.h"
#include "Control.h"
#include "DlgSettingsCacheDirectory.h"
#include "PreferencePages/DlgSettingsCacheDirectory.h"
#include "DocumentPy.h"
#include "DocumentRecovery.h"
#include "EditorView.h"

View File

@@ -297,7 +297,6 @@ SET(Gui_UIC_SRCS
DlgCreateNewPreferencePack.ui
DlgCustomizeSpNavSettings.ui
DlgDisplayProperties.ui
DlgSettingsEditor.ui
DlgInputDialog.ui
DlgKeyboard.ui
DlgMacroExecute.ui
@@ -312,22 +311,23 @@ SET(Gui_UIC_SRCS
DlgProjectInformation.ui
DlgProjectUtility.ui
DlgPropertyLink.ui
DlgSettingsReportView.ui
DlgRevertToBackupConfig.ui
DlgSettingsGeneral.ui
DlgSettings3DView.ui
DlgSettingsCacheDirectory.ui
DlgSettingsNavigation.ui
DlgSettingsSelection.ui
DlgSettingsViewColor.ui
DlgSettingsTheme.ui
PreferencePages/DlgSettings3DView.ui
PreferencePages/DlgSettingsCacheDirectory.ui
DlgSettingsColorGradient.ui
DlgSettingsDocument.ui
PreferencePages/DlgSettingsDocument.ui
PreferencePages/DlgSettingsEditor.ui
PreferencePages/DlgSettingsGeneral.ui
DlgSettingsImage.ui
DlgSettingsWorkbenches.ui
DlgSettingsMacro.ui
DlgSettingsNotificationArea.ui
DlgSettingsPythonConsole.ui
PreferencePages/DlgSettingsMacro.ui
PreferencePages/DlgSettingsNavigation.ui
PreferencePages/DlgSettingsNotificationArea.ui
PreferencePages/DlgSettingsPythonConsole.ui
PreferencePages/DlgSettingsReportView.ui
PreferencePages/DlgSettingsSelection.ui
DlgSettingsTheme.ui
PreferencePages/DlgSettingsViewColor.ui
PreferencePages/DlgSettingsWorkbenches.ui
DlgCheckableMessageBox.ui
DlgToolbars.ui
DlgTreeWidget.ui
@@ -556,66 +556,66 @@ SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS})
# The settings dialog sources
SET(Dialog_Settings_CPP_SRCS
DlgSettingsEditor.cpp
DlgOnlineHelpImp.cpp
DlgPreferencesImp.cpp
DlgSettingsReportView.cpp
DlgSettingsGeneral.cpp
DlgSettings3DViewImp.cpp
DlgSettingsCacheDirectory.cpp
DlgSettingsNavigation.cpp
DlgSettingsSelection.cpp
DlgSettingsViewColor.cpp
DlgSettingsTheme.cpp
PreferencePages/DlgSettings3DViewImp.cpp
PreferencePages/DlgSettingsCacheDirectory.cpp
DlgSettingsColorGradientImp.cpp
DlgSettingsDocumentImp.cpp
PreferencePages/DlgSettingsDocumentImp.cpp
PreferencePages/DlgSettingsEditor.cpp
PreferencePages/DlgSettingsGeneral.cpp
DlgSettingsImageImp.cpp
DlgSettingsWorkbenchesImp.cpp
DlgSettingsMacroImp.cpp
DlgSettingsNotificationArea.cpp
DlgSettingsPythonConsole.cpp
PreferencePages/DlgSettingsMacroImp.cpp
PreferencePages/DlgSettingsNavigation.cpp
PreferencePages/DlgSettingsNotificationArea.cpp
PreferencePages/DlgSettingsPythonConsole.cpp
PreferencePages/DlgSettingsReportView.cpp
PreferencePages/DlgSettingsSelection.cpp
DlgSettingsTheme.cpp
PreferencePages/DlgSettingsViewColor.cpp
PreferencePages/DlgSettingsWorkbenchesImp.cpp
)
SET(Dialog_Settings_HPP_SRCS
DlgSettingsEditor.h
DlgSettingsGeneral.h
DlgOnlineHelpImp.h
DlgPreferencesImp.h
DlgSettingsReportView.h
DlgSettings3DViewImp.h
DlgSettingsCacheDirectory.h
DlgSettingsNavigation.h
DlgSettingsSelection.h
DlgSettingsViewColor.h
DlgSettingsTheme.h
PreferencePages/DlgSettings3DViewImp.h
PreferencePages/DlgSettingsCacheDirectory.h
DlgSettingsColorGradientImp.h
DlgSettingsDocumentImp.h
PreferencePages/DlgSettingsDocumentImp.h
PreferencePages/DlgSettingsEditor.h
PreferencePages/DlgSettingsGeneral.h
DlgSettingsImageImp.h
DlgSettingsWorkbenchesImp.h
DlgSettingsMacroImp.h
DlgSettingsNotificationArea.h
DlgSettingsPythonConsole.h
PreferencePages/DlgSettingsMacroImp.h
PreferencePages/DlgSettingsNavigation.h
PreferencePages/DlgSettingsNotificationArea.h
PreferencePages/DlgSettingsPythonConsole.h
PreferencePages/DlgSettingsReportView.h
PreferencePages/DlgSettingsSelection.h
DlgSettingsTheme.h
PreferencePages/DlgSettingsViewColor.h
PreferencePages/DlgSettingsWorkbenchesImp.h
)
SET(Dialog_Settings_SRCS
${Dialog_Settings_CPP_SRCS}
${Dialog_Settings_HPP_SRCS}
DlgSettingsEditor.ui
DlgOnlineHelp.ui
DlgPreferences.ui
DlgSettingsReportView.ui
DlgSettingsGeneral.ui
DlgSettings3DView.ui
DlgSettingsCacheDirectory.ui
DlgSettingsNavigation.ui
DlgSettingsSelection.ui
DlgSettingsViewColor.ui
DlgSettingsTheme.ui
PreferencePages/DlgSettings3DView.ui
PreferencePages/DlgSettingsCacheDirectory.ui
DlgSettingsColorGradient.ui
DlgSettingsDocument.ui
PreferencePages/DlgSettingsDocument.ui
PreferencePages/DlgSettingsEditor.ui
PreferencePages/DlgSettingsGeneral.ui
DlgSettingsImage.ui
DlgSettingsWorkbenches.ui
DlgSettingsMacro.ui
DlgSettingsNotificationArea.ui
DlgSettingsPythonConsole.ui
PreferencePages/DlgSettingsMacro.ui
PreferencePages/DlgSettingsNavigation.ui
PreferencePages/DlgSettingsNotificationArea.ui
PreferencePages/DlgSettingsPythonConsole.ui
PreferencePages/DlgSettingsReportView.ui
PreferencePages/DlgSettingsSelection.ui
DlgSettingsTheme.ui
PreferencePages/DlgSettingsViewColor.ui
PreferencePages/DlgSettingsWorkbenches.ui
)
SOURCE_GROUP("Dialog\\Settings" FILES ${Dialog_Settings_SRCS})

View File

@@ -1,169 +1,169 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QApplication>
# include <QMessageBox>
#endif
#include <App/Application.h>
#include <Base/Parameter.h>
#include <Base/Tools.h>
#include "DlgSettings3DViewImp.h"
#include "ui_DlgSettings3DView.h"
#include "View3DInventorViewer.h"
using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgSettings3DViewImp */
bool DlgSettings3DViewImp::showMsg = true;
/**
* Constructs a DlgSettings3DViewImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
DlgSettings3DViewImp::DlgSettings3DViewImp(QWidget* parent)
: PreferencePage( parent )
, ui(new Ui_DlgSettings3DView)
{
ui->setupUi(this);
}
/**
* Destroys the object and frees any allocated resources
*/
DlgSettings3DViewImp::~DlgSettings3DViewImp()
{
// no need to delete child widgets, Qt does it all for us
}
void DlgSettings3DViewImp::saveSettings()
{
// must be done as very first because we create a new instance of NavigatorStyle
// where we set some attributes afterwards
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
int index = ui->comboAliasing->currentIndex();
hGrp->SetInt("AntiAliasing", index);
index = ui->renderCache->currentIndex();
hGrp->SetInt("RenderCache", index);
ui->comboTransparentRender->onSave();
QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex());
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());
ui->CheckBox_CornerCoordSystem->onSave();
ui->SpinBox_CornerCoordSystemSize->onSave();
ui->CheckBox_ShowAxisCross->onSave();
ui->CheckBox_ShowFPS->onSave();
ui->CheckBox_use_SW_OpenGL->onSave();
ui->CheckBox_useVBO->onSave();
ui->FloatSpinBox_EyeDistance->onSave();
ui->checkBoxBacklight->onSave();
ui->backlightColor->onSave();
ui->sliderIntensity->onSave();
ui->radioPerspective->onSave();
ui->radioOrthographic->onSave();
}
void DlgSettings3DViewImp::loadSettings()
{
ui->CheckBox_CornerCoordSystem->onRestore();
ui->SpinBox_CornerCoordSystemSize->onRestore();
ui->CheckBox_ShowAxisCross->onRestore();
ui->CheckBox_ShowFPS->onRestore();
ui->CheckBox_use_SW_OpenGL->onRestore();
ui->CheckBox_useVBO->onRestore();
ui->FloatSpinBox_EyeDistance->onRestore();
ui->checkBoxBacklight->onRestore();
ui->backlightColor->onRestore();
ui->sliderIntensity->onRestore();
ui->radioPerspective->onRestore();
ui->radioOrthographic->onRestore();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
int index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None));
index = Base::clamp(index, 0, ui->comboAliasing->count()-1);
ui->comboAliasing->setCurrentIndex(index);
// connect after setting current item of the combo box
connect(ui->comboAliasing, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgSettings3DViewImp::onAliasingChanged);
index = hGrp->GetInt("RenderCache", 0);
ui->renderCache->setCurrentIndex(index);
ui->comboTransparentRender->onRestore();
int const current = hGrp->GetInt("MarkerSize", 9L);
ui->boxMarkerSize->addItem(tr("5px"), QVariant(5));
ui->boxMarkerSize->addItem(tr("7px"), QVariant(7));
ui->boxMarkerSize->addItem(tr("9px"), QVariant(9));
ui->boxMarkerSize->addItem(tr("11px"), QVariant(11));
ui->boxMarkerSize->addItem(tr("13px"), QVariant(13));
ui->boxMarkerSize->addItem(tr("15px"), QVariant(15));
index = ui->boxMarkerSize->findData(QVariant(current));
if (index < 0) index = 2;
ui->boxMarkerSize->setCurrentIndex(index);
}
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgSettings3DViewImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
ui->comboAliasing->blockSignals(true);
int aliasing = ui->comboAliasing->currentIndex();
ui->retranslateUi(this);
ui->comboAliasing->setCurrentIndex(aliasing);
ui->comboAliasing->blockSignals(false);
}
else {
QWidget::changeEvent(e);
}
}
void DlgSettings3DViewImp::onAliasingChanged(int index)
{
if (index < 0 || !isVisible())
return;
// Show this message only once per application session to reduce
// annoyance when showing it too often.
if (showMsg) {
showMsg = false;
QMessageBox::information(this, tr("Anti-aliasing"),
tr("Open a new viewer or restart %1 to apply anti-aliasing changes.").arg(qApp->applicationName()));
}
}
#include "moc_DlgSettings3DViewImp.cpp"
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QApplication>
# include <QMessageBox>
#endif
#include <App/Application.h>
#include <Base/Parameter.h>
#include <Base/Tools.h>
#include <Gui/View3DInventorViewer.h>
#include "DlgSettings3DViewImp.h"
#include "ui_DlgSettings3DView.h"
using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgSettings3DViewImp */
bool DlgSettings3DViewImp::showMsg = true;
/**
* Constructs a DlgSettings3DViewImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
DlgSettings3DViewImp::DlgSettings3DViewImp(QWidget* parent)
: PreferencePage( parent )
, ui(new Ui_DlgSettings3DView)
{
ui->setupUi(this);
}
/**
* Destroys the object and frees any allocated resources
*/
DlgSettings3DViewImp::~DlgSettings3DViewImp()
{
// no need to delete child widgets, Qt does it all for us
}
void DlgSettings3DViewImp::saveSettings()
{
// must be done as very first because we create a new instance of NavigatorStyle
// where we set some attributes afterwards
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
int index = ui->comboAliasing->currentIndex();
hGrp->SetInt("AntiAliasing", index);
index = ui->renderCache->currentIndex();
hGrp->SetInt("RenderCache", index);
ui->comboTransparentRender->onSave();
QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex());
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());
ui->CheckBox_CornerCoordSystem->onSave();
ui->SpinBox_CornerCoordSystemSize->onSave();
ui->CheckBox_ShowAxisCross->onSave();
ui->CheckBox_ShowFPS->onSave();
ui->CheckBox_use_SW_OpenGL->onSave();
ui->CheckBox_useVBO->onSave();
ui->FloatSpinBox_EyeDistance->onSave();
ui->checkBoxBacklight->onSave();
ui->backlightColor->onSave();
ui->sliderIntensity->onSave();
ui->radioPerspective->onSave();
ui->radioOrthographic->onSave();
}
void DlgSettings3DViewImp::loadSettings()
{
ui->CheckBox_CornerCoordSystem->onRestore();
ui->SpinBox_CornerCoordSystemSize->onRestore();
ui->CheckBox_ShowAxisCross->onRestore();
ui->CheckBox_ShowFPS->onRestore();
ui->CheckBox_use_SW_OpenGL->onRestore();
ui->CheckBox_useVBO->onRestore();
ui->FloatSpinBox_EyeDistance->onRestore();
ui->checkBoxBacklight->onRestore();
ui->backlightColor->onRestore();
ui->sliderIntensity->onRestore();
ui->radioPerspective->onRestore();
ui->radioOrthographic->onRestore();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
int index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None));
index = Base::clamp(index, 0, ui->comboAliasing->count()-1);
ui->comboAliasing->setCurrentIndex(index);
// connect after setting current item of the combo box
connect(ui->comboAliasing, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgSettings3DViewImp::onAliasingChanged);
index = hGrp->GetInt("RenderCache", 0);
ui->renderCache->setCurrentIndex(index);
ui->comboTransparentRender->onRestore();
int const current = hGrp->GetInt("MarkerSize", 9L);
ui->boxMarkerSize->addItem(tr("5px"), QVariant(5));
ui->boxMarkerSize->addItem(tr("7px"), QVariant(7));
ui->boxMarkerSize->addItem(tr("9px"), QVariant(9));
ui->boxMarkerSize->addItem(tr("11px"), QVariant(11));
ui->boxMarkerSize->addItem(tr("13px"), QVariant(13));
ui->boxMarkerSize->addItem(tr("15px"), QVariant(15));
index = ui->boxMarkerSize->findData(QVariant(current));
if (index < 0) index = 2;
ui->boxMarkerSize->setCurrentIndex(index);
}
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgSettings3DViewImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
ui->comboAliasing->blockSignals(true);
int aliasing = ui->comboAliasing->currentIndex();
ui->retranslateUi(this);
ui->comboAliasing->setCurrentIndex(aliasing);
ui->comboAliasing->blockSignals(false);
}
else {
QWidget::changeEvent(e);
}
}
void DlgSettings3DViewImp::onAliasingChanged(int index)
{
if (index < 0 || !isVisible())
return;
// Show this message only once per application session to reduce
// annoyance when showing it too often.
if (showMsg) {
showMsg = false;
QMessageBox::information(this, tr("Anti-aliasing"),
tr("Open a new viewer or restart %1 to apply anti-aliasing changes.").arg(qApp->applicationName()));
}
}
#include "moc_DlgSettings3DViewImp.cpp"

View File

@@ -1,66 +1,66 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
#define GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
#include "PropertyPage.h"
#include <memory>
class QDoubleSpinBox;
namespace Gui {
namespace Dialog {
class Ui_DlgSettings3DView;
/**
* The DlgSettings3DViewImp class implements a preference page to change settings
* for the Inventor viewer.
* \author Jürgen Riegel
*/
class DlgSettings3DViewImp : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettings3DViewImp(QWidget* parent = nullptr);
~DlgSettings3DViewImp() override;
void saveSettings() override;
void loadSettings() override;
private Q_SLOTS:
void onAliasingChanged(int);
protected:
void changeEvent(QEvent *e) override;
private:
std::unique_ptr<Ui_DlgSettings3DView> ui;
static bool showMsg;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
#define GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
#include <Gui/PropertyPage.h>
#include <memory>
class QDoubleSpinBox;
namespace Gui {
namespace Dialog {
class Ui_DlgSettings3DView;
/**
* The DlgSettings3DViewImp class implements a preference page to change settings
* for the Inventor viewer.
* \author Jürgen Riegel
*/
class DlgSettings3DViewImp : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettings3DViewImp(QWidget* parent = nullptr);
~DlgSettings3DViewImp() override;
void saveSettings() override;
void loadSettings() override;
private Q_SLOTS:
void onAliasingChanged(int);
protected:
void changeEvent(QEvent *e) override;
private:
std::unique_ptr<Ui_DlgSettings3DView> ui;
static bool showMsg;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H

View File

@@ -37,11 +37,11 @@
#include <App/Application.h>
#include <App/Document.h>
#include <Gui/DocumentRecovery.h>
#include <Gui/MainWindow.h>
#include "DlgSettingsCacheDirectory.h"
#include "ui_DlgSettingsCacheDirectory.h"
#include "DocumentRecovery.h"
#include "MainWindow.h"
using namespace Gui::Dialog;

View File

@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSCACHEDIRECTORY_H
#define GUI_DIALOG_DLGSETTINGSCACHEDIRECTORY_H
#include "PropertyPage.h"
#include <Gui/PropertyPage.h>
#include <memory>
namespace Gui {

View File

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

View File

@@ -1,64 +1,64 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
#define GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
#include "PropertyPage.h"
#include <memory>
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsDocument;
/**
* The DlgSettingsDocumentImp class implements a preference page to change settings
* for the document.
* \author Jürgen Riegel
*/
class DlgSettingsDocumentImp : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsDocumentImp( QWidget* parent = nullptr );
~DlgSettingsDocumentImp() override;
void saveSettings() override;
void loadSettings() override;
protected Q_SLOTS:
void onLicenseTypeChanged(int index);
protected:
void changeEvent(QEvent *e) override;
void addLicenseTypes();
private:
std::unique_ptr<Ui_DlgSettingsDocument> ui;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
#define GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
#include <Gui/PropertyPage.h>
#include <memory>
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsDocument;
/**
* The DlgSettingsDocumentImp class implements a preference page to change settings
* for the document.
* \author Jürgen Riegel
*/
class DlgSettingsDocumentImp : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsDocumentImp( QWidget* parent = nullptr );
~DlgSettingsDocumentImp() override;
void saveSettings() override;
void loadSettings() override;
protected Q_SLOTS:
void onLicenseTypeChanged(int index);
protected:
void changeEvent(QEvent *e) override;
void addLicenseTypes();
private:
std::unique_ptr<Ui_DlgSettingsDocument> ui;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H

View File

@@ -26,11 +26,12 @@
# include <QFontDatabase>
#endif
#include <App/Color.h>
#include <Gui/PythonEditor.h>
#include <Gui/Tools.h>
#include "DlgSettingsEditor.h"
#include "ui_DlgSettingsEditor.h"
#include "PythonEditor.h"
#include "Tools.h"
#include <App/Color.h>
using namespace Gui;
@@ -72,16 +73,16 @@ QFont getMonospaceFont()
}
}
/* TRANSLATOR Gui::Dialog::DlgSettingsEditorImp */
/* TRANSLATOR Gui::Dialog::DlgSettingsEditor */
/**
* Constructs a DlgSettingsEditorImp which is a child of 'parent', with the
* Constructs a DlgSettingsEditor which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* true to construct a modal dialog.
*/
DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
DlgSettingsEditor::DlgSettingsEditor( QWidget* parent )
: PreferencePage( parent )
, ui(new Ui_DlgSettingsEditor)
{
@@ -171,29 +172,29 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
}
/** Destroys the object and frees any allocated resources */
DlgSettingsEditorImp::~DlgSettingsEditorImp()
DlgSettingsEditor::~DlgSettingsEditor()
{
// no need to delete child widgets, Qt does it all for us
delete pythonSyntax;
delete d;
}
void DlgSettingsEditorImp::setupConnections()
void DlgSettingsEditor::setupConnections()
{
connect(ui->displayItems, &QTreeWidget::currentItemChanged,
this, &DlgSettingsEditorImp::onDisplayItemsCurrentItemChanged);
this, &DlgSettingsEditor::onDisplayItemsCurrentItemChanged);
connect(ui->colorButton, &ColorButton::changed,
this, &DlgSettingsEditorImp::onColorButtonChanged);
this, &DlgSettingsEditor::onColorButtonChanged);
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
connect(ui->fontFamily, qOverload<const QString&>(&QComboBox::activated),
this, &DlgSettingsEditorImp::onFontFamilyActivated);
this, &DlgSettingsEditor::onFontFamilyActivated);
connect(ui->fontSize, qOverload<const QString&>(&PrefSpinBox::valueChanged),
this, &DlgSettingsEditorImp::onFontSizeValueChanged);
this, &DlgSettingsEditor::onFontSizeValueChanged);
#else
connect(ui->fontFamily, &QComboBox::textActivated,
this, &DlgSettingsEditorImp::onFontFamilyActivated);
this, &DlgSettingsEditor::onFontFamilyActivated);
connect(ui->fontSize, &PrefSpinBox::textChanged,
this, &DlgSettingsEditorImp::onFontSizeValueChanged);
this, &DlgSettingsEditor::onFontSizeValueChanged);
#endif
}
@@ -201,7 +202,7 @@ void DlgSettingsEditorImp::setupConnections()
* settings ColorMap and assigns it to the color button
* @see Gui::ColorButton
*/
void DlgSettingsEditorImp::onDisplayItemsCurrentItemChanged(QTreeWidgetItem *item)
void DlgSettingsEditor::onDisplayItemsCurrentItemChanged(QTreeWidgetItem *item)
{
int index = ui->displayItems->indexOfTopLevelItem(item);
unsigned int col = d->colormap[index].second;
@@ -209,7 +210,7 @@ void DlgSettingsEditorImp::onDisplayItemsCurrentItemChanged(QTreeWidgetItem *ite
}
/** Updates the color map if a color was changed */
void DlgSettingsEditorImp::onColorButtonChanged()
void DlgSettingsEditor::onColorButtonChanged()
{
QColor col = ui->colorButton->color();
unsigned int lcol = App::Color::asPackedRGB<QColor>(col);
@@ -219,7 +220,7 @@ void DlgSettingsEditorImp::onColorButtonChanged()
pythonSyntax->setColor( d->colormap[index].first, col );
}
void DlgSettingsEditorImp::setEditorTabWidth(int tabWidth)
void DlgSettingsEditor::setEditorTabWidth(int tabWidth)
{
QFontMetrics metric(font());
int fontSize = QtTools::horizontalAdvance(metric, QLatin1Char('0'));
@@ -230,7 +231,7 @@ void DlgSettingsEditorImp::setEditorTabWidth(int tabWidth)
#endif
}
void DlgSettingsEditorImp::saveSettings()
void DlgSettingsEditor::saveSettings()
{
ui->EnableLineNumber->onSave();
ui->EnableBlockCursor->onSave();
@@ -253,7 +254,7 @@ void DlgSettingsEditorImp::saveSettings()
setEditorTabWidth(ui->tabSize->value());
}
void DlgSettingsEditorImp::loadSettings()
void DlgSettingsEditor::loadSettings()
{
ui->EnableLineNumber->onRestore();
ui->EnableBlockCursor->onRestore();
@@ -325,7 +326,7 @@ void DlgSettingsEditorImp::loadSettings()
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgSettingsEditorImp::changeEvent(QEvent *e)
void DlgSettingsEditor::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
int index = 0;
@@ -337,16 +338,16 @@ void DlgSettingsEditorImp::changeEvent(QEvent *e)
}
}
void DlgSettingsEditorImp::onFontFamilyActivated(const QString& fontFamily)
void DlgSettingsEditor::onFontFamilyActivated(const QString& fontFamily)
{
int fontSize = ui->fontSize->value();
QFont ft(fontFamily, fontSize);
ui->textEdit1->setFont(ft);
}
void DlgSettingsEditorImp::onFontSizeValueChanged(const QString&)
void DlgSettingsEditor::onFontSizeValueChanged(const QString&)
{
onFontFamilyActivated(ui->fontFamily->currentText());
}
#include "moc_DlgEditorImp.cpp"
#include "moc_DlgSettingsEditor.cpp"

View File

@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSEDITOR_H
#define GUI_DIALOG_DLGSETTINGSEDITOR_H
#include "PropertyPage.h"
#include <Gui/PropertyPage.h>
#include <memory>
class QTreeWidgetItem;
@@ -40,13 +40,13 @@ class Ui_DlgSettingsEditor;
* @author Werner Mayer
*/
struct DlgSettingsEditorP;
class DlgSettingsEditorImp : public PreferencePage
class DlgSettingsEditor : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsEditorImp( QWidget* parent = nullptr );
~DlgSettingsEditorImp() override;
explicit DlgSettingsEditor( QWidget* parent = nullptr );
~DlgSettingsEditor() override;
public:
void saveSettings() override;
@@ -68,8 +68,8 @@ private:
DlgSettingsEditorP* d;
Gui::PythonSyntaxHighlighter* pythonSyntax;
DlgSettingsEditorImp( const DlgSettingsEditorImp & );
DlgSettingsEditorImp& operator=( const DlgSettingsEditorImp & );
DlgSettingsEditor( const DlgSettingsEditor & );
DlgSettingsEditor& operator=( const DlgSettingsEditor & );
};
} // namespace Dialog

View File

@@ -38,17 +38,18 @@
#include <Base/Parameter.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 "ui_DlgSettingsGeneral.h"
#include "Action.h"
#include "Application.h"
#include "DlgCreateNewPreferencePackImp.h"
#include "DlgPreferencesImp.h"
#include "DlgPreferencePackManagementImp.h"
#include "DlgRevertToBackupConfigImp.h"
#include "MainWindow.h"
#include "PreferencePackManager.h"
#include "Language/Translator.h"
using namespace Gui::Dialog;
namespace fs = boost::filesystem;
@@ -75,7 +76,7 @@ DlgSettingsGeneral::DlgSettingsGeneral( QWidget* parent )
connect(ui->ImportConfig, &QPushButton::clicked, this, &DlgSettingsGeneral::onImportConfigClicked);
connect(ui->SaveNewPreferencePack, &QPushButton::clicked, this, &DlgSettingsGeneral::saveAsNewPreferencePack);
connect(ui->themesCombobox, qOverload<int>(&QComboBox::activated), this, &DlgGeneralImp::onThemeChanged);
connect(ui->themesCombobox, qOverload<int>(&QComboBox::activated), this, &DlgSettingsGeneral::onThemeChanged);
ui->ManagePreferencePacks->setToolTip(tr("Manage preference packs"));
connect(ui->ManagePreferencePacks, &QPushButton::clicked, this, &DlgSettingsGeneral::onManagePreferencePacksClicked);
@@ -352,7 +353,7 @@ void DlgSettingsGeneral::loadSettings()
loadThemes();
}
void DlgGeneralImp::saveThemes()
void DlgSettingsGeneral::saveThemes()
{
// First we save the name of the theme
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow");
@@ -378,7 +379,7 @@ void DlgGeneralImp::saveThemes()
Application::Instance->setStyleSheet(sheet, tiledBackground);
}
void DlgGeneralImp::loadThemes()
void DlgSettingsGeneral::loadThemes()
{
ui->themesCombobox->clear();
@@ -574,7 +575,7 @@ void DlgSettingsGeneral::onUnitSystemIndexChanged(int index)
}
}
void DlgGeneralImp::onThemeChanged(int index) {
void DlgSettingsGeneral::onThemeChanged(int index) {
Q_UNUSED(index);
themeChanged = true;
}

View File

@@ -25,8 +25,8 @@
#ifndef GUI_DIALOG_DLGSETTINGSGENERAL_H
#define GUI_DIALOG_DLGSETTINGSGENERAL_H
#include "PropertyPage.h"
#include <Gui/PropertyPage.h>
#include <memory>
#include <string>
@@ -91,4 +91,4 @@ private:
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSGENERAL_H
#endif // GUI_DIALOG_DLGSETTINGSGENERAL_H

View File

@@ -1,119 +1,120 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include "DlgSettingsMacroImp.h"
#include "ui_DlgSettingsMacro.h"
#include "Action.h"
#include "Application.h"
#include "MainWindow.h"
using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgSettingsMacroImp */
/**
* Constructs a DlgSettingsMacroImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
DlgSettingsMacroImp::DlgSettingsMacroImp( QWidget* parent )
: PreferencePage( parent )
, ui(new Ui_DlgSettingsMacro)
{
ui->setupUi(this);
// Was never implemented, so hide it
ui->FileLogCheckBox->hide();
ui->MacroPath_2->hide();
if (ui->MacroPath->fileName().isEmpty()) {
QDir d(QString::fromUtf8(App::GetApplication().getUserMacroDir().c_str()));
ui->MacroPath->setFileName(d.path());
}
}
/**
* Destroys the object and frees any allocated resources
*/
DlgSettingsMacroImp::~DlgSettingsMacroImp()
{
// no need to delete child widgets, Qt does it all for us
}
/** Sets the size of the recent macros list from the user parameters.
* @see RecentMacrosAction
* @see StdCmdRecentMacros
*/
void DlgSettingsMacroImp::setRecentMacroSize()
{
auto recent = getMainWindow()->findChild<RecentMacrosAction *>(QLatin1String("recentMacros"));
if (recent) {
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
recent->resizeList(hGrp->GetInt("RecentMacros", 4));
}
}
void DlgSettingsMacroImp::saveSettings()
{
ui->PrefCheckBox_LocalEnv->onSave();
ui->MacroPath->onSave();
ui->PrefCheckBox_RecordGui->onSave();
ui->PrefCheckBox_GuiAsComment->onSave();
ui->PConsoleCheckBox->onSave();
ui->FileLogCheckBox->onSave();
ui->MacroPath_2->onSave();
ui->RecentMacros->onSave();
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
hGrp->SetASCII("ShortcutModifiers", qPrintable(ui->ShortcutModifiers->text()));
ui->ShortcutCount->onSave();
setRecentMacroSize();
}
void DlgSettingsMacroImp::loadSettings()
{
ui->PrefCheckBox_LocalEnv->onRestore();
ui->MacroPath->onRestore();
ui->PrefCheckBox_RecordGui->onRestore();
ui->PrefCheckBox_GuiAsComment->onRestore();
ui->PConsoleCheckBox->onRestore();
ui->FileLogCheckBox->onRestore();
ui->MacroPath_2->onRestore();
ui->RecentMacros->onRestore();
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
ui->ShortcutModifiers->setText(QString::fromStdString(hGrp->GetASCII("ShortcutModifiers", "Ctrl+Shift+")));
ui->ShortcutCount->onRestore();
}
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgSettingsMacroImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
ui->retranslateUi(this);
}
else {
QWidget::changeEvent(e);
}
}
#include "moc_DlgSettingsMacroImp.cpp"
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Gui/Action.h>
#include <Gui/Application.h>
#include <Gui/MainWindow.h>
#include "DlgSettingsMacroImp.h"
#include "ui_DlgSettingsMacro.h"
using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgSettingsMacroImp */
/**
* Constructs a DlgSettingsMacroImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
DlgSettingsMacroImp::DlgSettingsMacroImp( QWidget* parent )
: PreferencePage( parent )
, ui(new Ui_DlgSettingsMacro)
{
ui->setupUi(this);
// Was never implemented, so hide it
ui->FileLogCheckBox->hide();
ui->MacroPath_2->hide();
if (ui->MacroPath->fileName().isEmpty()) {
QDir d(QString::fromUtf8(App::GetApplication().getUserMacroDir().c_str()));
ui->MacroPath->setFileName(d.path());
}
}
/**
* Destroys the object and frees any allocated resources
*/
DlgSettingsMacroImp::~DlgSettingsMacroImp()
{
// no need to delete child widgets, Qt does it all for us
}
/** Sets the size of the recent macros list from the user parameters.
* @see RecentMacrosAction
* @see StdCmdRecentMacros
*/
void DlgSettingsMacroImp::setRecentMacroSize()
{
auto recent = getMainWindow()->findChild<RecentMacrosAction *>(QLatin1String("recentMacros"));
if (recent) {
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
recent->resizeList(hGrp->GetInt("RecentMacros", 4));
}
}
void DlgSettingsMacroImp::saveSettings()
{
ui->PrefCheckBox_LocalEnv->onSave();
ui->MacroPath->onSave();
ui->PrefCheckBox_RecordGui->onSave();
ui->PrefCheckBox_GuiAsComment->onSave();
ui->PConsoleCheckBox->onSave();
ui->FileLogCheckBox->onSave();
ui->MacroPath_2->onSave();
ui->RecentMacros->onSave();
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
hGrp->SetASCII("ShortcutModifiers", qPrintable(ui->ShortcutModifiers->text()));
ui->ShortcutCount->onSave();
setRecentMacroSize();
}
void DlgSettingsMacroImp::loadSettings()
{
ui->PrefCheckBox_LocalEnv->onRestore();
ui->MacroPath->onRestore();
ui->PrefCheckBox_RecordGui->onRestore();
ui->PrefCheckBox_GuiAsComment->onRestore();
ui->PConsoleCheckBox->onRestore();
ui->FileLogCheckBox->onRestore();
ui->MacroPath_2->onRestore();
ui->RecentMacros->onRestore();
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
ui->ShortcutModifiers->setText(QString::fromStdString(hGrp->GetASCII("ShortcutModifiers", "Ctrl+Shift+")));
ui->ShortcutCount->onRestore();
}
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgSettingsMacroImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
ui->retranslateUi(this);
}
else {
QWidget::changeEvent(e);
}
}
#include "moc_DlgSettingsMacroImp.cpp"

View File

@@ -1,61 +1,61 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSMACROIMP_H
#define GUI_DIALOG_DLGSETTINGSMACROIMP_H
#include "PropertyPage.h"
#include <memory>
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsMacro;
/**
* The DlgSettingsMacroImp class implements a preference page to change settings
* for macro stuff.
* \author Jürgen Riegel
*/
class DlgSettingsMacroImp : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsMacroImp( QWidget* parent = nullptr );
~DlgSettingsMacroImp() override;
void saveSettings() override;
void loadSettings() override;
protected:
void changeEvent(QEvent *e) override;
private:
std::unique_ptr<Ui_DlgSettingsMacro> ui;
void setRecentMacroSize();
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSMACROIMP_H
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSMACROIMP_H
#define GUI_DIALOG_DLGSETTINGSMACROIMP_H
#include <Gui/PropertyPage.h>
#include <memory>
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsMacro;
/**
* The DlgSettingsMacroImp class implements a preference page to change settings
* for macro stuff.
* \author Jürgen Riegel
*/
class DlgSettingsMacroImp : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsMacroImp( QWidget* parent = nullptr );
~DlgSettingsMacroImp() override;
void saveSettings() override;
void loadSettings() override;
protected:
void changeEvent(QEvent *e) override;
private:
std::unique_ptr<Ui_DlgSettingsMacro> ui;
void setRecentMacroSize();
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSMACROIMP_H

View File

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

View File

@@ -1,90 +1,90 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSNAVIGATION_H
#define GUI_DIALOG_DLGSETTINGSNAVIGATION_H
#include <memory>
#include "PropertyPage.h"
#include <QDialog>
class QDoubleSpinBox;
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsNavigation;
/**
* The Ui_DlgSettingsNavigation class implements a preference page to change settings
* for the Inventor viewer.
* \author Werner Mayer
*/
class DlgSettingsNavigation : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsNavigation(QWidget* parent = nullptr);
~DlgSettingsNavigation() override;
void saveSettings() override;
void loadSettings() override;
private:
void onMouseButtonClicked();
void onNewDocViewChanged(int);
protected:
void changeEvent(QEvent *e) override;
void retranslate();
private:
std::unique_ptr<Ui_DlgSettingsNavigation> ui;
double q0, q1, q2, q3;
};
class CameraDialog : public QDialog
{
Q_OBJECT
public:
explicit CameraDialog(QWidget* parent=nullptr);
~CameraDialog() override;
void setValues(double q0, double q1, double q2, double q3);
void getValues(double& q0, double& q1, double& q2, double& q3) const;
private:
void onCurrentViewClicked();
private:
QDoubleSpinBox* sb0;
QDoubleSpinBox* sb1;
QDoubleSpinBox* sb2;
QDoubleSpinBox* sb3;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSNAVIGATION_H
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSNAVIGATION_H
#define GUI_DIALOG_DLGSETTINGSNAVIGATION_H
#include <memory>
#include "PropertyPage.h"
#include <QDialog>
class QDoubleSpinBox;
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsNavigation;
/**
* The Ui_DlgSettingsNavigation class implements a preference page to change settings
* for the Inventor viewer.
* \author Werner Mayer
*/
class DlgSettingsNavigation : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsNavigation(QWidget* parent = nullptr);
~DlgSettingsNavigation() override;
void saveSettings() override;
void loadSettings() override;
private:
void onMouseButtonClicked();
void onNewDocViewChanged(int);
protected:
void changeEvent(QEvent *e) override;
void retranslate();
private:
std::unique_ptr<Ui_DlgSettingsNavigation> ui;
double q0, q1, q2, q3;
};
class CameraDialog : public QDialog
{
Q_OBJECT
public:
explicit CameraDialog(QWidget* parent=nullptr);
~CameraDialog() override;
void setValues(double q0, double q1, double q2, double q3);
void getValues(double& q0, double& q1, double& q2, double& q3) const;
private:
void onCurrentViewClicked();
private:
QDoubleSpinBox* sb0;
QDoubleSpinBox* sb1;
QDoubleSpinBox* sb2;
QDoubleSpinBox* sb3;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSNAVIGATION_H

View File

@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSNOTIFICATIONAREA_H
#define GUI_DIALOG_DLGSETTINGSNOTIFICATIONAREA_H
#include "PropertyPage.h"
#include <Gui/PropertyPage.h>
#include <memory>
namespace Gui {

View File

@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSPYTHONCONSOLE_H
#define GUI_DIALOG_DLGSETTINGSPYTHONCONSOLE_H
#include "PropertyPage.h"
#include <Gui/PropertyPage.h>
#include <memory>
namespace Gui {

View File

@@ -24,7 +24,7 @@
#ifndef GUI_DIALOG_DLG_SETTINGS_REPORT_VIEW
#define GUI_DIALOG_DLG_SETTINGS_REPORT_VIEW
#include "PropertyPage.h"
#include <Gui/PropertyPage.h>
#include <memory>
namespace Gui {

View File

@@ -82,4 +82,3 @@ void DlgSettingsSelection::changeEvent(QEvent *e)
}
#include "moc_DlgSettingsSelection.cpp"

View File

@@ -1,62 +1,62 @@
/***************************************************************************
* Copyright (c) 2021 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSSELECTION_H
#define GUI_DIALOG_DLGSETTINGSSELECTION_H
#include "PropertyPage.h"
#include <memory>
class QDoubleSpinBox;
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsSelection;
/**
* The Ui_DlgSettingsSelection class implements a preference page to change settings
* for the selection.
* \author Werner Mayer
*/
class DlgSettingsSelection : public PreferencePage
{
Q_OBJECT
public:
DlgSettingsSelection(QWidget* parent = nullptr);
~DlgSettingsSelection() override;
void saveSettings() override;
void loadSettings() override;
protected:
void changeEvent(QEvent *e) override;
private:
std::unique_ptr<Ui_DlgSettingsSelection> ui;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSSELECTION_H
/***************************************************************************
* Copyright (c) 2021 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSSELECTION_H
#define GUI_DIALOG_DLGSETTINGSSELECTION_H
#include <Gui/PropertyPage.h>
#include <memory>
class QDoubleSpinBox;
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsSelection;
/**
* The Ui_DlgSettingsSelection class implements a preference page to change settings
* for the selection.
* \author Werner Mayer
*/
class DlgSettingsSelection : public PreferencePage
{
Q_OBJECT
public:
DlgSettingsSelection(QWidget* parent = nullptr);
~DlgSettingsSelection() override;
void saveSettings() override;
void loadSettings() override;
protected:
void changeEvent(QEvent *e) override;
private:
std::unique_ptr<Ui_DlgSettingsSelection> ui;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSSELECTION_H

View File

@@ -165,4 +165,3 @@ void DlgSettingsViewColor::setGradientColorVisibility(bool val)
}
#include "moc_DlgSettingsViewColor.cpp"

View File

@@ -1,70 +1,70 @@
/***************************************************************************
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
#define GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
#include "PropertyPage.h"
#include <memory>
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsViewColor;
/**
* The DlgSettingsViewColor class implements a preference page to change color settings
* for the Inventor viewer like background and selection.
* @author Werner Mayer
*/
class DlgSettingsViewColor : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsViewColor(QWidget* parent = nullptr);
~DlgSettingsViewColor() override;
void saveSettings() override;
void loadSettings() override;
protected:
void changeEvent(QEvent *e) override;
protected Q_SLOTS:
void onSwitchGradientColorsPressed();
void onRadioButtonSimpleToggled(bool val);
void onRadioButtonGradientToggled(bool val);
void onRadioButtonRadialGradientToggled(bool val);
void onCheckMidColorToggled(bool val);
private:
void setGradientColorVisibility(bool val);
private:
std::unique_ptr<Ui_DlgSettingsViewColor> ui;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
/***************************************************************************
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
#define GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
#include <Gui/PropertyPage.h>
#include <memory>
namespace Gui {
namespace Dialog {
class Ui_DlgSettingsViewColor;
/**
* The DlgSettingsViewColor class implements a preference page to change color settings
* for the Inventor viewer like background and selection.
* @author Werner Mayer
*/
class DlgSettingsViewColor : public PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsViewColor(QWidget* parent = nullptr);
~DlgSettingsViewColor() override;
void saveSettings() override;
void loadSettings() override;
protected:
void changeEvent(QEvent *e) override;
protected Q_SLOTS:
void onSwitchGradientColorsPressed();
void onRadioButtonSimpleToggled(bool val);
void onRadioButtonGradientToggled(bool val);
void onRadioButtonRadialGradientToggled(bool val);
void onCheckMidColorToggled(bool val);
private:
void setGradientColorVisibility(bool val);
private:
std::unique_ptr<Ui_DlgSettingsViewColor> ui;
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H

View File

@@ -30,12 +30,13 @@
#include <sstream>
#endif
#include <Gui/Application.h>
#include <Gui/UserSettings.h>
#include <Gui/Workbench.h>
#include <Gui/WorkbenchManager.h>
#include "DlgSettingsWorkbenchesImp.h"
#include "ui_DlgSettingsWorkbenches.h"
#include "Application.h"
#include "UserSettings.h"
#include "Workbench.h"
#include "WorkbenchManager.h"
using namespace Gui::Dialog;

View File

@@ -26,7 +26,7 @@
#ifndef GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H
#define GUI_DIALOG_DLGSETTINGSWORKBENCHES_IMP_H
#include "PropertyPage.h"
#include <Gui/PropertyPage.h>
#include <memory>
namespace Gui::Dialog {

View File

@@ -30,26 +30,27 @@
// INCLUDE YOUR PREFERENCE PAGES HERE
//
#include "DlgPreferencesImp.h"
#include "DlgSettings3DViewImp.h"
#include "DlgSettingsNavigation.h"
#include "DlgSettingsSelection.h"
#include "DlgSettingsViewColor.h"
#include "PreferencePages/DlgSettings3DViewImp.h"
#include "PreferencePages/DlgSettingsCacheDirectory.h"
#include "PreferencePages/DlgSettingsDocumentImp.h"
#include "PreferencePages/DlgSettingsEditor.h"
#include "PreferencePages/DlgSettingsGeneral.h"
#include "PreferencePages/DlgSettingsMacroImp.h"
#include "PreferencePages/DlgSettingsNavigation.h"
#include "PreferencePages/DlgSettingsNotificationArea.h"
#include "PreferencePages/DlgSettingsPythonConsole.h"
#include "PreferencePages/DlgSettingsReportView.h"
#include "PreferencePages/DlgSettingsSelection.h"
#include "DlgSettingsTheme.h"
#include "DlgSettingsGeneral.h"
#include "DlgEditorImp.h"
#include "DlgSettingsNotificationArea.h"
#include "DlgSettingsPythonConsole.h"
#include "DlgSettingsMacroImp.h"
#include "DlgSettingsDocumentImp.h"
#include "DlgSettingsReportView.h"
#include "DlgSettingsWorkbenchesImp.h"
#include "PreferencePages/DlgSettingsViewColor.h"
#include "PreferencePages/DlgSettingsWorkbenchesImp.h"
#include "DlgToolbarsImp.h"
#include "DlgActionsImp.h"
#include "DlgKeyboardImp.h"
#include "DlgCustomizeSpaceball.h"
#include "DlgCustomizeSpNavSettings.h"
#include "DlgSettingsCacheDirectory.h"
#include "InputField.h"
#include "QuantitySpinBox.h"
#include "PrefWidgets.h"
@@ -78,7 +79,7 @@ WidgetFactorySupplier::WidgetFactorySupplier()
new PrefPageProducer<DlgSettingsWorkbenchesImp> ( QT_TRANSLATE_NOOP("QObject","Workbenches") );
new PrefPageProducer<DlgSettingsMacroImp> ( 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
//