Skip to content

Commit 36e60b7

Browse files
vkconfig: Add diagnostics search
Change-Id: I415054fef55a4e941d7cb08509a4455c44aed94b
1 parent 131c5ff commit 36e60b7

File tree

12 files changed

+96
-2
lines changed

12 files changed

+96
-2
lines changed

vkconfig_core/configurator.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,14 @@ bool Configurator::Load() {
883883

884884
this->use_system_tray = json_object.value("use_system_tray").toBool();
885885

886+
if (json_object.value("show_diagnostic_search") != QJsonValue::Undefined) {
887+
this->show_diagnostic_search = json_object.value("show_diagnostic_search").toBool();
888+
}
889+
890+
if (json_object.value("diagnostic_search_text") != QJsonValue::Undefined) {
891+
this->diagnostic_search_text = json_object.value("diagnostic_search_text").toString().toStdString();
892+
}
893+
886894
if (json_object.value("VULKAN_HOME") != QJsonValue::Undefined) {
887895
::SetHomePath(json_object.value("VULKAN_HOME").toString().toStdString());
888896
}
@@ -939,6 +947,8 @@ bool Configurator::Save() const {
939947
json_object.insert("use_notify_releases", this->use_notify_releases);
940948
json_object.insert("latest_sdk_version", this->latest_sdk_version.str().c_str());
941949
json_object.insert("last_vkconfig_version", Version::VKCONFIG.str().c_str());
950+
json_object.insert("show_diagnostic_search", this->show_diagnostic_search);
951+
json_object.insert("diagnostic_search_text", this->diagnostic_search_text.c_str());
942952
json_object.insert("VULKAN_HOME", ::Path(Path::HOME).RelativePath().c_str());
943953
json_object.insert("VULKAN_DOWNLOAD", ::Path(Path::DOWNLOAD).RelativePath().c_str());
944954
json_interface_object.insert(GetToken(TAB_PREFERENCES), json_object);
@@ -1004,6 +1014,10 @@ bool Configurator::GetUseNotifyReleases() const { return this->use_notify_releas
10041014

10051015
void Configurator::SetUseNotifyReleases(bool enabled) { this->use_notify_releases = enabled; }
10061016

1017+
bool Configurator::GetShowDiagnosticSearch() const { return show_diagnostic_search; }
1018+
1019+
void Configurator::SetShowDiagnosticSearch(bool enabled) { this->show_diagnostic_search = enabled; }
1020+
10071021
bool Configurator::ShouldNotify() const {
10081022
return this->latest_sdk_version < this->online_sdk_version && this->online_sdk_version != Version::NONE &&
10091023
!(Version::VKCONFIG > this->last_vkconfig_version);

vkconfig_core/configurator.h

+5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ class Configurator {
113113
bool GetUseNotifyReleases() const;
114114
void SetUseNotifyReleases(bool enabled);
115115

116+
bool GetShowDiagnosticSearch() const;
117+
void SetShowDiagnosticSearch(bool enabled);
118+
116119
bool ShouldNotify() const;
117120

118121
bool HasActiveSettings() const;
@@ -149,12 +152,14 @@ class Configurator {
149152
Version latest_sdk_version = Version::NONE;
150153
Version online_sdk_version = Version::NONE;
151154
Version last_vkconfig_version = Version::NONE;
155+
std::string diagnostic_search_text;
152156

153157
private:
154158
int hide_message_boxes_flags = 0;
155159
bool use_system_tray = false;
156160
bool use_layer_dev_mode = false;
157161
bool use_notify_releases = true;
162+
bool show_diagnostic_search = false;
158163
ExecutableScope executable_scope = EXECUTABLE_ANY;
159164
std::string selected_global_configuration = "Validation";
160165
};

vkconfig_gui/mainwindow.ui

+44-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>1200</width>
9+
<width>1024</width>
1010
<height>640</height>
1111
</rect>
1212
</property>
@@ -85,7 +85,7 @@
8585
<enum>QTabWidget::TabShape::Rounded</enum>
8686
</property>
8787
<property name="currentIndex">
88-
<number>5</number>
88+
<number>3</number>
8989
</property>
9090
<widget class="QWidget" name="tab_configurations">
9191
<attribute name="title">
@@ -1588,6 +1588,48 @@
15881588
<property name="bottomMargin">
15891589
<number>5</number>
15901590
</property>
1591+
<item>
1592+
<layout class="QHBoxLayout" name="diagnostic_search_layout">
1593+
<property name="spacing">
1594+
<number>0</number>
1595+
</property>
1596+
<property name="topMargin">
1597+
<number>0</number>
1598+
</property>
1599+
<property name="bottomMargin">
1600+
<number>0</number>
1601+
</property>
1602+
<item>
1603+
<widget class="QLineEdit" name="diagnostic_search_edit"/>
1604+
</item>
1605+
<item>
1606+
<widget class="QPushButton" name="diagnostic_search_next">
1607+
<property name="maximumSize">
1608+
<size>
1609+
<width>32</width>
1610+
<height>16777215</height>
1611+
</size>
1612+
</property>
1613+
<property name="text">
1614+
<string/>
1615+
</property>
1616+
</widget>
1617+
</item>
1618+
<item>
1619+
<widget class="QPushButton" name="diagnostic_search_exit">
1620+
<property name="maximumSize">
1621+
<size>
1622+
<width>32</width>
1623+
<height>16777215</height>
1624+
</size>
1625+
</property>
1626+
<property name="text">
1627+
<string/>
1628+
</property>
1629+
</widget>
1630+
</item>
1631+
</layout>
1632+
</item>
15911633
<item>
15921634
<widget class="QTextEdit" name="diagnostic_status_text">
15931635
<property name="font">
947 Bytes
Loading
800 Bytes
Loading
756 Bytes
Loading
608 Bytes
Loading

vkconfig_gui/resources.qrc

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
<file>resourcefiles/dark/clear.png</file>
1212
<file>resourcefiles/dark/drag.png</file>
13+
<file>resourcefiles/dark/next.png</file>
14+
<file>resourcefiles/dark/exit.png</file>
1315

1416
<file>resourcefiles/dark/file_export.png</file>
1517
<file>resourcefiles/dark/file_search.png</file>
@@ -38,6 +40,8 @@
3840

3941
<file>resourcefiles/light/clear.png</file>
4042
<file>resourcefiles/light/drag.png</file>
43+
<file>resourcefiles/light/next.png</file>
44+
<file>resourcefiles/light/exit.png</file>
4145

4246
<file>resourcefiles/light/file_export.png</file>
4347
<file>resourcefiles/light/file_search.png</file>

vkconfig_gui/source/arrow.pdn

20.7 KB
Binary file not shown.

vkconfig_gui/style.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ QIcon Get(Icon icon) {
3838
static const char* ICONS[] = {
3939
"clear.png", // ICON_CLEAR
4040
"drag.png", // ICON_DRAG
41+
"next.png", // ICON_NEXT
42+
"exit.png", // ICON_EXIT
4143
"file_append.png", // ICON_FILE_APPEND,
4244
"file_export.png", // ICON_FILE_EXPORT,
4345
"file_remove.png", // ICON_FILE_REMOVE,

vkconfig_gui/style.h

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ bool isDarkMode();
2727
enum Icon {
2828
ICON_CLEAR = 0,
2929
ICON_DRAG,
30+
ICON_NEXT,
31+
ICON_EXIT,
3032
ICON_FILE_APPEND,
3133
ICON_FILE_EXPORT,
3234
ICON_FILE_REMOVE,

vkconfig_gui/tab_diagnostics.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,24 @@
3131
#include <QDesktopServices>
3232

3333
TabDiagnostics::TabDiagnostics(MainWindow &window, std::shared_ptr<Ui::MainWindow> ui) : Tab(TAB_DIAGNOSTIC, window, ui) {
34+
Configurator &configurator = Configurator::Get();
35+
36+
this->ui->diagnostic_search_edit->setText(configurator.diagnostic_search_text.c_str());
37+
this->ui->diagnostic_search_edit->setVisible(configurator.GetShowDiagnosticSearch());
38+
39+
this->ui->diagnostic_search_next->setIcon(::Get(::ICON_NEXT));
40+
this->ui->diagnostic_search_next->setVisible(configurator.GetShowDiagnosticSearch());
41+
42+
this->ui->diagnostic_search_exit->setIcon(::Get(::ICON_EXIT));
43+
this->ui->diagnostic_search_exit->setVisible(configurator.GetShowDiagnosticSearch());
44+
3445
this->ui->diagnostic_status_text->installEventFilter(&window);
3546
this->ui->diagnostic_status_text->document()->setMaximumBlockCount(65536);
3647
this->ui->diagnostic_status_text->setContextMenuPolicy(Qt::CustomContextMenu);
48+
49+
this->connect(this->ui->diagnostic_search_edit, SIGNAL(textEdited(QString)), this,
50+
SLOT(on_diagnostic_search_textEdited(QString)));
51+
this->connect(this->ui->diagnostic_search_next, SIGNAL(clicked()), this, SLOT(on_diagnostic_search_next_pressed()));
3752
this->connect(this->ui->diagnostic_status_text, SIGNAL(customContextMenuRequested(QPoint)), this,
3853
SLOT(on_customContextMenuRequested(const QPoint &)));
3954

@@ -82,6 +97,13 @@ void TabDiagnostics::on_customContextMenuRequested(const QPoint &pos) {
8297
action_save->setEnabled(!this->status.empty());
8398
menu->addAction(action_save);
8499

100+
menu->addSeparator();
101+
102+
QAction *action_search = new QAction("Search...", nullptr);
103+
action_search->setShortcut(QKeySequence("Ctrl+f"));
104+
action_search->setEnabled(!configurator.GetShowDiagnosticSearch());
105+
menu->addAction(action_search);
106+
85107
QAction *action = menu->exec(this->ui->diagnostic_status_text->mapToGlobal(pos));
86108

87109
if (action == action_refresh) {
@@ -96,6 +118,9 @@ void TabDiagnostics::on_customContextMenuRequested(const QPoint &pos) {
96118
this->status.clear();
97119
this->ui->diagnostic_status_text->clear();
98120
}
121+
} else if (action == action_search) {
122+
configurator.SetShowDiagnosticSearch(true);
123+
this->ui->diagnostic_search_edit->setFocus();
99124
} else if (action == action_save) {
100125
const QString selected_path =
101126
QFileDialog::getSaveFileName(this->ui->diagnostic_group_box_refresh, "Select Log file...",

0 commit comments

Comments
 (0)