summaryrefslogtreecommitdiffstats
path: root/src/app/stateChange.cpp
diff options
context:
space:
mode:
authormio <stigma@disroot.org>2024-10-06 10:41:24 +1000
committermio <stigma@disroot.org>2024-10-06 17:16:41 +1000
commitf460840a5e1c4e6cc262177f2b60cebfe469d393 (patch)
tree97a47405e1714970d9eda9616ac3450a0ca2ccfb /src/app/stateChange.cpp
parentcc8974895a02a98823419846e75f23651aa0abc0 (diff)
downloadcodeine-f460840a5e1c4e6cc262177f2b60cebfe469d393.tar.gz
codeine-f460840a5e1c4e6cc262177f2b60cebfe469d393.zip
Fix channel selection menus disappearing
When adding/removing an action to/from the toolbar, the aspect ratio, audio channel, and subtitle channel menus would disappear from the parent settings menu. My understanding is that this happened because nothing was keeping those menus present (plugged?) when other actions were plugged/unplugged. This changes it so "Aspect Ratio", "Subtitles", and "Audio Channels" each are a TDESelectAction that is dynamically filled with items. This way, each popup menu is still present after other actions being plugged/unplugged. Resolves: TDE/codeine#24 Signed-off-by: mio <stigma@disroot.org>
Diffstat (limited to 'src/app/stateChange.cpp')
-rw-r--r--src/app/stateChange.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/app/stateChange.cpp b/src/app/stateChange.cpp
index efa9389..9322a13 100644
--- a/src/app/stateChange.cpp
+++ b/src/app/stateChange.cpp
@@ -90,11 +90,14 @@ MainWindow::engineStateChanged( Engine::State state )
file_menu->changeItem( play_id, item.iconSet(), item.text() );
file_menu->setItemChecked( play_id, false );
- settings_menu->setItemEnabled( AspectRatioMenuItemId, state & (Playing | Paused) && TheStream::hasVideo() );
-
- // set correct aspect ratio
- if( state == Loaded )
- static_cast<TQPopupMenu*>(child( "aspect_ratio_menu" ))->setItemChecked( TheStream::aspectRatio(), true );
+ if (const auto aspectAction = dynamic_cast<TDESelectAction *>(action("aspect_ratio_select")))
+ {
+ aspectAction->setEnabled((state & (Playing | Paused)) && TheStream::hasVideo());
+ if (state == Loaded)
+ {
+ aspectAction->setCurrentItem(TheStream::aspectRatio());
+ }
+ }
}