Skip to content

Commit

Permalink
enhanced widget sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurmasson committed Sep 3, 2019
1 parent 9406786 commit 9fbbedb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cpp/src/CMakeLists.txt.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.9.2, 2019-08-28T18:21:46. -->
<!-- Written by QtCreator 4.9.2, 2019-09-02T18:37:43. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
8 changes: 6 additions & 2 deletions cpp/src/invocationguiwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ void InvocationGUIWidget::parseDescriptor(QJsonObject *invocationJSON)
{
// If input is a list of files: a "Select files" push button opens a dialog to select multiple files
QPushButton *pushButton = new QPushButton("Select files");
pushButton->setMaximumWidth(100);

connect(pushButton, &QPushButton::clicked, [this, inputName, lineEdit]()
{
Expand Down Expand Up @@ -619,7 +620,7 @@ void InvocationGUIWidget::parseDescriptor(QJsonObject *invocationJSON)
{
// If parameter is File: create a line edit (for the file path), a "Select file" button, and a "Set input" button
QLineEdit *lineEdit = new QLineEdit();
lineEdit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
lineEdit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
lineEdit->setPlaceholderText(inputDescription);
lineEdit->setText(inputValue.toString());

Expand All @@ -628,13 +629,15 @@ void InvocationGUIWidget::parseDescriptor(QJsonObject *invocationJSON)
layout->addWidget(lineEdit);

QPushButton *selectFilePushButton = new QPushButton("Select file");
selectFilePushButton->setMaximumWidth(100);
connect(selectFilePushButton, &QPushButton::clicked, [this, inputName, lineEdit]()
{
lineEdit->setText(this->fileHandler->normalizePath(QFileDialog::getOpenFileName(this, "Select " + inputName)));
} );
layout->addWidget(selectFilePushButton);

QPushButton *setInputPushButton = new QPushButton("Set input");
setInputPushButton->setMaximumWidth(100);
connect(setInputPushButton, &QPushButton::clicked, [this, lineEdit]() { lineEdit->setText(this->fileHandler->createTemporaryInputFileForCurrentInput()); } );
layout->addWidget(setInputPushButton);

Expand Down Expand Up @@ -664,7 +667,7 @@ void InvocationGUIWidget::parseDescriptor(QJsonObject *invocationJSON)
});
}

if(inputType == "String")
if(inputType == "String" || inputType == "File")
{
// If input is a string: check if there is a corresponding output file,
// if there is one: create a "Set output" button to automatically open the output file in medInria when the process ends
Expand All @@ -691,6 +694,7 @@ void InvocationGUIWidget::parseDescriptor(QJsonObject *invocationJSON)
{
// Create the "Set output" button
QPushButton *toggleOutputPushButton = new QPushButton("Set output");
toggleOutputPushButton->setMaximumWidth(100);
connect(toggleOutputPushButton, &QPushButton::clicked, [this, toggleOutputPushButton, inputId]() { this->toggleOutputFile(toggleOutputPushButton, inputId); } );
layout->addWidget(toggleOutputPushButton);
}
Expand Down

0 comments on commit 9fbbedb

Please sign in to comment.