File: notificationpopuptest.cpp

package info (click to toggle)
kuserfeedback 1.3.0-9
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,496 kB
  • sloc: cpp: 13,251; php: 2,192; xml: 224; yacc: 90; lex: 82; sh: 17; makefile: 8
file content (52 lines) | stat: -rw-r--r-- 1,620 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
    SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>

    SPDX-License-Identifier: MIT
*/

#include <notificationpopup.h>
#include <provider.h>
#include <surveyinfo.h>

#include <QApplication>
#include <QPushButton>
#include <QStandardPaths>
#include <QUuid>
#include <QVBoxLayout>

using namespace KUserFeedback;

int main(int argc, char **argv)
{
    QStandardPaths::setTestModeEnabled(true);

    QCoreApplication::setApplicationName(QStringLiteral("notificationpopuptest"));
    QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
    QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
    QCoreApplication::setApplicationVersion(QStringLiteral("1984"));

    QApplication app(argc, argv);

    Provider provider;

    QWidget topLevel;
    auto layout = new QVBoxLayout(&topLevel);
    auto button = new QPushButton(QStringLiteral("Show Encouragement"));
    layout->addWidget(button);
    QObject::connect(button, &QPushButton::clicked, &provider, &Provider::showEncouragementMessage);
    button = new QPushButton(QStringLiteral("New Survey Available"));
    layout->addWidget(button);
    QObject::connect(button, &QPushButton::clicked, &provider, [&provider]() {
        SurveyInfo info;
        info.setUuid(QUuid(QStringLiteral("{9e529dfa-0213-413e-a1a8-8a9cea7d5a97}")));
        info.setUrl(QUrl(QStringLiteral("https://www.kde.org/")));
        emit provider.surveyAvailable(info);
    });

    auto popup = new NotificationPopup(&topLevel);
    popup->setFeedbackProvider(&provider);

    topLevel.resize(1024, 786);
    topLevel.show();
    return app.exec();
}