mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
Qt: sort game_list_frame members
This commit is contained in:
parent
93d2ac887d
commit
e272acd7c1
5 changed files with 192 additions and 130 deletions
|
@ -26,7 +26,6 @@
|
|||
#include <QMimeData>
|
||||
#include <QScrollBar>
|
||||
|
||||
static const std::string m_class_name = "GameViewer";
|
||||
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); }
|
||||
|
||||
|
@ -35,12 +34,12 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
{
|
||||
setAcceptDrops(true);
|
||||
|
||||
m_isListLayout = xgui_settings->GetValue(GUI::gl_listMode).toBool();
|
||||
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<QColor>();
|
||||
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<QColor>();
|
||||
|
||||
m_oldLayoutIsList = m_isListLayout;
|
||||
|
||||
|
@ -110,12 +109,6 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
m_Search_Bar->setMinimumWidth(m_Tool_Bar->height() * 5);
|
||||
m_Search_Bar->setFrame(false);
|
||||
|
||||
connect(m_Search_Bar, &QLineEdit::textChanged, [this](const QString& text)
|
||||
{
|
||||
m_searchText = text;
|
||||
Refresh();
|
||||
});
|
||||
|
||||
// Icon Size Slider
|
||||
m_Slider_Size = new QSlider(Qt::Horizontal , m_Tool_Bar);
|
||||
m_Slider_Size->setRange(0, GUI::gl_max_slider_pos);
|
||||
|
@ -168,17 +161,17 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
m_gameList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_gameList->setAlternatingRowColors(true);
|
||||
|
||||
m_gameList->setColumnCount(10);
|
||||
m_gameList->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Icon")));
|
||||
m_gameList->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Name")));
|
||||
m_gameList->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Serial")));
|
||||
m_gameList->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("Firmware")));
|
||||
m_gameList->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("Version")));
|
||||
m_gameList->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Category")));
|
||||
m_gameList->setHorizontalHeaderItem(6, new QTableWidgetItem(tr("Path")));
|
||||
m_gameList->setHorizontalHeaderItem(7, new QTableWidgetItem(tr("Supported Resolutions")));
|
||||
m_gameList->setHorizontalHeaderItem(8, new QTableWidgetItem(tr("Sound Formats")));
|
||||
m_gameList->setHorizontalHeaderItem(9, 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++)
|
||||
|
@ -194,15 +187,15 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
m_Game_Dock->setCentralWidget(m_Central_Widget);
|
||||
|
||||
// Actions regarding showing/hiding columns
|
||||
QAction* showIconColAct = new QAction(tr("Show Icons"), this);
|
||||
QAction* showNameColAct = new QAction(tr("Show Names"), this);
|
||||
QAction* showSerialColAct = new QAction(tr("Show Serials"), this);
|
||||
QAction* showFWColAct = new QAction(tr("Show Firmwares"), this);
|
||||
QAction* showAppVersionColAct = new QAction(tr("Show Versions"), this);
|
||||
QAction* showCategoryColAct = new QAction(tr("Show Categories"), this);
|
||||
QAction* showPathColAct = new QAction(tr("Show Paths"), this);
|
||||
QAction* showResolutionColAct = new QAction(tr("Show Supported Resolutions"), this);
|
||||
QAction* showSoundFormatColAct = new QAction(tr("Show Sound Formats"), this);
|
||||
QAction* showIconColAct = new QAction(tr("Show Icons"), this);
|
||||
QAction* showNameColAct = new QAction(tr("Show Names"), this);
|
||||
QAction* showSerialColAct = new QAction(tr("Show Serials"), this);
|
||||
QAction* showFWColAct = new QAction(tr("Show Firmwares"), this);
|
||||
QAction* showAppVersionColAct = new QAction(tr("Show Versions"), this);
|
||||
QAction* showCategoryColAct = new QAction(tr("Show Categories"), this);
|
||||
QAction* showPathColAct = new QAction(tr("Show Paths"), this);
|
||||
QAction* showResolutionColAct = new QAction(tr("Show Supported Resolutions"), this);
|
||||
QAction* showSoundFormatColAct = new QAction(tr("Show Sound Formats"), this);
|
||||
QAction* showParentalLevelColAct = new QAction(tr("Show Parental Levels"), this);
|
||||
|
||||
m_columnActs = { showIconColAct, showNameColAct, showSerialColAct, showFWColAct, showAppVersionColAct, showCategoryColAct, showPathColAct,
|
||||
|
@ -210,19 +203,22 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
|
||||
// Events
|
||||
connect(m_gameList, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
|
||||
connect(m_gameList, &QTableWidget::doubleClicked, this, &game_list_frame::doubleClickedSlot);
|
||||
|
||||
connect(m_gameList->horizontalHeader(), &QHeaderView::sectionClicked, this, &game_list_frame::OnColClicked);
|
||||
connect(m_gameList->horizontalHeader(), &QHeaderView::customContextMenuRequested, [=](const QPoint& pos)
|
||||
{
|
||||
QMenu* configure = new QMenu(this);
|
||||
configure->addActions(m_columnActs);
|
||||
configure->exec(mapToGlobal(pos));
|
||||
});
|
||||
connect(m_gameList, &QTableWidget::doubleClicked, this, &game_list_frame::doubleClickedSlot);
|
||||
connect(m_gameList->horizontalHeader(), &QHeaderView::sectionClicked, this, &game_list_frame::OnColClicked);
|
||||
|
||||
connect(m_xgrid, &QTableWidget::doubleClicked, this, &game_list_frame::doubleClickedSlot);
|
||||
connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
|
||||
|
||||
connect(m_Slider_Size, &QSlider::valueChanged, this, &game_list_frame::RequestIconSizeActSet);
|
||||
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::actionTriggered, [&](int action)
|
||||
{
|
||||
|
@ -494,17 +490,15 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
|
|||
}
|
||||
else
|
||||
{
|
||||
int games_per_row = 0;
|
||||
|
||||
if (m_Icon_Size.width() > 0 && m_Icon_Size.height() > 0)
|
||||
{
|
||||
m_games_per_row = width() / (m_Icon_Size.width() + m_Icon_Size.width() * m_xgrid->getMarginFactor() * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_games_per_row = 0;
|
||||
games_per_row = width() / (m_Icon_Size.width() + m_Icon_Size.width() * m_xgrid->getMarginFactor() * 2);
|
||||
}
|
||||
|
||||
int scroll_position = m_xgrid->verticalScrollBar()->value();
|
||||
PopulateGameGrid(m_games_per_row, m_Icon_Size, m_Icon_Color);
|
||||
PopulateGameGrid(games_per_row, m_Icon_Size, m_Icon_Color);
|
||||
connect(m_xgrid, &QTableWidget::doubleClicked, this, &game_list_frame::doubleClickedSlot);
|
||||
connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
|
||||
m_Central_Widget->addWidget(m_xgrid);
|
||||
|
@ -573,7 +567,7 @@ void game_list_frame::doubleClickedSlot(const QModelIndex& index)
|
|||
|
||||
if (m_isListLayout)
|
||||
{
|
||||
i = m_gameList->item(index.row(), 0)->data(Qt::UserRole).toInt();
|
||||
i = m_gameList->item(index.row(), GUI::COLUMN_ICON)->data(Qt::UserRole).toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -600,7 +594,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, 0);
|
||||
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();
|
||||
}
|
||||
|
@ -656,7 +650,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
|
|||
|
||||
connect(boot, &QAction::triggered, [=]
|
||||
{
|
||||
if (Boot(m_game_data[row].info))
|
||||
if (Boot(currGame))
|
||||
{
|
||||
LOG_SUCCESS(LOADER, "Boot from gamelist per Boot: done");
|
||||
}
|
||||
|
@ -674,7 +668,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
|
|||
{
|
||||
if (QMessageBox::question(this, tr("Confirm Delete"), tr("Permanently delete files?")) == QMessageBox::Yes)
|
||||
{
|
||||
fs::remove_all(m_game_data[row].info.path);
|
||||
fs::remove_all(currGame.path);
|
||||
m_game_data.erase(m_game_data.begin() + row);
|
||||
Refresh();
|
||||
}
|
||||
|
@ -982,38 +976,40 @@ int game_list_frame::PopulateGameList()
|
|||
return curr;
|
||||
};
|
||||
|
||||
int row = 0;
|
||||
for (size_t i = 0; i < m_game_data.size(); i++)
|
||||
int row = 0, index = -1;
|
||||
for (const auto& game : m_game_data)
|
||||
{
|
||||
if (!m_game_data[i].isVisible)
|
||||
index++;
|
||||
|
||||
if (!game.isVisible)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Icon
|
||||
QTableWidgetItem* iconItem = new QTableWidgetItem;
|
||||
iconItem->setFlags(iconItem->flags() & ~Qt::ItemIsEditable);
|
||||
iconItem->setData(Qt::DecorationRole, m_game_data[i].pxmap);
|
||||
iconItem->setData(Qt::UserRole, (int)i);
|
||||
QTableWidgetItem* icon_item = new QTableWidgetItem;
|
||||
icon_item->setFlags(icon_item->flags() & ~Qt::ItemIsEditable);
|
||||
icon_item->setData(Qt::DecorationRole, game.pxmap);
|
||||
icon_item->setData(Qt::UserRole, index);
|
||||
|
||||
QTableWidgetItem* titleItem = l_GetItem(m_game_data[i].info.name);
|
||||
if (m_game_data[i].hasCustomConfig)
|
||||
QTableWidgetItem* title_item = l_GetItem(game.info.name);
|
||||
if (game.hasCustomConfig)
|
||||
{
|
||||
titleItem->setIcon(QIcon(":/Icons/cog_black.png"));
|
||||
title_item->setIcon(QIcon(":/Icons/cog_black.png"));
|
||||
}
|
||||
|
||||
m_gameList->setItem(row, 0, iconItem);
|
||||
m_gameList->setItem(row, 1, titleItem);
|
||||
m_gameList->setItem(row, 2, l_GetItem(m_game_data[i].info.serial));
|
||||
m_gameList->setItem(row, 3, l_GetItem(m_game_data[i].info.fw));
|
||||
m_gameList->setItem(row, 4, l_GetItem(m_game_data[i].info.app_ver));
|
||||
m_gameList->setItem(row, 5, l_GetItem(m_game_data[i].info.category));
|
||||
m_gameList->setItem(row, 6, l_GetItem(m_game_data[i].info.path));
|
||||
m_gameList->setItem(row, 7, l_GetItem(GetStringFromU32(m_game_data[i].info.resolution, resolution::mode, true)));
|
||||
m_gameList->setItem(row, 8, l_GetItem(GetStringFromU32(m_game_data[i].info.sound_format, sound::format, true)));
|
||||
m_gameList->setItem(row, 9, l_GetItem(GetStringFromU32(m_game_data[i].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 == m_game_data[i].info.icon_path) result = row;
|
||||
if (selected_item == game.info.icon_path) result = row;
|
||||
|
||||
row++;
|
||||
}
|
||||
|
|
|
@ -217,6 +217,7 @@ public:
|
|||
/** Repaint Gamelist Icons with new background color */
|
||||
void RepaintIcons(const bool& fromSettings = false);
|
||||
|
||||
/** Return current icon size slider value */
|
||||
int GetSliderValue();
|
||||
|
||||
public Q_SLOTS:
|
||||
|
@ -269,15 +270,18 @@ private:
|
|||
// Which widget we are displaying depends on if we are in grid or list mode.
|
||||
QMainWindow* m_Game_Dock;
|
||||
QStackedWidget* m_Central_Widget;
|
||||
QToolBar* m_Tool_Bar;
|
||||
QLineEdit* m_Search_Bar;
|
||||
QSlider* m_Slider_Size;
|
||||
game_list* m_gameList;
|
||||
|
||||
// Game Grid
|
||||
game_list_grid* m_xgrid;
|
||||
|
||||
// Game List
|
||||
game_list* m_gameList;
|
||||
QList<QAction*> m_columnActs;
|
||||
Qt::SortOrder m_colSortOrder;
|
||||
int m_sortColumn;
|
||||
|
||||
// Actions regarding showing/hiding categories
|
||||
// Categories
|
||||
QStringList m_categoryFilters;
|
||||
Tool_Bar_Button m_catActHDD;
|
||||
Tool_Bar_Button m_catActDisc;
|
||||
Tool_Bar_Button m_catActHome;
|
||||
|
@ -285,34 +289,36 @@ private:
|
|||
Tool_Bar_Button m_catActAudioVideo;
|
||||
Tool_Bar_Button m_catActUnknown;
|
||||
Tool_Bar_Button m_catActOther;
|
||||
|
||||
QList<Tool_Bar_Button*> m_categoryButtons;
|
||||
|
||||
QActionGroup* m_categoryActs;
|
||||
|
||||
// Actions regarding switching list modes
|
||||
// List Mode
|
||||
Tool_Bar_Button m_modeActList;
|
||||
Tool_Bar_Button m_modeActGrid;
|
||||
|
||||
QActionGroup* m_modeActs;
|
||||
|
||||
// TODO: Reorganize this into a sensible order for private variables.
|
||||
std::shared_ptr<gui_settings> xgui_settings;
|
||||
std::shared_ptr<emu_settings> xemu_settings;
|
||||
|
||||
int m_sortColumn;
|
||||
Qt::SortOrder m_colSortOrder;
|
||||
bool m_isListLayout = true;
|
||||
bool m_oldLayoutIsList = true;
|
||||
bool m_showToolBar = true;
|
||||
|
||||
// Data
|
||||
std::shared_ptr<gui_settings> xgui_settings;
|
||||
std::shared_ptr<emu_settings> xemu_settings;
|
||||
std::vector<GUI_GameInfo> m_game_data;
|
||||
QSize m_Icon_Size;
|
||||
int m_icon_size_index;
|
||||
QColor m_Icon_Color;
|
||||
qreal m_Margin_Factor;
|
||||
qreal m_Text_Factor;
|
||||
QStringList m_categoryFilters;
|
||||
|
||||
// Toolbar
|
||||
QToolBar* m_Tool_Bar;
|
||||
bool m_showToolBar = true;
|
||||
|
||||
// Search Bar
|
||||
QLineEdit* m_Search_Bar;
|
||||
QString m_searchText;
|
||||
|
||||
uint m_games_per_row = 0;
|
||||
// Icon Size Slider
|
||||
QSlider* m_Slider_Size;
|
||||
int m_icon_size_index;
|
||||
|
||||
// Icons
|
||||
QColor m_Icon_Color;
|
||||
QSize m_Icon_Size;
|
||||
qreal m_Margin_Factor;
|
||||
qreal m_Text_Factor;
|
||||
};
|
||||
|
|
|
@ -300,7 +300,7 @@ logs::level gui_settings::GetLogLevel()
|
|||
bool gui_settings::GetGamelistColVisibility(int col)
|
||||
{
|
||||
// hide sound format and parental level
|
||||
bool show = col != 8 && col != 9;
|
||||
bool show = col != GUI::COLUMN_SOUND && col != GUI::COLUMN_PARENTAL;
|
||||
return GetValue(GUI_SAVE(GUI::game_list, "Col" + QString::number(col) + "visible", show)).toBool();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,22 @@ 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_COUNT
|
||||
};
|
||||
|
||||
const QSize gl_icon_size_min = QSize(40, 22);
|
||||
const QSize gl_icon_size_small = QSize(80, 44);
|
||||
const QSize gl_icon_size_medium = QSize(160, 88);
|
||||
|
@ -92,14 +108,14 @@ namespace GUI
|
|||
const QString fs = "FileSystem";
|
||||
const QString gs_frame = "GSFrame";
|
||||
|
||||
const QColor mw_tool_bar_color = QColor(227, 227, 227, 255);
|
||||
const QColor mw_tool_icon_color = QColor(64, 64, 64, 255);
|
||||
const QColor mw_thumb_icon_color = QColor(0, 100, 231, 255);
|
||||
const QColor gl_icon_color = QColor(209, 209, 209, 255);
|
||||
const QColor gl_tool_icon_color = QColor(0, 100, 231, 255);
|
||||
const QColor gl_tool_icon_color = QColor( 0, 100, 231, 255);
|
||||
const QColor mw_tool_icon_color = QColor( 64, 64, 64, 255);
|
||||
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 );
|
||||
|
@ -141,11 +157,11 @@ namespace GUI
|
|||
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) );
|
||||
|
@ -153,16 +169,16 @@ namespace GUI
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
/** Class for GUI settings..
|
||||
|
|
|
@ -46,25 +46,25 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
QJsonObject json_obj = QJsonDocument::fromJson(json_file.readAll()).object();
|
||||
json_file.close();
|
||||
|
||||
QJsonObject json_cpu = json_obj.value("cpu").toObject();
|
||||
QJsonObject json_cpu = json_obj.value("cpu").toObject();
|
||||
QJsonObject json_cpu_ppu = json_cpu.value("PPU").toObject();
|
||||
QJsonObject json_cpu_spu = json_cpu.value("SPU").toObject();
|
||||
QJsonObject json_cpu_cbs = json_cpu.value("checkboxes").toObject();
|
||||
QJsonObject json_cpu_cbo = json_cpu.value("comboboxes").toObject();
|
||||
QJsonObject json_cpu_lib = json_cpu.value("libraries").toObject();
|
||||
|
||||
QJsonObject json_gpu = json_obj.value("gpu").toObject();
|
||||
QJsonObject json_gpu_cbo = json_gpu.value("comboboxes").toObject();
|
||||
QJsonObject json_gpu = json_obj.value("gpu").toObject();
|
||||
QJsonObject json_gpu_cbo = json_gpu.value("comboboxes").toObject();
|
||||
QJsonObject json_gpu_main = json_gpu.value("main").toObject();
|
||||
QJsonObject json_gpu_deb = json_gpu.value("debug").toObject();
|
||||
QJsonObject json_gpu_deb = json_gpu.value("debug").toObject();
|
||||
|
||||
QJsonObject json_audio = json_obj.value("audio").toObject();
|
||||
QJsonObject json_input = json_obj.value("input").toObject();
|
||||
QJsonObject json_sys = json_obj.value("system").toObject();
|
||||
QJsonObject json_net = json_obj.value("network").toObject();
|
||||
QJsonObject json_sys = json_obj.value("system").toObject();
|
||||
QJsonObject json_net = json_obj.value("network").toObject();
|
||||
|
||||
QJsonObject json_emu = json_obj.value("emulator").toObject();
|
||||
QJsonObject json_emu_gui = json_emu.value("gui").toObject();
|
||||
QJsonObject json_emu = json_obj.value("emulator").toObject();
|
||||
QJsonObject json_emu_gui = json_emu.value("gui").toObject();
|
||||
QJsonObject json_emu_misc = json_emu.value("misc").toObject();
|
||||
|
||||
QJsonObject json_debug = json_obj.value("debug").toObject();
|
||||
|
@ -97,8 +97,13 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
xemu_settings->SaveSettings();
|
||||
accept();
|
||||
});
|
||||
|
||||
connect(ui->cancelButton, &QAbstractButton::clicked, this, &QWidget::close);
|
||||
connect(ui->tabWidget, &QTabWidget::currentChanged, [=]() {ui->cancelButton->setFocus(); });
|
||||
|
||||
connect(ui->tabWidget, &QTabWidget::currentChanged, [=]()
|
||||
{
|
||||
ui->cancelButton->setFocus();
|
||||
});
|
||||
|
||||
// _____ _____ _ _ _______ _
|
||||
// / ____| __ \| | | | |__ __| | |
|
||||
|
@ -157,7 +162,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
}
|
||||
#endif
|
||||
|
||||
connect(ppuBG->button(i), &QAbstractButton::pressed, [=]() {xemu_settings->SetSetting(emu_settings::PPUDecoder, sstr(ppu_list[i])); });
|
||||
connect(ppuBG->button(i), &QAbstractButton::pressed, [=]()
|
||||
{
|
||||
xemu_settings->SetSetting(emu_settings::PPUDecoder, sstr(ppu_list[i]));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +194,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
spuBG->button(i)->setChecked(true);
|
||||
}
|
||||
|
||||
connect(spuBG->button(i), &QAbstractButton::pressed, [=]() {xemu_settings->SetSetting(emu_settings::SPUDecoder, sstr(spu_list[i])); });
|
||||
connect(spuBG->button(i), &QAbstractButton::pressed, [=]()
|
||||
{
|
||||
xemu_settings->SetSetting(emu_settings::SPUDecoder, sstr(spu_list[i]));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +227,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
libModeBG->button(i)->setChecked(true);
|
||||
}
|
||||
|
||||
connect(libModeBG->button(i), &QAbstractButton::pressed, [=]() {xemu_settings->SetSetting(emu_settings::LibLoadOptions, sstr(libmode_list[i])); });
|
||||
connect(libModeBG->button(i), &QAbstractButton::pressed, [=]()
|
||||
{
|
||||
xemu_settings->SetSetting(emu_settings::LibLoadOptions, sstr(libmode_list[i]));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -677,6 +691,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
};
|
||||
|
||||
connect(ui->okButton, &QAbstractButton::clicked, [=]() { ApplyGuiOptions(); });
|
||||
|
||||
connect(ui->pb_reset_default, &QAbstractButton::clicked, [=]
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Reset GUI to default?"), tr("This will include your stylesheet as well. Do you wish to proceed?"),
|
||||
|
@ -691,11 +706,21 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
AddColoredIcons();
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->pb_backup_config, &QAbstractButton::clicked, this, &settings_dialog::OnBackupCurrentConfig);
|
||||
connect(ui->pb_apply_config, &QAbstractButton::clicked, this, &settings_dialog::OnApplyConfig);
|
||||
connect(ui->pb_apply_stylesheet, &QAbstractButton::clicked, this, &settings_dialog::OnApplyStylesheet);
|
||||
connect(ui->pb_open_folder, &QAbstractButton::clicked, [=]() {QDesktopServices::openUrl(xgui_settings->GetSettingsDir()); });
|
||||
connect(ui->cb_show_welcome, &QCheckBox::clicked, [=](bool val) {xgui_settings->SetValue(GUI::ib_show_welcome, val); });
|
||||
|
||||
connect(ui->pb_open_folder, &QAbstractButton::clicked, [=]()
|
||||
{
|
||||
QDesktopServices::openUrl(xgui_settings->GetSettingsDir());
|
||||
});
|
||||
|
||||
connect(ui->cb_show_welcome, &QCheckBox::clicked, [=](bool 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);
|
||||
|
@ -726,13 +751,32 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
Q_EMIT GuiRepaintRequest();
|
||||
}
|
||||
};
|
||||
connect(ui->pb_gl_icon_color, &QAbstractButton::clicked, [=]() { 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); });
|
||||
connect(ui->pb_tool_bar_color, &QAbstractButton::clicked, [=]() { 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); });
|
||||
|
||||
connect(ui->pb_gl_icon_color, &QAbstractButton::clicked, [=]()
|
||||
{
|
||||
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);
|
||||
});
|
||||
|
||||
connect(ui->pb_tool_bar_color, &QAbstractButton::clicked, [=]()
|
||||
{
|
||||
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);
|
||||
});
|
||||
|
||||
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); });
|
||||
connect(ui->gs_disableMouse, &QCheckBox::clicked, [=](bool val)
|
||||
{
|
||||
xgui_settings->SetValue(GUI::gs_disableMouse, val);
|
||||
});
|
||||
|
||||
bool enableButtons = xgui_settings->GetValue(GUI::gs_resize).toBool();
|
||||
ui->gs_resizeOnBoot->setChecked(enableButtons);
|
||||
|
|
Loading…
Add table
Reference in a new issue