mainwindow_moc.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * mainwindow_moc.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include <QMainWindow>
  12. #include <QStringList>
  13. #include <QTranslator>
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class CConsoleHandler;
  16. VCMI_LIB_NAMESPACE_END
  17. namespace Ui
  18. {
  19. class MainWindow;
  20. const QString teamName = "vcmi";
  21. const QString appName = "launcher";
  22. }
  23. class QTableWidgetItem;
  24. class CModList;
  25. class CModListView;
  26. enum class ETranslationStatus : int8_t
  27. {
  28. NOT_AVAILABLE, // translation for this language was not found in mod list. Could also happen if player is offline or disabled repository checkout
  29. NOT_INSTALLLED, // translation mod found, but it is not installed
  30. DISABLED, // translation mod found, and installed, but toggled off
  31. ACTIVE // translation mod active OR game is already in specified language (e.g. English H3 for players with English language)
  32. };
  33. class MainWindow : public QMainWindow
  34. {
  35. Q_OBJECT
  36. #ifdef ENABLE_QT_TRANSLATIONS
  37. QTranslator translator;
  38. #endif
  39. Ui::MainWindow * ui;
  40. #ifndef VCMI_MOBILE
  41. std::unique_ptr<CConsoleHandler> console;
  42. #endif
  43. void load();
  44. enum TabRows
  45. {
  46. MODS = 0,
  47. SETTINGS = 1,
  48. SETUP = 2,
  49. ABOUT = 3,
  50. START = 4,
  51. };
  52. public:
  53. explicit MainWindow(QWidget * parent = nullptr);
  54. ~MainWindow() override;
  55. CModListView * getModView();
  56. void updateTranslation();
  57. void computeSidePanelSizes();
  58. void detectPreferredLanguage();
  59. void enterSetup();
  60. void exitSetup(bool goToMods);
  61. void switchToModsTab();
  62. void switchToStartTab();
  63. void dragEnterEvent(QDragEnterEvent* event) override;
  64. void dropEvent(QDropEvent *event) override;
  65. void manualInstallFile(QString filePath);
  66. ETranslationStatus getTranslationStatus();
  67. protected:
  68. void changeEvent(QEvent * event) override;
  69. public slots:
  70. void on_startGameButton_clicked();
  71. private slots:
  72. void on_modslistButton_clicked();
  73. void on_settingsButton_clicked();
  74. void on_aboutButton_clicked();
  75. };