|
|
|
@ -77,6 +77,7 @@
|
|
|
|
|
#include <QSysInfo>
|
|
|
|
|
#include <QUrl>
|
|
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
|
#include <QDesktopWidget>
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SDL2
|
|
|
|
|
#include <SDL.h> // For SDL ScreenSaver functions
|
|
|
|
@ -191,6 +192,7 @@ enum class CalloutFlag : uint32_t {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const int GMainWindow::max_recent_files_item;
|
|
|
|
|
const float GMainWindow::window_opacity = 0.97;
|
|
|
|
|
|
|
|
|
|
static void RemoveCachedContents() {
|
|
|
|
|
const auto cache_dir = Common::FS::GetSuyuPath(Common::FS::SuyuPath::CacheDir);
|
|
|
|
@ -324,6 +326,7 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
|
|
|
|
|
|
|
|
|
|
InitializeWidgets();
|
|
|
|
|
InitializeDebugWidgets();
|
|
|
|
|
HideUnwantedWidgets();
|
|
|
|
|
InitializeRecentFileMenuActions();
|
|
|
|
|
InitializeHotkeys();
|
|
|
|
|
|
|
|
|
@ -398,12 +401,12 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
|
|
|
|
|
game_list->PopulateAsync(UISettings::values.game_dirs);
|
|
|
|
|
|
|
|
|
|
// make sure menubar has the arrow cursor instead of inheriting from this
|
|
|
|
|
ui->menubar->setCursor(QCursor());
|
|
|
|
|
//ui->menubar->setCursor(QCursor());
|
|
|
|
|
statusBar()->setCursor(QCursor());
|
|
|
|
|
|
|
|
|
|
mouse_hide_timer.setInterval(default_mouse_hide_timeout);
|
|
|
|
|
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
|
|
|
|
|
connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor);
|
|
|
|
|
//connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor);
|
|
|
|
|
|
|
|
|
|
update_input_timer.setInterval(default_input_update_timeout);
|
|
|
|
|
connect(&update_input_timer, &QTimer::timeout, this, &GMainWindow::UpdateInputDrivers);
|
|
|
|
@ -973,20 +976,21 @@ void GMainWindow::WebBrowserRequestExit() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::InitializeWidgets() {
|
|
|
|
|
#ifdef SUYU_ENABLE_COMPATIBILITY_REPORTING
|
|
|
|
|
ui->action_Report_Compatibility->setVisible(true);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//#ifdef SUYU_ENABLE_COMPATIBILITY_REPORTING
|
|
|
|
|
// ui->action_Report_Compatibility->setVisible(true);
|
|
|
|
|
//#endif
|
|
|
|
|
render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, *system);
|
|
|
|
|
render_window->hide();
|
|
|
|
|
//render_window->hide();
|
|
|
|
|
|
|
|
|
|
game_list = new GameList(vfs, provider.get(), *play_time_manager, *system, this);
|
|
|
|
|
ui->horizontalLayout->addWidget(game_list);
|
|
|
|
|
//ui->horizontalLayout->addWidget(game_list);
|
|
|
|
|
|
|
|
|
|
game_list_placeholder = new GameListPlaceholder(this);
|
|
|
|
|
ui->horizontalLayout->addWidget(game_list_placeholder);
|
|
|
|
|
game_list_placeholder->setVisible(false);
|
|
|
|
|
//ui->horizontalLayout->addWidget(game_list_placeholder);
|
|
|
|
|
//game_list_placeholder->setVisible(false);
|
|
|
|
|
|
|
|
|
|
loading_screen = new LoadingScreen(this);
|
|
|
|
|
/*loading_screen = new LoadingScreen(this);
|
|
|
|
|
loading_screen->hide();
|
|
|
|
|
ui->horizontalLayout->addWidget(loading_screen);
|
|
|
|
|
connect(loading_screen, &LoadingScreen::Hidden, [&] {
|
|
|
|
@ -995,37 +999,40 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
render_window->show();
|
|
|
|
|
render_window->setFocus();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
|
multiplayer_state = new MultiplayerState(this, game_list->GetModel(), ui->action_Leave_Room,
|
|
|
|
|
ui->action_Show_Room, *system);
|
|
|
|
|
multiplayer_state->setVisible(false);
|
|
|
|
|
//multiplayer_state = new MultiplayerState(this, game_list->GetModel(), ui->action_Leave_Room,
|
|
|
|
|
//ui->action_Show_Room, *system);
|
|
|
|
|
|
|
|
|
|
// Create status bar
|
|
|
|
|
message_label = new QLabel();
|
|
|
|
|
// Configured separately for left alignment
|
|
|
|
|
message_label->setFrameStyle(QFrame::NoFrame);
|
|
|
|
|
message_label->setContentsMargins(4, 0, 4, 0);
|
|
|
|
|
message_label->setAlignment(Qt::AlignLeft);
|
|
|
|
|
statusBar()->addPermanentWidget(message_label, 1);
|
|
|
|
|
//volume_slider->setVisible(false);
|
|
|
|
|
//volume_button->setVisible(false);
|
|
|
|
|
//multiplayer_state->setVisible(false);
|
|
|
|
|
|
|
|
|
|
shader_building_label = new QLabel();
|
|
|
|
|
shader_building_label->setToolTip(tr("The amount of shaders currently being built"));
|
|
|
|
|
res_scale_label = new QLabel();
|
|
|
|
|
res_scale_label->setToolTip(tr("The current selected resolution scaling multiplier."));
|
|
|
|
|
emu_speed_label = new QLabel();
|
|
|
|
|
emu_speed_label->setToolTip(
|
|
|
|
|
tr("Current emulation speed. Values higher or lower than 100% "
|
|
|
|
|
"indicate emulation is running faster or slower than a Switch."));
|
|
|
|
|
game_fps_label = new QLabel();
|
|
|
|
|
game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. "
|
|
|
|
|
"This will vary from game to game and scene to scene."));
|
|
|
|
|
emu_frametime_label = new QLabel();
|
|
|
|
|
emu_frametime_label->setToolTip(
|
|
|
|
|
tr("Time taken to emulate a Switch frame, not counting framelimiting or v-sync. For "
|
|
|
|
|
"full-speed emulation this should be at most 16.67 ms."));
|
|
|
|
|
//// Create status bar
|
|
|
|
|
//message_label = new QLabel();
|
|
|
|
|
//// Configured separately for left alignment
|
|
|
|
|
//message_label->setFrameStyle(QFrame::NoFrame);
|
|
|
|
|
//message_label->setContentsMargins(4, 0, 4, 0);
|
|
|
|
|
//message_label->setAlignment(Qt::AlignLeft);
|
|
|
|
|
//statusBar()->addPermanentWidget(message_label, 1);
|
|
|
|
|
|
|
|
|
|
for (auto& label : {shader_building_label, res_scale_label, emu_speed_label, game_fps_label,
|
|
|
|
|
//shader_building_label = new QLabel();
|
|
|
|
|
//shader_building_label->setToolTip(tr("The amount of shaders currently being built"));
|
|
|
|
|
//res_scale_label = new QLabel();
|
|
|
|
|
//res_scale_label->setToolTip(tr("The current selected resolution scaling multiplier."));
|
|
|
|
|
//emu_speed_label = new QLabel();
|
|
|
|
|
//emu_speed_label->setToolTip(
|
|
|
|
|
// tr("Current emulation speed. Values higher or lower than 100% "
|
|
|
|
|
// "indicate emulation is running faster or slower than a Switch."));
|
|
|
|
|
//game_fps_label = new QLabel();
|
|
|
|
|
//game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. "
|
|
|
|
|
// "This will vary from game to game and scene to scene."));
|
|
|
|
|
//emu_frametime_label = new QLabel();
|
|
|
|
|
//emu_frametime_label->setToolTip(
|
|
|
|
|
// tr("Time taken to emulate a Switch frame, not counting framelimiting or v-sync. For "
|
|
|
|
|
// "full-speed emulation this should be at most 16.67 ms."));
|
|
|
|
|
|
|
|
|
|
/*for (auto& label : {shader_building_label, res_scale_label, emu_speed_label, game_fps_label,
|
|
|
|
|
emu_frametime_label}) {
|
|
|
|
|
label->setVisible(false);
|
|
|
|
|
label->setFrameStyle(QFrame::NoFrame);
|
|
|
|
@ -1040,9 +1047,9 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
statusBar()->addPermanentWidget(firmware_label);
|
|
|
|
|
|
|
|
|
|
statusBar()->addPermanentWidget(multiplayer_state->GetStatusText(), 0);
|
|
|
|
|
statusBar()->addPermanentWidget(multiplayer_state->GetStatusIcon(), 0);
|
|
|
|
|
statusBar()->addPermanentWidget(multiplayer_state->GetStatusIcon(), 0);*/
|
|
|
|
|
|
|
|
|
|
tas_label = new QLabel();
|
|
|
|
|
/*tas_label = new QLabel();
|
|
|
|
|
tas_label->setObjectName(QStringLiteral("TASlabel"));
|
|
|
|
|
tas_label->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
statusBar()->insertPermanentWidget(0, tas_label);
|
|
|
|
@ -1077,8 +1084,8 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
bottomLeft.setY(bottomLeft.y() - volume_popup->geometry().height());
|
|
|
|
|
volume_popup->setGeometry(QRect(bottomLeft, QSize(rect.width(), rect.height())));
|
|
|
|
|
});
|
|
|
|
|
volume_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(volume_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
volume_button->setContextMenuPolicy(Qt::CustomContextMenu);*/
|
|
|
|
|
/*connect(volume_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
[this](const QPoint& menu_location) {
|
|
|
|
|
QMenu context_menu;
|
|
|
|
|
context_menu.addAction(
|
|
|
|
@ -1094,45 +1101,45 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
|
|
|
|
|
context_menu.exec(volume_button->mapToGlobal(menu_location));
|
|
|
|
|
volume_button->repaint();
|
|
|
|
|
});
|
|
|
|
|
connect(volume_button, &VolumeButton::VolumeChanged, this, &GMainWindow::UpdateVolumeUI);
|
|
|
|
|
});*/
|
|
|
|
|
/*connect(volume_button, &VolumeButton::VolumeChanged, this, &GMainWindow::UpdateVolumeUI);
|
|
|
|
|
|
|
|
|
|
statusBar()->insertPermanentWidget(0, volume_button);
|
|
|
|
|
statusBar()->insertPermanentWidget(0, volume_button);*/
|
|
|
|
|
|
|
|
|
|
// setup AA button
|
|
|
|
|
aa_status_button = new QPushButton();
|
|
|
|
|
aa_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
|
|
|
|
|
aa_status_button->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
connect(aa_status_button, &QPushButton::clicked, [&] {
|
|
|
|
|
auto aa_mode = Settings::values.anti_aliasing.GetValue();
|
|
|
|
|
aa_mode = static_cast<Settings::AntiAliasing>(static_cast<u32>(aa_mode) + 1);
|
|
|
|
|
if (aa_mode == Settings::AntiAliasing::MaxEnum) {
|
|
|
|
|
aa_mode = Settings::AntiAliasing::None;
|
|
|
|
|
}
|
|
|
|
|
Settings::values.anti_aliasing.SetValue(aa_mode);
|
|
|
|
|
aa_status_button->setChecked(true);
|
|
|
|
|
UpdateAAText();
|
|
|
|
|
});
|
|
|
|
|
UpdateAAText();
|
|
|
|
|
aa_status_button->setCheckable(true);
|
|
|
|
|
aa_status_button->setChecked(true);
|
|
|
|
|
aa_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(aa_status_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
[this](const QPoint& menu_location) {
|
|
|
|
|
QMenu context_menu;
|
|
|
|
|
for (auto const& aa_text_pair : ConfigurationShared::anti_aliasing_texts_map) {
|
|
|
|
|
context_menu.addAction(aa_text_pair.second, [this, aa_text_pair] {
|
|
|
|
|
Settings::values.anti_aliasing.SetValue(aa_text_pair.first);
|
|
|
|
|
UpdateAAText();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
context_menu.exec(aa_status_button->mapToGlobal(menu_location));
|
|
|
|
|
aa_status_button->repaint();
|
|
|
|
|
});
|
|
|
|
|
statusBar()->insertPermanentWidget(0, aa_status_button);
|
|
|
|
|
//// setup AA button
|
|
|
|
|
//aa_status_button = new QPushButton();
|
|
|
|
|
//aa_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
|
|
|
|
|
//aa_status_button->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
//connect(aa_status_button, &QPushButton::clicked, [&] {
|
|
|
|
|
// auto aa_mode = Settings::values.anti_aliasing.GetValue();
|
|
|
|
|
// aa_mode = static_cast<Settings::AntiAliasing>(static_cast<u32>(aa_mode) + 1);
|
|
|
|
|
// if (aa_mode == Settings::AntiAliasing::MaxEnum) {
|
|
|
|
|
// aa_mode = Settings::AntiAliasing::None;
|
|
|
|
|
// }
|
|
|
|
|
// Settings::values.anti_aliasing.SetValue(aa_mode);
|
|
|
|
|
// aa_status_button->setChecked(true);
|
|
|
|
|
// UpdateAAText();
|
|
|
|
|
//});
|
|
|
|
|
//UpdateAAText();
|
|
|
|
|
//aa_status_button->setCheckable(true);
|
|
|
|
|
//aa_status_button->setChecked(true);
|
|
|
|
|
//aa_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
//connect(aa_status_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
// [this](const QPoint& menu_location) {
|
|
|
|
|
// //QMenu context_menu;
|
|
|
|
|
// for (auto const& aa_text_pair : ConfigurationShared::anti_aliasing_texts_map) {
|
|
|
|
|
// context_menu.addAction(aa_text_pair.second, [this, aa_text_pair] {
|
|
|
|
|
// Settings::values.anti_aliasing.SetValue(aa_text_pair.first);
|
|
|
|
|
// UpdateAAText();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// //context_menu.exec(aa_status_button->mapToGlobal(menu_location));
|
|
|
|
|
// aa_status_button->repaint();
|
|
|
|
|
// });
|
|
|
|
|
//statusBar()->insertPermanentWidget(0, aa_status_button);
|
|
|
|
|
|
|
|
|
|
// Setup Filter button
|
|
|
|
|
filter_status_button = new QPushButton();
|
|
|
|
|
/*filter_status_button = new QPushButton();
|
|
|
|
|
filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
|
|
|
|
|
filter_status_button->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
connect(filter_status_button, &QPushButton::clicked, this,
|
|
|
|
@ -1140,30 +1147,30 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
UpdateFilterText();
|
|
|
|
|
filter_status_button->setCheckable(true);
|
|
|
|
|
filter_status_button->setChecked(true);
|
|
|
|
|
filter_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(filter_status_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
[this](const QPoint& menu_location) {
|
|
|
|
|
QMenu context_menu;
|
|
|
|
|
for (auto const& filter_text_pair : ConfigurationShared::scaling_filter_texts_map) {
|
|
|
|
|
context_menu.addAction(filter_text_pair.second, [this, filter_text_pair] {
|
|
|
|
|
Settings::values.scaling_filter.SetValue(filter_text_pair.first);
|
|
|
|
|
UpdateFilterText();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
context_menu.exec(filter_status_button->mapToGlobal(menu_location));
|
|
|
|
|
filter_status_button->repaint();
|
|
|
|
|
});
|
|
|
|
|
statusBar()->insertPermanentWidget(0, filter_status_button);
|
|
|
|
|
filter_status_button->setContextMenuPolicy(Qt::CustomContextMenu);*/
|
|
|
|
|
//connect(filter_status_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
// [this](const QPoint& menu_location) {
|
|
|
|
|
// //QMenu context_menu;
|
|
|
|
|
// for (auto const& filter_text_pair : ConfigurationShared::scaling_filter_texts_map) {
|
|
|
|
|
// context_menu.addAction(filter_text_pair.second, [this, filter_text_pair] {
|
|
|
|
|
// Settings::values.scaling_filter.SetValue(filter_text_pair.first);
|
|
|
|
|
// UpdateFilterText();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// //context_menu.exec(filter_status_button->mapToGlobal(menu_location));
|
|
|
|
|
// filter_status_button->repaint();
|
|
|
|
|
// });
|
|
|
|
|
//statusBar()->insertPermanentWidget(0, filter_status_button);
|
|
|
|
|
|
|
|
|
|
// Setup Dock button
|
|
|
|
|
dock_status_button = new QPushButton();
|
|
|
|
|
dock_status_button->setObjectName(QStringLiteral("DockingStatusBarButton"));
|
|
|
|
|
dock_status_button->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
connect(dock_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleDockedMode);
|
|
|
|
|
dock_status_button->setCheckable(true);
|
|
|
|
|
UpdateDockedButton();
|
|
|
|
|
dock_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(dock_status_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
//// Setup Dock button
|
|
|
|
|
//dock_status_button = new QPushButton();
|
|
|
|
|
//dock_status_button->setObjectName(QStringLiteral("DockingStatusBarButton"));
|
|
|
|
|
//dock_status_button->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
//connect(dock_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleDockedMode);
|
|
|
|
|
//dock_status_button->setCheckable(true);
|
|
|
|
|
//UpdateDockedButton();
|
|
|
|
|
//dock_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
/*connect(dock_status_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
[this](const QPoint& menu_location) {
|
|
|
|
|
QMenu context_menu;
|
|
|
|
|
|
|
|
|
@ -1176,18 +1183,18 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
}
|
|
|
|
|
context_menu.exec(dock_status_button->mapToGlobal(menu_location));
|
|
|
|
|
dock_status_button->repaint();
|
|
|
|
|
});
|
|
|
|
|
statusBar()->insertPermanentWidget(0, dock_status_button);
|
|
|
|
|
});*/
|
|
|
|
|
//statusBar()->insertPermanentWidget(0, dock_status_button);
|
|
|
|
|
|
|
|
|
|
// Setup GPU Accuracy button
|
|
|
|
|
gpu_accuracy_button = new QPushButton();
|
|
|
|
|
gpu_accuracy_button->setObjectName(QStringLiteral("GPUStatusBarButton"));
|
|
|
|
|
gpu_accuracy_button->setCheckable(true);
|
|
|
|
|
gpu_accuracy_button->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
connect(gpu_accuracy_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGpuAccuracy);
|
|
|
|
|
UpdateGPUAccuracyButton();
|
|
|
|
|
gpu_accuracy_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(gpu_accuracy_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
//// Setup GPU Accuracy button
|
|
|
|
|
//gpu_accuracy_button = new QPushButton();
|
|
|
|
|
//gpu_accuracy_button->setObjectName(QStringLiteral("GPUStatusBarButton"));
|
|
|
|
|
//gpu_accuracy_button->setCheckable(true);
|
|
|
|
|
//gpu_accuracy_button->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
//connect(gpu_accuracy_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGpuAccuracy);
|
|
|
|
|
//UpdateGPUAccuracyButton();
|
|
|
|
|
//gpu_accuracy_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
/*connect(gpu_accuracy_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
[this](const QPoint& menu_location) {
|
|
|
|
|
QMenu context_menu;
|
|
|
|
|
|
|
|
|
@ -1202,21 +1209,21 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
}
|
|
|
|
|
context_menu.exec(gpu_accuracy_button->mapToGlobal(menu_location));
|
|
|
|
|
gpu_accuracy_button->repaint();
|
|
|
|
|
});
|
|
|
|
|
statusBar()->insertPermanentWidget(0, gpu_accuracy_button);
|
|
|
|
|
});*/
|
|
|
|
|
//statusBar()->insertPermanentWidget(0, gpu_accuracy_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::clicked, this, &GMainWindow::OnToggleGraphicsAPI);
|
|
|
|
|
UpdateAPIText();
|
|
|
|
|
renderer_status_button->setCheckable(true);
|
|
|
|
|
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
|
|
|
|
|
Settings::RendererBackend::Vulkan);
|
|
|
|
|
renderer_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(renderer_status_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
//// 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::clicked, this, &GMainWindow::OnToggleGraphicsAPI);
|
|
|
|
|
//UpdateAPIText();
|
|
|
|
|
//renderer_status_button->setCheckable(true);
|
|
|
|
|
//renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
|
|
|
|
|
// Settings::RendererBackend::Vulkan);
|
|
|
|
|
//renderer_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
/*connect(renderer_status_button, &QPushButton::customContextMenuRequested,
|
|
|
|
|
[this](const QPoint& menu_location) {
|
|
|
|
|
QMenu context_menu;
|
|
|
|
|
|
|
|
|
@ -1233,30 +1240,30 @@ void GMainWindow::InitializeWidgets() {
|
|
|
|
|
}
|
|
|
|
|
context_menu.exec(renderer_status_button->mapToGlobal(menu_location));
|
|
|
|
|
renderer_status_button->repaint();
|
|
|
|
|
});
|
|
|
|
|
statusBar()->insertPermanentWidget(0, renderer_status_button);
|
|
|
|
|
});*/
|
|
|
|
|
/*statusBar()->insertPermanentWidget(0, renderer_status_button);
|
|
|
|
|
|
|
|
|
|
statusBar()->setVisible(true);
|
|
|
|
|
setStyleSheet(QStringLiteral("QStatusBar::item{border: none;}"));
|
|
|
|
|
setStyleSheet(QStringLiteral("QStatusBar::item{border: none;}"));*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::InitializeDebugWidgets() {
|
|
|
|
|
QMenu* debug_menu = ui->menu_View_Debugging;
|
|
|
|
|
//QMenu* debug_menu = ui->menu_View_Debugging;
|
|
|
|
|
|
|
|
|
|
#if MICROPROFILE_ENABLED
|
|
|
|
|
microProfileDialog = new MicroProfileDialog(this);
|
|
|
|
|
microProfileDialog->hide();
|
|
|
|
|
debug_menu->addAction(microProfileDialog->toggleViewAction());
|
|
|
|
|
//debug_menu->addAction(microProfileDialog->toggleViewAction());
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
waitTreeWidget = new WaitTreeWidget(*system, this);
|
|
|
|
|
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
|
|
|
|
|
waitTreeWidget->hide();
|
|
|
|
|
debug_menu->addAction(waitTreeWidget->toggleViewAction());
|
|
|
|
|
//debug_menu->addAction(waitTreeWidget->toggleViewAction());
|
|
|
|
|
|
|
|
|
|
controller_dialog = new ControllerDialog(system->HIDCore(), input_subsystem, this);
|
|
|
|
|
controller_dialog->hide();
|
|
|
|
|
debug_menu->addAction(controller_dialog->toggleViewAction());
|
|
|
|
|
//debug_menu->addAction(controller_dialog->toggleViewAction());
|
|
|
|
|
|
|
|
|
|
connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
|
|
|
|
|
&WaitTreeWidget::OnEmulationStarting);
|
|
|
|
@ -1264,22 +1271,31 @@ void GMainWindow::InitializeDebugWidgets() {
|
|
|
|
|
&WaitTreeWidget::OnEmulationStopping);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Hide widgets that do not have a valid name or those that are unwanted
|
|
|
|
|
void GMainWindow::HideUnwantedWidgets() {
|
|
|
|
|
foreach (QWidget* widget, findChildren<QWidget*>()) {
|
|
|
|
|
if (widget->objectName().isEmpty()) {
|
|
|
|
|
widget->hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::InitializeRecentFileMenuActions() {
|
|
|
|
|
for (int i = 0; i < max_recent_files_item; ++i) {
|
|
|
|
|
actions_recent_files[i] = new QAction(this);
|
|
|
|
|
actions_recent_files[i]->setVisible(false);
|
|
|
|
|
connect(actions_recent_files[i], &QAction::triggered, this, &GMainWindow::OnMenuRecentFile);
|
|
|
|
|
|
|
|
|
|
ui->menu_recent_files->addAction(actions_recent_files[i]);
|
|
|
|
|
//ui->menu_recent_files->addAction(actions_recent_files[i]);
|
|
|
|
|
}
|
|
|
|
|
ui->menu_recent_files->addSeparator();
|
|
|
|
|
//ui->menu_recent_files->addSeparator();
|
|
|
|
|
QAction* action_clear_recent_files = new QAction(this);
|
|
|
|
|
action_clear_recent_files->setText(tr("&Clear Recent Files"));
|
|
|
|
|
connect(action_clear_recent_files, &QAction::triggered, this, [this] {
|
|
|
|
|
UISettings::values.recent_files.clear();
|
|
|
|
|
UpdateRecentFiles();
|
|
|
|
|
});
|
|
|
|
|
ui->menu_recent_files->addAction(action_clear_recent_files);
|
|
|
|
|
//ui->menu_recent_files->addAction(action_clear_recent_files);
|
|
|
|
|
|
|
|
|
|
UpdateRecentFiles();
|
|
|
|
|
}
|
|
|
|
@ -1510,37 +1526,37 @@ void GMainWindow::ConnectMenuEvents() {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// File
|
|
|
|
|
connect_menu(ui->action_Load_File, &GMainWindow::OnMenuLoadFile);
|
|
|
|
|
/*connect_menu(ui->action_Load_File, &GMainWindow::OnMenuLoadFile);
|
|
|
|
|
connect_menu(ui->action_Load_Folder, &GMainWindow::OnMenuLoadFolder);
|
|
|
|
|
connect_menu(ui->action_Install_File_NAND, &GMainWindow::OnMenuInstallToNAND);
|
|
|
|
|
connect_menu(ui->action_Exit, &QMainWindow::close);
|
|
|
|
|
connect_menu(ui->action_Load_Amiibo, &GMainWindow::OnLoadAmiibo);
|
|
|
|
|
connect_menu(ui->action_Load_Amiibo, &GMainWindow::OnLoadAmiibo);*/
|
|
|
|
|
|
|
|
|
|
// Emulation
|
|
|
|
|
connect_menu(ui->action_Pause, &GMainWindow::OnPauseContinueGame);
|
|
|
|
|
connect_menu(ui->action_Stop, &GMainWindow::OnStopGame);
|
|
|
|
|
connect_menu(ui->action_Report_Compatibility, &GMainWindow::OnMenuReportCompatibility);
|
|
|
|
|
connect_menu(ui->action_Open_Mods_Page, &GMainWindow::OnOpenModsPage);
|
|
|
|
|
connect_menu(ui->action_Open_Quickstart_Guide, &GMainWindow::OnOpenQuickstartGuide);
|
|
|
|
|
connect_menu(ui->action_Open_FAQ, &GMainWindow::OnOpenFAQ);
|
|
|
|
|
connect_menu(ui->action_Restart, &GMainWindow::OnRestartGame);
|
|
|
|
|
connect_menu(ui->action_Configure, &GMainWindow::OnConfigure);
|
|
|
|
|
connect_menu(ui->action_Configure_Current_Game, &GMainWindow::OnConfigurePerGame);
|
|
|
|
|
//connect_menu(ui->action_Pause, &GMainWindow::OnPauseContinueGame);
|
|
|
|
|
//connect_menu(ui->action_Stop, &GMainWindow::OnStopGame);
|
|
|
|
|
//connect_menu(ui->action_Report_Compatibility, &GMainWindow::OnMenuReportCompatibility);
|
|
|
|
|
//connect_menu(ui->action_Open_Mods_Page, &GMainWindow::OnOpenModsPage);
|
|
|
|
|
//connect_menu(ui->action_Open_Quickstart_Guide, &GMainWindow::OnOpenQuickstartGuide);
|
|
|
|
|
//connect_menu(ui->action_Open_FAQ, &GMainWindow::OnOpenFAQ);
|
|
|
|
|
//connect_menu(ui->action_Restart, &GMainWindow::OnRestartGame);
|
|
|
|
|
//connect_menu(ui->action_Configure, &GMainWindow::OnConfigure);
|
|
|
|
|
//connect_menu(ui->action_Configure_Current_Game, &GMainWindow::OnConfigurePerGame);
|
|
|
|
|
|
|
|
|
|
// View
|
|
|
|
|
connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen);
|
|
|
|
|
connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode);
|
|
|
|
|
connect_menu(ui->action_Display_Dock_Widget_Headers, &GMainWindow::OnDisplayTitleBars);
|
|
|
|
|
connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar);
|
|
|
|
|
connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar);
|
|
|
|
|
connect_menu(ui->action_Show_Folders_In_List, &GMainWindow::OnToggleFoldersInList);
|
|
|
|
|
//// View
|
|
|
|
|
//connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen);
|
|
|
|
|
//connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode);
|
|
|
|
|
//connect_menu(ui->action_Display_Dock_Widget_Headers, &GMainWindow::OnDisplayTitleBars);
|
|
|
|
|
//connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar);
|
|
|
|
|
//connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar);
|
|
|
|
|
//connect_menu(ui->action_Show_Folders_In_List, &GMainWindow::OnToggleFoldersInList);
|
|
|
|
|
|
|
|
|
|
connect_menu(ui->action_Reset_Window_Size_720, &GMainWindow::ResetWindowSize720);
|
|
|
|
|
connect_menu(ui->action_Reset_Window_Size_900, &GMainWindow::ResetWindowSize900);
|
|
|
|
|
connect_menu(ui->action_Reset_Window_Size_1080, &GMainWindow::ResetWindowSize1080);
|
|
|
|
|
ui->menu_Reset_Window_Size->addActions({ui->action_Reset_Window_Size_720,
|
|
|
|
|
//connect_menu(ui->action_Reset_Window_Size_720, &GMainWindow::ResetWindowSize720);
|
|
|
|
|
//connect_menu(ui->action_Reset_Window_Size_900, &GMainWindow::ResetWindowSize900);
|
|
|
|
|
//connect_menu(ui->action_Reset_Window_Size_1080, &GMainWindow::ResetWindowSize1080);
|
|
|
|
|
/*ui->menu_Reset_Window_Size->addActions({ui->action_Reset_Window_Size_720,
|
|
|
|
|
ui->action_Reset_Window_Size_900,
|
|
|
|
|
ui->action_Reset_Window_Size_1080});
|
|
|
|
|
ui->action_Reset_Window_Size_1080});*/
|
|
|
|
|
|
|
|
|
|
// Multiplayer
|
|
|
|
|
connect(ui->action_View_Lobby, &QAction::triggered, multiplayer_state,
|
|
|
|
@ -2239,7 +2255,7 @@ void GMainWindow::UpdateRecentFiles() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Enable the recent files menu if the list isn't empty
|
|
|
|
|
ui->menu_recent_files->setEnabled(num_recent_files != 0);
|
|
|
|
|
//ui->menu_recent_files->setEnabled(num_recent_files != 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GMainWindow::OnGameListLoadFile(QString game_path, u64 program_id) {
|
|
|
|
@ -3452,7 +3468,7 @@ void GMainWindow::ShowFullscreen() {
|
|
|
|
|
if (ui->action_Single_Window_Mode->isChecked()) {
|
|
|
|
|
UISettings::values.geometry = saveGeometry();
|
|
|
|
|
|
|
|
|
|
ui->menubar->hide();
|
|
|
|
|
//ui->menubar->hide();
|
|
|
|
|
statusBar()->hide();
|
|
|
|
|
|
|
|
|
|
show_fullscreen(this);
|
|
|
|
@ -3476,7 +3492,7 @@ void GMainWindow::HideFullscreen() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked());
|
|
|
|
|
ui->menubar->show();
|
|
|
|
|
//ui->menubar->show();
|
|
|
|
|
} else {
|
|
|
|
|
if (UsingExclusiveFullscreen()) {
|
|
|
|
|
render_window->showNormal();
|
|
|
|
@ -3523,9 +3539,10 @@ void GMainWindow::ResetWindowSize(u32 width, u32 height) {
|
|
|
|
|
if (!ui->action_Single_Window_Mode->isChecked()) {
|
|
|
|
|
render_window->resize(height / aspect_ratio, height);
|
|
|
|
|
} else {
|
|
|
|
|
const bool show_status_bar = ui->action_Show_Status_Bar->isChecked();
|
|
|
|
|
const auto status_bar_height = show_status_bar ? statusBar()->height() : 0;
|
|
|
|
|
resize(height / aspect_ratio, height + menuBar()->height() + status_bar_height);
|
|
|
|
|
//const bool show_status_bar = ui->action_Show_Status_Bar->isChecked();
|
|
|
|
|
//const auto status_bar_height = show_status_bar ? statusBar()->height() : 0;
|
|
|
|
|
//resize(height / aspect_ratio, height + menuBar()->height() + status_bar_height);
|
|
|
|
|
resize(height / aspect_ratio, height);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -4669,15 +4686,15 @@ void GMainWindow::SetFirmwareVersion() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
firmware_label->setVisible(true);
|
|
|
|
|
//firmware_label->setVisible(true);
|
|
|
|
|
|
|
|
|
|
const std::string display_version(firmware_data.display_version.data());
|
|
|
|
|
const std::string display_title(firmware_data.display_title.data());
|
|
|
|
|
|
|
|
|
|
LOG_INFO(Frontend, "Installed firmware: {}", display_title);
|
|
|
|
|
|
|
|
|
|
firmware_label->setText(QString::fromStdString(display_version));
|
|
|
|
|
firmware_label->setToolTip(QString::fromStdString(display_title));
|
|
|
|
|
//firmware_label->setText(QString::fromStdString(display_version));
|
|
|
|
|
//firmware_label->setToolTip(QString::fromStdString(display_title));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GMainWindow::ConfirmClose() {
|
|
|
|
@ -4933,6 +4950,8 @@ void GMainWindow::changeEvent(QEvent* event) {
|
|
|
|
|
QWidget::changeEvent(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Service::AM::FrontendAppletParameters GMainWindow::ApplicationAppletParameters() {
|
|
|
|
|
return Service::AM::FrontendAppletParameters{
|
|
|
|
|
.applet_id = Service::AM::AppletId::Application,
|
|
|
|
@ -5114,12 +5133,23 @@ int main(int argc, char* argv[]) {
|
|
|
|
|
// generating shaders
|
|
|
|
|
setlocale(LC_ALL, "C");
|
|
|
|
|
|
|
|
|
|
GMainWindow main_window{std::move(config), has_broken_vulkan};
|
|
|
|
|
// After settings have been loaded by GMainWindow, apply the filter
|
|
|
|
|
main_window.show();
|
|
|
|
|
const QRect screenGeometry = QApplication::primaryScreen()->availableGeometry();
|
|
|
|
|
|
|
|
|
|
QObject::connect(&app, &QGuiApplication::applicationStateChanged, &main_window,
|
|
|
|
|
&GMainWindow::OnAppFocusStateChanged);
|
|
|
|
|
GMainWindow main_window{std::move(config), has_broken_vulkan};
|
|
|
|
|
|
|
|
|
|
main_window.setWindowFlags(Qt::FramelessWindowHint);
|
|
|
|
|
main_window.setGeometry(
|
|
|
|
|
QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, main_window.size(), screenGeometry));
|
|
|
|
|
main_window.setWindowState(main_window.windowState() & ~Qt::WindowMaximized);
|
|
|
|
|
main_window.setWindowOpacity(GMainWindow::window_opacity); // 0.97
|
|
|
|
|
main_window.statusBar()->hide();
|
|
|
|
|
main_window.show(); // After settings have been loaded by GMainWindow, apply the filter
|
|
|
|
|
|
|
|
|
|
QObject::connect(&app, &QGuiApplication::applicationStateChanged,
|
|
|
|
|
&main_window, &GMainWindow::OnAppFocusStateChanged);
|
|
|
|
|
|
|
|
|
|
// Temporary: Hide the console to avoid interference with the design of the new UI
|
|
|
|
|
ShowWindow(GetConsoleWindow(), SW_HIDE);
|
|
|
|
|
|
|
|
|
|
int result = app.exec();
|
|
|
|
|
detached_tasks.WaitForAllTasks();
|
|
|
|
|