File indexing completed on 2024-05-12 17:12:39
0001 /*************************************************************************** 0002 * Copyright (C) 2009 by Renaud Guezennec * 0003 * https://rolisteam.org/contact * 0004 * * 0005 * rolisteam is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #ifndef PLAYERWIDGET_H 0021 #define PLAYERWIDGET_H 0022 0023 #include <QContextMenuEvent> 0024 #include <QMenu> 0025 #include <QPointer> 0026 #include <QSlider> 0027 #include <QTime> 0028 #include <random> 0029 0030 #include "rwidgets_global.h" 0031 namespace Ui 0032 { 0033 class PlayerWidgetUI; 0034 } 0035 class AudioPlayerController; 0036 0037 /** 0038 * @brief The PlayerWidget class manages all widgets requiered for playing music. 0039 */ 0040 class RWIDGET_EXPORT PlayerWidget : public QWidget 0041 { 0042 Q_OBJECT 0043 public: 0044 PlayerWidget(AudioPlayerController* ctrl, QWidget* parent= nullptr); 0045 void updateUi(); 0046 0047 void addActionsIntoMenu(QMenu* menu); 0048 0049 protected: 0050 void contextMenuEvent(QContextMenuEvent* ev); 0051 void dropEvent(QDropEvent* event); 0052 0053 private: 0054 void setupUi(); 0055 0056 private slots: 0057 void updateIcon(); 0058 0059 void addFiles(); 0060 void openPlayList(); 0061 bool askToDeleteAll(); 0062 void openStream(); 0063 void savePlaylist(); 0064 0065 signals: 0066 void changePlayerDirectory(); 0067 0068 private: 0069 QPointer<AudioPlayerController> m_ctrl; 0070 QSlider* m_volume; 0071 QSlider* m_seek; 0072 QAction* m_playAct; 0073 QAction* m_stopAct; 0074 QAction* m_pauseAct; 0075 QAction* m_uniqueAct; 0076 QAction* m_repeatAct; 0077 QAction* m_shuffleAct; 0078 QAction* m_changeDirectoryAct; 0079 QAction* m_volumeMutedAct; 0080 QAction* m_loadTableTopAudioPlayListAct; 0081 QAction* m_addAction; //!< @brief add song action 0082 QAction* m_addStreamAction; 0083 QAction* m_deleteAction; //!< @brief remove song action 0084 QAction* m_openPlayList; 0085 QAction* m_savePlayList; 0086 QAction* m_clearList; 0087 Ui::PlayerWidgetUI* m_ui; 0088 }; 0089 #endif