From: Olaf Wintermann Date: Thu, 7 Aug 2025 18:55:37 +0000 (+0200) Subject: add arg parser + args for playback control X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=668d1894364d6d333eea69ea354a492a6e048459;p=uwplayer.git add arg parser + args for playback control --- diff --git a/application/main.c b/application/main.c index d49dc72..458fed0 100644 --- a/application/main.c +++ b/application/main.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include "window.h" #include "main.h" +#include "playlist.h" #include "settings.h" #include @@ -104,17 +106,70 @@ int main(int argc, char** argv) { display = XtOpenDisplay(app, NULL, APP_NAME, APP_CLASS, NULL, 0, &argc, argv); + PlaybackMode playback = PLAYBACK_STOP; + bool fullscreen = FALSE; + bool adjust_window_size = FALSE; + bool single_instance = FALSE; + + bool file_args = 0; if(argc > 1) { open_file_arg = cxArrayListCreateSimple(CX_STORE_POINTERS, argc-1); for(int i=1;iplaylist.tracks); } + +void PlayListSetMode(MainWindow *win, PlaybackMode mode) { + switch(mode) { + default: break; + case PLAYBACK_REPEAT: { + win->playlist.repeatTrack = TRUE; + win->playlist.repeatList = FALSE; + win->playlist.random = FALSE; + win->playlist.autoplayFolder = FALSE; + break; + } + case PLAYBACK_REPEAT_LIST: { + win->playlist.repeatTrack = TRUE; + win->playlist.repeatList = TRUE; + win->playlist.random = FALSE; + win->playlist.autoplayFolder = FALSE; + break; + } + case PLAYBACK_RANDOM: { + win->playlist.repeatTrack = TRUE; + win->playlist.repeatList = FALSE; + win->playlist.random = TRUE; + win->playlist.autoplayFolder = FALSE; + break; + } + case PLAYBACK_AUTOPLAY: { + win->playlist.repeatTrack = FALSE; + win->playlist.repeatList = FALSE; + win->playlist.random = FALSE; + win->playlist.autoplayFolder = TRUE; + break; + } + } + XtVaSetValues(win->playRepeatTrackButton, XmNset, win->playlist.repeatTrack, NULL); + XtVaSetValues(win->playRepeatListButton, XmNset, win->playlist.repeatList, NULL); + XtVaSetValues(win->playAutoPlayButton, XmNset, win->playlist.random, NULL); + XtVaSetValues(win->playRandom, XmNset, win->playlist.autoplayFolder, NULL); +} diff --git a/application/playlist.h b/application/playlist.h index 26df47b..553c2f8 100644 --- a/application/playlist.h +++ b/application/playlist.h @@ -29,6 +29,14 @@ extern "C" { #endif +typedef enum PlaybackMode { + PLAYBACK_STOP = 0, + PLAYBACK_REPEAT, + PLAYBACK_REPEAT_LIST, + PLAYBACK_RANDOM, + PLAYBACK_AUTOPLAY +} PlaybackMode; + void PlayListInit(MainWindow *win); void PlayListAddFile(MainWindow *win, const char *file); @@ -39,6 +47,8 @@ void PlayListPlayTrack(MainWindow *win, int i); void PlayListClear(MainWindow *win); +void PlayListSetMode(MainWindow *win, PlaybackMode mode); + #ifdef __cplusplus } #endif