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

Allow selection of multiple MoCap files at once

parent 7ab1d292
No related branches found
No related tags found
1 merge request!135Allow selection of multiple files at once
...@@ -29,6 +29,7 @@ public: ...@@ -29,6 +29,7 @@ public:
~MoCapSelectionWidget() override; ~MoCapSelectionWidget() override;
void setFileName(); void setFileName();
void setFileName(QString filename);
MoCapPersonMetadata getMetadata() const; MoCapPersonMetadata getMetadata() const;
bool isFilledOut() const; bool isFilledOut() const;
......
...@@ -21,7 +21,7 @@ MoCapSelectionWidget::MoCapSelectionWidget(QWidget *parent, const QMap<QString, ...@@ -21,7 +21,7 @@ MoCapSelectionWidget::MoCapSelectionWidget(QWidget *parent, const QMap<QString,
mUi->offSetSpinBox->setRange(-offsetRange, offsetRange); mUi->offSetSpinBox->setRange(-offsetRange, offsetRange);
mUi->offSetSpinBox->setSingleStep(0.01); 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); connect(mUi->btnDelete, &QPushButton::clicked, this, &MoCapSelectionWidget::deleteLater);
} }
...@@ -69,6 +69,20 @@ void MoCapSelectionWidget::setFileName() ...@@ -69,6 +69,20 @@ void MoCapSelectionWidget::setFileName()
extensionsString << ")"; extensionsString << ")";
QString filename = QFileDialog::getOpenFileName( QString filename = QFileDialog::getOpenFileName(
this, tr("Open C3D File"), QDir::currentPath(), QString::fromStdString(extensionsString.str())); 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->clear();
mUi->filePathLabel->setText(filename); mUi->filePathLabel->setText(filename);
mFilledOut = !filename.isEmpty(); mFilledOut = !filename.isEmpty();
......
...@@ -105,5 +105,19 @@ OpenMoCapDialog::~OpenMoCapDialog() ...@@ -105,5 +105,19 @@ OpenMoCapDialog::~OpenMoCapDialog()
void OpenMoCapDialog::on_btnAddSelection_clicked() 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