| 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 ALLPICVIEW_H |
| 22 |
#define ALLPICVIEW_H |
| 23 |
|
| 24 |
#include "application.h" |
| 25 |
#include "utils/baseutils.h" |
| 26 |
#include "utils/imageutils.h" |
| 27 |
#include "controller/configsetter.h" |
| 28 |
#include "controller/signalmanager.h" |
| 29 |
#include "dbmanager/dbmanager.h" |
| 30 |
#include "thumbnail/thumbnaillistview.h" |
| 31 |
#include "importview/importview.h" |
| 32 |
#include "searchview/searchview.h" |
| 33 |
#include "widgets/statusbar.h" |
| 34 |
#include "widgets/statusbar.h" |
| 35 |
|
| 36 |
#include <QWidget> |
| 37 |
#include <QVBoxLayout> |
| 38 |
#include <DLabel> |
| 39 |
#include <QPixmap> |
| 40 |
#include <QStandardPaths> |
| 41 |
#include <QImageReader> |
| 42 |
#include <DPushButton> |
| 43 |
#include <QDir> |
| 44 |
#include <QFileDialog> |
| 45 |
#include <QFileInfo> |
| 46 |
#include <DStackedWidget> |
| 47 |
#include <DSlider> |
| 48 |
#include <DSpinner> |
| 49 |
#include <DCommandLinkButton> |
| 50 |
|
| 51 |
DWIDGET_USE_NAMESPACE |
| 52 |
|
| 53 |
class NoResultWidget; |
| 54 |
class BatchOperateWidget; |
| 55 |
class AllPicView : public DWidget, public ImageEngineImportObject |
| 56 |
{ |
| 57 |
Q_OBJECT |
| 58 |
|
| 59 |
public: |
| 60 |
AllPicView(); |
| 61 |
|
| 62 |
bool imageImported(bool success) override; |
| 63 |
void restorePicNum(); |
| 64 |
void updatePicNum(); |
| 65 |
const ThumbnailListView *getAllPicThumbnailListViewModel(); |
| 66 |
|
| 67 |
private: |
| 68 |
void initConnections(); |
| 69 |
//初始化悬浮框 |
| 70 |
void initSuspensionWidget(); |
| 71 |
void initStackedWidget(); |
| 72 |
void updatePicsIntoThumbnailView(); |
| 73 |
void onUpdateAllpicsNumLabel(); |
| 74 |
void onKeyDelete(); |
| 75 |
|
| 76 |
void dragEnterEvent(QDragEnterEvent *e) override; |
| 77 |
void dropEvent(QDropEvent *event) override; |
| 78 |
void dragMoveEvent(QDragMoveEvent *event) override; |
| 79 |
void dragLeaveEvent(QDragLeaveEvent *e) override; |
| 80 |
void resizeEvent(QResizeEvent *e) override; |
| 81 |
|
| 82 |
public slots: |
| 83 |
//筛选显示,当先列表中内容为无结果 |
| 84 |
void slotNoPicOrNoVideo(bool isNoResult); |
| 85 |
void updateStackedWidget(); |
| 86 |
// 监控到新文件 |
| 87 |
void monitorHaveNewFile(QStringList list); |
| 88 |
|
| 89 |
private slots: |
| 90 |
//所有照片 |
| 91 |
|
| 92 |
void updatePicsIntoThumbnailViewWithCache(); |
| 93 |
void onRepeatImportingTheSamePhotos(QStringList importPaths, QStringList duplicatePaths, const QString &albumName); |
| 94 |
//打开图片 |
| 95 |
void onOpenImage(int row, const QString &path, bool bFullScreen); |
| 96 |
//幻灯片播放 |
| 97 |
void onSlideShow(const QString &path); |
| 98 |
void onImportViewImportBtnClicked(); |
| 99 |
void onImportFailedToView(); |
| 100 |
//图片刷新后更新 |
| 101 |
void onImgRemoved(const DBImgInfoList &infos); |
| 102 |
//缩略图选中项改变 |
| 103 |
void sltSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); |
| 104 |
|
| 105 |
public: |
| 106 |
DStackedWidget *m_pStackedWidget = nullptr; |
| 107 |
StatusBar *m_pStatusBar = nullptr; |
| 108 |
QWidget *m_pwidget = nullptr; |
| 109 |
ImportView *m_pImportView = nullptr; |
| 110 |
int step; |
| 111 |
const static int SUSPENSION_WIDGET_HEIGHT = 40;//悬浮控件高度 |
| 112 |
|
| 113 |
private: |
| 114 |
DWidget *m_thumbnailListViewWidget = nullptr; |
| 115 |
ThumbnailListView *m_pThumbnailListView = nullptr; |
| 116 |
NoResultWidget *m_noResultWidget = nullptr; |
| 117 |
SearchView *m_pSearchView = nullptr; |
| 118 |
// DSpinner *m_spinner;暂时废弃控件 |
| 119 |
DWidget *fatherwidget = nullptr; |
| 120 |
//悬浮时间栏控件 |
| 121 |
QWidget *m_SuspensionWidget = nullptr; |
| 122 |
BatchOperateWidget *m_batchOperateWidget = nullptr; |
| 123 |
DCommandLinkButton *m_suspensionChose = nullptr; |
| 124 |
public: |
| 125 |
ThumbnailListView *getThumbnailListView(); |
| 126 |
/** |
| 127 |
* @brief updatePicsIntoThumbnailView 针对单个或多个图片刷新 |
| 128 |
* @param strpath 图片路径队列 |
| 129 |
*/ |
| 130 |
void updatePicsThumbnailView(QStringList strpath = QStringList()); |
| 131 |
}; |
| 132 |
|
| 133 |
#endif // ALLPICVIEW_H |