download_dialog.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SuperTux
  2. // Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
  3. // 2022-2023 Vankata453
  4. //
  5. // This program is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #ifndef HEADER_SUPERTUX_SUPERTUX_MENU_DOWNLOAD_DIALOG_HPP
  18. #define HEADER_SUPERTUX_SUPERTUX_MENU_DOWNLOAD_DIALOG_HPP
  19. #include "gui/dialog.hpp"
  20. #include "addon/downloader_defines.hpp"
  21. class DownloadDialog final : public Dialog
  22. {
  23. private:
  24. TransferStatusListPtr m_status;
  25. std::string m_title;
  26. bool m_auto_close;
  27. bool m_error_msg;
  28. int m_download_total;
  29. bool m_complete;
  30. public:
  31. DownloadDialog(TransferStatusPtr status, bool auto_close = false,
  32. bool passive = false, bool no_error_msg = false);
  33. DownloadDialog(TransferStatusListPtr statuses, bool auto_close = false,
  34. bool passive = false, bool no_error_msg = false);
  35. void set_title(const std::string& title);
  36. void update() override;
  37. private:
  38. void update_text();
  39. void on_abort();
  40. void on_download_complete();
  41. private:
  42. DownloadDialog(const DownloadDialog&) = delete;
  43. DownloadDialog& operator=(const DownloadDialog&) = delete;
  44. };
  45. #endif
  46. /* EOF */