1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxNetworkFramework class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __VBoxNetworkFramework_h__
|
---|
20 | #define __VBoxNetworkFramework_h__
|
---|
21 |
|
---|
22 | #include <HappyHttp.h>
|
---|
23 | #include <qobject.h>
|
---|
24 | #include <qthread.h>
|
---|
25 | //Added by qt3to4:
|
---|
26 | #include <QEvent>
|
---|
27 | #include <QDataStream>
|
---|
28 | typedef happyhttp::Connection HConnect;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * QObject class reimplementation which is the target for different
|
---|
32 | * events reseived from network thread.
|
---|
33 | */
|
---|
34 | class VBoxNetworkFramework : public QObject
|
---|
35 | {
|
---|
36 | Q_OBJECT
|
---|
37 |
|
---|
38 | public:
|
---|
39 |
|
---|
40 | VBoxNetworkFramework()
|
---|
41 | : mDataStream (&mDataArray, QIODevice::ReadWrite)
|
---|
42 | , mNetworkThread (0) {}
|
---|
43 |
|
---|
44 | ~VBoxNetworkFramework() { delete mNetworkThread; }
|
---|
45 |
|
---|
46 | void postRequest (const QString &aHost, const QString &aUrl);
|
---|
47 |
|
---|
48 | signals:
|
---|
49 |
|
---|
50 | void netBegin (int aStatus);
|
---|
51 | void netData (const QByteArray &aData);
|
---|
52 | void netEnd (const QByteArray &aData);
|
---|
53 | void netError (const QString &aData);
|
---|
54 |
|
---|
55 | private:
|
---|
56 |
|
---|
57 | bool event (QEvent *aEvent);
|
---|
58 |
|
---|
59 | QByteArray mDataArray;
|
---|
60 | QDataStream mDataStream;
|
---|
61 | QThread *mNetworkThread;
|
---|
62 | };
|
---|
63 |
|
---|
64 | #endif // __VBoxNetworkFramework_h__
|
---|
65 |
|
---|