mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 06:21:26 +12:00
Qt: add setting for save manager background icon colors + fix icon size
This commit is contained in:
parent
d4c635a83c
commit
2f12226ff9
7 changed files with 53 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
#include "rpcs3_app.h"
|
#include "rpcs3_app.h"
|
||||||
|
|
||||||
#include "rpcs3qt/qt_utils.h"
|
#include "rpcs3qt/qt_utils.h"
|
||||||
|
|
||||||
|
@ -371,6 +371,9 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& path)
|
||||||
// game list icon color
|
// game list icon color
|
||||||
"QLabel#gamelist_icon_background_color { color: rgba(240, 240, 240, 255); }"
|
"QLabel#gamelist_icon_background_color { color: rgba(240, 240, 240, 255); }"
|
||||||
|
|
||||||
|
// save manager icon color
|
||||||
|
"QLabel#save_manager_icon_background_color { color: rgba(240, 240, 240, 255); }"
|
||||||
|
|
||||||
// tables
|
// tables
|
||||||
"QTableWidget { alternate-background-color: #f2f2f2; background-color: #fff; border: none; }"
|
"QTableWidget { alternate-background-color: #f2f2f2; background-color: #fff; border: none; }"
|
||||||
"QTableWidget#game_grid { alternate-background-color: #f2f2f2; background-color: #fff; font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); border: 0em solid white; }"
|
"QTableWidget#game_grid { alternate-background-color: #f2f2f2; background-color: #fff; font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); border: 0em solid white; }"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Utilities/Log.h"
|
#include "Utilities/Log.h"
|
||||||
|
|
||||||
|
@ -227,6 +227,7 @@ namespace gui
|
||||||
|
|
||||||
const gui_save sd_geometry = gui_save(savedata, "geometry", QByteArray());
|
const gui_save sd_geometry = gui_save(savedata, "geometry", QByteArray());
|
||||||
const gui_save sd_icon_size = gui_save(savedata, "icon_size", 60);
|
const gui_save sd_icon_size = gui_save(savedata, "icon_size", 60);
|
||||||
|
const gui_save sd_icon_color = gui_save(savedata, "icon_color", gl_icon_color);
|
||||||
|
|
||||||
const gui_save um_geometry = gui_save(users, "geometry", QByteArray());
|
const gui_save um_geometry = gui_save(users, "geometry", QByteArray());
|
||||||
const gui_save um_active_user = gui_save(users, "active_user", "00000001");
|
const gui_save um_active_user = gui_save(users, "active_user", "00000001");
|
||||||
|
|
|
@ -1321,8 +1321,9 @@ void main_window::CreateConnects()
|
||||||
|
|
||||||
connect(ui->confSavedataManagerAct, &QAction::triggered, [=]
|
connect(ui->confSavedataManagerAct, &QAction::triggered, [=]
|
||||||
{
|
{
|
||||||
save_manager_dialog* sdid = new save_manager_dialog(guiSettings);
|
save_manager_dialog* save_manager = new save_manager_dialog(guiSettings);
|
||||||
sdid->show();
|
connect(this, &main_window::RequestTrophyManagerRepaint, save_manager, &save_manager_dialog::HandleRepaintUiRequest);
|
||||||
|
save_manager->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->actionManage_Trophy_Data, &QAction::triggered, [=]
|
connect(ui->actionManage_Trophy_Data, &QAction::triggered, [=]
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include "save_manager_dialog.h"
|
#include "save_manager_dialog.h"
|
||||||
|
|
||||||
#include "save_data_info_dialog.h"
|
#include "save_data_info_dialog.h"
|
||||||
#include "custom_table_widget_item.h"
|
#include "custom_table_widget_item.h"
|
||||||
|
#include "qt_utils.h"
|
||||||
|
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "Emu/VFS.h"
|
#include "Emu/VFS.h"
|
||||||
|
@ -232,6 +233,15 @@ void save_manager_dialog::UpdateList()
|
||||||
|
|
||||||
QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();
|
QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();
|
||||||
|
|
||||||
|
if (m_gui_settings->GetValue(gui::m_enableUIColors).toBool())
|
||||||
|
{
|
||||||
|
m_icon_color = m_gui_settings->GetValue(gui::sd_icon_color).value<QColor>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_icon_color = gui::utils::get_label_color("save_manager_icon_background_color");
|
||||||
|
}
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (const SaveDataEntry& entry : m_save_entries)
|
for (const SaveDataEntry& entry : m_save_entries)
|
||||||
{
|
{
|
||||||
|
@ -239,7 +249,8 @@ void save_manager_dialog::UpdateList()
|
||||||
if (!icon.loadFromData(entry.iconBuf.data(), static_cast<uint>(entry.iconBuf.size())))
|
if (!icon.loadFromData(entry.iconBuf.data(), static_cast<uint>(entry.iconBuf.size())))
|
||||||
{
|
{
|
||||||
LOG_WARNING(GENERAL, "Loading icon for save %s failed", entry.dirName);
|
LOG_WARNING(GENERAL, "Loading icon for save %s failed", entry.dirName);
|
||||||
icon.fill(Qt::transparent);
|
icon = QPixmap(320, 176);
|
||||||
|
icon.fill(m_icon_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString title = qstr(entry.title) + QStringLiteral("\n") + qstr(entry.subtitle);
|
QString title = qstr(entry.title) + QStringLiteral("\n") + qstr(entry.subtitle);
|
||||||
|
@ -290,6 +301,17 @@ void save_manager_dialog::UpdateList()
|
||||||
resize(preferredSize.boundedTo(maxSize));
|
resize(preferredSize.boundedTo(maxSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save_manager_dialog::HandleRepaintUiRequest()
|
||||||
|
{
|
||||||
|
const QSize window_size = size();
|
||||||
|
const Qt::SortOrder sort_order = m_sort_ascending ? Qt::AscendingOrder : Qt::DescendingOrder;
|
||||||
|
|
||||||
|
UpdateList();
|
||||||
|
|
||||||
|
m_list->sortByColumn(m_sort_column, sort_order);
|
||||||
|
resize(window_size);
|
||||||
|
}
|
||||||
|
|
||||||
void save_manager_dialog::UpdateIcons()
|
void save_manager_dialog::UpdateIcons()
|
||||||
{
|
{
|
||||||
const int dpr = devicePixelRatio();
|
const int dpr = devicePixelRatio();
|
||||||
|
@ -306,7 +328,7 @@ void save_manager_dialog::UpdateIcons()
|
||||||
|
|
||||||
QPixmap icon = QPixmap(data.size() * dpr);
|
QPixmap icon = QPixmap(data.size() * dpr);
|
||||||
icon.setDevicePixelRatio(dpr);
|
icon.setDevicePixelRatio(dpr);
|
||||||
icon.fill(Qt::transparent);
|
icon.fill(m_icon_color);
|
||||||
|
|
||||||
QPainter painter(&icon);
|
QPainter painter(&icon);
|
||||||
painter.drawPixmap(0, 0, data);
|
painter.drawPixmap(0, 0, data);
|
||||||
|
|
|
@ -21,6 +21,8 @@ public:
|
||||||
* There'll be some duplicated code. But, in the future, there'll be no duplicated code. So, I don't care.
|
* 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::shared_ptr<gui_settings> gui_settings, std::string dir = "", QWidget* parent = nullptr);
|
explicit save_manager_dialog(std::shared_ptr<gui_settings> gui_settings, std::string dir = "", QWidget* parent = nullptr);
|
||||||
|
public Q_SLOTS:
|
||||||
|
void HandleRepaintUiRequest();
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void OnEntryRemove();
|
void OnEntryRemove();
|
||||||
void OnEntriesRemove();
|
void OnEntriesRemove();
|
||||||
|
@ -44,6 +46,7 @@ private:
|
||||||
int m_sort_column;
|
int m_sort_column;
|
||||||
bool m_sort_ascending;
|
bool m_sort_ascending;
|
||||||
QSize m_icon_size;
|
QSize m_icon_size;
|
||||||
|
QColor m_icon_color;
|
||||||
|
|
||||||
QLabel* m_details_icon = nullptr;
|
QLabel* m_details_icon = nullptr;
|
||||||
QLabel* m_details_title = nullptr;
|
QLabel* m_details_title = nullptr;
|
||||||
|
|
|
@ -1280,6 +1280,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||||
auto AddColoredIcons = [=]()
|
auto AddColoredIcons = [=]()
|
||||||
{
|
{
|
||||||
addColoredIcon(ui->pb_gl_icon_color, xgui_settings->GetValue(gui::gl_iconColor).value<QColor>());
|
addColoredIcon(ui->pb_gl_icon_color, xgui_settings->GetValue(gui::gl_iconColor).value<QColor>());
|
||||||
|
addColoredIcon(ui->pb_sd_icon_color, xgui_settings->GetValue(gui::sd_icon_color).value<QColor>());
|
||||||
};
|
};
|
||||||
AddColoredIcons();
|
AddColoredIcons();
|
||||||
|
|
||||||
|
@ -1292,6 +1293,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||||
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->cb_custom_colors->setChecked(enableUIColors);
|
||||||
ui->pb_gl_icon_color->setEnabled(enableUIColors);
|
ui->pb_gl_icon_color->setEnabled(enableUIColors);
|
||||||
|
ui->pb_sd_icon_color->setEnabled(enableUIColors);
|
||||||
|
|
||||||
auto ApplyGuiOptions = [&](bool reset = false)
|
auto ApplyGuiOptions = [&](bool reset = false)
|
||||||
{
|
{
|
||||||
|
@ -1367,6 +1369,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||||
{
|
{
|
||||||
xgui_settings->SetValue(gui::m_enableUIColors, val);
|
xgui_settings->SetValue(gui::m_enableUIColors, val);
|
||||||
ui->pb_gl_icon_color->setEnabled(val);
|
ui->pb_gl_icon_color->setEnabled(val);
|
||||||
|
ui->pb_sd_icon_color->setEnabled(val);
|
||||||
Q_EMIT GuiRepaintRequest();
|
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)
|
||||||
|
@ -1395,6 +1398,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||||
{
|
{
|
||||||
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_sd_icon_color, &QAbstractButton::clicked, [=]()
|
||||||
|
{
|
||||||
|
colorDialog(gui::sd_icon_color, tr("Choose save manager icon color"), ui->pb_sd_icon_color);
|
||||||
|
});
|
||||||
|
|
||||||
AddConfigs();
|
AddConfigs();
|
||||||
AddStylesheets();
|
AddStylesheets();
|
||||||
|
|
|
@ -2048,6 +2048,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_sd_icon_color">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save manager icons</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_5">
|
<spacer name="verticalSpacer_5">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue