12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #ifndef LEGACYAPP_H
- #define LEGACYAPP_H
- #include <QObject>
- #include <QSettings>
- #include <QApplication>
- #include <QVector>
- #include <QVariant>
- #include <LotroDat/LotroDat.h>
- using LOTRO_DAT::DatStatus;
- namespace debug {
- void ClientLocalDatStatusChangedHandler(DatStatus::ProgressInfo info);
- void ClientGeneralDatStatusChangedHandler(DatStatus::ProgressInfo info);
- }
- class LotroDatManager : public QObject
- {
- Q_OBJECT
- public:
- using Status = LOTRO_DAT::DatStatus::ProgressInfo;
- enum Category : int {
- E_TEXTS_COMMON = 100,
- E_TEXTS_ITEMS = 101,
- E_TEXTS_EMOTES = 102,
- E_TEXTS_VIDEOS_REFS = 103,
- E_MAPS_COMMON = 200,
- E_TEXTURES_COMMON = 201,
- E_AUDIOS_COMMON = 300,
- E_FONTS_COMMON = 400
- };
- public:
- explicit LotroDatManager(QObject *parent = nullptr);
- ~LotroDatManager();
- bool Initialised();
- bool NotPatched();
- bool DatPathIsRelevant();
- public slots:
- void initializeManager();
- void deinitializeManager();
- void startGame(LOTRO_DAT::DatLocaleManager::LOCALE locale);
- void installPatch(QString patch_name, QString database_path);
- void enableCategory(QString patch_name, LotroDatManager::Category category);
- void disableCategory(QString patch_name, LotroDatManager::Category category);
- void createBackup();
- void restoreFromBackup();
- void removeBackup();
- private:
- bool startLotroLauncherWithParameters(LOTRO_DAT::DatLocaleManager::LOCALE locale);
- signals:
- void operationStarted(QString operation_name, QVector<QVariant> args = {});
- void errorOccured(QString operation_name, QVector<QVariant> args = {}, QString message = "No error message provided");
- void operationFinished(QString operation_name, QVector<QVariant> args = {}, bool successful = true);
- void statusChanged(Status status);
- private:
- LOTRO_DAT::DatFile client_local_file_;
- LOTRO_DAT::DatFile client_general_file_;
- const LOTRO_DAT::DatStatus::Callback client_local_status_updated_callback_ = [&](Status status) {
- emit statusChanged(status);
- debug::ClientLocalDatStatusChangedHandler(status);
- };
- const LOTRO_DAT::DatStatus::Callback client_general_status_updated_callback_ = [&](Status status) {
- emit statusChanged(status);
- debug::ClientGeneralDatStatusChangedHandler(status);
- };
- };
- #endif // LEGACYAPP_H
|