citra_qt: Add API status indicator
This commit is contained in:
@@ -60,6 +60,11 @@
|
|||||||
<string>OpenGL</string>
|
<string>OpenGL</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Vulkan</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@@ -357,6 +357,22 @@ void GMainWindow::InitializeWidgets() {
|
|||||||
statusBar()->addPermanentWidget(label);
|
statusBar()->addPermanentWidget(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup Graphics API button
|
||||||
|
graphics_api_button = new QPushButton();
|
||||||
|
graphics_api_button->setObjectName(QStringLiteral("GraphicsAPIStatusBarButton"));
|
||||||
|
graphics_api_button->setFocusPolicy(Qt::NoFocus);
|
||||||
|
UpdateAPIIndicator();
|
||||||
|
|
||||||
|
connect(graphics_api_button, &QPushButton::clicked, this, [this] {
|
||||||
|
if (emulation_running) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateAPIIndicator(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
statusBar()->insertPermanentWidget(0, graphics_api_button);
|
||||||
|
|
||||||
statusBar()->addPermanentWidget(multiplayer_state->GetStatusText());
|
statusBar()->addPermanentWidget(multiplayer_state->GetStatusText());
|
||||||
statusBar()->addPermanentWidget(multiplayer_state->GetStatusIcon());
|
statusBar()->addPermanentWidget(multiplayer_state->GetStatusIcon());
|
||||||
|
|
||||||
@@ -1988,6 +2004,7 @@ void GMainWindow::OnConfigure() {
|
|||||||
}
|
}
|
||||||
UpdateSecondaryWindowVisibility();
|
UpdateSecondaryWindowVisibility();
|
||||||
UpdateBootHomeMenuState();
|
UpdateBootHomeMenuState();
|
||||||
|
UpdateAPIIndicator();
|
||||||
} else {
|
} else {
|
||||||
Settings::values.input_profiles = old_input_profiles;
|
Settings::values.input_profiles = old_input_profiles;
|
||||||
Settings::values.touch_from_button_maps = old_touch_from_button_maps;
|
Settings::values.touch_from_button_maps = old_touch_from_button_maps;
|
||||||
@@ -2314,6 +2331,26 @@ void GMainWindow::ShowMouseCursor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::UpdateAPIIndicator(bool update) {
|
||||||
|
static std::array graphics_apis = {QStringLiteral("SOFTWARE"), QStringLiteral("OPENGL"),
|
||||||
|
QStringLiteral("VULKAN")};
|
||||||
|
|
||||||
|
static std::array graphics_api_colors = {QStringLiteral("#3ae400"), QStringLiteral("#00ccdd"),
|
||||||
|
QStringLiteral("#91242a")};
|
||||||
|
|
||||||
|
u32 api_index = static_cast<u32>(Settings::values.graphics_api.GetValue());
|
||||||
|
if (update) {
|
||||||
|
api_index = (api_index + 1) % graphics_apis.size();
|
||||||
|
Settings::values.graphics_api = static_cast<Settings::GraphicsAPI>(api_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString style_sheet = QStringLiteral("QPushButton { font-weight: bold; color: %0; }")
|
||||||
|
.arg(graphics_api_colors[api_index]);
|
||||||
|
|
||||||
|
graphics_api_button->setText(graphics_apis[api_index]);
|
||||||
|
graphics_api_button->setStyleSheet(style_sheet);
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMouseActivity() {
|
void GMainWindow::OnMouseActivity() {
|
||||||
ShowMouseCursor();
|
ShowMouseCursor();
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include "citra_qt/compatibility_list.h"
|
#include "citra_qt/compatibility_list.h"
|
||||||
@@ -254,6 +255,7 @@ private:
|
|||||||
void HideMouseCursor();
|
void HideMouseCursor();
|
||||||
void ShowMouseCursor();
|
void ShowMouseCursor();
|
||||||
void OpenPerGameConfiguration(u64 title_id, const QString& file_name);
|
void OpenPerGameConfiguration(u64 title_id, const QString& file_name);
|
||||||
|
void UpdateAPIIndicator(bool update = false);
|
||||||
|
|
||||||
std::unique_ptr<Ui::MainWindow> ui;
|
std::unique_ptr<Ui::MainWindow> ui;
|
||||||
|
|
||||||
@@ -269,6 +271,7 @@ private:
|
|||||||
QLabel* emu_speed_label = nullptr;
|
QLabel* emu_speed_label = nullptr;
|
||||||
QLabel* game_fps_label = nullptr;
|
QLabel* game_fps_label = nullptr;
|
||||||
QLabel* emu_frametime_label = nullptr;
|
QLabel* emu_frametime_label = nullptr;
|
||||||
|
QPushButton* graphics_api_button = nullptr;
|
||||||
QTimer status_bar_update_timer;
|
QTimer status_bar_update_timer;
|
||||||
bool message_label_used_for_movie = false;
|
bool message_label_used_for_movie = false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user