1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * UIVMPreviewWindow class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2010 Oracle Corporation
|
---|
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 __UIVMPreviewWindow_h__
|
---|
20 | #define __UIVMPreviewWindow_h__
|
---|
21 |
|
---|
22 | /* Local includes */
|
---|
23 | #include "QIWithRetranslateUI.h"
|
---|
24 | #include "COMDefs.h"
|
---|
25 |
|
---|
26 | /* Global includes */
|
---|
27 | #include <QWidget>
|
---|
28 | #include <QHash>
|
---|
29 |
|
---|
30 | /* Global forward declarations */
|
---|
31 | class QAction;
|
---|
32 | class QImage;
|
---|
33 | class QMenu;
|
---|
34 | class QTimer;
|
---|
35 |
|
---|
36 | class UIVMPreviewWindow : public QIWithRetranslateUI<QWidget>
|
---|
37 | {
|
---|
38 | Q_OBJECT;
|
---|
39 |
|
---|
40 | enum UpdateInterval
|
---|
41 | {
|
---|
42 | UpdateDisabled,
|
---|
43 | Update500ms,
|
---|
44 | Update1000ms,
|
---|
45 | Update2000ms,
|
---|
46 | Update5000ms,
|
---|
47 | Update10000ms,
|
---|
48 | UpdateEnd
|
---|
49 | };
|
---|
50 |
|
---|
51 | public:
|
---|
52 |
|
---|
53 | UIVMPreviewWindow(QWidget *pParent);
|
---|
54 | ~UIVMPreviewWindow();
|
---|
55 |
|
---|
56 | void setMachine(const CMachine& machine);
|
---|
57 | CMachine machine() const;
|
---|
58 |
|
---|
59 | QSize sizeHint() const;
|
---|
60 |
|
---|
61 | protected:
|
---|
62 |
|
---|
63 | void retranslateUi();
|
---|
64 |
|
---|
65 | void resizeEvent(QResizeEvent *pEvent);
|
---|
66 | void showEvent(QShowEvent *pEvent);
|
---|
67 | void hideEvent(QHideEvent *pEvent);
|
---|
68 | void paintEvent(QPaintEvent *pEvent);
|
---|
69 | void contextMenuEvent(QContextMenuEvent *pEvent);
|
---|
70 |
|
---|
71 | private slots:
|
---|
72 |
|
---|
73 | void sltMachineStateChange(QString strId, KMachineState state);
|
---|
74 | void sltRecreatePreview();
|
---|
75 |
|
---|
76 | private:
|
---|
77 |
|
---|
78 | void setUpdateInterval(UpdateInterval interval, bool fSave);
|
---|
79 | void restart();
|
---|
80 | void repaintBGImages();
|
---|
81 |
|
---|
82 | /* Private member vars */
|
---|
83 | CSession m_session;
|
---|
84 | CMachine m_machine;
|
---|
85 | KMachineState m_machineState;
|
---|
86 | QTimer *m_pUpdateTimer;
|
---|
87 | QMenu *m_pUpdateTimerMenu;
|
---|
88 | QHash<UpdateInterval, QAction*> m_actions;
|
---|
89 | const int m_vMargin;
|
---|
90 | QRect m_wRect;
|
---|
91 | QRect m_vRect;
|
---|
92 | QImage *m_pbgImage;
|
---|
93 | QImage *m_pPreviewImg;
|
---|
94 | QImage *m_pGlossyImg;
|
---|
95 | };
|
---|
96 |
|
---|
97 | #endif /* !__UIVMPreviewWindow_h__ */
|
---|
98 |
|
---|