Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Measure] Remove unused properties from measure preferences #13811

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/Mod/Measure/App/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
App::Color Preferences::defaultLineColor()
{
App::Color fcColor;
fcColor.setPackedValue(getPreferenceGroup("Appearance")->GetUnsigned("DefaultLineColor", 0xFFFFFFFF));

Check warning on line 49 in src/Mod/Measure/App/Preferences.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

0xFFFFFFFF is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
return fcColor;
}

Expand All @@ -60,21 +60,11 @@
App::Color Preferences::defaultTextBackgroundColor()
{
App::Color fcColor;
fcColor.setPackedValue(getPreferenceGroup("Appearance")->GetUnsigned("DefaultTextBackgroundColor", 0xFFFFFFFF));

Check warning on line 63 in src/Mod/Measure/App/Preferences.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

0xFFFFFFFF is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
return fcColor;
}

double Preferences::defaultDistFactor()
{
return getPreferenceGroup("Appearance")->GetFloat("DefaultDistFactor", 1.0);
}

int Preferences::defaultFontSize()
{
return getPreferenceGroup("Appearance")->GetInt("DefaultFontSize", 18);

Check warning on line 69 in src/Mod/Measure/App/Preferences.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

narrowing conversion from 'long' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

Check warning on line 69 in src/Mod/Measure/App/Preferences.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

18 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
}

bool Preferences::defaultMirror()
{
return getPreferenceGroup("Appearance")->GetBool("DefaultMirror", false);
}
2 changes: 0 additions & 2 deletions src/Mod/Measure/App/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ class MeasureExport Preferences

static App::Color defaultLineColor();
static App::Color defaultTextColor();
static double defaultDistFactor();
static int defaultFontSize();
static bool defaultMirror();
static App::Color defaultTextBackgroundColor();
};

Expand Down
4 changes: 0 additions & 4 deletions src/Mod/Measure/Gui/DlgPrefsMeasureAppearanceImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "PreCompiled.h"

#include "DlgPrefsMeasureAppearanceImp.h"
#include "ui_DlgPrefsMeasureAppearanceImp.h"

Check failure on line 25 in src/Mod/Measure/Gui/DlgPrefsMeasureAppearanceImp.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

'ui_DlgPrefsMeasureAppearanceImp.h' file not found [clang-diagnostic-error]

using namespace MeasureGui;

Expand All @@ -33,15 +33,13 @@
ui->setupUi(this);
}

DlgPrefsMeasureAppearanceImp::~DlgPrefsMeasureAppearanceImp()

Check warning on line 36 in src/Mod/Measure/Gui/DlgPrefsMeasureAppearanceImp.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

use '= default' to define a trivial destructor [modernize-use-equals-default]
{
// 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();
Expand All @@ -54,22 +52,20 @@
ui->cbText->onRestore();
ui->cbBackground->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)

Check warning on line 60 in src/Mod/Measure/Gui/DlgPrefsMeasureAppearanceImp.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

parameter name 'e' is too short, expected at least 2 characters [readability-identifier-length]
{
if (e->type() == QEvent::LanguageChange) {
ui->retranslateUi(this);
}
else {
QWidget::changeEvent(e);

Check warning on line 66 in src/Mod/Measure/Gui/DlgPrefsMeasureAppearanceImp.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

qualified name 'QWidget::changeEvent' refers to a member overridden in subclass; did you mean 'Gui::Dialog::PreferencePage'? [bugprone-parent-virtual-call]
}
}

#include <Mod/Measure/Gui/moc_DlgPrefsMeasureAppearanceImp.cpp>

Check warning on line 70 in src/Mod/Measure/Gui/DlgPrefsMeasureAppearanceImp.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]

120 changes: 37 additions & 83 deletions src/Mod/Measure/Gui/DlgPrefsMeasureAppearanceImp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -52,35 +52,18 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_5" columnstretch="1,1">
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<layout class="QGridLayout" name="gridLayout_5" columnstretch="2,1">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Distance Factor</string>
<string>Text size</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Text color</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::PrefColorButton" name="cbText">
<property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>DefaultTextColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Measure/Appearance</cstring>
<string>Line color</string>
</property>
</widget>
</item>
Expand All @@ -103,90 +86,71 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::PrefColorButton" name="cbLine">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="color">
<item row="3" column="1">
<widget class="Gui::PrefColorButton" name="cbBackground">
<property name="color" stdset="0">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>DefaultLineColor</cstring>
<cstring>DefaultTextBackgroundColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Measure/Appearance</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Text size</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefDoubleSpinBox" name="dsbDistFactor">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>DefaultDistFactor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Measure/Appearance</cstring>
<string>Background color</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Line color</string>
<item row="2" column="1">
<widget class="Gui::PrefColorButton" name="cbLine">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="Gui::PrefCheckBox" name="cbMirror">
<property name="text">
<string>Mirror</string>
<property name="color" stdset="0">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>DefaultMirror</cstring>
<cstring>DefaultLineColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Measure/Appearance</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Background color</string>
<string>Text color</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::PrefColorButton" name="cbBackground">
<property name="color">
<item row="1" column="1">
<widget class="Gui::PrefColorButton" name="cbText">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>DefaultTextBackgroundColor</cstring>
<cstring>DefaultTextColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Measure/Appearance</cstring>
Expand Down Expand Up @@ -229,16 +193,6 @@
<extends>Gui::ColorButton</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Resources/Measure.qrc"/>
Expand Down