| 1 |
/* |
| 2 |
* Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd. |
| 3 |
* |
| 4 |
* Author: ZhangYong <[email protected]> |
| 5 |
* |
| 6 |
* Maintainer: ZhangYong <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
#ifndef SLIDESHOWPANEL_H |
| 22 |
#define SLIDESHOWPANEL_H |
| 23 |
|
| 24 |
#include "imageanimation.h" |
| 25 |
#include "controller/viewerthememanager.h" |
| 26 |
#include "controller/signalmanager.h" |
| 27 |
|
| 28 |
#include <DMenu> |
| 29 |
#include <DIconButton> |
| 30 |
#include <DLabel> |
| 31 |
#include <QHBoxLayout> |
| 32 |
#include <DFloatingWidget> |
| 33 |
#include <QShortcut> |
| 34 |
#include <QObject> |
| 35 |
|
| 36 |
class SlideShowBottomBar : public DFloatingWidget |
| 37 |
{ |
| 38 |
Q_OBJECT |
| 39 |
public: |
| 40 |
explicit SlideShowBottomBar(QWidget *parent = nullptr); |
| 41 |
public: |
| 42 |
DIconButton *m_preButton; |
| 43 |
DIconButton *m_nextButton; |
| 44 |
DIconButton *m_playpauseButton; |
| 45 |
DIconButton *m_cancelButton; |
| 46 |
int a = 0; |
| 47 |
|
| 48 |
public slots: |
| 49 |
void onPreButtonClicked(); |
| 50 |
void onPlaypauseButtonClicked(); |
| 51 |
void onUpdatePauseButton(); |
| 52 |
void onInitSlideShowButton(); |
| 53 |
void onNextButtonClicked(); |
| 54 |
void onCancelButtonClicked(); |
| 55 |
|
| 56 |
signals: |
| 57 |
void showPrevious(); |
| 58 |
void showPause(); |
| 59 |
void showContinue(); |
| 60 |
void showNext(); |
| 61 |
void showCancel(); |
| 62 |
}; |
| 63 |
|
| 64 |
class SlideShowPanel : public QWidget |
| 65 |
{ |
| 66 |
Q_OBJECT |
| 67 |
public: |
| 68 |
enum MenuItemId { |
| 69 |
IdStopslideshow, |
| 70 |
IdPlayOrPause, |
| 71 |
IdPlay, |
| 72 |
IdPause |
| 73 |
}; |
| 74 |
explicit SlideShowPanel(QWidget *parent = nullptr); |
| 75 |
void initConnections(); |
| 76 |
void initMenu(); |
| 77 |
void appendAction(int id, const QString &text, const QString &shortcut); |
| 78 |
void backToLastPanel(); |
| 79 |
void showNormal(); |
| 80 |
void showFullScreen(); |
| 81 |
//设置动画效果是否随机 |
| 82 |
void setIsRandom(bool isRandom); |
| 83 |
|
| 84 |
SlideShowBottomBar *slideshowbottombar; |
| 85 |
|
| 86 |
public slots: |
| 87 |
void startSlideShow(const SignalManager::ViewInfo &vinfo, bool inDB); |
| 88 |
void onMenuItemClicked(QAction *action); |
| 89 |
void onThemeChanged(ViewerThemeManager::AppTheme dark); |
| 90 |
// void onSingleAnimationEnd(); |
| 91 |
void onESCKeyStopSlide(); |
| 92 |
void onShowPause(); |
| 93 |
void onShowContinue(); |
| 94 |
void onShowPrevious(); |
| 95 |
void onShowNext(); |
| 96 |
void onCustomContextMenuRequested(); |
| 97 |
|
| 98 |
protected: |
| 99 |
void mouseMoveEvent(QMouseEvent *event) override; |
| 100 |
void timerEvent(QTimerEvent *event) override; |
| 101 |
private: |
| 102 |
ImageAnimation *m_animation; |
| 103 |
DMenu *m_menu; |
| 104 |
QShortcut *m_sEsc; |
| 105 |
SignalManager::ViewInfo m_vinfo; |
| 106 |
QColor m_bgColor; |
| 107 |
bool m_isMaximized; |
| 108 |
int m_hideCursorTid; |
| 109 |
}; |
| 110 |
|
| 111 |
#endif // SLIDESHOWPANEL_H |