From aafee49d1024d1299576e3d63d7b284dd96e3612 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Mon, 28 Apr 2014 15:53:13 +0200 Subject: [PATCH] I've added the capacity to not affect way (action begin by '-') --- mainwindow.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 7f7320c..6a91a04 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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,14 +352,17 @@ 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("< tmp({"select label,action from ui where keyword like ? order by id;", b}); + QString c="%"+a+"%"; + QList tmp({"select label,action from ui where keyword like ? order by id;", c}); label->setText(a); exec(tmp); int labCol = 0;//r.indexOf("label"); @@ -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();*/ @@ -402,7 +404,6 @@ void MainWindow::editButtonDB(const QString & a){ exec(QList({"update ui set keyword=?, label=?, action=? where id=?;", keyword, label, action, a})); } - void MainWindow::downloadUi(){ qDebug()<<"updateUi() : "<value(QString("download")).toString(); download(conf->value(QString("download")).toString()); @@ -444,7 +445,6 @@ void MainWindow::RAWsent(){ void MainWindow::back(){ flush(); getButtons(conf->value(QString("menuback")).toString()); - //way.removeLast(); for(int i=0; ivalue(QString("button")).toString())); } @@ -460,6 +460,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) -- 2.45.1