File indexing completed on 2024-04-28 05:38:03

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 
0021 /**!
0022  * @brief
0023  * This player can be used by the GM to play song.
0024  * Regular players can just change the volume level.
0025  */
0026 
0027 #ifndef AUDIO_PLAYER_H
0028 #define AUDIO_PLAYER_H
0029 
0030 #include <QAction>
0031 #include <QDockWidget>
0032 #include <QEvent>
0033 #include <QLCDNumber>
0034 #include <QLineEdit>
0035 #include <QList>
0036 #include <QListView>
0037 #include <QMediaPlayer>
0038 #include <QMutex>
0039 #include <QSlider>
0040 #include <QString>
0041 #include <QVBoxLayout>
0042 #include <QWidget>
0043 
0044 #include "model/musicmodel.h"
0045 #include "rwidgets/customs/playerwidget.h"
0046 
0047 class AudioController;
0048 /**
0049  * @brief This player can be used by the GM to play songs.
0050  * Regular players can just change the volume level.
0051  */
0052 class RWIDGET_EXPORT AudioPlayer : public QDockWidget
0053 {
0054     Q_OBJECT
0055 
0056 public:
0057     AudioPlayer(AudioController* ctrl, QWidget* parent= nullptr);
0058     ~AudioPlayer();
0059 
0060 protected:
0061     void contextMenuEvent(QContextMenuEvent* ev);
0062 
0063 private:
0064     void playerWidget();
0065     void setupUi();
0066 signals:
0067     void changePlayerDirectory();
0068 
0069 private:
0070     QPointer<AudioController> m_ctrl;
0071     QWidget* m_mainWidget; //!< @brief brings together all subwidget
0072     QVBoxLayout* m_mainLayout;
0073 
0074     QList<PlayerWidget*> m_players;
0075     QList<QAction*> m_playerActionsList;
0076 
0077     qint64 m_time; //!< @brief current time
0078 };
0079 
0080 #endif