VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.h@ 104158

Last change on this file since 104158 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/* $Id: UIMediumSearchWidget.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMediumSearchWidget class declaration.
4 */
5
6/*
7 * Copyright (C) 2006-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_medium_UIMediumSearchWidget_h
29#define FEQT_INCLUDED_SRC_medium_UIMediumSearchWidget_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* GUI includes: */
35#include "QIWithRetranslateUI.h"
36
37/* Forward declarations: */
38class QComboBox;
39class QTreeWidgetItem;
40class QIToolButton;
41class QITreeWidget;
42class UISearchLineEdit;
43
44/** QWidget extension providing a simple way to enter a earch term and search type for medium searching
45 * in virtual media manager, medium selection dialog, etc. */
46class SHARED_LIBRARY_STUFF UIMediumSearchWidget : public QIWithRetranslateUI<QWidget>
47{
48 Q_OBJECT;
49
50signals:
51
52 void sigPerformSearch();
53
54public:
55
56 enum SearchType
57 {
58 SearchByName,
59 SearchByUUID,
60 SearchByMax
61 };
62
63public:
64
65 UIMediumSearchWidget(QWidget *pParent = 0);
66 SearchType searchType() const;
67 QString searchTerm() const;
68 /** Performs the search on the items of the @p pTreeWidget. If @p is true
69 * then the next marched item is selected. */
70 void search(QITreeWidget* pTreeWidget, bool fGotoNext = true);
71
72protected:
73
74 void retranslateUi() RT_OVERRIDE;
75 virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
76
77private slots:
78
79 void sltShowNextMatchingItem();
80 void sltShowPreviousMatchingItem();
81
82private:
83
84 void prepareWidgets();
85 /** Marks/unmarks the items of @p itemList depending on @p fMark. */
86 void markUnmarkItems(QList<QTreeWidgetItem*> &itemList, bool fMark);
87 void setUnderlineItemText(QTreeWidgetItem* pItem, bool fUnderline);
88 /** Increases (or decreases if @p fNext is false) the m_iScrollToIndex and
89 * takes care of the necessary decoration changes to mark the current item. */
90 void goToNextPrevious(bool fNext);
91 /** Updates the feedback text of th line edit that shows # of matches. */
92 void updateSearchLineEdit(int iMatchCount, int iScrollToIndex);
93
94 QComboBox *m_pSearchComboxBox;
95 UISearchLineEdit *m_pSearchTermLineEdit;
96 QIToolButton *m_pShowNextMatchButton;
97 QIToolButton *m_pShowPreviousMatchButton;
98
99 QList<QTreeWidgetItem*> m_matchedItemList;
100 QITreeWidget *m_pTreeWidget;
101 /** The index to the matched item (in m_matchedItemList) which is currently selected/scrolled to. */
102 int m_iScrollToIndex;
103};
104
105#endif /* !FEQT_INCLUDED_SRC_medium_UIMediumSearchWidget_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette