|
4 | 4 | #include <FAST/Visualization/Window.hpp> |
5 | 5 | #include <FAST/Importers/ImageImporter.hpp> |
6 | 6 | #include <FAST/Visualization/ImageRenderer/ImageRenderer.hpp> |
| 7 | +#include <FAST/Tools/CommandLineParser.hpp> |
7 | 8 | #include <QMessageBox> |
8 | 9 | #include <QVBoxLayout> |
9 | 10 | #include <QTextEdit> |
@@ -108,46 +109,44 @@ std::string doCheck() { |
108 | 109 | class SystemCheckWindow : public Window { |
109 | 110 | FAST_OBJECT(SystemCheckWindow) |
110 | 111 | public: |
111 | | - SystemCheckWindow() { |
112 | | - setTitle("FAST " + getVersion() + " System Check"); |
113 | | - auto message = doCheck(); |
114 | | - |
115 | | - auto importer = ImageImporter::New(); |
116 | | - importer->setFilename(Config::getDocumentationPath() + "/images/FAST_logo_square.png"); |
117 | | - importer->setGrayscale(false); |
118 | | - |
119 | | - // Set up GUI |
120 | | - auto layout = new QVBoxLayout(); |
121 | | - setCenterLayout(layout); |
122 | | - |
123 | | - auto renderer = ImageRenderer::New(); |
124 | | - renderer->setInputConnection(importer->getOutputPort()); |
125 | | - |
126 | | - auto view = createView(); |
127 | | - view->set2DMode(); |
128 | | - view->addRenderer(renderer); |
129 | | - view->setFixedHeight((float)mHeight/2); |
130 | | - layout->addWidget(view); |
131 | | - |
132 | | - auto textField = new QTextEdit; |
133 | | - textField->setText(message.c_str()); |
134 | | - textField->setReadOnly(true); |
135 | | - layout->addWidget(textField); |
136 | | - } |
| 112 | + FAST_CONSTRUCTOR(SystemCheckWindow) |
137 | 113 | }; |
| 114 | +SystemCheckWindow::SystemCheckWindow() { |
| 115 | + setTitle("FAST " + getVersion() + " System Check"); |
| 116 | + auto message = doCheck(); |
| 117 | + |
| 118 | + auto importer = ImageImporter::create(Config::getDocumentationPath() + "/images/FAST_logo_square.png", false); |
| 119 | + |
| 120 | + // Set up GUI |
| 121 | + auto layout = new QVBoxLayout(); |
| 122 | + setCenterLayout(layout); |
| 123 | + |
| 124 | + auto renderer = ImageRenderer::create()->connect(importer); |
| 125 | + |
| 126 | + auto view = createView(); |
| 127 | + view->set2DMode(); |
| 128 | + view->addRenderer(renderer); |
| 129 | + view->setFixedHeight((float)mHeight/2); |
| 130 | + layout->addWidget(view); |
| 131 | + |
| 132 | + auto textField = new QTextEdit; |
| 133 | + textField->setText(message.c_str()); |
| 134 | + textField->setReadOnly(true); |
| 135 | + layout->addWidget(textField); |
| 136 | +} |
138 | 137 |
|
139 | | -int main(int argc, char**argv) { |
| 138 | +int main(int argc, char** argv) { |
| 139 | + CommandLineParser parser("FAST System Check"); |
| 140 | + parser.addOption("no-gui", "Disable GUI, and show information on command line interface instead"); |
| 141 | + parser.parse(argc, argv); |
140 | 142 |
|
141 | | - if(Config::getVisualization()) { |
142 | | - auto window = SystemCheckWindow::New(); |
143 | | - window->start(); |
| 143 | + if(Config::getVisualization() && !parser.getOption("no-gui")) { |
| 144 | + SystemCheckWindow::create()->run(); |
144 | 145 | } else { |
145 | 146 | std::cout << doCheck() << std::endl; |
146 | 147 |
|
147 | 148 | // Pipeline check |
148 | | - auto importer = ImageImporter::New(); |
149 | | - importer->setFilename(Config::getDocumentationPath() + "/images/FAST_logo_square.png"); |
150 | | - importer->setGrayscale(false); |
| 149 | + auto importer = ImageImporter::create(Config::getDocumentationPath() + "/images/FAST_logo_square.png", false); |
151 | 150 | auto image = importer->updateAndGetOutputData<Image>(); |
152 | 151 | } |
153 | 152 |
|
|
0 commit comments