File indexing completed on 2024-12-15 03:45:05
0001 /* 0002 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 #include "startcountsource.h" 0008 #include "abstractdatasource_p.h" 0009 #include "provider_p.h" 0010 0011 #include <QVariant> 0012 0013 using namespace KUserFeedback; 0014 0015 namespace KUserFeedback { 0016 class StartCountSourcePrivate : public AbstractDataSourcePrivate 0017 { 0018 public: 0019 StartCountSourcePrivate() : provider(nullptr) {} 0020 ProviderPrivate *provider; 0021 }; 0022 } 0023 0024 StartCountSource::StartCountSource() : 0025 AbstractDataSource(QStringLiteral("startCount"), Provider::BasicUsageStatistics, new StartCountSourcePrivate) 0026 { 0027 } 0028 0029 QString StartCountSource::description() const 0030 { 0031 return tr("How often the application has been started."); 0032 } 0033 0034 QVariant StartCountSource::data() 0035 { 0036 Q_D(StartCountSource); 0037 Q_ASSERT(d->provider); 0038 0039 QVariantMap m; 0040 m.insert(QStringLiteral("value"), d->provider->startCount); 0041 return m; 0042 } 0043 0044 QString StartCountSource::name() const 0045 { 0046 return tr("Launches count"); 0047 } 0048 0049 void StartCountSource::setProvider(ProviderPrivate *p) 0050 { 0051 Q_D(StartCountSource); 0052 d->provider = p; 0053 }