@@ -172,10 +172,25 @@ void GameDetailsPage::buildUI() {
172172 connect (m_installButton, &QPushButton::clicked, this , [this ]() {
173173 if (m_isDownloading) return ;
174174 m_isDownloading = true ;
175- // The reset will be handled if needed, but for now we emit
175+ // Reset state before new attempt
176+ m_installButton->setText (" Downloading..." );
177+ m_installProgressBar->setValue (0 );
178+ m_installProgressBar->show ();
179+
176180 emit addToLibraryClicked (m_appId, m_gameName, m_hasFix);
177181 });
178182 actionLayout->addWidget (m_installButton);
183+
184+ m_installProgressBar = new QProgressBar ();
185+ m_installProgressBar->setFixedSize (220 , 4 );
186+ m_installProgressBar->setTextVisible (false );
187+ m_installProgressBar->setStyleSheet (
188+ " QProgressBar { background: #1B5E20; border: none; border-radius: 2px; }"
189+ " QProgressBar::chunk { background: #00E676; border-radius: 2px; }"
190+ );
191+ m_installProgressBar->hide ();
192+ actionLayout->addWidget (m_installProgressBar);
193+
179194 infoLayout->addWidget (actionWidget, 1 ); // Takes 1/4 space
180195
181196 m_contentLayout->addWidget (infoRow);
@@ -332,10 +347,12 @@ void GameDetailsPage::loadGame(const QString& appId, const QString& name, bool s
332347
333348 // Update Action Button
334349 m_installButton->setEnabled (supported);
335- m_installButton->setText (hasFix ? " Download Patch" : " Generate Patch" );
350+ m_installButton->setText (" Install" );
351+ m_installProgressBar->hide ();
352+ m_installProgressBar->setValue (0 );
336353 m_installButton->setStyleSheet (
337354 " QPushButton {"
338- " background: #2E7D32; color: white; font-weight: 800; font-size: 16px ; border-radius: 4px ; font-family: 'Segoe UI';"
355+ " background: #2E7D32; color: white; font-weight: 800; font-size: 18px ; border-radius: 8px ; font-family: 'Segoe UI';"
339356 " }"
340357 " QPushButton:hover {"
341358 " background: #388E3C;"
@@ -506,26 +523,32 @@ void GameDetailsPage::populate(const QJsonObject& data) {
506523}
507524
508525void GameDetailsPage::updateInstallProgress (int pct) {
509- if (pct < 100 ) {
510- m_isDownloading = true ;
511- m_installButton->setText (QString (" Downloading... %1%" ).arg (pct));
512- double ratio = pct / 100.0 ;
513- double stop2 = ratio + 0.001 ;
514- if (stop2 > 1.0 ) stop2 = 1.0 ;
515-
516- m_installButton->setStyleSheet (QString (
517- " QPushButton {"
518- " background: qlineargradient(x1:0, y1:0, x2:1, y2:0, "
519- " stop:0 #2E7D32, stop:%1 #2E7D32, stop:%2 #424242, stop:1 #424242);"
520- " color: white; font-weight: 800; font-size: 16px; border-radius: 4px; font-family: 'Segoe UI';"
521- " }" ).arg (ratio).arg (stop2));
522- } else {
523- m_isDownloading = false ;
524- m_installButton->setText (" Installed / Restart Steam" );
525- m_installButton->setStyleSheet (
526- " QPushButton {"
527- " background: #2E7D32; color: white; font-weight: 800; font-size: 16px; border-radius: 4px; font-family: 'Segoe UI';"
528- " }"
529- );
530- }
526+ if (!m_isDownloading) return ;
527+ m_installProgressBar->show ();
528+ m_installProgressBar->setValue (pct);
529+ }
530+
531+ void GameDetailsPage::installFinished () {
532+ m_isDownloading = false ;
533+ m_installProgressBar->hide ();
534+ m_installButton->setText (" Installed" );
535+ m_installButton->setStyleSheet (
536+ " QPushButton {"
537+ " background: #2E7D32; color: white; font-weight: 800; font-size: 18px; border-radius: 8px; font-family: 'Segoe UI';"
538+ " }"
539+ );
540+ }
541+
542+ void GameDetailsPage::installError (const QString& err) {
543+ m_isDownloading = false ;
544+ m_installProgressBar->hide ();
545+ m_installButton->setText (" Error (Retry)" );
546+ m_installButton->setStyleSheet (
547+ " QPushButton {"
548+ " background: #D32F2F; color: white; font-weight: 800; font-size: 18px; border-radius: 8px; font-family: 'Segoe UI';"
549+ " }"
550+ " QPushButton:hover {"
551+ " background: #F44336;"
552+ " }"
553+ );
531554}
0 commit comments