VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootOrderEditor.h@ 82781

Last change on this file since 82781 was 79982, checked in by vboxsync, 5 years ago

FE/Qt: bugref:7720: VirtualBox Manager: Details pane: Possibility to edit VM boot order on-the-fly.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/* $Id: UIBootOrderEditor.h 79982 2019-07-25 16:09:39Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIBootListWidget class declaration.
4 */
5
6/*
7 * Copyright (C) 2009-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef FEQT_INCLUDED_SRC_widgets_UIBootOrderEditor_h
19#define FEQT_INCLUDED_SRC_widgets_UIBootOrderEditor_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* Qt includes: */
25#include <QListWidget>
26
27/* GUI includes: */
28#include "QIWithRetranslateUI.h"
29#include "UILibraryDefs.h"
30
31/* COM includes: */
32#include "COMEnums.h"
33
34/* Forward declarations: */
35class QLabel;
36class UIToolBar;
37class UIBootListWidget;
38class CMachine;
39
40
41/** Boot item data structure. */
42struct UIBootItemData
43{
44 /** Constructs boot item data. */
45 UIBootItemData()
46 : m_enmType(KDeviceType_Null)
47 , m_fEnabled(false)
48 {}
49
50 /** Returns whether @a another passed data is equal to this one. */
51 bool operator==(const UIBootItemData &another) const
52 {
53 return true
54 && (m_enmType == another.m_enmType)
55 && (m_fEnabled == another.m_fEnabled)
56 ;
57 }
58
59 /** Holds the boot device type. */
60 KDeviceType m_enmType;
61 /** Holds whether the boot device enabled. */
62 bool m_fEnabled;
63};
64typedef QList<UIBootItemData> UIBootItemDataList;
65Q_DECLARE_METATYPE(UIBootItemDataList);
66
67
68/** Boot data tools namespace. */
69namespace UIBootDataTools
70{
71 /** Loads boot item list for passed @a comMachine. */
72 SHARED_LIBRARY_STUFF UIBootItemDataList loadBootItems(const CMachine &comMachine);
73 /** Saves @a bootItems list to passed @a comMachine. */
74 SHARED_LIBRARY_STUFF void saveBootItems(const UIBootItemDataList &bootItems, CMachine &comMachine);
75
76 /** Converts passed @a bootItems list into human readable string. */
77 SHARED_LIBRARY_STUFF QString bootItemsToReadableString(const UIBootItemDataList &bootItems);
78
79 /** Performs serialization for passed @a bootItems list. */
80 SHARED_LIBRARY_STUFF QString bootItemsToSerializedString(const UIBootItemDataList &bootItems);
81 /** Performs deserialization for passed @a strBootItems string. */
82 SHARED_LIBRARY_STUFF UIBootItemDataList bootItemsFromSerializedString(const QString &strBootItems);
83}
84using namespace UIBootDataTools;
85
86
87/** QWidget subclass used as boot order editor. */
88class SHARED_LIBRARY_STUFF UIBootOrderEditor : public QIWithRetranslateUI<QWidget>
89{
90 Q_OBJECT;
91
92public:
93
94 /** Constructs boot order editor passing @a pParent to the base-class.
95 * @param fWithLabel Brings whether we should add label ourselves. */
96 UIBootOrderEditor(QWidget *pParent = 0, bool fWithLabel = false);
97
98 /** Defines editor @a guiValue. */
99 void setValue(const UIBootItemDataList &guiValue);
100 /** Returns editor value. */
101 UIBootItemDataList value() const;
102
103protected:
104
105 /** Preprocesses Qt @a pEvent for passed @a pObject. */
106 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
107
108 /** Handles translation event. */
109 virtual void retranslateUi() /* override */;
110
111private slots:
112
113 /** Handles current boot item change. */
114 void sltHandleCurrentBootItemChange();
115
116private:
117
118 /** Prepares all. */
119 void prepare();
120
121 /** Updates action availability: */
122 void updateActionAvailability();
123
124 /** Holds whether descriptive label should be created. */
125 bool m_fWithLabel;
126
127 /** Holds the label instance. */
128 QLabel *m_pLabel;
129 /** Holds the table instance. */
130 UIBootListWidget *m_pTable;
131 /** Holds the toolbar instance. */
132 UIToolBar *m_pToolbar;
133 /** Holds the move up action. */
134 QAction *m_pMoveUp;
135 /** Holds the move down action. */
136 QAction *m_pMoveDown;
137};
138
139
140#endif /* !FEQT_INCLUDED_SRC_widgets_UIBootOrderEditor_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use