conf->setValue(QString("first"), 1);
};
+ deb=0;
screen=new QWidget(this);
screen->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
grid=new QGridLayout(screen);
}
void MainWindow::action(const QString &a){
qDebug()<<"action("<<a<<")";
+ if(deb)QMessageBox::information(this, trUtf8("action", "box title to debug action"), a);
QStringList b=a.split(QString(" "));
QString c=a;
bool ok;
sav(c);
}
else if(b[0]==QString("back")){
- if(way.size()>1){
+ if(way.size()>=1){
int e;
if(bs>1)e=b[2].toInt(&ok);
else e=1;
for(int bcl=0;bcl<e;bcl++){
way.removeLast();
}
- get(QString("buttons"), way.takeLast());
+ }else{
+ return;
}
+ get(QString("buttons"), way.takeLast());
}
else if(b[0]==QString("setfile")){
bool ok=0;
}
}
else if(b[0]==QString("mass")){
- if(bs==4){
- int tmp=b[1].toInt();
- mass(tmp, b[2], b[3]);
+ if(bs==5){
+ mass(b[1], b[2], b[3], b[4]);
}
}
+ else if(b[0]==QString("debug")){
+ debug();
+ }
else {
get(QString("buttons"),a);
}
}
-void MainWindow::debug(int col){
+/*void MainWindow::debug(int col){
q->first();
while(q->isValid()){
int k=q->at();
qDebug()<<"n°"<<k<<"="<<get(col);
q->next();
}
-}
+}*/
void MainWindow::connectDB(){
db = QSqlDatabase::addDatabase("QSQLITE");
//db = QSqlDatabase::addDatabase("QPSQL");
conf->setValue(QString("maxcolumn"), QVariant(2));
conf->setValue(QString("maxline"), QVariant(3));
conf->setValue(QString("SQLsettings"), QVariant("connect_timeout=10000"));
- conf->setValue(QString("button"), QVariant("background-color: red;border-style: outset;border-width: 7px;border-radius: 10px;border-color: beige;font: bold 15px;padding: 6px;"));
+ conf->setValue(QString("button"), QVariant("background-color: res;border-style: outset;border-width: 7px;border-radius: 10px;border-color: beige;font: bold 15px;padding: 6px;"));
conf->setValue(QString("buttonbefore"), QVariant("border-style: outset"));
conf->setValue(QString("buttonafter"), QVariant("border-style: inset"));
conf->setValue(QString("menu"), QVariant(0));
key=key+" "+cur;
}
qDebug()<<"key="<<key<<" keyword="<<keyword;
- if((key==QString(" ").repeated(key.size()))||(key==keyword))exec(QList<QString>({conf->value(QString("delete")+a).toString(), id}));
+ key.replace(keyword, QString(""));
+ if(key==QString(" ").repeated(key.size()))exec(QList<QString>({conf->value(QString("delete")+a).toString(), id}));
else{
- key.replace(keyword, QString(""));
exec(QList<QString>({conf->value(QString("updatebuttons")).toString(), key, label, action, id}));
}
}
QString cmd=QInputDialog::getText(this, trUtf8("action", "Title of box where ask for a custom action"), trUtf8("Enter your action", "Label of box where ask for custom action"), QLineEdit::Normal, QString(""), &ok);
if(ok)action(cmd);
}
-void MainWindow::mass(int c, const QString & a, const QString & b){
- exec(QList<QString>({conf->value(QString("changekeyword")).toString(), a}));
+void MainWindow::mass(const QString & type, const QString & column, const QString & before, const QString & after){
+ exec(QList<QString>({conf->value(QString("change")+type).toString(), column}));
QString key;
while(q->next()){
- key=get(c);
- if(key.contains(a)){
- key.replace(a,b);
- QList<QString> tmp({conf->value(QString("updatebuttons")).toString()});
- for(int t=0;t<4;t++){//4 is conf("changekey") column
- if(t==c)tmp.append(key);
+ int n=q->record().indexOf(column);
+ key=get(n);
+ if(key.contains(before)){
+ key.replace(before, after);
+ QList<QString> tmp({conf->value(QString("update")+type).toString()});
+ for(int t=0;t<q->record().count();t++){
+ if(t==n)tmp.append(key);
else tmp.append(get(t));
}
exec2(tmp);
}
}
- get(QString("buttons"), lastprint);
+ get(type, lastprint);
}
void MainWindow::addDB(){
addDB(QString("buttons"));
}
emit datafilled();
}
+void MainWindow::debug(){
+ //deb=-deb;
+ if(deb)deb=0;
+ else deb=1;
+}