You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
1.9 KiB
87 lines
1.9 KiB
/* 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;
|
|
}
|
|
|