1 | /* $Id: UIBootTable.h 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIBootTable 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 ___UIBootTable_h___
|
---|
19 | #define ___UIBootTable_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 |
|
---|
35 | /** QListWidgetItem extension for our UIBootTable. */
|
---|
36 | class SHARED_LIBRARY_STUFF UIBootTableItem : public QListWidgetItem
|
---|
37 | {
|
---|
38 | public:
|
---|
39 |
|
---|
40 | /** Constructs boot-table item of passed @a enmType. */
|
---|
41 | UIBootTableItem(KDeviceType enmType);
|
---|
42 |
|
---|
43 | /** Returns the item type. */
|
---|
44 | KDeviceType type() const;
|
---|
45 |
|
---|
46 | /** Performs item translation. */
|
---|
47 | void retranslateUi();
|
---|
48 |
|
---|
49 | private:
|
---|
50 |
|
---|
51 | /** Holds the item type. */
|
---|
52 | KDeviceType m_enmType;
|
---|
53 |
|
---|
54 | };
|
---|
55 |
|
---|
56 |
|
---|
57 | /** QListWidget subclass used as system settings boot-table. */
|
---|
58 | class SHARED_LIBRARY_STUFF UIBootTable : public QIWithRetranslateUI<QListWidget>
|
---|
59 | {
|
---|
60 | Q_OBJECT;
|
---|
61 |
|
---|
62 | signals:
|
---|
63 |
|
---|
64 | /** Notifies listeners about current table row changed.
|
---|
65 | * @note Same as base-class currentRowChanged but in wider cases. */
|
---|
66 | void sigRowChanged(int iRow);
|
---|
67 |
|
---|
68 | public:
|
---|
69 |
|
---|
70 | /** Constructs boot-table passing @a pParent to the base-class. */
|
---|
71 | UIBootTable(QWidget *pParent = 0);
|
---|
72 |
|
---|
73 | /** Adjusts table size to fit contents. */
|
---|
74 | void adjustSizeToFitContent();
|
---|
75 |
|
---|
76 | public slots:
|
---|
77 |
|
---|
78 | /** Moves current item up. */
|
---|
79 | void sltMoveItemUp();
|
---|
80 | /** Moves current item down. */
|
---|
81 | void sltMoveItemDown();
|
---|
82 |
|
---|
83 | protected:
|
---|
84 |
|
---|
85 | /** Handles translation event. */
|
---|
86 | virtual void retranslateUi() /* override */;
|
---|
87 |
|
---|
88 | /** Handles drop @a pEvent. */
|
---|
89 | virtual void dropEvent(QDropEvent *pEvent) /* override */;
|
---|
90 |
|
---|
91 | /** Returns a QModelIndex object pointing to the next object in the view,
|
---|
92 | * based on the given @a cursorAction and keyboard @a fModifiers. */
|
---|
93 | virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction,
|
---|
94 | Qt::KeyboardModifiers fModifiers) /* override */;
|
---|
95 |
|
---|
96 | private:
|
---|
97 |
|
---|
98 | /** Prepares all. */
|
---|
99 | void prepare();
|
---|
100 |
|
---|
101 | /** Moves item with passed @a index to specified @a iRow. */
|
---|
102 | QModelIndex moveItemTo(const QModelIndex &index, int iRow);
|
---|
103 | };
|
---|
104 |
|
---|
105 |
|
---|
106 | #endif /* !___UIBootTable_h___ */
|
---|