#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "character.h"
#include "notepad.h"

#include <QMainWindow>
#include <QPushButton>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void loadImage(QString fileName);
    void createNewCharacter(Character* p, QString s = QString());
    void loadNewCharacter();
    void saveJson();
    void saveAsJson();
    void getUi();
    void setUi(Character* p);
    void toogleBackPack();
    void addWindow(const QString& s = QString());
    QString extractFileName(QString s);
    void changeCurrentCharacter();
    void changeTab(int index);
    void layoutTabs();
    void removeTab(int index);
    void toogleStartMenu();

private slots:
    void on_actionOuvrir_une_fiche_triggered();
    void on_actionNouvelle_fiche_triggered();
    void on_actionSauvegarder_triggered();
    void on_actionEnregistrer_sous_triggered();
    void on_actionFermer_triggered();
    void on_imagePushButton_clicked();
    void recevoirSauvegarde(QString contenu);
    void on_actionBloc_note_triggered();
    void on_actionCaract_ristiques_triggered();
    void changer_fiche_clicked();
    void ajouter_fiche_clicked();
    void on_actionCouleur_triggered();
    void on_actionPolice_triggered();
    void on_actionTaille_triggered();
    void on_actionGras_triggered();
    void on_actionItalique_triggered();
    void on_actionSouligner_triggered();
    void on_actionSurligner_triggered();
    void on_pushButtonNewFiche_clicked();
    void on_pushButtonOpenFiche_clicked();

private:
    Ui::MainWindow *ui;
    NotePad *notePad;

    bool edition = true;
    QString currentFile;
    QList<Character*> characters;
    QList<QString> files;
    Character* currentCharacter;
    int idFicheButtonCounter = 0;
    int sizeButtonFiche = 100;
};
#endif // MAINWINDOW_H
