Manager: Initial preparation for re-enabling the toolbar:

* Increase button size and display text under icons
* Remove the duplicate search bar
* Move the existing search bar to the top of the machine list
This commit is contained in:
Alexander Babikov
2025-12-06 03:23:42 +05:00
parent d0926809e5
commit 1dd681f33a
3 changed files with 25 additions and 67 deletions

View File

@@ -60,6 +60,19 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="searchBar">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="placeholderText">
<string>Search</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="listView">
<property name="sizePolicy">
@@ -76,19 +89,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="searchBar">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="placeholderText">
<string>Search</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="detailsArea" native="true">

View File

@@ -24,9 +24,6 @@
#include "qt_progsettings.hpp"
#include "qt_util.hpp"
#include <QLineEdit>
#include <QStringListModel>
#include <QCompleter>
#include <QCloseEvent>
#include <QDesktopServices>
@@ -70,11 +67,7 @@ VMManagerMainWindow::
connect(ui->actionCheck_for_updates, &QAction::triggered, this, &VMManagerMainWindow::checkForUpdatesTriggered);
#endif
// TODO: Remove all of this (all the way to END REMOVE) once certain the search will no longer be in the toolbar.
// BEGIN REMOVE
// Everything is still setup here for it but it is all hidden. None of it will be
// needed if the search stays in VMManagerMain
ui->actionStartPause->setEnabled(true);
// TODO: Unhide the toolbar once the actions are fixed to properly update on VM status change
ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico"));
ui->actionStartPause->setText(tr("Start"));
ui->actionStartPause->setToolTip(tr("Start"));
@@ -82,36 +75,13 @@ VMManagerMainWindow::
ui->actionForce_Shutdown->setEnabled(false);
ui->actionCtrl_Alt_Del->setEnabled(false);
const auto searchBar = new QLineEdit();
searchBar->setMinimumWidth(150);
searchBar->setPlaceholderText(tr("Search"));
searchBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
searchBar->setClearButtonEnabled(true);
// Spacer to make the search go all the way to the right
const auto spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
ui->toolBar->addWidget(spacer);
ui->toolBar->addWidget(searchBar);
// Connect signal for search
connect(searchBar, &QLineEdit::textChanged, vmm, &VMManagerMain::searchSystems);
// Preferences
connect(ui->actionPreferences, &QAction::triggered, this, &VMManagerMainWindow::preferencesTriggered);
// Create a completer for the search bar
auto *completer = new QCompleter(this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setFilterMode(Qt::MatchContains);
// Get the completer list
const auto allStrings = vmm->getSearchCompletionList();
// Set up the completer
auto *completerModel = new QStringListModel(allStrings, completer);
completer->setModel(completerModel);
searchBar->setCompleter(completer);
#ifdef Q_OS_WINDOWS
ui->toolBar->setBackgroundRole(QPalette::Light);
#endif
ui->toolBar->setVisible(false);
// END REMOVE
// Status bar widgets
statusLeft->setAlignment(Qt::AlignLeft);

View File

@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>86Box VM Manager</string>
<string notr="true">86Box VM Manager</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
@@ -23,6 +23,9 @@
<height>21</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
</property>
<widget class="QMenu" name="menuTools">
<property name="title">
<string>&amp;Tools</string>
@@ -56,22 +59,25 @@
<bool>true</bool>
</property>
<property name="windowTitle">
<string>toolBar</string>
<string notr="true">toolBar</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
</property>
<property name="allowedAreas">
<set>Qt::TopToolBarArea</set>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
@@ -88,9 +94,6 @@
<addaction name="actionSettings"/>
</widget>
<action name="actionStartPause">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../qt_resources.qrc">
<normaloff>:/menuicons/qt/icons/run.ico</normaloff>:/menuicons/qt/icons/run.ico</iconset>
@@ -206,21 +209,6 @@
<enum>QAction::PreferencesRole</enum>
</property>
</action>
<action name="actionStart">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../qt_resources.qrc">
<normaloff>:/menuicons/qt/icons/run.ico</normaloff>:/menuicons/qt/icons/run.ico</iconset>
</property>
<property name="text">
<string>&amp;Start</string>
</property>
<property name="iconVisibleInMenu">
<bool>false</bool>
</property>
</action>
<action name="actionCheck_for_updates">
<property name="text">
<string>&amp;Check for updates...</string>