Add minimal routine to disable Tx after 5 minutes of no mouse movement.

This commit is contained in:
Joe Taylor 2018-11-02 14:40:48 -04:00
parent 6ba2fb7bf9
commit aa0d4208ce
2 changed files with 26 additions and 1 deletions

View File

@ -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 ();

View File

@ -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