qt: The sound icon's menu is now a submenu of the Tools menu

Replaces (and includes) the standalone Sound gain option
This commit is contained in:
Alexander Babikov
2025-04-11 05:26:01 +05:00
parent 1819539c97
commit 40ee98d6f3
29 changed files with 110 additions and 33 deletions

View File

@@ -189,6 +189,9 @@ msgstr ""
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "" msgstr ""
msgid "S&ound"
msgstr ""
msgid "&Preferences..." msgid "&Preferences..."
msgstr "" msgstr ""

View File

@@ -189,6 +189,9 @@ msgstr "&Actualitzar icones a la barra d'estat"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Prendre c&aptura" msgstr "Prendre c&aptura"
msgid "S&ound"
msgstr "S&o"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Preferències ..." msgstr "&Preferències ..."

View File

@@ -189,6 +189,9 @@ msgstr "&Aktualizovat ikony stavového řádku"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Pořídit &screenshot" msgstr "Pořídit &screenshot"
msgid "S&ound"
msgstr "&Zvuk"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Předvolby..." msgstr "&Předvolby..."

View File

@@ -189,6 +189,9 @@ msgstr "&Statusleistenicons aktualisieren"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "S&creenshot aufnehmen" msgstr "S&creenshot aufnehmen"
msgid "S&ound"
msgstr "S&ound"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Einstellungen..." msgstr "&Einstellungen..."

View File

@@ -189,6 +189,9 @@ msgstr "&Actualizar iconos en barra de estado"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Tomar c&aptura" msgstr "Tomar c&aptura"
msgid "S&ound"
msgstr "S&onido"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Preferencias..." msgstr "&Preferencias..."

View File

@@ -189,6 +189,9 @@ msgstr "&Päivitä tilapalkin kuvakkeita"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Ota &kuvakaappaus" msgstr "Ota &kuvakaappaus"
msgid "S&ound"
msgstr "&Ääni"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Sovellusasetukset..." msgstr "&Sovellusasetukset..."

View File

@@ -189,6 +189,9 @@ msgstr "Mettre à jour la barre de stat&us"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Copie &Ecran" msgstr "Copie &Ecran"
msgid "S&ound"
msgstr "S&on"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Préférences..." msgstr "&Préférences..."

View File

@@ -189,6 +189,9 @@ msgstr "&Ažuriraj ikone statusnog redka"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Napravi &snimku zaslona" msgstr "Napravi &snimku zaslona"
msgid "S&ound"
msgstr "&Zvuk"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Postavke..." msgstr "&Postavke..."

View File

@@ -189,6 +189,9 @@ msgstr "Állapotsori ikonok &frissítése"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "&Képernyőkép készítése" msgstr "&Képernyőkép készítése"
msgid "S&ound"
msgstr "&Hang"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Beállítások..." msgstr "&Beállítások..."

View File

@@ -189,6 +189,9 @@ msgstr "&Aggiorna icone della barra di stato"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Cattura schermata" msgstr "Cattura schermata"
msgid "S&ound"
msgstr "A&udio"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Preferenze..." msgstr "&Preferenze..."

View File

@@ -189,6 +189,9 @@ msgstr "ステータスバーのアイコンを更新(&U)"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "スクリーンショットを撮る(&C)" msgstr "スクリーンショットを撮る(&C)"
msgid "S&ound"
msgstr "サウンド(&O)"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "環境設定(&P)..." msgstr "環境設定(&P)..."

View File

@@ -189,6 +189,9 @@ msgstr "상태 바 아이콘 갱신하기(&U)"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "스크린샷 찍기(&C)" msgstr "스크린샷 찍기(&C)"
msgid "S&ound"
msgstr "사운드(&O)"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "환경설정(&P)..." msgstr "환경설정(&P)..."

View File

@@ -189,6 +189,9 @@ msgstr "&Statusbalkpictogrammen bijwerken"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Maak een schermafbeelding" msgstr "Maak een schermafbeelding"
msgid "S&ound"
msgstr "&Geluid"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Voorkeuren..." msgstr "&Voorkeuren..."

View File

@@ -189,6 +189,9 @@ msgstr "&Aktualizuj ikony na pasku statusu"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Zrób &zrzut ekranu" msgstr "Zrób &zrzut ekranu"
msgid "S&ound"
msgstr "Dź&więk"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Preferencje..." msgstr "&Preferencje..."

View File

@@ -189,6 +189,9 @@ msgstr "&Atualizar ícones da barra de status"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Capturar &tela" msgstr "Capturar &tela"
msgid "S&ound"
msgstr "&Som"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Preferências..." msgstr "&Preferências..."

View File

@@ -189,6 +189,9 @@ msgstr "&Atualizar ícones da barra de estado"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Gravar imagem de ecrã" msgstr "Gravar imagem de ecrã"
msgid "S&ound"
msgstr "&Som"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Preferências..." msgstr "&Preferências..."

View File

@@ -189,6 +189,9 @@ msgstr "&Обновление значков строки состояния"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Сделать с&криншот" msgstr "Сделать с&криншот"
msgid "S&ound"
msgstr "&Звук"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Параметры..." msgstr "&Параметры..."

View File

@@ -189,6 +189,9 @@ msgstr "&Aktualizovať ikony na stavovom riadku"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Urobiť snímku &obrazovky" msgstr "Urobiť snímku &obrazovky"
msgid "S&ound"
msgstr "&Zvuk"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Predvoľby..." msgstr "&Predvoľby..."

View File

@@ -189,6 +189,9 @@ msgstr "&Posodabljaj ikone statusne vrstice"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "&Zajemi posnetek zaslona" msgstr "&Zajemi posnetek zaslona"
msgid "S&ound"
msgstr "Z&vok"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Možnosti..." msgstr "&Možnosti..."

View File

@@ -195,6 +195,9 @@ msgstr "&Tercihler..."
msgid "Enable &Discord integration" msgid "Enable &Discord integration"
msgstr "&Discord entegrasyonunu etkinleştir" msgstr "&Discord entegrasyonunu etkinleştir"
msgid "S&ound"
msgstr "&Ses"
msgid "Sound &gain..." msgid "Sound &gain..."
msgstr "&Ses düzeyi artışı..." msgstr "&Ses düzeyi artışı..."

View File

@@ -189,6 +189,9 @@ msgstr "&Обновлення значків рядка стану"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Зробити &знімок" msgstr "Зробити &знімок"
msgid "S&ound"
msgstr "&Звук"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Параметри..." msgstr "&Параметри..."

View File

@@ -189,6 +189,9 @@ msgstr "Cậ&p nhật biểu tượng thanh trạng thái"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "Chụp &màn hình" msgstr "Chụp &màn hình"
msgid "S&ound"
msgstr "&Thanh âm"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "&Tùy biến..." msgstr "&Tùy biến..."

View File

@@ -189,6 +189,9 @@ msgstr "更新状态栏图标(&U)"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "截图(&C)" msgstr "截图(&C)"
msgid "S&ound"
msgstr "声音(&O)"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "首选项(&P)..." msgstr "首选项(&P)..."

View File

@@ -189,6 +189,9 @@ msgstr "更新狀態列圖示(&U)"
msgid "Take s&creenshot" msgid "Take s&creenshot"
msgstr "擷圖(&C)" msgstr "擷圖(&C)"
msgid "S&ound"
msgstr "聲音(&O)"
msgid "&Preferences..." msgid "&Preferences..."
msgstr "偏好設定(&P)..." msgstr "偏好設定(&P)..."

View File

@@ -270,7 +270,6 @@ MachineStatus::MachineStatus(QObject *parent)
, refreshTimer(new QTimer(this)) , refreshTimer(new QTimer(this))
{ {
d = std::make_unique<MachineStatus::States>(this); d = std::make_unique<MachineStatus::States>(this);
muteUnmuteAction = nullptr;
soundMenu = nullptr; soundMenu = nullptr;
connect(refreshTimer, &QTimer::timeout, this, &MachineStatus::refreshIcons); connect(refreshTimer, &QTimer::timeout, this, &MachineStatus::refreshIcons);
refreshTimer->start(75); refreshTimer->start(75);
@@ -279,9 +278,9 @@ MachineStatus::MachineStatus(QObject *parent)
MachineStatus::~MachineStatus() = default; MachineStatus::~MachineStatus() = default;
void void
MachineStatus::setSoundGainAction(QAction* action) MachineStatus::setSoundMenu(QMenu* menu)
{ {
soundGainAction = action; soundMenu = menu;
} }
bool bool
@@ -519,28 +518,6 @@ MachineStatus::refresh(QStatusBar *sbar)
} }
sbar->removeWidget(d->sound.get()); sbar->removeWidget(d->sound.get());
if (!muteUnmuteAction) {
muteUnmuteAction = new QAction;
connect(muteUnmuteAction, &QAction::triggered, this, [this]() {
sound_muted ^= 1;
config_save();
if (d->sound)
d->sound->setPixmap(sound_muted ? d->pixmaps.sound.disabled : d->pixmaps.sound.normal);
muteUnmuteAction->setText(sound_muted ? tr("&Unmute") : tr("&Mute"));
});
}
if (!soundMenu) {
soundMenu = new QMenu((QWidget*)parent());
soundMenu->addAction(muteUnmuteAction);
soundMenu->addSeparator();
soundMenu->addAction(soundGainAction);
muteUnmuteAction->setParent(soundMenu);
}
if (cassette_enable) { if (cassette_enable) {
d->cassette.label = std::make_unique<ClickableLabel>(); d->cassette.label = std::make_unique<ClickableLabel>();
d->cassette.setEmpty(QString(cassette_fname).isEmpty()); d->cassette.setEmpty(QString(cassette_fname).isEmpty());
@@ -710,8 +687,6 @@ MachineStatus::refresh(QStatusBar *sbar)
d->sound = std::make_unique<ClickableLabel>(); d->sound = std::make_unique<ClickableLabel>();
d->sound->setPixmap(sound_muted ? d->pixmaps.sound.disabled : d->pixmaps.sound.normal); d->sound->setPixmap(sound_muted ? d->pixmaps.sound.disabled : d->pixmaps.sound.normal);
if (muteUnmuteAction)
muteUnmuteAction->setText(sound_muted ? tr("&Unmute") : tr("&Mute"));
connect(d->sound.get(), &ClickableLabel::clicked, this, [this](QPoint pos) { connect(d->sound.get(), &ClickableLabel::clicked, this, [this](QPoint pos) {
this->soundMenu->popup(pos - QPoint(0, this->soundMenu->sizeHint().height())); this->soundMenu->popup(pos - QPoint(0, this->soundMenu->sizeHint().height()));
@@ -727,6 +702,13 @@ MachineStatus::refresh(QStatusBar *sbar)
refreshEmptyIcons(); refreshEmptyIcons();
} }
void
MachineStatus::updateSoundIcon()
{
if (d->sound)
d->sound->setPixmap(sound_muted ? d->pixmaps.sound.disabled : d->pixmaps.sound.normal);
}
void void
MachineStatus::message(const QString &msg) MachineStatus::message(const QString &msg)
{ {

View File

@@ -73,20 +73,19 @@ public:
QString getMessage(); QString getMessage();
void clearActivity(); void clearActivity();
void setSoundGainAction(QAction* action); void setSoundMenu(QMenu* menu);
public slots: public slots:
void refresh(QStatusBar *sbar); void refresh(QStatusBar *sbar);
void message(const QString &msg); void message(const QString &msg);
void updateTip(int tag); void updateTip(int tag);
void refreshEmptyIcons(); void refreshEmptyIcons();
void refreshIcons(); void refreshIcons();
void updateSoundIcon();
private: private:
struct States; struct States;
std::unique_ptr<States> d; std::unique_ptr<States> d;
QTimer *refreshTimer; QTimer *refreshTimer;
QAction *soundGainAction;
QAction *muteUnmuteAction;
QMenu *soundMenu; QMenu *soundMenu;
}; };

View File

@@ -180,7 +180,8 @@ MainWindow::MainWindow(QWidget *parent)
extern MainWindow *main_window; extern MainWindow *main_window;
main_window = this; main_window = this;
ui->setupUi(this); ui->setupUi(this);
status->setSoundGainAction(ui->actionSound_gain); status->setSoundMenu(ui->menuSound);
ui->actionMute_Unmute->setText(sound_muted ? tr("&Unmute") : tr("&Mute"));
ui->menuEGA_S_VGA_settings->menuAction()->setMenuRole(QAction::NoRole); ui->menuEGA_S_VGA_settings->menuAction()->setMenuRole(QAction::NoRole);
ui->stackedWidget->setMouseTracking(true); ui->stackedWidget->setMouseTracking(true);
statusBar()->setVisible(!hide_status_bar); statusBar()->setVisible(!hide_status_bar);
@@ -1334,7 +1335,7 @@ void
MainWindow::refreshMediaMenu() MainWindow::refreshMediaMenu()
{ {
mm->refresh(ui->menuMedia); mm->refresh(ui->menuMedia);
status->setSoundGainAction(ui->actionSound_gain); status->setSoundMenu(ui->menuSound);
status->refresh(ui->statusbar); status->refresh(ui->statusbar);
ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA)); ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA));
ui->actionACPI_Shutdown->setEnabled(!!acpi_enabled); ui->actionACPI_Shutdown->setEnabled(!!acpi_enabled);
@@ -1937,6 +1938,15 @@ MainWindow::on_actionTake_screenshot_triggered()
device_force_redraw(); device_force_redraw();
} }
void
MainWindow::on_actionMute_Unmute_triggered()
{
sound_muted ^= 1;
config_save();
status->updateSoundIcon();
ui->actionMute_Unmute->setText(sound_muted ? tr("&Unmute") : tr("&Mute"));
}
void void
MainWindow::on_actionSound_gain_triggered() MainWindow::on_actionSound_gain_triggered()
{ {

View File

@@ -116,6 +116,7 @@ private slots:
void on_actionHide_tool_bar_triggered(); void on_actionHide_tool_bar_triggered();
void on_actionUpdate_status_bar_icons_triggered(); void on_actionUpdate_status_bar_icons_triggered();
void on_actionTake_screenshot_triggered(); void on_actionTake_screenshot_triggered();
void on_actionMute_Unmute_triggered();
void on_actionSound_gain_triggered(); void on_actionSound_gain_triggered();
void on_actionPreferences_triggered(); void on_actionPreferences_triggered();
void on_actionEnable_Discord_integration_triggered(bool checked); void on_actionEnable_Discord_integration_triggered(bool checked);

View File

@@ -87,13 +87,21 @@
<property name="title"> <property name="title">
<string>&amp;Tools</string> <string>&amp;Tools</string>
</property> </property>
<widget class="QMenu" name="menuSound">
<property name="title">
<string>S&amp;ound</string>
</property>
<addaction name="actionMute_Unmute"/>
<addaction name="separator"/>
<addaction name="actionSound_gain"/>
</widget>
<addaction name="actionSettings"/> <addaction name="actionSettings"/>
<addaction name="actionUpdate_status_bar_icons"/> <addaction name="actionUpdate_status_bar_icons"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionEnable_Discord_integration"/> <addaction name="actionEnable_Discord_integration"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionTake_screenshot"/> <addaction name="actionTake_screenshot"/>
<addaction name="actionSound_gain"/> <addaction name="menuSound"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionPreferences"/> <addaction name="actionPreferences"/>
<addaction name="separator"/> <addaction name="separator"/>
@@ -725,6 +733,11 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
</action> </action>
<action name="actionMute_Unmute">
<property name="text">
<string>&amp;Mute</string>
</property>
</action>
<action name="actionSound_gain"> <action name="actionSound_gain">
<property name="text"> <property name="text">
<string>Sound &amp;gain...</string> <string>Sound &amp;gain...</string>