totalswidget.cpp 844 B

123456789101112131415161718192021222324252627282930
  1. #include "totalswidget.h"
  2. #include "ui_totalswidget.h"
  3. // Debug Makro
  4. #define DEB(expr) \
  5. qDebug() << __PRETTY_FUNCTION__ << "\t" << expr
  6. TotalsWidget::TotalsWidget(QWidget *parent) :
  7. QWidget(parent),
  8. ui(new Ui::TotalsWidget)
  9. {
  10. ui->setupUi(this);
  11. auto data = Stat::totals();
  12. DEB("Filling Totals Line Edits...");
  13. //DEB("data: " << data);
  14. for (const auto &field : data) {
  15. auto line_edit = parent->findChild<QLineEdit *>(field.first + "LineEdit");
  16. line_edit->setText(field.second);
  17. }
  18. QSettings settings;
  19. QString name = settings.value("userdata/picfirstname").toString();
  20. if(!name.isEmpty()) {
  21. QString salutation = "Welcome to openPilotLog, " + name + QLatin1Char('!');
  22. ui->welcomeLabel->setText(salutation);
  23. }
  24. }
  25. TotalsWidget::~TotalsWidget()
  26. {
  27. delete ui;
  28. }