File: testview.cpp

package info (click to toggle)
krdc 4%3A25.12.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,096 kB
  • sloc: cpp: 8,850; xml: 308; makefile: 6; sh: 5
file content (92 lines) | stat: -rw-r--r-- 1,668 bytes parent folder | download
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
    SPDX-FileCopyrightText: 2008 Urs Wolfer <uwolfer@kde.org>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "testview.h"

#include <QEvent>
#include <QTimer>

TestView::TestView(QWidget *parent, const QUrl &url, KConfigGroup configGroup)
    : RemoteView(parent)
{
    m_hostPreferences = new TestHostPreferences(configGroup, this);

    Q_UNUSED(url);
}

TestView::~TestView()
{
    Q_EMIT disconnected();
    setStatus(Disconnected);
}

void TestView::handleKeyEvent(QKeyEvent *event)
{
    Q_UNUSED(event);
}

void TestView::handleMouseEvent(QMouseEvent *event)
{
    Q_UNUSED(event);
}

void TestView::handleWheelEvent(QWheelEvent *event)
{
    Q_UNUSED(event);
}

void TestView::asyncConnect()
{
    QPalette pal = palette();
    pal.setColor(QPalette::Window, Qt::yellow);
    setPalette(pal);
    setAutoFillBackground(true);

    const QSize size = QSize(640, 480);
    setFixedSize(size);
    resize(size);
    setStatus(Connected);
    Q_EMIT framebufferSizeChanged(size.width(), size.height());
    Q_EMIT connected();
    setFocus();
}

QSize TestView::framebufferSize()
{
    return minimumSizeHint();
}

QSize TestView::sizeHint() const
{
    return maximumSize();
}

bool TestView::isQuitting()
{
    return false;
}

bool TestView::startConnection()
{
    setStatus(Connecting);
    // call it async in order to simulate real world behavior
    QTimer::singleShot(1000, this, SLOT(asyncConnect()));
    return true;
}

HostPreferences *TestView::hostPreferences()
{
    return m_hostPreferences;
}

void TestView::startQuittingConnection()
{
}

void TestView::handleLocalClipboardChanged(const QMimeData *data)
{
    Q_UNUSED(data);
}