File indexing completed on 2024-05-12 04:58:25
0001 /* ============================================================ 0002 * Falkon - Qt web browser 0003 * Copyright (C) 2018 David Rosca <nowrep@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #include "abstractbuttoninterface.h" 0019 0020 AbstractButtonInterface::AbstractButtonInterface(QObject *parent) 0021 : QObject(parent) 0022 { 0023 } 0024 0025 bool AbstractButtonInterface::isValid() const 0026 { 0027 return !id().isEmpty() && !name().isEmpty(); 0028 } 0029 0030 bool AbstractButtonInterface::isActive() const 0031 { 0032 return m_active; 0033 } 0034 0035 void AbstractButtonInterface::setActive(bool active) 0036 { 0037 if (m_active == active) { 0038 return; 0039 } 0040 0041 m_active = active; 0042 Q_EMIT activeChanged(m_active); 0043 } 0044 0045 bool AbstractButtonInterface::isVisible() const 0046 { 0047 return m_visible; 0048 } 0049 0050 void AbstractButtonInterface::setVisible(bool visible) 0051 { 0052 if (m_visible == visible) { 0053 return; 0054 } 0055 0056 m_visible = visible; 0057 Q_EMIT visibleChanged(m_visible); 0058 } 0059 0060 QString AbstractButtonInterface::title() const 0061 { 0062 return m_title; 0063 } 0064 0065 void AbstractButtonInterface::setTitle(const QString &title) 0066 { 0067 if (m_title == title) { 0068 return; 0069 } 0070 0071 m_title = title; 0072 Q_EMIT titleChanged(m_title); 0073 } 0074 0075 QString AbstractButtonInterface::toolTip() const 0076 { 0077 return m_toolTip; 0078 } 0079 0080 void AbstractButtonInterface::setToolTip(const QString &toolTip) 0081 { 0082 if (m_toolTip == toolTip) { 0083 return; 0084 } 0085 0086 m_toolTip = toolTip; 0087 Q_EMIT toolTipChanged(m_toolTip); 0088 } 0089 0090 QIcon AbstractButtonInterface::icon() const 0091 { 0092 return m_icon; 0093 } 0094 0095 void AbstractButtonInterface::setIcon(const QIcon &icon) 0096 { 0097 m_icon = icon; 0098 Q_EMIT iconChanged(icon); 0099 } 0100 0101 QString AbstractButtonInterface::badgeText() const 0102 { 0103 return m_badgeText; 0104 } 0105 0106 void AbstractButtonInterface::setBadgeText(const QString &badgeText) 0107 { 0108 if (m_badgeText == badgeText) { 0109 return; 0110 } 0111 0112 m_badgeText = badgeText; 0113 Q_EMIT badgeTextChanged(m_badgeText); 0114 } 0115 0116 WebView *AbstractButtonInterface::webView() const 0117 { 0118 return m_view; 0119 } 0120 0121 void AbstractButtonInterface::setWebView(WebView *view) 0122 { 0123 if (m_view == view) { 0124 return; 0125 } 0126 0127 m_view = view; 0128 Q_EMIT webViewChanged(m_view); 0129 }