Merge pull request #12896 from LillyJadeKatrin/retroachievements-visual-improvements

RetroAchievements - Dialog Visual Improvements
This commit is contained in:
JMC47 2024-06-30 01:30:34 -04:00 committed by GitHub
commit cff37a9f4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 28 additions and 14 deletions

View File

@ -47,6 +47,12 @@ AchievementBox::AchievementBox(QWidget* parent, rc_client_achievement_t* achieve
m_progress_label->setStyleSheet(QStringLiteral("background-color:transparent;"));
m_progress_label->setAlignment(Qt::AlignCenter);
QVBoxLayout* a_col_left = new QVBoxLayout();
a_col_left->addSpacerItem(new QSpacerItem(0, 0));
a_col_left->addWidget(m_badge);
a_col_left->addSpacerItem(new QSpacerItem(0, 0));
a_col_left->setSizeConstraint(QLayout::SetFixedSize);
a_col_left->setAlignment(Qt::AlignCenter);
QVBoxLayout* a_col_right = new QVBoxLayout();
a_col_right->addWidget(title);
a_col_right->addWidget(description);
@ -57,7 +63,7 @@ AchievementBox::AchievementBox(QWidget* parent, rc_client_achievement_t* achieve
a_prog_layout->setContentsMargins(0, 0, 0, 0);
a_prog_layout->addWidget(m_progress_label);
QHBoxLayout* a_total = new QHBoxLayout();
a_total->addWidget(m_badge);
a_total->addLayout(a_col_left);
a_total->addLayout(a_col_right);
setLayout(a_total);

View File

@ -30,6 +30,7 @@ AchievementLeaderboardWidget::AchievementLeaderboardWidget(QWidget* parent) : QW
layout->setContentsMargins(0, 0, 0, 0);
layout->setAlignment(Qt::AlignTop);
layout->addWidget(m_common_box);
layout->setSizeConstraint(QLayout::SetFixedSize);
setLayout(layout);
}
@ -50,7 +51,8 @@ void AchievementLeaderboardWidget::UpdateData(bool clean_all)
for (u32 bucket = 0; bucket < leaderboard_list->num_buckets; bucket++)
{
const auto& leaderboard_bucket = leaderboard_list->buckets[bucket];
m_common_layout->addWidget(new QLabel(tr(leaderboard_bucket.label)));
m_common_layout->addWidget(new QLabel(tr(leaderboard_bucket.label)), row, 0);
row += 2;
for (u32 board = 0; board < leaderboard_bucket.num_leaderboards; board++)
{
const auto* leaderboard = leaderboard_bucket.leaderboards[board];
@ -64,24 +66,18 @@ void AchievementLeaderboardWidget::UpdateData(bool clean_all)
QVBoxLayout* a_col_left = new QVBoxLayout();
a_col_left->addWidget(a_title);
a_col_left->addWidget(a_description);
if (row > 0)
{
QFrame* a_divider = new QFrame();
a_divider->setFrameShape(QFrame::HLine);
m_common_layout->addWidget(a_divider, row - 1, 0);
}
QFrame* a_divider = new QFrame();
a_divider->setFrameShape(QFrame::HLine);
m_common_layout->addWidget(a_divider, row - 1, 0);
m_common_layout->addLayout(a_col_left, row, 0);
for (size_t ix = 0; ix < 4; ix++)
{
QVBoxLayout* a_col = new QVBoxLayout();
for (size_t jx = 0; jx < 3; jx++)
a_col->addWidget(new QLabel(QStringLiteral("---")));
if (row > 0)
{
QFrame* a_divider = new QFrame();
a_divider->setFrameShape(QFrame::HLine);
m_common_layout->addWidget(a_divider, row - 1, static_cast<int>(ix) + 1);
}
QFrame* a_divider_2 = new QFrame();
a_divider_2->setFrameShape(QFrame::HLine);
m_common_layout->addWidget(a_divider_2, row - 1, static_cast<int>(ix) + 1);
m_common_layout->addLayout(a_col, row, static_cast<int>(ix) + 1);
}
row += 2;

View File

@ -33,6 +33,7 @@ AchievementProgressWidget::AchievementProgressWidget(QWidget* parent) : QWidget(
layout->setContentsMargins(0, 0, 0, 0);
layout->setAlignment(Qt::AlignTop);
layout->addWidget(m_common_box);
layout->setSizeConstraint(QLayout::SetFixedSize);
setLayout(layout);
}

View File

@ -7,6 +7,8 @@
#include <mutex>
#include <QDialogButtonBox>
#include <QScrollArea>
#include <QScrollBar>
#include <QTabWidget>
#include <QVBoxLayout>
@ -83,6 +85,8 @@ void AchievementsWindow::UpdateData(AchievementManager::UpdatedItems updated_ite
m_header_widget->UpdateData();
m_progress_widget->UpdateData(true);
m_leaderboard_widget->UpdateData(true);
static_cast<QScrollArea*>(m_tab_widget->widget(1))->verticalScrollBar()->setValue(0);
static_cast<QScrollArea*>(m_tab_widget->widget(2))->verticalScrollBar()->setValue(0);
}
else
{

View File

@ -493,3 +493,10 @@ QTableCornerButton::section {
border-left: 0px;
border-bottom: 0px;
}
QProgressBar {
border: 2px solid grey;
border-radius: 5px;
background-color: #202020;
}