message: UI-CPP: added functionality to read multiple images at once.
  If more files are selected than there are images in the chain, the current image is copied and appended and then corresponding data is read in.
diff: @@ -1124,28 +1124,60 @@ void MainWindow::save_Spin_Configuration()
  void MainWindow::load_Spin_Configuration()
  {
  - auto fileName = QFileDialog::getOpenFileName(this,
  + auto fileNames = QFileDialog::getOpenFileNames(this,
  tr("Load Spin Configuration"),
  "./input",
  tr("Any (*.txt *.csv *.ovf);;Plaintext (*.txt);;Comma-separated (*.csv);;OOMF Vector Field binary (*.ovf)"));
  +
  + int n_files = fileNames.size();
  + int n_read = 0;
  + int i_start = System_Get_Index(this->state.get());
  +
  + for (auto& fileName : fileNames)
  + {
  + int noi = Chain_Get_NOI(this->state.get());
  + bool read_image = true;
  + int type = IO_Fileformat_Regular;
  +
  if (!fileName.isEmpty())
  {
  QFileInfo fi(fileName);
  // Determine file type from suffix
  auto qs_type = fi.suffix();
  - int type = IO_Fileformat_Regular;
  if (qs_type == "txt") type = IO_Fileformat_Regular;
  else if (qs_type == "csv") type = IO_Fileformat_CSV_Pos;
  else if (qs_type == "ovf") type = IO_Fileformat_OVF;
  else
  {
  Log_Send(state.get(), Log_Level_Error, Log_Sender_UI, ("Invalid file ending (only txt, csv and ovf allowed) on file " + string_q2std(fileName)).c_str());
  - return;
  + read_image = false;
  + }
  + }
  + else read_image = false;
  +
  + if (read_image)
  + {
  + std::cerr << i_start << " " << n_read << " " << noi << std::endl;
  + // Append image to chain if necessary
  + if (i_start+n_read == noi)
  + {
  + Chain_Image_to_Clipboard(this->state.get());
  + Chain_Insert_Image_After(this->state.get());
  + Chain_next_Image(this->state.get());
  + }
  + else if (n_read > 0)
  + {
  + Chain_next_Image(this->state.get());
  }
  +
  // Read the file
  auto file = string_q2std(fileName);
  IO_Image_Read(this->state.get(), file.c_str(), type);
  + ++n_read;
  }
  + }
  +
  + Chain_Jump_To_Image(this->state.get(), i_start);
  this->spinWidget->updateData();
  }
  