#ifndef SettingsWidget_H
#define SettingsWidget_H

#include <QWidget>
#include <QTimer>
#include <QSettings>
#include <QPropertyAnimation>
#include <QPushButton>
#include <QEvent>
#include <QDebug>

namespace Ui {
class SettingsWidget;
}

class PatchDownloader;
class LotroDatManager;

namespace SettingsWidgetPrivate {
class ComboboxScrollingDisabler : public QObject {
    Q_OBJECT

protected:
    bool eventFilter(QObject *, QEvent *event) override {
        if (event->type() == QEvent::Wheel) {
            event->ignore();
            return true;
        } else {
            return false;
        }
    }
};
}

class SettingsWidget : public QWidget
{
    Q_OBJECT

public:

    explicit SettingsWidget(QSettings* settings, PatchDownloader* patch_downloader, LotroDatManager* lotro_dat_manager, QWidget *parent = 0);

    ~SettingsWidget();

    enum E_STATUS {
        E_NONE = 0,
        E_ERROR = -2,
        E_WARNING = -1,
        E_OK = 1
    };

public slots:
    void updateFontsSizes();
    void setStatusToBlock(int block_id, E_STATUS status);

protected:
    void resizeEvent(QResizeEvent *event) override;

private slots:

    void handleLotroManagerStarted(QString, QVector<QVariant>);

    void handleLotroManagerFinished(QString, QVector<QVariant>);

    void handleCheckForUpdatesStarted();

    void handleCheckForUpdatesFinished();

    void on_interface_scale_combobox_currentIndexChanged(const QString &arg1);

    void on_change_folder_button_clicked();

    void on_lotro_base_language_combobox_currentIndexChanged(int index);

private:
    QSettings* app_settings;
    PatchDownloader* patch_updater;
    LotroDatManager* lotro_manager;

    Ui::SettingsWidget *ui;
    SettingsWidgetPrivate::ComboboxScrollingDisabler* combobox_scrolling_disabler;
};

#endif // SettingsWidget_H
