#ifndef DIALOGSETTINGSTRAY_H
#define DIALOGSETTINGSTRAY_H

#include <QDialog>
#include <QTranslator>
#include <QEvent>
#include "providerdblms.h"

class ServerDBSettings{
public:
    QString Type;
    QString NameDB;
    QString UserName;
    QString Password;
    QString HostName;
    QString Port;
    QString Language;
};

namespace Ui {
class DialogSettingsTray;
}

class DialogSettingsTray : public QDialog
{
    Q_OBJECT

public:
    explicit DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *parent = nullptr);
    ~DialogSettingsTray();

    ServerDBSettings getSettings();

    bool settingsDBisChanged(){ return flSettingsServerChanged;}

    static bool loadSettings(ServerDBSettings *settings);

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

private slots:
    void on_btnSave_clicked();

    void on_cmbLanguage_currentIndexChanged(int index);

    void on_DialogSettingsTray_accepted();

    void on_editNameDB_textChanged(const QString &arg1);

    void on_editHostName_textChanged(const QString &arg1);

    void on_editPort_textChanged(const QString &arg1);

    void on_editUserName_textChanged(const QString &arg1);

    void on_editPassword_textChanged(const QString &arg1);

    void on_btnCheckDB_clicked();

    void on_checkLocalhost_stateChanged(int arg1);

    void on_btnUpdateDocs_clicked();

private:
    bool saveSettings();

private:
    Ui::DialogSettingsTray *ui;

    ServerDBSettings *settings;

    ProviderDBLMS* providerDBLMS;

    bool flSettingsServerChanged;
};

#endif // DIALOGSETTINGSTRAY_H
