forked from FreeCAD/FreeCAD
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* checkpoint - fix warnings, add tooltip, check for valid shape * checkpoint - remove warnings * checkpoint - parent properties to children * checkpoint - get initial property values from config * checkpoint - add preference getters * checkpoint - inheritance & property init * checkpoint - add Appearance pref page * checkpoint - use prefs for default values * checkpoint - move vpMeasurementBase to MeasureGui --------- Co-authored-by: wandererfan <[email protected]>
- Loading branch information
1 parent
9a47907
commit ebce989
Showing
23 changed files
with
1,307 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/*************************************************************************** | ||
* Copyright (c) 2023 WandererFan <[email protected]> * | ||
* * | ||
* 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 <string> | ||
#endif | ||
|
||
#include <App/Application.h> | ||
#include <App/Material.h> | ||
#include <Base/Console.h> | ||
#include <Base/Parameter.h> | ||
|
||
#include "Preferences.h" | ||
|
||
|
||
//getters for parameters used in multiple places. | ||
//ensure this is in sync with parameter names and default values on preference pages | ||
|
||
using namespace Measure; | ||
|
||
//! Returns the Measure preference group | ||
Base::Reference<ParameterGrp> Preferences::getPreferenceGroup(const char* Name) | ||
{ | ||
return App::GetApplication().GetUserParameter().GetGroup("BaseApp/Preferences/Mod/Measure")->GetGroup(Name); | ||
} | ||
|
||
App::Color Preferences::defaultLineColor() | ||
{ | ||
App::Color fcColor; | ||
fcColor.setPackedValue(getPreferenceGroup("Appearance")->GetUnsigned("DefaultLineColor", 0xFFFFFFFF)); | ||
return fcColor; | ||
} | ||
|
||
App::Color Preferences::defaultTextColor() | ||
{ | ||
App::Color fcColor; | ||
fcColor.setPackedValue(getPreferenceGroup("Appearance")->GetUnsigned("DefaultTextColor", 0xFFFFFFFF)); | ||
return fcColor; | ||
} | ||
|
||
double Preferences::defaultDistFactor() | ||
{ | ||
return getPreferenceGroup("Appearance")->GetFloat("DefaultDistFactor", 1.0); | ||
} | ||
|
||
int Preferences::defaultFontSize() | ||
{ | ||
return getPreferenceGroup("Appearance")->GetInt("DefaultFontSize", 0); | ||
} | ||
|
||
bool Preferences::defaultMirror() | ||
{ | ||
return getPreferenceGroup("Appearance")->GetBool("DefaultMirror", false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/*************************************************************************** | ||
* Copyright (c) 2023 WandererFan <[email protected]> * | ||
* * | ||
* 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 Preferences_h_ | ||
#define Preferences_h_ | ||
|
||
#include <string> | ||
|
||
#include <Base/Parameter.h> | ||
#include <Mod/Measure/MeasureGlobal.h> | ||
|
||
|
||
namespace App | ||
{ | ||
class Color; | ||
} | ||
|
||
namespace Measure | ||
{ | ||
|
||
//getters for parameters used in multiple places. | ||
class MeasureExport Preferences | ||
{ | ||
|
||
public: | ||
static Base::Reference<ParameterGrp> getPreferenceGroup(const char* Name); | ||
|
||
static App::Color defaultLineColor(); | ||
static App::Color defaultTextColor(); | ||
static double defaultDistFactor(); | ||
static int defaultFontSize(); | ||
static bool defaultMirror(); | ||
}; | ||
|
||
|
||
}//end namespace Measure | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/************************************************************************** | ||
* Copyright (c) 2023 Wanderer Fan <[email protected]> * | ||
* * | ||
* 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 "DlgPrefsMeasureAppearanceImp.h" | ||
#include "ui_DlgPrefsMeasureAppearanceImp.h" | ||
|
||
using namespace MeasureGui; | ||
|
||
DlgPrefsMeasureAppearanceImp::DlgPrefsMeasureAppearanceImp( QWidget* parent ) | ||
: PreferencePage( parent ) | ||
, ui(new Ui_DlgPrefsMeasureAppearanceImp) | ||
{ | ||
ui->setupUi(this); | ||
} | ||
|
||
DlgPrefsMeasureAppearanceImp::~DlgPrefsMeasureAppearanceImp() | ||
{ | ||
// no need to delete child widgets, Qt does it all for us | ||
} | ||
|
||
void DlgPrefsMeasureAppearanceImp::saveSettings() | ||
{ | ||
ui->cbMirror->onSave(); | ||
ui->dsbDistFactor->onSave(); | ||
ui->sbFontSize->onSave(); | ||
ui->cbText->onSave(); | ||
ui->cbLine->onSave(); | ||
} | ||
|
||
void DlgPrefsMeasureAppearanceImp::loadSettings() | ||
{ | ||
ui->sbFontSize->onRestore(); | ||
ui->cbText->onRestore(); | ||
ui->cbLine->onRestore(); | ||
ui->cbMirror->onRestore(); | ||
ui->dsbDistFactor->onRestore(); | ||
} | ||
|
||
/** | ||
* Sets the strings of the subwidgets using the current language. | ||
*/ | ||
void DlgPrefsMeasureAppearanceImp::changeEvent(QEvent *e) | ||
{ | ||
if (e->type() == QEvent::LanguageChange) { | ||
saveSettings(); | ||
ui->retranslateUi(this); | ||
loadSettings(); | ||
} | ||
else { | ||
QWidget::changeEvent(e); | ||
} | ||
} | ||
|
||
#include <Mod/Measure/Gui/moc_DlgPrefsMeasureAppearanceImp.cpp> | ||
|
Oops, something went wrong.