int MoodBox::HttpChannel2::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = TransportChannelBase::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: sendPendingRequest(); break; case 1: requestFinished((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break; case 2: handleAndContinue(); break; case 3: dataProcessedProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break; case 4: onAbort(); break; default: ; } _id -= 5; } return _id; }
ToolInstance::ToolInstance(QString filename, ToolInformation information, mcrl2::gui::qt::PersistentFileDialog* fileDialog, QWidget *parent) : QWidget(parent), m_filename(filename), m_info(information), m_fileDialog(fileDialog) { m_ui.setupUi(this); connect(this, SIGNAL(colorChanged(QColor)), this, SLOT(onColorChanged(QColor))); connect(&m_process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(onStateChange(QProcess::ProcessState))); connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(onStandardOutput())); connect(&m_process, SIGNAL(readyReadStandardError()), this, SLOT(onStandardError())); connect(m_ui.btnRun, SIGNAL(clicked()), this, SLOT(onRun())); connect(m_ui.btnAbort, SIGNAL(clicked()), this, SLOT(onAbort())); connect(m_ui.btnSave, SIGNAL(clicked()), this, SLOT(onSave())); connect(m_ui.btnClear, SIGNAL(clicked()), m_ui.edtOutput, SLOT(clear())); QFileInfo fileInfo(filename); m_process.setWorkingDirectory(fileInfo.absoluteDir().absolutePath()); m_ui.lblDirectoryValue->setText(fileInfo.absoluteDir().absolutePath()); m_ui.lblFileValue->setText(fileInfo.fileName()); if (m_info.hasOutput()) { QDir dir = fileInfo.absoluteDir(); QString newfile = fileInfo.baseName().append(".%1").arg(m_info.output); int filenr = 0; while(dir.exists(newfile)) { filenr++; newfile = fileInfo.baseName().append("_%1.%2").arg(filenr).arg(m_info.output); } m_pckFileOut = new FilePicker(m_fileDialog, m_ui.pckFileOut); m_ui.pckFileOut->layout()->addWidget(m_pckFileOut); m_pckFileOut->setText(newfile); } else { m_pckFileOut = NULL; m_ui.lblFileOut->setVisible(false); m_ui.pckFileOut->setVisible(false); } if (m_info.hasSecondInput()) { m_pckFileIn = new FilePicker(m_fileDialog, m_ui.pckFileIn, false); m_ui.pckFileIn->layout()->addWidget(m_pckFileIn); } else { m_pckFileIn = NULL; m_ui.lblFileIn->setVisible(false); m_ui.pckFileIn->setVisible(false); } QFormLayout *formLayout = new QFormLayout(); formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); for (int i = 0; i < m_info.options.count(); i++) { ToolOption option = m_info.options.at(i); QWidget *nameOpt = NULL; QCheckBox* cbOpt = NULL; QVBoxLayout *lytOpt = new QVBoxLayout(); if (option.argument.type == EnumArgument) { nameOpt = new QLabel("<b>"+option.nameLong+": </b>"); } else { cbOpt = new QCheckBox(option.nameLong + ": ", this); cbOpt->setChecked(option.standard); QFont font(cbOpt->font()); font.setBold(true); cbOpt->setFont(font); nameOpt = cbOpt; } formLayout->addRow(nameOpt, lytOpt); QLabel *lblOpt = new QLabel(option.description, this); lblOpt->setAlignment(Qt::AlignJustify | Qt::AlignTop); lblOpt->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); lblOpt->setWordWrap(true); lytOpt->addWidget(lblOpt); if (!option.hasArgument()) { m_optionValues.append(new OptionValue(option, cbOpt)); } else { switch (option.argument.type) { case StringArgument: case LevelArgument: case IntegerArgument: case RealArgument: case BooleanArgument: { QHBoxLayout *lytArg = new QHBoxLayout(); lytArg->setSpacing(6); QWidget *edtArg = NULL; switch (option.argument.type) { case LevelArgument: { QLineEdit *edtLdt = new QLineEdit("verbose", this); m_optionValues.append(new OptionValue(option, cbOpt, edtLdt)); edtArg = edtLdt; } break; case IntegerArgument: { QSpinBox *edtSpb = new QSpinBox(this); edtSpb->setRange(std::numeric_limits<int>::min(), std::numeric_limits<int>::max()); if (option.argument.optional) { QCheckBox *cbOptional = new QCheckBox(this); lytArg->addWidget(cbOptional); m_optionValues.append(new OptionValue(option, cbOpt, edtSpb, cbOptional)); } else { m_optionValues.append(new OptionValue(option, cbOpt, edtSpb)); } edtArg = edtSpb; } break; case RealArgument: { QDoubleSpinBox *edtSpb = new QDoubleSpinBox(this); edtSpb->setRange(std::numeric_limits<double>::min(), std::numeric_limits<double>::max()); if (option.argument.optional) { QCheckBox *cbOptional = new QCheckBox(this); lytArg->addWidget(cbOptional); m_optionValues.append(new OptionValue(option, cbOpt, edtSpb, cbOptional)); } else { m_optionValues.append(new OptionValue(option, cbOpt, edtSpb)); } edtArg = edtSpb; } break; case BooleanArgument: { QCheckBox *edtChb = new QCheckBox("Yes", this); m_optionValues.append(new OptionValue(option, cbOpt, edtChb)); edtArg = edtChb; } break; case StringArgument: default: { QLineEdit *edtLdt = new QLineEdit(this); m_optionValues.append(new OptionValue(option, cbOpt, edtLdt)); edtArg = edtLdt; } break; } edtArg->setMinimumWidth(300); lytArg->addWidget(edtArg); if (!option.argument.optional && option.argument.type != BooleanArgument) { QLabel *lblReq = new QLabel("*", this); lytArg->addWidget(lblReq); } QSpacerItem *spacer = new QSpacerItem(100, 20, QSizePolicy::Expanding); lytArg->addItem(spacer); lytOpt->addLayout(lytArg); } break; case FileArgument: { QHBoxLayout *lytArg = new QHBoxLayout(); lytArg->setSpacing(6); FilePicker *edtArg = new FilePicker(m_fileDialog, this, false); lytArg->addWidget(edtArg); m_optionValues.append(new OptionValue(option, cbOpt, edtArg)); if (!option.argument.optional) { QLabel *lblReq = new QLabel("*", this); lytArg->addWidget(lblReq); } QSpacerItem *spacer = new QSpacerItem(100, 20, QSizePolicy::Expanding); lytArg->addItem(spacer); lytOpt->addLayout(lytArg); } break; case EnumArgument: { QFormLayout *lytValues = new QFormLayout(); lytValues->setSpacing(6); QButtonGroup *grpValues = new QButtonGroup(this); for (int j = 0; j < option.argument.values.count(); j++) { ToolValue val = option.argument.values.at(j); QRadioButton *rbVal = new QRadioButton(val.nameLong, this); rbVal->setChecked(val.standard); grpValues->addButton(rbVal); QLabel *lblVal = new QLabel(val.description, this); lblVal->setWordWrap(true); lytValues->addRow(rbVal, lblVal); } m_optionValues.append(new OptionValue(option, cbOpt, grpValues)); lytOpt->addLayout(lytValues); } break; default: break; } } } m_ui.scrollWidget->setLayout(formLayout); }
DialogMenu::DialogMenu(QWidget *parent) : QDialog(parent), ui(new Ui::DialogMenu) { ui->setupUi(this); // *** -= КИРИЛИЗАЦИЯ !!! =- *** QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); //без курсор this->setCursor(QCursor(Qt::BlankCursor)); //connect buttons handlers connect(ui->btnMenuExit,SIGNAL(clicked()),this,SLOT(exitMenu())); connect(ui->btnSetDateTime,SIGNAL(clicked()),this,SLOT(setDateTime())); connect(ui->btnLoadRecipies,SIGNAL(clicked()),this,SLOT(loadRecipies())); connect(ui->btnSaveRecepies,SIGNAL(clicked()),this,SLOT(saveRecepies())); connect(ui->btnAbort,SIGNAL(clicked()),this,SLOT(onAbort())); connect(ui->btnReport,SIGNAL(clicked()),this,SLOT(Report())); connect(ui->btnHumiditySandUp,SIGNAL(clicked()),this,SLOT(onHumiditySandUp())); connect(ui->btnHumiditySandDwn,SIGNAL(clicked()),this,SLOT(onHumiditySandDown())); connect(ui->btnHumidityFractionUp,SIGNAL(clicked()),this,SLOT(onHumidityFractionUp())); connect(ui->btnHumidityFractionDwn,SIGNAL(clicked()),this,SLOT(onHumidityFractionDown())); connect(ui->btnDumpTimeUp,SIGNAL(clicked()),this,SLOT(onDumpTimeUp())); connect(ui->btnDumpTimeDwn,SIGNAL(clicked()),this,SLOT(onDumpTimeDown())); connect(ui->btnAdvCementUp,SIGNAL(clicked()),this,SLOT(onCementAdvUp())); connect(ui->btnAdvCementDwn,SIGNAL(clicked()),this,SLOT(onCementAdvDwn())); connect(ui->btnAdvFractUp,SIGNAL(clicked()),this,SLOT(onFractAdvUp())); connect(ui->btnAdvFracDwn,SIGNAL(clicked()),this,SLOT(onFractAdvDwn())); connect(ui->btnAdvSandUp,SIGNAL(clicked()),this,SLOT(onSandAdvUp())); connect(ui->btnAdvSandDwn,SIGNAL(clicked()),this,SLOT(onSandAdvDwn())); connect(ui->btnAdvPepelUp,SIGNAL(clicked()),this,SLOT(onPepelAdvUp())); connect(ui->btnAdvPepelDwn,SIGNAL(clicked()),this,SLOT(onPepelAdvDwn())); //Date/Time update connect(&clockTimer,SIGNAL(timeout()),this,SLOT(clockTick())); clockTimer.start(1000); ui->lineHumidityFraction->setText(QString("%1").arg(globals.HumidityFraction)); ui->lineHumiditySand->setText(QString("%1").arg(globals.HumiditySand)); ui->lineDumpTime->setText(QString("%1").arg(globals.DumpTime)); ui->lineAdvCement->setText(QString::number(globals.AdvScaleCement,'f',0)); ui->lineAdvFraction->setText(QString::number(globals.AdvScaleFraction,'f',0)); ui->lineAdvPepel->setText(QString::number(globals.AdvScalePepelina,'f',0)); ui->lineAdvSand->setText(QString::number(globals.AdvScaleSand,'f',0)); humidityChanged=false; //В зависимост от текущото състояние някои корекции могат да бъдат забранени. switch(states.State) { case Idle: //в това състояние всички бутони за достъпни освен ПРЕКРАТИ ЗАЯВКА ui->btnHumidityFractionDwn->setEnabled(true); ui->btnHumidityFractionUp->setEnabled(true); ui->lineHumidityFraction->setEnabled(true); ui->btnHumiditySandUp->setEnabled(true); ui->btnHumiditySandDwn->setEnabled(true); ui->lineHumiditySand->setEnabled(true); ui->btnDumpTimeUp->setEnabled(true); ui->btnDumpTimeDwn->setEnabled(true); ui->lineDumpTime->setEnabled(true); ui->btnAbort->setEnabled(false); ui->btnLoadRecipies->setEnabled(true); ui->btnSaveRecepies->setEnabled(true); ui->btnSetDateTime->setEnabled(true); ui->btnAdvCementUp->setEnabled(true); ui->btnAdvCementDwn->setEnabled(true); ui->lineAdvCement->setEnabled(true); ui->btnAdvFractUp->setEnabled(true); ui->btnAdvFracDwn->setEnabled(true); ui->lineAdvFraction->setEnabled(true); ui->btnAdvPepelUp->setEnabled(true); ui->btnAdvPepelDwn->setEnabled(true); ui->lineAdvPepel->setEnabled(true); ui->btnAdvSandUp->setEnabled(true); ui->btnAdvSandDwn->setEnabled(true); ui->lineAdvSand->setEnabled(true); break; case Fail: case Start: case Run: case Abort: case PowerDown: ui->btnHumidityFractionDwn->setEnabled(false); ui->btnHumidityFractionUp->setEnabled(false); ui->lineHumidityFraction->setEnabled(false); ui->btnHumiditySandUp->setEnabled(false); ui->btnHumiditySandDwn->setEnabled(false); ui->lineHumiditySand->setEnabled(false); ui->btnDumpTimeUp->setEnabled(false); ui->btnDumpTimeDwn->setEnabled(false); ui->lineDumpTime->setEnabled(false); ui->btnAbort->setEnabled(false); ui->btnLoadRecipies->setEnabled(false); ui->btnSaveRecepies->setEnabled(false); ui->btnSetDateTime->setEnabled(false); ui->btnAdvCementUp->setEnabled(false); ui->btnAdvCementDwn->setEnabled(false); ui->lineAdvCement->setEnabled(false); ui->btnAdvFractUp->setEnabled(false); ui->btnAdvFracDwn->setEnabled(false); ui->lineAdvFraction->setEnabled(false); ui->btnAdvPepelUp->setEnabled(false); ui->btnAdvPepelDwn->setEnabled(false); ui->lineAdvPepel->setEnabled(false); ui->btnAdvSandUp->setEnabled(false); ui->btnAdvSandDwn->setEnabled(false); ui->lineAdvSand->setEnabled(false); break; case Paused: ui->btnHumidityFractionDwn->setEnabled(false); ui->btnHumidityFractionUp->setEnabled(false); ui->lineHumidityFraction->setEnabled(false); ui->btnHumiditySandUp->setEnabled(false); ui->btnHumiditySandDwn->setEnabled(false); ui->lineHumiditySand->setEnabled(false); ui->btnDumpTimeUp->setEnabled(false); ui->btnDumpTimeDwn->setEnabled(false); ui->lineDumpTime->setEnabled(false); ui->btnAbort->setEnabled(true); ui->btnLoadRecipies->setEnabled(false); ui->btnSaveRecepies->setEnabled(false); ui->btnSetDateTime->setEnabled(false); ui->btnAdvCementUp->setEnabled(false); ui->btnAdvCementDwn->setEnabled(false); ui->lineAdvCement->setEnabled(false); ui->btnAdvFractUp->setEnabled(false); ui->btnAdvFracDwn->setEnabled(false); ui->lineAdvFraction->setEnabled(false); ui->btnAdvPepelUp->setEnabled(false); ui->btnAdvPepelDwn->setEnabled(false); ui->lineAdvPepel->setEnabled(false); ui->btnAdvSandUp->setEnabled(false); ui->btnAdvSandDwn->setEnabled(false); ui->lineAdvSand->setEnabled(false); break; } }