Skip to content

Commit

Permalink
fix thumbnail path finding UI
Browse files Browse the repository at this point in the history
  • Loading branch information
codebot committed Nov 26, 2019
1 parent 07c47b4 commit a0f6968
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions gui/preferences_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,21 @@ PreferencesDialog::~PreferencesDialog()
void PreferencesDialog::thumbnail_path_button_clicked()
{
QFileDialog file_dialog(this, "Find Thumbnail Path");
file_dialog.setFileMode(QFileDialog::ExistingFile);
file_dialog.setNameFilter("model_list.yaml");
file_dialog.setFileMode(QFileDialog::Directory);
file_dialog.setOption(QFileDialog::ShowDirsOnly);
if (file_dialog.exec() != QDialog::Accepted)
return; // user clicked 'cancel'

const QString model_list_path = file_dialog.selectedFiles().first();
if (!QFileInfo(model_list_path).exists())
const QString path = file_dialog.selectedFiles().first();
if (!QFileInfo(path).exists())
{
QMessageBox::critical(
this,
"model_list.yaml file does not exist",
"File does not exist.");
"path does not exist",
"path does not exist");
return;
}
thumbnail_path_line_edit->setText(
QFileInfo(model_list_path).dir().absolutePath());
thumbnail_path_line_edit->setText(path);
}

void PreferencesDialog::ok_button_clicked()
Expand Down

0 comments on commit a0f6968

Please sign in to comment.