/// <summary> /// /// </summary> /// <param name="profile"></param> /// <param name="category"></param> /// <param name="name"></param> /// <param name="keysAsText"></param> /// <param name="isGlobal"></param> private static void SetKeyboardShortcut(KeyboardShortcutProfile profile, String category, String name, String keysAsText, bool isGlobal = false) { KeyboardShortcut sc = GetKeyboardShortcut(profile, category, name); if (sc == null) { sc = new KeyboardShortcut(); sc.Category = category; sc.Name = name; profile.Shortcuts.Add(sc); } SetKeyboardShortcut(sc, keysAsText, isGlobal); }
/// <summary> /// Initializes a keyboard shortcut profile. /// </summary> /// <param name="profile">The keyboard shortcut profile</param> /// <param name="name">The name of the profile</param> /// <param name="isprotected">Whether or not the profile is protected from changes by user</param> public static void InitShortcutProfile(KeyboardShortcutProfile profile, String name, Boolean isprotected) { profile.Name = name; profile.IsProtected = isprotected; profile.Shortcuts = new List<KeyboardShortcut>(); // set the default shortcuts profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add track", IsGlobal = false, Keys = "Alt+T" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add folder", IsGlobal = false, Keys = "Alt+F" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add playlist", IsGlobal = false, Keys = "Alt+P" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add radio station", IsGlobal = false, Keys = "Alt+R" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Add plugin", IsGlobal = false, Keys = "Alt+A" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Generate playlist", IsGlobal = false, Keys = "Alt+G" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Minimize", IsGlobal = false, Keys = "Ctrl+Shift+M" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Restore", IsGlobal = true, Keys = "Ctrl+Shift+R" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Help", IsGlobal = false, Keys = "F1" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Application", Name = "Close", IsGlobal = false, Keys = "Ctrl+W" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Video", IsGlobal = false, Keys = "Ctrl+F1" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Visualizer", IsGlobal = false, Keys = "Ctrl+F2" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Files", IsGlobal = false, Keys = "Ctrl+F3" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "YouTube", IsGlobal = false, Keys = "Ctrl+F4" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "SoundCloud", IsGlobal = false, Keys = "Ctrl+F5" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Radio", IsGlobal = false, Keys = "Ctrl+F6" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Queue", IsGlobal = false, Keys = "Ctrl+F7" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "History", IsGlobal = false, Keys = "Ctrl+F8" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Playlists", IsGlobal = false, Keys = "Ctrl+F9" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Tracklist", IsGlobal = false, Keys = "Ctrl+T" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Search", IsGlobal = false, Keys = "Ctrl+F" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "General preferences", IsGlobal = false, Keys = "Alt+F1" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Music sources", IsGlobal = false, Keys = "Alt+F2" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Services", IsGlobal = false, Keys = "Alt+F3" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Plugins", IsGlobal = false, Keys = "Alt+F4" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Keyboard shortcuts", IsGlobal = false, Keys = "Alt+F5" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "About", IsGlobal = false, Keys = "Alt+F6" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Toggle details pane", IsGlobal = false, Keys = "Alt+D" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Toggle menu bar", IsGlobal = false, Keys = "Alt+M" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MainWindow", Name = "Create playlist", IsGlobal = false, Keys = "Ctrl+N" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Play or pause", IsGlobal = false, Keys = "Alt+5 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Next", IsGlobal = false, Keys = "Alt+6 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Previous", IsGlobal = false, Keys = "Alt+4 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Toggle shuffle", IsGlobal = false, Keys = "Alt+9 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Toggle repeat", IsGlobal = false, Keys = "Alt+7 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Increase volume", IsGlobal = false, Keys = "Alt+8 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Decrease volume", IsGlobal = false, Keys = "Alt+2 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Seek forward", IsGlobal = false, Keys = "Alt+3 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Seek backward", IsGlobal = false, Keys = "Alt+1 (numpad)" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Add bookmark", IsGlobal = false, Keys = "Alt+B" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to previous bookmark", IsGlobal = false, Keys = "Alt+Left" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to next bookmark", IsGlobal = false, Keys = "Alt+Right" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to first bookmark", IsGlobal = false, Keys = "Alt+Home" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to last bookmark", IsGlobal = false, Keys = "Alt+End" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 1", IsGlobal = false, Keys = "Alt+1" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 2", IsGlobal = false, Keys = "Alt+2" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 3", IsGlobal = false, Keys = "Alt+3" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 4", IsGlobal = false, Keys = "Alt+4" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 5", IsGlobal = false, Keys = "Alt+5" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 6", IsGlobal = false, Keys = "Alt+6" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 7", IsGlobal = false, Keys = "Alt+7" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 8", IsGlobal = false, Keys = "Alt+8" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 9", IsGlobal = false, Keys = "Alt+9" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to bookmark 10", IsGlobal = false, Keys = "Alt+0" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to current track", IsGlobal = false, Keys = "Alt+C" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "MediaCommands", Name = "Jump to selected track", IsGlobal = false, Keys = "Alt+X" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Play track", IsGlobal = false, Keys = "Enter" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Queue and dequeue", IsGlobal = false, Keys = "Shift+Q" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Open folder", IsGlobal = false, Keys = "Ctrl+L" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Remove", IsGlobal = false, Keys = "Delete" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Remove from harddrive", IsGlobal = false, Keys = "Shift+Delete" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Copy", IsGlobal = false, Keys = "Ctrl+C" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Move", IsGlobal = false, Keys = "Ctrl+X" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "View information", IsGlobal = false, Keys = "Ctrl+I" }); profile.Shortcuts.Add(new KeyboardShortcut { Category = "Track", Name = "Share", IsGlobal = false, Keys = "Shift+S" }); }
/// <summary> /// Find a keyboard shortcut inside a profile by looking for its name. /// </summary> /// <param name="profile">The keyboard shortcut profile to look in</param> /// <param name="category">The name of the category of the shortcut</param> /// <param name="name">The name of the shortcut</param> /// <returns>The keyboard shortcut corresponding to the category and name inside the profile</returns> public static KeyboardShortcut GetKeyboardShortcut(KeyboardShortcutProfile profile, String category, String name) { foreach (KeyboardShortcut s in profile.Shortcuts) if (s.Name == name && s.Category == category) return s; return null; }
/// <summary> /// Initializes the settings manager. /// </summary> public static void Initialize() { #region Lists and collections if (FileTracks == null) FileTracks = new ObservableCollection<TrackData>(); if (HistoryTracks == null) HistoryTracks = new ObservableCollection<TrackData>(); if (QueueTracks == null) QueueTracks = new ObservableCollection<TrackData>(); if (RadioTracks == null) RadioTracks = new ObservableCollection<TrackData>(); if (Plugins == null) Plugins = new ObservableCollection<PluginItem>(); if (PluginSettings == null) PluginSettings = new List<PluginSettings>(); if (Sources == null) Sources = new ObservableCollection<SourceData>(); if (Playlists == null) Playlists = new List<PlaylistData>(); #endregion #region Equalizer if (EqualizerProfiles == null) { EqualizerProfiles = new List<EqualizerProfile>(); EqualizerProfiles.Add(CreateEqualizerLevel(U.T("EqualizerProfileDefault"), new float[] { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, true)); } if (CurrentEqualizerProfile == null) CurrentEqualizerProfile = EqualizerProfiles[0]; #endregion #region Shortcuts if (ShortcutProfiles == null) { ShortcutProfiles = new List<KeyboardShortcutProfile>(); // Stoffi KeyboardShortcutProfile shortStoffi = new KeyboardShortcutProfile(); InitShortcutProfile(shortStoffi, "Stoffi", true); ShortcutProfiles.Add(shortStoffi); // Stoffi (laptop) KeyboardShortcutProfile shortLaptop = new KeyboardShortcutProfile(); InitShortcutProfile(shortLaptop, "Stoffi (laptop)", true); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Previous", "Ctrl+1"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Play or pause", "Ctrl+2"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Next", "Ctrl+3"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Decrease volume", "Ctrl+4"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Increase volume", "Ctrl+5"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Seek backward", "Ctrl+6"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Seek forward", "Ctrl+7"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Toggle shuffle", "Ctrl+8"); SetKeyboardShortcut(shortLaptop, "MediaCommands", "Toggle repeat", "Ctrl+9"); ShortcutProfiles.Add(shortLaptop); // Amarok KeyboardShortcutProfile shortAmarok = new KeyboardShortcutProfile(); InitShortcutProfile(shortAmarok, "Amarok", true); SetKeyboardShortcut(shortAmarok, "Application", "Add track", "Win+A"); SetKeyboardShortcut(shortAmarok, "Application", "Add playlist", "Space"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Play or pause", "Win+X"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Next", "Win+B"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Previous", "Win+Z"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Toggle shuffle", "Ctrl+H"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Increase volume", "Win++ (numpad)"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Decrease volume", "Win+- (numpad)"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Seek forward", "Win+Shift++ (numpad)"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Seek backward", "Win+Shift+- (numpad)"); SetKeyboardShortcut(shortAmarok, "MediaCommands", "Jump to current track", "Ctrl+Enter"); SetKeyboardShortcut(shortAmarok, "MainWindow", "Toggle menu bar", "Ctrl+M"); ShortcutProfiles.Add(shortAmarok); // Banshee KeyboardShortcutProfile shortBanshee = new KeyboardShortcutProfile(); InitShortcutProfile(shortBanshee, "Banshee", true); SetKeyboardShortcut(shortBanshee, "Application", "Add track", "Ctrl+I"); SetKeyboardShortcut(shortBanshee, "Application", "Close", "Ctrl+Q"); SetKeyboardShortcut(shortBanshee, "MediaCommands", "Play or pause", "Space"); SetKeyboardShortcut(shortBanshee, "MediaCommands", "Next", "N"); SetKeyboardShortcut(shortBanshee, "MediaCommands", "Previous", "B"); ShortcutProfiles.Add(shortBanshee); // Foobar2000 KeyboardShortcutProfile shortFoobar2000 = new KeyboardShortcutProfile(); InitShortcutProfile(shortFoobar2000, "Foobar2000", true); SetKeyboardShortcut(shortFoobar2000, "Application", "Add track", "Ctrl+O"); SetKeyboardShortcut(shortFoobar2000, "Application", "Add folder", "Ctrl+A"); SetKeyboardShortcut(shortFoobar2000, "Application", "Add playlist", "Ctrl+L"); SetKeyboardShortcut(shortFoobar2000, "Application", "Add radio station", "Ctrl+U"); SetKeyboardShortcut(shortFoobar2000, "MainWindow", "General preferences", "Ctrl+P"); SetKeyboardShortcut(shortFoobar2000, "Track", "View information", "Alt+Enter"); ShortcutProfiles.Add(shortFoobar2000); // iTunes KeyboardShortcutProfile shortiTunes = new KeyboardShortcutProfile(); InitShortcutProfile(shortiTunes, "iTunes", true); SetKeyboardShortcut(shortiTunes, "Application", "Add track", "Ctrl+O"); SetKeyboardShortcut(shortiTunes, "Application", "Add playlist", "Ctrl+P"); SetKeyboardShortcut(shortiTunes, "Application", "Add radio station", "Ctrl+U"); SetKeyboardShortcut(shortiTunes, "MainWindow", "General preferences", "Ctrl+,"); SetKeyboardShortcut(shortiTunes, "MainWindow", "Search", "Ctrl+Alt+F"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Play or pause", "Space"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Increase volume", "Ctrl+Up"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Decrease volume", "Ctrl+Down"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Seek forward", "Ctrl+Alt+Right"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Seek backward", "Ctrl+Alt+Left"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Previous", "Left"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Next", "Right"); SetKeyboardShortcut(shortiTunes, "MediaCommands", "Jump to current track", "Ctrl+L"); SetKeyboardShortcut(shortiTunes, "Track", "Open folder", "Ctrl+R"); ShortcutProfiles.Add(shortiTunes); // MusicBee KeyboardShortcutProfile shortMusicBee = new KeyboardShortcutProfile(); InitShortcutProfile(shortMusicBee, "MusicBee", true); SetKeyboardShortcut(shortMusicBee, "MainWindow", "General preferences", "Ctrl+O"); SetKeyboardShortcut(shortMusicBee, "MainWindow", "Create playlist", "Ctrl+Shift+N"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Play or pause", "Ctrl+P"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Next", "Ctrl+N"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Previous", "Ctrl+B"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Increase volume", "Ctrl+Up"); SetKeyboardShortcut(shortMusicBee, "MediaCommands", "Decrease volume", "Ctrl+Down"); SetKeyboardShortcut(shortMusicBee, "Track", "Queue and dequeue", "Ctrl+Enter"); SetKeyboardShortcut(shortMusicBee, "Track", "View information", "Alt+E"); ShortcutProfiles.Add(shortMusicBee); // Rythmbox KeyboardShortcutProfile shortRythmbox = new KeyboardShortcutProfile(); InitShortcutProfile(shortRythmbox, "Rythmbox", true); SetKeyboardShortcut(shortRythmbox, "Application", "Close", "Ctrl+Q"); SetKeyboardShortcut(shortRythmbox, "Application", "Add folder", "Ctrl+O"); SetKeyboardShortcut(shortRythmbox, "Application", "Add radio station", "Ctrl+I"); SetKeyboardShortcut(shortRythmbox, "MainWindow", "Search", "Alt+S"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Play or pause", "Ctrl+Space"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Previous", "Alt+Left"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Next", "Alt+Right"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Toggle shuffle", "Ctrl+U"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Toggle repeat", "Ctrl+R"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Jump to current track", "Ctrl+J"); SetKeyboardShortcut(shortRythmbox, "Track", "View information", "Alt+Enter"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Jump to previous bookmark", "Alt+,"); SetKeyboardShortcut(shortRythmbox, "MediaCommands", "Jump to next bookmark", "Alt+."); ShortcutProfiles.Add(shortRythmbox); // Spotify KeyboardShortcutProfile shortSpotify = new KeyboardShortcutProfile(); InitShortcutProfile(shortSpotify, "Spotify", true); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Play or pause", "Space"); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Next", "Ctrl+Right"); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Previous", "Ctrl+Left"); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Increase volume", "Ctrl+Up"); SetKeyboardShortcut(shortSpotify, "MediaCommands", "Decrease volume", "Ctrl+Down"); SetKeyboardShortcut(shortSpotify, "MainWindow", "Search", "Ctrl+L"); SetKeyboardShortcut(shortSpotify, "MainWindow", "General preferences", "Ctrl+P"); SetKeyboardShortcut(shortSpotify, "Track", "Open folder", "Alt+L"); ShortcutProfiles.Add(shortSpotify); // VLC KeyboardShortcutProfile shortVLC = new KeyboardShortcutProfile(); InitShortcutProfile(shortVLC, "VLC", true); SetKeyboardShortcut(shortVLC, "Application", "Add track", "Ctrl+O"); SetKeyboardShortcut(shortVLC, "Application", "Add folder", "Ctrl+F"); SetKeyboardShortcut(shortVLC, "Application", "Add radio station", "Ctrl+N"); SetKeyboardShortcut(shortVLC, "Application", "Close", "Ctrl+Q"); SetKeyboardShortcut(shortVLC, "MainWindow", "General preferences", "Ctrl+P"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Play or pause", "Space"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Next", "N"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Previous", "P"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Seek backward", "Ctrl+Left"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Seek forward", "Ctrl+Right"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Increase volume", "Ctrl+Up"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Decrease volume", "Ctrl+Down"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Toggle shuffle", "R"); SetKeyboardShortcut(shortVLC, "MediaCommands", "Toggle repeat", "L"); SetKeyboardShortcut(shortVLC, "MainWindow", "Search", "F3"); SetKeyboardShortcut(shortVLC, "MainWindow", "Create playlist", "Ctrl+Alt+P"); ShortcutProfiles.Add(shortVLC); // Winamp KeyboardShortcutProfile shortWinamp = new KeyboardShortcutProfile(); InitShortcutProfile(shortWinamp, "Winamp", true); SetKeyboardShortcut(shortWinamp, "Application", "Minimize", "Alt+M"); SetKeyboardShortcut(shortWinamp, "Application", "Add track", "Ctrl+Alt+L"); SetKeyboardShortcut(shortWinamp, "MainWindow", "History", "Ctrl+H"); SetKeyboardShortcut(shortWinamp, "MainWindow", "General preferences", "Ctrl+P"); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Play or pause", "Ctrl+Alt+Insert", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Next", "Ctrl+Alt+PageDown", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Previous", "Ctrl+Alt+PageUp", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Increase volume", "Ctrl+Alt+Up", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Decrease volume", "Ctrl+Alt+Down", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Seek forward", "Ctrl+Alt+Right", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Seek backward", "Ctrl+Alt+Left", true); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Toggle shuffle", "S"); SetKeyboardShortcut(shortWinamp, "MediaCommands", "Toggle repeat", "R"); SetKeyboardShortcut(shortWinamp, "Track", "View information", "Alt+3"); SetKeyboardShortcut(shortWinamp, "MainWindow", "Toggle menu bar", "Ctrl+Alt+M"); ShortcutProfiles.Add(shortWinamp); // Windows Media Player KeyboardShortcutProfile shortWMP = new KeyboardShortcutProfile(); InitShortcutProfile(shortWMP, "Windows Media Player", true); SetKeyboardShortcut(shortWMP, "Application", "Add track", "Ctrl+O"); SetKeyboardShortcut(shortWMP, "Application", "Add radio station", "Ctrl+U"); SetKeyboardShortcut(shortWMP, "MainWindow", "Search", "Ctrl+E"); SetKeyboardShortcut(shortWMP, "MainWindow", "Toggle menu bar", "F10"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Play or pause", "Ctrl+P"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Next", "Ctrl+F"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Previous", "Ctrl+B"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Seek forward", "Ctrl+Shift+F"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Seek backward", "Ctrl+Shift+B"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Toggle shuffle", "Ctrl+H"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Toggle repeat", "Ctrl+T"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Increase volume", "F9"); SetKeyboardShortcut(shortWMP, "MediaCommands", "Decrease volume", "F8"); SetKeyboardShortcut(shortWMP, "Track", "View information", "F2"); SetKeyboardShortcut(shortWMP, "MainWindow", "Tracklist", "Ctrl+1"); ShortcutProfiles.Add(shortWMP); } #endregion #region ViewDetails lists // sources list if (SourceListConfig == null) { ViewDetailsConfig sourceConfig = CreateListConfig(); sourceConfig.Columns.Add(CreateListColumn("Data", U.T("ColumnLocation"), 200)); sourceConfig.Columns.Add(CreateListColumn("Type", U.T("ColumnType"), 150, "SourceType")); sourceConfig.Sorts.Add("asc:Type"); sourceConfig.Sorts.Add("asc:Data"); SourceListConfig = sourceConfig; } // youtube list if (YouTubeListConfig == null) { ViewDetailsConfig youtubeConfig = CreateListConfig(); youtubeConfig.AcceptFileDrops = false; youtubeConfig.IsDragSortable = false; youtubeConfig.Columns.Add(CreateListColumn("Artist", U.T("ColumnArtist"), 200)); youtubeConfig.Columns.Add(CreateListColumn("Title", U.T("ColumnTitle"), 350)); youtubeConfig.Columns.Add(CreateListColumn("Views", U.T("ColumnViews"), 120, "Number", Alignment.Right)); youtubeConfig.Columns.Add(CreateListColumn("Length", U.T("ColumnLength"), 100, "Duration", Alignment.Right)); youtubeConfig.Columns.Add(CreateListColumn("Path", U.T("ColumnPath"), 200, Alignment.Left, false)); YouTubeListConfig = youtubeConfig; } // soundcloud list if (SoundCloudListConfig == null) { ViewDetailsConfig soundcloudConfig = CreateListConfig(); soundcloudConfig.AcceptFileDrops = false; soundcloudConfig.IsDragSortable = false; soundcloudConfig.Columns.Add(CreateListColumn("Artist", U.T("ColumnArtist"), 150)); soundcloudConfig.Columns.Add(CreateListColumn("Title", U.T("ColumnTitle"), 300)); soundcloudConfig.Columns.Add(CreateListColumn("Genre", U.T("ColumnGenre"), 100)); soundcloudConfig.Columns.Add(CreateListColumn("Length", U.T("ColumnLength"), 150, "Duration", Alignment.Right)); soundcloudConfig.Columns.Add(CreateListColumn("Path", U.T("ColumnPath"), 200, Alignment.Left, false)); SoundCloudListConfig = soundcloudConfig; } // soundcloud list if (JamendoListConfig == null) { ViewDetailsConfig jamendoConfig = CreateListConfig(); jamendoConfig.AcceptFileDrops = false; jamendoConfig.IsDragSortable = false; jamendoConfig.Columns.Add(CreateListColumn("Artist", U.T("ColumnArtist"), 150)); jamendoConfig.Columns.Add(CreateListColumn("Album", U.T("ColumnAlbum"), 150)); jamendoConfig.Columns.Add(CreateListColumn("Title", U.T("ColumnTitle"), 300)); jamendoConfig.Columns.Add(CreateListColumn("Genre", U.T("ColumnGenre"), 100)); jamendoConfig.Columns.Add(CreateListColumn("Length", U.T("ColumnLength"), 150, "Duration", Alignment.Right)); jamendoConfig.Columns.Add(CreateListColumn("Path", U.T("ColumnPath"), 200, Alignment.Left, false)); JamendoListConfig = jamendoConfig; } // file list if (FileListConfig == null) { ViewDetailsConfig fileList = CreateListConfig(); InitViewDetailsConfig(fileList); fileList.Sorts.Add("asc:Title"); fileList.Sorts.Add("asc:Track"); fileList.Sorts.Add("asc:Album"); fileList.Sorts.Add("asc:Artist"); FileListConfig = fileList; } // radio list if (RadioListConfig == null) { ViewDetailsConfig radioList = CreateListConfig(); radioList.Columns.Add(CreateListColumn("Title", U.T("ColumnTitle"), 300)); radioList.Columns.Add(CreateListColumn("Genre", U.T("ColumnGenre"), 150)); radioList.Columns.Add(CreateListColumn("URL", U.T("ColumnURL"), 300)); radioList.Sorts.Add("asc:Title"); RadioListConfig = radioList; } // disc list if (DiscListConfig == null) { ViewDetailsConfig discList = CreateListConfig(); InitViewDetailsConfig(discList); DiscListConfig = discList; } // queue list if (QueueListConfig == null) { ViewDetailsConfig queueList = CreateListConfig(); queueList.IsNumberVisible = true; InitViewDetailsConfig(queueList); queueList.Sorts.Add("asc:Title"); queueList.Sorts.Add("asc:Track"); queueList.Sorts.Add("asc:Album"); queueList.Sorts.Add("asc:Artist"); QueueListConfig = queueList; } // history list if (HistoryListConfig == null) { ViewDetailsConfig historyList = CreateListConfig(); historyList.Columns.Add(CreateListColumn("LastPlayed", U.T("ColumnPlayed"), 200, "DateTime")); historyList.Columns.Add(CreateListColumn("Artist", U.T("ColumnArtist"), 100)); historyList.Columns.Add(CreateListColumn("Album", U.T("ColumnAlbum"), 100)); historyList.Columns.Add(CreateListColumn("Title", U.T("ColumnTitle"), 100)); historyList.Columns.Add(CreateListColumn("Genre", U.T("ColumnGenre"), 100)); historyList.Columns.Add(CreateListColumn("Length", U.T("ColumnLength"), 60, "Duration", Alignment.Right)); historyList.Columns.Add(CreateListColumn("Year", U.T("ColumnYear"), 100, Alignment.Right, false)); historyList.Columns.Add(CreateListColumn("PlayCount", U.T("ColumnPlayCount"), 100, "Number", Alignment.Right, false)); historyList.Columns.Add(CreateListColumn("Path", U.T("ColumnPath"), 200, Alignment.Left, false)); historyList.Columns.Add(CreateListColumn("Track", U.T("ColumnTrack"), 100, Alignment.Right, false)); historyList.Sorts.Add("dsc:LastPlayed"); HistoryListConfig = historyList; } if (PluginListConfig == null) { ViewDetailsConfig pluginListConfig = CreateListConfig(); pluginListConfig.AcceptFileDrops = false; pluginListConfig.IsDragSortable = false; pluginListConfig.Columns.Add(CreateListColumn("Name", U.T("ColumnName"), 150)); pluginListConfig.Columns.Add(CreateListColumn("Author", U.T("ColumnAuthor"), 100)); pluginListConfig.Columns.Add(CreateListColumn("Type", U.T("ColumnType"), 100, "PluginType")); pluginListConfig.Columns.Add(CreateListColumn("Installed", U.T("ColumnInstalled"), 150, "DateTime")); pluginListConfig.Columns.Add(CreateListColumn("Version", U.T("ColumnVersion"), 80)); //pluginListConfig.Columns.Add(CreateListColumn("Enabled", U.T("ColumnEnabled"), "Enabled", 20)); pluginListConfig.Sorts.Add("asc:Name"); PluginListConfig = pluginListConfig; } #endregion #region Adjustments if (ListenBuffer == null) ListenBuffer = new Dictionary<string, Tuple<string, string>>(); //Save(); foreach (TrackData t in SettingsManager.FileTracks) if (String.IsNullOrWhiteSpace(t.ArtURL)) t.ArtURL = "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg"; foreach (TrackData t in SettingsManager.HistoryTracks) if (String.IsNullOrWhiteSpace(t.ArtURL)) t.ArtURL = "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg"; foreach (TrackData t in SettingsManager.QueueTracks) if (String.IsNullOrWhiteSpace(t.ArtURL)) t.ArtURL = "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg"; foreach (PlaylistData p in SettingsManager.Playlists) foreach (TrackData t in p.Tracks) if (String.IsNullOrWhiteSpace(t.ArtURL)) t.ArtURL = "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg"; Thread aa_thread = new Thread(delegate() { foreach (TrackData t in SettingsManager.HistoryTracks) { if (U.IsClosing) break; if (t.ArtURL == "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg") ServiceManager.SetArt(t); } foreach (TrackData t in SettingsManager.QueueTracks) { if (U.IsClosing) break; if (t.ArtURL == "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg") ServiceManager.SetArt(t); } foreach (PlaylistData p in SettingsManager.Playlists) foreach (TrackData t in p.Tracks) { if (U.IsClosing) break; if (t.ArtURL == "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg") ServiceManager.SetArt(t); } foreach (TrackData t in SettingsManager.FileTracks) { if (U.IsClosing) break; if (t.ArtURL == "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg") ServiceManager.SetArt(t); } }); aa_thread.Name = "Fetch album art"; aa_thread.Priority = ThreadPriority.BelowNormal; //aa_thread.Start(); // fix tracks foreach (TrackData t in SettingsManager.HistoryTracks) { if (t.Path.StartsWith("youtube://")) t.Path = "stoffi:track:youtube:" + t.Path.Substring(10); else if (t.Path.StartsWith("soundcloud://")) t.Path = "stoffi:track:soundcloud:" + t.Path.Substring(13); } foreach (TrackData t in SettingsManager.QueueTracks) { if (t.Path.StartsWith("youtube://")) t.Path = "stoffi:track:youtube:" + t.Path.Substring(10); else if (t.Path.StartsWith("soundcloud://")) t.Path = "stoffi:track:soundcloud:" + t.Path.Substring(13); } foreach (PlaylistData p in SettingsManager.Playlists) foreach (TrackData t in p.Tracks) { if (t.Path.StartsWith("youtube://")) t.Path = "stoffi:track:youtube:" + t.Path.Substring(10); else if (t.Path.StartsWith("soundcloud://")) t.Path = "stoffi:track:soundcloud:" + t.Path.Substring(13); } //foreach (KeyboardShortcutProfile p in ShortcutProfiles) // if (p.Shortcuts.ElementAt<KeyboardShortcut>(17).Name != "Plugins") // p.Shortcuts.Insert(17, new KeyboardShortcut { Category = "MainWindow", Name = "Plugins", IsGlobal = false, // Keys = "Alt+X" }); #endregion DispatchInitialized(); }
/// <summary> /// Find a keyboard shortcut inside a profile by looking for its key combination. /// </summary> /// <param name="profile">The keyboard shortcut profile to look in</param> /// <param name="keysAsText">The key combination of the shortcut</param> /// <returns>A corresponding shortcut if found, otherwise null</returns> public static KeyboardShortcut GetKeyboardShortcut(KeyboardShortcutProfile profile, String keysAsText) { if (profile != null) foreach (KeyboardShortcut s in profile.Shortcuts) if (s.Keys == keysAsText) return s; return null; }