cmodlistview_moc.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * cmodlistview_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 "../StdInc.h"
  12. #include "../../lib/CConfigHandler.h"
  13. namespace Ui
  14. {
  15. class CModListView;
  16. }
  17. class CModManager;
  18. class CModList;
  19. class CModListModel;
  20. class CModFilterModel;
  21. class CDownloadManager;
  22. class QTableWidgetItem;
  23. class CModEntry;
  24. class CModListView : public QWidget
  25. {
  26. Q_OBJECT
  27. std::unique_ptr<CModManager> manager;
  28. CModListModel * modModel;
  29. CModFilterModel * filterModel;
  30. CDownloadManager * dlManager;
  31. void setupModModel();
  32. void setupFilterModel();
  33. void setupModsView();
  34. void checkManagerErrors();
  35. /// replace mod ID's with proper human-readable mod names
  36. QStringList getModNames(QStringList input);
  37. // find mods unknown to mod list (not present in repo and not installed)
  38. QStringList findInvalidDependencies(QString mod);
  39. // find mods that block enabling of this mod: conflicting with this mod or one of required mods
  40. QStringList findBlockingMods(QString modUnderTest);
  41. // find mods that depend on this one
  42. QStringList findDependentMods(QString mod, bool excludeDisabled);
  43. void downloadFile(QString file, QString url, QString description, qint64 size = 0);
  44. void installMods(QStringList archives);
  45. void installMaps(QStringList maps);
  46. void installFiles(QStringList mods);
  47. QString genChangelogText(CModEntry & mod);
  48. QString genModInfoText(CModEntry & mod);
  49. void changeEvent(QEvent *event) override;
  50. void dragEnterEvent(QDragEnterEvent* event) override;
  51. void dropEvent(QDropEvent *event) override;
  52. signals:
  53. void modsChanged();
  54. public:
  55. explicit CModListView(QWidget * parent = nullptr);
  56. ~CModListView();
  57. void loadScreenshots();
  58. void loadRepositories();
  59. void disableModInfo();
  60. void selectMod(const QModelIndex & index);
  61. const CModList & getModList() const;
  62. // First Launch View interface
  63. /// install mod by name
  64. void doInstallMod(const QString & modName);
  65. /// returns true if mod is available in repository and can be installed
  66. bool isModAvailable(const QString & modName);
  67. /// finds translation mod for specified languages. Returns empty string on error
  68. QString getTranslationModName(const QString & language);
  69. /// returns true if mod is currently enabled
  70. bool isModEnabled(const QString & modName);
  71. public slots:
  72. void enableModByName(QString modName);
  73. void disableModByName(QString modName);
  74. private slots:
  75. void dataChanged(const QModelIndex & topleft, const QModelIndex & bottomRight);
  76. void modSelected(const QModelIndex & current, const QModelIndex & previous);
  77. void downloadProgress(qint64 current, qint64 max);
  78. void extractionProgress(qint64 current, qint64 max);
  79. void downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors);
  80. void modelReset();
  81. void hideProgressBar();
  82. void on_lineEdit_textChanged(const QString & arg1);
  83. void on_comboBox_currentIndexChanged(int index);
  84. void on_enableButton_clicked();
  85. void on_disableButton_clicked();
  86. void on_updateButton_clicked();
  87. void on_uninstallButton_clicked();
  88. void on_installButton_clicked();
  89. void on_pushButton_clicked();
  90. void on_refreshButton_clicked();
  91. void on_allModsView_activated(const QModelIndex & index);
  92. void on_tabWidget_currentChanged(int index);
  93. void on_screenshotsList_clicked(const QModelIndex & index);
  94. void on_allModsView_doubleClicked(const QModelIndex &index);
  95. private:
  96. Ui::CModListView * ui;
  97. };