Commit fa397a3b authored by Volker Krause's avatar Volker Krause
Browse files

Add Qt version data source

parent c92732fd
......@@ -29,8 +29,10 @@
#include <provider/widgets/feedbackconfigdialog.h>
#include <provider/core/applicationversionsource.h>
#include <provider/core/platforminfosource.h>
#include <provider/core/propertyratiosource.h>
#include <provider/core/provider.h>
#include <provider/core/qtversionsource.h>
#include <QApplication>
#include <QDebug>
......@@ -140,6 +142,8 @@ MainWindow::MainWindow() :
viewModeSource->addValueMapping(2, QStringLiteral("schemaEditor"));
m_feedbackProvider->addDataSource(viewModeSource, Provider::AllStatistics);
m_feedbackProvider->addDataSource(new ApplicationVersionSource, Provider::BasicStatistics);
m_feedbackProvider->addDataSource(new PlatformInfoSource, Provider::AllStatistics);
m_feedbackProvider->addDataSource(new QtVersionSource, Provider::AllStatistics);
}
MainWindow::~MainWindow()
......
......@@ -5,7 +5,7 @@
"aggregation": "category",
"elements": [
{
"name": "qtVersion",
"name": "value",
"type": "string"
}
]
......
......@@ -42,7 +42,7 @@
"aggregationType": "category",
"elements": [
{
"name": "qtVersion",
"name": "value",
"type": "string"
}
],
......
......@@ -3,6 +3,7 @@ set(userfeedback_core_srcs
applicationversionsource.cpp
platforminfosource.cpp
provider.cpp
qtversionsource.cpp
screeninfosource.cpp
surveyinfo.cpp
)
......
/*
Copyright (C) 2016 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qtversionsource.h"
#include <QVariant>
using namespace UserFeedback;
QtVersionSource::QtVersionSource() :
AbstractDataSource(QStringLiteral("qtVersion"))
{
}
QVariant QtVersionSource::data()
{
QVariantMap m;
m.insert(QStringLiteral("value"), QString::fromLatin1(qVersion()));
return m;
}
/*
Copyright (C) 2016 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef USERFEEDBACK_QTVERSIONSOURCE_H
#define USERFEEDBACK_QTVERSIONSOURCE_H
#include "userfeedbackcore_export.h"
#include "abstractdatasource.h"
namespace UserFeedback {
/*! Data source reporting the Qt version used at runtime. */
class USERFEEDBACKCORE_EXPORT QtVersionSource : public AbstractDataSource
{
public:
QtVersionSource();
QVariant data() Q_DECL_OVERRIDE;
};
}
#endif // USERFEEDBACK_QTVERSIONSOURCE_H
......@@ -18,6 +18,7 @@
#include <provider/core/applicationversionsource.h>
#include <provider/core/platforminfosource.h>
#include <provider/core/propertyratiosource.h>
#include <provider/core/qtversionsource.h>
#include <provider/core/screeninfosource.h>
#include <QDebug>
......@@ -122,6 +123,14 @@ private slots:
QVERIFY(m.contains(QLatin1String("value")));
QCOMPARE(m.value(QLatin1String("value")).toString(), QLatin1String("1.9.84"));
}
void testQtVersionSource()
{
QtVersionSource src;
const auto m = src.data().toMap();
QVERIFY(m.contains(QLatin1String("value")));
QCOMPARE(m.value(QLatin1String("value")).toString(), QLatin1String(QT_VERSION_STR));
}
};
QTEST_MAIN(DataSourceTest)
......
......@@ -23,6 +23,7 @@
#include <provider/core/platforminfosource.h>
#include <provider/core/propertyratiosource.h>
#include <provider/core/provider.h>
#include <provider/core/qtversionsource.h>
#include <provider/core/screeninfosource.h>
#include <provider/core/surveyinfo.h>
......@@ -107,6 +108,7 @@ int main(int argc, char** argv)
provider->setEncouragementDelay(10);
provider->addDataSource(new UserFeedback::ApplicationVersionSource, UserFeedback::Provider::BasicStatistics);
provider->addDataSource(new UserFeedback::PlatformInfoSource, UserFeedback::Provider::AllStatistics);
provider->addDataSource(new UserFeedback::QtVersionSource, UserFeedback::Provider::BasicStatistics);
provider->addDataSource(new UserFeedback::ScreenInfoSource, UserFeedback::Provider::AllStatistics);
Orwell mainWindow;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment