/* DrewTechs * Note Binder * @Version 1.0 */ #include "newNotebookDialog.h" #include "ui_newNotebookDialog.h" newNotebookDialog::newNotebookDialog(QWidget *parent) : QDialog(parent), ui(new Ui::newNotebookDialog) { ui->setupUi(this); } newNotebookDialog::~newNotebookDialog() { delete ui; } void newNotebookDialog::on_buttonBox_accepted() { if(ui->notebookDirectoryBox->text() != "") { NotebookCreator(); } accepted(); } void newNotebookDialog::on_buttonBox_rejected() { rejected(); } void newNotebookDialog::NotebookCreator() { QString notebookPath = ui->notebookDirectoryBox->text(); QDir().mkdir(notebookPath); QString notebookDirName = QDir(notebookPath).dirName(); setNbName(notebookDirName); setNbDirectory(notebookPath); setNbFileName(notebookDirName + ".noteb"); setNbColor(ui->notebookColorBox->currentText()); } void newNotebookDialog::on_directorySelector_clicked() { QFileDialog dialog(this); dialog.setFileMode(QFileDialog::DirectoryOnly); QString notebookPath = dialog.getSaveFileName(this, tr("Save File"), "/home/drew/Documents", tr("Notebook Directory")); ui->notebookDirectoryBox->setText(notebookPath); } /* Setter Functions */ void newNotebookDialog::setNbName(QString newNbName) { nbName = newNbName; } void newNotebookDialog::setNbDirectory(QString newNbDirectory) { nbDirectory = newNbDirectory; } void newNotebookDialog::setNbFileName(QString newNbFileName) { nbFileName = newNbFileName; } void newNotebookDialog::setNbColor(QString newNbColor) { nbColor = newNbColor; } /* Getter Functions */ QString newNotebookDialog::getNbName() { return nbName; } QString newNotebookDialog::getNbDirectory() { return nbDirectory; } QString newNotebookDialog::getNbFileName() { return nbFileName; } QString newNotebookDialog::getNbColor() { return nbColor; }