blob: 5a60391f63eedca521dedca6d288f9e2b50224ea (
plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#include "ui/mainwindow.h"
#include "ui_mainwindow.h"
#include "ui/metadatadialog.h"
#include <iostream>
MainWindow::MainWindow(samb::Structogram *structogram, QWidget *parent) :
QMainWindow(parent),
_ui(new Ui::MainWindow),
_structogram(structogram)
{
_ui->setupUi(this);
initData();
}
MainWindow::~MainWindow()
{
delete _ui;
}
/**** private slots ****/
void MainWindow::on_newButton_clicked()
{
if (_structogram != nullptr)
{
// TODO: implement save dialog
std::cout << "TODO: implement save dialog" << std::endl;
delete _structogram;
_structogram = nullptr;
}
MetadataDialog *dialog = new MetadataDialog(this);
if (dialog->exec() == QDialog::Accepted)
{
_structogram = new samb::Structogram(dialog->title(), dialog->author());
}
delete dialog;
}
void MainWindow::on_metadataButton_clicked()
{
if (_structogram == nullptr) { return; }
MetadataDialog *dialog = new MetadataDialog(this);
dialog->setMetadata(_structogram->title(), _structogram->author());
if (dialog->exec() == QDialog::Accepted)
{
_structogram->title(dialog->title());
_structogram->author(dialog->author());
}
}
/**** private methods ****/
void MainWindow::initData()
{
if (_structogram == nullptr)
{
_structogram = new samb::Structogram("", "");
}
}
|