2017-07-13 10:26:03 +02:00
|
|
|
/*
|
|
|
|
* cmodlistview_moc.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2013-08-22 17:22:49 +03:00
|
|
|
#pragma once
|
|
|
|
|
2016-01-27 22:08:08 +02:00
|
|
|
#include "../StdInc.h"
|
2013-08-24 23:11:51 +03:00
|
|
|
#include "../../lib/CConfigHandler.h"
|
|
|
|
|
2018-04-13 07:34:58 +02:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class CModListView;
|
2013-08-22 17:22:49 +03:00
|
|
|
}
|
|
|
|
|
2024-11-12 22:00:21 +02:00
|
|
|
class ModStateController;
|
2022-11-16 21:53:54 +02:00
|
|
|
class CModList;
|
2024-11-12 22:00:21 +02:00
|
|
|
class ModStateItemModel;
|
|
|
|
class ModStateModel;
|
2013-08-22 17:22:49 +03:00
|
|
|
class CModFilterModel;
|
|
|
|
class CDownloadManager;
|
|
|
|
class QTableWidgetItem;
|
|
|
|
|
2024-11-12 22:00:21 +02:00
|
|
|
class ModState;
|
2013-08-22 17:22:49 +03:00
|
|
|
|
|
|
|
class CModListView : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2024-11-12 22:00:21 +02:00
|
|
|
std::shared_ptr<ModStateModel> modStateModel;
|
|
|
|
std::unique_ptr<ModStateController> manager;
|
|
|
|
ModStateItemModel * modModel;
|
2013-08-22 17:22:49 +03:00
|
|
|
CModFilterModel * filterModel;
|
|
|
|
CDownloadManager * dlManager;
|
|
|
|
|
|
|
|
void setupModModel();
|
|
|
|
void setupFilterModel();
|
|
|
|
void setupModsView();
|
|
|
|
|
2013-09-06 00:25:03 +03:00
|
|
|
void checkManagerErrors();
|
|
|
|
|
2023-03-26 23:32:24 +02:00
|
|
|
/// replace mod ID's with proper human-readable mod names
|
2024-11-14 20:43:41 +02:00
|
|
|
QStringList getModNames(QString queryingMod, QStringList input);
|
2023-03-26 23:32:24 +02:00
|
|
|
|
2024-11-18 19:37:45 +02:00
|
|
|
/// returns list of mods that are needed for install of this mod (potentially including this mod itself)
|
|
|
|
QStringList getModsToInstall(QString mod);
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
// find mods unknown to mod list (not present in repo and not installed)
|
2024-11-20 17:24:52 +02:00
|
|
|
QStringList findUnavailableMods(QStringList candidates);
|
2013-08-22 17:22:49 +03:00
|
|
|
|
2024-07-08 15:10:44 +02:00
|
|
|
void manualInstallFile(QString filePath);
|
2023-09-01 16:43:26 +02:00
|
|
|
void downloadFile(QString file, QString url, QString description, qint64 size = 0);
|
2024-07-08 15:10:44 +02:00
|
|
|
void downloadFile(QString file, QUrl url, QString description, qint64 size = 0);
|
2013-08-22 17:22:49 +03:00
|
|
|
|
|
|
|
void installMods(QStringList archives);
|
2023-12-25 23:41:15 +02:00
|
|
|
void installMaps(QStringList maps);
|
2013-08-22 17:22:49 +03:00
|
|
|
void installFiles(QStringList mods);
|
|
|
|
|
2024-11-13 22:27:51 +02:00
|
|
|
QString genChangelogText(const ModState & mod);
|
|
|
|
QString genModInfoText(const ModState & mod);
|
2018-04-13 07:34:58 +02:00
|
|
|
|
2022-12-25 13:19:16 +02:00
|
|
|
void changeEvent(QEvent *event) override;
|
2023-12-25 19:53:02 +02:00
|
|
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
|
|
|
void dropEvent(QDropEvent *event) override;
|
2022-09-27 10:51:49 +02:00
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
public:
|
2023-10-27 17:10:54 +02:00
|
|
|
explicit CModListView(QWidget * parent = nullptr);
|
2013-08-22 17:22:49 +03:00
|
|
|
~CModListView();
|
2016-01-09 22:23:55 +02:00
|
|
|
|
2014-03-23 15:08:01 +03:00
|
|
|
void loadScreenshots();
|
2023-06-30 17:41:05 +02:00
|
|
|
void loadRepositories();
|
2013-08-22 17:22:49 +03:00
|
|
|
|
|
|
|
void disableModInfo();
|
|
|
|
|
2014-03-20 20:06:25 +03:00
|
|
|
void selectMod(const QModelIndex & index);
|
2013-08-22 17:22:49 +03:00
|
|
|
|
2023-03-11 00:57:55 +02:00
|
|
|
// First Launch View interface
|
|
|
|
|
|
|
|
/// install mod by name
|
|
|
|
void doInstallMod(const QString & modName);
|
|
|
|
|
2023-03-26 19:11:59 +02:00
|
|
|
/// returns true if mod is available in repository and can be installed
|
|
|
|
bool isModAvailable(const QString & modName);
|
2023-03-11 00:57:55 +02:00
|
|
|
|
|
|
|
/// finds translation mod for specified languages. Returns empty string on error
|
|
|
|
QString getTranslationModName(const QString & language);
|
|
|
|
|
2023-03-14 13:37:22 +02:00
|
|
|
/// returns true if mod is currently enabled
|
|
|
|
bool isModEnabled(const QString & modName);
|
|
|
|
|
2024-09-14 21:34:39 +02:00
|
|
|
/// returns true if mod is currently installed
|
|
|
|
bool isModInstalled(const QString & modName);
|
|
|
|
|
2022-12-26 02:34:10 +02:00
|
|
|
public slots:
|
|
|
|
void enableModByName(QString modName);
|
|
|
|
void disableModByName(QString modName);
|
2022-11-16 21:53:54 +02:00
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
private slots:
|
2014-03-20 20:06:25 +03:00
|
|
|
void dataChanged(const QModelIndex & topleft, const QModelIndex & bottomRight);
|
2013-08-22 17:22:49 +03:00
|
|
|
void modSelected(const QModelIndex & current, const QModelIndex & previous);
|
|
|
|
void downloadProgress(qint64 current, qint64 max);
|
2023-12-18 00:34:00 +02:00
|
|
|
void extractionProgress(qint64 current, qint64 max);
|
2013-08-22 17:22:49 +03:00
|
|
|
void downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors);
|
2018-04-13 07:34:58 +02:00
|
|
|
void modelReset();
|
2013-08-22 17:22:49 +03:00
|
|
|
void hideProgressBar();
|
|
|
|
|
2018-04-13 07:34:58 +02:00
|
|
|
void on_lineEdit_textChanged(const QString & arg1);
|
2013-08-22 17:22:49 +03:00
|
|
|
|
|
|
|
void on_comboBox_currentIndexChanged(int index);
|
|
|
|
|
|
|
|
void on_enableButton_clicked();
|
|
|
|
|
|
|
|
void on_disableButton_clicked();
|
|
|
|
|
|
|
|
void on_updateButton_clicked();
|
|
|
|
|
|
|
|
void on_uninstallButton_clicked();
|
|
|
|
|
|
|
|
void on_installButton_clicked();
|
|
|
|
|
2024-04-20 00:26:58 +02:00
|
|
|
void on_installFromFileButton_clicked();
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
void on_pushButton_clicked();
|
|
|
|
|
2014-11-03 17:47:37 +02:00
|
|
|
void on_refreshButton_clicked();
|
|
|
|
|
2018-04-13 07:34:58 +02:00
|
|
|
void on_allModsView_activated(const QModelIndex & index);
|
2014-03-20 20:06:25 +03:00
|
|
|
|
2014-03-23 15:08:01 +03:00
|
|
|
void on_tabWidget_currentChanged(int index);
|
|
|
|
|
2018-04-13 07:34:58 +02:00
|
|
|
void on_screenshotsList_clicked(const QModelIndex & index);
|
2014-03-23 15:08:01 +03:00
|
|
|
|
2023-09-01 01:29:50 +02:00
|
|
|
void on_allModsView_doubleClicked(const QModelIndex &index);
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
private:
|
2018-04-13 07:34:58 +02:00
|
|
|
Ui::CModListView * ui;
|
2013-08-22 17:22:49 +03:00
|
|
|
};
|