Debian Codegraph @

src/album/albumview/albumimagebutton.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 #pragma once
22
23 #include <QScopedPointer>
24 #include <QMap>
25 #include <QVariant>
26
27 #include <DPushButton>
28
29 DWIDGET_USE_NAMESPACE
30
31 class AlbumImageButton : public DPushButton
32 {
33 struct MusicPicPathInfo {
34 QString normalPicPath;
35 QString hoverPicPath;
36 QString pressPicPath;
37 QString checkedPicPath;
38 };
39 Q_OBJECT
40 public:
41 explicit AlbumImageButton(QWidget *parent = Q_NULLPTR);
42 AlbumImageButton(const QString &normalPic, const QString &hoverPic,
43 const QString &pressPic, const QString &checkedPic = QString(), QWidget *parent = nullptr);
44 void setPropertyPic(const QString &propertyName, const QVariant &value, const QString &normalPic, const QString &hoverPic,
45 const QString &pressPic, const QString &checkedPic = QString());
46 void setPropertyPic(const QString &normalPic, const QString &hoverPic,
47 const QString &pressPic, const QString &checkedPic = QString());
48 // void setTransparent(bool flag);
49 // void setAutoChecked(bool flag);
50 protected:
51 void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
52 void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
53 void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
54 void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
55 void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
56 private:
57 char status;
58 bool autoChecked;
59 MusicPicPathInfo defaultPicPath;
60 bool transparent;
61 QPair<QString, QMap<QVariant, MusicPicPathInfo> > propertyPicPaths;
62 };