Removed all widgets from the main form and applied transparency

This commit is contained in:
TechnoHector 2024-04-04 22:08:21 -04:00
parent a3c8b29607
commit f6d7b27c57
5 changed files with 219 additions and 335 deletions

View file

@ -401,7 +401,7 @@ void GameList::SetFilterFocus() {
} }
void GameList::SetFilterVisible(bool visibility) { void GameList::SetFilterVisible(bool visibility) {
search_field->setVisible(visibility); //search_field->setVisible(visibility); // TEMP
} }
void GameList::ClearFilter() { void GameList::ClearFilter() {
@ -860,6 +860,9 @@ void GameList::SaveInterfaceLayout() {
} }
void GameList::LoadInterfaceLayout() { void GameList::LoadInterfaceLayout() {
return; // TEMP
auto* header = tree_view->header(); auto* header = tree_view->header();
if (header->restoreState(UISettings::values.gamelist_header_state)) { if (header->restoreState(UISettings::values.gamelist_header_state)) {

View file

@ -191,6 +191,7 @@ enum class CalloutFlag : uint32_t {
}; };
const int GMainWindow::max_recent_files_item; const int GMainWindow::max_recent_files_item;
const float GMainWindow::window_opacity = 0.97;
static void RemoveCachedContents() { static void RemoveCachedContents() {
const auto cache_dir = Common::FS::GetSuyuPath(Common::FS::SuyuPath::CacheDir); const auto cache_dir = Common::FS::GetSuyuPath(Common::FS::SuyuPath::CacheDir);
@ -324,6 +325,7 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
InitializeWidgets(); InitializeWidgets();
InitializeDebugWidgets(); InitializeDebugWidgets();
HideUnwantedWidgets();
InitializeRecentFileMenuActions(); InitializeRecentFileMenuActions();
InitializeHotkeys(); InitializeHotkeys();
@ -398,12 +400,12 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
game_list->PopulateAsync(UISettings::values.game_dirs); game_list->PopulateAsync(UISettings::values.game_dirs);
// make sure menubar has the arrow cursor instead of inheriting from this // make sure menubar has the arrow cursor instead of inheriting from this
ui->menubar->setCursor(QCursor()); //ui->menubar->setCursor(QCursor());
statusBar()->setCursor(QCursor()); statusBar()->setCursor(QCursor());
mouse_hide_timer.setInterval(default_mouse_hide_timeout); mouse_hide_timer.setInterval(default_mouse_hide_timeout);
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor); 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); update_input_timer.setInterval(default_input_update_timeout);
connect(&update_input_timer, &QTimer::timeout, this, &GMainWindow::UpdateInputDrivers); connect(&update_input_timer, &QTimer::timeout, this, &GMainWindow::UpdateInputDrivers);
@ -973,20 +975,21 @@ void GMainWindow::WebBrowserRequestExit() {
} }
void GMainWindow::InitializeWidgets() { void GMainWindow::InitializeWidgets() {
#ifdef SUYU_ENABLE_COMPATIBILITY_REPORTING
ui->action_Report_Compatibility->setVisible(true); //#ifdef SUYU_ENABLE_COMPATIBILITY_REPORTING
#endif // ui->action_Report_Compatibility->setVisible(true);
//#endif
render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, *system); 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); 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); game_list_placeholder = new GameListPlaceholder(this);
ui->horizontalLayout->addWidget(game_list_placeholder); //ui->horizontalLayout->addWidget(game_list_placeholder);
game_list_placeholder->setVisible(false); //game_list_placeholder->setVisible(false);
loading_screen = new LoadingScreen(this); /*loading_screen = new LoadingScreen(this);
loading_screen->hide(); loading_screen->hide();
ui->horizontalLayout->addWidget(loading_screen); ui->horizontalLayout->addWidget(loading_screen);
connect(loading_screen, &LoadingScreen::Hidden, [&] { connect(loading_screen, &LoadingScreen::Hidden, [&] {
@ -995,37 +998,40 @@ void GMainWindow::InitializeWidgets() {
render_window->show(); render_window->show();
render_window->setFocus(); render_window->setFocus();
} }
}); });*/
multiplayer_state = new MultiplayerState(this, game_list->GetModel(), ui->action_Leave_Room, //multiplayer_state = new MultiplayerState(this, game_list->GetModel(), ui->action_Leave_Room,
ui->action_Show_Room, *system); //ui->action_Show_Room, *system);
multiplayer_state->setVisible(false);
// Create status bar //volume_slider->setVisible(false);
message_label = new QLabel(); //volume_button->setVisible(false);
// Configured separately for left alignment //multiplayer_state->setVisible(false);
message_label->setFrameStyle(QFrame::NoFrame);
message_label->setContentsMargins(4, 0, 4, 0);
message_label->setAlignment(Qt::AlignLeft);
statusBar()->addPermanentWidget(message_label, 1);
shader_building_label = new QLabel(); //// Create status bar
shader_building_label->setToolTip(tr("The amount of shaders currently being built")); //message_label = new QLabel();
res_scale_label = new QLabel(); //// Configured separately for left alignment
res_scale_label->setToolTip(tr("The current selected resolution scaling multiplier.")); //message_label->setFrameStyle(QFrame::NoFrame);
emu_speed_label = new QLabel(); //message_label->setContentsMargins(4, 0, 4, 0);
emu_speed_label->setToolTip( //message_label->setAlignment(Qt::AlignLeft);
tr("Current emulation speed. Values higher or lower than 100% " //statusBar()->addPermanentWidget(message_label, 1);
"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, //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}) { emu_frametime_label}) {
label->setVisible(false); label->setVisible(false);
label->setFrameStyle(QFrame::NoFrame); label->setFrameStyle(QFrame::NoFrame);
@ -1040,9 +1046,9 @@ void GMainWindow::InitializeWidgets() {
statusBar()->addPermanentWidget(firmware_label); statusBar()->addPermanentWidget(firmware_label);
statusBar()->addPermanentWidget(multiplayer_state->GetStatusText(), 0); 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->setObjectName(QStringLiteral("TASlabel"));
tas_label->setFocusPolicy(Qt::NoFocus); tas_label->setFocusPolicy(Qt::NoFocus);
statusBar()->insertPermanentWidget(0, tas_label); statusBar()->insertPermanentWidget(0, tas_label);
@ -1077,8 +1083,8 @@ void GMainWindow::InitializeWidgets() {
bottomLeft.setY(bottomLeft.y() - volume_popup->geometry().height()); bottomLeft.setY(bottomLeft.y() - volume_popup->geometry().height());
volume_popup->setGeometry(QRect(bottomLeft, QSize(rect.width(), rect.height()))); volume_popup->setGeometry(QRect(bottomLeft, QSize(rect.width(), rect.height())));
}); });
volume_button->setContextMenuPolicy(Qt::CustomContextMenu); volume_button->setContextMenuPolicy(Qt::CustomContextMenu);*/
connect(volume_button, &QPushButton::customContextMenuRequested, /*connect(volume_button, &QPushButton::customContextMenuRequested,
[this](const QPoint& menu_location) { [this](const QPoint& menu_location) {
QMenu context_menu; QMenu context_menu;
context_menu.addAction( context_menu.addAction(
@ -1094,45 +1100,45 @@ void GMainWindow::InitializeWidgets() {
context_menu.exec(volume_button->mapToGlobal(menu_location)); context_menu.exec(volume_button->mapToGlobal(menu_location));
volume_button->repaint(); 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 //// setup AA button
aa_status_button = new QPushButton(); //aa_status_button = new QPushButton();
aa_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); //aa_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
aa_status_button->setFocusPolicy(Qt::NoFocus); //aa_status_button->setFocusPolicy(Qt::NoFocus);
connect(aa_status_button, &QPushButton::clicked, [&] { //connect(aa_status_button, &QPushButton::clicked, [&] {
auto aa_mode = Settings::values.anti_aliasing.GetValue(); // auto aa_mode = Settings::values.anti_aliasing.GetValue();
aa_mode = static_cast<Settings::AntiAliasing>(static_cast<u32>(aa_mode) + 1); // aa_mode = static_cast<Settings::AntiAliasing>(static_cast<u32>(aa_mode) + 1);
if (aa_mode == Settings::AntiAliasing::MaxEnum) { // if (aa_mode == Settings::AntiAliasing::MaxEnum) {
aa_mode = Settings::AntiAliasing::None; // aa_mode = Settings::AntiAliasing::None;
} // }
Settings::values.anti_aliasing.SetValue(aa_mode); // Settings::values.anti_aliasing.SetValue(aa_mode);
aa_status_button->setChecked(true); // aa_status_button->setChecked(true);
UpdateAAText(); // UpdateAAText();
}); //});
UpdateAAText(); //UpdateAAText();
aa_status_button->setCheckable(true); //aa_status_button->setCheckable(true);
aa_status_button->setChecked(true); //aa_status_button->setChecked(true);
aa_status_button->setContextMenuPolicy(Qt::CustomContextMenu); //aa_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(aa_status_button, &QPushButton::customContextMenuRequested, //connect(aa_status_button, &QPushButton::customContextMenuRequested,
[this](const QPoint& menu_location) { // [this](const QPoint& menu_location) {
QMenu context_menu; // //QMenu context_menu;
for (auto const& aa_text_pair : ConfigurationShared::anti_aliasing_texts_map) { // for (auto const& aa_text_pair : ConfigurationShared::anti_aliasing_texts_map) {
context_menu.addAction(aa_text_pair.second, [this, aa_text_pair] { // context_menu.addAction(aa_text_pair.second, [this, aa_text_pair] {
Settings::values.anti_aliasing.SetValue(aa_text_pair.first); // Settings::values.anti_aliasing.SetValue(aa_text_pair.first);
UpdateAAText(); // UpdateAAText();
}); // });
} // }
context_menu.exec(aa_status_button->mapToGlobal(menu_location)); // //context_menu.exec(aa_status_button->mapToGlobal(menu_location));
aa_status_button->repaint(); // aa_status_button->repaint();
}); // });
statusBar()->insertPermanentWidget(0, aa_status_button); //statusBar()->insertPermanentWidget(0, aa_status_button);
// Setup Filter button // Setup Filter button
filter_status_button = new QPushButton(); /*filter_status_button = new QPushButton();
filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
filter_status_button->setFocusPolicy(Qt::NoFocus); filter_status_button->setFocusPolicy(Qt::NoFocus);
connect(filter_status_button, &QPushButton::clicked, this, connect(filter_status_button, &QPushButton::clicked, this,
@ -1140,30 +1146,30 @@ void GMainWindow::InitializeWidgets() {
UpdateFilterText(); UpdateFilterText();
filter_status_button->setCheckable(true); filter_status_button->setCheckable(true);
filter_status_button->setChecked(true); filter_status_button->setChecked(true);
filter_status_button->setContextMenuPolicy(Qt::CustomContextMenu); filter_status_button->setContextMenuPolicy(Qt::CustomContextMenu);*/
connect(filter_status_button, &QPushButton::customContextMenuRequested, //connect(filter_status_button, &QPushButton::customContextMenuRequested,
[this](const QPoint& menu_location) { // [this](const QPoint& menu_location) {
QMenu context_menu; // //QMenu context_menu;
for (auto const& filter_text_pair : ConfigurationShared::scaling_filter_texts_map) { // for (auto const& filter_text_pair : ConfigurationShared::scaling_filter_texts_map) {
context_menu.addAction(filter_text_pair.second, [this, filter_text_pair] { // context_menu.addAction(filter_text_pair.second, [this, filter_text_pair] {
Settings::values.scaling_filter.SetValue(filter_text_pair.first); // Settings::values.scaling_filter.SetValue(filter_text_pair.first);
UpdateFilterText(); // UpdateFilterText();
}); // });
} // }
context_menu.exec(filter_status_button->mapToGlobal(menu_location)); // //context_menu.exec(filter_status_button->mapToGlobal(menu_location));
filter_status_button->repaint(); // filter_status_button->repaint();
}); // });
statusBar()->insertPermanentWidget(0, filter_status_button); //statusBar()->insertPermanentWidget(0, filter_status_button);
// Setup Dock button //// Setup Dock button
dock_status_button = new QPushButton(); //dock_status_button = new QPushButton();
dock_status_button->setObjectName(QStringLiteral("DockingStatusBarButton")); //dock_status_button->setObjectName(QStringLiteral("DockingStatusBarButton"));
dock_status_button->setFocusPolicy(Qt::NoFocus); //dock_status_button->setFocusPolicy(Qt::NoFocus);
connect(dock_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleDockedMode); //connect(dock_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleDockedMode);
dock_status_button->setCheckable(true); //dock_status_button->setCheckable(true);
UpdateDockedButton(); //UpdateDockedButton();
dock_status_button->setContextMenuPolicy(Qt::CustomContextMenu); //dock_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(dock_status_button, &QPushButton::customContextMenuRequested, /*connect(dock_status_button, &QPushButton::customContextMenuRequested,
[this](const QPoint& menu_location) { [this](const QPoint& menu_location) {
QMenu context_menu; QMenu context_menu;
@ -1176,18 +1182,18 @@ void GMainWindow::InitializeWidgets() {
} }
context_menu.exec(dock_status_button->mapToGlobal(menu_location)); context_menu.exec(dock_status_button->mapToGlobal(menu_location));
dock_status_button->repaint(); dock_status_button->repaint();
}); });*/
statusBar()->insertPermanentWidget(0, dock_status_button); //statusBar()->insertPermanentWidget(0, dock_status_button);
// Setup GPU Accuracy button //// Setup GPU Accuracy button
gpu_accuracy_button = new QPushButton(); //gpu_accuracy_button = new QPushButton();
gpu_accuracy_button->setObjectName(QStringLiteral("GPUStatusBarButton")); //gpu_accuracy_button->setObjectName(QStringLiteral("GPUStatusBarButton"));
gpu_accuracy_button->setCheckable(true); //gpu_accuracy_button->setCheckable(true);
gpu_accuracy_button->setFocusPolicy(Qt::NoFocus); //gpu_accuracy_button->setFocusPolicy(Qt::NoFocus);
connect(gpu_accuracy_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGpuAccuracy); //connect(gpu_accuracy_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGpuAccuracy);
UpdateGPUAccuracyButton(); //UpdateGPUAccuracyButton();
gpu_accuracy_button->setContextMenuPolicy(Qt::CustomContextMenu); //gpu_accuracy_button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(gpu_accuracy_button, &QPushButton::customContextMenuRequested, /*connect(gpu_accuracy_button, &QPushButton::customContextMenuRequested,
[this](const QPoint& menu_location) { [this](const QPoint& menu_location) {
QMenu context_menu; QMenu context_menu;
@ -1202,21 +1208,21 @@ void GMainWindow::InitializeWidgets() {
} }
context_menu.exec(gpu_accuracy_button->mapToGlobal(menu_location)); context_menu.exec(gpu_accuracy_button->mapToGlobal(menu_location));
gpu_accuracy_button->repaint(); gpu_accuracy_button->repaint();
}); });*/
statusBar()->insertPermanentWidget(0, gpu_accuracy_button); //statusBar()->insertPermanentWidget(0, gpu_accuracy_button);
// Setup Renderer API button //// Setup Renderer API button
renderer_status_button = new QPushButton(); //renderer_status_button = new QPushButton();
renderer_status_button->setObjectName(QStringLiteral("RendererStatusBarButton")); //renderer_status_button->setObjectName(QStringLiteral("RendererStatusBarButton"));
renderer_status_button->setCheckable(true); //renderer_status_button->setCheckable(true);
renderer_status_button->setFocusPolicy(Qt::NoFocus); //renderer_status_button->setFocusPolicy(Qt::NoFocus);
connect(renderer_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGraphicsAPI); //connect(renderer_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGraphicsAPI);
UpdateAPIText(); //UpdateAPIText();
renderer_status_button->setCheckable(true); //renderer_status_button->setCheckable(true);
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == //renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
Settings::RendererBackend::Vulkan); // Settings::RendererBackend::Vulkan);
renderer_status_button->setContextMenuPolicy(Qt::CustomContextMenu); //renderer_status_button->setContextMenuPolicy(Qt::CustomContextMenu);
connect(renderer_status_button, &QPushButton::customContextMenuRequested, /*connect(renderer_status_button, &QPushButton::customContextMenuRequested,
[this](const QPoint& menu_location) { [this](const QPoint& menu_location) {
QMenu context_menu; QMenu context_menu;
@ -1233,30 +1239,30 @@ void GMainWindow::InitializeWidgets() {
} }
context_menu.exec(renderer_status_button->mapToGlobal(menu_location)); context_menu.exec(renderer_status_button->mapToGlobal(menu_location));
renderer_status_button->repaint(); renderer_status_button->repaint();
}); });*/
statusBar()->insertPermanentWidget(0, renderer_status_button); /*statusBar()->insertPermanentWidget(0, renderer_status_button);
statusBar()->setVisible(true); statusBar()->setVisible(true);
setStyleSheet(QStringLiteral("QStatusBar::item{border: none;}")); setStyleSheet(QStringLiteral("QStatusBar::item{border: none;}"));*/
} }
void GMainWindow::InitializeDebugWidgets() { void GMainWindow::InitializeDebugWidgets() {
QMenu* debug_menu = ui->menu_View_Debugging; //QMenu* debug_menu = ui->menu_View_Debugging;
#if MICROPROFILE_ENABLED #if MICROPROFILE_ENABLED
microProfileDialog = new MicroProfileDialog(this); microProfileDialog = new MicroProfileDialog(this);
microProfileDialog->hide(); microProfileDialog->hide();
debug_menu->addAction(microProfileDialog->toggleViewAction()); //debug_menu->addAction(microProfileDialog->toggleViewAction());
#endif #endif
waitTreeWidget = new WaitTreeWidget(*system, this); waitTreeWidget = new WaitTreeWidget(*system, this);
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
waitTreeWidget->hide(); waitTreeWidget->hide();
debug_menu->addAction(waitTreeWidget->toggleViewAction()); //debug_menu->addAction(waitTreeWidget->toggleViewAction());
controller_dialog = new ControllerDialog(system->HIDCore(), input_subsystem, this); controller_dialog = new ControllerDialog(system->HIDCore(), input_subsystem, this);
controller_dialog->hide(); controller_dialog->hide();
debug_menu->addAction(controller_dialog->toggleViewAction()); //debug_menu->addAction(controller_dialog->toggleViewAction());
connect(this, &GMainWindow::EmulationStarting, waitTreeWidget, connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
&WaitTreeWidget::OnEmulationStarting); &WaitTreeWidget::OnEmulationStarting);
@ -1264,22 +1270,31 @@ void GMainWindow::InitializeDebugWidgets() {
&WaitTreeWidget::OnEmulationStopping); &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() { void GMainWindow::InitializeRecentFileMenuActions() {
for (int i = 0; i < max_recent_files_item; ++i) { for (int i = 0; i < max_recent_files_item; ++i) {
actions_recent_files[i] = new QAction(this); actions_recent_files[i] = new QAction(this);
actions_recent_files[i]->setVisible(false); actions_recent_files[i]->setVisible(false);
connect(actions_recent_files[i], &QAction::triggered, this, &GMainWindow::OnMenuRecentFile); 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); QAction* action_clear_recent_files = new QAction(this);
action_clear_recent_files->setText(tr("&Clear Recent Files")); action_clear_recent_files->setText(tr("&Clear Recent Files"));
connect(action_clear_recent_files, &QAction::triggered, this, [this] { connect(action_clear_recent_files, &QAction::triggered, this, [this] {
UISettings::values.recent_files.clear(); UISettings::values.recent_files.clear();
UpdateRecentFiles(); UpdateRecentFiles();
}); });
ui->menu_recent_files->addAction(action_clear_recent_files); //ui->menu_recent_files->addAction(action_clear_recent_files);
UpdateRecentFiles(); UpdateRecentFiles();
} }
@ -1510,37 +1525,37 @@ void GMainWindow::ConnectMenuEvents() {
}; };
// File // 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_Load_Folder, &GMainWindow::OnMenuLoadFolder);
connect_menu(ui->action_Install_File_NAND, &GMainWindow::OnMenuInstallToNAND); connect_menu(ui->action_Install_File_NAND, &GMainWindow::OnMenuInstallToNAND);
connect_menu(ui->action_Exit, &QMainWindow::close); connect_menu(ui->action_Exit, &QMainWindow::close);
connect_menu(ui->action_Load_Amiibo, &GMainWindow::OnLoadAmiibo); connect_menu(ui->action_Load_Amiibo, &GMainWindow::OnLoadAmiibo);*/
// Emulation // Emulation
connect_menu(ui->action_Pause, &GMainWindow::OnPauseContinueGame); //connect_menu(ui->action_Pause, &GMainWindow::OnPauseContinueGame);
connect_menu(ui->action_Stop, &GMainWindow::OnStopGame); //connect_menu(ui->action_Stop, &GMainWindow::OnStopGame);
connect_menu(ui->action_Report_Compatibility, &GMainWindow::OnMenuReportCompatibility); //connect_menu(ui->action_Report_Compatibility, &GMainWindow::OnMenuReportCompatibility);
connect_menu(ui->action_Open_Mods_Page, &GMainWindow::OnOpenModsPage); //connect_menu(ui->action_Open_Mods_Page, &GMainWindow::OnOpenModsPage);
connect_menu(ui->action_Open_Quickstart_Guide, &GMainWindow::OnOpenQuickstartGuide); //connect_menu(ui->action_Open_Quickstart_Guide, &GMainWindow::OnOpenQuickstartGuide);
connect_menu(ui->action_Open_FAQ, &GMainWindow::OnOpenFAQ); //connect_menu(ui->action_Open_FAQ, &GMainWindow::OnOpenFAQ);
connect_menu(ui->action_Restart, &GMainWindow::OnRestartGame); //connect_menu(ui->action_Restart, &GMainWindow::OnRestartGame);
connect_menu(ui->action_Configure, &GMainWindow::OnConfigure); //connect_menu(ui->action_Configure, &GMainWindow::OnConfigure);
connect_menu(ui->action_Configure_Current_Game, &GMainWindow::OnConfigurePerGame); //connect_menu(ui->action_Configure_Current_Game, &GMainWindow::OnConfigurePerGame);
// View //// View
connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen); //connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen);
connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode); //connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode);
connect_menu(ui->action_Display_Dock_Widget_Headers, &GMainWindow::OnDisplayTitleBars); //connect_menu(ui->action_Display_Dock_Widget_Headers, &GMainWindow::OnDisplayTitleBars);
connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar); //connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar);
connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar); //connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar);
connect_menu(ui->action_Show_Folders_In_List, &GMainWindow::OnToggleFoldersInList); //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_720, &GMainWindow::ResetWindowSize720);
connect_menu(ui->action_Reset_Window_Size_900, &GMainWindow::ResetWindowSize900); //connect_menu(ui->action_Reset_Window_Size_900, &GMainWindow::ResetWindowSize900);
connect_menu(ui->action_Reset_Window_Size_1080, &GMainWindow::ResetWindowSize1080); //connect_menu(ui->action_Reset_Window_Size_1080, &GMainWindow::ResetWindowSize1080);
ui->menu_Reset_Window_Size->addActions({ui->action_Reset_Window_Size_720, /*ui->menu_Reset_Window_Size->addActions({ui->action_Reset_Window_Size_720,
ui->action_Reset_Window_Size_900, ui->action_Reset_Window_Size_900,
ui->action_Reset_Window_Size_1080}); ui->action_Reset_Window_Size_1080});*/
// Multiplayer // Multiplayer
connect(ui->action_View_Lobby, &QAction::triggered, multiplayer_state, connect(ui->action_View_Lobby, &QAction::triggered, multiplayer_state,
@ -2239,7 +2254,7 @@ void GMainWindow::UpdateRecentFiles() {
} }
// Enable the recent files menu if the list isn't empty // 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) { void GMainWindow::OnGameListLoadFile(QString game_path, u64 program_id) {
@ -3452,7 +3467,7 @@ void GMainWindow::ShowFullscreen() {
if (ui->action_Single_Window_Mode->isChecked()) { if (ui->action_Single_Window_Mode->isChecked()) {
UISettings::values.geometry = saveGeometry(); UISettings::values.geometry = saveGeometry();
ui->menubar->hide(); //ui->menubar->hide();
statusBar()->hide(); statusBar()->hide();
show_fullscreen(this); show_fullscreen(this);
@ -3476,7 +3491,7 @@ void GMainWindow::HideFullscreen() {
} }
statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked());
ui->menubar->show(); //ui->menubar->show();
} else { } else {
if (UsingExclusiveFullscreen()) { if (UsingExclusiveFullscreen()) {
render_window->showNormal(); render_window->showNormal();
@ -3523,9 +3538,10 @@ void GMainWindow::ResetWindowSize(u32 width, u32 height) {
if (!ui->action_Single_Window_Mode->isChecked()) { if (!ui->action_Single_Window_Mode->isChecked()) {
render_window->resize(height / aspect_ratio, height); render_window->resize(height / aspect_ratio, height);
} else { } else {
const bool show_status_bar = ui->action_Show_Status_Bar->isChecked(); //const bool show_status_bar = ui->action_Show_Status_Bar->isChecked();
const auto status_bar_height = show_status_bar ? statusBar()->height() : 0; //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 + menuBar()->height() + status_bar_height);
resize(height / aspect_ratio, height);
} }
} }
@ -4669,15 +4685,15 @@ void GMainWindow::SetFirmwareVersion() {
return; return;
} }
firmware_label->setVisible(true); //firmware_label->setVisible(true);
const std::string display_version(firmware_data.display_version.data()); const std::string display_version(firmware_data.display_version.data());
const std::string display_title(firmware_data.display_title.data()); const std::string display_title(firmware_data.display_title.data());
LOG_INFO(Frontend, "Installed firmware: {}", display_title); LOG_INFO(Frontend, "Installed firmware: {}", display_title);
firmware_label->setText(QString::fromStdString(display_version)); //firmware_label->setText(QString::fromStdString(display_version));
firmware_label->setToolTip(QString::fromStdString(display_title)); //firmware_label->setToolTip(QString::fromStdString(display_title));
} }
bool GMainWindow::ConfirmClose() { bool GMainWindow::ConfirmClose() {
@ -4933,6 +4949,8 @@ void GMainWindow::changeEvent(QEvent* event) {
QWidget::changeEvent(event); QWidget::changeEvent(event);
} }
Service::AM::FrontendAppletParameters GMainWindow::ApplicationAppletParameters() { Service::AM::FrontendAppletParameters GMainWindow::ApplicationAppletParameters() {
return Service::AM::FrontendAppletParameters{ return Service::AM::FrontendAppletParameters{
.applet_id = Service::AM::AppletId::Application, .applet_id = Service::AM::AppletId::Application,
@ -5114,14 +5132,25 @@ int main(int argc, char* argv[]) {
// generating shaders // generating shaders
setlocale(LC_ALL, "C"); setlocale(LC_ALL, "C");
GMainWindow main_window{std::move(config), has_broken_vulkan}; const QRect screenGeometry = QApplication::primaryScreen()->availableGeometry();
// After settings have been loaded by GMainWindow, apply the filter
main_window.show();
QObject::connect(&app, &QGuiApplication::applicationStateChanged, &main_window, GMainWindow main_window{std::move(config), has_broken_vulkan};
&GMainWindow::OnAppFocusStateChanged);
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(); int result = app.exec();
detached_tasks.WaitForAllTasks(); detached_tasks.WaitForAllTasks();
return result; return result;
} }

View file

@ -174,6 +174,9 @@ public:
bool DropAction(QDropEvent* event); bool DropAction(QDropEvent* event);
void AcceptDropEvent(QDropEvent* event); void AcceptDropEvent(QDropEvent* event);
/// Specifies the window opacity value within a range of 0 to 1
static const float window_opacity;
signals: signals:
/** /**
@ -255,6 +258,7 @@ private:
void InitializeWidgets(); void InitializeWidgets();
void InitializeDebugWidgets(); void InitializeDebugWidgets();
void HideUnwantedWidgets();
void InitializeRecentFileMenuActions(); void InitializeRecentFileMenuActions();
void SetDefaultUIGeometry(); void SetDefaultUIGeometry();

View file

@ -18,7 +18,7 @@
<normaloff>:/img/suyu.ico</normaloff>:/img/suyu.ico</iconset> <normaloff>:/img/suyu.ico</normaloff>:/img/suyu.ico</iconset>
</property> </property>
<property name="tabShape"> <property name="tabShape">
<enum>QTabWidget::Rounded</enum> <enum>QTabWidget::TabShape::Rounded</enum>
</property> </property>
<property name="dockNestingEnabled"> <property name="dockNestingEnabled">
<bool>true</bool> <bool>true</bool>
@ -39,164 +39,6 @@
</property> </property>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
<property name="title">
<string>&amp;File</string>
</property>
<widget class="QMenu" name="menu_recent_files">
<property name="title">
<string>&amp;Recent Files</string>
</property>
</widget>
<addaction name="action_Install_File_NAND"/>
<addaction name="separator"/>
<addaction name="action_Load_File"/>
<addaction name="action_Load_Folder"/>
<addaction name="separator"/>
<addaction name="menu_recent_files"/>
<addaction name="separator"/>
<addaction name="action_Load_Amiibo"/>
<addaction name="separator"/>
<addaction name="action_Open_suyu_Folder"/>
<addaction name="separator"/>
<addaction name="action_Exit"/>
</widget>
<widget class="QMenu" name="menu_Emulation">
<property name="title">
<string>&amp;Emulation</string>
</property>
<addaction name="action_Pause"/>
<addaction name="action_Stop"/>
<addaction name="action_Restart"/>
<addaction name="separator"/>
<addaction name="action_Configure"/>
<addaction name="action_Configure_Current_Game"/>
</widget>
<widget class="QMenu" name="menu_View">
<property name="title">
<string>&amp;View</string>
</property>
<widget class="QMenu" name="menu_Reset_Window_Size">
<property name="title">
<string>&amp;Reset Window Size</string>
</property>
</widget>
<widget class="QMenu" name="menu_View_Debugging">
<property name="title">
<string>&amp;Debugging</string>
</property>
</widget>
<action name="action_Reset_Window_Size_720">
<property name="text">
<string>Reset Window Size to &amp;720p</string>
</property>
<property name="iconText">
<string>Reset Window Size to 720p</string>
</property>
</action>
<action name="action_Reset_Window_Size_900">
<property name="text">
<string>Reset Window Size to &amp;900p</string>
</property>
<property name="iconText">
<string>Reset Window Size to 900p</string>
</property>
</action>
<action name="action_Reset_Window_Size_1080">
<property name="text">
<string>Reset Window Size to &amp;1080p</string>
</property>
<property name="iconText">
<string>Reset Window Size to 1080p</string>
</property>
</action>
<addaction name="action_Fullscreen"/>
<addaction name="action_Single_Window_Mode"/>
<addaction name="action_Display_Dock_Widget_Headers"/>
<addaction name="action_Show_Filter_Bar"/>
<addaction name="action_Show_Status_Bar"/>
<addaction name="action_Show_Folders_In_List" />
<addaction name="separator"/>
<addaction name="menu_Reset_Window_Size"/>
<addaction name="menu_View_Debugging"/>
</widget>
<widget class="QMenu" name="menu_Multiplayer">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>&amp;Multiplayer</string>
</property>
<addaction name="action_View_Lobby"/>
<addaction name="action_Start_Room"/>
<addaction name="action_Connect_To_Room"/>
<addaction name="separator"/>
<addaction name="action_Show_Room"/>
<addaction name="action_Leave_Room"/>
</widget>
<widget class="QMenu" name="menu_Tools">
<property name="title">
<string>&amp;Tools</string>
</property>
<widget class="QMenu" name="menu_cabinet_applet">
<property name="title">
<string>&amp;Amiibo</string>
</property>
<addaction name="action_Load_Cabinet_Nickname_Owner"/>
<addaction name="action_Load_Cabinet_Eraser"/>
<addaction name="action_Load_Cabinet_Restorer"/>
<addaction name="action_Load_Cabinet_Formatter"/>
</widget>
<widget class="QMenu" name="menuTAS">
<property name="title">
<string>&amp;TAS</string>
</property>
<addaction name="action_TAS_Start"/>
<addaction name="action_TAS_Record"/>
<addaction name="action_TAS_Reset"/>
<addaction name="separator"/>
<addaction name="action_Configure_Tas"/>
</widget>
<addaction name="action_Install_Keys"/>
<addaction name="action_Install_Firmware"/>
<addaction name="action_Verify_installed_contents"/>
<addaction name="separator"/>
<addaction name="menu_cabinet_applet"/>
<addaction name="action_Load_Album"/>
<addaction name="action_Load_Mii_Edit"/>
<addaction name="action_Open_Controller_Menu"/>
<addaction name="action_Load_Home_Menu"/>
<addaction name="separator"/>
<addaction name="action_Capture_Screenshot"/>
<addaction name="menuTAS"/>
</widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="action_Report_Compatibility"/>
<addaction name="action_Open_Mods_Page"/>
<addaction name="action_Open_Quickstart_Guide"/>
<addaction name="action_Open_FAQ"/>
<addaction name="separator"/>
<addaction name="action_About"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Emulation"/>
<addaction name="menu_View"/>
<addaction name="menu_Tools"/>
<addaction name="menu_Multiplayer"/>
<addaction name="menu_Help"/>
</widget>
<action name="action_Install_File_NAND"> <action name="action_Install_File_NAND">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -259,7 +101,7 @@
<string>Con&amp;figure...</string> <string>Con&amp;figure...</string>
</property> </property>
<property name="menuRole"> <property name="menuRole">
<enum>QAction::PreferencesRole</enum> <enum>QAction::MenuRole::PreferencesRole</enum>
</property> </property>
</action> </action>
<action name="action_Display_Dock_Widget_Headers"> <action name="action_Display_Dock_Widget_Headers">
@ -435,7 +277,7 @@
<string>&amp;Configure TAS...</string> <string>&amp;Configure TAS...</string>
</property> </property>
<property name="menuRole"> <property name="menuRole">
<enum>QAction::NoRole</enum> <enum>QAction::MenuRole::NoRole</enum>
</property> </property>
</action> </action>
<action name="action_Configure_Current_Game"> <action name="action_Configure_Current_Game">
@ -446,7 +288,7 @@
<string>Configure C&amp;urrent Game...</string> <string>Configure C&amp;urrent Game...</string>
</property> </property>
<property name="menuRole"> <property name="menuRole">
<enum>QAction::NoRole</enum> <enum>QAction::MenuRole::NoRole</enum>
</property> </property>
</action> </action>
<action name="action_TAS_Start"> <action name="action_TAS_Start">

View file

@ -111,6 +111,9 @@ void MultiplayerState::SetNotificationStatus(NotificationStatus status) {
} }
void MultiplayerState::UpdateNotificationStatus() { void MultiplayerState::UpdateNotificationStatus() {
return; // TEMP
switch (notification_status) { switch (notification_status) {
case NotificationStatus::Uninitialized: case NotificationStatus::Uninitialized:
status_icon->setPixmap(QIcon::fromTheme(QStringLiteral("disconnected")).pixmap(16)); status_icon->setPixmap(QIcon::fromTheme(QStringLiteral("disconnected")).pixmap(16));
@ -326,6 +329,9 @@ void MultiplayerState::UpdateCredentials() {
} }
void MultiplayerState::UpdateGameList(QStandardItemModel* game_list) { void MultiplayerState::UpdateGameList(QStandardItemModel* game_list) {
return; // TEMP
game_list_model = game_list; game_list_model = game_list;
if (lobby) { if (lobby) {
lobby->UpdateGameList(game_list); lobby->UpdateGameList(game_list);