Dagimon mega level

ani fixes

add color options for toolbar and game icons
This commit is contained in:
Megamouse 2017-07-06 11:48:06 +02:00 committed by Ivan
parent 457c2d364f
commit 1a4e1919fc
16 changed files with 196 additions and 64 deletions

View file

@ -33,6 +33,7 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, const R
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;
@ -49,6 +50,7 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, const R
}
// 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);
@ -149,7 +151,7 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, const R
setWidget(m_Game_Dock);
bool showText = (m_Icon_Size_Str != GUI::gl_icon_key_small && m_Icon_Size_Str != GUI::gl_icon_key_tiny);
m_xgrid = new game_list_grid(m_Icon_Size, m_Margin_Factor, m_Text_Factor, showText);
m_xgrid = new game_list_grid(m_Icon_Size, m_Icon_Color, m_Margin_Factor, m_Text_Factor, showText);
gameList = new QTableWidget();
gameList->setShowGrid(false);
@ -168,7 +170,6 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, const R
gameList->horizontalHeader()->setDefaultSectionSize(150);
gameList->setContextMenuPolicy(Qt::CustomContextMenu);
gameList->setAlternatingRowColors(true);
gameList->setStyleSheet("alternate-background-color: rgb(242, 242, 242);");
gameList->setColumnCount(10);
gameList->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Icon")));
@ -293,6 +294,8 @@ void game_list_frame::LoadSettings()
m_sortColumn = xgui_settings->GetValue(GUI::gl_sortCol).toInt();
m_Icon_Color = xgui_settings->GetValue(GUI::gl_iconColor).value<QColor>();
m_categoryFilters = xgui_settings->GetGameListCategoryFilters();
Refresh(true);
@ -420,7 +423,7 @@ void game_list_frame::Refresh(bool fromDrive)
if (!game.icon_path.empty() && img.load(qstr(game.icon_path)))
{
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32);
scaled.fill(QColor(209, 209, 209, 255));
scaled.fill(m_Icon_Color);
QPainter painter(&scaled);
painter.drawImage(QPoint(0,0), img.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
painter.end();
@ -471,7 +474,7 @@ void game_list_frame::Refresh(bool fromDrive)
m_games_per_row = 0;
}
PopulateGameGrid(m_games_per_row, m_Icon_Size);
PopulateGameGrid(m_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);
@ -715,7 +718,7 @@ void game_list_frame::ResizeIcons(const QString& sizeStr, const QSize& size, con
for (size_t i = 0; i < m_game_data.size(); i++)
{
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32);
scaled.fill(QColor(209, 209, 209, 255));
scaled.fill(m_Icon_Color);
QPainter painter(&scaled);
painter.drawImage(QPoint(0, 0), m_game_data[i].icon.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
painter.end();
@ -828,7 +831,7 @@ int game_list_frame::PopulateGameList()
return result;
}
void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size)
void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size, const QColor& image_color)
{
uint r = 0;
uint c = 0;
@ -841,11 +844,11 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size)
if (m_Icon_Size_Str == GUI::gl_icon_key_medium)
{
m_xgrid = new game_list_grid(image_size, m_Margin_Factor, m_Text_Factor * 2, showText);
m_xgrid = new game_list_grid(image_size, image_color, m_Margin_Factor, m_Text_Factor * 2, showText);
}
else
{
m_xgrid = new game_list_grid(image_size, m_Margin_Factor, m_Text_Factor, showText);
m_xgrid = new game_list_grid(image_size, image_color, m_Margin_Factor, m_Text_Factor, showText);
}
// Get number of things that'll be in grid and precompute grid size.