1 /**************************************************************************
2 *   Copyright (C) 2005-2020 by Oleksandr Shneyder                         *
3 *                              <o.shneyder@phoca-gmbh.de>                 *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 *   This program is distributed in the hope that it will be useful,       *
10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12 *   GNU General Public License for more details.                          *
13 *                                                                         *
14 *   You should have received a copy of the GNU General Public License     *
15 *   along with this program.  If not, see <https://www.gnu.org/licenses/>. *
16 ***************************************************************************/
17 
18 #ifndef FOLDERBUTTON_H
19 #define FOLDERBUTTON_H
20 
21 #include "SVGFrame.h"
22 #include <QPushButton>
23 #include <QLabel>
24 class ONMainWindow;
25 class QComboBox;
26 class QPushButton;
27 
28 /**
29 	@author Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de>
30 */
31 class FolderButton : public SVGFrame
32 {
33     Q_OBJECT
34 public:
35     FolderButton ( ONMainWindow* mw, QWidget* parent, QString folderPath, QString folderName );
36     ~FolderButton();
37 
folderIcon()38     const QPixmap* folderIcon() {
39         return icon->pixmap();
40     }
41     static bool lessThen ( const FolderButton* b1, const FolderButton* b2 );
getName()42     QString getName()
43     {
44         return name;
45     }
getPath()46     QString getPath()
47     {
48         return path;
49     }
setPath(QString path)50     void setPath(QString path)
51     {
52         this->path=path;
53     }
setName(QString name)54     void setName(QString name)
55     {
56         this->name=name;
57     }
58     void loadIcon();
59 
60     void setChildrenList(QStringList children);
61 private:
62     QString path;
63     QString name;
64     QString description;
65     QLabel* nameLabel;
66     QLabel* icon;
67     ONMainWindow* par;
68 
69 private slots:
70     void slotClicked();
71 signals:
72     void folderSelected ( FolderButton* );
73     void clicked();
74 protected:
75     virtual void mousePressEvent ( QMouseEvent * event );
76     virtual void mouseReleaseEvent ( QMouseEvent * event );
77 };
78 
79 #endif
80