]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
I've added the capacity to not affect way (action begin by '-')
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Mon, 28 Apr 2014 13:53:13 +0000 (15:53 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Mon, 28 Apr 2014 13:56:09 +0000 (15:56 +0200)
mainwindow.cpp

index 7f7320c40fac9507b13579f631d9c361d3a0c50e..24255fc54bfd55e5ee62b37fd2d2f0439f1981f5 100644 (file)
@@ -38,7 +38,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
     setCentralWidget(screen);
     createMenuBar();
     connectDB();
-
+    screen->show();
     if((conf->value(QString("first")).toInt()==1)){
         qDebug()<<"second";
         QString ser=QInputDialog::getText(this, "fichier initial", "Entrez l'adresse du serveur où télécharger les premier boutons", QLineEdit::Normal, conf->value(QString("download")).toString());
@@ -279,7 +279,7 @@ void MainWindow::firstrun(){
     conf->setValue(QString("db"), QVariant("/data/data/eu.nothing2do.diarymobile/files/db"));
     conf->setValue(QString("selectbuttons"), QVariant("select keyword,label,action from ui order by label;"));
     conf->setValue(QString("selectraw"), QVariant("select date,texte from raw;"));
-    conf->setValue(QString("menuback"), QVariant("menuback"));
+    conf->setValue(QString("menuback"), QVariant("-menuback"));
 }
 QString &MainWindow::get(int row, int column){
     q->seek(row);
@@ -352,15 +352,18 @@ void MainWindow::addButtonDB(){
     exec(cmd);
     return;
 }
-void MainWindow::getButtons(const QString &a){
-    if(a==conf->value(QString("start")).toString())way.clear();
+void MainWindow::getButtons(const QString &b){
+    QString a=b;
+    if(b[0]!='-')way.append(a);
+    else a.remove(0, 1);
+
     qDebug()<<"getButtons("<<a<<") way.size()"<<way.size();
     flush();
     if(updatelocker.tryLock(60000))updatelocker.unlock();
     else{qDebug()<<"updatelocker is locked more than 1mn";}
-    QString b="%"+a+"%";
-    QList<QString> tmp({"select label,action from ui where keyword like ? order by id;", b});
-    label->setText(a);
+    QString c="%"+a+"%";
+    QList<QString> tmp({"select label,action from ui where keyword like ? order by id;", c});
+    label->setText(b);
     exec(tmp);
     int labCol = 0;//r.indexOf("label");
     int actCol = 1;//r.indexOf("action");
@@ -370,7 +373,6 @@ void MainWindow::getButtons(const QString &a){
         addWidget(q->value(actCol).toString(), new CLabel(q->value(labCol).toString(), conf->value(QString("button")).toString()));
         i++;
     };
-    way.append(a);
     /*grid->update();
     scroll->updateGeometry();
     screen->updateGeometry();*/
@@ -444,7 +446,6 @@ void MainWindow::RAWsent(){
 void MainWindow::back(){
     flush();
     getButtons(conf->value(QString("menuback")).toString());
-    //way.removeLast();
     for(int i=0; i<way.size(); i++){
         addWidget(QString(way[i]), new CLabel(QString(way[i]), conf->value(QString("button")).toString()));
     }
@@ -460,6 +461,7 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
         back();
         //accepted=false;// close the app next time when the user press back button
     }
+    //Qt::Key_VolumeDown Qt::Key_VolumeUp
 
 }
 void CLabel::SetTextToLabel(const QString& text)