
#ifndef AppearanceOptionsWidget_H
#define AppearanceOptionsWidget_H

#include <memory>
#include <QDialog>
#include <QPushButton>

#include "core/Iaito.h"

class SettingsDialog;

namespace Ui {
class AppearanceOptionsWidget;
}

class AppearanceOptionsWidget : public QDialog
{
    Q_OBJECT

public:
    explicit AppearanceOptionsWidget(SettingsDialog *dialog);
    ~AppearanceOptionsWidget();

private:
    std::unique_ptr<Ui::AppearanceOptionsWidget> ui;

private slots:
    void updateFontFromConfig();
    void updateThemeFromConfig(bool interfaceThemeChanged = true);
    void updateVisualNavbarFromConfig();

    void on_fontSelectionButton_clicked();
    void on_fontResetButton_clicked();
    void onFontFamilyComboBoxCurrentIndexChanged(int index);
    void onFontSizeSpinBoxValueChanged(int size);
    void onFontZoomBoxValueChanged(int zoom);
    void on_themeComboBox_currentIndexChanged(int index);
    void on_visualNavbarLocationComboBox_currentIndexChanged(int index);
    void on_visualNavbarThicknessSpinBox_valueChanged(int value);
    void on_copyButton_clicked();
    void on_deleteButton_clicked();

    /**
     * @brief Imports theme file specified by user to custom themes
     * directory.
     */
    void on_importButton_clicked();

    /**
     * @brief Exports current color theme to file
     * specified by user.
     */
    void on_exportButton_clicked();

    /**
     * @brief Shows dialog to rename current color theme.
     */
    void on_renameButton_clicked();
    void on_editButton_clicked();

    void on_ifaceEditButton_clicked();
    void on_ifaceCopyButton_clicked();
    void on_ifaceRenameButton_clicked();
    void on_ifaceDeleteButton_clicked();
    void on_ifaceExportButton_clicked();
    void on_ifaceImportButton_clicked();

    void onLanguageComboBoxCurrentIndexChanged(int index);

private:
    void updateModificationButtons(const QString &theme);
    void updateInterfaceModificationButtons(const QString &theme);
    void selectInterfaceThemeByName(const QString &name);
    void updateFromConfig();

    /**
     * @brief Changes all @a before colors in given @a fileName svg file to @a
     * after and returns result icon. If @a before is not specified, changes all
     * colors.
     * @param fileName
     * Path to svg file.
     * @param after
     * What color should be inserted instead of old one.
     * @param before
     * Color that should be repalced.
     */
    QIcon getIconFromSvg(
        const QString &fileName, const QColor &after, const QColor &before = QColor());
};

#endif // ASMOPTIONSDIALOG_H
