| 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 THUMBNAILWIDGET_H |
| 22 |
#define THUMBNAILWIDGET_H |
| 23 |
|
| 24 |
#include <QLabel> |
| 25 |
#include <QPaintEvent> |
| 26 |
#include <QMouseEvent> |
| 27 |
|
| 28 |
#include <DLabel> |
| 29 |
|
| 30 |
#include "controller/viewerthememanager.h" |
| 31 |
#include "widgets/themewidget.h" |
| 32 |
|
| 33 |
class ThumbnailWidget : public ThemeWidget |
| 34 |
{ |
| 35 |
Q_OBJECT |
| 36 |
public: |
| 37 |
ThumbnailWidget(const QString &darkFile, const QString |
| 38 |
&lightFile, QWidget *parent = nullptr); |
| 39 |
~ThumbnailWidget() override; |
| 40 |
signals: |
| 41 |
void mouseHoverMoved(); |
| 42 |
#ifdef LITE_DIV |
| 43 |
void openImageInDialog(); |
| 44 |
#endif |
| 45 |
|
| 46 |
public slots: |
| 47 |
void setThumbnailImage(const QPixmap thumbnail); |
| 48 |
void onThemeTypeChanged(); |
| 49 |
|
| 50 |
|
| 51 |
// bool isDefaultThumbnail(); |
| 52 |
protected: |
| 53 |
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; |
| 54 |
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; |
| 55 |
private: |
| 56 |
void onThemeChanged(ViewerThemeManager::AppTheme theme); |
| 57 |
|
| 58 |
bool m_isDefaultThumbnail = false; |
| 59 |
QLabel *m_thumbnailLabel; |
| 60 |
QPixmap m_logo; |
| 61 |
#ifndef LITE_DIV |
| 62 |
QLabel *m_tips; |
| 63 |
#endif |
| 64 |
QPixmap m_defaultImage; |
| 65 |
QColor m_inBorderColor; |
| 66 |
QString m_picString; |
| 67 |
bool m_theme; |
| 68 |
bool m_usb = false; |
| 69 |
}; |
| 70 |
|
| 71 |
#endif // THUMBNAILWIDGET_H |