-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathannotationeditordialog.cpp
47 lines (40 loc) · 1.29 KB
/
annotationeditordialog.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
41
42
43
44
45
46
47
#include "annotationeditordialog.h"
#include "ui_annotationeditordialog.h"
AnnotationEditorDialog::AnnotationEditorDialog(const Annotation &annotation, const TextBit &hint, const QString &annotationKey, const QList<AnnotationType>* types, QWidget *parent) :
QDialog(parent),
ui(new Ui::AnnotationEditorDialog),
mHint(hint)
{
ui->setupUi(this);
ui->textEdit->setTextBit( annotation.text() );
ui->headerEdit->setTextBit( annotation.header() );
foreach(AnnotationType type, *types)
{
ui->annotationType->addItem( type.label() );
}
ui->annotationType->setCurrentText( annotationKey );
connect(ui->guessButton, SIGNAL(clicked()), this, SLOT(guessButton()));
connect(ui->clearAll, SIGNAL(clicked()), this, SLOT(clearAll()) );
}
AnnotationEditorDialog::~AnnotationEditorDialog()
{
delete ui;
}
Annotation AnnotationEditorDialog::annotation() const
{
return Annotation( ui->headerEdit->textBit() , ui->textEdit->textBit() );
}
QString AnnotationEditorDialog::newAnnotationType() const
{
return ui->annotationType->currentText();
}
void AnnotationEditorDialog::guessButton()
{
ui->headerEdit->setText( mHint.text() );
}
void AnnotationEditorDialog::clearAll()
{
ui->textEdit->setText( "" );
ui->headerEdit->setText( "" );
accept();
}