#include "notepad.h"
#include "ui_notepad.h"
#include "textFormatUtils.h"

#include <QInputDialog>
#include <QFontDialog>
#include <QColorDialog>

using namespace std;

NotePad::NotePad(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::NotePad)
{
    ui->setupUi(this);
}

NotePad::~NotePad(){}

void NotePad::on_actionFont_triggered() {TextFormatUtils::changeFont(this);}
void NotePad::on_actionFontSize_triggered() {TextFormatUtils::changeFontSize(this);}
void NotePad::on_actionFontColor_triggered() {TextFormatUtils::changeFontColor(this);}
void NotePad::on_actionBold_triggered() {TextFormatUtils::toggleBold();}
void NotePad::on_actionItalic_triggered() {TextFormatUtils::toggleItalic();}
void NotePad::on_actionOverline_triggered() {TextFormatUtils::toggleOverline();}
void NotePad::on_actionUnderline_triggered() {TextFormatUtils::toggleUnderline();}

void NotePad::setTexte(QString t){
    texte = t;
    setUi(t);
}
void NotePad::setUi(QString t){ui->plainTextEdit->setPlainText(t);}
void NotePad::getUi(){texte = ui->plainTextEdit->toPlainText();}
void NotePad::on_actionSauvegarder_triggered(){emit demandeSauvegarde(ui->plainTextEdit->toPlainText());}

