diff --git a/windowrace.cpp b/windowrace.cpp index 9f4da10..d83c74c 100644 --- a/windowrace.cpp +++ b/windowrace.cpp @@ -2,9 +2,11 @@ #include "ui_windowrace.h" #include #include +#include #include #include #include "unistd.h" +#include using std::vector; using std::string; @@ -118,7 +120,29 @@ WindowRace::WindowRace(DataBase *db, QWidget *parent) : this->ui->pbTime->setStyleSheet("QProgressBar::chunk { color: #05B8CC;}"); this->ui->pbTime->setValue(0); + QKeySequence ks(Qt::Key_Return); // btw, this is numpad enter + QShortcut *keyReturn = new QShortcut(ks, this); + QObject::connect(keyReturn, SIGNAL(activated()), this, SLOT(ReturnPress())); + + //QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(close())); + } + +void WindowRace::ReturnPress(){ + //cout << "Return pressed" << endl; + if(this->ui->pBNextRace->isEnabled()){ + this->prepareNextRace(); + } + else{ + if(started){ + this->breakCounter(); + } + else{ + this->go(); + } + } +} + void WindowRace::prepareNextRace(){ this->firstTimeShell = true; this->firstTimeDea = true; diff --git a/windowrace.h b/windowrace.h index 98892d3..a6358cf 100644 --- a/windowrace.h +++ b/windowrace.h @@ -69,6 +69,7 @@ public slots: void laufcheck(); void deaSlot(); void shellSlot(); + void ReturnPress(); }; #endif // WINDOWRACE_H