Line data Source code
1 : #include <QDialog>
2 : #include <QWidget>
3 :
4 : #include "dbe/SchemaGraphicNote.hpp"
5 : #include "dbe/SchemaNoteEditor.hpp"
6 : #include "ui_SchemaNoteEditor.h"
7 :
8 : namespace dbse {
9 0 : SchemaNoteEditor::SchemaNoteEditor(SchemaGraphicNote* note, QWidget* parent)
10 : : QDialog(parent)
11 0 : , m_note(note)
12 0 : , m_ui(new Ui::SchemaNoteEditor)
13 : {
14 :
15 0 : m_ui->setupUi(this);
16 0 : m_ui->text->setPlainText(m_note->text());
17 0 : m_ui->text->setFocus();
18 0 : connect(m_ui->buttons, SIGNAL(accepted()), this, SLOT(update_text()));
19 0 : connect(m_ui->buttons, SIGNAL(rejected()), this, SLOT(cancel_note()));
20 0 : }
21 :
22 0 : SchemaNoteEditor::~SchemaNoteEditor()
23 : {
24 0 : delete m_ui;
25 0 : }
26 :
27 : void
28 0 : SchemaNoteEditor::cancel_note()
29 : {
30 0 : emit cancelled(m_note);
31 0 : }
32 :
33 : void
34 0 : SchemaNoteEditor::update_text()
35 : {
36 0 : emit note_accepted(m_note);
37 0 : m_note->update_note(m_ui->text->toPlainText());
38 0 : }
39 : } // namespace dbse
|