duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

coverdownloaddialog.h (1286B)


      1 // SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
      2 // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
      3 
      4 #pragma once
      5 #include "common/timer.h"
      6 #include "common/types.h"
      7 #include "qtprogresscallback.h"
      8 #include "ui_coverdownloaddialog.h"
      9 #include <QtWidgets/QDialog>
     10 #include <array>
     11 #include <memory>
     12 #include <string>
     13 
     14 class CoverDownloadDialog final : public QDialog
     15 {
     16   Q_OBJECT
     17 
     18 public:
     19   CoverDownloadDialog(QWidget* parent = nullptr);
     20   ~CoverDownloadDialog();
     21 
     22 Q_SIGNALS:
     23   void coverRefreshRequested();
     24 
     25 protected:
     26   void closeEvent(QCloseEvent* ev);
     27 
     28 private Q_SLOTS:
     29   void onDownloadStatus(const QString& text);
     30   void onDownloadProgress(int value, int range);
     31   void onDownloadComplete();
     32   void onStartClicked();
     33   void onCloseClicked();
     34   void updateEnabled();
     35 
     36 private:
     37   class CoverDownloadThread : public QtAsyncProgressThread
     38   {
     39   public:
     40     CoverDownloadThread(QWidget* parent, const QString& urls, bool use_serials);
     41     ~CoverDownloadThread();
     42 
     43   protected:
     44     void runAsync() override;
     45 
     46   private:
     47     std::vector<std::string> m_urls;
     48     bool m_use_serials;
     49   };
     50 
     51   void startThread();
     52   void cancelThread();
     53 
     54   Ui::CoverDownloadDialog m_ui;
     55   std::unique_ptr<CoverDownloadThread> m_thread;
     56   Common::Timer m_last_refresh_time;
     57 };