]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
copyright updated, every buttons is now active the first time and left
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Mon, 1 Jun 2015 21:25:57 +0000 (23:25 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Mon, 1 Jun 2015 21:25:57 +0000 (23:25 +0200)
to the system the second time and css value is now correct.

mainwindow.cpp

index 959920c7ffefd67a0af9d364a0d648a13cdd1814..40456a9f7c22069627c9ebba92b23ede005857b0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, PIOT Gabriel
+// Copyright (c) 2014-2015, PIOT Gabriel
 // All rights reserved.
 
 // Redistribution and use in source and binary forms, with or without modification,
@@ -81,7 +81,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
     menuBar()->setVisible(conf->value(QString("menu")).toBool());
 
     //d.lock();
-    //start();
+    start();
 }
 void MainWindow::start(){
     QString a=conf->value(QString("currenttype"), QString("buttons")).toString();
@@ -175,14 +175,13 @@ int unsigned MainWindow::addWidget(const QString &key, const CLabel *a){
     //if(c==(maxc*maxl)-1)return 1;
 
     //(p-1)*(ml*mc)+c nombre de boutons en tout osef,
-/*    if((c==((maxc*maxl)-1))&&(!np)){
+    if((c==((maxc*maxl)-1))&&(!np)){
         np=1;
         CLabel * next=new CLabel(QString("Next page"), *conf);
         addWidget(QString("nextpage"), next);
-        page++;
         return 1;
     }
-*/
+
     return 0;
 }
 void MainWindow::action(const QString &a){
@@ -278,13 +277,14 @@ void MainWindow::action(const QString &a){
         page--;
         int maxc=conf->value(QString("maxcolumn")).toInt(), maxl=conf->value(QString("maxline")).toInt();
         q->seek(0-(maxc*maxl),1);
+        printItem();
 
     }
     else if(b[0]==QString("nextpage")){
         page++;
         int maxc=conf->value(QString("maxcolumn")).toInt(), maxl=conf->value(QString("maxline")).toInt();
         q->seek(maxc*maxl,1);
-
+        printItem();
     }
     else if(b[0]==QString("setfile")){
         bool ok=0;
@@ -432,9 +432,10 @@ void MainWindow::action(const QString &a){
     }
     else if(b[0]==QString("val")){
         for(int a=0;a<((bs-1)/2); a++){
-            valeur->insert(b[2*a], b[2*a+1]);
-            qDebug()<<"val.size()=="<<valeur->size()<<endl;
+            valeur->insert(b[(2*a)+1], b[(2*a)+2]);
+            if(deb)QMessageBox::information(this, QString("val"), QString("val("+b[(2*a)+1]+")=="+b[(2*a)+2]));
         }
+        if(deb)QMessageBox::information(this, QString("val"), QString("val.size()=="+valeur->size()));
     }
 
     else {
@@ -558,15 +559,15 @@ void MainWindow::firstrun(){
     conf->setValue(QString("maxcolumn"), QVariant(3));
     conf->setValue(QString("maxline"), QVariant(3));
     conf->setValue(QString("SQLsettings"), QVariant("connect_timeout=10000"));
-    conf->setValue(QString("buttons"), QVariant("background-color: red;border-style: outset;border-width: 15px;border-radius: 10px;border-color: beige;font: bold 15px;padding: 6px;"));
+    conf->setValue(QString("buttons"), QVariant("background-color: red;border-style: outset;border-width: 15px;border-radius: 10px;border-color: beige;font-size: 30px;padding: 6px;"));
     conf->setValue(QString("buttonsbefore"), QVariant("background-color: red;"));
     conf->setValue(QString("buttonsafter"), QVariant("background-color: blue;"));
     conf->setValue(QString("menu"), QVariant(1));
     conf->setValue(QString("download"), QVariant("http://www.nothing2do.eu/"+conf->value(QString("filebuttons")).toString()));
     conf->setValue(QString("init"), QVariant("http://www.nothing2do.eu/init"));
-    conf->setValue(QString("userftp"), QVariant("<user>"));
-    conf->setValue(QString("hostftp"), QVariant("<host>"));
-    conf->setValue(QString("passftp"), QVariant("<pass>"));
+    conf->setValue(QString("userftp"), QVariant("<userftp>"));
+    conf->setValue(QString("hostftp"), QVariant("<hostftp>"));
+    conf->setValue(QString("passftp"), QVariant("<passftp>"));
     conf->setValue(QString("start"), QVariant("begin"));
     conf->setValue(QString("restore"), QVariant("http://www.abc.de/db"));
     conf->setValue(QString("db"), QVariant("/data/data/eu.nothing2do.diarymobile/files/db"));
@@ -810,19 +811,21 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
     
     if (k==Qt::Key_Menu){
         action(conf->value(QString("actionmenu")).toString());
-        accepted==false;
+        accepted=false;
         }
     else if(k==Qt::Key_Back){
         action(conf->value(QString("menuback")).toString());
-        accepted==false;
+        accepted=false;
         }
     else if(k==Qt::Key_VolumeDown){
         qDebug()<<"keyvolumdown";
         const QString a=conf->value(QString("volumdown")).toString();
+        accepted=false;
         action(a);
         }
     else if(k==Qt::Key_VolumeUp){
         action(conf->value(QString("volumup")).toString());
+        accepted=false;
         };
 }
 void CLabel::SetTextToLabel(const QString& text)
@@ -905,7 +908,7 @@ void MainWindow::download(const QString & a){//keep downloaded data into m->down
     QUrl url(a);
     m = new FileDownloader(url, this);
 }
-void MainWindow::download(const QString & a, const QString & b){//write downloaded data into "b"
+void MainWindow::download(const QString & a, const QString & b){//write downloaded data from "a" into "b"
     qDebug()<<"download("<<a<<") in "<<b;
     d.lock();
     QUrl url(a);
@@ -1144,12 +1147,12 @@ bool MainWindow::printItem(){
     int actCol = 1;//r.indexOf("action");
     int i=0;
     qDebug()<<"printItem()";
-    /*if(page){
+    if(page){
         addWidget(QString("prevpage"), new CLabel(trUtf8("Prev."), *conf));
-    }*/
+    };
     while(q->next()){
         int tmp=addWidget(q->value(actCol).toString(), new CLabel(q->value(labCol).toString(), *conf));
-        //if(tmp==1)return 1;
+        if(tmp==1)return 1;
         i++;
     };
     //grid->update();