Debian Codegraph @

src/album/albumview/albumview.h

raw ◀ ▶
1 Debian patch touch this file
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 ALBUMVIEW_H
22 #define ALBUMVIEW_H
23
24 #include "thumbnail/thumbnaillistview.h"
25 #include "dbmanager/dbmanager.h"
26 #include "controller/signalmanager.h"
27 #include "widgets/albumlefttabitem.h"
28 #include "importview/importview.h"
29 #include "searchview/searchview.h"
30 #include "widgets/statusbar.h"
31 #include "importtimelineview/importtimelineview.h"
32 #include "leftlistview.h"
33 #include "waitdevicedialog.h"
34 #include "dialogs/albumdeletedialog.h"
35
36 #include <QWidget>
37 #include <QSplitter>
38 #include <QUrl>
39 #include <DListWidget>
40 #include <QListWidgetItem>
41 #include <QVBoxLayout>
42 #include <DLineEdit>
43 #include <DStackedWidget>
44 #include <DPushButton>
45 #include <dgiomount.h>
46 #include <DApplicationHelper>
47 #include <DSpinner>
48 #include <DSuggestButton>
49 #include <DDialog>
50 #include <ddiskmanager.h>
51 #include <dblockdevice.h>
52 #include <ddiskdevice.h>
53 #include "leftlistwidget.h"
54 #include <QRunnable>
55 #include <QThreadPool>
•56 #include <DComboBox>
57
58 //#define GIO_COMPILATION
59 #undef signals
60 extern "C" {
61 #include <gio/gio.h>
62 }
63
64
65 #define signals public
66
67 DWIDGET_USE_NAMESPACE
68 DCORE_USE_NAMESPACE
69
70 class DGioVolumeManager;
71 class AlbumView;
72 class AlbumView : public QWidget, public ImageEngineImportObject, public ImageMountGetPathsObject, public ImageMountImportPathsObject
73 {
74 Q_OBJECT
75
76 public:
77 enum MenuItemId {
78 IdStartSlideShow,
79 IdCreateAlbum,
80 IdRenameAlbum,
81 IdExport,
82 IdDeleteAlbum,
83 };
84
85 enum AblumType {
86 photosType,
87 ablumType,
88 devType
89 };
90
91 AlbumView();
92 ~AlbumView() override;
93
94 bool imageImported(bool success) override;
95 bool imageGeted(QStringList &filelist, QString path) override;
96 bool imageMountImported(QStringList &filelist) override;
97
98 void iniWaitDiolag();
99 void SearchReturnUpdate();
100 void restorePicNum();
101 void updatePicNum();
102 void updateRightView();
103 void updateAlbumView(const QString &album);
104 void updateDeviceLeftList();
105 void setCurrentItemType(int type);
106 void leftTabClicked();
107 private:
108 void initConnections();
109 void initLeftView();
110 void initRightView();
111 //初始化最近删除
112 void initTrashWidget();
113 //初始化自定义相册列表
114 void initCustomAlbumWidget();
115 //初始化收藏列表
116 void initFavoriteWidget();
117 //初始化设备列表
118 void initPhoneWidget();
119 //显示照片与视频总数
120 void resetLabelCount(int photosCount, int videosCount, DLabel *lable);
121
122 void updateRightCustomAlbumView();
123 void updateRightTrashView();
124 void updateRightImportView();
125 void updateRightMyFavoriteView();
126 void updateRightMountView();
127 //打开图片
128 void onOpenImageFav(int row, const QString &path, bool bFullScreen);
129 //打开图片
130 void onOpenImageCustom(int row, const QString &path, bool bFullScreen);
131 //幻灯片播放
132 void onSlideShowFav(const QString &path);
133 //幻灯片播放
134 void onSlideShowCustom(const QString &path);
135
136 void dragEnterEvent(QDragEnterEvent *e) override;
137 void dropEvent(QDropEvent *event) override;
138 void dragMoveEvent(QDragMoveEvent *event) override;
139 void dragLeaveEvent(QDragLeaveEvent *e) override;
140 void resizeEvent(QResizeEvent *e) override;
141 void showEvent(QShowEvent *e) override;
142 void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
143
144 void onVfsMountChangedAdd(QExplicitlySharedDataPointer<DGioMount> mount);
145 void onVfsMountChangedRemove(QExplicitlySharedDataPointer<DGioMount> mount); //拔掉外设移除
146 const QList<QExplicitlySharedDataPointer<DGioMount> > getVfsMountList();
147
148 void initExternalDevice();
149 void updateExternalDevice(QExplicitlySharedDataPointer<DGioMount> mount, QString strPath = QString());
150 bool findPicturePathByPhone(QString &path);
151 void updateImportComboBox();
152 void importAllBtnClicked();
153 void importSelectBtnClicked();
154
155 void initLeftMenu();
156 void importComboBoxChange(QString strText);
157 void getAllDeviceName();
158
159 signals:
160 void sigSearchEditIsDisplay(bool bIsDisp);
161 void sigLoadMountImagesStart(QString mountName, QString path);
162
163 private slots:
164 void onTrashRecoveryBtnClicked();
165 void onUpdataAlbumRightTitle(const QString &titlename);
166 void onUnMountSignal(const QString &unMountPath); //手动卸载设备
167 void onCreateNewAlbumFromDialog(const QString &newalbumname);
168 void onCreateNewAlbumFrom(const QString &albumname);
169 void onLeftListDropEvent(QModelIndex dropIndex);
170 void onKeyDelete();
171 void onKeyF2();
172 void needUnMount(const QString &path);
173 void importDialog();
174 void onWaitDialogClose();
175 void onWaitDialogIgnore();
176 // change lambda to normal slt
177 void onRepeatImportingTheSamePhotos(QStringList importPaths, QStringList duplicatePaths, const QString &albumName);
178 void ongMouseMove();
179 void onSelectAll();
180 void onInsertedIntoAlbum(const QString &albumname, QStringList pathlist);
181 void onFileSystemAdded(const QString &dbusPath);
182 void onBlockDeviceAdded(const QString &blks);
183 void onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType);
184 void onRightPhoneCustomContextMenuRequested();
185 void onRightPhoneThumbnailListMouseRelease();
186 void onImportViewImportBtnClicked();
187 void onImportFailedToView();
188 void onWaitDailogTimeout();
189 void onLeftListViewMountListWidgetClicked(const QModelIndex &index);
190
191 //接收到设备中文件列表加载完成信号
192 void sltLoadMountFileList(const QString &path, QStringList fileList);
193 //筛选显示,当先列表中内容为无结果
194 void slotNoPicOrNoVideo(bool isNoResult);
195 //缩略图选中项改变
196 void sltSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
197 //最近删除中有变化
198 void onTrashInfosChanged();
199 public:
200 int m_iAlubmPicsNum;
201 QString m_currentAlbum;
202 QString m_currentType;
203 AblumType m_currentItemType = photosType;
204 int m_selPicNum;
205 bool m_itemClicked;
206
207 DStackedWidget *m_pRightStackWidget;
208 LeftListView *m_pLeftListView;
209 StatusBar *m_pStatusBar;
210 DWidget *m_pRightWidget;
211
212 ThumbnailListView *m_pRightPhoneThumbnailList; //设备相关列表
213 QMap<QString, QStringList> m_phoneNameAndPathlist;
214 //LMH0424
215 QStringList m_pictrueallPathlist;
216
217 DWidget *m_pwidget;
218
219 ThumbnailListView *m_customThumbnailList = nullptr; //自定义
220 DBImgInfoList m_allTrashInfos; //最近删除中的数据
221 ThumbnailListView *m_pRightTrashThumbnailList = nullptr; //最近删除
222 ThumbnailListView *m_favoriteThumbnailList = nullptr; //我的收藏
223
224 DWidget *pImportTimeLineWidget;
225 Waitdevicedialog *m_waitDeviceScandialog;
226 ImportView *m_pImportView;
227 // 已导入窗体
228 ImportTimeLineView *m_pImpTimeLineView;
229
230 const static int custom_title_height = 60;
231 const static int favorite_title_height = 60;
232 const static int trash_title_height = 60;
233 const static int magin_offset = 20;//标题不居中偏移
234 private:
235 //自定义相册标题
236 DLabel *m_customAlbumTitleLabel = nullptr;
237 DLabel *m_pRightPicTotal = nullptr;
238 BatchOperateWidget *m_customBatchOperateWidget = nullptr;
239 DWidget *m_customAlbumTitle = nullptr; //自定义相册悬浮标题
240 DWidget *m_pCustomAlbumWidget = nullptr; //自定义相册右侧展示界面外层窗口
241 NoResultWidget *m_customNoResultWidget = nullptr;
242 //我的收藏标题栏
243 DWidget *m_pFavoriteWidget = nullptr;
244 DWidget *m_FavoriteTitleWidget = nullptr;
245 DLabel *m_pFavoriteTitle;
246 DLabel *m_pFavoritePicTotal;
247 BatchOperateWidget *m_favoriteBatchOperateWidget = nullptr;
248 NoResultWidget *m_favoriteNoResultWidget = nullptr;
249 //外部设备
250 DLabel *m_pPhoneTitle;
251 DLabel *m_pPhonePicTotal;
252 SearchView *m_pSearchView;
253 DGioVolumeManager *m_vfsManager;
254 DDiskManager *m_diskManager;
255 //最近删除标题
256 DLabel *m_TrashTitleLab = nullptr;
257 DLabel *m_TrashDescritionLab = nullptr;
258 DWidget *m_TrashTitleWidget = nullptr;
259 BatchOperateWidget *m_trashBatchOperateWidget = nullptr;
260 DWidget *m_pTrashWidget = nullptr; //最近删除外层界面
261 NoResultWidget *m_trashNoResultWidget = nullptr;
262 //手机照片导入窗体
263 DWidget *m_importByPhoneWidget;
264 DComboBox *m_importByPhoneComboBox;
265 DPushButton *m_importAllByPhoneBtn;
266 DSuggestButton *m_importSelectByPhoneBtn;
267 QList<QExplicitlySharedDataPointer<DGioMount>> m_mounts; //外部设备挂载
268
269 DBImgInfoList m_curThumbnaiItemList_info;
270 QStringList m_curThumbnaiItemList_str;
271 int m_mountPicNum;
272
273 QMap<QUrl, QString> durlAndNameMap;
274 DSpinner *m_spinner = nullptr;
275 //add start 3975
276 AlbumDeleteDialog *m_deleteDialog = nullptr;
277 //add end 3975
278 DWidget *pPhoneWidget;
279 DWidget *phonetopwidget;
280 bool isIgnore;
281 QTimer *m_waitDailog_timer;
282 QMap<QString, bool> mountLoadStatus;
283 };
284
285 #endif // ALBUMVIEW_H