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"
msgstr ""
msgid "S&ound"
msgstr ""
msgid "&Preferences..."
msgstr ""

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -189,6 +189,9 @@ msgstr "&Обновлення значків рядка стану"
msgid "Take s&creenshot"
msgstr "Зробити &знімок"
msgid "S&ound"
msgstr "&Звук"
msgid "&Preferences..."
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"
msgstr "Chụp &màn hình"
msgid "S&ound"
msgstr "&Thanh âm"
msgid "&Preferences..."
msgstr "&Tùy biến..."

View File

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

View File

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

View File

@@ -270,7 +270,6 @@ MachineStatus::MachineStatus(QObject *parent)
, refreshTimer(new QTimer(this))
{
d = std::make_unique<MachineStatus::States>(this);
muteUnmuteAction = nullptr;
soundMenu = nullptr;
connect(refreshTimer, &QTimer::timeout, this, &MachineStatus::refreshIcons);
refreshTimer->start(75);
@@ -279,9 +278,9 @@ MachineStatus::MachineStatus(QObject *parent)
MachineStatus::~MachineStatus() = default;
void
MachineStatus::setSoundGainAction(QAction* action)
MachineStatus::setSoundMenu(QMenu* menu)
{
soundGainAction = action;
soundMenu = menu;
}
bool
@@ -519,28 +518,6 @@ MachineStatus::refresh(QStatusBar *sbar)
}
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) {
d->cassette.label = std::make_unique<ClickableLabel>();
d->cassette.setEmpty(QString(cassette_fname).isEmpty());
@@ -710,8 +687,6 @@ MachineStatus::refresh(QStatusBar *sbar)
d->sound = std::make_unique<ClickableLabel>();
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) {
this->soundMenu->popup(pos - QPoint(0, this->soundMenu->sizeHint().height()));
@@ -727,6 +702,13 @@ MachineStatus::refresh(QStatusBar *sbar)
refreshEmptyIcons();
}
void
MachineStatus::updateSoundIcon()
{
if (d->sound)
d->sound->setPixmap(sound_muted ? d->pixmaps.sound.disabled : d->pixmaps.sound.normal);
}
void
MachineStatus::message(const QString &msg)
{

View File

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

View File

@@ -180,7 +180,8 @@ MainWindow::MainWindow(QWidget *parent)
extern MainWindow *main_window;
main_window = 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->stackedWidget->setMouseTracking(true);
statusBar()->setVisible(!hide_status_bar);
@@ -1334,7 +1335,7 @@ void
MainWindow::refreshMediaMenu()
{
mm->refresh(ui->menuMedia);
status->setSoundGainAction(ui->actionSound_gain);
status->setSoundMenu(ui->menuSound);
status->refresh(ui->statusbar);
ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA));
ui->actionACPI_Shutdown->setEnabled(!!acpi_enabled);
@@ -1937,6 +1938,15 @@ MainWindow::on_actionTake_screenshot_triggered()
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
MainWindow::on_actionSound_gain_triggered()
{

View File

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

View File

@@ -87,13 +87,21 @@
<property name="title">
<string>&amp;Tools</string>
</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="actionUpdate_status_bar_icons"/>
<addaction name="separator"/>
<addaction name="actionEnable_Discord_integration"/>
<addaction name="separator"/>
<addaction name="actionTake_screenshot"/>
<addaction name="actionSound_gain"/>
<addaction name="menuSound"/>
<addaction name="separator"/>
<addaction name="actionPreferences"/>
<addaction name="separator"/>
@@ -725,6 +733,11 @@
<bool>false</bool>
</property>
</action>
<action name="actionMute_Unmute">
<property name="text">
<string>&amp;Mute</string>
</property>
</action>
<action name="actionSound_gain">
<property name="text">
<string>Sound &amp;gain...</string>