1 //=========================================== 2 // Lumina-Desktop source code 3 // Copyright (c) 2017, Ken Moore 4 // Available under the 3-clause BSD license 5 // See the LICENSE file for full details 6 //=========================================== 7 #ifndef _LUMINA_MEDIA_PLAYER_MAIN_UI_H 8 #define _LUMINA_MEDIA_PLAYER_MAIN_UI_H 9 10 #include <QMainWindow> 11 #include <QAction> 12 #include <QString> 13 #include <QStringList> 14 #include <QSystemTrayIcon> 15 #include <QCloseEvent> 16 #include <QSettings> 17 18 //QMultimedia classes 19 #include <QMediaPlayer> 20 #include <QMediaPlaylist> 21 #include <QVideoWidget> 22 23 #include "PianoBarProcess.h" 24 25 namespace Ui{ 26 class MainUI; 27 }; 28 29 class MainUI : public QMainWindow{ 30 Q_OBJECT 31 public: 32 MainUI(); 33 ~MainUI(); 34 35 void loadArguments(QStringList); 36 37 private: 38 Ui::MainUI *ui; 39 PianoBarProcess *PANDORA; 40 QMediaPlayer *PLAYER; 41 QVideoWidget *VIDEO; 42 QMediaPlaylist *PLAYLIST; 43 QSystemTrayIcon *SYSTRAY; 44 bool closing, DISABLE_VIDEO; 45 QSettings *SETTINGS; 46 47 void setupPlayer(); 48 void setupPandora(); 49 void setupConnections(); 50 void setupIcons(); 51 void setupTrayIcon(); 52 void closeTrayIcon(); 53 54 void loadFile(QString); //simplification for loading files into the local playlist 55 56 private slots: 57 void closeApplication(); 58 void PlayerTypeChanged(bool active = true); 59 void PlayerSettingsChanged(); 60 61 //Toolbar actions 62 void playToggled(); 63 void pauseToggled(); 64 void stopToggled(); 65 void nextToggled(); 66 void backToggled(); 67 void volupToggled(); 68 void voldownToggled(); 69 70 //Local Playback UI slots setLocalPosition(int pos)71 void setLocalPosition(int pos){ PLAYER->setPosition(pos); } 72 void addLocalMedia(); 73 void rmLocalMedia(); 74 void upLocalMedia(); 75 void downLocalMedia(); 76 void localPlaybackSettingsChanged(); 77 78 //Local Playlist Feedback 79 void LocalListIndexChanged(int); //item being played just changed 80 void LocalListMediaChanged(int,int); 81 void LocalListMediaInserted(int,int); 82 void LocalListMediaRemoved(int,int); 83 84 //Local Player Feedback 85 //void LocalAudioAvailable(bool); 86 void LocalVideoAvailable(bool); 87 void LocalIsSeekable(bool); 88 void LocalNowMuted(bool); 89 void LocalError(QMediaPlayer::Error); 90 void LocalMediaChanged(const QMediaContent&); 91 void LocalMediaStatusChanged(QMediaPlayer::MediaStatus); 92 void LocalStateChanged(QMediaPlayer::State); 93 void LocalDurationChanged(qint64); 94 void LocalPositionChanged(qint64); 95 void LocalVolumeChanged(int); 96 97 //Pandora Options 98 void showPandoraSongInfo(); 99 void changePandoraStation(QString); 100 void checkPandoraSettings(); 101 void applyPandoraSettings(); 102 void createPandoraStation(); 103 104 //Pandora Process Feedback 105 void PandoraStateChanged(PianoBarProcess::State); 106 void NewPandoraInfo(QString); 107 void PandoraStationChanged(QString); 108 void PandoraSongChanged(bool, QString, QString, QString, QString, QString); //[isLoved, title, artist, album, detailsURL, fromStation] 109 void PandoraTimeUpdate(int,int); //current secs, total secs 110 void PandoraStationListChanged(QStringList); 111 void PandoraInteractivePrompt(QString, QStringList); 112 void PandoraError(QString); 113 114 //System Tray interactions 115 void toggleVisibility(); 116 void trayMessageClicked(); 117 void trayClicked(QSystemTrayIcon::ActivationReason); 118 119 protected: 120 void closeEvent(QCloseEvent *ev); 121 122 }; 123 #endif 124