#ifndef LEGACYAPPLICATION_H
#define LEGACYAPPLICATION_H

#include <QThread>
#include <QTimer>

#include "utils.h"

class LotroDatManager;
class PatchList;
class MainWindow;

class LegacyApplication : public QObject
{
    Q_OBJECT

public:
    static LegacyApplication& instance() {
        static LegacyApplication instance;
        return instance;
    }

private:
    LegacyApplication();

public:
    bool init();

signals:
    void ErrorStatusChanged(AppErrorStatus status);

    void SecondsToNextTryToInitChanged(size_t seconds_elapsed);

private slots:
    void InitModules();

private:
    LotroDatManager *lotro_dat_manager = nullptr;
    QThread *lotro_dat_manager_thread = nullptr;
    PatchList *patch_list = nullptr;
    MainWindow *gui = nullptr;

    QTimer modules_init_timer_;
    size_t seconds_after_previous_try_to_init_ = 10; // init value should be equal to try_to_init_timeout_
    const size_t try_to_init_timeout_ = 10;
};

#endif // LEGACYAPPLICATION_H
