| 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 TTBCONTENT_H |
| 22 |
#define TTBCONTENT_H |
| 23 |
|
| 24 |
#include <QWidget> |
| 25 |
#include <QLabel> |
| 26 |
#include "controller/viewerthememanager.h" |
| 27 |
//#include <dlistwidget.h> |
| 28 |
//#include <DListWidget> |
| 29 |
#include <DListWidget> |
| 30 |
#include <DSpinner> |
| 31 |
//#include <DtkWidgets> |
| 32 |
//#include "dlistwidget.h" |
| 33 |
#include <QListWidget> |
| 34 |
#include <DListView> |
| 35 |
#include <QAbstractItemModel> |
| 36 |
#include <QStandardItem> |
| 37 |
#include "dbmanager/dbmanager.h" |
| 38 |
#include <DAnchors> |
| 39 |
#include <dimagebutton.h> |
| 40 |
#include <DThumbnailProvider> |
| 41 |
#include <QPropertyAnimation> |
| 42 |
#include <QHBoxLayout> |
| 43 |
#include <DIconButton> |
| 44 |
#include <DBlurEffectWidget> |
| 45 |
#include <DGuiApplicationHelper> |
| 46 |
#include <DLabel> |
| 47 |
#include "imageengine/imageengineobject.h" |
| 48 |
#include "signalmanager.h" |
| 49 |
|
| 50 |
DWIDGET_USE_NAMESPACE |
| 51 |
|
| 52 |
class ElidedLabel; |
| 53 |
class QAbstractItemModel; |
| 54 |
//class DImageButton; |
| 55 |
class ImageButton; |
| 56 |
class ImgViewListView; |
| 57 |
class ImageItem; |
| 58 |
class MyImageListWidget; |
| 59 |
|
| 60 |
class TTBContent : public QLabel |
| 61 |
{ |
| 62 |
Q_OBJECT |
| 63 |
public: |
| 64 |
struct TTBContentData { |
| 65 |
int index; |
| 66 |
DBImgInfo data; |
| 67 |
}; |
| 68 |
// explicit TTBContent(bool inDB, DBImgInfoList m_infos, QWidget *parent = 0); |
| 69 |
explicit TTBContent(bool inDB, QWidget *parent = nullptr); |
| 70 |
~TTBContent() override |
| 71 |
{ |
| 72 |
} |
| 73 |
|
| 74 |
// void reLoad(); |
| 75 |
bool setCurrentItem(); |
| 76 |
void updateScreen(); |
| 77 |
// void updateScreenNoAnimation(); |
| 78 |
int itemLoadedSize(); |
| 79 |
//设置需要浏览的图片信息 |
| 80 |
void setAllFileInfo(const SignalManager::ViewInfo &info); |
| 81 |
//获取所有图片数量 |
| 82 |
int getAllFileCount(); |
| 83 |
signals: |
| 84 |
void resetTransform(bool fitWindow); |
| 85 |
void rotateClockwise(); |
| 86 |
void rotateCounterClockwise(); |
| 87 |
|
| 88 |
void removed(); |
| 89 |
void imageEmpty(bool v); |
| 90 |
void contentWidthChanged(int width); |
| 91 |
void showPrevious(); |
| 92 |
void feedBackCurrentIndex(int index, const QString &path); |
| 93 |
//平板需求,退出时重置ttb显隐 |
| 94 |
void resetShoworHide(); |
| 95 |
|
| 96 |
public slots: |
| 97 |
void setImage(const QString &path); |
| 98 |
void updateCollectButton(); |
| 99 |
|
| 100 |
void onResize(); |
| 101 |
void disCheckAdaptImageBtn(); |
| 102 |
void disCheckAdaptScreenBtn(); |
| 103 |
void checkAdaptImageBtn(); |
| 104 |
void checkAdaptScreenBtn(); |
| 105 |
void deleteImage(); |
| 106 |
void onNextButton(); |
| 107 |
void onPreButton(); |
| 108 |
void updateFilenameLayout(); |
| 109 |
void onBackButtonClicked(); |
| 110 |
void onAdaptImageBtnClicked(); |
| 111 |
void onAdaptScreenBtnClicked(); |
| 112 |
void onclBTClicked(); |
| 113 |
void onRotateLBtnClicked(); |
| 114 |
void onRotateRBtnClicked(); |
| 115 |
void onTrashBtnClicked(); |
| 116 |
|
| 117 |
private slots: |
| 118 |
|
| 119 |
protected: |
| 120 |
void resizeEvent(QResizeEvent *event) override; |
| 121 |
public: |
| 122 |
QString m_imageType; |
| 123 |
|
| 124 |
private: |
| 125 |
#ifndef LITE_DIV |
| 126 |
PushButton *m_folderBtn; |
| 127 |
ReturnButton *m_returnBtn; |
| 128 |
#endif |
| 129 |
bool m_inDB; |
| 130 |
bool m_bClBTChecked; |
| 131 |
|
| 132 |
DIconButton *m_adaptImageBtn = nullptr; |
| 133 |
DIconButton *m_adaptScreenBtn = nullptr; |
| 134 |
DIconButton *m_clBT = nullptr; |
| 135 |
DIconButton *m_rotateLBtn = nullptr; |
| 136 |
DIconButton *m_rotateRBtn = nullptr; |
| 137 |
DIconButton *m_trashBtn = nullptr; |
| 138 |
DIconButton *m_preButton = nullptr; |
| 139 |
DIconButton *m_nextButton = nullptr; |
| 140 |
DIconButton *m_backButton = nullptr; |
| 141 |
ElidedLabel *m_fileNameLabel = nullptr; |
| 142 |
MyImageListWidget *m_imgListWidget = nullptr; |
| 143 |
int m_windowWidth; |
| 144 |
int m_contentWidth; |
| 145 |
bool badaptImageBtnChecked = false; |
| 146 |
bool badaptScreenBtnChecked = false; |
| 147 |
QString m_currentpath = ""; |
| 148 |
}; |
| 149 |
|
| 150 |
#endif // TTLCONTENT_H |