summaryrefslogtreecommitdiff
path: root/src/VBox/Frontends
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2019-01-25 21:36:44 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2019-01-25 21:36:44 +0000
commita8b7cd4f8799a68270b591855abe39235c7bdb20 (patch)
tree171b654fc25f2061d6674ea02b7a6613d53cdb3e /src/VBox/Frontends
parent8af70fc0d9aa5c2d42ff1d31641879674bc0bf5e (diff)
downloadVirtualBox-svn-a8b7cd4f8799a68270b591855abe39235c7bdb20.tar.gz
FE/Qt. Reverting the previous commit
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@76996 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Frontends')
-rw-r--r--src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp22
-rw-r--r--src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h19
-rw-r--r--src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp1
-rw-r--r--src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h2
-rw-r--r--src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp12
-rw-r--r--src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h4
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp47
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h2
-rw-r--r--src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.h5
-rw-r--r--src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp114
-rw-r--r--src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h19
-rw-r--r--src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.cpp104
-rw-r--r--src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.h21
13 files changed, 4 insertions, 368 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp
index 8c4961bddf6..815ce67f3c3 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp
@@ -437,28 +437,6 @@ QModelIndex QITreeWidget::itemIndex(QTreeWidgetItem *pItem)
return indexFromItem(pItem);
}
-QList<QTreeWidgetItem*> QITreeWidget::filterItems(const QITreeWidgetItemFilter &filter, QTreeWidgetItem* pParent /* = 0 */)
-{
- QList<QTreeWidgetItem*> filteredItemList;
- if (!pParent)
- filterItemsInternal(filter, invisibleRootItem(), filteredItemList);
- else
- filterItemsInternal(filter, pParent, filteredItemList);
- return filteredItemList;
-}
-
-void QITreeWidget::filterItemsInternal(const QITreeWidgetItemFilter &filter,
- QTreeWidgetItem* pParent, QList<QTreeWidgetItem*> &filteredItemList)
-{
- if (!pParent)
- return;
- if (filter(pParent))
- filteredItemList.append(pParent);
-
- for (int i = 0; i < pParent->childCount(); ++i)
- filterItemsInternal(filter, pParent->child(i), filteredItemList);
-}
-
void QITreeWidget::paintEvent(QPaintEvent *pEvent)
{
/* Create item painter: */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h
index 3180ed3c7b8..f16256a9df1 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h
@@ -31,16 +31,6 @@
/* Forward declarations: */
class QITreeWidget;
-/** A functor base to be passed to QITabWidget::filterItems(..). Overload operator()(..) to filter out
- * tree items. */
-class SHARED_LIBRARY_STUFF QITreeWidgetItemFilter
-{
- public:
- virtual bool operator()(QTreeWidgetItem*) const
- {
- return true;
- }
-};
/** QTreeWidgetItem subclass extending standard functionality. */
class SHARED_LIBRARY_STUFF QITreeWidgetItem : public QObject, public QTreeWidgetItem
@@ -108,9 +98,6 @@ signals:
/** Returns the child item with @a iIndex. */
QITreeWidgetItem *childItem(int iIndex) const;
QModelIndex itemIndex(QTreeWidgetItem *pItem);
- /** Recurses thru the subtree with a root pParent and returns a list of tree items filtered by @a filter.
- * When @a pParent is null than QTreeWidget::invisibleRootItem() is used as the root item. */
- QList<QTreeWidgetItem*> filterItems(const QITreeWidgetItemFilter &filter, QTreeWidgetItem* pParent = 0);
protected:
@@ -118,12 +105,6 @@ protected:
void paintEvent(QPaintEvent *pEvent);
/** Handles resize @a pEvent. */
void resizeEvent(QResizeEvent *pEvent);
-
- private:
-
- /* Recurses thru the tree and append filtered items to @a filteredItemList. */
- void filterItemsInternal(const QITreeWidgetItemFilter &filter, QTreeWidgetItem* pParent,
- QList<QTreeWidgetItem*> &filteredItemList);
};
diff --git a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
index c7b187e6ca8..5f3646cdada 100644
--- a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
@@ -99,7 +99,6 @@ const char *UIExtraDataDefs::GUI_SnapshotManager_Details_Expanded = "GUI/Snapsho
/* Virtual Media Manager: */
const char *UIExtraDataDefs::GUI_VirtualMediaManager_Details_Expanded = "GUI/VirtualMediaManager/Details/Expanded";
-const char *UIExtraDataDefs::GUI_VirtualMediaManager_Search_Widget_Expanded = "GUI/VirtualMediaManager/SearchWidget/Expanded";
/* Host Network Manager: */
const char *UIExtraDataDefs::GUI_HostNetworkManager_Details_Expanded = "GUI/HostNetworkManager/Details/Expanded";
diff --git a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
index c0e266a7339..7dd192e1e77 100644
--- a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
@@ -190,8 +190,6 @@ namespace UIExtraDataDefs
* @{ */
/** Holds whether Virtual Media Manager details expanded. */
SHARED_LIBRARY_STUFF extern const char *GUI_VirtualMediaManager_Details_Expanded;
- /** Holds whether Virtual Media Manager search widget expanded. */
- SHARED_LIBRARY_STUFF extern const char *GUI_VirtualMediaManager_Search_Widget_Expanded;
/** @} */
/** @name Host Network Manager
diff --git a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
index 113dbe5f0cc..17d8ecb59ae 100644
--- a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
@@ -2974,18 +2974,6 @@ void UIExtraDataManager::setVirtualMediaManagerDetailsExpanded(bool fExpanded)
return setExtraDataString(GUI_VirtualMediaManager_Details_Expanded, toFeatureAllowed(fExpanded));
}
-bool UIExtraDataManager::virtualMediaManagerSearchWidgetExpanded()
-{
- /* 'False' unless feature allowed: */
- return isFeatureAllowed(GUI_VirtualMediaManager_Search_Widget_Expanded);
-}
-
-void UIExtraDataManager::setVirtualMediaManagerSearchWidgetExpanded(bool fExpanded)
-{
- /* 'True' if feature allowed, null-string otherwise: */
- return setExtraDataString(GUI_VirtualMediaManager_Search_Widget_Expanded, toFeatureAllowed(fExpanded));
-}
-
bool UIExtraDataManager::hostNetworkManagerDetailsExpanded()
{
/* 'False' unless feature allowed: */
diff --git a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
index e4ea0022815..018637c9f18 100644
--- a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
@@ -369,10 +369,6 @@ public:
bool virtualMediaManagerDetailsExpanded();
/** Defines whether Virtual Media Manager details @a fExpanded. */
void setVirtualMediaManagerDetailsExpanded(bool fExpanded);
- /** Returns whether Virtual Media Manager search widget expanded. */
- bool virtualMediaManagerSearchWidgetExpanded();
- /** Defines whether Virtual Media Manager search widget @a fExpanded. */
- void setVirtualMediaManagerSearchWidgetExpanded(bool fExpanded);
/** @} */
/** @name Host Network Manager
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
index aabf7f2430f..9a0a7cc4485 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
@@ -2044,50 +2044,6 @@ protected:
}
};
-/** Toggle action extension, used as 'Toggle Search Pane' action class. */
-class UIActionMenuSelectorMediumToggleSearch : public UIActionToggle
-{
- Q_OBJECT;
-
-public:
-
- /** Constructs action passing @a pParent to the base-class. */
- UIActionMenuSelectorMediumToggleSearch(UIActionPool *pParent)
- : UIActionToggle(pParent)
- {
- setShortcutContext(Qt::WidgetWithChildrenShortcut);
- setIcon(0, UIIconPool::iconSetFull(":/hd_modify_32px.png", ":/hd_modify_16px.png",
- ":/hd_modify_disabled_32px.png", ":/hd_modify_disabled_16px.png"));
- setIcon(1, UIIconPool::iconSetFull(":/cd_modify_32px.png", ":/cd_modify_16px.png",
- ":/cd_modify_disabled_32px.png", ":/cd_modify_disabled_16px.png"));
- setIcon(2, UIIconPool::iconSetFull(":/fd_modify_32px.png", ":/fd_modify_16px.png",
- ":/fd_modify_disabled_32px.png", ":/fd_modify_disabled_16px.png"));
- }
-
-protected:
-
- /** Returns shortcut extra-data ID. */
- virtual QString shortcutExtraDataID() const /* override */
- {
- return QString("ToggleMediumSearch");
- }
-
- /** Returns default shortcut. */
- virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
- {
- return QKeySequence("");
- }
-
- /** Handles translation event. */
- virtual void retranslateUi() /* override */
- {
- setName(QApplication::translate("UIActionPool", "&Search"));
- setShortcutScope(QApplication::translate("UIActionPool", "Media Manager"));
- setStatusTip(QApplication::translate("UIActionPool", "Open the medium search pane"));
- setToolTip(QApplication::translate("UIActionPool", "Open Medium Search Pane (%1)").arg(shortcut().toString()));
- }
-};
-
/** Simple action extension, used as 'Perform Refresh' action class. */
class UIActionMenuSelectorMediumPerformRefresh : public UIActionSimple
{
@@ -2662,7 +2618,6 @@ void UIActionPoolManager::preparePool()
m_pool[UIActionIndexST_M_Medium_S_Remove] = new UIActionMenuSelectorMediumPerformRemove(this);
m_pool[UIActionIndexST_M_Medium_S_Release] = new UIActionMenuSelectorMediumPerformRelease(this);
m_pool[UIActionIndexST_M_Medium_T_Details] = new UIActionMenuSelectorMediumToggleProperties(this);
- m_pool[UIActionIndexST_M_Medium_T_Search] = new UIActionMenuSelectorMediumToggleSearch(this);
m_pool[UIActionIndexST_M_Medium_S_Refresh] = new UIActionMenuSelectorMediumPerformRefresh(this);
/* Host Network Manager actions: */
@@ -3131,8 +3086,6 @@ void UIActionPoolManager::updateMenuMediumWrapper(UIMenu *pMenu)
fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_S_Release)) || fSeparator;
/* 'Properties' action: */
fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_T_Details)) || fSeparator;
- /* 'Search' action: */
- fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_T_Search)) || fSeparator;
/* Separator? */
if (fSeparator)
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h b/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h
index 896b56f944e..19820928985 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h
@@ -137,7 +137,6 @@ enum UIActionIndexST
UIActionIndexST_M_Medium_S_Remove,
UIActionIndexST_M_Medium_S_Release,
UIActionIndexST_M_Medium_T_Details,
- UIActionIndexST_M_Medium_T_Search,
UIActionIndexST_M_Medium_S_Refresh,
/* Host Network Manager actions: */
@@ -247,3 +246,4 @@ private:
#endif /* !FEQT_INCLUDED_SRC_globals_UIActionPoolManager_h */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.h
index 510922eaa91..9075a807096 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.h
@@ -71,11 +71,8 @@ public:
/** Returns KMediumState of the wrapped UIMedium. */
KMediumState state() const { return m_guiMedium.state(); }
- /** Returns QUuid <i>ID</i> of the wrapped UIMedium. */
+ /** Returns QString <i>ID</i> of the wrapped UIMedium. */
QUuid id() const { return m_guiMedium.id(); }
- /** Returns QString <i>name</i> of the wrapped UIMedium. */
- QString name() const { return m_guiMedium.name(); }
-
/** Returns QString <i>location</i> of the wrapped UIMedium. */
QString location() const { return m_guiMedium.location(); }
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
index ce5261d7b30..25915c79e1c 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
@@ -36,7 +36,6 @@
#include "UIMediumDetailsWidget.h"
#include "UIMediumItem.h"
#include "UIMediumManager.h"
-#include "UIMediumSearchWidget.h"
#include "UIWizardCloneVD.h"
#include "UIMessageCenter.h"
#include "UIToolBar.h"
@@ -161,7 +160,6 @@ UIMediumManagerWidget::UIMediumManagerWidget(EmbedTo enmEmbedding, UIActionPool
, m_pDetailsWidget(0)
, m_pToolBar(0)
, m_pProgressBar(0)
- , m_pSearchWidget(0)
{
/* Prepare: */
prepare();
@@ -563,15 +561,6 @@ void UIMediumManagerWidget::sltToggleMediumDetailsVisibility(bool fVisible)
emit sigMediumDetailsVisibilityChanged(fVisible);
}
-void UIMediumManagerWidget::sltToggleMediumSearchVisibility(bool fVisible)
-{
- /* Save the setting: */
- //gEDataManager->setVirtualMediaManagerSea(fVisible);
- /* Toggle medium details visibility: */
- if (m_pSearchWidget)
- m_pSearchWidget->setVisible(fVisible);
-}
-
void UIMediumManagerWidget::sltRefreshAll()
{
/* Start medium-enumeration: */
@@ -630,12 +619,10 @@ void UIMediumManagerWidget::sltHandleContextMenuRequest(const QPoint &position)
menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Remove));
menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Release));
menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Details));
- menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Search));
}
else
{
menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Add));
- menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Search));
menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Refresh));
}
/* And show it: */
@@ -667,42 +654,6 @@ void UIMediumManagerWidget::sltPerformTablesAdjustment()
}
}
-void UIMediumManagerWidget::sltHandlePerformSearch()
-{
- if (!m_pSearchWidget || !m_pTabWidget)
- return;
-
- QITreeWidget *pTreeWidget = treeWidget(static_cast<UIMediumDeviceType>(m_pTabWidget->currentIndex()));
- if (!pTreeWidget)
- return;
- m_pSearchWidget->search(pTreeWidget);
-
- // printf("size %d\n", matchedList.size());
- // m_pSearchWidget->searchItems(pTreeWidget->invisibleRootItem(), matchedList);
-
-
-
- // SearchType searchType() const;
- // QString searchTerm() const;
-
-
- // foreach (const QUuid &id, vboxGlobal().mediumIDs())
- // {
- // UIMedium medium = vboxGlobal().medium(id);
- // /** Only search among the types of the tab widget's current page: */
- // if (static_cast<UIMediumDeviceType>(m_pTabWidget->currentIndex()) != medium.type())
- // continue;
- // if (m_pSearchWidget->searchType() == UIMediumSearchWidget::SearchByName &&
- // medium.name().contains(m_pSearchWidget->searchTerm(), Qt::CaseInsensitive))
- // matchedMediumList << medium;
- // else if (m_pSearchWidget->searchType() == UIMediumSearchWidget::SearchByUUID &&
- // medium.id().toString().contains(m_pSearchWidget->searchTerm(), Qt::CaseInsensitive))
- // matchedMediumList << medium;
- // }
- // printf("search %s -- %d\n", qPrintable(m_pSearchWidget->searchTerm()), matchedMediumList.size());
-
-}
-
void UIMediumManagerWidget::prepare()
{
/* Prepare connections: */
@@ -759,7 +710,6 @@ void UIMediumManagerWidget::prepareActions()
addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Remove));
addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Release));
addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Details));
- addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Search));
addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Refresh));
/* Connect actions: */
@@ -775,8 +725,6 @@ void UIMediumManagerWidget::prepareActions()
this, &UIMediumManagerWidget::sltReleaseMedium);
connect(m_pActionPool->action(UIActionIndexST_M_Medium_T_Details), &QAction::toggled,
this, &UIMediumManagerWidget::sltToggleMediumDetailsVisibility);
- connect(m_pActionPool->action(UIActionIndexST_M_Medium_T_Search), &QAction::toggled,
- this, &UIMediumManagerWidget::sltToggleMediumSearchVisibility);
connect(m_pActionPool->action(UIActionIndexST_M_Medium_S_Refresh), &QAction::triggered,
this, &UIMediumManagerWidget::sltRefreshAll);
@@ -805,8 +753,6 @@ void UIMediumManagerWidget::prepareWidgets()
prepareTabWidget();
/* Prepare details-widget: */
prepareDetailsWidget();
- /* Prepare search-widget: */
- prepareSearchWidget();
}
}
@@ -829,7 +775,6 @@ void UIMediumManagerWidget::prepareToolBar()
m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Remove));
m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Release));
m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Details));
- m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Search));
m_pToolBar->addSeparator();
m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Refresh));
@@ -955,31 +900,11 @@ void UIMediumManagerWidget::prepareDetailsWidget()
}
}
-void UIMediumManagerWidget::prepareSearchWidget()
-{
- m_pSearchWidget = new UIMediumSearchWidget(this);
- AssertPtrReturnVoid(m_pSearchWidget);
- {
- m_pSearchWidget->setVisible(false);
- m_pSearchWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
- connect(m_pSearchWidget, &UIMediumSearchWidget::sigPerformSearch,
- this, &UIMediumManagerWidget::sltHandlePerformSearch);
-
- /* Add into layout: */
- layout()->addWidget(m_pSearchWidget);
- }
-
-}
-
void UIMediumManagerWidget::loadSettings()
{
/* Details action/widget: */
m_pActionPool->action(UIActionIndexST_M_Medium_T_Details)->setChecked(gEDataManager->virtualMediaManagerDetailsExpanded());
sltToggleMediumDetailsVisibility(m_pActionPool->action(UIActionIndexST_M_Medium_T_Details)->isChecked());
-
- /* Search action/widget: */
- m_pActionPool->action(UIActionIndexST_M_Medium_T_Search)->setChecked(gEDataManager->virtualMediaManagerDetailsExpanded());
- sltToggleMediumSearchVisibility(m_pActionPool->action(UIActionIndexST_M_Medium_T_Search)->isChecked());
}
void UIMediumManagerWidget::repopulateTreeWidgets()
@@ -1718,42 +1643,3 @@ UIMediumManagerWidget *UIMediumManager::widget()
{
return qobject_cast<UIMediumManagerWidget*>(QIManagerDialog::widget());
}
-
-void UIMediumManagerWidget::markUnmarkSearchMatchedItems(bool fMark)
-{
- /* Unmark the whole tree: */
- if (!fMark)
- {
- QITreeWidget *pTreeWidget = treeWidget(static_cast<UIMediumDeviceType>(m_pTabWidget->currentIndex()));
- if (!pTreeWidget)
- return;
- QList<UIMediumItem*> itemList;
-
- getItems(pTreeWidget->invisibleRootItem(), itemList);
- }
- //QList<UIMedium> m_matchedMediumList;
- // for (int i = 0; i < m_mediumItemList.size(); ++i)
- // {
- // for (int j = 0; j < m_pTreeWidget->columnCount(); ++j)
- // {
- // if (m_mediumItemList[i])
- // m_mediumItemList[i]->setData(j, Qt::ForegroundRole, m_defaultItemForeground);
- // }
- // }
-
-}
-
-void UIMediumManagerWidget::getItems(QTreeWidgetItem *pParentItem, QList<UIMediumItem*> outList)
-{
- if (!pParentItem)
- return;
- if (pParentItem->type() == QITreeWidgetItem::ItemType)
- {
- UIMediumItem* pItem = static_cast<UIMediumItem*>(pParentItem);
- if (pItem)
- outList.append(pItem);
- }
-
- for (int iChildIndex = 0; iChildIndex < pParentItem->childCount(); ++iChildIndex)
- getItems(pParentItem->child(iChildIndex), outList);
-}
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
index 718b74c7627..34c5bee2631 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
@@ -39,7 +39,6 @@ class UIActionPool;
class UIMedium;
class UIMediumDetailsWidget;
class UIMediumItem;
-class UIMediumSearchWidget;
class UIToolBar;
@@ -177,8 +176,6 @@ private slots:
void sltReleaseMedium();
/** Handles command to make medium details @a fVisible. */
void sltToggleMediumDetailsVisibility(bool fVisible);
- /** Handles command to make medium search pane @a fVisible. */
- void sltToggleMediumSearchVisibility(bool fVisible);
/** Handles command to refresh medium. */
void sltRefreshAll();
/** @} */
@@ -199,12 +196,6 @@ private slots:
void sltPerformTablesAdjustment();
/** @} */
- /** @name Medium search stuff.
- * @{ */
- /** Adjusts tree-widgets according content. */
- void sltHandlePerformSearch();
- /** @} */
-
private:
/** @name Prepare/cleanup cascade.
@@ -227,8 +218,6 @@ private:
void prepareTreeWidget(UIMediumDeviceType type, int iColumns);
/** Prepares details-widget. */
void prepareDetailsWidget();
- /** Prepares search-widget. */
- void prepareSearchWidget();
/** Load settings: */
void loadSettings();
@@ -296,7 +285,6 @@ private:
const CheckIfSuitableBy &condition,
CheckIfSuitableBy *pException = 0);
-
/** Checks if @a action can be used for @a pItem. */
static bool checkMediumFor(UIMediumItem *pItem, Action action);
@@ -362,13 +350,6 @@ private:
/** Holds the progress-bar widget reference. */
UIEnumerationProgressBar *m_pProgressBar;
/** @} */
-
- /** @name Search-widget variables.
- * @{ */
- /** Holds the medium details-widget instance. */
- UIMediumSearchWidget *m_pSearchWidget;
- /** @} */
-
};
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.cpp
index 928a277ba4f..da9d06ee522 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.cpp
@@ -24,10 +24,8 @@
#include "QIComboBox.h"
#include "QIDialogButtonBox.h"
#include "QIToolButton.h"
-#include "QITreeWidget.h"
#include "UIFDCreationDialog.h"
#include "UIIconPool.h"
-#include "UIMediumItem.h"
#include "UIMediumSearchWidget.h"
#include "UIToolBar.h"
@@ -35,47 +33,12 @@
# include "UIWindowMenuManager.h"
#endif /* VBOX_WS_MAC */
-
-class FilterByNameUUID : public QITreeWidgetItemFilter
-{
-
-public:
-
- FilterByNameUUID(UIMediumSearchWidget::SearchType enmSearchType, const QString &strSearchTerm)
- : m_enmSearchType(enmSearchType)
- , m_strSearchTerm(strSearchTerm){}
-
- virtual bool operator()(QTreeWidgetItem *pItem) const
- {
- if (!pItem || m_strSearchTerm.isEmpty())
- return false;
- if (pItem->type() != QITreeWidgetItem::ItemType)
- return false;
-
- UIMediumItem *pMediumItem = static_cast<UIMediumItem*>(pItem);
- if (!pMediumItem)
- return false;
- if (m_enmSearchType == UIMediumSearchWidget::SearchByUUID && !pMediumItem->id().toString().contains(m_strSearchTerm))
- return false;
- if (m_enmSearchType == UIMediumSearchWidget::SearchByName && !pMediumItem->name().contains(m_strSearchTerm))
- return false;
- return true;
- }
-
-private:
-
- UIMediumSearchWidget::SearchType m_enmSearchType;
- QString m_strSearchTerm;
-};
-
UIMediumSearchWidget::UIMediumSearchWidget(QWidget *pParent)
:QIWithRetranslateUI<QWidget>(pParent)
, m_pSearchComboxBox(0)
, m_pSearchTermLineEdit(0)
, m_pShowNextMatchButton(0)
, m_pShowPreviousMatchButton(0)
- , m_pTreeWidget(0)
- , m_iScrollToIndex(0)
{
prepareWidgets();
}
@@ -114,8 +77,6 @@ void UIMediumSearchWidget::prepareWidgets()
{
m_pShowPreviousMatchButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_backward_16px.png", ":/log_viewer_search_backward_disabled_16px.png"));
connect(m_pShowPreviousMatchButton, &QIToolButton::clicked, this, &UIMediumSearchWidget::sigShowPreviousMatchingItem);
- connect(m_pShowPreviousMatchButton, &QIToolButton::clicked, this, &UIMediumSearchWidget::sltShowPreviousMatchingItem);
-
pLayout->addWidget(m_pShowPreviousMatchButton);
}
m_pShowNextMatchButton = new QIToolButton;
@@ -123,8 +84,6 @@ void UIMediumSearchWidget::prepareWidgets()
{
m_pShowNextMatchButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_forward_16px.png", ":/log_viewer_search_forward_disabled_16px.png"));
connect(m_pShowNextMatchButton, &QIToolButton::clicked, this, &UIMediumSearchWidget:: sigShowNextMatchingItem);
- connect(m_pShowNextMatchButton, &QIToolButton::clicked, this, &UIMediumSearchWidget:: sltShowNextMatchingItem);
-
pLayout->addWidget(m_pShowNextMatchButton);
}
@@ -145,24 +104,6 @@ QString UIMediumSearchWidget::searchTerm() const
return m_pSearchTermLineEdit->text();
}
-void UIMediumSearchWidget::search(QITreeWidget* pTreeWidget)
-{
- if (!pTreeWidget)
- return;
-
- m_pTreeWidget = pTreeWidget;
- QList<QTreeWidgetItem*> allItems = pTreeWidget->filterItems(QITreeWidgetItemFilter());
- markUnmarkItems(allItems, false);
-
- m_matchedItemList = pTreeWidget->filterItems(FilterByNameUUID(searchType(), searchTerm()));
- markUnmarkItems(m_matchedItemList, true);
- if (!m_matchedItemList.isEmpty())
- {
- m_iScrollToIndex = 0;
- pTreeWidget->scrollTo(pTreeWidget->itemIndex(m_matchedItemList[m_iScrollToIndex]), QAbstractItemView::PositionAtCenter);
- }
-}
-
void UIMediumSearchWidget::retranslateUi()
{
if (m_pSearchComboxBox)
@@ -178,48 +119,3 @@ void UIMediumSearchWidget::retranslateUi()
if (m_pShowNextMatchButton)
m_pShowNextMatchButton->setToolTip("Show the next item matching the search term");
}
-
-void UIMediumSearchWidget::showEvent(QShowEvent *pEvent)
-{
- if (m_pSearchTermLineEdit)
- m_pSearchTermLineEdit->setFocus();
- QIWithRetranslateUI<QWidget>::showEvent(pEvent);
-}
-
-void UIMediumSearchWidget::markUnmarkItems(QList<QTreeWidgetItem*> &itemList, bool fMark)
-{
- foreach (QTreeWidgetItem* pItem, itemList)
- {
- if (pItem->type() != QITreeWidgetItem::ItemType)
- continue;
- UIMediumItem *pMediumItem = static_cast<UIMediumItem*>(pItem);
- if (!pMediumItem)
- continue;
- QFont font = pMediumItem->font(0);
- font.setBold(fMark);
- pMediumItem->setFont(0, font);
- }
-}
-
-void UIMediumSearchWidget::sltShowNextMatchingItem()
-{
- if (!m_pTreeWidget)
- return;
- if (++m_iScrollToIndex >= m_matchedItemList.size())
- m_iScrollToIndex = 0;
- if (!m_matchedItemList[m_iScrollToIndex])
- return;
- m_pTreeWidget->scrollTo(m_pTreeWidget->itemIndex(m_matchedItemList[m_iScrollToIndex]), QAbstractItemView::PositionAtCenter);
-}
-
-void UIMediumSearchWidget::sltShowPreviousMatchingItem()
-{
- if (!m_pTreeWidget)
- return;
- if (--m_iScrollToIndex <= 0)
- m_iScrollToIndex = m_matchedItemList.size() - 1;
- if (!m_matchedItemList[m_iScrollToIndex])
- return;
- m_pTreeWidget->scrollTo(m_pTreeWidget->itemIndex(m_matchedItemList[m_iScrollToIndex]), QAbstractItemView::PositionAtCenter);
-
-}
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.h
index 3d39e3a185d..17460a034ab 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.h
@@ -26,14 +26,10 @@
/* Forward declarations: */
class QAction;
-class QTreeWidgetItem;
class QLineEdit;
class QIComboBox;
class QIDialogButtonBox;
class QIToolButton;
-class QITreeWidget;
-class UIMediumItem;
-
/** QWidget extension providing a simple way to enter a earch term and search type for medium searching
* in virtual media manager, medium selection dialog, etc. */
@@ -61,31 +57,18 @@ public:
UIMediumSearchWidget(QWidget *pParent = 0);
SearchType searchType() const;
QString searchTerm() const;
- void search(QITreeWidget* pTreeWidget);
- protected:
+protected:
void retranslateUi() /* override */;
- virtual void showEvent(QShowEvent *pEvent) /* override */;
-
- private slots:
-
- void sltShowNextMatchingItem();
- void sltShowPreviousMatchingItem();
private:
- void prepareWidgets();
- void markUnmarkItems(QList<QTreeWidgetItem*> &itemList, bool fMark);
-
+ void prepareWidgets();
QIComboBox *m_pSearchComboxBox;
QLineEdit *m_pSearchTermLineEdit;
QIToolButton *m_pShowNextMatchButton;
QIToolButton *m_pShowPreviousMatchButton;
-
- QList<QTreeWidgetItem*> m_matchedItemList;
- QITreeWidget *m_pTreeWidget;
- int m_iScrollToIndex;
};
#endif /* !FEQT_INCLUDED_SRC_medium_UIMediumSearchWidget_h */