diff --git a/rpcs3/Json/tooltips.json b/rpcs3/Json/tooltips.json index 731e4dc881..725aa1cea8 100644 --- a/rpcs3/Json/tooltips.json +++ b/rpcs3/Json/tooltips.json @@ -71,6 +71,7 @@ "renderBox_Linux": "Vulkan is the fastest renderer. OpenGL is the most accurate renderer.\nIf unsure, use Vulkan. Should you have any compatibility issues, fall back to OpenGL.", "resBox": "This setting will be ignored if the Resolution Scale is set to anything other than 100%!\nLeave this on 1280x720, every PS3 game is compatible with this resolution.\nOnly use 1920x1080 if the game supports it.\nRarely due to emulation bugs some games will only render at low resolutions like 480p.", "graphicsAdapterBox": "On multi GPU systems select which GPU to use in RPCS3 when using Vulkan or DirectX 12.\nThis is not needed when using OpenGL.", + "graphicsAdapterBox_Linux": "On multi GPU systems select which GPU to use in RPCS3 when using Vulkan.\nThis is not needed when using OpenGL.", "aspectBox": "Leave this on 16:9 unless you have a 4:3 monitor.\nAuto also works well, especially if you use a resolution that is not 720p.", "frameLimitBox": "Off is the best option as it performs faster.\nUsing the frame limiter will add extra overhead and slow down the game.\nHowever, some games will crash if the framerate is too high.\nIf that happens, set value to anything other than Off.", "anisotropicFilterOverride": "Higher values increase sharpness of textures on sloped surfaces at the cost of GPU resources.\nModern GPUs can handle this setting just fine even at 16x.\nKeep this on Automatic if you want to use the original setting used by a real PS3." diff --git a/rpcs3/rpcs3_app.cpp b/rpcs3/rpcs3_app.cpp index 6dddf28808..91cd545c6e 100644 --- a/rpcs3/rpcs3_app.cpp +++ b/rpcs3/rpcs3_app.cpp @@ -87,7 +87,7 @@ void rpcs3_app::Init() // Create the thumbnail toolbar after the main_window is created RPCS3MainWin->CreateThumbnailToolbar(); - if (guiSettings->GetValue(GUI::ib_show_welcome).toBool()) + if (guiSettings->GetValue(gui::ib_show_welcome).toBool()) { welcome_dialog* welcome = new welcome_dialog(); welcome->exec(); @@ -160,13 +160,13 @@ void rpcs3_app::InitializeCallbacks() int w = size.first; int h = size.second; - if (guiSettings->GetValue(GUI::gs_resize).toBool()) + if (guiSettings->GetValue(gui::gs_resize).toBool()) { - w = guiSettings->GetValue(GUI::gs_width).toInt(); - h = guiSettings->GetValue(GUI::gs_height).toInt(); + w = guiSettings->GetValue(gui::gs_width).toInt(); + h = guiSettings->GetValue(gui::gs_height).toInt(); } - bool disableMouse = guiSettings->GetValue(GUI::gs_disableMouse).toBool(); + bool disableMouse = guiSettings->GetValue(gui::gs_disableMouse).toBool(); switch (video_renderer type = g_cfg.video.renderer) { @@ -292,38 +292,38 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath) }; // toolbar color stylesheet - QString rgba_tool_bar = rgba(GUI::mw_tool_bar_color); + QString rgba_tool_bar = rgba(gui::mw_tool_bar_color); QString style_toolbar = QString ( "QLineEdit#mw_searchbar { margin-left:14px; background-color: " + rgba_tool_bar + " }" "QToolBar#mw_toolbar { background-color: " + rgba_tool_bar + " }" "QToolBar#mw_toolbar QSlider { background-color: " + rgba_tool_bar + " }" - "QToolBar#mw_toolbar::separator { background-color: " + rgba(GUI::mw_tool_bar_color, -20) + " width: 1px; margin-top: 2px; margin-bottom: 2px; }" + "QToolBar#mw_toolbar::separator { background-color: " + rgba(gui::mw_tool_bar_color, -20) + " width: 1px; margin-top: 2px; margin-bottom: 2px; }" ); // toolbar icon color stylesheet QString style_toolbar_icons = QString ( - "QLabel#toolbar_icon_color { color: " + rgba(GUI::mw_tool_icon_color) + " }" + "QLabel#toolbar_icon_color { color: " + rgba(gui::mw_tool_icon_color) + " }" ); // thumbnail icon color stylesheet QString style_thumbnail_icons = QString ( - "QLabel#thumbnail_icon_color { color: " + rgba(GUI::mw_thumb_icon_color) + " }" + "QLabel#thumbnail_icon_color { color: " + rgba(gui::mw_thumb_icon_color) + " }" ); // gamelist toolbar stylesheet QString style_gamelist_toolbar = QString ( "QLineEdit#tb_searchbar { background: transparent; }" - "QLabel#gamelist_toolbar_icon_color { color: " + rgba(GUI::gl_tool_icon_color) + " }" + "QLabel#gamelist_toolbar_icon_color { color: " + rgba(gui::gl_tool_icon_color) + " }" ); // gamelist icon color stylesheet QString style_gamelist_icons = QString ( - "QLabel#gamelist_icon_background_color { color: " + rgba(GUI::gl_icon_color) + " }" + "QLabel#gamelist_icon_background_color { color: " + rgba(gui::gl_icon_color) + " }" ); // log stylesheet @@ -366,7 +366,7 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath) setStyleSheet(file.readAll()); file.close(); } - GUI::stylesheet = styleSheet(); + gui::stylesheet = styleSheet(); RPCS3MainWin->RepaintGui(); } diff --git a/rpcs3/rpcs3qt/cg_disasm_window.cpp b/rpcs3/rpcs3qt/cg_disasm_window.cpp index 24a4839d93..3059e2575f 100644 --- a/rpcs3/rpcs3qt/cg_disasm_window.cpp +++ b/rpcs3/rpcs3qt/cg_disasm_window.cpp @@ -28,7 +28,7 @@ cg_disasm_window::cg_disasm_window(std::shared_ptr xSettings): xgu setMinimumSize(QSize(200, 150)); // seems fine on win 10 resize(QSize(620, 395)); - m_path_last = xgui_settings->GetValue(GUI::fd_cg_disasm).toString(); + m_path_last = xgui_settings->GetValue(gui::fd_cg_disasm).toString(); m_disasm_text = new QTextEdit(this); m_disasm_text->setReadOnly(true); @@ -205,7 +205,7 @@ void cg_disasm_window::ShowDisasm() disasm.BuildShaderBody(); m_disasm_text->setText(qstr(disasm.GetArbShader())); m_glsl_text->setText(qstr(disasm.GetGlslShader())); - xgui_settings->SetValue(GUI::fd_cg_disasm, m_path_last); + xgui_settings->SetValue(gui::fd_cg_disasm, m_path_last); } else if (!m_path_last.isEmpty()) { diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 0d678b0258..d06c1be087 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -143,17 +143,17 @@ debugger_frame::debugger_frame(std::shared_ptr settings, QWidget * void debugger_frame::SaveSettings() { - xgui_settings->SetValue(GUI::d_splitterState, m_splitter->saveState()); + xgui_settings->SetValue(gui::d_splitterState, m_splitter->saveState()); } void debugger_frame::ChangeColors() { if (m_list) { - m_list->m_color_bp = GUI::get_Label_Color("debugger_frame_breakpoint", QPalette::Background); - m_list->m_color_pc = GUI::get_Label_Color("debugger_frame_pc", QPalette::Background); - m_list->m_text_color_bp = GUI::get_Label_Color("debugger_frame_breakpoint");; - m_list->m_text_color_pc = GUI::get_Label_Color("debugger_frame_pc");; + m_list->m_color_bp = gui::get_Label_Color("debugger_frame_breakpoint", QPalette::Background); + m_list->m_color_pc = gui::get_Label_Color("debugger_frame_pc", QPalette::Background); + m_list->m_text_color_bp = gui::get_Label_Color("debugger_frame_breakpoint");; + m_list->m_text_color_pc = gui::get_Label_Color("debugger_frame_pc");; } } @@ -166,7 +166,7 @@ void debugger_frame::closeEvent(QCloseEvent *event) void debugger_frame::showEvent(QShowEvent * event) { // resize splitter widgets - QByteArray state = xgui_settings->GetValue(GUI::d_splitterState).toByteArray(); + QByteArray state = xgui_settings->GetValue(gui::d_splitterState).toByteArray(); if (state.isEmpty()) // resize 2:1 { @@ -184,7 +184,7 @@ void debugger_frame::showEvent(QShowEvent * event) void debugger_frame::hideEvent(QHideEvent * event) { // save splitter state or it will resume its initial state on next show - xgui_settings->SetValue(GUI::d_splitterState, m_splitter->saveState()); + xgui_settings->SetValue(gui::d_splitterState, m_splitter->saveState()); QDockWidget::hideEvent(event); } diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 004159070f..8732fe9f75 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -25,27 +25,27 @@ #include inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); } -inline QSize sizeFromSlider(const int& pos) { return GUI::gl_icon_size_min + (GUI::gl_icon_size_max - GUI::gl_icon_size_min) * (pos / (float)GUI::gl_max_slider_pos); } +inline QSize sizeFromSlider(const int& pos) { return gui::gl_icon_size_min + (gui::gl_icon_size_max - gui::gl_icon_size_min) * (pos / (float)gui::gl_max_slider_pos); } game_list_frame::game_list_frame(std::shared_ptr guiSettings, std::shared_ptr emuSettings, QWidget *parent) : QDockWidget(tr("Game List"), parent), xgui_settings(guiSettings), xemu_settings(emuSettings) { - m_isListLayout = xgui_settings->GetValue(GUI::gl_listMode).toBool(); - m_icon_size_index = xgui_settings->GetValue(GUI::gl_iconSize).toInt(); - m_Margin_Factor = xgui_settings->GetValue(GUI::gl_marginFactor).toReal(); - m_Text_Factor = xgui_settings->GetValue(GUI::gl_textFactor).toReal(); - m_showToolBar = xgui_settings->GetValue(GUI::gl_toolBarVisible).toBool(); - m_Icon_Color = xgui_settings->GetValue(GUI::gl_iconColor).value(); - m_colSortOrder = xgui_settings->GetValue(GUI::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder; - m_sortColumn = xgui_settings->GetValue(GUI::gl_sortCol).toInt(); + m_isListLayout = xgui_settings->GetValue(gui::gl_listMode).toBool(); + m_icon_size_index = xgui_settings->GetValue(gui::gl_iconSize).toInt(); + m_Margin_Factor = xgui_settings->GetValue(gui::gl_marginFactor).toReal(); + m_Text_Factor = xgui_settings->GetValue(gui::gl_textFactor).toReal(); + m_showToolBar = xgui_settings->GetValue(gui::gl_toolBarVisible).toBool(); + m_Icon_Color = xgui_settings->GetValue(gui::gl_iconColor).value(); + m_colSortOrder = xgui_settings->GetValue(gui::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder; + m_sortColumn = xgui_settings->GetValue(gui::gl_sortCol).toInt(); m_oldLayoutIsList = m_isListLayout; // Save factors for first setup - xgui_settings->SetValue(GUI::gl_iconColor, m_Icon_Color); - xgui_settings->SetValue(GUI::gl_marginFactor, m_Margin_Factor); - xgui_settings->SetValue(GUI::gl_textFactor, m_Text_Factor); - xgui_settings->SetValue(GUI::gl_toolBarVisible, m_showToolBar); + xgui_settings->SetValue(gui::gl_iconColor, m_Icon_Color); + xgui_settings->SetValue(gui::gl_marginFactor, m_Margin_Factor); + xgui_settings->SetValue(gui::gl_textFactor, m_Text_Factor); + xgui_settings->SetValue(gui::gl_toolBarVisible, m_showToolBar); m_Game_Dock = new QMainWindow(this); m_Game_Dock->setWindowFlags(Qt::Widget); @@ -57,25 +57,25 @@ game_list_frame::game_list_frame(std::shared_ptr guiSettings, std: m_Tool_Bar->setContextMenuPolicy(Qt::PreventContextMenu); // ToolBar Actions - m_catActHDD = { new QAction(""), QIcon(":/Icons/hdd_blue.png"), QIcon(":/Icons/hdd_gray.png"), xgui_settings->GetValue(GUI::cat_hdd_game).toBool() }; + m_catActHDD = { new QAction(""), QIcon(":/Icons/hdd_blue.png"), QIcon(":/Icons/hdd_gray.png"), xgui_settings->GetValue(gui::cat_hdd_game).toBool() }; m_catActHDD.action->setToolTip(tr("Show HDD Categories")); - m_catActDisc = { new QAction(""), QIcon(":/Icons/disc_blue.png"), QIcon(":/Icons/disc_gray.png"), xgui_settings->GetValue(GUI::cat_disc_game).toBool() }; + m_catActDisc = { new QAction(""), QIcon(":/Icons/disc_blue.png"), QIcon(":/Icons/disc_gray.png"), xgui_settings->GetValue(gui::cat_disc_game).toBool() }; m_catActDisc.action->setToolTip(tr("Show Disc Categories")); - m_catActHome = { new QAction(""), QIcon(":/Icons/home_blue.png"), QIcon(":/Icons/home_gray.png"), xgui_settings->GetValue(GUI::cat_home).toBool() }; + m_catActHome = { new QAction(""), QIcon(":/Icons/home_blue.png"), QIcon(":/Icons/home_gray.png"), xgui_settings->GetValue(gui::cat_home).toBool() }; m_catActHome.action->setToolTip(tr("Show Home Categories")); - m_catActAudioVideo = { new QAction(""), QIcon(":/Icons/media_blue.png"), QIcon(":/Icons/media_gray.png"), xgui_settings->GetValue(GUI::cat_audio_video).toBool() }; + m_catActAudioVideo = { new QAction(""), QIcon(":/Icons/media_blue.png"), QIcon(":/Icons/media_gray.png"), xgui_settings->GetValue(gui::cat_audio_video).toBool() }; m_catActAudioVideo.action->setToolTip(tr("Show Audio/Video Categories")); - m_catActGameData = { new QAction(""), QIcon(":/Icons/data_blue.png"), QIcon(":/Icons/data_gray.png"), xgui_settings->GetValue(GUI::cat_game_data).toBool() }; + m_catActGameData = { new QAction(""), QIcon(":/Icons/data_blue.png"), QIcon(":/Icons/data_gray.png"), xgui_settings->GetValue(gui::cat_game_data).toBool() }; m_catActGameData.action->setToolTip(tr("Show GameData Categories")); - m_catActUnknown = { new QAction(""), QIcon(":/Icons/unknown_blue.png"), QIcon(":/Icons/unknown_gray.png"), xgui_settings->GetValue(GUI::cat_unknown).toBool() }; + m_catActUnknown = { new QAction(""), QIcon(":/Icons/unknown_blue.png"), QIcon(":/Icons/unknown_gray.png"), xgui_settings->GetValue(gui::cat_unknown).toBool() }; m_catActUnknown.action->setToolTip(tr("Show Unknown Categories")); - m_catActOther = { new QAction(""), QIcon(":/Icons/other_blue.png"), QIcon(":/Icons/other_gray.png"), xgui_settings->GetValue(GUI::cat_other).toBool() }; + m_catActOther = { new QAction(""), QIcon(":/Icons/other_blue.png"), QIcon(":/Icons/other_gray.png"), xgui_settings->GetValue(gui::cat_other).toBool() }; m_catActOther.action->setToolTip(tr("Show Other Categories")); m_categoryButtons = { &m_catActHDD , &m_catActDisc, &m_catActHome, &m_catActAudioVideo, &m_catActGameData, &m_catActUnknown, &m_catActOther }; @@ -109,7 +109,7 @@ game_list_frame::game_list_frame(std::shared_ptr guiSettings, std: // Icon Size Slider m_Slider_Size = new QSlider(Qt::Horizontal , m_Tool_Bar); - m_Slider_Size->setRange(0, GUI::gl_max_slider_pos); + m_Slider_Size->setRange(0, gui::gl_max_slider_pos); m_Slider_Size->setSliderPosition(m_icon_size_index); m_Slider_Size->setFixedWidth(m_Tool_Bar->height() * 3); @@ -134,7 +134,7 @@ game_list_frame::game_list_frame(std::shared_ptr guiSettings, std: RepaintToolBarIcons(); - bool showText = m_icon_size_index < GUI::gl_max_slider_pos; + bool showText = m_icon_size_index < gui::gl_max_slider_pos; m_Icon_Size = sizeFromSlider(m_icon_size_index); m_xgrid = new game_list_grid(m_Icon_Size, m_Icon_Color, m_Margin_Factor, m_Text_Factor, showText); @@ -161,17 +161,17 @@ game_list_frame::game_list_frame(std::shared_ptr guiSettings, std: m_gameList->setAlternatingRowColors(true); m_gameList->installEventFilter(this); - m_gameList->setColumnCount(GUI::COLUMN_COUNT); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_ICON, new QTableWidgetItem(tr("Icon"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_NAME, new QTableWidgetItem(tr("Name"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_SERIAL, new QTableWidgetItem(tr("Serial"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_FIRMWARE, new QTableWidgetItem(tr("Firmware"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_VERSION, new QTableWidgetItem(tr("Version"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_CATEGORY, new QTableWidgetItem(tr("Category"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_PATH, new QTableWidgetItem(tr("Path"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_RESOLUTION, new QTableWidgetItem(tr("Supported Resolutions"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_SOUND, new QTableWidgetItem(tr("Sound Formats"))); - m_gameList->setHorizontalHeaderItem( GUI::COLUMN_PARENTAL, new QTableWidgetItem(tr("Parental Level"))); + m_gameList->setColumnCount(gui::column_count); + m_gameList->setHorizontalHeaderItem(gui::column_icon, new QTableWidgetItem(tr("Icon"))); + m_gameList->setHorizontalHeaderItem(gui::column_name, new QTableWidgetItem(tr("Name"))); + m_gameList->setHorizontalHeaderItem(gui::column_serial, new QTableWidgetItem(tr("Serial"))); + m_gameList->setHorizontalHeaderItem(gui::column_firmware, new QTableWidgetItem(tr("Firmware"))); + m_gameList->setHorizontalHeaderItem(gui::column_version, new QTableWidgetItem(tr("Version"))); + m_gameList->setHorizontalHeaderItem(gui::column_category, new QTableWidgetItem(tr("Category"))); + m_gameList->setHorizontalHeaderItem(gui::column_path, new QTableWidgetItem(tr("Path"))); + m_gameList->setHorizontalHeaderItem(gui::column_resolution, new QTableWidgetItem(tr("Supported Resolutions"))); + m_gameList->setHorizontalHeaderItem(gui::column_sound, new QTableWidgetItem(tr("Sound Formats"))); + m_gameList->setHorizontalHeaderItem(gui::column_parental, new QTableWidgetItem(tr("Parental Level"))); // since this won't work somehow: gameList->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); for (int i = 0; i < m_gameList->horizontalHeader()->count(); i++) @@ -219,7 +219,7 @@ game_list_frame::game_list_frame(std::shared_ptr guiSettings, std: connect(m_Search_Bar, &QLineEdit::textChanged, this, &game_list_frame::SetSearchText); connect(m_Slider_Size, &QSlider::valueChanged, this, &game_list_frame::RequestIconSizeActSet); - connect(m_Slider_Size, &QSlider::sliderReleased, this, [&]{ xgui_settings->SetValue(GUI::gl_iconSize, m_Slider_Size->value()); }); + connect(m_Slider_Size, &QSlider::sliderReleased, this, [&]{ xgui_settings->SetValue(gui::gl_iconSize, m_Slider_Size->value()); }); connect(m_Slider_Size, &QSlider::actionTriggered, [&](int action) { if (action != QAbstractSlider::SliderNoAction && action != QAbstractSlider::SliderMove) @@ -267,7 +267,7 @@ game_list_frame::game_list_frame(std::shared_ptr guiSettings, std: void game_list_frame::LoadSettings() { - QByteArray state = xgui_settings->GetValue(GUI::gl_state).toByteArray(); + QByteArray state = xgui_settings->GetValue(gui::gl_state).toByteArray(); if (state.isEmpty()) { // If no settings exist, go to default. @@ -293,11 +293,11 @@ void game_list_frame::LoadSettings() m_gameList->horizontalHeader()->restoreState(m_gameList->horizontalHeader()->saveState()); m_gameList->horizontalHeader()->stretchLastSection(); - m_colSortOrder = xgui_settings->GetValue(GUI::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder; + m_colSortOrder = xgui_settings->GetValue(gui::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder; - m_sortColumn = xgui_settings->GetValue(GUI::gl_sortCol).toInt(); + m_sortColumn = xgui_settings->GetValue(gui::gl_sortCol).toInt(); - m_Icon_Color = xgui_settings->GetValue(GUI::gl_iconColor).value(); + m_Icon_Color = xgui_settings->GetValue(gui::gl_iconColor).value(); m_categoryFilters = xgui_settings->GetGameListCategoryFilters(); @@ -323,8 +323,8 @@ void game_list_frame::OnColClicked(int col) } m_sortColumn = col; - xgui_settings->SetValue(GUI::gl_sortAsc, m_colSortOrder == Qt::AscendingOrder); - xgui_settings->SetValue(GUI::gl_sortCol, col); + xgui_settings->SetValue(gui::gl_sortAsc, m_colSortOrder == Qt::AscendingOrder); + xgui_settings->SetValue(gui::gl_sortCol, col); SortGameList(); } @@ -538,10 +538,10 @@ void game_list_frame::SaveSettings() { xgui_settings->SetGamelistColVisibility(col, m_columnActs[col]->isChecked()); } - xgui_settings->SetValue(GUI::gl_sortCol, m_sortColumn); - xgui_settings->SetValue(GUI::gl_sortAsc, m_colSortOrder == Qt::AscendingOrder); + xgui_settings->SetValue(gui::gl_sortCol, m_sortColumn); + xgui_settings->SetValue(gui::gl_sortAsc, m_colSortOrder == Qt::AscendingOrder); - xgui_settings->SetValue(GUI::gl_state, m_gameList->horizontalHeader()->saveState()); + xgui_settings->SetValue(gui::gl_state, m_gameList->horizontalHeader()->saveState()); } static void open_dir(const std::string& spath) @@ -557,7 +557,7 @@ void game_list_frame::doubleClickedSlot(const QModelIndex& index) if (m_isListLayout) { - i = m_gameList->item(index.row(), GUI::COLUMN_ICON)->data(Qt::UserRole).toInt(); + i = m_gameList->item(index.row(), gui::column_icon)->data(Qt::UserRole).toInt(); } else { @@ -584,7 +584,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) if (m_isListLayout) { int row = m_gameList->indexAt(pos).row(); - QTableWidgetItem* item = m_gameList->item(row, GUI::COLUMN_ICON); + QTableWidgetItem* item = m_gameList->item(row, gui::column_icon); if (item == nullptr) return; // null happens if you are double clicking in dockwidget area on nothing. index = item->data(Qt::UserRole).toInt(); } @@ -752,7 +752,7 @@ bool game_list_frame::Boot(const GameInfo& game) } else { - Q_EMIT RequestAddRecentGame(GUI::Recent_Game(qstr(Emu.GetBoot()), qstr("[" + game.serial + "] " + game.name))); + Q_EMIT RequestAddRecentGame(gui::Recent_Game(qstr(Emu.GetBoot()), qstr("[" + game.serial + "] " + game.name))); Refresh(true); return true; } @@ -851,13 +851,13 @@ void game_list_frame::RepaintIcons(const bool& fromSettings) { if (fromSettings) { - if (xgui_settings->GetValue(GUI::m_enableUIColors).toBool()) + if (xgui_settings->GetValue(gui::m_enableUIColors).toBool()) { - m_Icon_Color = xgui_settings->GetValue(GUI::gl_iconColor).value(); + m_Icon_Color = xgui_settings->GetValue(gui::gl_iconColor).value(); } else { - m_Icon_Color = GUI::get_Label_Color("gamelist_icon_background_color"); + m_Icon_Color = gui::get_Label_Color("gamelist_icon_background_color"); } } @@ -879,7 +879,7 @@ void game_list_frame::SetListMode(const bool& isList) m_oldLayoutIsList = m_isListLayout; m_isListLayout = isList; - xgui_settings->SetValue(GUI::gl_listMode, isList); + xgui_settings->SetValue(gui::gl_listMode, isList); m_categoryActs->setEnabled(isList); m_modeActList.action->setIcon(m_isListLayout ? m_modeActList.colored : m_modeActList.gray); @@ -894,7 +894,7 @@ void game_list_frame::SetToolBarVisible(const bool& showToolBar) { m_showToolBar = showToolBar; m_Tool_Bar->setVisible(showToolBar); - xgui_settings->SetValue(GUI::gl_toolBarVisible, showToolBar); + xgui_settings->SetValue(gui::gl_toolBarVisible, showToolBar); } bool game_list_frame::GetToolBarVisible() { @@ -917,18 +917,18 @@ void game_list_frame::RepaintToolBarIcons() { QColor newColor; - if (xgui_settings->GetValue(GUI::m_enableUIColors).toBool()) + if (xgui_settings->GetValue(gui::m_enableUIColors).toBool()) { - newColor = xgui_settings->GetValue(GUI::gl_toolIconColor).value(); + newColor = xgui_settings->GetValue(gui::gl_toolIconColor).value(); } else { - newColor = GUI::get_Label_Color("gamelist_toolbar_icon_color"); + newColor = gui::get_Label_Color("gamelist_toolbar_icon_color"); } auto icon = [&newColor](const QString& path, bool mask = false) { - return gui_settings::colorizedIcon(QIcon(path), GUI::gl_tool_icon_color, newColor, mask); + return gui_settings::colorizedIcon(QIcon(path), gui::gl_tool_icon_color, newColor, mask); }; m_catActHDD.colored = icon(":/Icons/hdd_blue.png", true); @@ -980,6 +980,7 @@ bool game_list_frame::eventFilter(QObject *object, QEvent *event) { QPoint numSteps = wheelEvent->angleDelta() / 8 / 15; // http://doc.qt.io/qt-5/qwheelevent.html#pixelDelta const int value = numSteps.y(); + Q_EMIT RequestSaveSliderPos(true); m_Slider_Size->setValue(m_Slider_Size->value() + value); return true; } @@ -992,11 +993,13 @@ bool game_list_frame::eventFilter(QObject *object, QEvent *event) { if (keyEvent->key() == Qt::Key_Plus) { + Q_EMIT RequestSaveSliderPos(true); m_Slider_Size->setValue(m_Slider_Size->value() + 1); return true; } else if (keyEvent->key() == Qt::Key_Minus) { + Q_EMIT RequestSaveSliderPos(true); m_Slider_Size->setValue(m_Slider_Size->value() - 1); return true; } @@ -1020,7 +1023,7 @@ int game_list_frame::PopulateGameList() auto l_GetItem = [](const std::string& text) { // force single line text ("hack" used instead of Qt shenanigans like Qt::TextSingleLine) - QString formattedText = GUI::get_Single_Line(qstr(text)); + QString formattedText = gui::get_Single_Line(qstr(text)); QTableWidgetItem* curr = new QTableWidgetItem; curr->setFlags(curr->flags() & ~Qt::ItemIsEditable); @@ -1050,16 +1053,16 @@ int game_list_frame::PopulateGameList() title_item->setIcon(QIcon(":/Icons/cog_black.png")); } - m_gameList->setItem(row, GUI::COLUMN_ICON, icon_item); - m_gameList->setItem(row, GUI::COLUMN_NAME, title_item); - m_gameList->setItem(row, GUI::COLUMN_SERIAL, l_GetItem(game.info.serial)); - m_gameList->setItem(row, GUI::COLUMN_FIRMWARE, l_GetItem(game.info.fw)); - m_gameList->setItem(row, GUI::COLUMN_VERSION, l_GetItem(game.info.app_ver)); - m_gameList->setItem(row, GUI::COLUMN_CATEGORY, l_GetItem(game.info.category)); - m_gameList->setItem(row, GUI::COLUMN_PATH, l_GetItem(game.info.path)); - m_gameList->setItem(row, GUI::COLUMN_RESOLUTION, l_GetItem(GetStringFromU32(game.info.resolution, resolution::mode, true))); - m_gameList->setItem(row, GUI::COLUMN_SOUND, l_GetItem(GetStringFromU32(game.info.sound_format, sound::format, true))); - m_gameList->setItem(row, GUI::COLUMN_PARENTAL, l_GetItem(GetStringFromU32(game.info.parental_lvl, parental::level))); + m_gameList->setItem(row, gui::column_icon, icon_item); + m_gameList->setItem(row, gui::column_name, title_item); + m_gameList->setItem(row, gui::column_serial, l_GetItem(game.info.serial)); + m_gameList->setItem(row, gui::column_firmware, l_GetItem(game.info.fw)); + m_gameList->setItem(row, gui::column_version, l_GetItem(game.info.app_ver)); + m_gameList->setItem(row, gui::column_category, l_GetItem(game.info.category)); + m_gameList->setItem(row, gui::column_path, l_GetItem(game.info.path)); + m_gameList->setItem(row, gui::column_resolution, l_GetItem(GetStringFromU32(game.info.resolution, resolution::mode, true))); + m_gameList->setItem(row, gui::column_sound, l_GetItem(GetStringFromU32(game.info.sound_format, sound::format, true))); + m_gameList->setItem(row, gui::column_parental, l_GetItem(GetStringFromU32(game.info.parental_lvl, parental::level))); if (selected_item == game.info.icon_path) result = row; @@ -1080,9 +1083,9 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size, co m_xgrid->deleteLater(); - bool showText = m_icon_size_index > GUI::gl_max_slider_pos * 2 / 5; + bool showText = m_icon_size_index > gui::gl_max_slider_pos * 2 / 5; - if (m_icon_size_index < GUI::gl_max_slider_pos * 2 / 3) + if (m_icon_size_index < gui::gl_max_slider_pos * 2 / 3) { m_xgrid = new game_list_grid(image_size, image_color, m_Margin_Factor, m_Text_Factor * 2, showText); } @@ -1125,7 +1128,7 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size, co for (const auto& app : matching_apps) { - QString title = GUI::get_Single_Line(qstr(app.first->info.name)); + QString title = gui::get_Single_Line(qstr(app.first->info.name)); m_xgrid->addItem(app.first->pxmap, title, app.second, r, c); diff --git a/rpcs3/rpcs3qt/game_list_grid.cpp b/rpcs3/rpcs3qt/game_list_grid.cpp index 147b17e0d5..50d0f1f4c3 100644 --- a/rpcs3/rpcs3qt/game_list_grid.cpp +++ b/rpcs3/rpcs3qt/game_list_grid.cpp @@ -20,8 +20,8 @@ game_list_grid::game_list_grid(const QSize& icon_size, const QColor& icon_color, } // font by stylesheet - QFont font = GUI::get_Label_Font("gamegrid_font"); - QColor font_color = GUI::get_Label_Color("gamegrid_font"); + QFont font = gui::get_Label_Font("gamegrid_font"); + QColor font_color = gui::get_Label_Color("gamegrid_font"); grid_item_delegate = new game_list_grid_delegate(item_size, m_margin_factor, m_text_factor, font, font_color, this); setItemDelegate(grid_item_delegate); diff --git a/rpcs3/rpcs3qt/gui_settings.cpp b/rpcs3/rpcs3qt/gui_settings.cpp index 7f946ac323..625fe8e492 100644 --- a/rpcs3/rpcs3qt/gui_settings.cpp +++ b/rpcs3/rpcs3qt/gui_settings.cpp @@ -53,13 +53,13 @@ void gui_settings::Reset(bool removeMeta) } else { - m_settings.remove(GUI::logger); - m_settings.remove(GUI::main_window); - m_settings.remove(GUI::game_list); + m_settings.remove(gui::logger); + m_settings.remove(gui::main_window); + m_settings.remove(gui::game_list); } } -QVariant gui_settings::GetValue(const GUI_SAVE& entry) +QVariant gui_settings::GetValue(const gui_save& entry) { return m_settings.value(entry.key + "/" + entry.name, entry.def); } @@ -180,7 +180,7 @@ QImage gui_settings::GetOpaqueImageArea(const QString& path) return image.copy(QRect(QPoint(w_max, h_max), QPoint(w_min, h_min))); } -void gui_settings::SetValue(const GUI_SAVE& entry, const QVariant& value) +void gui_settings::SetValue(const gui_save& entry, const QVariant& value) { m_settings.beginGroup(entry.key); m_settings.setValue(entry.name, value); @@ -202,24 +202,24 @@ QStringList gui_settings::GetGameListCategoryFilters() bool gui_settings::GetCategoryVisibility(int cat) { - GUI_SAVE value; + gui_save value; switch (cat) { case Category::Non_Disc_Game: - value = GUI::cat_hdd_game; break; + value = gui::cat_hdd_game; break; case Category::Disc_Game: - value = GUI::cat_disc_game; break; + value = gui::cat_disc_game; break; case Category::Home: - value = GUI::cat_home; break; + value = gui::cat_home; break; case Category::Media: - value = GUI::cat_audio_video; break; + value = gui::cat_audio_video; break; case Category::Data: - value = GUI::cat_game_data; break; + value = gui::cat_game_data; break; case Category::Unknown_Cat: - value = GUI::cat_unknown; break; + value = gui::cat_unknown; break; case Category::Others: - value = GUI::cat_other; break; + value = gui::cat_other; break; default: LOG_WARNING(GENERAL, "GetCategoryVisibility: wrong cat <%d>", cat); break; @@ -230,24 +230,24 @@ bool gui_settings::GetCategoryVisibility(int cat) void gui_settings::SetCategoryVisibility(int cat, const bool& val) { - GUI_SAVE value; + gui_save value; switch (cat) { case Category::Non_Disc_Game: - value = GUI::cat_hdd_game; break; + value = gui::cat_hdd_game; break; case Category::Disc_Game: - value = GUI::cat_disc_game; break; + value = gui::cat_disc_game; break; case Category::Home: - value = GUI::cat_home; break; + value = gui::cat_home; break; case Category::Media: - value = GUI::cat_audio_video; break; + value = gui::cat_audio_video; break; case Category::Data: - value = GUI::cat_game_data; break; + value = gui::cat_game_data; break; case Category::Unknown_Cat: - value = GUI::cat_unknown; break; + value = gui::cat_unknown; break; case Category::Others: - value = GUI::cat_other; break; + value = gui::cat_other; break; default: LOG_WARNING(GENERAL, "SetCategoryVisibility: wrong cat <%d>", cat); break; @@ -256,7 +256,7 @@ void gui_settings::SetCategoryVisibility(int cat, const bool& val) SetValue(value, val); } -void gui_settings::ShowInfoBox(const GUI_SAVE& entry, const QString& title, const QString& text, QWidget* parent) +void gui_settings::ShowInfoBox(const gui_save& entry, const QString& title, const QString& text, QWidget* parent) { if (GetValue(entry).toBool()) { @@ -278,35 +278,35 @@ void gui_settings::SetGamelistColVisibility(int col, bool val) { // hide sound format and parental level bool show = col != 8 && col != 9; - SetValue(GUI_SAVE(GUI::game_list, "Col" + QString::number(col) + "visible", show), val); + SetValue(gui_save(gui::game_list, "Col" + QString::number(col) + "visible", show), val); } void gui_settings::SetCustomColor(int col, const QColor& val) { - SetValue(GUI_SAVE(GUI::meta, "CustomColor" + QString::number(col), GUI::mw_tool_bar_color), val); + SetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::mw_tool_bar_color), val); } void gui_settings::SaveCurrentConfig(const QString& friendlyName) { - SetValue(GUI::m_currentConfig, friendlyName); + SetValue(gui::m_currentConfig, friendlyName); BackupSettingsToTarget(friendlyName); } logs::level gui_settings::GetLogLevel() { - return (logs::level) GetValue(GUI::l_level).toUInt(); + return (logs::level) GetValue(gui::l_level).toUInt(); } bool gui_settings::GetGamelistColVisibility(int col) { // hide sound format and parental level - bool show = col != GUI::COLUMN_SOUND && col != GUI::COLUMN_PARENTAL; - return GetValue(GUI_SAVE(GUI::game_list, "Col" + QString::number(col) + "visible", show)).toBool(); + bool show = col != gui::column_sound && col != gui::column_parental; + return GetValue(gui_save(gui::game_list, "Col" + QString::number(col) + "visible", show)).toBool(); } QColor gui_settings::GetCustomColor(int col) { - return GetValue(GUI_SAVE(GUI::meta, "CustomColor" + QString::number(col), GUI::mw_tool_bar_color)).value(); + return GetValue(gui_save(gui::meta, "CustomColor" + QString::number(col), gui::mw_tool_bar_color)).value(); } QStringList gui_settings::GetConfigEntries() @@ -329,7 +329,7 @@ void gui_settings::BackupSettingsToTarget(const QString& friendlyName) QStringList keys = m_settings.allKeys(); for (QStringList::iterator i = keys.begin(); i != keys.end(); i++) { - if (!i->startsWith(GUI::meta)) + if (!i->startsWith(gui::meta)) { target.setValue(*i, m_settings.value(*i)); } @@ -354,9 +354,9 @@ QStringList gui_settings::GetStylesheetEntries() QString gui_settings::GetCurrentStylesheetPath() { - QString stylesheet = GetValue(GUI::m_currentStylesheet).toString(); + QString stylesheet = GetValue(gui::m_currentStylesheet).toString(); - if (stylesheet == GUI::Default) + if (stylesheet == gui::Default) { return ""; } diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index b23d032db8..2fd81dc837 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -10,20 +10,20 @@ #include #include -struct GUI_SAVE +struct gui_save { QString key; QString name; QVariant def; - GUI_SAVE() + gui_save() { key = ""; name = ""; def = QVariant(); }; - GUI_SAVE(const QString& k, const QString& n, const QVariant& d) + gui_save(const QString& k, const QString& n, const QVariant& d) { key = k; name = n; @@ -37,24 +37,24 @@ typedef QPair q_size_pair; typedef QList q_pair_list; typedef QList q_size_list; -namespace GUI +namespace gui { static QString stylesheet; enum game_list_columns { - COLUMN_ICON, - COLUMN_NAME, - COLUMN_SERIAL, - COLUMN_FIRMWARE, - COLUMN_VERSION, - COLUMN_CATEGORY, - COLUMN_PATH, - COLUMN_RESOLUTION, - COLUMN_SOUND, - COLUMN_PARENTAL, + column_icon, + column_name, + column_serial, + column_firmware, + column_version, + column_category, + column_path, + column_resolution, + column_sound, + column_parental, - COLUMN_COUNT + column_count }; const QSize gl_icon_size_min = QSize(40, 22); @@ -107,6 +107,8 @@ namespace GUI const QString meta = "Meta"; const QString fs = "FileSystem"; const QString gs_frame = "GSFrame"; + const QString trophy = "Trophy"; + const QString savedata = "SaveData"; const QColor gl_icon_color = QColor(209, 209, 209, 255); const QColor gl_tool_icon_color = QColor( 0, 100, 231, 255); @@ -114,71 +116,83 @@ namespace GUI const QColor mw_tool_bar_color = QColor(227, 227, 227, 255); const QColor mw_thumb_icon_color = QColor( 0, 100, 231, 255); - const GUI_SAVE rg_freeze = GUI_SAVE( main_window, "recentGamesFrozen", false); - const GUI_SAVE rg_entries = GUI_SAVE( main_window, "recentGamesNames", QVariant::fromValue(q_pair_list())); + const gui_save rg_freeze = gui_save(main_window, "recentGamesFrozen", false); + const gui_save rg_entries = gui_save(main_window, "recentGamesNames", QVariant::fromValue(q_pair_list())); - const GUI_SAVE ib_pkg_success = GUI_SAVE( main_window, "infoBoxEnabledInstallPKG", true ); - const GUI_SAVE ib_pup_success = GUI_SAVE( main_window, "infoBoxEnabledInstallPUP", true ); - const GUI_SAVE ib_show_welcome = GUI_SAVE( main_window, "infoBoxEnabledWelcome", true ); + const gui_save ib_pkg_success = gui_save(main_window, "infoBoxEnabledInstallPKG", true ); + const gui_save ib_pup_success = gui_save(main_window, "infoBoxEnabledInstallPUP", true ); + const gui_save ib_show_welcome = gui_save(main_window, "infoBoxEnabledWelcome", true ); - const GUI_SAVE fd_install_pkg = GUI_SAVE( main_window, "lastExplorePathPKG", "" ); - const GUI_SAVE fd_install_pup = GUI_SAVE( main_window, "lastExplorePathPUP", "" ); - const GUI_SAVE fd_boot_elf = GUI_SAVE( main_window, "lastExplorePathELF", "" ); - const GUI_SAVE fd_boot_game = GUI_SAVE( main_window, "lastExplorePathGAME", "" ); - const GUI_SAVE fd_decrypt_sprx = GUI_SAVE( main_window, "lastExplorePathSPRX", "" ); - const GUI_SAVE fd_cg_disasm = GUI_SAVE( main_window, "lastExplorePathCGD", "" ); + const gui_save fd_install_pkg = gui_save(main_window, "lastExplorePathPKG", "" ); + const gui_save fd_install_pup = gui_save(main_window, "lastExplorePathPUP", "" ); + const gui_save fd_boot_elf = gui_save(main_window, "lastExplorePathELF", "" ); + const gui_save fd_boot_game = gui_save(main_window, "lastExplorePathGAME", "" ); + const gui_save fd_decrypt_sprx = gui_save(main_window, "lastExplorePathSPRX", "" ); + const gui_save fd_cg_disasm = gui_save(main_window, "lastExplorePathCGD", "" ); - const GUI_SAVE mw_debugger = GUI_SAVE( main_window, "debuggerVisible", false ); - const GUI_SAVE mw_logger = GUI_SAVE( main_window, "loggerVisible", true ); - const GUI_SAVE mw_gamelist = GUI_SAVE( main_window, "gamelistVisible", true ); - const GUI_SAVE mw_toolBarVisible = GUI_SAVE( main_window, "toolBarVisible", true ); - const GUI_SAVE mw_toolBarColor = GUI_SAVE( main_window, "toolBarColor", mw_tool_bar_color); - const GUI_SAVE mw_toolIconColor = GUI_SAVE( main_window, "toolIconColor", mw_tool_icon_color); - const GUI_SAVE mw_geometry = GUI_SAVE( main_window, "geometry", QByteArray() ); - const GUI_SAVE mw_windowState = GUI_SAVE( main_window, "windowState", QByteArray() ); - const GUI_SAVE mw_mwState = GUI_SAVE( main_window, "wwState", QByteArray() ); + const gui_save mw_debugger = gui_save(main_window, "debuggerVisible", false ); + const gui_save mw_logger = gui_save(main_window, "loggerVisible", true ); + const gui_save mw_gamelist = gui_save(main_window, "gamelistVisible", true ); + const gui_save mw_toolBarVisible = gui_save(main_window, "toolBarVisible", true ); + const gui_save mw_toolBarColor = gui_save(main_window, "toolBarColor", mw_tool_bar_color); + const gui_save mw_toolIconColor = gui_save(main_window, "toolIconColor", mw_tool_icon_color); + const gui_save mw_geometry = gui_save(main_window, "geometry", QByteArray() ); + const gui_save mw_windowState = gui_save(main_window, "windowState", QByteArray() ); + const gui_save mw_mwState = gui_save(main_window, "wwState", QByteArray() ); - const GUI_SAVE cat_hdd_game = GUI_SAVE( game_list, "categoryVisibleHDDGame", true ); - const GUI_SAVE cat_disc_game = GUI_SAVE( game_list, "categoryVisibleDiscGame", true ); - const GUI_SAVE cat_home = GUI_SAVE( game_list, "categoryVisibleHome", true ); - const GUI_SAVE cat_audio_video = GUI_SAVE( game_list, "categoryVisibleAudioVideo", true ); - const GUI_SAVE cat_game_data = GUI_SAVE( game_list, "categoryVisibleGameData", false ); - const GUI_SAVE cat_unknown = GUI_SAVE( game_list, "categoryVisibleUnknown", true ); - const GUI_SAVE cat_other = GUI_SAVE( game_list, "categoryVisibleOther", true ); + const gui_save cat_hdd_game = gui_save(game_list, "categoryVisibleHDDGame", true ); + const gui_save cat_disc_game = gui_save(game_list, "categoryVisibleDiscGame", true ); + const gui_save cat_home = gui_save(game_list, "categoryVisibleHome", true ); + const gui_save cat_audio_video = gui_save(game_list, "categoryVisibleAudioVideo", true ); + const gui_save cat_game_data = gui_save(game_list, "categoryVisibleGameData", false ); + const gui_save cat_unknown = gui_save(game_list, "categoryVisibleUnknown", true ); + const gui_save cat_other = gui_save(game_list, "categoryVisibleOther", true ); - const GUI_SAVE gl_sortAsc = GUI_SAVE( game_list, "sortAsc", true ); - const GUI_SAVE gl_sortCol = GUI_SAVE( game_list, "sortCol", 1 ); - const GUI_SAVE gl_state = GUI_SAVE( game_list, "state", QByteArray() ); - const GUI_SAVE gl_iconSize = GUI_SAVE( game_list, "iconSize", get_Index(gl_icon_size_small)); - const GUI_SAVE gl_iconColor = GUI_SAVE( game_list, "iconColor", gl_icon_color); - const GUI_SAVE gl_listMode = GUI_SAVE( game_list, "listMode", true ); - const GUI_SAVE gl_textFactor = GUI_SAVE( game_list, "textFactor", (qreal) 2.0 ); - const GUI_SAVE gl_marginFactor = GUI_SAVE( game_list, "marginFactor", (qreal) 0.09 ); - const GUI_SAVE gl_toolBarVisible = GUI_SAVE( game_list, "toolBarVisible", false); - const GUI_SAVE gl_toolIconColor = GUI_SAVE( game_list, "toolIconColor", gl_tool_icon_color); + const gui_save gl_sortAsc = gui_save(game_list, "sortAsc", true ); + const gui_save gl_sortCol = gui_save(game_list, "sortCol", 1 ); + const gui_save gl_state = gui_save(game_list, "state", QByteArray() ); + const gui_save gl_iconSize = gui_save(game_list, "iconSize", get_Index(gl_icon_size_small)); + const gui_save gl_iconColor = gui_save(game_list, "iconColor", gl_icon_color); + const gui_save gl_listMode = gui_save(game_list, "listMode", true ); + const gui_save gl_textFactor = gui_save(game_list, "textFactor", (qreal) 2.0 ); + const gui_save gl_marginFactor = gui_save(game_list, "marginFactor", (qreal) 0.09 ); + const gui_save gl_toolBarVisible = gui_save(game_list, "toolBarVisible", false); + const gui_save gl_toolIconColor = gui_save(game_list, "toolIconColor", gl_tool_icon_color); - const GUI_SAVE fs_emulator_dir_list = GUI_SAVE( fs, "emulator_dir_list", QStringList()); - const GUI_SAVE fs_dev_hdd0_list = GUI_SAVE( fs, "dev_hdd0_list", QStringList()); - const GUI_SAVE fs_dev_hdd1_list = GUI_SAVE( fs, "dev_hdd1_list", QStringList()); - const GUI_SAVE fs_dev_flash_list = GUI_SAVE( fs, "dev_flash_list", QStringList()); - const GUI_SAVE fs_dev_usb000_list = GUI_SAVE( fs, "dev_usb000_list", QStringList()); + const gui_save fs_emulator_dir_list = gui_save(fs, "emulator_dir_list", QStringList()); + const gui_save fs_dev_hdd0_list = gui_save(fs, "dev_hdd0_list", QStringList()); + const gui_save fs_dev_hdd1_list = gui_save(fs, "dev_hdd1_list", QStringList()); + const gui_save fs_dev_flash_list = gui_save(fs, "dev_flash_list", QStringList()); + const gui_save fs_dev_usb000_list = gui_save(fs, "dev_usb000_list", QStringList()); - const GUI_SAVE l_tty = GUI_SAVE( logger, "TTY", true ); - const GUI_SAVE l_level = GUI_SAVE( logger, "level", (uint)(logs::level::success) ); - const GUI_SAVE l_stack = GUI_SAVE( logger, "stack", false ); + const gui_save l_tty = gui_save(logger, "TTY", true ); + const gui_save l_level = gui_save(logger, "level", (uint)(logs::level::success) ); + const gui_save l_stack = gui_save(logger, "stack", false ); - const GUI_SAVE d_splitterState = GUI_SAVE( debugger, "splitterState", QByteArray()); + const gui_save d_splitterState = gui_save(debugger, "splitterState", QByteArray()); - const GUI_SAVE m_currentConfig = GUI_SAVE( meta, "currentConfig", QObject::tr("CurrentSettings")); - const GUI_SAVE m_currentStylesheet = GUI_SAVE( meta, "currentStylesheet", Default); - const GUI_SAVE m_saveNotes = GUI_SAVE( meta, "saveNotes", QVariantMap()); - const GUI_SAVE m_showDebugTab = GUI_SAVE( meta, "showDebugTab", false); - const GUI_SAVE m_enableUIColors = GUI_SAVE( meta, "enableUIColors", false); + const gui_save m_currentConfig = gui_save(meta, "currentConfig", QObject::tr("CurrentSettings")); + const gui_save m_currentStylesheet = gui_save(meta, "currentStylesheet", Default); + const gui_save m_saveNotes = gui_save(meta, "saveNotes", QVariantMap()); + const gui_save m_showDebugTab = gui_save(meta, "showDebugTab", false); + const gui_save m_enableUIColors = gui_save(meta, "enableUIColors", false); - const GUI_SAVE gs_disableMouse = GUI_SAVE( gs_frame, "disableMouse", false); - const GUI_SAVE gs_resize = GUI_SAVE( gs_frame, "resize", false); - const GUI_SAVE gs_width = GUI_SAVE( gs_frame, "width", 1280); - const GUI_SAVE gs_height = GUI_SAVE( gs_frame, "height", 720); + const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false); + const gui_save gs_resize = gui_save(gs_frame, "resize", false); + const gui_save gs_width = gui_save(gs_frame, "width", 1280); + const gui_save gs_height = gui_save(gs_frame, "height", 720); + + const gui_save tr_icon_height = gui_save(trophy, "icon_height", 75); + const gui_save tr_show_locked = gui_save(trophy, "show_locked", true); + const gui_save tr_show_unlocked = gui_save(trophy, "show_unlocked", true); + const gui_save tr_show_hidden = gui_save(trophy, "show_hidden", false); + const gui_save tr_show_bronze = gui_save(trophy, "show_bronze", true); + const gui_save tr_show_silver = gui_save(trophy, "show_silver", true); + const gui_save tr_show_gold = gui_save(trophy, "show_gold", true); + const gui_save tr_show_platinum = gui_save(trophy, "show_platinum", true); + const gui_save tr_geometry = gui_save(trophy, "geometry", QByteArray()); + + const gui_save sd_geometry = gui_save(savedata, "geometry", QByteArray()); } /** Class for GUI settings.. @@ -197,11 +211,11 @@ public: void ChangeToConfig(const QString& destination); bool GetCategoryVisibility(int cat); - QVariant GetValue(const GUI_SAVE& entry); + QVariant GetValue(const gui_save& entry); QVariant List2Var(const q_pair_list& list); q_pair_list Var2List(const QVariant &var); - void ShowInfoBox(const GUI_SAVE& entry, const QString& title, const QString& text, QWidget* parent = 0); + void ShowInfoBox(const gui_save& entry, const QString& title, const QString& text, QWidget* parent = 0); logs::level GetLogLevel(); bool GetGamelistColVisibility(int col); @@ -226,7 +240,7 @@ public Q_SLOTS: void Reset(bool removeMeta = false); /** Write value to entry */ - void SetValue(const GUI_SAVE& entry, const QVariant& value); + void SetValue(const gui_save& entry, const QVariant& value); /** Sets the visibility of the chosen category. */ void SetCategoryVisibility(int cat, const bool& val); diff --git a/rpcs3/rpcs3qt/log_frame.cpp b/rpcs3/rpcs3qt/log_frame.cpp index 6fdce76f0e..8ee5a92813 100644 --- a/rpcs3/rpcs3qt/log_frame.cpp +++ b/rpcs3/rpcs3qt/log_frame.cpp @@ -193,7 +193,7 @@ void log_frame::CreateAndConnectActions() connect(act, &QAction::triggered, [this, logLevel]() { s_gui_listener.enabled = std::max(logLevel, logs::level::fatal); - xgui_settings->SetValue(GUI::l_level, static_cast(logLevel)); + xgui_settings->SetValue(gui::l_level, static_cast(logLevel)); }); }; @@ -219,7 +219,7 @@ void log_frame::CreateAndConnectActions() m_stackAct->setCheckable(true); connect(m_stackAct, &QAction::toggled, xgui_settings.get(), [=](bool checked) { - xgui_settings->SetValue(GUI::l_stack, checked); + xgui_settings->SetValue(gui::l_stack, checked); m_stack_log = checked; }); @@ -227,7 +227,7 @@ void log_frame::CreateAndConnectActions() m_TTYAct->setCheckable(true); connect(m_TTYAct, &QAction::triggered, xgui_settings.get(), [=](bool checked) { - xgui_settings->SetValue(GUI::l_tty, checked); + xgui_settings->SetValue(gui::l_tty, checked); }); l_initAct(m_nothingAct, logs::level::fatal); @@ -265,8 +265,8 @@ void log_frame::CreateAndConnectActions() void log_frame::LoadSettings() { SetLogLevel(xgui_settings->GetLogLevel()); - SetTTYLogging(xgui_settings->GetValue(GUI::l_tty).toBool()); - m_stack_log = xgui_settings->GetValue(GUI::l_stack).toBool(); + SetTTYLogging(xgui_settings->GetValue(gui::l_tty).toBool()); + m_stack_log = xgui_settings->GetValue(gui::l_stack).toBool(); m_stackAct->setChecked(m_stack_log); } @@ -275,18 +275,18 @@ void log_frame::RepaintTextColors() { // Get text color. Do this once to prevent possible slowdown m_color.clear(); - m_color.append(GUI::get_Label_Color("log_level_always")); - m_color.append(GUI::get_Label_Color("log_level_fatal")); - m_color.append(GUI::get_Label_Color("log_level_error")); - m_color.append(GUI::get_Label_Color("log_level_todo")); - m_color.append(GUI::get_Label_Color("log_level_success")); - m_color.append(GUI::get_Label_Color("log_level_warning")); - m_color.append(GUI::get_Label_Color("log_level_notice")); - m_color.append(GUI::get_Label_Color("log_level_trace")); + m_color.append(gui::get_Label_Color("log_level_always")); + m_color.append(gui::get_Label_Color("log_level_fatal")); + m_color.append(gui::get_Label_Color("log_level_error")); + m_color.append(gui::get_Label_Color("log_level_todo")); + m_color.append(gui::get_Label_Color("log_level_success")); + m_color.append(gui::get_Label_Color("log_level_warning")); + m_color.append(gui::get_Label_Color("log_level_notice")); + m_color.append(gui::get_Label_Color("log_level_trace")); - m_color_stack = GUI::get_Label_Color("log_stack"); + m_color_stack = gui::get_Label_Color("log_stack"); - m_tty->setTextColor(GUI::get_Label_Color("tty_text")); + m_tty->setTextColor(gui::get_Label_Color("tty_text")); } void log_frame::UpdateUI() diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 6d10aa87fc..848f226425 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -77,12 +77,12 @@ void main_window::Init() setAcceptDrops(true); // hide utilities from the average user - ui->menuUtilities->menuAction()->setVisible(guiSettings->GetValue(GUI::m_showDebugTab).toBool()); + ui->menuUtilities->menuAction()->setVisible(guiSettings->GetValue(gui::m_showDebugTab).toBool()); // add toolbar widgets (crappy Qt designer is not able to) ui->toolBar->setObjectName("mw_toolbar"); - ui->sizeSlider->setRange(0, GUI::gl_max_slider_pos); - ui->sizeSlider->setSliderPosition(guiSettings->GetValue(GUI::gl_iconSize).toInt()); + ui->sizeSlider->setRange(0, gui::gl_max_slider_pos); + ui->sizeSlider->setSliderPosition(guiSettings->GetValue(gui::gl_iconSize).toInt()); ui->toolBar->addWidget(ui->sizeSliderContainer); ui->toolBar->addSeparator(); ui->toolBar->addWidget(ui->mw_searchbar); @@ -245,7 +245,7 @@ void main_window::BootElf() stopped = true; } - QString path_last_ELF = guiSettings->GetValue(GUI::fd_boot_elf).toString(); + QString path_last_ELF = guiSettings->GetValue(gui::fd_boot_elf).toString(); QString filePath = QFileDialog::getOpenFileName(this, tr("Select (S)ELF To Boot"), path_last_ELF, tr( "(S)ELF files (*BOOT.BIN *.elf *.self);;" "ELF files (BOOT.BIN *.elf);;" @@ -266,7 +266,7 @@ void main_window::BootElf() // If we resolved the filepath earlier we would end up setting the last opened dir to the unwanted // game folder in case of having e.g. a Game Folder with collected links to elf files. // Don't set last path earlier in case of cancelled dialog - guiSettings->SetValue(GUI::fd_boot_elf, filePath); + guiSettings->SetValue(gui::fd_boot_elf, filePath); const std::string path = sstr(QFileInfo(filePath).canonicalFilePath()); SetAppIconFromPath(path); @@ -281,7 +281,7 @@ void main_window::BootElf() LOG_SUCCESS(LOADER, "(S)ELF: boot done."); const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] "; - AddRecentAction(GUI::Recent_Game(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle()))); + AddRecentAction(gui::Recent_Game(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle()))); m_gameListFrame->Refresh(true); } } @@ -296,7 +296,7 @@ void main_window::BootGame() stopped = true; } - QString path_last_Game = guiSettings->GetValue(GUI::fd_boot_game).toString(); + QString path_last_Game = guiSettings->GetValue(gui::fd_boot_game).toString(); QString dirPath = QFileDialog::getExistingDirectory(this, tr("Select Game Folder"), path_last_Game, QFileDialog::ShowDirsOnly); if (dirPath == NULL) @@ -305,7 +305,7 @@ void main_window::BootGame() return; } Emu.Stop(); - guiSettings->SetValue(GUI::fd_boot_game, QFileInfo(dirPath).path()); + guiSettings->SetValue(gui::fd_boot_game, QFileInfo(dirPath).path()); const std::string path = sstr(dirPath); SetAppIconFromPath(path); @@ -318,7 +318,7 @@ void main_window::BootGame() LOG_SUCCESS(LOADER, "Boot Game: boot done."); const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] "; - AddRecentAction(GUI::Recent_Game(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle()))); + AddRecentAction(gui::Recent_Game(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle()))); m_gameListFrame->Refresh(true); } } @@ -329,7 +329,7 @@ void main_window::InstallPkg(const QString& dropPath) if (filePath.isEmpty()) { - QString path_last_PKG = guiSettings->GetValue(GUI::fd_install_pkg).toString(); + QString path_last_PKG = guiSettings->GetValue(gui::fd_install_pkg).toString(); filePath = QFileDialog::getOpenFileName(this, tr("Select PKG To Install"), path_last_PKG, tr("PKG files (*.pkg);;All files (*.*)")); } else @@ -348,7 +348,7 @@ void main_window::InstallPkg(const QString& dropPath) } Emu.Stop(); - guiSettings->SetValue(GUI::fd_install_pkg, QFileInfo(filePath).path()); + guiSettings->SetValue(gui::fd_install_pkg, QFileInfo(filePath).path()); const std::string fileName = sstr(QFileInfo(filePath).fileName()); const std::string path = sstr(filePath); @@ -470,7 +470,7 @@ void main_window::InstallPkg(const QString& dropPath) { m_gameListFrame->Refresh(true); LOG_SUCCESS(GENERAL, "Successfully installed %s.", fileName); - guiSettings->ShowInfoBox(GUI::ib_pkg_success, tr("Success!"), tr("Successfully installed software from package!"), this); + guiSettings->ShowInfoBox(gui::ib_pkg_success, tr("Success!"), tr("Successfully installed software from package!"), this); #ifdef _WIN32 taskbar_progress->hide(); @@ -485,7 +485,7 @@ void main_window::InstallPup(const QString& dropPath) if (filePath.isEmpty()) { - QString path_last_PUP = guiSettings->GetValue(GUI::fd_install_pup).toString(); + QString path_last_PUP = guiSettings->GetValue(gui::fd_install_pup).toString(); filePath = QFileDialog::getOpenFileName(this, tr("Select PS3UPDAT.PUP To Install"), path_last_PUP, tr("PS3 update file (PS3UPDAT.PUP)")); } else @@ -505,7 +505,7 @@ void main_window::InstallPup(const QString& dropPath) Emu.Stop(); - guiSettings->SetValue(GUI::fd_install_pup, QFileInfo(filePath).path()); + guiSettings->SetValue(gui::fd_install_pup, QFileInfo(filePath).path()); const std::string path = sstr(filePath); fs::file pup_f(path); @@ -625,7 +625,7 @@ void main_window::InstallPup(const QString& dropPath) if (progress > 0) { LOG_SUCCESS(GENERAL, "Successfully installed PS3 firmware version %s.", version_string); - guiSettings->ShowInfoBox(GUI::ib_pup_success, tr("Success!"), tr("Successfully installed PS3 firmware and LLE Modules!"), this); + guiSettings->ShowInfoBox(gui::ib_pup_success, tr("Success!"), tr("Successfully installed PS3 firmware and LLE Modules!"), this); #ifdef _WIN32 taskbar_progress->hide(); @@ -639,7 +639,7 @@ extern void sysutil_send_system_cmd(u64 status, u64 param); void main_window::DecryptSPRXLibraries() { - QString path_last_SPRX = guiSettings->GetValue(GUI::fd_decrypt_sprx).toString(); + QString path_last_SPRX = guiSettings->GetValue(gui::fd_decrypt_sprx).toString(); QStringList modules = QFileDialog::getOpenFileNames(this, tr("Select SPRX files"), path_last_SPRX, tr("SPRX files (*.sprx)")); if (modules.isEmpty()) @@ -649,7 +649,7 @@ void main_window::DecryptSPRXLibraries() Emu.Stop(); - guiSettings->SetValue(GUI::fd_decrypt_sprx, QFileInfo(modules.first()).path()); + guiSettings->SetValue(gui::fd_decrypt_sprx, QFileInfo(modules.first()).path()); LOG_NOTICE(GENERAL, "Decrypting SPRX libraries..."); @@ -697,9 +697,9 @@ void main_window::DecryptSPRXLibraries() void main_window::SaveWindowState() { // Save gui settings - guiSettings->SetValue(GUI::mw_geometry, saveGeometry()); - guiSettings->SetValue(GUI::mw_windowState, saveState()); - guiSettings->SetValue(GUI::mw_mwState, m_mw->saveState()); + guiSettings->SetValue(gui::mw_geometry, saveGeometry()); + guiSettings->SetValue(gui::mw_windowState, saveState()); + guiSettings->SetValue(gui::mw_mwState, m_mw->saveState()); // Save column settings m_gameListFrame->SaveSettings(); @@ -709,11 +709,11 @@ void main_window::SaveWindowState() void main_window::RepaintThumbnailIcons() { - QColor newColor = GUI::get_Label_Color("thumbnail_icon_color"); + QColor newColor = gui::get_Label_Color("thumbnail_icon_color"); auto icon = [&newColor](const QString& path) { - return gui_settings::colorizedIcon(QPixmap::fromImage(gui_settings::GetOpaqueImageArea(path)), GUI::mw_tool_icon_color, newColor); + return gui_settings::colorizedIcon(QPixmap::fromImage(gui_settings::GetOpaqueImageArea(path)), gui::mw_tool_icon_color, newColor); }; #ifdef _WIN32 @@ -734,18 +734,18 @@ void main_window::RepaintToolBarIcons() { QColor newColor; - if (guiSettings->GetValue(GUI::m_enableUIColors).toBool()) + if (guiSettings->GetValue(gui::m_enableUIColors).toBool()) { - newColor = guiSettings->GetValue(GUI::mw_toolIconColor).value(); + newColor = guiSettings->GetValue(gui::mw_toolIconColor).value(); } else { - newColor = GUI::get_Label_Color("toolbar_icon_color"); + newColor = gui::get_Label_Color("toolbar_icon_color"); } auto icon = [&newColor](const QString& path) { - return gui_settings::colorizedIcon(QIcon(path), GUI::mw_tool_icon_color, newColor); + return gui_settings::colorizedIcon(QIcon(path), gui::mw_tool_icon_color, newColor); }; m_icon_play = icon(":/Icons/play.png"); @@ -938,7 +938,7 @@ void main_window::BootRecentAction(const QAction* act) m_rg_entries.removeAt(idx); m_recentGameActs.removeAt(idx); - guiSettings->SetValue(GUI::rg_entries, guiSettings->List2Var(m_rg_entries)); + guiSettings->SetValue(gui::rg_entries, guiSettings->List2Var(m_rg_entries)); LOG_ERROR(GENERAL, "Recent Game not valid, removed from Boot Recent list: %s", sstr(pth)); @@ -971,7 +971,7 @@ void main_window::BootRecentAction(const QAction* act) else { LOG_SUCCESS(LOADER, "Boot from Recent List: done"); - AddRecentAction(GUI::Recent_Game(qstr(Emu.GetBoot()), nam)); + AddRecentAction(gui::Recent_Game(qstr(Emu.GetBoot()), nam)); m_gameListFrame->Refresh(true); } }; @@ -988,7 +988,7 @@ QAction* main_window::CreateRecentAction(const q_string_pair& entry, const uint& int idx = m_rg_entries.indexOf(entry); m_rg_entries.removeAt(idx); - guiSettings->SetValue(GUI::rg_entries, guiSettings->List2Var(m_rg_entries)); + guiSettings->SetValue(gui::rg_entries, guiSettings->List2Var(m_rg_entries)); } return nullptr; } @@ -1073,7 +1073,7 @@ void main_window::AddRecentAction(const q_string_pair& entry) ui->bootRecentMenu->addAction(m_recentGameActs[i]); } - guiSettings->SetValue(GUI::rg_entries, guiSettings->List2Var(m_rg_entries)); + guiSettings->SetValue(gui::rg_entries, guiSettings->List2Var(m_rg_entries)); } void main_window::RepaintGui() @@ -1101,11 +1101,11 @@ void main_window::RepaintGui() void main_window::RepaintToolbar() { - if (guiSettings->GetValue(GUI::m_enableUIColors).toBool()) + if (guiSettings->GetValue(gui::m_enableUIColors).toBool()) { - QColor tbc = guiSettings->GetValue(GUI::mw_toolBarColor).value(); + QColor tbc = guiSettings->GetValue(gui::mw_toolBarColor).value(); - ui->toolBar->setStyleSheet(GUI::stylesheet + QString( + ui->toolBar->setStyleSheet(gui::stylesheet + QString( "QToolBar { background-color: rgba(%1, %2, %3, %4); }" "QToolBar::separator {background-color: rgba(%5, %6, %7, %8); width: 1px; margin-top: 2px; margin-bottom: 2px;}" "QSlider { background-color: rgba(%1, %2, %3, %4); }" @@ -1116,7 +1116,7 @@ void main_window::RepaintToolbar() } else { - ui->toolBar->setStyleSheet(GUI::stylesheet); + ui->toolBar->setStyleSheet(gui::stylesheet); } } @@ -1175,12 +1175,12 @@ void main_window::CreateConnects() ui->bootRecentMenu->removeAction(act); } m_recentGameActs.clear(); - guiSettings->SetValue(GUI::rg_entries, guiSettings->List2Var(q_pair_list())); + guiSettings->SetValue(gui::rg_entries, guiSettings->List2Var(q_pair_list())); }); connect(ui->freezeRecentAct, &QAction::triggered, [=](bool checked) { - guiSettings->SetValue(GUI::rg_freeze, checked); + guiSettings->SetValue(gui::rg_freeze, checked); }); connect(ui->bootInstallPkgAct, &QAction::triggered, [this] {InstallPkg(); }); @@ -1239,13 +1239,13 @@ void main_window::CreateConnects() connect(ui->confSavedataManagerAct, &QAction::triggered, [=] { - save_manager_dialog* sdid = new save_manager_dialog(); + save_manager_dialog* sdid = new save_manager_dialog(guiSettings); sdid->show(); }); connect(ui->actionManage_Trophy_Data, &QAction::triggered, [=] { - trophy_manager_dialog* trop_manager = new trophy_manager_dialog(); + trophy_manager_dialog* trop_manager = new trophy_manager_dialog(guiSettings); trop_manager->show(); }); @@ -1284,25 +1284,25 @@ void main_window::CreateConnects() connect(ui->showDebuggerAct, &QAction::triggered, [=](bool checked) { checked ? m_debuggerFrame->show() : m_debuggerFrame->hide(); - guiSettings->SetValue(GUI::mw_debugger, checked); + guiSettings->SetValue(gui::mw_debugger, checked); }); connect(ui->showLogAct, &QAction::triggered, [=](bool checked) { checked ? m_logFrame->show() : m_logFrame->hide(); - guiSettings->SetValue(GUI::mw_logger, checked); + guiSettings->SetValue(gui::mw_logger, checked); }); connect(ui->showGameListAct, &QAction::triggered, [=](bool checked) { checked ? m_gameListFrame->show() : m_gameListFrame->hide(); - guiSettings->SetValue(GUI::mw_gamelist, checked); + guiSettings->SetValue(gui::mw_gamelist, checked); }); connect(ui->showToolBarAct, &QAction::triggered, [=](bool checked) { ui->toolBar->setVisible(checked); - guiSettings->SetValue(GUI::mw_toolBarVisible, checked); + guiSettings->SetValue(gui::mw_toolBarVisible, checked); }); connect(ui->showGameToolBarAct, &QAction::triggered, [=](bool checked) @@ -1355,7 +1355,7 @@ void main_window::CreateConnects() if (m_save_slider_pos) { m_save_slider_pos = false; - guiSettings->SetValue(GUI::gl_iconSize, index); + guiSettings->SetValue(gui::gl_iconSize, index); } m_gameListFrame->ResizeIcons(index); } @@ -1366,18 +1366,18 @@ void main_window::CreateConnects() int index; if (act == ui->setIconSizeTinyAct) index = 0; - else if (act == ui->setIconSizeSmallAct) index = GUI::get_Index(GUI::gl_icon_size_small); - else if (act == ui->setIconSizeMediumAct) index = GUI::get_Index(GUI::gl_icon_size_medium); - else index = GUI::gl_max_slider_pos; + else if (act == ui->setIconSizeSmallAct) index = gui::get_Index(gui::gl_icon_size_small); + else if (act == ui->setIconSizeMediumAct) index = gui::get_Index(gui::gl_icon_size_medium); + else index = gui::gl_max_slider_pos; resizeIcons(index); }); connect (m_gameListFrame, &game_list_frame::RequestIconSizeActSet, [=](const int& idx) { - if (idx < GUI::get_Index((GUI::gl_icon_size_small + GUI::gl_icon_size_min) / 2)) ui->setIconSizeTinyAct->setChecked(true); - else if (idx < GUI::get_Index((GUI::gl_icon_size_medium + GUI::gl_icon_size_small) / 2)) ui->setIconSizeSmallAct->setChecked(true); - else if (idx < GUI::get_Index((GUI::gl_icon_size_max + GUI::gl_icon_size_medium) / 2)) ui->setIconSizeMediumAct->setChecked(true); + if (idx < gui::get_Index((gui::gl_icon_size_small + gui::gl_icon_size_min) / 2)) ui->setIconSizeTinyAct->setChecked(true); + else if (idx < gui::get_Index((gui::gl_icon_size_medium + gui::gl_icon_size_small) / 2)) ui->setIconSizeSmallAct->setChecked(true); + else if (idx < gui::get_Index((gui::gl_icon_size_max + gui::gl_icon_size_medium) / 2)) ui->setIconSizeMediumAct->setChecked(true); else ui->setIconSizeLargeAct->setChecked(true); resizeIcons(idx); @@ -1430,7 +1430,7 @@ void main_window::CreateConnects() connect(ui->toolbar_list, &QAction::triggered, [=]() { ui->setlistModeListAct->trigger(); }); connect(ui->toolbar_grid, &QAction::triggered, [=]() { ui->setlistModeGridAct->trigger(); }); connect(ui->sizeSlider, &QSlider::valueChanged, resizeIcons); - connect(ui->sizeSlider, &QSlider::sliderReleased, this, [&] { guiSettings->SetValue(GUI::gl_iconSize, ui->sizeSlider->value()); }); + connect(ui->sizeSlider, &QSlider::sliderReleased, this, [&] { guiSettings->SetValue(gui::gl_iconSize, ui->sizeSlider->value()); }); connect(ui->sizeSlider, &QSlider::actionTriggered, [&](int action) { @@ -1447,6 +1447,7 @@ void main_window::CreateDockWindows() { // new mainwindow widget because existing seems to be bugged for now m_mw = new QMainWindow(); + m_mw->setContextMenuPolicy(Qt::PreventContextMenu); m_gameListFrame = new game_list_frame(guiSettings, emuSettings, m_mw); m_gameListFrame->setObjectName("gamelist"); @@ -1466,7 +1467,7 @@ void main_window::CreateDockWindows() if (ui->showLogAct->isChecked()) { ui->showLogAct->setChecked(false); - guiSettings->SetValue(GUI::mw_logger, false); + guiSettings->SetValue(gui::mw_logger, false); } }); @@ -1475,7 +1476,7 @@ void main_window::CreateDockWindows() if (ui->showDebuggerAct->isChecked()) { ui->showDebuggerAct->setChecked(false); - guiSettings->SetValue(GUI::mw_debugger, false); + guiSettings->SetValue(gui::mw_debugger, false); } }); @@ -1484,7 +1485,7 @@ void main_window::CreateDockWindows() if (ui->showGameListAct->isChecked()) { ui->showGameListAct->setChecked(false); - guiSettings->SetValue(GUI::mw_gamelist, false); + guiSettings->SetValue(gui::mw_gamelist, false); } }); @@ -1495,7 +1496,7 @@ void main_window::CreateDockWindows() void main_window::ConfigureGuiFromSettings(bool configure_all) { // Restore GUI state if needed. We need to if they exist. - QByteArray geometry = guiSettings->GetValue(GUI::mw_geometry).toByteArray(); + QByteArray geometry = guiSettings->GetValue(gui::mw_geometry).toByteArray(); if (geometry.isEmpty() == false) { restoreGeometry(geometry); @@ -1508,11 +1509,11 @@ void main_window::ConfigureGuiFromSettings(bool configure_all) resize(defaultSize); } - restoreState(guiSettings->GetValue(GUI::mw_windowState).toByteArray()); - m_mw->restoreState(guiSettings->GetValue(GUI::mw_mwState).toByteArray()); + restoreState(guiSettings->GetValue(gui::mw_windowState).toByteArray()); + m_mw->restoreState(guiSettings->GetValue(gui::mw_mwState).toByteArray()); - ui->freezeRecentAct->setChecked(guiSettings->GetValue(GUI::rg_freeze).toBool()); - m_rg_entries = guiSettings->Var2List(guiSettings->GetValue(GUI::rg_entries)); + ui->freezeRecentAct->setChecked(guiSettings->GetValue(gui::rg_freeze).toBool()); + m_rg_entries = guiSettings->Var2List(guiSettings->GetValue(gui::rg_entries)); // clear recent games menu of actions for (auto act : m_recentGameActs) @@ -1524,7 +1525,7 @@ void main_window::ConfigureGuiFromSettings(bool configure_all) for (int i = 0; i < m_rg_entries.count(); i++) { // adjust old unformatted entries (avoid duplication) - m_rg_entries[i] = GUI::Recent_Game(m_rg_entries[i].first, m_rg_entries[i].second); + m_rg_entries[i] = gui::Recent_Game(m_rg_entries[i].first, m_rg_entries[i].second); // create new action QAction* act = CreateRecentAction(m_rg_entries[i], i + 1); @@ -1541,11 +1542,11 @@ void main_window::ConfigureGuiFromSettings(bool configure_all) } } - ui->showLogAct->setChecked(guiSettings->GetValue(GUI::mw_logger).toBool()); - ui->showGameListAct->setChecked(guiSettings->GetValue(GUI::mw_gamelist).toBool()); - ui->showDebuggerAct->setChecked(guiSettings->GetValue(GUI::mw_debugger).toBool()); - ui->showToolBarAct->setChecked(guiSettings->GetValue(GUI::mw_toolBarVisible).toBool()); - ui->showGameToolBarAct->setChecked(guiSettings->GetValue(GUI::gl_toolBarVisible).toBool()); + ui->showLogAct->setChecked(guiSettings->GetValue(gui::mw_logger).toBool()); + ui->showGameListAct->setChecked(guiSettings->GetValue(gui::mw_gamelist).toBool()); + ui->showDebuggerAct->setChecked(guiSettings->GetValue(gui::mw_debugger).toBool()); + ui->showToolBarAct->setChecked(guiSettings->GetValue(gui::mw_toolBarVisible).toBool()); + ui->showGameToolBarAct->setChecked(guiSettings->GetValue(gui::gl_toolBarVisible).toBool()); m_debuggerFrame->setVisible(ui->showDebuggerAct->isChecked()); m_logFrame->setVisible(ui->showLogAct->isChecked()); @@ -1563,14 +1564,14 @@ void main_window::ConfigureGuiFromSettings(bool configure_all) ui->showCatUnknownAct->setChecked(guiSettings->GetCategoryVisibility(Category::Unknown_Cat)); ui->showCatOtherAct->setChecked(guiSettings->GetCategoryVisibility(Category::Others)); - int idx = guiSettings->GetValue(GUI::gl_iconSize).toInt(); - int index = GUI::gl_max_slider_pos / 4; + int idx = guiSettings->GetValue(gui::gl_iconSize).toInt(); + int index = gui::gl_max_slider_pos / 4; if (idx < index) ui->setIconSizeTinyAct->setChecked(true); else if (idx < index * 2) ui->setIconSizeSmallAct->setChecked(true); else if (idx < index * 3) ui->setIconSizeMediumAct->setChecked(true); else ui->setIconSizeLargeAct->setChecked(true); - bool isListMode = guiSettings->GetValue(GUI::gl_listMode).toBool(); + bool isListMode = guiSettings->GetValue(gui::gl_listMode).toBool(); if (isListMode) ui->setlistModeListAct->setChecked(true); else ui->setlistModeGridAct->setChecked(true); m_categoryVisibleActGroup->setEnabled(isListMode); @@ -1675,7 +1676,7 @@ Check data for valid file types and cache their paths if necessary */ int main_window::IsValidFile(const QMimeData& md, QStringList* dropPaths) { - int dropType = DROP_ERROR; + int dropType = drop_type::drop_error; const QList list = md.urls(); // get list of all the dropped file urls @@ -1688,47 +1689,47 @@ int main_window::IsValidFile(const QMimeData& md, QStringList* dropPaths) // check for directories first, only valid if all other paths led to directories until now. if (info.isDir()) { - if (dropType != DROP_DIR && dropType != DROP_ERROR) + if (dropType != drop_type::drop_dir && dropType != drop_type::drop_error) { - return DROP_ERROR; + return drop_type::drop_error; } - dropType = DROP_DIR; + dropType = drop_type::drop_dir; } else if (info.fileName() == "PS3UPDAT.PUP") { if (list.size() != 1) { - return DROP_ERROR; + return drop_type::drop_error; } - dropType = DROP_PUP; + dropType = drop_type::drop_pup; } else if (info.suffix().toLower() == "pkg") { - if (dropType != DROP_PKG && dropType != DROP_ERROR) + if (dropType != drop_type::drop_pkg && dropType != drop_type::drop_error) { - return DROP_ERROR; + return drop_type::drop_error; } - dropType = DROP_PKG; + dropType = drop_type::drop_pkg; } else if (info.suffix() == "rap") { - if (dropType != DROP_RAP && dropType != DROP_ERROR) + if (dropType != drop_type::drop_rap && dropType != drop_type::drop_error) { - return DROP_ERROR; + return drop_type::drop_error; } - dropType = DROP_RAP; + dropType = drop_type::drop_rap; } else if (list.size() == 1) { - dropType = DROP_GAME; + dropType = drop_type::drop_game; } else { - return DROP_ERROR; + return drop_type::drop_error; } if (dropPaths) // we only need to know the paths on drop @@ -1746,18 +1747,18 @@ void main_window::dropEvent(QDropEvent* event) switch (IsValidFile(*event->mimeData(), &dropPaths)) // get valid file paths and drop type { - case DROP_ERROR: + case drop_type::drop_error: break; - case DROP_PKG: // install the packages + case drop_type::drop_pkg: // install the packages for (const auto& path : dropPaths) { InstallPkg(path); } break; - case DROP_PUP: // install the firmware + case drop_type::drop_pup: // install the firmware InstallPup(dropPaths.first()); break; - case DROP_RAP: // import rap files to exdata dir + case drop_type::drop_rap: // import rap files to exdata dir for (const auto& rap : dropPaths) { const std::string rapname = sstr(QFileInfo(rap).fileName()); @@ -1773,14 +1774,14 @@ void main_window::dropEvent(QDropEvent* event) } } break; - case DROP_DIR: // import valid games to gamelist (games.yaml) + case drop_type::drop_dir: // import valid games to gamelist (games.yaml) for (const auto& path : dropPaths) { AddGamesFromDir(path); } m_gameListFrame->Refresh(true); break; - case DROP_GAME: // import valid games to gamelist (games.yaml) + case drop_type::drop_game: // import valid games to gamelist (games.yaml) if (Emu.BootGame(sstr(dropPaths.first()), true)) { LOG_SUCCESS(GENERAL, "Elf Boot from drag and drop done: %s", sstr(dropPaths.first())); diff --git a/rpcs3/rpcs3qt/main_window.h b/rpcs3/rpcs3qt/main_window.h index e15d29483c..8a731142fc 100644 --- a/rpcs3/rpcs3qt/main_window.h +++ b/rpcs3/rpcs3qt/main_window.h @@ -55,14 +55,14 @@ class main_window : public QMainWindow QStringList m_d3d12_adapters; #endif - enum + enum drop_type { - DROP_ERROR, - DROP_PKG, - DROP_PUP, - DROP_RAP, - DROP_DIR, - DROP_GAME + drop_error, + drop_pkg, + drop_pup, + drop_rap, + drop_dir, + drop_game }; public: diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index 2143e3a424..88e9bb70f1 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -70,7 +70,7 @@ pad_settings_dialog::pad_settings_dialog(QWidget *parent) : QDialog(parent), ui( gui_settings settings(this); // repaint and resize controller image - ui->l_controller->setPixmap(settings.colorizedPixmap(*ui->l_controller->pixmap(), QColor(), GUI::get_Label_Color("l_controller"), false, true)); + ui->l_controller->setPixmap(settings.colorizedPixmap(*ui->l_controller->pixmap(), QColor(), gui::get_Label_Color("l_controller"), false, true)); ui->l_controller->setMaximumSize(ui->gb_description->sizeHint().width(), ui->l_controller->maximumHeight() * ui->gb_description->sizeHint().width() / ui->l_controller->maximumWidth()); layout()->setSizeConstraint(QLayout::SetFixedSize); diff --git a/rpcs3/rpcs3qt/save_data_list_dialog.cpp b/rpcs3/rpcs3qt/save_data_list_dialog.cpp index 554b477726..8095211ba6 100644 --- a/rpcs3/rpcs3qt/save_data_list_dialog.cpp +++ b/rpcs3/rpcs3qt/save_data_list_dialog.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" #include "save_data_list_dialog.h" #include "save_data_info_dialog.h" -#include "gui_settings.h" #include #include @@ -15,7 +14,7 @@ constexpr auto qstr = QString::fromStdString; //Show up the savedata list, either to choose one to save/load or to manage saves. //I suggest to use function callbacks to give save data list or get save data entry. (Not implemented or stubbed) save_data_list_dialog::save_data_list_dialog(const std::vector& entries, s32 focusedEntry, u32 op, vm::ptr listSet, QWidget* parent) - : QDialog(parent), m_save_entries(entries), m_entry(-1), m_entry_label(nullptr) + : QDialog(parent), m_save_entries(entries), m_entry(selection_code::new_save), m_entry_label(nullptr) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -34,6 +33,8 @@ save_data_list_dialog::save_data_list_dialog(const std::vector& e setMinimumSize(QSize(400, 400)); + m_gui_settings.reset(new gui_settings()); + // Table m_list = new QTableWidget(this); @@ -64,7 +65,7 @@ save_data_list_dialog::save_data_list_dialog(const std::vector& e QPushButton *saveNewEntry = new QPushButton(tr("Save New Entry"), this); connect(saveNewEntry, &QAbstractButton::clicked, this, [&]() { - m_entry = -1; // Set the return properly. + m_entry = selection_code::new_save; accept(); }); hbox_action->addWidget(saveNewEntry); @@ -106,10 +107,9 @@ save_data_list_dialog::save_data_list_dialog(const std::vector& e int originalIndex = m_list->item(row, 0)->data(Qt::UserRole).toInt(); SaveDataEntry originalEntry = m_save_entries[originalIndex]; QString originalDirName = qstr(originalEntry.dirName); - gui_settings settings(this); - QVariantMap currNotes = settings.GetValue(GUI::m_saveNotes).toMap(); + QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap(); currNotes[originalDirName] = m_list->item(row, col)->text(); - settings.SetValue(GUI::m_saveNotes, currNotes); + m_gui_settings->SetValue(gui::m_saveNotes, currNotes); }); m_list->setCurrentCell(focusedEntry, 0); @@ -136,15 +136,15 @@ s32 save_data_list_dialog::GetSelection() int res = result(); if (res == QDialog::Accepted) { - if (m_entry == -1) + if (m_entry == selection_code::new_save) { // Save new entry - return -1; + return selection_code::new_save; } return m_list->item(m_entry, 0)->data(Qt::UserRole).toInt(); } - // Cancel is pressed. May promote to enum or figure out proper cellsavedata code to use later. - return -2; + // Cancel is pressed. May figure out proper cellsavedata code to use later. + return selection_code::canceled; } void save_data_list_dialog::OnSort(int logicalIndex) @@ -181,7 +181,8 @@ void save_data_list_dialog::UpdateList() { m_list->clearContents(); m_list->setRowCount((int)m_save_entries.size()); - gui_settings settings(this); + + QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap(); int row = 0; for (SaveDataEntry entry: m_save_entries) @@ -203,18 +204,14 @@ void save_data_list_dialog::UpdateList() dirNameItem->setFlags(dirNameItem->flags() & ~Qt::ItemIsEditable); m_list->setItem(row, 2, dirNameItem); - QVariantMap currNotes = settings.GetValue(GUI::m_saveNotes).toMap(); QTableWidgetItem* noteItem = new QTableWidgetItem(); noteItem->setFlags(noteItem->flags() | Qt::ItemIsEditable); + if (currNotes.contains(dirName)) { noteItem->setText(currNotes[dirName].toString()); } - else - { - currNotes[dirName] = ""; - settings.SetValue(GUI::m_saveNotes, currNotes); - } + m_list->setItem(row, 3, noteItem); ++row; } diff --git a/rpcs3/rpcs3qt/save_data_list_dialog.h b/rpcs3/rpcs3qt/save_data_list_dialog.h index a5a0df83d3..27dd466387 100644 --- a/rpcs3/rpcs3qt/save_data_list_dialog.h +++ b/rpcs3/rpcs3qt/save_data_list_dialog.h @@ -5,6 +5,7 @@ #include "Emu/System.h" #include "Emu/Memory/Memory.h" #include "Emu/Cell/Modules/cellSaveData.h" +#include "gui_settings.h" #include #include @@ -16,6 +17,12 @@ class save_data_list_dialog : public QDialog { Q_OBJECT + enum selection_code + { + new_save = -1, + canceled = -2 + }; + public: explicit save_data_list_dialog(const std::vector& entries, s32 focusedEntry, u32 op, vm::ptr, QWidget* parent = nullptr); @@ -33,6 +40,8 @@ private: QTableWidget* m_list; std::vector m_save_entries; + std::shared_ptr m_gui_settings; + int m_sort_column; bool m_sort_ascending; }; diff --git a/rpcs3/rpcs3qt/save_manager_dialog.cpp b/rpcs3/rpcs3qt/save_manager_dialog.cpp index 3e61564554..11ac80025e 100644 --- a/rpcs3/rpcs3qt/save_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/save_manager_dialog.cpp @@ -1,7 +1,6 @@ #include "save_manager_dialog.h" #include "save_data_info_dialog.h" -#include "gui_settings.h" #include "Emu/System.h" #include "Emu/VFS.h" @@ -29,7 +28,6 @@ namespace */ std::vector GetSaveEntries(const std::string& base_dir) { - std::vector save_entries; // get the saves matching the supplied prefix @@ -80,8 +78,8 @@ namespace } } -save_manager_dialog::save_manager_dialog(std::string dir, QWidget* parent) : QDialog(parent), - m_save_entries(), m_dir(dir), m_sort_column(1), m_sort_ascending(true) +save_manager_dialog::save_manager_dialog(std::shared_ptr gui_settings, std::string dir, QWidget* parent) + : QDialog(parent), m_save_entries(), m_dir(dir), m_sort_column(1), m_sort_ascending(true), m_gui_settings(gui_settings) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowTitle(tr("Save Manager")); @@ -110,7 +108,6 @@ void save_manager_dialog::Init(std::string dir) QPushButton* push_close = new QPushButton(tr("&Close"), this); push_close->setAutoDefault(true); - // Button Layout QHBoxLayout* hbox_buttons = new QHBoxLayout(); hbox_buttons->addWidget(push_remove_entries); @@ -126,6 +123,12 @@ void save_manager_dialog::Init(std::string dir) UpdateList(); + QByteArray geometry = m_gui_settings->GetValue(gui::sd_geometry).toByteArray(); + if (geometry.isEmpty() == false) + { + restoreGeometry(geometry); + } + // Connects and events connect(push_close, &QAbstractButton::clicked, this, &save_manager_dialog::close); connect(push_remove_entries, &QAbstractButton::clicked, this, &save_manager_dialog::OnEntriesRemove); @@ -137,10 +140,9 @@ void save_manager_dialog::Init(std::string dir) int originalIndex = m_list->item(row, 0)->data(Qt::UserRole).toInt(); SaveDataEntry originalEntry = m_save_entries[originalIndex]; QString originalDirName = qstr(originalEntry.dirName); - gui_settings settings(this); - QVariantMap currNotes = settings.GetValue(GUI::m_saveNotes).toMap(); + QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap(); currNotes[originalDirName] = m_list->item(row, col)->text(); - settings.SetValue(GUI::m_saveNotes, currNotes); + m_gui_settings->SetValue(gui::m_saveNotes, currNotes); }); } @@ -155,7 +157,8 @@ void save_manager_dialog::UpdateList() m_list->clearContents(); m_list->setRowCount(static_cast(m_save_entries.size())); - gui_settings settings(this); + + QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap(); int row = 0; for (SaveDataEntry entry : m_save_entries) @@ -177,18 +180,14 @@ void save_manager_dialog::UpdateList() dirNameItem->setFlags(dirNameItem->flags() & ~Qt::ItemIsEditable); m_list->setItem(row, 2, dirNameItem); - QVariantMap currNotes = settings.GetValue(GUI::m_saveNotes).toMap(); QTableWidgetItem* noteItem = new QTableWidgetItem(); noteItem->setFlags(noteItem->flags() | Qt::ItemIsEditable); + if (currNotes.contains(dirName)) { noteItem->setText(currNotes[dirName].toString()); } - else - { - currNotes[dirName] = ""; - settings.SetValue(GUI::m_saveNotes, currNotes); - } + m_list->setItem(row, 3, noteItem); ++row; } @@ -338,3 +337,8 @@ void save_manager_dialog::ShowContextMenu(const QPoint &pos) menu->exec(globalPos); } + +void save_manager_dialog::closeEvent(QCloseEvent * event) +{ + m_gui_settings->SetValue(gui::sd_geometry, saveGeometry()); +} diff --git a/rpcs3/rpcs3qt/save_manager_dialog.h b/rpcs3/rpcs3qt/save_manager_dialog.h index c8b56eb324..25d0ddd7dd 100644 --- a/rpcs3/rpcs3qt/save_manager_dialog.h +++ b/rpcs3/rpcs3qt/save_manager_dialog.h @@ -3,6 +3,7 @@ #include "stdafx.h" #include "Emu/Memory/Memory.h" #include "Emu/Cell/Modules/cellSaveData.h" +#include "gui_settings.h" #include #include @@ -17,7 +18,7 @@ public: * Plus, there's the added complexity of an additional way in which the dialog will spawn differently. * There'll be some duplicated code. But, in the future, there'll be no duplicated code. So, I don't care. */ - explicit save_manager_dialog(std::string dir = "", QWidget* parent = nullptr); + explicit save_manager_dialog(std::shared_ptr gui_settings, std::string dir = "", QWidget* parent = nullptr); private Q_SLOTS: void OnEntryInfo(); void OnEntryRemove(); @@ -29,10 +30,14 @@ private: void ShowContextMenu(const QPoint &pos); + void closeEvent(QCloseEvent* event) override; + QTableWidget* m_list; std::string m_dir; std::vector m_save_entries; + std::shared_ptr m_gui_settings; + QMenu* m_sort_options; int m_sort_column; diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 028ac4d8c8..aebec43e99 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -35,8 +35,8 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: ui->cancelButton->setFocus(); ui->tabWidget->setUsesScrollButtons(false); - bool showDebugTab = xgui_settings->GetValue(GUI::m_showDebugTab).toBool(); - xgui_settings->SetValue(GUI::m_showDebugTab, showDebugTab); + bool showDebugTab = xgui_settings->GetValue(gui::m_showDebugTab).toBool(); + xgui_settings->SetValue(gui::m_showDebugTab, showDebugTab); if (!showDebugTab) { ui->tabWidget->removeTab(7); @@ -361,13 +361,13 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: emu_settings::Render_Creator render_creator = xemu_settings.get()->m_render_creator; // Comboboxes - SubscribeTooltip(ui->graphicsAdapterBox, json_gpu_cbo["graphicsAdapterBox"].toString()); - xemu_settings->EnhanceComboBox(ui->renderBox, emu_settings::Renderer); #ifdef WIN32 SubscribeTooltip(ui->renderBox, json_gpu_cbo["renderBox"].toString()); + SubscribeTooltip(ui->graphicsAdapterBox, json_gpu_cbo["graphicsAdapterBox"].toString()); #else SubscribeTooltip(ui->renderBox, json_gpu_cbo["renderBox_Linux"].toString()); + SubscribeTooltip(ui->graphicsAdapterBox, json_gpu_cbo["graphicsAdapterBox_Linux"].toString()); #endif //Change D3D12 to D3D12[DO NOT USE] ui->renderBox->setItemText(ui->renderBox->findData("D3D12"), render_creator.name_D3D12); @@ -758,16 +758,16 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: auto AddColoredIcons = [=]() { - addColoredIcon(ui->pb_gl_icon_color, xgui_settings->GetValue(GUI::gl_iconColor).value()); - addColoredIcon(ui->pb_tool_bar_color, xgui_settings->GetValue(GUI::mw_toolBarColor).value()); - addColoredIcon(ui->pb_gl_tool_icon_color, xgui_settings->GetValue(GUI::gl_toolIconColor).value(), QIcon(":/Icons/home_blue.png"), GUI::gl_tool_icon_color); - addColoredIcon(ui->pb_tool_icon_color, xgui_settings->GetValue(GUI::mw_toolIconColor).value(), QIcon(":/Icons/stop.png"), GUI::mw_tool_icon_color); + addColoredIcon(ui->pb_gl_icon_color, xgui_settings->GetValue(gui::gl_iconColor).value()); + addColoredIcon(ui->pb_tool_bar_color, xgui_settings->GetValue(gui::mw_toolBarColor).value()); + addColoredIcon(ui->pb_gl_tool_icon_color, xgui_settings->GetValue(gui::gl_toolIconColor).value(), QIcon(":/Icons/home_blue.png"), gui::gl_tool_icon_color); + addColoredIcon(ui->pb_tool_icon_color, xgui_settings->GetValue(gui::mw_toolIconColor).value(), QIcon(":/Icons/stop.png"), gui::mw_tool_icon_color); }; AddColoredIcons(); - ui->cb_show_welcome->setChecked(xgui_settings->GetValue(GUI::ib_show_welcome).toBool()); + ui->cb_show_welcome->setChecked(xgui_settings->GetValue(gui::ib_show_welcome).toBool()); - bool enableUIColors = xgui_settings->GetValue(GUI::m_enableUIColors).toBool(); + bool enableUIColors = xgui_settings->GetValue(gui::m_enableUIColors).toBool(); ui->cb_custom_colors->setChecked(enableUIColors); ui->pb_gl_icon_color->setEnabled(enableUIColors); ui->pb_gl_tool_icon_color->setEnabled(enableUIColors); @@ -778,17 +778,17 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: { if (reset) { - m_currentConfig = GUI::Default; - m_currentStylesheet = GUI::Default; + m_currentConfig = gui::Default; + m_currentStylesheet = gui::Default; ui->combo_configs->setCurrentIndex(0); ui->combo_stylesheets->setCurrentIndex(0); } // Only attempt to load a config if changes occurred. - if (m_currentConfig != xgui_settings->GetValue(GUI::m_currentConfig).toString()) + if (m_currentConfig != xgui_settings->GetValue(gui::m_currentConfig).toString()) { OnApplyConfig(); } - if (m_currentStylesheet != xgui_settings->GetValue(GUI::m_currentStylesheet).toString()) + if (m_currentStylesheet != xgui_settings->GetValue(gui::m_currentStylesheet).toString()) { OnApplyStylesheet(); } @@ -803,7 +803,7 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: { ApplyGuiOptions(true); xgui_settings->Reset(true); - xgui_settings->ChangeToConfig(GUI::Default); + xgui_settings->ChangeToConfig(gui::Default); Q_EMIT GuiSettingsSyncRequest(true); AddConfigs(); AddStylesheets(); @@ -822,19 +822,19 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: connect(ui->cb_show_welcome, &QCheckBox::clicked, [=](bool val) { - xgui_settings->SetValue(GUI::ib_show_welcome, val); + xgui_settings->SetValue(gui::ib_show_welcome, val); }); connect(ui->cb_custom_colors, &QCheckBox::clicked, [=](bool val) { - xgui_settings->SetValue(GUI::m_enableUIColors, val); + xgui_settings->SetValue(gui::m_enableUIColors, val); ui->pb_gl_icon_color->setEnabled(val); ui->pb_gl_tool_icon_color->setEnabled(val); ui->pb_tool_bar_color->setEnabled(val); ui->pb_tool_icon_color->setEnabled(val); Q_EMIT GuiRepaintRequest(); }); - auto colorDialog = [&](const GUI_SAVE& color, const QString& title, QPushButton *button) + auto colorDialog = [&](const gui_save& color, const QString& title, QPushButton *button) { QColor oldColor = xgui_settings->GetValue(color).value(); QColorDialog dlg(oldColor, this); @@ -858,56 +858,56 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: connect(ui->pb_gl_icon_color, &QAbstractButton::clicked, [=]() { - colorDialog(GUI::gl_iconColor, tr("Choose gamelist icon color"), ui->pb_gl_icon_color); + colorDialog(gui::gl_iconColor, tr("Choose gamelist icon color"), ui->pb_gl_icon_color); }); connect(ui->pb_gl_tool_icon_color, &QAbstractButton::clicked, [=]() { - colorDialog(GUI::gl_toolIconColor, tr("Choose gamelist tool icon color"), ui->pb_gl_tool_icon_color); + colorDialog(gui::gl_toolIconColor, tr("Choose gamelist tool icon color"), ui->pb_gl_tool_icon_color); }); connect(ui->pb_tool_bar_color, &QAbstractButton::clicked, [=]() { - colorDialog(GUI::mw_toolBarColor, tr("Choose tool bar color"), ui->pb_tool_bar_color); + colorDialog(gui::mw_toolBarColor, tr("Choose tool bar color"), ui->pb_tool_bar_color); }); connect(ui->pb_tool_icon_color, &QAbstractButton::clicked, [=]() { - colorDialog(GUI::mw_toolIconColor, tr("Choose tool icon color"), ui->pb_tool_icon_color); + colorDialog(gui::mw_toolIconColor, tr("Choose tool icon color"), ui->pb_tool_icon_color); }); - ui->gs_disableMouse->setChecked(xgui_settings->GetValue(GUI::gs_disableMouse).toBool()); + ui->gs_disableMouse->setChecked(xgui_settings->GetValue(gui::gs_disableMouse).toBool()); connect(ui->gs_disableMouse, &QCheckBox::clicked, [=](bool val) { - xgui_settings->SetValue(GUI::gs_disableMouse, val); + xgui_settings->SetValue(gui::gs_disableMouse, val); }); - bool enableButtons = xgui_settings->GetValue(GUI::gs_resize).toBool(); + bool enableButtons = xgui_settings->GetValue(gui::gs_resize).toBool(); ui->gs_resizeOnBoot->setChecked(enableButtons); ui->gs_width->setEnabled(enableButtons); ui->gs_height->setEnabled(enableButtons); QRect screen = QApplication::desktop()->screenGeometry(); - int width = xgui_settings->GetValue(GUI::gs_width).toInt(); - int height = xgui_settings->GetValue(GUI::gs_height).toInt(); + int width = xgui_settings->GetValue(gui::gs_width).toInt(); + int height = xgui_settings->GetValue(gui::gs_height).toInt(); ui->gs_width->setValue(std::min(width, screen.width())); ui->gs_height->setValue(std::min(height, screen.height())); connect(ui->gs_resizeOnBoot, &QCheckBox::clicked, [=](bool val) { - xgui_settings->SetValue(GUI::gs_resize, val); + xgui_settings->SetValue(gui::gs_resize, val); ui->gs_width->setEnabled(val); ui->gs_height->setEnabled(val); }); connect(ui->gs_width, &QSpinBox::editingFinished, [=]() { ui->gs_width->setValue(std::min(ui->gs_width->value(), QApplication::desktop()->screenGeometry().width())); - xgui_settings->SetValue(GUI::gs_width, ui->gs_width->value()); + xgui_settings->SetValue(gui::gs_width, ui->gs_width->value()); }); connect(ui->gs_height, &QSpinBox::editingFinished, [=]() { ui->gs_height->setValue(std::min(ui->gs_height->value(), QApplication::desktop()->screenGeometry().height())); - xgui_settings->SetValue(GUI::gs_height, ui->gs_height->value()); + xgui_settings->SetValue(gui::gs_height, ui->gs_height->value()); }); AddConfigs(); @@ -976,11 +976,11 @@ void settings_dialog::AddConfigs() { ui->combo_configs->clear(); - ui->combo_configs->addItem(GUI::Default); + ui->combo_configs->addItem(gui::Default); for (QString entry : xgui_settings->GetConfigEntries()) { - if (entry != GUI::Default) + if (entry != gui::Default) { ui->combo_configs->addItem(entry); } @@ -1003,17 +1003,17 @@ void settings_dialog::AddStylesheets() { ui->combo_stylesheets->clear(); - ui->combo_stylesheets->addItem("Default (Bright)", GUI::Default); + ui->combo_stylesheets->addItem("Default (Bright)", gui::Default); for (const QString& entry : xgui_settings->GetStylesheetEntries()) { - if (entry != GUI::Default) + if (entry != gui::Default) { ui->combo_stylesheets->addItem(entry, entry); } } - m_currentStylesheet = xgui_settings->GetValue(GUI::m_currentStylesheet).toString(); + m_currentStylesheet = xgui_settings->GetValue(gui::m_currentStylesheet).toString(); int index = ui->combo_stylesheets->findData(m_currentStylesheet); if (index != -1) @@ -1063,7 +1063,7 @@ void settings_dialog::OnBackupCurrentConfig() void settings_dialog::OnApplyConfig() { m_currentConfig = ui->combo_configs->currentText(); - xgui_settings->SetValue(GUI::m_currentConfig, m_currentConfig); + xgui_settings->SetValue(gui::m_currentConfig, m_currentConfig); xgui_settings->ChangeToConfig(m_currentConfig); Q_EMIT GuiSettingsSyncRequest(true); } @@ -1071,7 +1071,7 @@ void settings_dialog::OnApplyConfig() void settings_dialog::OnApplyStylesheet() { m_currentStylesheet = ui->combo_stylesheets->currentData().toString(); - xgui_settings->SetValue(GUI::m_currentStylesheet, m_currentStylesheet); + xgui_settings->SetValue(gui::m_currentStylesheet, m_currentStylesheet); Q_EMIT GuiStylesheetRequest(xgui_settings->GetCurrentStylesheetPath()); } diff --git a/rpcs3/rpcs3qt/syntax_highlighter.cpp b/rpcs3/rpcs3qt/syntax_highlighter.cpp index 2db72e0957..74e4a8c86b 100644 --- a/rpcs3/rpcs3qt/syntax_highlighter.cpp +++ b/rpcs3/rpcs3qt/syntax_highlighter.cpp @@ -132,10 +132,10 @@ void syntax_highlighter::highlightBlock(const QString &text) int comment_length = 0; // Current comment length // We assume we end outside a comment until we know better - setCurrentBlockState(ENDED_OUTSIDE_COMMENT); + setCurrentBlockState(block_state::ended_outside_comment); // Search for the first comment in this block if we start outside or don't want to search for multiline comments - if (!rule.multi_line || previousBlockState() != ENDED_INSIDE_COMMENT) + if (!rule.multi_line || previousBlockState() != block_state::ended_inside_comment) { comment_start = m_current_block.indexOf(rule.start_expression); } @@ -159,7 +159,7 @@ void syntax_highlighter::highlightBlock(const QString &text) if (comment_end == -1) { // We end inside a comment and want to format the entire remaining text - setCurrentBlockState(ENDED_INSIDE_COMMENT); + setCurrentBlockState(block_state::ended_inside_comment); comment_length = m_current_block.length() - comment_start; } else diff --git a/rpcs3/rpcs3qt/syntax_highlighter.h b/rpcs3/rpcs3qt/syntax_highlighter.h index 0ff076c06c..fa8f283191 100644 --- a/rpcs3/rpcs3qt/syntax_highlighter.h +++ b/rpcs3/rpcs3qt/syntax_highlighter.h @@ -7,10 +7,10 @@ class syntax_highlighter : public QSyntaxHighlighter { Q_OBJECT - enum BlockState + enum block_state { - ENDED_OUTSIDE_COMMENT, - ENDED_INSIDE_COMMENT + ended_outside_comment, + ended_inside_comment }; public: diff --git a/rpcs3/rpcs3qt/trophy_manager_dialog.cpp b/rpcs3/rpcs3qt/trophy_manager_dialog.cpp index 4d333650a3..b227d6e28d 100644 --- a/rpcs3/rpcs3qt/trophy_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/trophy_manager_dialog.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -29,7 +28,6 @@ #include #include -static const int m_TROPHY_ICON_HEIGHT = 75; static const char* m_TROPHY_DIR = "/dev_hdd0/home/00000001/trophy/"; namespace @@ -38,12 +36,22 @@ namespace inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); } } -trophy_manager_dialog::trophy_manager_dialog() : QWidget(), m_sort_column(0), m_col_sort_order(Qt::AscendingOrder) +trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr gui_settings) + : QWidget(), m_sort_column(0), m_col_sort_order(Qt::AscendingOrder), m_gui_settings(gui_settings) { // Nonspecific widget settings setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowTitle(tr("Trophy Manager")); + m_icon_height = m_gui_settings->GetValue(gui::tr_icon_height).toInt(); + m_show_locked_trophies = m_gui_settings->GetValue(gui::tr_show_locked).toBool(); + m_show_unlocked_trophies = m_gui_settings->GetValue(gui::tr_show_unlocked).toBool(); + m_show_hidden_trophies = m_gui_settings->GetValue(gui::tr_show_hidden).toBool(); + m_show_bronze_trophies = m_gui_settings->GetValue(gui::tr_show_bronze).toBool(); + m_show_silver_trophies = m_gui_settings->GetValue(gui::tr_show_silver).toBool(); + m_show_gold_trophies = m_gui_settings->GetValue(gui::tr_show_gold).toBool(); + m_show_platinum_trophies = m_gui_settings->GetValue(gui::tr_show_platinum).toBool(); + // HACK: dev_hdd0 must be mounted for vfs to work for loading trophies. const std::string emu_dir_ = g_cfg.vfs.emulator_dir; const std::string emu_dir = emu_dir_.empty() ? fs::get_config_dir() : emu_dir_; @@ -81,66 +89,156 @@ trophy_manager_dialog::trophy_manager_dialog() : QWidget(), m_sort_column(0), m_ // Checkboxes to control dialog QCheckBox* check_lock_trophy = new QCheckBox(tr("Show Locked Trophies")); check_lock_trophy->setCheckable(true); - check_lock_trophy->setChecked(true); + check_lock_trophy->setChecked(m_show_locked_trophies); QCheckBox* check_unlock_trophy = new QCheckBox(tr("Show Unlocked Trophies")); check_unlock_trophy->setCheckable(true); - check_unlock_trophy->setChecked(true); + check_unlock_trophy->setChecked(m_show_unlocked_trophies); QCheckBox* check_hidden_trophy = new QCheckBox(tr("Show Hidden Trophies")); - check_unlock_trophy->setCheckable(true); - check_unlock_trophy->setChecked(true); + check_hidden_trophy->setCheckable(true); + check_hidden_trophy->setChecked(m_show_hidden_trophies); + + QCheckBox* check_bronze_trophy = new QCheckBox(tr("Show Bronze Trophies")); + check_bronze_trophy->setCheckable(true); + check_bronze_trophy->setChecked(m_show_bronze_trophies); + + QCheckBox* check_silver_trophy = new QCheckBox(tr("Show Silver Trophies")); + check_silver_trophy->setCheckable(true); + check_silver_trophy->setChecked(m_show_silver_trophies); + + QCheckBox* check_gold_trophy = new QCheckBox(tr("Show Gold Trophies")); + check_gold_trophy->setCheckable(true); + check_gold_trophy->setChecked(m_show_gold_trophies); + + QCheckBox* check_platinum_trophy = new QCheckBox(tr("Show Platinum Trophies")); + check_platinum_trophy->setCheckable(true); + check_platinum_trophy->setChecked(m_show_platinum_trophies); QLabel* slider_label = new QLabel(); - slider_label->setText(QString("Icon Size: %0").arg(m_TROPHY_ICON_HEIGHT)); + slider_label->setText(tr("Icon Size: %0").arg(m_icon_height)); - QSlider* icon_slider = new QSlider(Qt::Horizontal); - icon_slider->setRange(25, 225); - icon_slider->setValue(m_TROPHY_ICON_HEIGHT); + m_icon_slider = new QSlider(Qt::Horizontal); + m_icon_slider->setRange(25, 225); + m_icon_slider->setValue(m_icon_height); // LAYOUTS - QGroupBox* settings = new QGroupBox(tr("Trophy View Options")); - settings->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + QGroupBox* show_settings = new QGroupBox(tr("Trophy View Options")); + show_settings->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); QVBoxLayout* settings_layout = new QVBoxLayout(); settings_layout->addWidget(check_lock_trophy); settings_layout->addWidget(check_unlock_trophy); settings_layout->addWidget(check_hidden_trophy); - QHBoxLayout* slider_layout = new QHBoxLayout(); + settings_layout->addWidget(check_bronze_trophy); + settings_layout->addWidget(check_silver_trophy); + settings_layout->addWidget(check_gold_trophy); + settings_layout->addWidget(check_platinum_trophy); + show_settings->setLayout(settings_layout); + + QGroupBox* icon_settings = new QGroupBox(tr("Trophy Icon Options")); + QVBoxLayout* slider_layout = new QVBoxLayout(); slider_layout->addWidget(slider_label); - slider_layout->addWidget(icon_slider); - settings_layout->addLayout(slider_layout); - settings_layout->addStretch(0); - settings->setLayout(settings_layout); + slider_layout->addWidget(m_icon_slider); + icon_settings->setLayout(slider_layout); + + QVBoxLayout* options_layout = new QVBoxLayout(); + options_layout->addStretch(); + options_layout->addWidget(show_settings); + options_layout->addWidget(icon_settings); + options_layout->addStretch(); QHBoxLayout* all_layout = new QHBoxLayout(this); - all_layout->addWidget(settings); + all_layout->addLayout(options_layout); all_layout->addWidget(m_trophy_tree); + all_layout->setStretch(1, 1); setLayout(all_layout); - QSize defaultSize = QDesktopWidget().availableGeometry().size() * 0.7; - resize(defaultSize); + QByteArray geometry = m_gui_settings->GetValue(gui::tr_geometry).toByteArray(); + if (geometry.isEmpty() == false) + { + restoreGeometry(geometry); + } + else + { + resize(QDesktopWidget().availableGeometry().size() * 0.7); + } // Make connects - connect(m_trophy_tree->header(), &QHeaderView::sectionClicked, this, &trophy_manager_dialog::OnColClicked); - connect(icon_slider, &QSlider::valueChanged, this, [=](int val) { - slider_label->setText(QString("Icon Size: %0").arg(val)); + connect(m_icon_slider, &QSlider::valueChanged, this, [=](int val) + { + slider_label->setText(tr("Icon Size: %0").arg(val)); ResizeTrophyIcons(val); - }); - connect(check_lock_trophy, &QCheckBox::clicked, [this](bool val) { - m_show_locked_trophies = val; - ApplyFilter(); + if (m_save_icon_height) + { + m_save_icon_height = false; + m_gui_settings->SetValue(gui::tr_icon_height, val); + } }); - connect(check_unlock_trophy, &QCheckBox::clicked, [this](bool val) { - m_show_unlocked_trophies = val; - ApplyFilter(); + connect(m_icon_slider, &QSlider::sliderReleased, this, [&]() + { + m_gui_settings->SetValue(gui::tr_icon_height, m_icon_slider->value()); }); - connect(check_hidden_trophy, &QCheckBox::clicked, [this](bool val) { - m_show_hidden_trophies = val; - ApplyFilter(); + connect(m_icon_slider, &QSlider::actionTriggered, [&](int action) + { + if (action != QAbstractSlider::SliderNoAction && action != QAbstractSlider::SliderMove) + { // we only want to save on mouseclicks or slider release (the other connect handles this) + m_save_icon_height = true; // actionTriggered happens before the value was changed + } }); + connect(check_lock_trophy, &QCheckBox::clicked, [this](bool checked) + { + m_show_locked_trophies = checked; + ApplyFilter(); + m_gui_settings->SetValue(gui::tr_show_locked, checked); + }); + + connect(check_unlock_trophy, &QCheckBox::clicked, [this](bool checked) + { + m_show_unlocked_trophies = checked; + ApplyFilter(); + m_gui_settings->SetValue(gui::tr_show_unlocked, checked); + }); + + connect(check_hidden_trophy, &QCheckBox::clicked, [this](bool checked) + { + m_show_hidden_trophies = checked; + ApplyFilter(); + m_gui_settings->SetValue(gui::tr_show_hidden, checked); + }); + + connect(check_bronze_trophy, &QCheckBox::clicked, [this](bool checked) + { + m_show_bronze_trophies = checked; + ApplyFilter(); + m_gui_settings->SetValue(gui::tr_show_bronze, checked); + }); + + connect(check_silver_trophy, &QCheckBox::clicked, [this](bool checked) + { + m_show_silver_trophies = checked; + ApplyFilter(); + m_gui_settings->SetValue(gui::tr_show_silver, checked); + }); + + connect(check_gold_trophy, &QCheckBox::clicked, [this](bool checked) + { + m_show_gold_trophies = checked; + ApplyFilter(); + m_gui_settings->SetValue(gui::tr_show_gold, checked); + }); + + connect(check_platinum_trophy, &QCheckBox::clicked, [this](bool checked) + { + m_show_platinum_trophies = checked; + ApplyFilter(); + m_gui_settings->SetValue(gui::tr_show_platinum, checked); + }); + + connect(m_trophy_tree->header(), &QHeaderView::sectionClicked, this, &trophy_manager_dialog::OnColClicked); + connect(m_trophy_tree, &QTableWidget::customContextMenuRequested, this, &trophy_manager_dialog::ShowContextMenu); } @@ -260,6 +358,7 @@ void trophy_manager_dialog::ApplyFilter() { auto* node = game->child(j); int trophy_id = node->text(TrophyColumns::Id).toInt(); + QString trophy_type = node->text(TrophyColumns::Type); // I could use boolean logic and reduce this to something much shorter and also much more confusing... bool hidden = node->data(TrophyColumns::Hidden, Qt::UserRole).toBool(); @@ -278,6 +377,13 @@ void trophy_manager_dialog::ApplyFilter() { hide = true; } + if ((trophy_type == Bronze && !m_show_bronze_trophies) + || (trophy_type == Silver && !m_show_silver_trophies) + || (trophy_type == Gold && !m_show_gold_trophies) + || (trophy_type == Platinum && !m_show_platinum_trophies)) + { + hide = true; + } // Special override to show *just* hidden trophies. if (!m_show_unlocked_trophies && !m_show_locked_trophies && m_show_hidden_trophies) @@ -300,7 +406,7 @@ void trophy_manager_dialog::ShowContextMenu(const QPoint& loc) return; } - QAction* show_trophy_dir = new QAction("Open Trophy Dir", menu); + QAction* show_trophy_dir = new QAction(tr("Open Trophy Dir"), menu); // Only two levels in this tree (ignoring root). So getting the index as such works. int db_ind; @@ -314,7 +420,8 @@ void trophy_manager_dialog::ShowContextMenu(const QPoint& loc) db_ind = item->parent()->data(1, Qt::UserRole).toInt(); } - connect(show_trophy_dir, &QAction::triggered, [=]() { + connect(show_trophy_dir, &QAction::triggered, [=]() + { QString path = qstr(m_trophies_db[db_ind]->path); QDesktopServices::openUrl(QUrl("file:///" + path)); }); @@ -365,14 +472,17 @@ void trophy_manager_dialog::PopulateUI() SceNpTrophyDetails details; details.trophyId = trophy_id; QString trophy_type = ""; - switch (n->GetAttribute("ttype")[0]) { - case 'B': details.trophyGrade = SCE_NP_TROPHY_GRADE_BRONZE; trophy_type = "Bronze"; break; - case 'S': details.trophyGrade = SCE_NP_TROPHY_GRADE_SILVER; trophy_type = "Silver"; break; - case 'G': details.trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; trophy_type = "Gold"; break; - case 'P': details.trophyGrade = SCE_NP_TROPHY_GRADE_PLATINUM; trophy_type = "Platinum"; break; + + switch (n->GetAttribute("ttype")[0]) + { + case 'B': details.trophyGrade = SCE_NP_TROPHY_GRADE_BRONZE; trophy_type = Bronze; break; + case 'S': details.trophyGrade = SCE_NP_TROPHY_GRADE_SILVER; trophy_type = Silver; break; + case 'G': details.trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; trophy_type = Gold; break; + case 'P': details.trophyGrade = SCE_NP_TROPHY_GRADE_PLATINUM; trophy_type = Platinum; break; } - switch (n->GetAttribute("hidden")[0]) { + switch (n->GetAttribute("hidden")[0]) + { case 'y': details.hidden = true; break; case 'n': details.hidden = false; break; } @@ -398,8 +508,8 @@ void trophy_manager_dialog::PopulateUI() } trophy_tree_widget_item* trophy_item = new trophy_tree_widget_item(game_root); - trophy_item->setData(TrophyColumns::Icon, Qt::DecorationRole, data->trophy_images[trophy_id].scaledToHeight(m_TROPHY_ICON_HEIGHT, Qt::SmoothTransformation)); - trophy_item->setSizeHint(TrophyColumns::Icon, QSize(-1, m_TROPHY_ICON_HEIGHT)); + trophy_item->setData(TrophyColumns::Icon, Qt::DecorationRole, data->trophy_images[trophy_id].scaledToHeight(m_icon_height, Qt::SmoothTransformation)); + trophy_item->setSizeHint(TrophyColumns::Icon, QSize(-1, m_icon_height)); trophy_item->setText(TrophyColumns::Name, qstr(details.name)); trophy_item->setText(TrophyColumns::Description, qstr(details.description)); trophy_item->setText(TrophyColumns::Type, trophy_type); @@ -410,6 +520,14 @@ void trophy_manager_dialog::PopulateUI() game_root->addChild(trophy_item); } - game_root->setText(0, qstr(data->game_name) + " : " + QString::number(unlocked_trophies) + "| " + QString::number(data->trop_usr->GetTrophiesCount())); + int all_trophies = data->trop_usr->GetTrophiesCount(); + int percentage = 100 * unlocked_trophies / all_trophies; + game_root->setText(0, qstr(data->game_name) + QString(" : %1% (%2/%3)").arg(percentage).arg(unlocked_trophies).arg(all_trophies)); } } + +void trophy_manager_dialog::closeEvent(QCloseEvent * event) +{ + // Save gui settings + m_gui_settings->SetValue(gui::tr_geometry, saveGeometry()); +} diff --git a/rpcs3/rpcs3qt/trophy_manager_dialog.h b/rpcs3/rpcs3qt/trophy_manager_dialog.h index cacd510605..1d5e4cde8b 100644 --- a/rpcs3/rpcs3qt/trophy_manager_dialog.h +++ b/rpcs3/rpcs3qt/trophy_manager_dialog.h @@ -3,12 +3,14 @@ #include "stdafx.h" #include "rpcs3/Loader/TROPUSR.h" +#include "gui_settings.h" #include "Utilities/rXml.h" #include #include #include +#include struct GameTrophiesData { @@ -32,8 +34,13 @@ enum TrophyColumns class trophy_manager_dialog : public QWidget { + const QString Bronze = "Bronze"; + const QString Silver = "Silver"; + const QString Gold = "Gold"; + const QString Platinum = "Platinum"; + public: - explicit trophy_manager_dialog(); + explicit trophy_manager_dialog(std::shared_ptr gui_settings); private Q_SLOTS: void OnColClicked(int col); void ResizeTrophyIcons(int val); @@ -50,6 +57,10 @@ private: */ void PopulateUI(); + void closeEvent(QCloseEvent* event) override; + + std::shared_ptr m_gui_settings; + std::vector> m_trophies_db; //! Holds all the trophy information. QTreeWidget* m_trophy_tree; //! UI element to display trophy stuff. @@ -59,6 +70,14 @@ private: bool m_show_hidden_trophies = false; bool m_show_unlocked_trophies = true; bool m_show_locked_trophies = true; + bool m_show_bronze_trophies = true; + bool m_show_silver_trophies = true; + bool m_show_gold_trophies = true; + bool m_show_platinum_trophies = true; + + int m_icon_height = 75; + bool m_save_icon_height = false; + QSlider* m_icon_slider = nullptr; }; #endif diff --git a/rpcs3/rpcs3qt/vfs_dialog.cpp b/rpcs3/rpcs3qt/vfs_dialog.cpp index 9816543faa..a011050485 100644 --- a/rpcs3/rpcs3qt/vfs_dialog.cpp +++ b/rpcs3/rpcs3qt/vfs_dialog.cpp @@ -18,19 +18,19 @@ vfs_dialog::vfs_dialog(std::shared_ptr guiSettings, std::shared_pt m_emu_settings->LoadSettings(); // Create tabs - vfs_dialog_tab* emulator_tab = new vfs_dialog_tab({ "$(EmulatorDir)", emu_settings::emulatorLocation, GUI::fs_emulator_dir_list, &g_cfg.vfs.emulator_dir }, + vfs_dialog_tab* emulator_tab = new vfs_dialog_tab({ "$(EmulatorDir)", emu_settings::emulatorLocation, gui::fs_emulator_dir_list, &g_cfg.vfs.emulator_dir }, m_gui_settings, m_emu_settings, this); - vfs_dialog_tab* dev_hdd0_tab = new vfs_dialog_tab({ "dev_hdd0", emu_settings::dev_hdd0Location, GUI::fs_dev_hdd0_list, &g_cfg.vfs.dev_hdd0 }, + vfs_dialog_tab* dev_hdd0_tab = new vfs_dialog_tab({ "dev_hdd0", emu_settings::dev_hdd0Location, gui::fs_dev_hdd0_list, &g_cfg.vfs.dev_hdd0 }, m_gui_settings, m_emu_settings, this); - vfs_dialog_tab* dev_hdd1_tab = new vfs_dialog_tab({ "dev_hdd1", emu_settings::dev_hdd1Location, GUI::fs_dev_hdd1_list, &g_cfg.vfs.dev_hdd1 }, + vfs_dialog_tab* dev_hdd1_tab = new vfs_dialog_tab({ "dev_hdd1", emu_settings::dev_hdd1Location, gui::fs_dev_hdd1_list, &g_cfg.vfs.dev_hdd1 }, m_gui_settings, m_emu_settings, this); - vfs_dialog_tab* dev_flash_tab = new vfs_dialog_tab({ "dev_flash", emu_settings::dev_flashLocation, GUI::fs_dev_flash_list, &g_cfg.vfs.dev_flash }, + vfs_dialog_tab* dev_flash_tab = new vfs_dialog_tab({ "dev_flash", emu_settings::dev_flashLocation, gui::fs_dev_flash_list, &g_cfg.vfs.dev_flash }, m_gui_settings, m_emu_settings, this); - vfs_dialog_tab* dev_usb000_tab = new vfs_dialog_tab({ "dev_usb000", emu_settings::dev_usb000Location, GUI::fs_dev_usb000_list, &g_cfg.vfs.dev_usb000 }, + vfs_dialog_tab* dev_usb000_tab = new vfs_dialog_tab({ "dev_usb000", emu_settings::dev_usb000Location, gui::fs_dev_usb000_list, &g_cfg.vfs.dev_usb000 }, m_gui_settings, m_emu_settings, this); tabs->addTab(emulator_tab, "$(EmulatorDir)"); diff --git a/rpcs3/rpcs3qt/vfs_dialog_tab.h b/rpcs3/rpcs3qt/vfs_dialog_tab.h index 4c417bffd3..ea4e9e70cc 100644 --- a/rpcs3/rpcs3qt/vfs_dialog_tab.h +++ b/rpcs3/rpcs3qt/vfs_dialog_tab.h @@ -14,7 +14,7 @@ struct vfs_settings_info { QString name; // name of tab emu_settings::SettingsType settingLoc; // Where the setting is saved in emu_settings - GUI_SAVE listLocation; // Where the list of dir options are saved + gui_save listLocation; // Where the list of dir options are saved cfg::string* cfg_node; // Needed since emu_settings overrides settings file and doesn't touch g_cfg currently. }; diff --git a/rpcs3/rpcs3qt/welcome_dialog.cpp b/rpcs3/rpcs3qt/welcome_dialog.cpp index 09740a964b..0bd44f8f01 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.cpp +++ b/rpcs3/rpcs3qt/welcome_dialog.cpp @@ -28,7 +28,7 @@ welcome_dialog::welcome_dialog(QWidget* parent) : QDialog(parent), ui(new Ui::we connect(ui->do_not_show, &QCheckBox::clicked, [=](bool checked) { - settings->SetValue(GUI::ib_show_welcome, QVariant(!checked)); + settings->SetValue(gui::ib_show_welcome, QVariant(!checked)); }); connect(ui->okay, &QPushButton::pressed, this, &QDialog::accept);