#ifndef DIALOGSETTINGS_H
#define DIALOGSETTINGS_H

#include <QDialog>
#include <QTranslator>
#include <QEvent>
#include "Datas.h"
#include "connectortoserver.h"

namespace Ui {
class DialogSettings;
}

class DialogSettings : public QDialog
{
    Q_OBJECT

public:
    explicit DialogSettings(ConnectorToServer* connectorToServer, bool instructorIsLogged, QWidget *parent = nullptr);
    ~DialogSettings();

    ServerSettings getSettings();

    bool settingsServerIsChanged(){ return flSettingsServerChanged;}

    static bool loadSettings(ServerSettings *settings);

protected:
    void changeEvent(QEvent * event) override;

signals:
    //сигнал об изменении языка интерфейса
    void signal_LanguageChanged(QString language);
    //сигнал об изменении стиля
    void signal_UpdateStyleSheet();

private slots:
    void on_btnUpdateStyle_clicked();
    void on_btnSave_clicked();
    void on_btnSetVersion_clicked();
    void on_cmbLanguage_currentIndexChanged(int index);
    void on_editAddress_textChanged(const QString &arg1);
    void on_editPort_textChanged(const QString &arg1);
    void on_DialogSettings_accepted();

private:    
    bool saveSettings();

private:
    Ui::DialogSettings *ui;
    QTranslator qtLanguageTranslator;

    ServerSettings *settings;
    ConnectorToServer* connectorToServer;

    bool flSettingsServerChanged;
};

#endif // DIALOGSETTINGS_H
