Compare commits

...

4 commits

5 changed files with 220 additions and 335 deletions

View file

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

View file

@ -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,14 +5133,25 @@ 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();
return result;
}
}

View file

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

View file

@ -18,7 +18,7 @@
<normaloff>:/img/suyu.ico</normaloff>:/img/suyu.ico</iconset>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
<enum>QTabWidget::TabShape::Rounded</enum>
</property>
<property name="dockNestingEnabled">
<bool>true</bool>
@ -39,164 +39,6 @@
</property>
</layout>
</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">
<property name="enabled">
<bool>true</bool>
@ -259,7 +101,7 @@
<string>Con&amp;figure...</string>
</property>
<property name="menuRole">
<enum>QAction::PreferencesRole</enum>
<enum>QAction::MenuRole::PreferencesRole</enum>
</property>
</action>
<action name="action_Display_Dock_Widget_Headers">
@ -435,7 +277,7 @@
<string>&amp;Configure TAS...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="action_Configure_Current_Game">
@ -446,7 +288,7 @@
<string>Configure C&amp;urrent Game...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="action_TAS_Start">

View file

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