#pragma once

#include <QDialog>

class QXmlStreamReader;

namespace Ui {
class SettingsDialog;
}

class SettingsDialog : public QDialog
{
    Q_OBJECT

public:
    explicit SettingsDialog(QWidget* parent = nullptr);
    ~SettingsDialog();
    void setSettingsFile(const QString& fileName);
    QString hostname() const;
    QString database() const;
    QString username() const;
    QString password() const;

private:
    void fillForm();
    void parseSettings(QXmlStreamReader& xml);
    void saveSettings();

private slots:
    void onCancelPressed();
    void onOkPressed();
    void onTestPressed();

private:
    Ui::SettingsDialog* ui_;
    QString settingsFileName_;
    QString hostname_;
    QString database_;
    QString username_;
    QString password_;
};

