Skip to content

Commit

Permalink
introduce default YAxisMinMaxMode
Browse files Browse the repository at this point in the history
  • Loading branch information
ElderOrb committed Jul 8, 2024
1 parent 5f20089 commit a9de8f9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions Source/Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct per_group
const bool CheckedByDefault;
const char* Description;
activefilter ActiveFilterGroup;
const char* YAxisMinMaxMode;
};

struct per_item
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/VideoCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct per_group VideoPerGroup [Group_VideoMax]=
"LOW (10th percentile), and HIGH (90th percentile) values for each frame.\n"
"The Y plane provides information about video brightness or luminance.",
ActiveFilter_Video_signalstats,
"MinMaxOfThePlot",
},
//U
{
Expand All @@ -25,6 +26,7 @@ struct per_group VideoPerGroup [Group_VideoMax]=
"LOW (10th percentile), and HIGH (90th percentile) values for each frame.\n"
"The U plane (along with V) provides information about video color.",
ActiveFilter_Video_signalstats,
"Formula",
},
//V
{
Expand All @@ -33,6 +35,7 @@ struct per_group VideoPerGroup [Group_VideoMax]=
"LOW (10th percentile), and HIGH (90th percentile) values for each frame.\n"
"The V plane (along with U) provides information about video color.",
ActiveFilter_Video_signalstats,
"Custom;0;55"
},
//YDiff
{
Expand Down
23 changes: 17 additions & 6 deletions Source/GUI/Plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,12 +813,8 @@ Plot::Plot( size_t streamPos, size_t Type, size_t Group, const FileInformation*
panner->setMouseButton( Qt::MiddleButton );
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

QSettings settings;
settings.beginGroup("yminmax");

QMetaEnum metaEnum = QMetaEnum::fromType<Plot::YMinMaxMode>();
QString value = settings.value(QString::number(m_group)).toString();
if(!value.isEmpty()) {
auto applyYMinMaxMode = [&](QString value) {
QMetaEnum metaEnum = QMetaEnum::fromType<Plot::YMinMaxMode>();
auto splitted = value.split(";");
auto yMinMaxMode = (Plot::YMinMaxMode) metaEnum.keyToValue(splitted[0].toLatin1().constData());

Expand All @@ -830,6 +826,21 @@ Plot::Plot( size_t streamPos, size_t Type, size_t Group, const FileInformation*
}

setYAxisMinMaxMode(yMinMaxMode);
};

if(group.YAxisMinMaxMode) {
QString yMinMaxModeStringValue = group.YAxisMinMaxMode;
qDebug() << "applying default yMinMaxMode: " << yMinMaxModeStringValue;
applyYMinMaxMode(yMinMaxModeStringValue);
}

QSettings settings;
settings.beginGroup("yminmax");

QString value = settings.value(QString::number(m_group)).toString();
if(!value.isEmpty()) {
qDebug() << "applying yMinMaxMode from settings: " << value;
applyYMinMaxMode(value);
}

settings.endGroup();
Expand Down

0 comments on commit a9de8f9

Please sign in to comment.