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 | |
---|
9 | /*informations window constructor*/ |
---|
10 | void Window::winformations() |
---|
11 | { |
---|
12 | winfo = new QWidget(); |
---|
13 | informations = new QBoxLayout(QBoxLayout::TopToBottom,0); |
---|
14 | winfo->setWindowTitle("informations"); |
---|
15 | winfo->setFixedSize(370,180); |
---|
16 | winfo->move(628,50); |
---|
17 | |
---|
18 | |
---|
19 | /*name line*/ |
---|
20 | QBoxLayout *bname = new QBoxLayout(QBoxLayout::LeftToRight,0); |
---|
21 | ln = new QLabel(); |
---|
22 | ln->setText(""); |
---|
23 | lname = new QLabel(); |
---|
24 | lname->setText(""); |
---|
25 | bname->addWidget(ln); |
---|
26 | bname->addWidget(lname); |
---|
27 | |
---|
28 | /*type line*/ |
---|
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); |
---|
36 | |
---|
37 | /*comment line*/ |
---|
38 | comment = new QLineEdit(); |
---|
39 | comment->setText(""); |
---|
40 | comment->setReadOnly(true); |
---|
41 | |
---|
42 | /*buttons*/ |
---|
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); |
---|
50 | informations->addWidget(comment); |
---|
51 | informations->addWidget(noselect); |
---|
52 | informations->addWidget(back); |
---|
53 | |
---|
54 | winfo->setLayout(informations); |
---|
55 | winfo->show(); |
---|
56 | } |
---|
57 | |
---|
58 | /*write the comment of the componenet selected*/ |
---|
59 | void Window::write_comment(string cm){ |
---|
60 | QString c = QString::fromStdString(cm); |
---|
61 | comment->setText(c); |
---|
62 | comment->setCursorPosition(1); |
---|
63 | comment->show(); |
---|
64 | } |
---|
65 | |
---|
66 | void Window::erase_comment(){ |
---|
67 | comment->setText(""); |
---|
68 | comment->hide(); |
---|
69 | } |
---|
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 | } |
---|
77 | |
---|
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*/ |
---|
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 | } |
---|