1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * VBoxSnapshotsWgt class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2009 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxSnapshotsWgt_h__
|
---|
24 | #define __VBoxSnapshotsWgt_h__
|
---|
25 |
|
---|
26 | /* Global includes */
|
---|
27 | #include <QTimer>
|
---|
28 |
|
---|
29 | /* Local includes */
|
---|
30 | #include "VBoxSnapshotsWgt.gen.h"
|
---|
31 | #include "VBoxGlobal.h"
|
---|
32 | #include "QIWithRetranslateUI.h"
|
---|
33 |
|
---|
34 | /* Local forwards */
|
---|
35 | class SnapshotWgtItem;
|
---|
36 |
|
---|
37 | /* Snapshot age format */
|
---|
38 | enum SnapshotAgeFormat
|
---|
39 | {
|
---|
40 | AgeInSeconds,
|
---|
41 | AgeInMinutes,
|
---|
42 | AgeInHours,
|
---|
43 | AgeInDays,
|
---|
44 | AgeMax
|
---|
45 | };
|
---|
46 |
|
---|
47 | class VBoxSnapshotsWgt : public QIWithRetranslateUI <QWidget>, public Ui::VBoxSnapshotsWgt
|
---|
48 | {
|
---|
49 | Q_OBJECT;
|
---|
50 |
|
---|
51 | public:
|
---|
52 |
|
---|
53 | VBoxSnapshotsWgt (QWidget *aParent);
|
---|
54 |
|
---|
55 | void setMachine (const CMachine &aMachine);
|
---|
56 |
|
---|
57 | protected:
|
---|
58 |
|
---|
59 | void retranslateUi();
|
---|
60 |
|
---|
61 | private slots:
|
---|
62 |
|
---|
63 | void onCurrentChanged (QTreeWidgetItem *aItem = 0);
|
---|
64 | void onContextMenuRequested (const QPoint &aPoint);
|
---|
65 | void onItemChanged (QTreeWidgetItem *aItem);
|
---|
66 |
|
---|
67 | void restoreSnapshot();
|
---|
68 | void deleteSnapshot();
|
---|
69 | void showSnapshotDetails();
|
---|
70 | void takeSnapshot();
|
---|
71 |
|
---|
72 | void machineDataChanged (const VBoxMachineDataChangeEvent &aEvent);
|
---|
73 | void machineStateChanged (const VBoxMachineStateChangeEvent &aEvent);
|
---|
74 | void sessionStateChanged (const VBoxSessionStateChangeEvent &aEvent);
|
---|
75 |
|
---|
76 | void updateSnapshotsAge();
|
---|
77 |
|
---|
78 | private:
|
---|
79 |
|
---|
80 | void refreshAll();
|
---|
81 | SnapshotWgtItem* findItem (const QString &aSnapshotId);
|
---|
82 | SnapshotWgtItem* curStateItem();
|
---|
83 | void populateSnapshots (const CSnapshot &aSnapshot, QTreeWidgetItem *aItem);
|
---|
84 | SnapshotAgeFormat traverseSnapshotAge (QTreeWidgetItem *aParentItem);
|
---|
85 |
|
---|
86 | CMachine mMachine;
|
---|
87 | QString mMachineId;
|
---|
88 | KSessionState mSessionState;
|
---|
89 | SnapshotWgtItem *mCurSnapshotItem;
|
---|
90 | bool mEditProtector;
|
---|
91 |
|
---|
92 | QActionGroup *mSnapshotActionGroup;
|
---|
93 | QActionGroup *mCurStateActionGroup;
|
---|
94 |
|
---|
95 | QAction *mRestoreSnapshotAction;
|
---|
96 | QAction *mDeleteSnapshotAction;
|
---|
97 | QAction *mShowSnapshotDetailsAction;
|
---|
98 | QAction *mTakeSnapshotAction;
|
---|
99 |
|
---|
100 | QTimer mAgeUpdateTimer;
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif // __VBoxSnapshotsWgt_h__
|
---|
104 |
|
---|