MCPcopy Create free account
hub / github.com/IENT/YUView / SettingsDialog

Method SettingsDialog

YUViewLib/src/ui/SettingsDialog.cpp:52–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50#define MIN_CACHE_SIZE_IN_MB (20u)
51
52SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent)
53{
54 ui.setupUi(this);
55
56 // Set the minimum and maximum values for memory
57 ui.labelMaxMb->setText(QString("%1 MB").arg(functions::systemMemorySizeInMB()));
58 ui.labelMinMB->setText(QString("%1 MB").arg(functions::systemMemorySizeInMB() / 100));
59
60 // --- Load the current settings from the QSettings ---
61 QSettings settings;
62
63 // "Generals" tab
64 ui.checkBoxWatchFiles->setChecked(settings.value("WatchFiles", true).toBool());
65 ui.checkBoxAskToSave->setChecked(settings.value("AskToSaveOnExit", true).toBool());
66 ui.checkBoxContinuePlaybackNewSelection->setChecked(
67 settings.value("ContinuePlaybackOnSequenceSelection", false).toBool());
68 ui.checkBoxSavePositionPerItem->setChecked(
69 settings.value("SavePositionAndZoomPerItem", false).toBool());
70 // UI
71 const auto theme = settings.value("Theme", "Default").toString();
72 int themeIdx = functions::getThemeNameList().indexOf(theme);
73 if (themeIdx < 0)
74 themeIdx = 0;
75 ui.comboBoxTheme->addItems(functions::getThemeNameList());
76 ui.comboBoxTheme->setCurrentIndex(themeIdx);
77 // Central view settings
78 const auto splittingStyleString = settings.value("SplitViewLineStyle", "Solid Line").toString();
79 if (splittingStyleString == "Handlers")
80 ui.comboBoxSplitLineStyle->setCurrentIndex(1);
81 else
82 ui.comboBoxSplitLineStyle->setCurrentIndex(0);
83 const auto mouseModeString = settings.value("MouseMode", "Left Zoom, Right Move").toString();
84 if (mouseModeString == "Left Zoom, Right Move")
85 ui.comboBoxMouseMode->setCurrentIndex(0);
86 else
87 ui.comboBoxMouseMode->setCurrentIndex(1);
88 ui.viewBackgroundColor->setPlainColor(settings.value("View/BackgroundColor").value<QColor>());
89 ui.viewGridLineColor->setPlainColor(settings.value("View/GridColor").value<QColor>());
90 ui.plotBackgroundColor->setPlainColor(settings.value("Plot/BackgroundColor").value<QColor>());
91 ui.checkBoxPlaybackControlFullScreen->setChecked(
92 settings.value("ShowPlaybackControlFullScreen", false).toBool());
93 ui.checkBoxShowFilePathSplitMode->setChecked(
94 settings.value("ShowFilePathInSplitMode", true).toBool());
95 ui.checkBoxPixelValuesHex->setChecked(settings.value("ShowPixelValuesHex", false).toBool());
96 // Updates settings
97 settings.beginGroup("updates");
98 const auto checkForUpdates = settings.value("checkForUpdates", true).toBool();
99 ui.groupBoxUpdates->setChecked(checkForUpdates);
100 if (UPDATE_FEATURE_ENABLE)
101 {
102 const auto updateBehavior = settings.value("updateBehavior", "ask").toString();
103 if (updateBehavior == "ask")
104 ui.comboBoxUpdateSettings->setCurrentIndex(1);
105 else if (updateBehavior == "auto")
106 ui.comboBoxUpdateSettings->setCurrentIndex(0);
107 }
108 else
109 {

Callers

nothing calls this directly

Calls 9

systemMemorySizeInMBFunction · 0.85
getThemeNameListFunction · 0.85
getOptimalThreadCountFunction · 0.85
setupUiMethod · 0.80
setTextMethod · 0.80
toStringMethod · 0.80
indexOfMethod · 0.80
setPlainColorMethod · 0.80
getNameMethod · 0.45

Tested by

no test coverage detected