Skip to content

Commit 85cc02b

Browse files
committed
Added --no-gui option to systemCheck
1 parent 7d28684 commit 85cc02b

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

source/FAST/Tools/SystemCheck/main.cpp

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <FAST/Visualization/Window.hpp>
55
#include <FAST/Importers/ImageImporter.hpp>
66
#include <FAST/Visualization/ImageRenderer/ImageRenderer.hpp>
7+
#include <FAST/Tools/CommandLineParser.hpp>
78
#include <QMessageBox>
89
#include <QVBoxLayout>
910
#include <QTextEdit>
@@ -108,46 +109,44 @@ std::string doCheck() {
108109
class SystemCheckWindow : public Window {
109110
FAST_OBJECT(SystemCheckWindow)
110111
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)
137113
};
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+
}
138137

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);
140142

141-
if(Config::getVisualization()) {
142-
auto window = SystemCheckWindow::New();
143-
window->start();
143+
if(Config::getVisualization() && !parser.getOption("no-gui")) {
144+
SystemCheckWindow::create()->run();
144145
} else {
145146
std::cout << doCheck() << std::endl;
146147

147148
// 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);
151150
auto image = importer->updateAndGetOutputData<Image>();
152151
}
153152

0 commit comments

Comments
 (0)