1 | /* $Id: UIChooserSearchWidget.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIChooserSearchWidget class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2024 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_UIChooserSearchWidget_h
|
---|
29 | #define FEQT_INCLUDED_SRC_manager_chooser_UIChooserSearchWidget_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QWidget>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UILibraryDefs.h"
|
---|
39 |
|
---|
40 | /* Forward declarations: */
|
---|
41 | class QHBoxLayout;
|
---|
42 | class QILineEdit;
|
---|
43 | class QIToolButton;
|
---|
44 | class UISearchLineEdit;
|
---|
45 |
|
---|
46 | /** QWidget extension used as virtual machine search widget in the VM Chooser-pane. */
|
---|
47 | class UIChooserSearchWidget : public QWidget
|
---|
48 | {
|
---|
49 | Q_OBJECT;
|
---|
50 |
|
---|
51 | signals:
|
---|
52 |
|
---|
53 | void sigRedoSearch(const QString &strSearchTerm, int iSearchFlags);
|
---|
54 | /** Is being signalled as next/prev tool buttons are pressed. @a fIsNext is true
|
---|
55 | * for the next and false for the previous case. */
|
---|
56 | void sigScrollToMatch(bool fIsNext);
|
---|
57 | /** Is used for signalling show/hide event from this to parent. */
|
---|
58 | void sigToggleVisibility(bool fIsVisible);
|
---|
59 |
|
---|
60 | public:
|
---|
61 |
|
---|
62 | UIChooserSearchWidget(QWidget *pParent);
|
---|
63 | /** Forward @a iMatchCount to UISearchLineEdit. */
|
---|
64 | void setMatchCount(int iMatchCount);
|
---|
65 | /** Forward @a iScrollToIndex to UISearchLineEdit. */
|
---|
66 | void setScroolToIndex(int iScrollToIndex);
|
---|
67 | /** Appends the @a strSearchText to the current (if any) search text. */
|
---|
68 | void appendToSearchString(const QString &strSearchText);
|
---|
69 | /** Repeats the last search again. */
|
---|
70 | void redoSearch();
|
---|
71 |
|
---|
72 | protected:
|
---|
73 |
|
---|
74 | virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
|
---|
75 | virtual void hideEvent(QHideEvent *pEvent) RT_OVERRIDE;
|
---|
76 | virtual bool eventFilter(QObject *pWatched, QEvent *pEvent) RT_OVERRIDE;
|
---|
77 |
|
---|
78 | private slots:
|
---|
79 |
|
---|
80 | /** Emits sigRedoSearch thuse causes a re-search. */
|
---|
81 | void sltHandleSearchTermChange(const QString &strSearchTerm);
|
---|
82 | void sltHandleScroolToButtonClick();
|
---|
83 | /** Emits sigToggleVisibility, */
|
---|
84 | void sltHandleCloseButtonClick();
|
---|
85 | void sltRetranslateUI();
|
---|
86 |
|
---|
87 | private:
|
---|
88 |
|
---|
89 | void prepareWidgets();
|
---|
90 | void prepareConnections();
|
---|
91 |
|
---|
92 | /** @name Member widgets.
|
---|
93 | * @{ */
|
---|
94 | UISearchLineEdit *m_pLineEdit;
|
---|
95 | QHBoxLayout *m_pMainLayout;
|
---|
96 | QIToolButton *m_pScrollToNextMatchButton;
|
---|
97 | QIToolButton *m_pScrollToPreviousMatchButton;
|
---|
98 | QIToolButton *m_pCloseButton;
|
---|
99 | /** @} */
|
---|
100 | };
|
---|
101 |
|
---|
102 | #endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserSearchWidget_h */
|
---|