VirtualBox

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

Last change on this file was 104226, checked in by vboxsync, 6 weeks ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in medium manager related classes.

  • 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 104226 2024-04-08 12:07:43Z 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/* Qt includes. */
35#include <QWidget>
36
37/* GUI includes. */
38#include "UILibraryDefs.h"
39
40/* Forward declarations: */
41class QComboBox;
42class QTreeWidgetItem;
43class QIToolButton;
44class QITreeWidget;
45class UISearchLineEdit;
46
47/** QWidget extension providing a simple way to enter a earch term and search type for medium searching
48 * in virtual media manager, medium selection dialog, etc. */
49class SHARED_LIBRARY_STUFF UIMediumSearchWidget : public QWidget
50{
51 Q_OBJECT;
52
53signals:
54
55 void sigPerformSearch();
56
57public:
58
59 enum SearchType
60 {
61 SearchByName,
62 SearchByUUID,
63 SearchByMax
64 };
65
66public:
67
68 UIMediumSearchWidget(QWidget *pParent = 0);
69 SearchType searchType() const;
70 QString searchTerm() const;
71 /** Performs the search on the items of the @p pTreeWidget. If @p is true
72 * then the next marched item is selected. */
73 void search(QITreeWidget* pTreeWidget, bool fGotoNext = true);
74
75protected:
76
77 virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
78
79private slots:
80
81 void sltShowNextMatchingItem();
82 void sltShowPreviousMatchingItem();
83 void sltRetranslateUI();
84
85private:
86
87 void prepareWidgets();
88 /** Marks/unmarks the items of @p itemList depending on @p fMark. */
89 void markUnmarkItems(QList<QTreeWidgetItem*> &itemList, bool fMark);
90 void setUnderlineItemText(QTreeWidgetItem* pItem, bool fUnderline);
91 /** Increases (or decreases if @p fNext is false) the m_iScrollToIndex and
92 * takes care of the necessary decoration changes to mark the current item. */
93 void goToNextPrevious(bool fNext);
94 /** Updates the feedback text of th line edit that shows # of matches. */
95 void updateSearchLineEdit(int iMatchCount, int iScrollToIndex);
96
97 QComboBox *m_pSearchComboxBox;
98 UISearchLineEdit *m_pSearchTermLineEdit;
99 QIToolButton *m_pShowNextMatchButton;
100 QIToolButton *m_pShowPreviousMatchButton;
101
102 QList<QTreeWidgetItem*> m_matchedItemList;
103 QITreeWidget *m_pTreeWidget;
104 /** The index to the matched item (in m_matchedItemList) which is currently selected/scrolled to. */
105 int m_iScrollToIndex;
106};
107
108#endif /* !FEQT_INCLUDED_SRC_medium_UIMediumSearchWidget_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use