1 | /* $Id: UIChooserView.h 102477 2023-12-05 13:54:50Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIChooserView class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_manager_chooser_UIChooserView_h
|
---|
29 | #define FEQT_INCLUDED_SRC_manager_chooser_UIChooserView_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "QIGraphicsView.h"
|
---|
36 | #include "QIWithRetranslateUI.h"
|
---|
37 |
|
---|
38 | /* Forward declarations: */
|
---|
39 | class UIChooserModel;
|
---|
40 | class UIChooserSearchWidget;
|
---|
41 |
|
---|
42 | /** QIGraphicsView extension used as VM chooser pane view. */
|
---|
43 | class UIChooserView : public QIWithRetranslateUI<QIGraphicsView>
|
---|
44 | {
|
---|
45 | Q_OBJECT;
|
---|
46 |
|
---|
47 | signals:
|
---|
48 |
|
---|
49 | /** Notifies listeners about resize. */
|
---|
50 | void sigResized();
|
---|
51 |
|
---|
52 | /** Notifies listeners about search widget visibility changed to @a fVisible. */
|
---|
53 | void sigSearchWidgetVisibilityChanged(bool fVisible);
|
---|
54 |
|
---|
55 | public:
|
---|
56 |
|
---|
57 | /** Constructs a Chooser-view passing @a pParent to the base-class. */
|
---|
58 | UIChooserView(QWidget *pParent);
|
---|
59 |
|
---|
60 | /** @name General stuff.
|
---|
61 | * @{ */
|
---|
62 | /** Defines @a pChooserModel reference. */
|
---|
63 | void setModel(UIChooserModel *pChooserModel);
|
---|
64 | /** Returns Chooser-model reference. */
|
---|
65 | UIChooserModel *model() const;
|
---|
66 | /** @} */
|
---|
67 |
|
---|
68 | /** @name Search stuff.
|
---|
69 | * @{ */
|
---|
70 | /** Returns whether search widget visible. */
|
---|
71 | bool isSearchWidgetVisible() const;
|
---|
72 | /** Makes search widget @a fVisible. */
|
---|
73 | void setSearchWidgetVisible(bool fVisible);
|
---|
74 |
|
---|
75 | /** Updates search widget's results count.
|
---|
76 | * @param iTotalMatchCount Brings total search results count.
|
---|
77 | * @param iCurrentlyScrolledItemIndex Brings the item index search currently scrolled to. */
|
---|
78 | void setSearchResultsCount(int iTotalMatchCount, int iCurrentlyScrolledItemIndex);
|
---|
79 | /** Forwards @a strSearchText to the search widget which in
|
---|
80 | * turn appends it to the current (if any) search term. */
|
---|
81 | void appendToSearchString(const QString &strSearchText);
|
---|
82 | /** Repeats the last search again. */
|
---|
83 | void redoSearch();
|
---|
84 | /** @} */
|
---|
85 |
|
---|
86 | public slots:
|
---|
87 |
|
---|
88 | /** @name Layout stuff.
|
---|
89 | * @{ */
|
---|
90 | /** Handles minimum width @a iHint change. */
|
---|
91 | void sltMinimumWidthHintChanged(int iHint);
|
---|
92 | /** @} */
|
---|
93 |
|
---|
94 | protected:
|
---|
95 |
|
---|
96 | /** @name Event handling stuff.
|
---|
97 | * @{ */
|
---|
98 | /** Handles translation event. */
|
---|
99 | virtual void retranslateUi() RT_OVERRIDE;
|
---|
100 |
|
---|
101 | /** Handles resize @a pEvent. */
|
---|
102 | virtual void resizeEvent(QResizeEvent *pEvent) RT_OVERRIDE;
|
---|
103 | /** @} */
|
---|
104 |
|
---|
105 | private slots:
|
---|
106 |
|
---|
107 | /** @name Theme stuff stuff.
|
---|
108 | * @{ */
|
---|
109 | /** Updates palette. */
|
---|
110 | void sltUpdatePalette() { preparePalette(); }
|
---|
111 | /** @} */
|
---|
112 |
|
---|
113 | /** @name Search stuff.
|
---|
114 | * @{ */
|
---|
115 | /** Handles request for a new search.
|
---|
116 | * @param strSearchTerm Brings the search term.
|
---|
117 | * @param iSearchFlags Brings the item search flags. */
|
---|
118 | void sltRedoSearch(const QString &strSearchTerm, int iSearchFlags);
|
---|
119 | /** Handles request to scroll to @a fNext search result. */
|
---|
120 | void sltHandleScrollToSearchResult(bool fNext);
|
---|
121 | /** Handles request to scroll to make search widget @a fVisible. */
|
---|
122 | void sltHandleSearchWidgetVisibilityToggle(bool fVisible);
|
---|
123 | /** @} */
|
---|
124 |
|
---|
125 | private:
|
---|
126 |
|
---|
127 | /** @name Prepare/Cleanup cascade.
|
---|
128 | * @{ */
|
---|
129 | /** Prepares all. */
|
---|
130 | void prepare();
|
---|
131 | /** Prepares this. */
|
---|
132 | void prepareThis();
|
---|
133 | /** Prepares palette. */
|
---|
134 | void preparePalette();
|
---|
135 | /** Prepares widgets. */
|
---|
136 | void prepareWidget();
|
---|
137 | /** @} */
|
---|
138 |
|
---|
139 | /** @name General stuff.
|
---|
140 | * @{ */
|
---|
141 | /** Updates scene rectangle. */
|
---|
142 | void updateSceneRect();
|
---|
143 | /** @} */
|
---|
144 |
|
---|
145 | /** @name Search stuff.
|
---|
146 | * @{ */
|
---|
147 | /** Updates search widget's geometry. */
|
---|
148 | void updateSearchWidgetGeometry();
|
---|
149 | /** @} */
|
---|
150 |
|
---|
151 | /** @name General stuff.
|
---|
152 | * @{ */
|
---|
153 | /** Holds the Chooser-model reference. */
|
---|
154 | UIChooserModel *m_pChooserModel;
|
---|
155 | /** @} */
|
---|
156 |
|
---|
157 | /** @name Search stuff.
|
---|
158 | * @{ */
|
---|
159 | /** Holds the search widget instance. */
|
---|
160 | UIChooserSearchWidget *m_pSearchWidget;
|
---|
161 | /** @} */
|
---|
162 |
|
---|
163 | /** @name Layout stuff.
|
---|
164 | * @{ */
|
---|
165 | /** Holds the minimum width hint. */
|
---|
166 | int m_iMinimumWidthHint;
|
---|
167 | /** @} */
|
---|
168 | };
|
---|
169 |
|
---|
170 | #endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserView_h */
|
---|