Skip to content
Snippets Groups Projects
Commit 3cdfe10c authored by d.kilic's avatar d.kilic
Browse files

Merge branch '201-allow-selection-of-multiple-mocap-files-in-file-dialog' into 'master'

Allow selection of multiple files at once

Closes #201

See merge request !135
parents 7ab1d292 f380a0df
No related branches found
No related tags found
1 merge request!135Allow selection of multiple files at once
Pipeline #45270 passed
......@@ -29,6 +29,7 @@ public:
~MoCapSelectionWidget() override;
void setFileName();
void setFileName(QString filename);
MoCapPersonMetadata getMetadata() const;
bool isFilledOut() const;
......
......@@ -21,7 +21,7 @@ MoCapSelectionWidget::MoCapSelectionWidget(QWidget *parent, const QMap<QString,
mUi->offSetSpinBox->setRange(-offsetRange, offsetRange);
mUi->offSetSpinBox->setSingleStep(0.01);
connect(mUi->browseFileButton, &QPushButton::clicked, this, &MoCapSelectionWidget::setFileName);
connect(mUi->browseFileButton, &QPushButton::clicked, this, QOverload<>::of(&MoCapSelectionWidget::setFileName));
connect(mUi->btnDelete, &QPushButton::clicked, this, &MoCapSelectionWidget::deleteLater);
}
......@@ -69,6 +69,20 @@ void MoCapSelectionWidget::setFileName()
extensionsString << ")";
QString filename = QFileDialog::getOpenFileName(
this, tr("Open C3D File"), QDir::currentPath(), QString::fromStdString(extensionsString.str()));
setFileName(filename);
}
/**
* @brief Sets the filename to the given string
*
* Sets filePathLabel. Also sets mFilledOut to true if
* a file was selected, i.e. name != "" or false if
* name == ""
*
* @param filename name of MoCap-file
*/
void MoCapSelectionWidget::setFileName(QString filename)
{
mUi->filePathLabel->clear();
mUi->filePathLabel->setText(filename);
mFilledOut = !filename.isEmpty();
......
......@@ -105,5 +105,19 @@ OpenMoCapDialog::~OpenMoCapDialog()
void OpenMoCapDialog::on_btnAddSelection_clicked()
{
mUi->moCapSelections->layout()->addWidget(new MoCapSelectionWidget(this, mMoCapSystems));
std::stringstream extensions;
extensions << "All MoCap File Types (";
for(const auto &extension : moCapFileExtensions)
{
extensions << " *." << extension.second;
}
extensions << ")";
auto selectedFiles = QFileDialog::getOpenFileNames(
this, tr("Open C3D File"), QDir::currentPath(), QString::fromStdString(extensions.str()));
for(const auto &file : selectedFiles)
{
MoCapSelectionWidget *widget = new MoCapSelectionWidget(this, mMoCapSystems);
widget->setFileName(file);
mUi->moCapSelections->layout()->addWidget(widget);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment