From 8790eb520e308fd59a7bf3827e47b225cc0bbeeb Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Wed, 21 May 2014 15:26:29 +0200 Subject: [PATCH] remove useless QFile and little tweak --- README.md | 6 +++--- mainwindow.cpp | 20 ++++++++------------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index fcf7f3a..5ab6559 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -diary-mobile-android +diary-mobile ==================== 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 this soft is launched, it will ask an URL to download the buttons -(read ui.sql to undertand what is expected).
+(read ui.sql to understand 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] todo : -add autoupdate feature, and ... +add autoupdate feature, buttons in action, and ... diff --git a/mainwindow.cpp b/mainwindow.cpp index 1fb0671..e08c376 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -148,13 +148,13 @@ void MainWindow::quit(){ } const CLabel* MainWindow::addWidget(const QString &key, const CLabel *a){ qDebug()<<"addWidget("<value(QString("maxcolumn")).toInt(); - int maxl=conf->value(QString("maxline")).toInt(); int c=grid->count(); + int maxc=conf->value(QString("maxcolumn")).toInt(); + /*int maxl=conf->value(QString("maxline")).toInt(); if(c>=maxc*maxl){ QMessageBox::information(this, QString("lourd !"), QString("il y a trop de boutons sur cette page")); return 0; - } + }*/ grid->addWidget(a, c/maxc, c%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())); @@ -353,7 +353,7 @@ void MainWindow::firstrun(){ conf->setValue(QString("updatebuttons"), QVariant("update ui set keyword=?, label=?, action=? where id=?;")); conf->setValue(QString("deletebuttons"), QVariant("delete from ui where id=?")); conf->setValue(QString("testbuttons"), QVariant("select id,keyword from ui where label=? and action=?;")); - conf->setValue(QString("volumdown"), QVariant("config")); + conf->setValue(QString("volumdown"), QVariant("back")); conf->setValue(QString("volumup"), QVariant("begin")); qDebug()<<"firstrun() finished"; } @@ -393,7 +393,7 @@ void MainWindow::entry(const QString &a){ if(a=="")c=context+" : "+entry; else c=context+", "+a+" : "+entry; QList d({"INSERT INTO raw (date, texte) VALUES (:date, :txt);", time, c}); - if(!exec(d))qDebug()<<"exec don't works (l370)"; + if(!exec(d))qDebug()<<"exec don't works (entry(QString))"; QSqlError b=q->lastError(); if (b.isValid())qDebug()<<"q->lastError():"< ({conf->value(QString("selectbuttons")).toString()})); - QFile a(conf->value(QString("buttonfile"), QVariant("ui.sql")).toString()); - a.open(QIODevice::WriteOnly|QIODevice::Text); - QTextStream b(&a); - b<value("firstline", "INSERT INTO ui (keyword, label, action) VALUES(?, ?, ?);").toString()<<"\n"; + QTextStream b; + b<value("firstline").toString()<<"\n"; while (q->next()) { for (int i=0; i<2; i++){ b<value(i).toString()<<"$"; } b<value(2).toString()<<"\n"; } - a.close(); - qDebug()<<"a.open()="<value(QString("uploadUi")).toString()); net=new QNetworkAccessManager(this); - rep=net->put(QNetworkRequest(upload), a.readAll()); + rep=net->put(QNetworkRequest(upload), b.device()); qDebug()<<"net->put : "<