2020-04-06 15:15:13 +08:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
namespace Ui { class MainWindow; }
|
|
|
|
|
2020-04-06 20:23:29 +08:00
|
|
|
class QMediaPlayer;
|
2020-04-06 15:15:13 +08:00
|
|
|
class QPropertyAnimation;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MainWindow(QWidget *parent = nullptr);
|
|
|
|
~MainWindow() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
|
|
|
2020-04-06 20:23:29 +08:00
|
|
|
void loadFile();
|
|
|
|
|
2020-04-06 15:15:13 +08:00
|
|
|
private slots:
|
|
|
|
void on_closeWindowBtn_clicked();
|
2020-04-06 20:23:29 +08:00
|
|
|
void on_playBtn_clicked();
|
|
|
|
void on_volumeSlider_valueChanged(int value);
|
|
|
|
void on_stopBtn_clicked();
|
|
|
|
|
|
|
|
void on_playbackSlider_valueChanged(int value);
|
|
|
|
|
|
|
|
void on_prevBtn_clicked();
|
|
|
|
|
|
|
|
void on_nextBtn_clicked();
|
|
|
|
|
|
|
|
void on_volumeBtn_clicked();
|
|
|
|
|
|
|
|
void on_minimumWindowBtn_clicked();
|
2020-04-06 15:15:13 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
QPoint m_oldMousePos;
|
|
|
|
bool m_clickedOnWindow = false;
|
2020-04-06 20:23:29 +08:00
|
|
|
bool m_playbackSliderPressed = false;
|
2020-04-06 15:15:13 +08:00
|
|
|
QLinearGradient m_bgLinearGradient;
|
|
|
|
|
|
|
|
Ui::MainWindow *ui;
|
|
|
|
|
2020-04-06 20:23:29 +08:00
|
|
|
QMediaPlayer *m_mediaPlayer;
|
2020-04-06 15:15:13 +08:00
|
|
|
QPropertyAnimation *m_fadeOutAnimation;
|
2020-04-06 20:23:29 +08:00
|
|
|
|
|
|
|
static QString ms2str(qint64 ms);
|
2020-04-06 15:15:13 +08:00
|
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|