1 /*  smplayer, GUI front-end for mplayer.
2     Copyright (C) 2006-2021 Ricardo Villalba <ricardo@smplayer.info>
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
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, write to the Free Software
16     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 */
18 
19 
20 #ifndef SHAREWIDGET_H
21 #define SHAREWIDGET_H
22 
23 #include <QWidget>
24 #include <QPushButton>
25 
26 class QSettings;
27 class QEvent;
28 
29 class ShareButton : public QPushButton
30 {
31 	Q_OBJECT
32 
33 public:
34 	ShareButton(const QString icon_name, const QString & tooltip, QWidget * parent = 0);
~ShareButton()35 	~ShareButton() {};
36 
37 	QSize sizeHint() const;
38 
39 protected:
40 	void enterEvent(QEvent *);
41 	void leaveEvent(QEvent *);
42 };
43 
44 
45 class ShareWidget : public QWidget
46 {
47 	Q_OBJECT
48 
49 public:
50 	enum Display { Never = 0, Random = 1, Always = 2 };
51 
52 	ShareWidget(QSettings * settings, QWidget * parent = 0, Qt::WindowFlags f = QFlag(0));
53 	~ShareWidget();
54 
55 	virtual void setVisible(bool visible);
56 
57 	void setActions(int a);
actions()58 	int actions() { return actions_taken; }
59 
60 	void loadConfig();
61 	void saveConfig();
62 
63 signals:
64 	void supportClicked();
65 
66 protected:
67 	void setActionPerformed(int action);
68 	void updateButtons();
69 	void retranslateStrings();
70 	virtual void changeEvent(QEvent * event);
71 
72 protected slots:
73 	void donate();
74 	void facebook();
75 	void twitter();
76 
77 protected:
78 	ShareButton * donate_button;
79 	ShareButton * fb_button;
80 	ShareButton * twitter_button;
81 	QPushButton * support_button;
82 
83 	QSettings * set;
84 	int actions_taken;
85 	int count;
86 	int display;
87 };
88 
89 #endif
90 
91