-
Notifications
You must be signed in to change notification settings - Fork 0
/
editfolderdialog.cpp
40 lines (35 loc) · 922 Bytes
/
editfolderdialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "editfolderdialog.h"
#include "ui_editfolderdialog.h"
#include "mainwindow.h"
#include <QMessageBox>
EditFolderDialog::EditFolderDialog(int32_t FolderID,QWidget *parent) :
QDialog(parent),
ui(new Ui::EditFolderDialog)
{
ui->setupUi(this);
ui->buttonBox->layout()->setSpacing(0);
if (FolderID!=0)
{
const FolderInfo * CurrentFolder=MainWindow::MainWindowPtr->AlbumFolders.value(FolderID)->Info;
ui->FolderNameEdit->setText(CurrentFolder->FolderName);
ui->FolderDescriptionEdit->setText(CurrentFolder->Comments);
}
else
{
setWindowTitle("New Folder");
}
connect(ui->buttonBox,&QDialogButtonBox::accepted,this,&EditFolderDialog::onAcceptPressed);
}
EditFolderDialog::~EditFolderDialog()
{
delete ui;
}
void EditFolderDialog::onAcceptPressed()
{
if (ui->FolderNameEdit->text().isEmpty())
{
QMessageBox::warning(this,"Error","Folder Name field cannot be empty");
return;
}
accept();
}