| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #ifndef AVPLAYER2_PLAY_CONTROL_WINDOW_H
- #define AVPLAYER2_PLAY_CONTROL_WINDOW_H
- #pragma once
- #include <QSlider>
- #include <QWidget>
- #include <memory>
- #include <QPushButton>
- #include <QLabel>
- #include <QCheckBox>
- #include <QHBoxLayout>
- #include <QVBoxLayout>
- #include <QGridLayout>
- #include "clickable_slider.h"
- QT_BEGIN_NAMESPACE
- namespace Ui
- {
- class play_control_window;
- };
- QT_END_NAMESPACE
- class PlayerController;
- class PlayControlWnd : public QWidget
- {
- Q_OBJECT
- public:
- explicit PlayControlWnd(PlayerController* playerController, QWidget* parent = Q_NULLPTR);
- ~PlayControlWnd();
- public:
- void update_play_time(int64_t total_secs);
- void set_total_time(int64_t hours, int64_t mins, int64_t secs);
- inline QSlider* get_progress_slider() const;
- inline QSlider* get_volume_slider() const;
- inline QSlider* get_speed_slider() const;
- int get_volum_slider_max();
- int get_progress_slider_max();
- int get_progress_slider_value();
- void set_volume_slider(float volume);
- void clear_all();
- void update_btn_play(bool bPause = true);
- double get_total_time() const;
- double get_speed() const;
- void speed_adjust(bool up = true);
- public:
- static void get_play_time_params(int64_t total_secs, int64_t& hours, int64_t& mins, int64_t& secs);
- static QString get_play_time(int64_t hours, int64_t mins, int64_t secs);
- static inline double get_time_secs(int64_t hours, int64_t mins, int64_t secs);
- public slots:
- void volume_muted(int mute);
- void speed_changed(int speed);
- private:
- void enable_progressbar(bool enable = true);
- void enable_slider_vol(bool enable = true);
- void enable_slider_speed(bool enable = true);
- void init_slider_speed();
- void clear_time();
- void enable_play_buttons(bool enable = true);
- void update_play_time(int64_t hours, int64_t mins, int64_t secs);
- void set_progress_bar(double total_secs);
- void set_focus_policy();
- void keyPressEvent(QKeyEvent* event) override;
- private:
- // UI控件成员
- QPushButton* btn_pre = nullptr;
- QPushButton* btn_play = nullptr;
- QPushButton* btn_next = nullptr;
- QPushButton* btn_stop = nullptr;
- QSlider* slider_speed = nullptr;
- QLabel* label_speed = nullptr;
- QCheckBox* check_mute = nullptr;
- QSlider* slider_vol = nullptr;
- QLabel* label_vol = nullptr;
- ClickableSlider* progress_slider = nullptr;
- QLabel* label_curTime = nullptr;
- QLabel* label_totalTime = nullptr;
- QLabel* label_divider = nullptr;
- QGridLayout* gridLayout = nullptr;
- QHBoxLayout* hLayout_controls = nullptr;
- QHBoxLayout* hLayout_progress = nullptr;
- QVBoxLayout* mainLayout = nullptr;
- // ... 其它需要的布局和控件 ...
- int64_t m_hours{0};
- int64_t m_mins{0};
- int64_t m_secs{0};
- };
- #endif // AVPLAYER2_PLAY_CONTROL_WINDOW_H
|