File indexing completed on 2024-04-28 04:44:14
0001 /* 0002 SnoreNotify is a Notification Framework based on Qt 0003 Copyright (C) 2014-2015 Hannah von Reth <vonreth@kde.org> 0004 0005 SnoreNotify is free software: you can redistribute it and/or modify 0006 it under the terms of the GNU Lesser 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 SnoreNotify 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 Lesser General Public License for more details. 0014 0015 You should have received a copy of the GNU Lesser General Public License 0016 along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 0019 #include "alert.h" 0020 #include "alert_p.h" 0021 0022 #include <QDebug> 0023 0024 using namespace Snore; 0025 0026 Alert::Alert() : 0027 d(nullptr) 0028 {} 0029 0030 Alert::Alert(const QString &name, const Icon &icon): 0031 d(new AlertData(name, name, icon)) 0032 {} 0033 0034 Alert::Alert(const QString &key, const QString &name, const Icon &icon): 0035 d(new AlertData(key, name, icon)) 0036 { 0037 0038 } 0039 0040 Alert::Alert(const Alert &other): 0041 d(other.d) 0042 { 0043 0044 } 0045 0046 Alert &Alert::operator=(const Alert &other) 0047 { 0048 d = other.d; 0049 return *this; 0050 } 0051 0052 Alert::~Alert() 0053 { 0054 0055 } 0056 0057 QString Alert::key() const 0058 { 0059 return d->m_key; 0060 } 0061 0062 QString Alert::name() const 0063 { 0064 return d->m_name; 0065 } 0066 0067 const Icon &Alert::icon() const 0068 { 0069 return d->m_icon; 0070 } 0071 0072 bool Alert::isValid() const 0073 { 0074 return d; 0075 } 0076 0077 QDebug operator<<(QDebug debug, const Alert &alert) 0078 { 0079 if (alert.isValid()) { 0080 debug << "Snore::Alert(" << alert.name() << ")" ; 0081 } else { 0082 debug << "Snore::Alert(0x00)" ; 0083 } 0084 return debug.maybeSpace(); 0085 }