File indexing completed on 2024-04-21 05:54:03
0001 /* 0002 SPDX-FileCopyrightText: 2009 Tom Albers <toma@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "popupeffect.h" 0008 #include "passivepopup.h" 0009 0010 #include <KLocalizedString> 0011 0012 #include <QLabel> 0013 0014 PopupEffect::PopupEffect(QObject *parent) 0015 : BreakBase(parent) 0016 { 0017 m_popup = new PassivePopup(nullptr); 0018 0019 m_label = new QLabel(i18n("Take a break...."), m_popup); 0020 0021 m_popup->setView(m_label); 0022 m_popup->setTimeout(0); 0023 } 0024 0025 PopupEffect::~PopupEffect() 0026 { 0027 delete m_popup; 0028 } 0029 0030 void PopupEffect::activate() 0031 { 0032 m_popup->show(); 0033 } 0034 0035 void PopupEffect::deactivate() 0036 { 0037 m_popup->hide(); 0038 } 0039 0040 void PopupEffect::setLabel(const QString &text) 0041 { 0042 // text is a time string like '2 minutes 42 seconds' 0043 // or '42 seconds', so no plural here 0044 m_label->setText(i18nc("%1 is a time string like '2 minutes 42 seconds'", "Take a break for %1", text)); 0045 }