Skip to content

Commit 57dabe2

Browse files
committed
error fix
1 parent 5cb4f9d commit 57dabe2

4 files changed

Lines changed: 33 additions & 21 deletions

File tree

src/gamecard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
GameCard::GameCard(QWidget* parent)
1313
: QWidget(parent)
1414
{
15-
setFixedSize(170, 256);
15+
setFixedSize(190, 285);
1616
setCursor(Qt::PointingHandCursor);
1717
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
1818
}

src/mainwindow.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ MainWindow::MainWindow(QWidget* parent)
109109
, m_nameFetchSearchId(0)
110110
, m_hasCachedData(false)
111111
{
112+
// Retrieve username first so UI reflects it correctly (Avatar initial)
113+
QSettings settings("LuaPatcher", "SteamLuaPatcher");
114+
m_username = settings.value("username", "User").toString();
115+
112116
setWindowTitle("Steam Lua Patcher");
113117
setMinimumSize(900, 600);
114-
resize(1350, 820);
118+
resize(1480, 900);
115119
setAcceptDrops(true);
116120

117121
// ── Enable Transparency for Desktop Blur ──
@@ -127,10 +131,6 @@ MainWindow::MainWindow(QWidget* parent)
127131
// Apply Desktop Acrylic/Mica Blur
128132
enableAcrylicBlur();
129133

130-
// Retrieve username from settings (already checked in main.cpp)
131-
QSettings settings("LuaPatcher", "SteamLuaPatcher");
132-
m_username = settings.value("username", "User").toString();
133-
134134
m_debounceTimer = new QTimer(this);
135135
m_debounceTimer->setSingleShot(true);
136136
connect(m_debounceTimer, &QTimer::timeout, this, &MainWindow::doSearch);
@@ -561,7 +561,7 @@ void MainWindow::initUI() {
561561
for (QChar c : displayName) colorIdx += c.unicode();
562562
QColor avatarColor = avatarColors[colorIdx % 8];
563563

564-
int avatarSize = 36;
564+
int avatarSize = 40;
565565
QPixmap avatarPix(avatarSize, avatarSize);
566566
avatarPix.fill(Qt::transparent);
567567
QPainter avatarPainter(&avatarPix);
@@ -570,7 +570,7 @@ void MainWindow::initUI() {
570570
avatarPainter.setPen(Qt::NoPen);
571571
avatarPainter.drawEllipse(0, 0, avatarSize, avatarSize);
572572
avatarPainter.setPen(Qt::white);
573-
QFont avatarFont("Segoe UI", 15, QFont::Bold);
573+
QFont avatarFont("Segoe UI", 18, QFont::Bold);
574574
avatarPainter.setFont(avatarFont);
575575
avatarPainter.drawText(QRect(0, 0, avatarSize, avatarSize), Qt::AlignCenter, QString(firstLetter));
576576
avatarPainter.end();
@@ -613,14 +613,14 @@ void MainWindow::initUI() {
613613
m_mainScrollContainer = new QWidget();
614614
m_mainScrollContainer->setStyleSheet("background: transparent;");
615615
m_mainScrollLayout = new QVBoxLayout(m_mainScrollContainer);
616-
// Added horizontal padding (24px) so the banner and grid fit gracefully within the window bounds
617-
m_mainScrollLayout->setContentsMargins(10, 0, 10, 20);
618-
m_mainScrollLayout->setSpacing(16);
616+
// Increased horizontal padding (15px) and spacing (10px) to perfectly fit the 175px game cards
617+
m_mainScrollLayout->setContentsMargins(15, 0, 15, 20);
618+
m_mainScrollLayout->setSpacing(10);
619619

620620
// 1. Hero Stack — holds up to 4 trending games, shows exactly one at a time
621621
m_leadingTitlesLabel = new QLabel("Leading Titles");
622622
m_leadingTitlesLabel->setMaximumWidth(1200);
623-
m_leadingTitlesLabel->setStyleSheet("font-size: 20px; font-weight: bold; padding-left: 4px; color: white;");
623+
m_leadingTitlesLabel->setStyleSheet("font-size: 20px; font-weight: bold; padding-left: 0px; color: white;");
624624

625625
m_heroStack = new QStackedWidget();
626626
m_heroStack->setFixedHeight(240);
@@ -655,13 +655,13 @@ void MainWindow::initUI() {
655655

656656
// 3. All Games Grid
657657
m_gridTitleLabel = new QLabel("All Available Games");
658-
m_gridTitleLabel->setStyleSheet("font-size: 20px; font-weight: bold; padding-left: 4px; color: white;");
658+
m_gridTitleLabel->setStyleSheet("font-size: 20px; font-weight: bold; padding-left: 0px; color: white;");
659659
m_mainScrollLayout->addWidget(m_gridTitleLabel);
660660

661661
m_gridContainer = new QWidget();
662662
m_gridLayout = new QGridLayout(m_gridContainer);
663-
m_gridLayout->setContentsMargins(4, 4, 4, 4);
664-
m_gridLayout->setSpacing(14);
663+
m_gridLayout->setContentsMargins(0, 8, 0, 0);
664+
m_gridLayout->setSpacing(12); // Optimized for 190px cards
665665
m_gridLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
666666
m_mainScrollLayout->addWidget(m_gridContainer);
667667

src/workers/indexdownloadworker.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ void IndexDownloadWorker::run() {
4444

4545
QUrl requestUrl{urlStr};
4646
QNetworkRequest request{requestUrl};
47+
QString token = Config::getAccessToken();
4748
request.setHeader(QNetworkRequest::UserAgentHeader, "SteamLuaPatcher/2.0");
48-
request.setRawHeader("X-Access-Token", Config::getAccessToken().toUtf8());
49+
request.setRawHeader("X-Access-Token", token.toUtf8());
50+
request.setRawHeader("Authorization", ("Bearer " + token).toUtf8());
51+
request.setRawHeader("Cache-Control", "no-cache");
4952
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
5053

5154
QEventLoop loop;

src/workers/luadownloadworker.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <QFile>
99
#include <QDir>
1010
#include <QTimer>
11+
#include <QUrlQuery>
12+
#include <QDateTime>
1113

1214
LuaDownloadWorker::LuaDownloadWorker(const QString& appId, QObject* parent)
1315
: QThread(parent)
@@ -20,12 +22,17 @@ void LuaDownloadWorker::run() {
2022
emit log("Starting patch process...", "INFO");
2123
emit status("Downloading patch...");
2224

23-
// Build URL
24-
QString url = Config::luaFileUrl() + m_appId + ".lua";
25+
// Build URL with timestamp to prevent caching
26+
QString urlBase = Config::luaFileUrl() + m_appId + ".lua";
27+
QUrl qurl{urlBase};
28+
QUrlQuery query;
29+
query.addQueryItem("_t", QString::number(QDateTime::currentMSecsSinceEpoch()));
30+
qurl.setQuery(query);
31+
2532
QString cachePath = QDir(Paths::getLocalCacheDir()).filePath(m_appId + ".lua");
2633

2734
emit log(QString("Target App ID: %1").arg(m_appId), "INFO");
28-
emit log(QString("Download URL: %1").arg(url), "INFO");
35+
emit log(QString("Download URL: %1").arg(qurl.toString()), "INFO");
2936
emit log(QString("Cache path: %1").arg(cachePath), "INFO");
3037

3138
// Ensure cache directory exists
@@ -37,10 +44,12 @@ void LuaDownloadWorker::run() {
3744

3845
emit log("Initializing network request...", "INFO");
3946
QNetworkAccessManager manager;
40-
QUrl qurl{url};
4147
QNetworkRequest request{qurl};
48+
QString token = Config::getAccessToken();
4249
request.setHeader(QNetworkRequest::UserAgentHeader, "SteamLuaPatcher/2.0");
43-
request.setRawHeader("X-Access-Token", Config::getAccessToken().toUtf8());
50+
request.setRawHeader("X-Access-Token", token.toUtf8());
51+
request.setRawHeader("Authorization", ("Bearer " + token).toUtf8());
52+
request.setRawHeader("Cache-Control", "no-cache");
4453

4554
emit log("Connecting to server...", "INFO");
4655
QEventLoop loop;

0 commit comments

Comments
 (0)