1 /*******************************************************************************
2 * Goggles Music Manager *
3 ********************************************************************************
4 * Copyright (C) 2006-2021 by Sander Jansen. All Rights Reserved *
5 * --- *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see http://www.gnu.org/licenses. *
18 ********************************************************************************/
19 #include "gmdefs.h"
20 #include "GMTrack.h"
21 #include "GMPlayerManager.h"
22
23 /*
24 Display Help/Version
25 returns true if application may exit
26 TODO expand to all possible options
27 */
gm_display_help(int argc,char * argv[])28 static bool gm_display_help(int argc,char * argv[]) {
29 for (int i=1;i<argc;i++){
30 if ( (comparecase(argv[i],"--help")==0) || (comparecase(argv[i],"-h")==0) ) {
31 fxmessage("Usage: %s [options]\n\n",FXPath::name(argv[0]).text());
32 fxmessage("General options:\n"
33 " -h, --help Display this help page\n"
34 " -v, --version Display version information\n"
35 " --tray Start minimized to tray\n"
36 #ifdef HAVE_OPENGL
37 " --disable-opengl Disables opengl based features\n"
38 #endif
39 "\n"
40 "Control running music manager:\n"
41 " --play Start playback\n"
42 " --play-pause Toggle pause / playback.\n"
43 " --pause Pause playback\n"
44 " --previous Play previous track\n"
45 " --next Play next track\n"
46 " --stop Stop playback\n"
47 " --raise Try to raise the main window\n"
48 " --toggle-shown Show or Hide the main window\n"
49 " --now-playing Show now playing notification\n"
50 " --update-podcasts Refresh podcast feeds\n"
51 "\n"
52 );
53 return true;
54 }
55 else if ( (comparecase(argv[i],"--version")==0) || (comparecase(argv[i],"-v")==0) ) {
56 fxmessage("Goggles Music Manager %s\n",GOGGLESMM_VERSION_STRING);
57 return true;
58 }
59 }
60 return false;
61 }
main(int argc,char * argv[])62 int main(int argc,char *argv[]){
63 if (fxversion[0]==1 && ( fxversion[1]==7)) {
64 // FOX 1.7 is not api stable, so rather than crashing refuse to run.
65 if (FOX_MAJOR!=fxversion[0] || FOX_MINOR!=fxversion[1] || FOX_LEVEL!=fxversion[2]) {
66 fxwarning("FOX Header (v%d.%d.%d) / Library (v%d.%d.%d) mismatch!\n",FOX_MAJOR,FOX_MINOR,FOX_LEVEL,fxversion[0],fxversion[1],fxversion[2]);
67 return 1;
68 }
69 }
70 else {
71 fxwarning("Goggles Music Manager linked to a unknown/unsupported version of the FOX Library (v%d.%d.%d)",fxversion[0],fxversion[1],fxversion[2]);
72 return 1;
73 }
74
75 /// Display Help
76 if (gm_display_help(argc,argv))
77 return 0;
78
79 /// Main Application
80 GMPlayerManager gogglesmm;
81 return gogglesmm.run(argc,argv);
82 }
83