[20] | 1 | #include "window.h" |
---|
| 2 | |
---|
| 3 | using namespace std; |
---|
| 4 | |
---|
| 5 | using namespace morpheo::tools::viewer::parser; |
---|
| 6 | using namespace morpheo::tools::viewer::bdd; |
---|
| 7 | using namespace morpheo::tools::viewer::graphics; |
---|
| 8 | |
---|
[32] | 9 | /*informations window constructor*/ |
---|
[20] | 10 | void Window::winformations() |
---|
| 11 | { |
---|
| 12 | winfo = new QWidget(); |
---|
[21] | 13 | informations = new QBoxLayout(QBoxLayout::TopToBottom,0); |
---|
[20] | 14 | winfo->setWindowTitle("informations"); |
---|
[32] | 15 | winfo->setFixedSize(370,180); |
---|
[26] | 16 | winfo->move(628,50); |
---|
[32] | 17 | |
---|
[30] | 18 | |
---|
[32] | 19 | /*name line*/ |
---|
[30] | 20 | QBoxLayout *bname = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 21 | ln = new QLabel(); |
---|
| 22 | ln->setText(""); |
---|
[26] | 23 | lname = new QLabel(); |
---|
| 24 | lname->setText(""); |
---|
[30] | 25 | bname->addWidget(ln); |
---|
| 26 | bname->addWidget(lname); |
---|
| 27 | |
---|
[32] | 28 | /*type line*/ |
---|
[30] | 29 | QBoxLayout *btype = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
| 30 | lt = new QLabel(); |
---|
| 31 | lt->setText(""); |
---|
| 32 | ltype = new QLabel(); |
---|
| 33 | ltype->setText(""); |
---|
| 34 | btype->addWidget(lt); |
---|
| 35 | btype->addWidget(ltype); |
---|
[32] | 36 | |
---|
| 37 | /*comment line*/ |
---|
[26] | 38 | comment = new QLineEdit(); |
---|
| 39 | comment->setText(""); |
---|
[30] | 40 | comment->setReadOnly(true); |
---|
| 41 | |
---|
[32] | 42 | /*buttons*/ |
---|
[30] | 43 | QPushButton *noselect = new QPushButton("cancel selection",wparam); |
---|
| 44 | QPushButton *back = new QPushButton("back",wparam); |
---|
| 45 | connect(back,SIGNAL(clicked()),this,SLOT(_back())); |
---|
| 46 | connect(noselect,SIGNAL(clicked()),this,SLOT(_cancel_selection())); |
---|
| 47 | |
---|
| 48 | informations->addLayout(bname); |
---|
| 49 | informations->addLayout(btype); |
---|
[26] | 50 | informations->addWidget(comment); |
---|
[30] | 51 | informations->addWidget(noselect); |
---|
| 52 | informations->addWidget(back); |
---|
| 53 | |
---|
[20] | 54 | winfo->setLayout(informations); |
---|
| 55 | winfo->show(); |
---|
| 56 | } |
---|
| 57 | |
---|
[32] | 58 | /*write the comment of the componenet selected*/ |
---|
[26] | 59 | void Window::write_comment(string cm){ |
---|
| 60 | QString c = QString::fromStdString(cm); |
---|
| 61 | comment->setText(c); |
---|
[32] | 62 | comment->setCursorPosition(1); |
---|
[30] | 63 | comment->show(); |
---|
[26] | 64 | } |
---|
| 65 | |
---|
[32] | 66 | void Window::erase_comment(){ |
---|
| 67 | comment->setText(""); |
---|
| 68 | comment->hide(); |
---|
[26] | 69 | } |
---|
[32] | 70 | /*write the name of the component selected*/ |
---|
| 71 | void Window::write_name(string type,string name){ |
---|
| 72 | QString n = QString::fromStdString(type); |
---|
| 73 | ln->setText(n); |
---|
| 74 | QString n2 = QString::fromStdString(name); |
---|
| 75 | lname->setText(n2); |
---|
| 76 | } |
---|
[30] | 77 | |
---|
[32] | 78 | void Window::erase_line(QLabel *l1, QLabel *l2){ |
---|
| 79 | l1->setText(""); |
---|
| 80 | l2->setText(""); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | /*write the type of the component selected*/ |
---|
[30] | 84 | void Window::write_type(string type){ |
---|
| 85 | lt->setText("type"); |
---|
| 86 | QString n = QString::fromStdString(type); |
---|
| 87 | ltype->setText(n); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | void Window::_cancel_selection(){ |
---|
| 91 | component_clicked = false; |
---|
| 92 | } |
---|