qt: Save button label setting

This commit is contained in:
rainmakerv2 2025-06-04 19:14:48 +08:00
parent 23710f397e
commit 70673102fa
4 changed files with 8 additions and 15 deletions

View File

@ -180,10 +180,6 @@ bool getShowLabelsUnderIcons() {
return showLabelsUnderIcons;
}
bool setShowLabelsUnderIcons() {
return false;
}
std::string getFullscreenMode() {
return fullscreenMode;
}
@ -431,7 +427,8 @@ void setVblankDiv(u32 value) {
void setIsFullscreen(bool enable) {
isFullscreen = enable;
}
static void setShowLabelsUnderIcons(bool enable) {
void setShowLabelsUnderIcons(bool enable) {
showLabelsUnderIcons = enable;
}
@ -882,6 +879,7 @@ void load(const std::filesystem::path& path) {
emulator_language = toml::find_or<std::string>(gui, "emulatorLanguage", "en_US");
backgroundImageOpacity = toml::find_or<int>(gui, "backgroundImageOpacity", 50);
showBackgroundImage = toml::find_or<bool>(gui, "showBackgroundImage", true);
showLabelsUnderIcons = toml::find_or<bool>(gui, "showLabels", true);
}
if (data.contains("Settings")) {
@ -1096,6 +1094,7 @@ void saveMainWindow(const std::filesystem::path& path) {
data["GUI"]["geometry_h"] = main_window_geometry_h;
data["GUI"]["elfDirs"] = m_elf_viewer;
data["GUI"]["recentFiles"] = m_recent_files;
data["GUI"]["showLabels"] = showLabelsUnderIcons;
// Sorting of TOML sections
sortTomlSections(data);

View File

@ -27,7 +27,6 @@ std::filesystem::path GetSaveDataPath();
void setLoadGameSizeEnabled(bool enable);
bool getIsFullscreen();
bool getShowLabelsUnderIcons();
bool setShowLabelsUnderIcons();
std::string getFullscreenMode();
bool isNeoModeConsole();
bool isDevKitConsole();
@ -157,6 +156,7 @@ void setMainWindowHeight(u32 height);
void setElfViewer(const std::vector<std::string>& elfList);
void setRecentFiles(const std::vector<std::string>& recentFiles);
void setEmulatorLanguage(std::string language);
void setShowLabelsUnderIcons(bool enable);
u32 getMainWindowGeometryX();
u32 getMainWindowGeometryY();

View File

@ -138,9 +138,8 @@ void MainWindow::PauseGame() {
}
void MainWindow::toggleLabelsUnderIcons() {
bool showLabels = ui->toggleLabelsAct->isChecked();
Config::setShowLabelsUnderIcons();
UpdateToolbarLabels();
Config::setShowLabelsUnderIcons(ui->toggleLabelsAct->isChecked());
AddUiWidgets();
if (isGameRunning) {
UpdateToolbarButtons();
}
@ -187,7 +186,7 @@ void MainWindow::AddUiWidgets() {
// add toolbar widgets
QApplication::setStyle("Fusion");
bool showLabels = ui->toggleLabelsAct->isChecked();
bool showLabels = Config::getShowLabelsUnderIcons();
ui->toolBar->clear();
ui->toolBar->addWidget(createSpacer(this));
@ -280,10 +279,6 @@ void MainWindow::UpdateToolbarButtons() {
}
}
void MainWindow::UpdateToolbarLabels() {
AddUiWidgets();
}
void MainWindow::CreateDockWindows() {
// place holder widget is needed for good health they say :)
QWidget* phCentralWidget = new QWidget(this);

View File

@ -52,7 +52,6 @@ private Q_SLOTS:
private:
Ui_MainWindow* ui;
void AddUiWidgets();
void UpdateToolbarLabels();
void UpdateToolbarButtons();
QWidget* createButtonWithLabel(QPushButton* button, const QString& labelText, bool showLabel);
void CreateActions();