atailentry.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. *openTail Log - A FOSS Tail Logbook Application
  3. *Copyright (C) 2020 Felix Turowsky
  4. *
  5. *This program is free software: you can redistribute it and/or modify
  6. *it under the terms of the GNU General Public License as published by
  7. *the Free Software Foundation, either version 3 of the License, or
  8. *(at your option) any later version.
  9. *
  10. *This program is distributed in the hope that it will be useful,
  11. *but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. *GNU General Public License for more details.
  14. *
  15. *You should have received a copy of the GNU General Public License
  16. *along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. #include "atailentry.h"
  19. ATailEntry::ATailEntry()
  20. : AEntry::AEntry(DEFAULT_TAIL_POSITION)
  21. {}
  22. ATailEntry::ATailEntry(int row_id)
  23. : AEntry::AEntry(DataPosition(DB_TABLE_TAILS, row_id))
  24. {}
  25. ATailEntry::ATailEntry(RowData table_data)
  26. : AEntry::AEntry(DEFAULT_TAIL_POSITION, table_data)
  27. {}
  28. const QString ATailEntry::registration()
  29. {
  30. return getData().value(DB_TAILS_REGISTRATION).toString();
  31. }
  32. const QString ATailEntry::type()
  33. {
  34. QString type_string;
  35. if (!tableData.value(DB_TAILS_MAKE).toString().isEmpty())
  36. type_string.append(getData().value(DB_TAILS_MAKE).toString() + ' ');
  37. if (!tableData.value(DB_TAILS_MODEL).toString().isEmpty())
  38. type_string.append(getData().value(DB_TAILS_MODEL).toString());
  39. if (!tableData.value(DB_TAILS_VARIANT).toString().isEmpty())
  40. type_string.append('-' + getData().value(DB_TAILS_VARIANT).toString() + ' ');
  41. return type_string;
  42. }