mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
GUI fixes + log stacking (#2897)
* Add Stacking option to log contextmenu Squashed commit: [69f296af] cleanup [4f4bf41f] use contextmenu instead [e67036bc] use gui settings instead (+1 squashed commits) Squashed commits: [b3913dbe] fix backwards selection (+1 squashed commits) Squashed commits: [1e150f04] add stacking option (+3 squashed commit) Squashed commit: [be78da4f] fix scroll [d3450c21] fix clearSelection [e962ec9c] fix log color issue * fix recent games related app crash * gamelist improvements Squashed commit: [aa1f79c2] fix title names & con background [d8381984] fix gamelist search * finally fix show menu bug * add rows to gamelist: resolutions, sound formats and parental level * fix gamelist loadsettings
This commit is contained in:
parent
645f0e63ab
commit
fd4a153eef
9 changed files with 257 additions and 59 deletions
|
@ -161,16 +161,31 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, Render_
|
||||||
gameList->verticalHeader()->setMaximumSectionSize(m_Icon_Size.height());
|
gameList->verticalHeader()->setMaximumSectionSize(m_Icon_Size.height());
|
||||||
gameList->verticalHeader()->setVisible(false);
|
gameList->verticalHeader()->setVisible(false);
|
||||||
gameList->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
|
gameList->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
gameList->horizontalHeader()->setHighlightSections(false);
|
||||||
|
gameList->horizontalHeader()->setSortIndicatorShown(true);
|
||||||
|
gameList->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
gameList->horizontalHeader()->setDefaultSectionSize(150);
|
||||||
gameList->setContextMenuPolicy(Qt::CustomContextMenu);
|
gameList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
gameList->setAlternatingRowColors(true);
|
||||||
|
gameList->setStyleSheet("alternate-background-color: rgb(242, 242, 242);");
|
||||||
|
|
||||||
gameList->setColumnCount(7);
|
gameList->setColumnCount(10);
|
||||||
gameList->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Icon")));
|
gameList->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Icon")));
|
||||||
gameList->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Name")));
|
gameList->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Name")));
|
||||||
gameList->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Serial")));
|
gameList->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Serial")));
|
||||||
gameList->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("FW")));
|
gameList->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("Firmware")));
|
||||||
gameList->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("App version")));
|
gameList->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("Version")));
|
||||||
gameList->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Category")));
|
gameList->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Category")));
|
||||||
gameList->setHorizontalHeaderItem(6, new QTableWidgetItem(tr("Path")));
|
gameList->setHorizontalHeaderItem(6, new QTableWidgetItem(tr("Path")));
|
||||||
|
gameList->setHorizontalHeaderItem(7, new QTableWidgetItem(tr("Supported Resolutions")));
|
||||||
|
gameList->setHorizontalHeaderItem(8, new QTableWidgetItem(tr("Sound Formats")));
|
||||||
|
gameList->setHorizontalHeaderItem(9, new QTableWidgetItem(tr("Parental Level")));
|
||||||
|
|
||||||
|
// since this won't work somehow: gameList->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
|
for (int i = 0; i < gameList->horizontalHeader()->count(); i++)
|
||||||
|
{
|
||||||
|
gameList->horizontalHeaderItem(i)->setTextAlignment(Qt::AlignLeft);
|
||||||
|
}
|
||||||
|
|
||||||
m_Central_Widget = new QStackedWidget(this);
|
m_Central_Widget = new QStackedWidget(this);
|
||||||
m_Central_Widget->addWidget(gameList);
|
m_Central_Widget->addWidget(gameList);
|
||||||
|
@ -183,18 +198,22 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, Render_
|
||||||
showIconColAct = new QAction(tr("Show Icons"), this);
|
showIconColAct = new QAction(tr("Show Icons"), this);
|
||||||
showNameColAct = new QAction(tr("Show Names"), this);
|
showNameColAct = new QAction(tr("Show Names"), this);
|
||||||
showSerialColAct = new QAction(tr("Show Serials"), this);
|
showSerialColAct = new QAction(tr("Show Serials"), this);
|
||||||
showFWColAct = new QAction(tr("Show FWs"), this);
|
showFWColAct = new QAction(tr("Show Firmwares"), this);
|
||||||
showAppVersionColAct = new QAction(tr("Show App Versions"), this);
|
showAppVersionColAct = new QAction(tr("Show Versions"), this);
|
||||||
showCategoryColAct = new QAction(tr("Show Categories"), this);
|
showCategoryColAct = new QAction(tr("Show Categories"), this);
|
||||||
showPathColAct = new QAction(tr("Show Paths"), this);
|
showPathColAct = new QAction(tr("Show Paths"), this);
|
||||||
|
showResolutionColAct = new QAction(tr("Show Supported Resolutions"), this);
|
||||||
|
showSoundFormatColAct = new QAction(tr("Show Sound Formats"), this);
|
||||||
|
showParentalLevelColAct = new QAction(tr("Show Parental Levels"), this);
|
||||||
|
|
||||||
columnActs = { showIconColAct, showNameColAct, showSerialColAct, showFWColAct, showAppVersionColAct, showCategoryColAct, showPathColAct };
|
columnActs = { showIconColAct, showNameColAct, showSerialColAct, showFWColAct, showAppVersionColAct, showCategoryColAct, showPathColAct,
|
||||||
|
showResolutionColAct, showSoundFormatColAct, showParentalLevelColAct };
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
connect(gameList, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
|
connect(gameList, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
|
||||||
connect(gameList->horizontalHeader(), &QHeaderView::customContextMenuRequested, [=](const QPoint& pos) {
|
connect(gameList->horizontalHeader(), &QHeaderView::customContextMenuRequested, [=](const QPoint& pos) {
|
||||||
QMenu* configure = new QMenu(this);
|
QMenu* configure = new QMenu(this);
|
||||||
configure->addActions({ showIconColAct, showNameColAct, showSerialColAct, showFWColAct, showAppVersionColAct, showCategoryColAct, showPathColAct });
|
configure->addActions(columnActs);
|
||||||
configure->exec(mapToGlobal(pos));
|
configure->exec(mapToGlobal(pos));
|
||||||
});
|
});
|
||||||
connect(gameList, &QTableWidget::doubleClicked, this, &game_list_frame::doubleClickedSlot);
|
connect(gameList, &QTableWidget::doubleClicked, this, &game_list_frame::doubleClickedSlot);
|
||||||
|
@ -236,42 +255,45 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, Render_
|
||||||
gameList->setColumnHidden(col, !val); // Negate because it's a set col hidden and we have menu say show.
|
gameList->setColumnHidden(col, !val); // Negate because it's a set col hidden and we have menu say show.
|
||||||
xgui_settings->SetGamelistColVisibility(col, val);
|
xgui_settings->SetGamelistColVisibility(col, val);
|
||||||
};
|
};
|
||||||
columnActs[col]->setChecked(xgui_settings->GetGamelistColVisibility(col));
|
|
||||||
connect(columnActs[col], &QAction::triggered, l_CallBack);
|
connect(columnActs[col], &QAction::triggered, l_CallBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
|
||||||
LoadSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_list_frame::LoadSettings()
|
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.
|
||||||
|
if (gameList->rowCount() > 0)
|
||||||
|
{
|
||||||
|
gameList->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||||
|
gameList->horizontalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||||
|
gameList->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gameList->horizontalHeader()->restoreState(state);
|
||||||
|
}
|
||||||
|
|
||||||
for (int col = 0; col < columnActs.count(); ++col)
|
for (int col = 0; col < columnActs.count(); ++col)
|
||||||
{
|
{
|
||||||
bool vis = xgui_settings->GetGamelistColVisibility(col);
|
bool vis = xgui_settings->GetGamelistColVisibility(col);
|
||||||
columnActs[col]->setChecked(vis);
|
columnActs[col]->setChecked(vis);
|
||||||
gameList->setColumnHidden(col, !vis);
|
gameList->setColumnHidden(col, !vis);
|
||||||
}
|
}
|
||||||
bool sortAsc = Qt::SortOrder(xgui_settings->GetValue(GUI::gl_sortAsc).toBool());
|
|
||||||
m_colSortOrder = sortAsc ? Qt::AscendingOrder : Qt::DescendingOrder;
|
gameList->horizontalHeader()->restoreState(gameList->horizontalHeader()->saveState());
|
||||||
|
gameList->horizontalHeader()->stretchLastSection();
|
||||||
|
|
||||||
|
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_categoryFilters = xgui_settings->GetGameListCategoryFilters();
|
m_categoryFilters = xgui_settings->GetGameListCategoryFilters();
|
||||||
|
|
||||||
if (state.isEmpty())
|
|
||||||
{ // If no settings exist, go to default.
|
|
||||||
gameList->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
|
||||||
gameList->horizontalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
|
||||||
gameList->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gameList->horizontalHeader()->restoreState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
Refresh(true);
|
Refresh(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,19 +328,16 @@ void game_list_frame::FilterData()
|
||||||
for (int i = 0; i < gameList->rowCount(); ++i)
|
for (int i = 0; i < gameList->rowCount(); ++i)
|
||||||
{
|
{
|
||||||
bool match = false;
|
bool match = false;
|
||||||
for (auto filter : m_categoryFilters)
|
const QString category = qstr(m_game_data[i].info.category);
|
||||||
|
for (const auto& filter : m_categoryFilters)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < gameList->columnCount(); ++j)
|
if (category.contains(filter))
|
||||||
{
|
{
|
||||||
if (gameList->horizontalHeaderItem(j)->text() == tr("Category") && gameList->item(i, j)->text().contains(filter))
|
match = true;
|
||||||
{
|
break;
|
||||||
match = true;
|
|
||||||
goto OutOfThis;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutOfThis:
|
gameList->setRowHidden(i, !match || !SearchMatchesApp(m_game_data[i].info.name, m_game_data[i].info.serial));
|
||||||
gameList->setRowHidden(i, !match);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,10 +373,10 @@ void game_list_frame::Refresh(bool fromDrive)
|
||||||
GameInfo game;
|
GameInfo game;
|
||||||
game.root = entry.name;
|
game.root = entry.name;
|
||||||
game.serial = psf::get_string(psf, "TITLE_ID", "");
|
game.serial = psf::get_string(psf, "TITLE_ID", "");
|
||||||
game.name = psf::get_string(psf, "TITLE", "unknown");
|
game.name = psf::get_string(psf, "TITLE", sstr(category::unknown));
|
||||||
game.app_ver = psf::get_string(psf, "APP_VER", "unknown");
|
game.app_ver = psf::get_string(psf, "APP_VER", sstr(category::unknown));
|
||||||
game.category = psf::get_string(psf, "CATEGORY", "unknown");
|
game.category = psf::get_string(psf, "CATEGORY", sstr(category::unknown));
|
||||||
game.fw = psf::get_string(psf, "PS3_SYSTEM_VER", "unknown");
|
game.fw = psf::get_string(psf, "PS3_SYSTEM_VER", sstr(category::unknown));
|
||||||
game.parental_lvl = psf::get_integer(psf, "PARENTAL_LEVEL");
|
game.parental_lvl = psf::get_integer(psf, "PARENTAL_LEVEL");
|
||||||
game.resolution = psf::get_integer(psf, "RESOLUTION");
|
game.resolution = psf::get_integer(psf, "RESOLUTION");
|
||||||
game.sound_format = psf::get_integer(psf, "SOUND_FORMAT");
|
game.sound_format = psf::get_integer(psf, "SOUND_FORMAT");
|
||||||
|
@ -383,12 +402,13 @@ void game_list_frame::Refresh(bool fromDrive)
|
||||||
game.icon_path = dir + "/ICON0.PNG";
|
game.icon_path = dir + "/ICON0.PNG";
|
||||||
game.category = sstr(cat->second);
|
game.category = sstr(cat->second);
|
||||||
}
|
}
|
||||||
else if (game.category == "unknown")
|
else if (game.category == sstr(category::unknown))
|
||||||
{
|
{
|
||||||
game.category = sstr(category::unknown);
|
game.icon_path = dir + "/ICON0.PNG";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
game.icon_path = dir + "/ICON0.PNG";
|
||||||
game.category = sstr(category::other);
|
game.category = sstr(category::other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +418,11 @@ void game_list_frame::Refresh(bool fromDrive)
|
||||||
|
|
||||||
if (!game.icon_path.empty() && img.load(qstr(game.icon_path)))
|
if (!game.icon_path.empty() && img.load(qstr(game.icon_path)))
|
||||||
{
|
{
|
||||||
QImage scaled = img.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation);
|
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32);
|
||||||
|
scaled.fill(QColor(209, 209, 209, 255));
|
||||||
|
QPainter painter(&scaled);
|
||||||
|
painter.drawImage(QPoint(0,0), img.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
|
||||||
|
painter.end();
|
||||||
pxmap = QPixmap::fromImage(scaled);
|
pxmap = QPixmap::fromImage(scaled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -458,7 +482,7 @@ void game_list_frame::Refresh(bool fromDrive)
|
||||||
void game_list_frame::ToggleCategoryFilter(const QStringList& categories, bool show)
|
void game_list_frame::ToggleCategoryFilter(const QStringList& categories, bool show)
|
||||||
{
|
{
|
||||||
if (show) { m_categoryFilters.append(categories); }
|
if (show) { m_categoryFilters.append(categories); }
|
||||||
else { for (auto cat : categories) m_categoryFilters.removeAll(cat); }
|
else { for (const auto& cat : categories) m_categoryFilters.removeAll(cat); }
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,7 +710,12 @@ void game_list_frame::ResizeIcons(const QSize& size, const int& idx)
|
||||||
|
|
||||||
for (size_t i = 0; i < m_game_data.size(); i++)
|
for (size_t i = 0; i < m_game_data.size(); i++)
|
||||||
{
|
{
|
||||||
m_game_data[i].pxmap = QPixmap::fromImage(m_game_data[i].icon.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
|
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32);
|
||||||
|
scaled.fill(QColor(209, 209, 209, 255));
|
||||||
|
QPainter painter(&scaled);
|
||||||
|
painter.drawImage(QPoint(0, 0), m_game_data[i].icon.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
|
||||||
|
painter.end();
|
||||||
|
m_game_data[i].pxmap = QPixmap::fromImage(scaled);
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
|
@ -758,15 +787,8 @@ int game_list_frame::PopulateGameList()
|
||||||
};
|
};
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (GUI_GameInfo game : m_game_data)
|
for (const GUI_GameInfo& game : m_game_data)
|
||||||
{
|
{
|
||||||
if (SearchMatchesApp(game.info.name, game.info.serial) == false)
|
|
||||||
{
|
|
||||||
// We aren't showing this entry. Decrement row count to avoid empty entries at end.
|
|
||||||
gameList->setRowCount(gameList->rowCount() - 1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Icon
|
// Icon
|
||||||
QTableWidgetItem* iconItem = new QTableWidgetItem;
|
QTableWidgetItem* iconItem = new QTableWidgetItem;
|
||||||
iconItem->setFlags(iconItem->flags() & ~Qt::ItemIsEditable);
|
iconItem->setFlags(iconItem->flags() & ~Qt::ItemIsEditable);
|
||||||
|
@ -780,6 +802,9 @@ int game_list_frame::PopulateGameList()
|
||||||
gameList->setItem(row, 4, l_GetItem(game.info.app_ver));
|
gameList->setItem(row, 4, l_GetItem(game.info.app_ver));
|
||||||
gameList->setItem(row, 5, l_GetItem(game.info.category));
|
gameList->setItem(row, 5, l_GetItem(game.info.category));
|
||||||
gameList->setItem(row, 6, l_GetItem(game.info.root));
|
gameList->setItem(row, 6, l_GetItem(game.info.root));
|
||||||
|
gameList->setItem(row, 7, l_GetItem(GetStringFromU32(game.info.resolution, resolution::mode, true)));
|
||||||
|
gameList->setItem(row, 8, l_GetItem(GetStringFromU32(game.info.sound_format, sound::format, true)));
|
||||||
|
gameList->setItem(row, 9, l_GetItem(GetStringFromU32(game.info.parental_lvl, parental::level)));
|
||||||
|
|
||||||
if (selected_item == game.info.icon_path) result = row;
|
if (selected_item == game.info.icon_path) result = row;
|
||||||
|
|
||||||
|
@ -811,7 +836,7 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size)
|
||||||
|
|
||||||
// Get number of things that'll be in grid and precompute grid size.
|
// Get number of things that'll be in grid and precompute grid size.
|
||||||
int entries = 0;
|
int entries = 0;
|
||||||
for (GUI_GameInfo game : m_game_data)
|
for (const GUI_GameInfo& game : m_game_data)
|
||||||
{
|
{
|
||||||
if (qstr(game.info.category) == category::disc_Game || qstr(game.info.category) == category::hdd_Game)
|
if (qstr(game.info.category) == category::disc_Game || qstr(game.info.category) == category::hdd_Game)
|
||||||
{
|
{
|
||||||
|
@ -910,3 +935,33 @@ std::string game_list_frame::CurrentSelectionIconPath()
|
||||||
|
|
||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string game_list_frame::GetStringFromU32(const u32& key, const std::map<u32, QString>& map, bool combined)
|
||||||
|
{
|
||||||
|
QStringList string;
|
||||||
|
|
||||||
|
if (combined)
|
||||||
|
{
|
||||||
|
for (const auto& item : map)
|
||||||
|
{
|
||||||
|
if (key & item.first)
|
||||||
|
{
|
||||||
|
string << item.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (map.find(key) != map.end())
|
||||||
|
{
|
||||||
|
string << map.at(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.isEmpty())
|
||||||
|
{
|
||||||
|
string << tr("Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
return sstr(string.join(", "));
|
||||||
|
}
|
||||||
|
|
|
@ -102,6 +102,53 @@ namespace category // (see PARAM.SFO in psdevwiki.com) TODO: Disc Categories
|
||||||
const QStringList others = { network, store_FE, trophy, other };
|
const QStringList others = { network, store_FE, trophy, other };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace parental
|
||||||
|
{
|
||||||
|
// These values are partly generalized. They can vary between country and category
|
||||||
|
// Normally only values 1,2,3,5,7 and 9 are used
|
||||||
|
const std::map<u32, QString> level
|
||||||
|
{
|
||||||
|
{ 1, QObject::tr("0+") },
|
||||||
|
{ 2, QObject::tr("3+") },
|
||||||
|
{ 3, QObject::tr("7+") },
|
||||||
|
{ 4, QObject::tr("10+") },
|
||||||
|
{ 5, QObject::tr("12+") },
|
||||||
|
{ 6, QObject::tr("15+") },
|
||||||
|
{ 7, QObject::tr("16+") },
|
||||||
|
{ 8, QObject::tr("17+") },
|
||||||
|
{ 9, QObject::tr("18+") },
|
||||||
|
{ 10, QObject::tr("Level 10") },
|
||||||
|
{ 11, QObject::tr("Level 11") }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace resolution
|
||||||
|
{
|
||||||
|
// there might be different values for other categories
|
||||||
|
const std::map<u32, QString> mode
|
||||||
|
{
|
||||||
|
{ 1 << 0, QObject::tr("480p") },
|
||||||
|
{ 1 << 1, QObject::tr("576p") },
|
||||||
|
{ 1 << 2, QObject::tr("720p") },
|
||||||
|
{ 1 << 3, QObject::tr("1080p") },
|
||||||
|
{ 1 << 4, QObject::tr("480p 16:9") },
|
||||||
|
{ 1 << 5, QObject::tr("576p 16:9") },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace sound
|
||||||
|
{
|
||||||
|
const std::map<u32, QString> format
|
||||||
|
{
|
||||||
|
{ 1 << 0, QObject::tr("LPCM 2.0") },
|
||||||
|
//{ 1 << 1, QObject::tr("LPCM ???") },
|
||||||
|
{ 1 << 2, QObject::tr("LPCM 5.1") },
|
||||||
|
{ 1 << 4, QObject::tr("LPCM 7.1") },
|
||||||
|
{ 1 << 8, QObject::tr("Dolby Digital 5.1") },
|
||||||
|
{ 1 << 9, QObject::tr("DTS 5.1") },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/* Having the icons associated with the game info simplifies logic internally */
|
/* Having the icons associated with the game info simplifies logic internally */
|
||||||
typedef struct GUI_GameInfo
|
typedef struct GUI_GameInfo
|
||||||
{
|
{
|
||||||
|
@ -167,6 +214,7 @@ private:
|
||||||
bool SearchMatchesApp(const std::string& name, const std::string& serial);
|
bool SearchMatchesApp(const std::string& name, const std::string& serial);
|
||||||
|
|
||||||
std::string CurrentSelectionIconPath();
|
std::string CurrentSelectionIconPath();
|
||||||
|
std::string GetStringFromU32(const u32& key, const std::map<u32, QString>& map, bool combined = false);
|
||||||
|
|
||||||
// Which widget we are displaying depends on if we are in grid or list mode.
|
// Which widget we are displaying depends on if we are in grid or list mode.
|
||||||
QMainWindow* m_Game_Dock;
|
QMainWindow* m_Game_Dock;
|
||||||
|
@ -185,6 +233,9 @@ private:
|
||||||
QAction* showAppVersionColAct;
|
QAction* showAppVersionColAct;
|
||||||
QAction* showCategoryColAct;
|
QAction* showCategoryColAct;
|
||||||
QAction* showPathColAct;
|
QAction* showPathColAct;
|
||||||
|
QAction* showResolutionColAct;
|
||||||
|
QAction* showSoundFormatColAct;
|
||||||
|
QAction* showParentalLevelColAct;
|
||||||
|
|
||||||
QList<QAction*> columnActs;
|
QList<QAction*> columnActs;
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,13 @@ void game_list_grid::addItem(const QPixmap& img, const QString& name, const int&
|
||||||
QImage exp_img = QImage(exp_size, QImage::Format_ARGB32);
|
QImage exp_img = QImage(exp_size, QImage::Format_ARGB32);
|
||||||
exp_img.fill(Qt::transparent);
|
exp_img.fill(Qt::transparent);
|
||||||
|
|
||||||
|
// create background for image
|
||||||
|
QImage bg_img = QImage(img.size(), QImage::Format_ARGB32);
|
||||||
|
bg_img.fill(QColor(209, 209, 209, 255));
|
||||||
|
|
||||||
// place raw image inside expanded image
|
// place raw image inside expanded image
|
||||||
QPainter painter(&exp_img);
|
QPainter painter(&exp_img);
|
||||||
|
painter.drawImage(offset, bg_img);
|
||||||
painter.drawPixmap(offset, img);
|
painter.drawPixmap(offset, img);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,9 @@ void gui_settings::ShowInfoBox(const GUI_SAVE& entry, const QString& title, cons
|
||||||
|
|
||||||
void gui_settings::SetGamelistColVisibility(int col, bool val)
|
void gui_settings::SetGamelistColVisibility(int col, bool val)
|
||||||
{
|
{
|
||||||
SetValue(GUI_SAVE(GUI::game_list, "Col" + QString::number(col) + "visible", true), 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_settings::SaveCurrentConfig(const QString& friendlyName)
|
void gui_settings::SaveCurrentConfig(const QString& friendlyName)
|
||||||
|
@ -190,7 +192,9 @@ logs::level gui_settings::GetLogLevel()
|
||||||
|
|
||||||
bool gui_settings::GetGamelistColVisibility(int col)
|
bool gui_settings::GetGamelistColVisibility(int col)
|
||||||
{
|
{
|
||||||
return GetValue(GUI_SAVE(GUI::game_list, "Col" + QString::number(col) + "visible", true)).toBool();
|
// hide sound format and parental level
|
||||||
|
bool show = col != 8 && col != 9;
|
||||||
|
return GetValue(GUI_SAVE(GUI::game_list, "Col" + QString::number(col) + "visible", show)).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList gui_settings::GetConfigEntries()
|
QStringList gui_settings::GetConfigEntries()
|
||||||
|
|
|
@ -96,6 +96,7 @@ namespace GUI
|
||||||
|
|
||||||
const GUI_SAVE l_tty = GUI_SAVE( logger, "TTY", true );
|
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_level = GUI_SAVE( logger, "level", (uint)(logs::level::success) );
|
||||||
|
const GUI_SAVE l_stack = GUI_SAVE( logger, "stack", false );
|
||||||
|
|
||||||
const GUI_SAVE m_currentConfig = GUI_SAVE(meta, "currentConfig", QObject::tr("CurrentSettings"));
|
const GUI_SAVE m_currentConfig = GUI_SAVE(meta, "currentConfig", QObject::tr("CurrentSettings"));
|
||||||
const GUI_SAVE m_currentStylesheet = GUI_SAVE(meta, "currentStylesheet", QObject::tr("default"));
|
const GUI_SAVE m_currentStylesheet = GUI_SAVE(meta, "currentStylesheet", QObject::tr("default"));
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
#include <QScrollBar>
|
||||||
|
|
||||||
inline QString qstr(const std::string& _in) { return QString::fromUtf8(_in.data(), _in.size()); }
|
inline QString qstr(const std::string& _in) { return QString::fromUtf8(_in.data(), _in.size()); }
|
||||||
|
|
||||||
|
@ -135,6 +136,8 @@ log_frame::log_frame(std::shared_ptr<gui_settings> guiSettings, QWidget *parent)
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addActions({ nothingAct, fatalAct, errorAct, todoAct, successAct, warningAct, noticeAct, traceAct });
|
menu->addActions({ nothingAct, fatalAct, errorAct, todoAct, successAct, warningAct, noticeAct, traceAct });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
menu->addAction(stackAct);
|
||||||
|
menu->addSeparator();
|
||||||
menu->addAction(TTYAct);
|
menu->addAction(TTYAct);
|
||||||
menu->exec(mapToGlobal(pos));
|
menu->exec(mapToGlobal(pos));
|
||||||
});
|
});
|
||||||
|
@ -231,6 +234,13 @@ void log_frame::CreateAndConnectActions()
|
||||||
noticeAct = new QAction(tr("Notice"), logLevels);
|
noticeAct = new QAction(tr("Notice"), logLevels);
|
||||||
traceAct = new QAction(tr("Trace"), logLevels);
|
traceAct = new QAction(tr("Trace"), logLevels);
|
||||||
|
|
||||||
|
stackAct = new QAction(tr("Stack Mode"), this);
|
||||||
|
stackAct->setCheckable(true);
|
||||||
|
connect(stackAct, &QAction::toggled, xgui_settings.get(), [=](bool checked) {
|
||||||
|
xgui_settings->SetValue(GUI::l_stack, checked);
|
||||||
|
m_stack_log = checked;
|
||||||
|
});
|
||||||
|
|
||||||
TTYAct = new QAction(tr("TTY"), this);
|
TTYAct = new QAction(tr("TTY"), this);
|
||||||
TTYAct->setCheckable(true);
|
TTYAct->setCheckable(true);
|
||||||
connect(TTYAct, &QAction::triggered, xgui_settings.get(), [=](bool checked){
|
connect(TTYAct, &QAction::triggered, xgui_settings.get(), [=](bool checked){
|
||||||
|
@ -253,6 +263,7 @@ void log_frame::LoadSettings()
|
||||||
{
|
{
|
||||||
SetLogLevel(xgui_settings->GetLogLevel());
|
SetLogLevel(xgui_settings->GetLogLevel());
|
||||||
SetTTYLogging(xgui_settings->GetValue(GUI::l_tty).toBool());
|
SetTTYLogging(xgui_settings->GetValue(GUI::l_tty).toBool());
|
||||||
|
stackAct->setChecked(xgui_settings->GetValue(GUI::l_stack).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_frame::UpdateUI()
|
void log_frame::UpdateUI()
|
||||||
|
@ -324,10 +335,70 @@ void log_frame::UpdateUI()
|
||||||
|
|
||||||
// Print UTF-8 text.
|
// Print UTF-8 text.
|
||||||
text += qstr(packet->msg);
|
text += qstr(packet->msg);
|
||||||
log->setTextColor(color);
|
|
||||||
|
// save old log state
|
||||||
|
QScrollBar *sb = log->verticalScrollBar();
|
||||||
|
bool isMax = sb->value() == sb->maximum();
|
||||||
|
int sb_pos = sb->value();
|
||||||
|
int sel_pos = log->textCursor().position();
|
||||||
|
int sel_start = log->textCursor().selectionStart();
|
||||||
|
int sel_end = log->textCursor().selectionEnd();
|
||||||
|
|
||||||
|
// clear selection or else it will get colorized as well
|
||||||
|
QTextCursor c = log->textCursor();
|
||||||
|
c.clearSelection();
|
||||||
|
log->setTextCursor(c);
|
||||||
|
|
||||||
// remove the new line because Qt's append adds a new line already.
|
// remove the new line because Qt's append adds a new line already.
|
||||||
text.chop(1);
|
text.chop(1);
|
||||||
|
|
||||||
|
QString suffix;
|
||||||
|
bool isSame = text == m_old_text;
|
||||||
|
|
||||||
|
// create counter suffix and remove recurring line if needed
|
||||||
|
if (m_stack_log)
|
||||||
|
{
|
||||||
|
if (isSame)
|
||||||
|
{
|
||||||
|
m_log_counter++;
|
||||||
|
suffix = QString(" x%1").arg(m_log_counter);
|
||||||
|
log->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
|
||||||
|
log->moveCursor(QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
|
||||||
|
log->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor);
|
||||||
|
log->textCursor().removeSelectedText();
|
||||||
|
log->textCursor().deletePreviousChar();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log_counter = 1;
|
||||||
|
m_old_text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add actual log message
|
||||||
|
log->setTextColor(color);
|
||||||
log->append(text);
|
log->append(text);
|
||||||
|
|
||||||
|
// add counter suffix if needed
|
||||||
|
if (m_stack_log && isSame)
|
||||||
|
{
|
||||||
|
log->setTextColor(Qt::white);
|
||||||
|
log->insertPlainText(suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we mark text from right to left we need to swap sides (start is always smaller than end)
|
||||||
|
if (sel_pos < sel_end)
|
||||||
|
{
|
||||||
|
std::swap(sel_start, sel_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset old text cursor and selection
|
||||||
|
c.setPosition(sel_start);
|
||||||
|
c.setPosition(sel_end, QTextCursor::KeepAnchor);
|
||||||
|
log->setTextCursor(c);
|
||||||
|
|
||||||
|
// set scrollbar to max means auto-scroll
|
||||||
|
sb->setValue(isMax ? sb->maximum() : sb_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop packet
|
// Drop packet
|
||||||
|
|
|
@ -38,6 +38,9 @@ private:
|
||||||
QTabWidget *tabWidget;
|
QTabWidget *tabWidget;
|
||||||
QTextEdit *log;
|
QTextEdit *log;
|
||||||
QTextEdit *tty;
|
QTextEdit *tty;
|
||||||
|
QString m_old_text;
|
||||||
|
ullong m_log_counter;
|
||||||
|
bool m_stack_log;
|
||||||
|
|
||||||
fs::file tty_file;
|
fs::file tty_file;
|
||||||
|
|
||||||
|
@ -53,6 +56,8 @@ private:
|
||||||
QAction* noticeAct;
|
QAction* noticeAct;
|
||||||
QAction* traceAct;
|
QAction* traceAct;
|
||||||
|
|
||||||
|
QAction* stackAct;
|
||||||
|
|
||||||
QAction* TTYAct;
|
QAction* TTYAct;
|
||||||
|
|
||||||
std::shared_ptr<gui_settings> xgui_settings;
|
std::shared_ptr<gui_settings> xgui_settings;
|
||||||
|
|
|
@ -1424,6 +1424,12 @@ void main_window::ConfigureGuiFromSettings(bool configureAll)
|
||||||
freezeRecentAct->setChecked(guiSettings->GetValue(GUI::rg_freeze).toBool());
|
freezeRecentAct->setChecked(guiSettings->GetValue(GUI::rg_freeze).toBool());
|
||||||
m_rg_entries = guiSettings->Var2List(guiSettings->GetValue(GUI::rg_entries));
|
m_rg_entries = guiSettings->Var2List(guiSettings->GetValue(GUI::rg_entries));
|
||||||
|
|
||||||
|
// clear recent games menu of actions
|
||||||
|
for (auto act : m_recentGameActs)
|
||||||
|
{
|
||||||
|
m_bootRecentMenu->removeAction(act);
|
||||||
|
}
|
||||||
|
m_recentGameActs.clear();
|
||||||
// Fill the recent games menu
|
// Fill the recent games menu
|
||||||
for (uint i = 0; i < m_rg_entries.count(); i++)
|
for (uint i = 0; i < m_rg_entries.count(); i++)
|
||||||
{
|
{
|
||||||
|
@ -1442,10 +1448,10 @@ void main_window::ConfigureGuiFromSettings(bool configureAll)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showLogAct->setChecked(guiSettings->GetValue(GUI::mw_logger).toBool());
|
showLogAct->setChecked(logFrame->isVisible() || guiSettings->GetValue(GUI::mw_logger).toBool());
|
||||||
showGameListAct->setChecked(guiSettings->GetValue(GUI::mw_gamelist).toBool());
|
showGameListAct->setChecked(gameListFrame->isVisible() || guiSettings->GetValue(GUI::mw_gamelist).toBool());
|
||||||
showDebuggerAct->setChecked(guiSettings->GetValue(GUI::mw_debugger).toBool());
|
showDebuggerAct->setChecked(debuggerFrame->isVisible() || guiSettings->GetValue(GUI::mw_debugger).toBool());
|
||||||
showControlsAct->setChecked(guiSettings->GetValue(GUI::mw_controls).toBool());
|
showControlsAct->setChecked(controls->isVisible() || guiSettings->GetValue(GUI::mw_controls).toBool());
|
||||||
showGameListToolBarAct->setChecked(guiSettings->GetValue(GUI::gl_toolBarVisible).toBool());
|
showGameListToolBarAct->setChecked(guiSettings->GetValue(GUI::gl_toolBarVisible).toBool());
|
||||||
guiSettings->GetValue(GUI::mw_controls).toBool() ? controls->show() : controls->hide();
|
guiSettings->GetValue(GUI::mw_controls).toBool() ? controls->show() : controls->hide();
|
||||||
|
|
||||||
|
|
|
@ -28,4 +28,4 @@ misc_tab::misc_tab(std::shared_ptr<emu_settings> xemu_settings, QWidget *parent)
|
||||||
QHBoxLayout *hbox = new QHBoxLayout;
|
QHBoxLayout *hbox = new QHBoxLayout;
|
||||||
hbox->addLayout(vbox_left);
|
hbox->addLayout(vbox_left);
|
||||||
setLayout(hbox);
|
setLayout(hbox);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue