Orfeo Toolbox  3.16
otbWrapperQtWidgetView.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #include "otbWrapperQtWidgetView.h"
19 
28 
29 #include "itksys/SystemTools.hxx"
30 
31 namespace otb
32 {
33 namespace Wrapper
34 {
35 
37 {
38  m_Model = new QtWidgetModel(app);
39  m_Application = app;
40 }
41 
43 {
44 
45 }
46 
48 {
49  // Create a VBoxLayout with the header, the input widgets, and the footer
50  QVBoxLayout *mainLayout = new QVBoxLayout();
51  QTabWidget *tab = new QTabWidget();
52 
53  tab->addTab(CreateInputWidgets(), "Parameters");
54  QTextEdit *log = new QTextEdit();
55  connect( m_Model->GetLogOutput(), SIGNAL(NewContentLog(QString)), log, SLOT(append(QString) ) );
56  tab->addTab(log, "Logs");
59  tab->addTab(prog, "Progress");
60  tab->addTab(CreateDoc(), "Documentation");
61  mainLayout->addWidget(tab);
62 
63  m_Message = new QLabel("<center><font color=\"#FF0000\">Select parameters</font></center>");
64  connect( m_Model, SIGNAL(SetApplicationReady(bool)), this, SLOT(UpdateMessageAfterApplicationReady(bool)) );
65  mainLayout->addWidget(m_Message);
66 
68  progressReport->SetApplication(m_Application);
69 
70  QHBoxLayout *footLayout = new QHBoxLayout;
71  footLayout->addWidget(progressReport);
72  footLayout->addWidget(CreateFooter());
73  mainLayout->addLayout(footLayout);
74 
75  QGroupBox *mainGroup = new QGroupBox();
76  mainGroup->setLayout(mainLayout);
77 
78  QVBoxLayout *finalLayout = new QVBoxLayout();
79  finalLayout->addWidget(mainGroup);
80 
81  // Make the final layout to the widget
82  this->setLayout(finalLayout);
83 }
84 
86 {
87  m_Message->setText("<center><font color=\"#FF0000\">Running</font></center>");
88 }
89 
91 {
92  if(val == true)
93  m_Message->setText("<center><font color=\"#00FF00\">Ready to run</font></center>");
94  else
95  m_Message->setText("<center><font color=\"#FF0000\">Select parameters</font></center>");
96 }
97 
99 {
100  QScrollArea *scrollArea = new QScrollArea;
101  // Put the main group inside a scroll area
103  scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
104  scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
105  scrollArea->setWidgetResizable(true);
106 
107  return scrollArea;
108 }
109 
110 
112 {
113  // an HLayout with two buttons : Execute and Quit
114  QGroupBox *footerGroup = new QGroupBox;
115  QHBoxLayout *footerLayout = new QHBoxLayout;
116 
117  footerGroup->setFixedHeight(40);
118  footerGroup->setContentsMargins(0, 0, 0, 0);
119  footerLayout->setContentsMargins(5, 5, 5, 5);
120 
121  m_ExecButton = new QPushButton(footerGroup);
122  m_ExecButton->setDefault(true);
123  m_ExecButton->setEnabled(false);
124  m_ExecButton->setText(QObject::tr("Execute"));
125  connect( m_ExecButton, SIGNAL(clicked()), m_Model, SLOT(ExecuteAndWriteOutputSlot() ) );
126  connect( m_Model, SIGNAL(SetApplicationReady(bool)), m_ExecButton, SLOT(setEnabled(bool)) );
127  connect( m_ExecButton, SIGNAL(clicked()), this, SLOT(UpdateMessageAfterExcuteClicked() ) );
128 
129  m_QuitButton = new QPushButton(footerGroup);
130  m_QuitButton->setText(QObject::tr("Quit"));
131  connect( m_QuitButton, SIGNAL(clicked()), this, SLOT(CloseSlot()) );
132 
133  // Put the buttons on the right
134  footerLayout->addStretch();
135  footerLayout->addWidget(m_ExecButton);
136  footerLayout->addWidget(m_QuitButton);
137 
138  footerGroup->setLayout(footerLayout);
139 
140  return footerGroup;
141 }
142 
144 {
145  QTextEdit *text = new QTextEdit;
146  text->setReadOnly(true);
147 
148  QTextDocument * doc = new QTextDocument();
149 
150  std::string docContain;
152 
153  doc->setHtml(docContain.c_str());
154 
155  text->setDocument(doc);
156 
157  return text;
158 }
159 
161 {
162  // Close the widget
163  this->close();
164 
165  // Emit a signal to close any widget that this gui belonging to
166  emit QuitSignal();
167 }
168 
169 }
170 }

Generated at Sun May 19 2013 01:01:51 for Orfeo Toolbox with doxygen 1.8.3.1