Falkon Develop
Cross-platform Qt-based web browser
abstractbuttoninterface.cpp
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2018 David Rosca <nowrep@gmail.com>
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 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
19
21 : QObject(parent)
22{
23}
24
26{
27 return !id().isEmpty() && !name().isEmpty();
28}
29
31{
32 return m_active;
33}
34
36{
37 if (m_active == active) {
38 return;
39 }
40
41 m_active = active;
42 Q_EMIT activeChanged(m_active);
43}
44
46{
47 return m_visible;
48}
49
51{
52 if (m_visible == visible) {
53 return;
54 }
55
56 m_visible = visible;
57 Q_EMIT visibleChanged(m_visible);
58}
59
61{
62 return m_title;
63}
64
65void AbstractButtonInterface::setTitle(const QString &title)
66{
67 if (m_title == title) {
68 return;
69 }
70
71 m_title = title;
72 Q_EMIT titleChanged(m_title);
73}
74
76{
77 return m_toolTip;
78}
79
80void AbstractButtonInterface::setToolTip(const QString &toolTip)
81{
82 if (m_toolTip == toolTip) {
83 return;
84 }
85
86 m_toolTip = toolTip;
87 Q_EMIT toolTipChanged(m_toolTip);
88}
89
91{
92 return m_icon;
93}
94
95void AbstractButtonInterface::setIcon(const QIcon &icon)
96{
97 m_icon = icon;
98 Q_EMIT iconChanged(icon);
99}
100
102{
103 return m_badgeText;
104}
105
106void AbstractButtonInterface::setBadgeText(const QString &badgeText)
107{
108 if (m_badgeText == badgeText) {
109 return;
110 }
111
112 m_badgeText = badgeText;
113 Q_EMIT badgeTextChanged(m_badgeText);
114}
115
117{
118 return m_view;
119}
120
122{
123 if (m_view == view) {
124 return;
125 }
126
127 m_view = view;
128 Q_EMIT webViewChanged(m_view);
129}
void titleChanged(const QString &title)
void webViewChanged(WebView *view)
virtual QString id() const =0
void iconChanged(const QIcon &icon)
void setTitle(const QString &text)
void badgeTextChanged(const QString &badgeText)
void setBadgeText(const QString &badgeText)
void setToolTip(const QString &toolTip)
void activeChanged(bool active)
virtual QString name() const =0
AbstractButtonInterface(QObject *parent=nullptr)
void visibleChanged(bool visible)
void toolTipChanged(const QString &toolTip)
void setIcon(const QIcon &icon)