From: Norbert Moutarde Date: Sun, 13 Mar 2016 19:18:47 +0000 (+0100) Subject: i've added the possibility to push a button once to get menu and a X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=e9660a9a6e8f5a7b16abd3a3e66a7b608d46ca92;p=diary-mobile.git i've added the possibility to push a button once to get menu and a second time to get back --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 599677a..04af234 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -895,59 +895,46 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event) qDebug()<<"key released="<value(QString("actionmenu"), QString("")).toString(); - if(a!=""){ - if(beforekey.isEmpty()){ - beforekey=lastprint; - action(a); - }else{ - action(beforekey); - beforekey.clear(); - }; - //accepted=true; + const QString a=conf->value(QString("actionmenu")).toString(); + if(a!=lastprint){ + beforeactionmenu=lastprint; + action(a); }else{ - accepted=false; - } - } - else if(k==Qt::Key_Back){ + action(beforeactionmenu); + + }; + accepted=true; + }else if(k==Qt::Key_Back){ const QString a=conf->value(QString("menuback"), QString("")).toString(); - if(a!=""){ - if(beforekey.isEmpty()){ - beforekey=lastprint; - action(a); - }else{ - action(beforekey); - beforekey.clear(); - }; - accepted=true; - } - } - else if(k==Qt::Key_VolumeDown){ + if(a!=lastprint){ + beforekeyback=lastprint; + action(a); + }else{ + action(beforekeyback); + + }; + accepted=true; + }else if(k==Qt::Key_VolumeDown){ qDebug()<<"keyvolumdown"; const QString a=conf->value(QString("volumdown")).toString(); - if(a!=""){ - if(beforekey.isEmpty()){ - beforekey=lastprint; - action(a); - }else{ - action(beforekey); - beforekey.clear(); - }; - accepted=true; - } - } - else if(k==Qt::Key_VolumeUp){ + if(a!=lastprint){ + beforevolumedown=lastprint; + action(a); + }else{ + action(beforevolumedown); + + }; + accepted=true; + }else if(k==Qt::Key_VolumeUp){ const QString a=conf->value(QString("volumup")).toString(); - if(a!=""){ - if(beforekey.isEmpty()){ - beforekey=lastprint; - action(a); - }else{ - action(beforekey); - beforekey.clear(); - }; - accepted=true; - } + if(a!=lastprint){ + beforevolumeup=lastprint; + action(a); + }else{ + action(beforevolumeup); + + }; + accepted=true; }; event->setAccepted(accepted); } @@ -1310,7 +1297,7 @@ void MainWindow::get2(const QString & d, const QString &b){ QString c="%"+a+"%", x=conf->value(t).toString(); qDebug()<<"l691 x="<