2 GNU GENERAL PUBLIC LICENSE
3 Version 3, 29 June 2007
5 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
11 The GNU General Public License is a free, copyleft license for
12 software and other kinds of works.
14 The licenses for most software and other practical works are designed
15 to take away your freedom to share and change the works. By contrast,
16 the GNU General Public License is intended to guarantee your freedom to
17 share and change all versions of a program--to make sure it remains free
18 software for all its users. We, the Free Software Foundation, use the
19 GNU General Public License for most of our software; it applies also to
20 any other work released this way by its authors. You can apply it to
23 When we speak of free software, we are referring to freedom, not
24 price. Our General Public Licenses are designed to make sure that you
25 have the freedom to distribute copies of free software (and charge for
26 them if you wish), that you receive source code or can get it if you
27 want it, that you can change the software or use pieces of it in new
28 free programs, and that you know you can do these things.
30 To protect your rights, we need to prevent others from denying you
31 these rights or asking you to surrender the rights. Therefore, you have
32 certain responsibilities if you distribute copies of the software, or if
33 you modify it: responsibilities to respect the freedom of others.
35 For example, if you distribute copies of such a program, whether
36 gratis or for a fee, you must pass on to the recipients the same
37 freedoms that you received. You must make sure that they, too, receive
38 or can get the source code. And you must show them these terms so they
41 Developers that use the GNU GPL protect your rights with two steps:
42 (1) assert copyright on the software, and (2) offer you this License
43 giving you legal permission to copy, distribute and/or modify it.
45 For the developers' and authors' protection, the GPL clearly explains
46 that there is no warranty for this free software. For both users' and
47 authors' sake, the GPL requires that modified versions be marked as
48 changed, so that their problems will not be attributed erroneously to
49 authors of previous versions.
51 Some devices are designed to deny users access to install or run
52 modified versions of the software inside them, although the manufacturer
53 can do so. This is fundamentally incompatible with the aim of
54 protecting users' freedom to change the software. The systematic
55 pattern of such abuse occurs in the area of products for individuals to
56 use, which is precisely where it is most unacceptable. Therefore, we
57 have designed this version of the GPL to prohibit the practice for those
58 products. If such problems arise substantially in other domains, we
59 stand ready to extend this provision to those domains in future versions
60 of the GPL, as needed to protect the freedom of users.
62 Finally, every program is threatened constantly by software patents.
63 States should not allow patents to restrict development and use of
64 software on general-purpose computers, but in those that do, we wish to
65 avoid the special danger that patents applied to a free program could
66 make it effectively proprietary. To prevent this, the GPL assures that
67 patents cannot be used to render the program non-free.
69 The precise terms and conditions for copying, distribution and
72 http://www.gnu.org/licenses/gpl-3.0.txt
75 * @file ffdpadbutton.cpp
76 * @brief Implementation of the FFiPadButton class
78 * @author ComArch S.A.
83 #include "ffdpadbutton.h"
86 * Constructs a FFDPadButton with size and parent.
88 FFDPadButton::FFDPadButton(QString path, int type, QWidget* parent) :
89 QAbstractButton(parent)
92 //initiates button's elements
93 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
101 buttonView = new FFViewCache(this);
102 buttonPressedView = new FFViewCache(this);
104 buttonView->init(path + ".svg");
105 buttonPressedView->init(path + "_pressed.svg");
109 /** A virtual destructor */
110 FFDPadButton::~FFDPadButton()
116 * Sets size of FFDPadButton
117 * Calls updateView of FFViewCache objects to fit pixmap's size
118 * to new FFDPadButton's size.
119 * Calls updateMask() to set new event's mask for FFDPadButton.
121 * @param size is a new size of FFDPadButton
123 void FFDPadButton::setSize(QSize size)
126 buttonView->updateView(size);
127 buttonPressedView->updateView(size);
128 setGeometry(0,0, size.width(),size.height());
134 * Returns a value that tells if the FFDPadButton is pressed.
136 bool FFDPadButton::isPressed() const
141 * Sets FFDPadButton's state. Value "true" means that the FFDPadButton is pressed.
143 void FFDPadButton::setPressed(bool pressed_)
145 this->pressed_ = pressed_;
148 * Returns a value defining type of pressed FFDPadButton.
150 int FFDPadButton::type() const
155 * Sets type of FFDPadButton defined in enum BUTTON_TYPE,which is placed
156 * in file ffdipabutton.h.
158 void FFDPadButton::setType(int type_)
163 * Updates events' mask for FFDPadButton based on pixmap
165 void FFDPadButton::updateMask()
168 setMask(buttonPressedView->pixmap().mask());
170 setMask(buttonView->pixmap().mask());
174 * Repaints the view of FFDPadButton. There are 2 views of FFDiButton for both
175 * states pressed and unpressed. Overrides the virtual method from QWidget.
176 * @param event Contains all informations about event.
178 void FFDPadButton::paintEvent(QPaintEvent *event)
181 QPainter paint(this);
183 paint.drawPixmap(0, 0, buttonPressedView->pixmap());
185 paint.drawPixmap(0, 0, buttonView->pixmap());
188 * Sets pressed_ value on true and calls updateMask() method.
189 * At the end calls update() method.
190 * Overrides the virtual method from QWidget.
191 * @param event Contains all informations about event.
193 void FFDPadButton::mousePressEvent(QMouseEvent *)
199 * Sets pressed_ value on false and calls updateMask() and update() method.
200 * At the end emit buttonClicked() signal.
201 * Overrides the virtual method from QWidget.
202 * @param event Contains all informations about event.
204 void FFDPadButton::mouseReleaseEvent(QMouseEvent *)
208 emit clicked(this->type_);
212 \fn void FFDPadButton::clicked(int type)
214 This signal is emitted when the button was released.