ReportDialog::ReportDialog(SceneView *sceneView, QWidget *parent) : QDialog(parent) { logMessage("ReportDialog::ReportDialog()"); m_sceneView = sceneView; setWindowIcon(icon("browser")); setWindowTitle(tr("Report")); setWindowFlags(Qt::Window); createControls(); defaultValues(); setControls(); setMinimumSize(sizeHint()); setMaximumSize(sizeHint()); QSettings settings; restoreGeometry(settings.value("ReportDialog/Geometry", saveGeometry()).toByteArray()); }
CL_Gdh::CL_Gdh() { CL_ObjectWithParams::clear(); defaultValues(); }
void ReportDialog::createControls() { logMessage("ReportDialog::createControls()"); chkDescription = new QCheckBox(tr("Description")); chkProblemInformation = new QCheckBox(tr("Problem information")); chkStartupScript = new QCheckBox(tr("Startup script")); chkPhysicalProperties = new QCheckBox(tr("Physical properties")); chkGeometry = new QCheckBox(tr("Geometry")); connect(chkGeometry, SIGNAL(clicked()), this, SLOT(resetControls())); chkMeshAndSolution = new QCheckBox(tr("Mesh and solution")); connect(chkMeshAndSolution, SIGNAL(clicked()), this, SLOT(resetControls())); chkScript = new QCheckBox(tr("Script")); chkFigureGeometry = new QCheckBox(tr("Geometry")); chkFigureMesh = new QCheckBox(tr("Mesh")); chkFigureOrder = new QCheckBox(tr("Order")); chkFigureScalarView = new QCheckBox(tr("Scalar view")); chkFigureContourView = new QCheckBox(tr("Contour view")); chkFigureVectorView = new QCheckBox(tr("Vector view")); chkShowGrid = new QCheckBox(tr("Show grid")); chkShowRulers = new QCheckBox(tr("Show rulers")); txtTemplate = new QLineEdit(); connect(txtTemplate, SIGNAL(textChanged(QString)), this, SLOT(checkPaths())); txtStyleSheet = new QLineEdit(); connect(txtStyleSheet, SIGNAL(textChanged(QString)), this, SLOT(checkPaths())); txtFigureWidth = new ValueLineEdit(); txtFigureWidth->setValue(Value("600")); txtFigureWidth->setMinimum(200); txtFigureHeight = new ValueLineEdit(); txtFigureHeight->setValue(Value("400")); txtFigureHeight->setMinimum(200); btnDefault = new QPushButton(tr("Default")); connect(btnDefault, SIGNAL(clicked()), this, SLOT(defaultValues())); btnShowReport = new QPushButton(tr("Show report")); connect(btnShowReport, SIGNAL(clicked()), this, SLOT(doShowReport())); btnClose = new QPushButton(tr("Close")); btnClose->setDefault(true); connect(btnClose, SIGNAL(clicked()), this, SLOT(doClose())); QVBoxLayout *layoutSections = new QVBoxLayout(); layoutSections->addWidget(chkDescription); layoutSections->addWidget(chkProblemInformation); layoutSections->addWidget(chkStartupScript); layoutSections->addWidget(chkPhysicalProperties); layoutSections->addWidget(chkGeometry); layoutSections->addWidget(chkMeshAndSolution); layoutSections->addWidget(chkScript); QVBoxLayout *layoutFigures = new QVBoxLayout(); layoutFigures->addWidget(chkFigureGeometry); layoutFigures->addWidget(chkFigureMesh); layoutFigures->addWidget(chkFigureOrder); layoutFigures->addWidget(chkFigureScalarView); layoutFigures->addWidget(chkFigureContourView); layoutFigures->addWidget(chkFigureVectorView); layoutFigures->addWidget(new QLabel()); layoutFigures->addWidget(chkShowGrid); layoutFigures->addWidget(chkShowRulers); QGridLayout *layoutSection = new QGridLayout(); layoutSection->addLayout(layoutSections, 0, 0); QGridLayout *layoutTemplate = new QGridLayout(); layoutTemplate->addWidget(new QLabel(tr("Template")), 0, 0); layoutTemplate->addWidget(txtTemplate, 0, 1); layoutTemplate->addWidget(new QLabel(tr("Style sheet")), 1, 0); layoutTemplate->addWidget(txtStyleSheet, 1, 1); QGridLayout *layoutFigureSize = new QGridLayout(); layoutFigureSize->addWidget(new QLabel(tr("Width")), 0, 0); layoutFigureSize->addWidget(txtFigureWidth, 0, 1); layoutFigureSize->addWidget(new QLabel(tr("Height")), 1, 0); layoutFigureSize->addWidget(txtFigureHeight, 1, 1); layoutFigureSize->setRowStretch(2, 1); QHBoxLayout *layoutFigure = new QHBoxLayout(); layoutFigure->addLayout(layoutFigures); layoutFigure->addLayout(layoutFigureSize); layoutFigure->addStretch(); QHBoxLayout *layoutButtons = new QHBoxLayout(); layoutButtons->addStretch(); layoutButtons->addWidget(btnShowReport); layoutButtons->addWidget(btnDefault); layoutButtons->addWidget(btnClose); QGroupBox *grpBasicProperties = new QGroupBox(tr("Sections")); grpBasicProperties->setLayout(layoutSection); QGroupBox *grpFigure = new QGroupBox(tr("Figures properties")); grpFigure->setLayout(layoutFigure); QGroupBox *grpAdditionalProperties = new QGroupBox(tr("Additional properties")); grpAdditionalProperties->setLayout(layoutTemplate); QGridLayout *layout = new QGridLayout(); layout->addWidget(grpBasicProperties, 0, 0); layout->addWidget(grpFigure, 0, 1); // layout->addWidget(grpAdditionalProperties, 1, 0, 1, 2); layout->addLayout(layoutButtons, 2, 0, 2, 2); setLayout(layout); }
// setup the meta-table for synched variables bool CScriptRMI::BuildSynchTable( SmartScriptTable vars, SmartScriptTable cls, const char * name ) { IScriptSystem * pSS = vars->GetScriptSystem(); SmartScriptTable synched( pSS ); SmartScriptTable defaultValues( pSS ); // TODO: Improve IScriptTable::SUserFunctionDesc fd; fd.pFunctor = functor_ret( SynchedNewIndexFunction ); fd.sFunctionName = "__newindex"; fd.sGlobalName = "<net-dispatch>"; fd.sFunctionParams = "(...)"; synched->AddFunction( fd ); std::vector<SSynchedPropertyInfo> properties; IScriptTable::Iterator iter = vars->BeginIteration(); while (vars->MoveNext(iter)) { if (iter.sKey) { int type; if (!vars->GetValue(iter.sKey, type)) { vars->EndIteration(iter); pSS->RaiseError( "No type for %s", iter.sKey ); return false; } size_t len = strlen(iter.sKey); if (len > MaxSynchedPropertyNameLength) { vars->EndIteration(iter); pSS->RaiseError( "Synched var name '%s' too long (max is %d)", iter.sKey, (int)MaxSynchedPropertyNameLength ); return false; } SSynchedPropertyInfo info; strcpy( info.name, iter.sKey ); info.type = (EScriptSerializeType) type; properties.push_back( info ); if (info.type == eSST_String) defaultValues->SetValue( iter.sKey, "" ); else defaultValues->SetValue( iter.sKey, 0 ); } } vars->EndIteration( iter ); if (properties.empty()) return true; fd.pFunctor = NULL; fd.pUserDataFunc = SerializeFunction; fd.nDataSize = sizeof(SSynchedPropertyInfo) * properties.size(); fd.pDataBuffer = &properties[0]; fd.sFunctionName = SERIALIZE_FUNCTION; fd.sFunctionParams = "(...)"; fd.sGlobalName = "<net-dispatch>"; synched->AddFunction( fd ); cls->SetValue( SERVER_SYNCHED_FIELD, synched ); cls->SetValue( "synched", defaultValues ); return true; }