Debian Codegraph @

src/album/widgets/imgviewwidget.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 IMGVIEWWIDGET_H
22 #define IMGVIEWWIDGET_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 "controller/signalmanager.h"
49
50 DWIDGET_USE_NAMESPACE
51
52 class ElidedLabel;
53 class QAbstractItemModel;
54 //class DImageButton;
55 class ImageButton;
56 class MyImageListWidget;
57 class ImageItem;
58 class ImgViewListView;
59
60 class MyImageListWidget : public QWidget
61 {
62 Q_OBJECT
63 public:
64 explicit MyImageListWidget(QWidget *parent = nullptr);
65 ~MyImageListWidget() override;
66
67 void setAllFile(const SignalManager::ViewInfo &info, QString path); //设置需要展示的所有缩略图
68 //通过路径获取图片信息
69 DBImgInfo getImgInfo(const QString &path);
70 //将选中的项居中
71 void setSelectCenter();
72 //获取当前所有展示图片数量
73 int getImgCount();
74 //移除当前选中
75 void removeCurrent();
76 //加载当前页面前后各两百张图片
77 void reloadImage(int value);
78 protected:
79 signals:
80 void openImg(int index, QString path);
81 private:
82 void resetSelectImg();
83 public slots:
84 //列表点击事件
85 void onClicked(const QModelIndex &index);
86
87 void onScrollBarValueChanged(int value);
88
89 //查看下一张
90 void openNext();
91 //查看前一张
92 void openPre();
93 bool isLast();
94 bool isFirst();
95 private:
96 ImgViewListView *m_listview = nullptr;
97 QPoint m_pressPoint;//鼠标按下位置
98 QPoint m_pressListviewPoint;//鼠标按下时列表位置
99 QPoint m_releasePoint;//鼠标释放位置
100 bool m_mousePress = false;//鼠标是否按下
101 QTime m_mousePressTime;//记录鼠标按下的时间点
102 int m_time;//鼠标按下移动持续时间,毫秒
103 int m_moveSpeed = 0;
104 QTimer *m_loadTimer = nullptr;
105 int m_value = 0;
106 // QPropertyAnimation *m_correctAnimation = nullptr;//纠偏动画
107 };
108
109 #endif // IMGVIEWWIDGET_H