File indexing completed on 2024-05-05 17:33:20

0001 /*
0002  *   SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #include "DiscoverAction.h"
0008 
0009 DiscoverAction::DiscoverAction(QObject *parent)
0010     : QObject(parent)
0011 {
0012 }
0013 
0014 DiscoverAction::DiscoverAction(const QString &icon, const QString &text, QObject *parent)
0015     : QObject(parent)
0016     , m_text(text)
0017     , m_icon(icon)
0018 {
0019 }
0020 
0021 DiscoverAction::DiscoverAction(const QString &text, QObject *parent)
0022     : QObject(parent)
0023     , m_text(text)
0024 {
0025 }
0026 
0027 void DiscoverAction::setEnabled(bool enabled)
0028 {
0029     if (enabled == m_isEnabled)
0030         return;
0031 
0032     m_isEnabled = enabled;
0033     Q_EMIT enabledChanged(enabled);
0034 }
0035 
0036 void DiscoverAction::setVisible(bool visible)
0037 {
0038     if (visible == m_isVisible)
0039         return;
0040 
0041     m_isVisible = visible;
0042     Q_EMIT visibleChanged(visible);
0043 }
0044 
0045 void DiscoverAction::setIconName(const QString &icon)
0046 {
0047     if (icon == m_icon)
0048         return;
0049 
0050     m_icon = icon;
0051     Q_EMIT iconNameChanged(icon);
0052 }
0053 
0054 void DiscoverAction::setText(const QString &text)
0055 {
0056     if (text == m_text)
0057         return;
0058 
0059     m_text = text;
0060     Q_EMIT textChanged(text);
0061 }
0062 
0063 void DiscoverAction::setToolTip(const QString &toolTip)
0064 {
0065     if (toolTip == m_toolTip)
0066         return;
0067 
0068     m_toolTip = toolTip;
0069     Q_EMIT toolTipChanged(toolTip);
0070 }
0071 
0072 void DiscoverAction::trigger()
0073 {
0074     Q_EMIT triggered();
0075 }