diff --git a/mainwindow.cpp b/mainwindow.cpp index e48c5c211..355058f3e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -929,6 +929,11 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, ui->cbMenus->setChecked(false); } + mouseLastPos=QCursor::pos(); + m_mouseIdleSeconds=0; + connect(&mouseTimer, &QTimer::timeout, this, &MainWindow::mouseTimerTick); + mouseTimer.start(1000); + // this must be the last statement of constructor if (!m_valid) throw std::runtime_error {"Fatal initialization exception"}; } @@ -954,6 +959,22 @@ void MainWindow::initialize_fonts () setDecodedTextFont (m_config.decoded_text_font ()); } +void MainWindow::mouseTimerTick() +{ + QPoint point = QCursor::pos(); + if(point != mouseLastPos) + m_mouseIdleSeconds = 0; + else + m_mouseIdleSeconds++; + mouseLastPos = point; +//Here we should do what's necessary when mouseIdleSeconds gets too big. +// qDebug() << m_mouseIdleSeconds; + if(ui->cbAutoSeq->isChecked() and m_mouseIdleSeconds>300) { + auto_tx_mode (false); + } +} + + void MainWindow::splash_done () { m_splash && m_splash->close (); diff --git a/mainwindow.h b/mainwindow.h index 6a6a88d02..856a1ff6a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -442,7 +442,7 @@ private: qint32 m_Nslots=5; qint32 m_nFoxMsgTimes[5]={0,0,0,0,0}; qint32 m_tAutoOn; -// qint32 m_maxQSOs; + qint32 m_mouseIdleSeconds; qint32 m_tFoxTx=0; qint32 m_tFoxTx0=0; qint32 m_maxStrikes=3; //Max # of repeats: 3 strikes and you're out @@ -566,6 +566,9 @@ private: QTimer minuteTimer; QTimer splashTimer; QTimer p1Timer; + QTimer mouseTimer; + + QPoint mouseLastPos; QString m_path; QString m_baseCall; @@ -695,6 +698,7 @@ private: void cabLog(); void useNextCall(); void abortQSO(); + void mouseTimerTick(); bool isWorked(int itype, QString key, float fMHz=0, QString=""); QString save_wave_file (QString const& name