From 2b484bc52584f89ea04b7776293dc79957c0bb97 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Thu, 17 Apr 2014 19:40:40 +0200 Subject: [PATCH] added a "backmenu" setting (and few tweaks) --- README.md | 6 ++---- mainwindow.cpp | 27 ++++++++------------------- ui.sql | 1 + 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 866f389..90c3099 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,8 @@ diary-mobile-android a GUI to use diary-shell on android (or computer, or IOS, or symbian, or whatever Qt works on if you want, it's so Qt !) -the first time you run this, you've only one buttons ("config"), -so click on and on the new page, choose "download". Now you've to write -the full path to get your full button file (don't forget the "http://" -like me the first time).
+The first time this soft is launched, it will ask an URL to download the buttons +(read ui.sql to undertand what is expected).
To upload in real time, you've to set the "upload" to a ftp server where you've an account with syntax : ftp://[user]:[pass]@[hostname]/[filename] diff --git a/mainwindow.cpp b/mainwindow.cpp index 03fbd64..87f97a8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -105,6 +105,7 @@ void MainWindow::showExpanded() void MainWindow::quit(){ qDebug()<<"quit()"; conf->setValue(QString("menu"), menuBar()->isVisible()); + //savButtons(); db.commit(); db.close(); @@ -116,8 +117,8 @@ CLabel* MainWindow::addWidget(const QString &key, const CLabel *a){ int maxc=conf->value(QString("maxcolumn")).toInt(); int maxl=conf->value(QString("maxline")).toInt(); grid->addWidget(a, grid->count()/maxc, grid->count()%maxc, 1, 1, Qt::AlignJustify| Qt::AlignVCenter | Qt::AlignHCenter); - //QObject::connect(a, SIGNAL(pressed()), signalmap, SLOT(map())); - QObject::connect(a, SIGNAL(released()), signalmap, SLOT(map())); + QObject::connect(a, SIGNAL(pressed()), signalmap, SLOT(map())); + //QObject::connect(a, SIGNAL(released()), signalmap, SLOT(map())); signalmap->setMapping(a, key); return a; } @@ -261,6 +262,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;")); conf->setValue(QString("selectraw"), QVariant("select date,texte from raw;")); + conf->setValue(QString("menu"), QVariant("menuback")); } QString &MainWindow::get(int row, int column){ q->seek(row); @@ -301,11 +303,6 @@ void MainWindow::entry(const QString &a){ if(a=="")c=context+" : "+entry; else c=context+", "+a+" : "+entry; //qDebug()<<"c="<value(QString("file"), QVariant("raw")).toString()); - fichier.open(QIODevice::Append | QIODevice::Text); - QTextStream flux(&fichier); - flux << time << " " << c << endl; - fichier.close(); QList d({"INSERT INTO raw (date, texte) VALUES (:date, :txt);", time, c}); exec(d); QSqlError b=q->lastError(); @@ -396,7 +393,7 @@ void MainWindow::sendRAW(){ b<value(1).toString()<<"\n"; } a.close(); - //QMessageBox::information(this, QString("end"), conf->value(QString("file")).toString()); + qDebug()<<"a.open()="<value(QString("uploadRAW")).toString()); @@ -412,17 +409,10 @@ void MainWindow::RAWsent(){ } void MainWindow::back(){ flush(); - if(way.size()-1>0){ - addWidget(QString("quit"), new CLabel(QString("quitter"), conf->value(QString("button")).toString())); - for(int i=0; ivalue(QString("button")).toString())); - } + getButtons(conf->value(QString("menu")).toString()); + for(int i=0; ivalue(QString("button")).toString())); } - else { - getButtons(conf->value(QString("start")).toString()); - //QMessageBox::information(this, QString("Erreur"), QString("Vous êtes déja au départ.")); - } - } void MainWindow::keyReleaseEvent(QKeyEvent *event) { @@ -532,7 +522,6 @@ void MainWindow::savButtons(){ b<value(2).toString()<<"\n"; } a.close(); - QMessageBox::information(this, QString("end"), conf->value(QString("buttonfile"), QVariant("ui.sql")).toString()); qDebug()<<"a.open()="<value(QString("uploadUi")).toString()); net=new QNetworkAccessManager(this); diff --git a/ui.sql b/ui.sql index 1b4a457..bd33e17 100644 --- a/ui.sql +++ b/ui.sql @@ -17,4 +17,5 @@ config$start$settext start config$DB file$settext db config$restore DB$settext restore config$selectraw$settext selectraw +config$menu$settext menu main help$action$box action can be : set #1 #2, settext #1, setint #1, setfile #1, box #, quit, # (getbuttons) -- 2.45.1