@@ -4,10 +4,12 @@ const storage = require('electron-json-storage');
44const fs = require ( 'fs-extra' ) ;
55const settings = require ( 'electron-settings' ) ;
66const SettingsController = require ( './settings-controller' ) ;
7+ const URLS = require ( '../configuration/urls' ) ;
78
8- const language = fs . existsSync ( `${ app . getPath ( 'userData' ) } /Settings` ) ? settings . get ( 'language' , 'en' ) : 'en' ;
9- const Locale = language === 'en' ? require ( '../locale/locale_en' ) : require ( '../locale/locale_sc' ) ;
10- const macOS = process . platform === 'darwin' ? true : false ;
9+ // const language = fs.existsSync(`${app.getPath('userData')}/Settings`) ? settings.get('language', 'sc') : 'sc';
10+ // const Locale = language === 'en' ? require('../locale/locale_en') : require('../locale/locale_sc');
11+ const Locale = require ( '../locale/locale_sc' ) ;
12+ const macOS = process . platform === 'darwin' ;
1113
1214class AppTray {
1315 constructor ( playerController , lyricsController , notificationController ) {
@@ -25,18 +27,20 @@ class AppTray {
2527 //set the context menu
2628 const context = Menu . buildFromTemplate ( [
2729 { label : Locale . TRAY_SHOW_MAIN , click : ( ) => this . togglePlayerWindow ( ) } ,
28- { label : Locale . TRAY_PLAY_PAUSE , click : ( ) => this . playerController . toggle ( ) } ,
30+ { label : Locale . TRAY_PLAY_PAUSE , click : ( ) => this . playerController . pausePlay ( ) } ,
2931 { label : Locale . TRAY_NEXT , click : ( ) => this . playerController . next ( ) } ,
3032 { label : Locale . TRAY_PREVIOUS , click : ( ) => this . playerController . previous ( ) } ,
3133 { label : 'Separator' , type : 'separator' } ,
34+ { label : Locale . TRAY_WINDOW_FRAME , type : 'checkbox' , checked : settings . get ( 'showWindowFrame' , true ) , click : ( ) => this . toggleWindowFrame ( ) } ,
3235 { label : Locale . TRAY_PLAYER_MODE , submenu : [
33- { label : Locale . TRAY_PLAYER_MODE_DEFAULT , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_DEFAULT_VALUE ) } ,
34- { label : Locale . TRAY_PLAYER_MODE_HIDE_LYRICS , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_HIDE_LYRICS_VALUE ) } ,
35- { label : Locale . TRAY_PLAYER_MODE_HIDE_SIDEBAR , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_HIDE_SIDEBAR_VALUE ) } ,
36- { label : Locale . TRAY_PLAYER_MODE_SONG_LIST_ONLY , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_SONG_LIST_ONLY_VALUE ) } ,
37- { label : Locale . TRAY_PLAYER_MODE_MINI , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_MINI_VALUE ) }
36+ { label : Locale . TRAY_PLAYER_MODE_SUGGESTION , type : 'radio' , checked : 'suggestion' === settings . get ( 'customLayout' , 'suggestion' ) , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_SUGGESTION_VALUE ) } ,
37+ { label : Locale . TRAY_PLAYER_MODE_BILLBOARD , type : 'radio' , checked : 'billboard' === settings . get ( 'customLayout' , 'suggestion' ) , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_BILLBOARD_VALUE ) } ,
38+ { label : Locale . TRAY_PLAYER_MODE_COLLECTION , type : 'radio' , checked : 'collection' === settings . get ( 'customLayout' , 'suggestion' ) , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_COLLECTION_VALUE ) } ,
39+ { label : Locale . TRAY_PLAYER_MODE_ARTIST , type : 'radio' , checked : 'artist' === settings . get ( 'customLayout' , 'suggestion' ) , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_ARTIST_VALUE ) } ,
40+ { label : Locale . TRAY_PLAYER_MODE_ALBUM , type : 'radio' , checked : 'album' === settings . get ( 'customLayout' , 'suggestion' ) , click : ( ) => this . changePlayerMode ( Locale . TRAY_PLAYER_MODE_ALBUM_VALUE ) } ,
41+ // {label: Locale.TRAY_PLAYER_MODE_MINI, type: 'radio', checked: 'mini' === settings.get('customLayout', 'suggestion'), click: () => this.changePlayerMode(Locale.TRAY_PLAYER_MODE_MINI_VALUE)}
3842 ] } ,
39- { label : Locale . TRAY_LYRICS_TOGGLE , click : ( ) => this . toggleLyrics ( ) } ,
43+ // {label: Locale.TRAY_LYRICS_TOGGLE, click: () => this.toggleLyrics()},
4044 { label : Locale . TRAY_SWITCH_TO_RADIO , click : ( ) => this . switchToRadioMode ( ) } ,
4145 { label : 'Separator' , type : 'separator' } ,
4246 { label : Locale . TRAY_SETTINGS , click : ( ) => this . openSettings ( ) } ,
@@ -63,6 +67,12 @@ class AppTray {
6367 }
6468 }
6569
70+ toggleWindowFrame ( ) {
71+ settings . set ( 'showWindowFrame' , ! settings . get ( 'showWindowFrame' ) ) ;
72+ this . playerController . window . destroy ( ) ;
73+ this . playerController . init ( ) ;
74+ }
75+
6676 toggleLyrics ( ) {
6777 if ( ! this . lyricsController . window . isVisible ( ) ) {
6878 this . playerController . addPlaytimeObserver ( ) ;
@@ -119,9 +129,7 @@ ${Locale.NOTIFICATION_ALBUM}: ${trackInfo.album_name}`;
119129
120130 changePlayerMode ( mode ) {
121131 settings . set ( 'customLayout' , mode ) ;
122- this . lyricsController . window . isVisible ( ) && this . lyricsController . window . hide ( ) ;
123- this . playerController . window . destroy ( ) ;
124- this . playerController . init ( ) ;
132+ this . playerController . window . loadURL ( URLS . getUrl ( mode ) ) ;
125133 }
126134
127135 openSettings ( ) {
0 commit comments