newsequenz.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "newsequenz.h"
  2. #include "ui_newsequenz.h"
  3. #include <QLineEdit>
  4. #include <QIntValidator>
  5. NewSequenz::NewSequenz( int max, QWidget *parent) :
  6. QDialog(parent),
  7. ui(new Ui::NewSequenz),
  8. offset( 0 ),
  9. limit( 0 )
  10. {
  11. ui->setupUi(this);
  12. ui->label->setText( "Es wurden " + QString::number( max ) + " Bilder gefunden." );
  13. ui->min->setValidator( new QIntValidator(1, max, this) );
  14. ui->max->setValidator( new QIntValidator(1, max, this) );
  15. ui->min->setText( "1" );
  16. ui->max->setText( QString::number( max ) );
  17. }
  18. NewSequenz::~NewSequenz()
  19. {
  20. delete ui;
  21. }
  22. // Gibt das Offset zurück, ab dem die Bilder in den neuen Datensatz übertragen werden sollen
  23. int NewSequenz::getOffset() const
  24. {
  25. return offset;
  26. }
  27. // Gibt die Anzahl der Bilder zurück, die in den neuen Datensatz übertragen werden sollen
  28. int NewSequenz::getLimit() const
  29. {
  30. return limit;
  31. }
  32. // Schließt das Dialogfenster
  33. void NewSequenz::on_ok_clicked()
  34. {
  35. if( !ui->min->text().length() || !ui->max->text().length() )
  36. return;
  37. int offset = ui->min->text().toInt() - 1;
  38. int limit = ui->max->text().toInt() - offset;
  39. if( limit > 0 && offset >= 0 )
  40. {
  41. this->offset = offset;
  42. this->limit = limit;
  43. this->close();
  44. }
  45. }
  46. // Schließt das Dialogfenster ohne angabe von Limit und Offset
  47. void NewSequenz::on_abbrechen_clicked()
  48. {
  49. this->close();
  50. }