1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * VBoxSnapshotsWgt class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2009 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 __VBoxSnapshotsWgt_h__
|
---|
20 | #define __VBoxSnapshotsWgt_h__
|
---|
21 |
|
---|
22 | /* Qt includes: */
|
---|
23 | #include <QTimer>
|
---|
24 |
|
---|
25 | /* GUI includes: */
|
---|
26 | #include "VBoxSnapshotsWgt.gen.h"
|
---|
27 | #include "VBoxGlobal.h"
|
---|
28 | #include "QIWithRetranslateUI.h"
|
---|
29 |
|
---|
30 | /* COM includes: */
|
---|
31 | #include "CMachine.h"
|
---|
32 |
|
---|
33 | /* Local forwards */
|
---|
34 | class SnapshotWgtItem;
|
---|
35 |
|
---|
36 | /* Snapshot age format */
|
---|
37 | enum SnapshotAgeFormat
|
---|
38 | {
|
---|
39 | AgeInSeconds,
|
---|
40 | AgeInMinutes,
|
---|
41 | AgeInHours,
|
---|
42 | AgeInDays,
|
---|
43 | AgeMax
|
---|
44 | };
|
---|
45 |
|
---|
46 | class VBoxSnapshotsWgt : public QIWithRetranslateUI <QWidget>, public Ui::VBoxSnapshotsWgt
|
---|
47 | {
|
---|
48 | Q_OBJECT;
|
---|
49 |
|
---|
50 | public:
|
---|
51 |
|
---|
52 | VBoxSnapshotsWgt (QWidget *aParent);
|
---|
53 |
|
---|
54 | void setMachine (const CMachine &aMachine);
|
---|
55 |
|
---|
56 | protected:
|
---|
57 |
|
---|
58 | void retranslateUi();
|
---|
59 |
|
---|
60 | private slots:
|
---|
61 |
|
---|
62 | /* Snapshot tree slots: */
|
---|
63 | void onCurrentChanged (QTreeWidgetItem *aItem = 0);
|
---|
64 | void onContextMenuRequested (const QPoint &aPoint);
|
---|
65 | void onItemChanged (QTreeWidgetItem *aItem);
|
---|
66 |
|
---|
67 | /* Snapshot functionality slots: */
|
---|
68 | void sltTakeSnapshot();
|
---|
69 | void sltRestoreSnapshot();
|
---|
70 | void sltDeleteSnapshot();
|
---|
71 | void sltShowSnapshotDetails();
|
---|
72 | void sltCloneSnapshot();
|
---|
73 |
|
---|
74 | /* Main API event handlers: */
|
---|
75 | void machineDataChanged(QString strId);
|
---|
76 | void machineStateChanged(QString strId, KMachineState state);
|
---|
77 | void sessionStateChanged(QString strId, KSessionState state);
|
---|
78 |
|
---|
79 | void updateSnapshotsAge();
|
---|
80 |
|
---|
81 | private:
|
---|
82 |
|
---|
83 | /* Snapshot private functions: */
|
---|
84 | bool takeSnapshot();
|
---|
85 | //bool restoreSnapshot();
|
---|
86 | //bool deleteSnapshot();
|
---|
87 | //bool showSnapshotDetails();
|
---|
88 |
|
---|
89 | void refreshAll();
|
---|
90 | SnapshotWgtItem* findItem (const QString &aSnapshotId);
|
---|
91 | SnapshotWgtItem* curStateItem();
|
---|
92 | void populateSnapshots (const CSnapshot &aSnapshot, QTreeWidgetItem *aItem);
|
---|
93 | SnapshotAgeFormat traverseSnapshotAge (QTreeWidgetItem *aParentItem);
|
---|
94 |
|
---|
95 | CMachine mMachine;
|
---|
96 | QString mMachineId;
|
---|
97 | KSessionState mSessionState;
|
---|
98 | SnapshotWgtItem *mCurSnapshotItem;
|
---|
99 | bool mEditProtector;
|
---|
100 |
|
---|
101 | QActionGroup *mSnapshotActionGroup;
|
---|
102 | QActionGroup *mCurStateActionGroup;
|
---|
103 |
|
---|
104 | QAction *mRestoreSnapshotAction;
|
---|
105 | QAction *mDeleteSnapshotAction;
|
---|
106 | QAction *mShowSnapshotDetailsAction;
|
---|
107 | QAction *mTakeSnapshotAction;
|
---|
108 | QAction *mCloneSnapshotAction;
|
---|
109 |
|
---|
110 | QTimer mAgeUpdateTimer;
|
---|
111 | };
|
---|
112 |
|
---|
113 | #endif // __VBoxSnapshotsWgt_h__
|
---|
114 |
|
---|