summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCJBok <cjbok@ziggo.nl>2020-01-28 23:59:30 +0100
committerCJBok <cjbok@ziggo.nl>2020-01-28 23:59:30 +0100
commit4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952 (patch)
tree1fe70c7485464f8e31af3a04a624af035c671fb7 /src
parentMerge pull request #3359 from ReinUsesLisp/assert-point-size (diff)
downloadyuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.tar
yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.tar.gz
yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.tar.bz2
yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.tar.lz
yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.tar.xz
yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.tar.zst
yuzu-4bc4fdf5ff69e8a8eeb7e62635c50ea4c84eb952.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/main.cpp98
-rw-r--r--src/yuzu/main.h4
2 files changed, 95 insertions, 7 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index b5dd3e0d6..135adde06 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -454,11 +454,10 @@ void GMainWindow::InitializeWidgets() {
// Create status bar
message_label = new QLabel();
// Configured separately for left alignment
- message_label->setVisible(false);
message_label->setFrameStyle(QFrame::NoFrame);
message_label->setContentsMargins(4, 0, 4, 0);
message_label->setAlignment(Qt::AlignLeft);
- statusBar()->addPermanentWidget(message_label, 1);
+ statusBar()->addPermanentWidget(message_label, 01);
emu_speed_label = new QLabel();
emu_speed_label->setToolTip(
@@ -476,8 +475,73 @@ void GMainWindow::InitializeWidgets() {
label->setVisible(false);
label->setFrameStyle(QFrame::NoFrame);
label->setContentsMargins(4, 0, 4, 0);
- statusBar()->addPermanentWidget(label, 0);
+ statusBar()->addPermanentWidget(label);
}
+
+ // Setup Dock button
+ dock_status_button = new QPushButton();
+ dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
+ dock_status_button->setFocusPolicy(Qt::NoFocus);
+ connect(dock_status_button, &QPushButton::clicked, [&] {
+ Settings::values.use_docked_mode = !Settings::values.use_docked_mode;
+ dock_status_button->setChecked(Settings::values.use_docked_mode);
+ OnDockedModeChanged(!Settings::values.use_docked_mode, Settings::values.use_docked_mode);
+ });
+ dock_status_button->setText(tr("DOCK"));
+ dock_status_button->setCheckable(true);
+ dock_status_button->setChecked(Settings::values.use_docked_mode);
+ statusBar()->insertPermanentWidget(0, dock_status_button);
+
+ // Setup ASync button
+ async_status_button = new QPushButton();
+ async_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
+ async_status_button->setFocusPolicy(Qt::NoFocus);
+ connect(async_status_button, &QPushButton::clicked, [&] {
+ if (emulation_running) {
+ return;
+ }
+ Settings::values.use_asynchronous_gpu_emulation =
+ !Settings::values.use_asynchronous_gpu_emulation;
+ async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation);
+ Settings::Apply();
+ });
+ async_status_button->setText(tr("ASYNC"));
+ async_status_button->setCheckable(true);
+ async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation);
+ statusBar()->insertPermanentWidget(0, async_status_button);
+
+ // Setup Renderer API button
+ renderer_status_button = new QPushButton();
+ renderer_status_button->setObjectName(QStringLiteral("RendererStatusBarButton"));
+ renderer_status_button->setCheckable(true);
+ renderer_status_button->setFocusPolicy(Qt::NoFocus);
+ connect(renderer_status_button, &QPushButton::toggled, [=](bool checked) {
+ renderer_status_button->setText(checked ? tr("VULKAN") : tr("OPENGL"));
+ });
+ renderer_status_button->toggle();
+
+#ifndef HAS_VULKAN
+ renderer_status_button->setChecked(false);
+ renderer_status_button->setCheckable(false);
+ renderer_status_button->setDisabled(true);
+#else
+ renderer_status_button->setChecked(Settings::values.renderer_backend ==
+ Settings::RendererBackend::Vulkan);
+ connect(renderer_status_button, &QPushButton::clicked, [=] {
+ if (emulation_running) {
+ return;
+ }
+ if (renderer_status_button->isChecked()) {
+ Settings::values.renderer_backend = Settings::RendererBackend::Vulkan;
+ } else {
+ Settings::values.renderer_backend = Settings::RendererBackend::OpenGL;
+ }
+
+ Settings::Apply();
+ });
+#endif // HAS_VULKAN
+ statusBar()->insertPermanentWidget(0, renderer_status_button);
+
statusBar()->setVisible(true);
setStyleSheet(QStringLiteral("QStatusBar::item{border: none;}"));
}
@@ -640,6 +704,7 @@ void GMainWindow::InitializeHotkeys() {
Settings::values.use_docked_mode = !Settings::values.use_docked_mode;
OnDockedModeChanged(!Settings::values.use_docked_mode,
Settings::values.use_docked_mode);
+ dock_status_button->setChecked(Settings::values.use_docked_mode);
});
}
@@ -1000,6 +1065,8 @@ void GMainWindow::BootGame(const QString& filename) {
game_list_placeholder->hide();
}
status_bar_update_timer.start(2000);
+ async_status_button->setDisabled(true);
+ renderer_status_button->setDisabled(true);
const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
@@ -1065,10 +1132,13 @@ void GMainWindow::ShutdownGame() {
// Disable status bar updates
status_bar_update_timer.stop();
- message_label->setVisible(false);
emu_speed_label->setVisible(false);
game_fps_label->setVisible(false);
emu_frametime_label->setVisible(false);
+ async_status_button->setEnabled(true);
+#ifdef HAS_VULKAN
+ renderer_status_button->setEnabled(true);
+#endif
emulation_running = false;
@@ -1836,6 +1906,13 @@ void GMainWindow::OnConfigure() {
}
config->Save();
+
+ dock_status_button->setChecked(Settings::values.use_docked_mode);
+ async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation);
+#ifdef HAS_VULKAN
+ renderer_status_button->setChecked(
+ Settings::values.renderer_backend == Settings::RendererBackend::Vulkan ? true : false);
+#endif
}
void GMainWindow::OnLoadAmiibo() {
@@ -2028,7 +2105,6 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
if (emu_thread) {
emu_thread->SetRunning(true);
message_label->setText(status_message);
- message_label->setVisible(true);
}
}
}
@@ -2290,8 +2366,16 @@ void GMainWindow::UpdateUITheme() {
QStringList theme_paths(default_theme_paths);
if (is_default_theme || current_theme.isEmpty()) {
- qApp->setStyleSheet({});
- setStyleSheet({});
+ const QString theme_uri(QStringLiteral(":default/style.qss"));
+ QFile f(theme_uri);
+ if (f.open(QFile::ReadOnly | QFile::Text)) {
+ QTextStream ts(&f);
+ qApp->setStyleSheet(ts.readAll());
+ setStyleSheet(ts.readAll());
+ } else {
+ qApp->setStyleSheet({});
+ setStyleSheet({});
+ }
theme_paths.append(default_icons);
QIcon::setThemeName(default_icons);
} else {
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index a56f9a981..537c7d5ed 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -27,6 +27,7 @@ class LoadingScreen;
class MicroProfileDialog;
class ProfilerWidget;
class QLabel;
+class QPushButton;
class WaitTreeWidget;
enum class GameListOpenTarget;
class GameListPlaceholder;
@@ -229,6 +230,9 @@ private:
QLabel* emu_speed_label = nullptr;
QLabel* game_fps_label = nullptr;
QLabel* emu_frametime_label = nullptr;
+ QPushButton* async_status_button = nullptr;
+ QPushButton* renderer_status_button = nullptr;
+ QPushButton* dock_status_button = nullptr;
QTimer status_bar_update_timer;
std::unique_ptr<Config> config;