Debian Codegraph @

src/album/widgets/batchoperatewidget.h

raw
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 BATCHOPERATEWIDGET_H
22 #define BATCHOPERATEWIDGET_H
23
24 #include <QWidget>
25 #include <QLabel>
26 #include "controller/viewerthememanager.h"
27 #include <DListWidget>
28 #include <DSpinner>
29 #include <QListWidget>
30 #include <DListView>
31 #include <QAbstractItemModel>
32 #include <QStandardItem>
33 #include "dbmanager/dbmanager.h"
34 #include <DAnchors>
35 #include <dimagebutton.h>
36 #include <DThumbnailProvider>
37 #include <QPropertyAnimation>
38 #include <QHBoxLayout>
39 #include <DIconButton>
40 #include <DBlurEffectWidget>
41 #include <DGuiApplicationHelper>
42 #include <DLabel>
43 #include <DToolButton>
44 #include <DCommandLinkButton>
45
46 #include "imageengine/imageengineobject.h"
47 #include "expansionpanel.h"
48
49 DWIDGET_USE_NAMESPACE
50
51 class ThumbnailListView;
52 class ExpansionMenu;
53 class FilterWidget;
54 class BatchOperateWidget : public QWidget
55 {
56 Q_OBJECT
57 public:
58 enum OperateType {
59 NullType = 0,
60 AllPicViewType,//所有照片
61 TimeLineViewType,//时间线
62 SearchViewType,//搜索
63 AlbumViewImportTimeLineViewType,//相册-最近导入
64 AlbumViewTrashType,//相册-已删除
65 AlbumViewFavoriteType,//相册-收藏
66 AlbumViewCustomType,//相册-自定义
67 AlbumViewPhoneType//相册-设备
68 };
69
70 public:
71 explicit BatchOperateWidget(ThumbnailListView *thumbnailListView, OperateType type, QWidget *parent = nullptr);
72 ~BatchOperateWidget() override;
73
74 void initUI();
75 //初始化最近删除相关按钮
76 void initTrashBtn(QHBoxLayout *hb);
77 //初始化下拉菜单
78 void initDropdown();
79 //刷新按钮显隐状态
80 void batchSelectChanged(bool isBatchSelect, bool disConnectSignal);
81 //刷新按钮可用状态 isNoSelected:是否有选中,true为没有
82 void refreshBtnEnabled(bool noSelected = false);
83 //刷新收藏按钮
84 void refreshCollectBtn();
85 protected:
86 void hideEvent(QHideEvent *event) override;
87 signals:
88 //进入批量状态
89 void signalBatchSelectChanged(bool isBatchSelect);
90 public slots:
91 //批量操作状态改变
92 void sltBatchSelectChanged();
93 //全选
94 void sltSelectAll();
95 //取消全选
96 void sltUnSelectAll();
97 //删除选中项
98 void sltRemoveSelect(bool checked);
99 //收藏选中项
100 void sltCollectSelect(bool checked);
101 //顺时针旋转图片
102 void sltRightRotate(bool checked);
103 //逆时针旋转图片
104 void sltLeftRotate(bool checked);
105 //缩略图选中项改变
106 void sltSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
107 //筛选显示变化
108 void sltCurrentFilterChanged(ExpansionPanel::FilteData &data);
109 //点击最近删除恢复按钮
110 void onTrashRecoveryBtnClicked();
111 //点击最近删除中删除按钮
112 void onTrashDeleteBtnClicked();
113
114 //主题变化
115 void onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType);
116 private:
117 //初始化信号槽
118 void initConnection();
119 //判断全部选中项是否全部已收藏
120 bool isAllSelectedCollected();
121 //刷新恢复与删除按钮是否可用状态
122 void refreshTrashBtnState();
123 private:
124 ExpansionMenu *m_expansionMenu = nullptr;
125 FilterWidget *m_ToolButton = nullptr;
126 //最近删除中使用按钮
127 DPushButton *m_trashRecoveryBtn = nullptr;
128 DPushButton *m_trashDeleteBtn = nullptr;
129
130 DToolButton *m_collection = nullptr;
131 DToolButton *m_leftRotate = nullptr;
132 DToolButton *m_rightRotate = nullptr;
133 DToolButton *m_delete = nullptr;
134 DCommandLinkButton *m_chooseAll = nullptr; //全选
135 DCommandLinkButton *m_cancelChooseAll = nullptr; //取消全选
136
137 DCommandLinkButton *m_startBatchSelect = nullptr; //进入批量状态
138 DCommandLinkButton *m_cancelBatchSelect = nullptr; //退出选择状态
139
140 ThumbnailListView *m_thumbnailListView = nullptr;
141 OperateType m_operateType;
142 };
143
144 #endif // BATCHOPERATEWIDGET_H