VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxDownloaderWgt.h@ 5717

Last change on this file since 5717 was 4432, checked in by vboxsync, 18 years ago

2142: GUI should download Additions:

Downloader widget rewritten to make no use the QT networking class.
Free HappyHttp cross-platform networking framework implementation used (developed by Ben Campbell).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 2.9 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxDownloaderWgt 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 as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __VBoxDownloaderWgt_h__
20#define __VBoxDownloaderWgt_h__
21
22#include "HappyHttp.h"
23#include "qwidget.h"
24#include "qurl.h"
25#include "qmutex.h"
26class QStatusBar;
27class QAction;
28class QProgressBar;
29class QToolButton;
30class QThread;
31class QTimer;
32typedef happyhttp::Connection HConnect;
33
34/** class VBoxDownloaderWgt
35 *
36 * The VBoxDownloaderWgt class is an QWidget class for Guest Additions
37 * http backgroung downloading. This class is also used to display the
38 * Guest Additions download state through the progress dialog integrated
39 * into the VM console status bar.
40 */
41class VBoxDownloaderWgt : public QWidget
42{
43 Q_OBJECT
44
45public:
46
47 VBoxDownloaderWgt (QStatusBar *aStatusBar, QAction *aAction,
48 const QString &aUrl, const QString &aTarget);
49
50 void languageChange();
51
52 bool isCheckingPresence() { return mIsChecking; }
53
54private slots:
55
56 /* This slot is used to control the connection timeout. */
57 void processTimeout();
58
59 /* This slot is used to process cancel-button clicking signal. */
60 void processAbort();
61
62 /* This slot is used to terminate the downloader, activate the
63 * Install Guest Additions action and removing the downloader's
64 * sub-widgets from the VM Console status-bar. */
65 void suicide();
66
67private:
68
69 /* Used to process all the widget events */
70 bool event (QEvent *aEvent);
71
72 /* This function is used to make a request to get a file */
73 void getFile();
74
75 /* This function is used to ask the user about he wants to download the
76 * founded Guest Additions image or not. It also shows the progress-bar
77 * and Cancel-button widgets. */
78 void processFile (int aSize);
79
80 /* This wrapper displays an error message box (unless @aReason is
81 * QString::null) with the cause of the download procedure
82 * termination. After the message box is dismissed, the downloader signals
83 * to close itself on the next event loop iteration. */
84 void abortDownload (const QString &aReason = QString::null);
85
86 void abortConnection();
87
88 QUrl mUrl;
89 QString mTarget;
90 QStatusBar *mStatusBar;
91 QAction *mAction;
92 QProgressBar *mProgressBar;
93 QToolButton *mCancelButton;
94 bool mIsChecking;
95 bool mSuicide;
96 HConnect *mConn;
97 QThread *mRequestThread;
98 QMutex mMutex;
99 QByteArray mDataArray;
100 QDataStream mDataStream;
101 QTimer *mTimeout;
102};
103
104#endif
105
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette