QStringList b=a.split(QString(" "));
QString c=a;
c.remove(0,4);
+ int bs=b.size();
int part=a.count(conf->value(QString("sepcmd")).toString());
if(part){
for(int d=0; d<=part; d++){
}
}
else if(b[0]==QString("set")){
- conf->setValue(b[1], b[2]);
- }
- else if(b[0]==QString("settext")){
+ QString d, e;
bool ok;
- QString e=QInputDialog::getText(this, "setText", b[1], QLineEdit::Normal, conf->value(b[1]).toString(), &ok);
- if(ok)conf->setValue(b[1], e);
+ if(bs==1){
+ d=QInputDialog::getText(this, "set", trUtf8("Variable's name ?", "text to ask value's name before changing it (set)"), QLineEdit::Normal, QString(""), &ok);
+ if(!ok)return;
+ e=QInputDialog::getText(this, "set", d, QLineEdit::Normal, conf->value(d).toString(), &ok);
+ if(!ok)return;
+ }else if(bs==2){
+ d=b[1];
+ e=QInputDialog::getText(this, "set", d, QLineEdit::Normal, conf->value(d).toString(), &ok);
+ if(!ok)return;
+ }else if(bs==3){
+ d=b[1];
+ e=b[2];
+ }else{
+ QMessageBox::critical(this, trUtf8("Error","title if action(\"set\") has too much value"), trUtf8("Too much value in button's action", "text if action(\"set\") has too much value"));
+ return;
+ }
+ QMessageBox::information(this, trUtf8("variable text change", "title to warn about variable content change"), trUtf8(d+" will be changed to "+e, "text to warn about variable content change"));
+ conf->setValue(d, e);
}
else if(b[0]==QString("setint")){
bool ok;
- int e=QInputDialog::getInt(this, "setInt", b[1] , conf->value(QString(b[1])).toInt(), 0, 100, 1, &ok);
- if(ok)conf->setValue(b[1], e);
+ int e;
+ QString d;
+ if(bs==1){
+ d=QInputDialog::getText(this, "setInt", trUtf8("Variable's name ?", "text to ask value's name before changing it (setint)") , QString(""), 0, 100, 1, &ok);
+ if(!ok)return;
+ e=QInputDialog::getInt(this, "setInt", d, QLineEdit::Normal, conf->value(d).toInt(), &ok);
+ if(!ok)return;
+ }else if(bs==2){
+ d=b[1];
+ e=QInputDialog::getInt(this, "setInt", b[1] , conf->value(QString(d)).toInt(), 0, 100, 1, &ok);
+ if(!ok)return;
+ }else if(bs==3){
+ d=b[1];
+ e=b[2].toInt();
+ }else{
+ QMessageBox::critical(this, trUtf8("Error","title if action(\"set\") has too much value"), trUtf8("Too much value in button's action", "text if action(\"set\") has too much value"));
+ return;
+ }
+ QMessageBox::information(this, trUtf8("variable integer change", "title to warn about variable content change"), trUtf8(d+" will be changed to "+e, "text to warn about variable content change"));
+ conf->setValue(d, e);
}
else if(b[0]==QString("start")){
start();
}
else if(b[0]==QString("setfile")){
bool ok=0;
- QString e=QFileDialog::getSaveFileName(this, trUtf8("get file", "title to ask file"), conf->value(b[1]).toString());
- if(ok)conf->setValue(b[1], e);
+ QString d, e;
+ if(bs==1){
+ d=QInputDialog::getText(this, "setInt", trUtf8("Variable's name ?", "text to ask value's name before changing it (setint)") , QString(""), 0, 100, 1, &ok);
+ if(!ok)return;
+ e=QFileDialog::getSaveFileName(this, trUtf8("get file", "title to ask file"), conf->value(d).toString());
+ }else if(bs==2){
+ d=b[1];
+ e=QFileDialog::getSaveFileName(this, trUtf8("get file", "title to ask file"), conf->value(d).toString());
+ }else if(bs==3){
+ d=b[1];
+ e=b[2];
+ }
+ QMessageBox::information(this, trUtf8("variable file change", "title to warn about variable content change"), trUtf8(d+" will be changed to "+e, "text to warn about variable content change"));
+ conf->setValue(d, e);
}
else if(b[0]==QString("box")){
QMessageBox::information(this, trUtf8("box", "box title to show a text"), c);
else if(b[0]==QString("edit")){
QString e;
bool ok;
- if(b.size()<=1){
+ if(bs==1){
e=QInputDialog::getText(this, QString("ID"), trUtf8("Enter ID of button to edit"), QLineEdit::Normal, QString(""), &ok);
- if(ok)editButtonDB(e);
+ if(!ok)return;
}
- else editButtonDB(b[1]);
+ else if(bs==2){
+ e=b[1];
+ }
+ else{
+ QMessageBox::critical(this, trUtf8("Error","title if action(\"edit\") has too much value"), trUtf8("Too much value in button's action", "text if action(\"edit\") has too much value"));
+ return;
+ }
+ editButtonDB(e);
}
else if(b[0]==QString("but")){
way.removeAt(b[1].toInt());
}
else if(b[0]==QString("read")){
- QFile a(b[1]);
- a.open(QIODevice::ReadOnly);
- readData(a.readAll());
+ if(bs==2){
+ QFile a(b[1]);
+ a.open(QIODevice::ReadOnly);
+ readData(a.readAll());
+ }else{
+ QMessageBox::warning(this, trUtf8("Error", "title of box if action(\"read\" hasn't too much value"));
+ }
}
else {
getButtons(a);