cmodlistview_moc.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 CModListModel;
  19. class CModFilterModel;
  20. class CDownloadManager;
  21. class QTableWidgetItem;
  22. class CModEntry;
  23. class CModListView : public QWidget
  24. {
  25. Q_OBJECT
  26. std::unique_ptr<CModManager> manager;
  27. CModListModel * modModel;
  28. CModFilterModel * filterModel;
  29. CDownloadManager * dlManager;
  30. SettingsListener settingsListener;
  31. bool repositoriesChanged;
  32. void showEvent(QShowEvent * event) override;
  33. void keyPressEvent(QKeyEvent * event) override;
  34. void setupModModel();
  35. void setupFilterModel();
  36. void setupModsView();
  37. void loadRepositories();
  38. void checkManagerErrors();
  39. // find mods unknown to mod list (not present in repo and not installed)
  40. QStringList findInvalidDependencies(QString mod);
  41. // find mods that block enabling of this mod: conflicting with this mod or one of required mods
  42. QStringList findBlockingMods(QString mod);
  43. // find mods that depend on this one
  44. QStringList findDependentMods(QString mod, bool excludeDisabled);
  45. void downloadFile(QString file, QString url, QString description);
  46. void installMods(QStringList archives);
  47. void installFiles(QStringList mods);
  48. QString genChangelogText(CModEntry & mod);
  49. QString genModInfoText(CModEntry & mod);
  50. public:
  51. explicit CModListView(QWidget * parent = 0);
  52. ~CModListView();
  53. void showModInfo();
  54. void hideModInfo();
  55. void loadScreenshots();
  56. void enableModInfo();
  57. void disableModInfo();
  58. void selectMod(const QModelIndex & index);
  59. private slots:
  60. void dataChanged(const QModelIndex & topleft, const QModelIndex & bottomRight);
  61. void modSelected(const QModelIndex & current, const QModelIndex & previous);
  62. void downloadProgress(qint64 current, qint64 max);
  63. void downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors);
  64. void modelReset();
  65. void hideProgressBar();
  66. void on_hideModInfoButton_clicked();
  67. void on_lineEdit_textChanged(const QString & arg1);
  68. void on_comboBox_currentIndexChanged(int index);
  69. void on_enableButton_clicked();
  70. void on_disableButton_clicked();
  71. void on_updateButton_clicked();
  72. void on_uninstallButton_clicked();
  73. void on_installButton_clicked();
  74. void on_pushButton_clicked();
  75. void on_refreshButton_clicked();
  76. void on_allModsView_activated(const QModelIndex & index);
  77. void on_tabWidget_currentChanged(int index);
  78. void on_screenshotsList_clicked(const QModelIndex & index);
  79. void on_showInfoButton_clicked();
  80. private:
  81. Ui::CModListView * ui;
  82. };