Debian Codegraph @

src/album/widgets/dialogs/imginfodialog.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 IMGINFODIALOG_H
22 #define IMGINFODIALOG_H
23
24 #include <DDialog>
25 #include <DScrollArea>
26 //#include <DArrowLineExpand>
27 #include <DDrawer>
28 #include <denhancedwidget.h>
29
30 DWIDGET_USE_NAMESPACE
31
32 class QFormLayout;
33 class QVBoxLayout;
34 class QWidget;
35
36 class ImgInfoDialog : public DDialog
37 {
38 Q_OBJECT
39 public:
40 explicit ImgInfoDialog(const QString &path, QWidget *parent = nullptr);
41 int height();
42 private:
43 void initUI();
44 void setImagePath(const QString &path);
45 void updateInfo();
46 void clearLayout(QLayout *layout);
47 const QString trLabel(const char *str);
48 void updateBaseInfo(const QMap<QString, QString> &infos);
49 void updateDetailsInfo(const QMap<QString, QString> &infos);
50 QList<DDrawer *> addExpandWidget(const QStringList &titleList);
51 void initExpand(QVBoxLayout *layout, DDrawer *expand);
52 int contentHeight() const;
53
54 private:
55 int m_title_maxwidth;
56 int m_maxFieldWidth;
57 int m_currentFontSize;
58 bool m_isBaseInfo;
59 bool m_isDetailsInfo;
60 QString m_path;
61 QFrame *m_exif_base;
62 QFrame *m_exif_details;
63 QFormLayout *m_exifLayout_base;
64 QFormLayout *m_exifLayout_details;
65 QList<DDrawer *> m_expandGroup;
66 QVBoxLayout *m_mainLayout;
67 DScrollArea *m_scrollArea;
68 bool m_mousePress = false;
69 int m_mouseY = 0;
70 void keyPressEvent(QKeyEvent *e) override;
71 void paintEvent(QPaintEvent *event) override;
72 bool event(QEvent *event)override;
73 bool eventFilter(QObject *obj, QEvent *e) Q_DECL_OVERRIDE;
74 };
75
76 #endif // IMGINFODIALOG_H