void ConfigComputerDialog::createControls() { lstView = new QListWidget(this); pages = new QStackedWidget(this); panMain = createMainWidget(); panSolver = createSolverWidget(); // List View lstView->setCurrentRow(0); lstView->setViewMode(QListView::IconMode); lstView->setResizeMode(QListView::Adjust); lstView->setMovement(QListView::Static); lstView->setFlow(QListView::TopToBottom); lstView->setIconSize(QSize(60, 60)); lstView->setMinimumWidth(135); lstView->setMaximumWidth(135); lstView->setMinimumHeight((45+fontMetrics().height()*4)*5); connect(lstView, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(doCurrentItemChanged(QListWidgetItem *, QListWidgetItem *))); QSize sizeItem(131, 85); // listView items QListWidgetItem *itemMain = new QListWidgetItem(icon("options-main"), tr("Main"), lstView); itemMain->setTextAlignment(Qt::AlignHCenter); itemMain->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); itemMain->setSizeHint(sizeItem); QListWidgetItem *itemSolver = new QListWidgetItem(icon("options-solver"), tr("Solver"), lstView); itemSolver->setTextAlignment(Qt::AlignHCenter); itemSolver->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); itemSolver->setSizeHint(sizeItem); pages->addWidget(panMain); pages->addWidget(panSolver); QHBoxLayout *layoutHorizontal = new QHBoxLayout(); layoutHorizontal->addWidget(lstView); layoutHorizontal->addWidget(pages); // dialog buttons QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(doAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(doReject())); QVBoxLayout *layout = new QVBoxLayout(); layout->addLayout(layoutHorizontal); // layout->addStretch(); layout->addWidget(buttonBox); setLayout(layout); }
ccDisplayOptionsDlg::ccDisplayOptionsDlg(QWidget* parent) : QDialog(parent, Qt::Tool) , Ui::DisplayOptionsDlg() { setupUi(this); connect(ambientColorButton, SIGNAL(clicked()), this, SLOT(changeLightAmbientColor())); connect(diffuseColorButton, SIGNAL(clicked()), this, SLOT(changeLightDiffuseColor())); connect(specularColorButton, SIGNAL(clicked()), this, SLOT(changeLightSpecularColor())); connect(meshBackColorButton, SIGNAL(clicked()), this, SLOT(changeMeshBackDiffuseColor())); connect(meshSpecularColorButton, SIGNAL(clicked()), this, SLOT(changeMeshSpecularColor())); connect(meshFrontColorButton, SIGNAL(clicked()), this, SLOT(changeMeshFrontDiffuseColor())); connect(bbColorButton, SIGNAL(clicked()), this, SLOT(changeBBColor())); connect(bkgColorButton, SIGNAL(clicked()), this, SLOT(changeBackgroundColor())); connect(labelBkgColorButton, SIGNAL(clicked()), this, SLOT(changeLabelBackgroundColor())); connect(labelMarkerColorButton, SIGNAL(clicked()), this, SLOT(changeLabelMarkerColor())); connect(enableGradientCheckBox, SIGNAL(clicked()), this, SLOT(changeBackgroundGradient())); connect(pointsColorButton, SIGNAL(clicked()), this, SLOT(changePointsColor())); connect(textColorButton, SIGNAL(clicked()), this, SLOT(changeTextColor())); connect(decimateMeshBox, SIGNAL(clicked()), this, SLOT(changeMeshDecimation())); connect(decimateCloudBox, SIGNAL(clicked()), this, SLOT(changeCloudDecimation())); connect(useVBOCheckBox, SIGNAL(clicked()), this, SLOT(changeVBOUsage())); connect(showCrossCheckBox, SIGNAL(clicked()), this, SLOT(changeCrossDisplayed())); connect(colorScaleShowHistogramCheckBox, SIGNAL(clicked()), this, SLOT(changeColorScaleShowHistogram())); connect(useColorScaleShaderCheckBox, SIGNAL(clicked()), this, SLOT(changeColorScaleUseShader())); connect(colorRampWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeColorScaleRampWidth(int))); connect(defaultFontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeDefaultFontSize(int))); connect(labelFontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeLabelFontSize(int))); connect(numberPrecisionSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeNumberPrecision(int))); connect(labelOpacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeLabelOpacity(int))); connect(labelMarkerSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeLabelMarkerSize(int))); connect(zoomSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeZoomSpeed(double))); connect(maxCloudSizeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeMaxCloudSize(double))); connect(maxMeshSizeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeMaxMeshSize(double))); connect(autoComputeOctreeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeAutoComputeOctreeOption(int))); connect(okButton, SIGNAL(clicked()), this, SLOT(doAccept())); connect(applyButton, SIGNAL(clicked()), this, SLOT(apply())); connect(resetButton, SIGNAL(clicked()), this, SLOT(reset())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(doReject())); oldParameters = parameters = ccGui::Parameters(); refresh(); setUpdatesEnabled(true); }
void DSceneBasic::createControls() { logMessage("DSceneBasic::createControls()"); // dialog buttons buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(doAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(doReject())); layout->addLayout(createContent()); layout->addStretch(); layout->addWidget(buttonBox); setLayout(layout); }
void ProblemDialog::createControls() { logMessage("ProblemDialog::createControls()"); // tab QTabWidget *tabType = new QTabWidget(); tabType->addTab(createControlsGeneral(), icon(""), tr("General")); tabType->addTab(createControlsStartupScript(), icon(""), tr("Startup script")); tabType->addTab(createControlsDescription(), icon(""), tr("Description")); // dialog buttons QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(doAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(doReject())); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(tabType); layout->addStretch(); layout->addWidget(buttonBox); setLayout(layout); }
void SceneBasicSelectDialog::createControls() { logMessage("SceneBasicSelectDialog::createControls()"); // edge lstEdges = new QListWidget(this); for (int i = 1; i < Util::scene()->edges.count(); i++) { QListWidgetItem *item = new QListWidgetItem(lstEdges); item->setText(QString::number(i)); // Util::scene()->edges[i]-> if (Util::scene()->edges[i]->isSelected) item->setCheckState(Qt::Checked); else item->setCheckState(Qt::Unchecked); lstEdges->addItem(item); } connect(lstEdges, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(currentItemChanged(QListWidgetItem *, QListWidgetItem *))); QGridLayout *layoutSurface = new QGridLayout(); layoutSurface->addWidget(lstEdges); widEdge = new QWidget(); widEdge->setLayout(layoutSurface); // dialog buttons QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(doAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(doReject())); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(widEdge, 1); layout->addStretch(); layout->addWidget(buttonBox); setLayout(layout); }
void DSceneFunction::createControls() { logMessage("DSceneFunction::createControls()"); // chart chart = new Chart(this); // axis labels QwtText text(""); text.setFont(QFont("Helvetica", 10, QFont::Normal)); text.setText("x"); chart->setAxisTitle(QwtPlot::xBottom, text); text.setText("y"); chart->setAxisTitle(QwtPlot::yLeft, text); // name txtName = new QLineEdit(""); txtFunction = new QLineEdit(); // interval txtStart = new ValueLineEdit(); txtStart->setMaximumWidth(100); connect(txtStart, SIGNAL(editingFinished()), this, SLOT(doPlot())); txtEnd = new ValueLineEdit(); txtEnd->setMaximumWidth(100); connect(txtEnd, SIGNAL(editingFinished()), this, SLOT(doPlot())); lblError = new QLabel(); lblError->setVisible(false); QPushButton *btnPlot = new QPushButton(this); btnPlot->setText(tr("Plot")); connect(btnPlot, SIGNAL(clicked()), this, SLOT(doPlot())); QPushButton *btnSaveImage = new QPushButton(this); btnSaveImage->setText(tr("Save image")); connect(btnSaveImage, SIGNAL(clicked()), SLOT(doSaveImage())); QGridLayout *controlsLayout = new QGridLayout(); controlsLayout->addWidget(new QLabel(tr("Start:")), 0, 0); controlsLayout->addWidget(txtStart, 0, 1); controlsLayout->addWidget(new QLabel(tr("End:")), 1, 0); controlsLayout->addWidget(txtEnd, 1, 1); controlsLayout->addWidget(new QLabel(tr("Name:")), 0, 2); controlsLayout->addWidget(txtName, 0, 3); controlsLayout->addWidget(new QLabel(tr("Function:")), 1, 2); controlsLayout->addWidget(txtFunction, 1, 3); controlsLayout->addWidget(lblError, 0, 4, 2, 1); controlsLayout->addWidget(btnPlot, 0, 5); controlsLayout->addWidget(btnSaveImage, 1, 5); // dialog buttons QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(doAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(doReject())); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(chart); layout->addLayout(controlsLayout); layout->addWidget(buttonBox); setLayout(layout); }
UnitTestsWidget::UnitTestsWidget(QWidget *parent) : QDialog(parent), m_test(XMLTest::tests()), m_isAborted(false) { setWindowTitle(tr("Unit tests")); setModal(true); webView = new QWebView(); webView->page()->setNetworkAccessManager(new QNetworkAccessManager()); webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); webView->setMinimumSize(200, 200); logWidget = new LogWidget(this); logWidget->setMemoryLabelVisible(false); trvTests = new QTreeWidget(this); trvTests->setMouseTracking(true); trvTests->setColumnCount(1); trvTests->setIndentation(15); trvTests->setIconSize(QSize(24, 24)); trvTests->setHeaderHidden(true); trvTests->setMinimumWidth(360); trvTests->setContextMenuPolicy(Qt::CustomContextMenu); connect(trvTests, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(doContextMenu(const QPoint &))); // connect(trvTests, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(doItemDoubleClicked(QTreeWidgetItem *, int))); // connect(trvTests, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(doItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))); btnRunTests = new QPushButton(tr("Run tests")); connect(btnRunTests, SIGNAL(clicked()), this, SLOT(runTestsFromSuite())); // dialog buttons btnScenarios = new QPushButton(tr("Scenarios...")); btnUncheckTests = new QPushButton(tr("Uncheck tests")); connect(btnUncheckTests, SIGNAL(clicked()), this, SLOT(uncheckTests())); btnStopTest = new QPushButton(tr("Stop")); btnStopTest->setEnabled(false); connect(btnStopTest, SIGNAL(clicked()), this, SLOT(stopTest())); QGridLayout *leftLayout = new QGridLayout(); leftLayout->setContentsMargins(0, 0, 0, 0); leftLayout->addWidget(trvTests, 0, 0, 1, 5); leftLayout->addWidget(btnScenarios, 1, 0); leftLayout->addWidget(btnUncheckTests, 1, 1); leftLayout->setColumnStretch(2, 1); leftLayout->addWidget(btnStopTest, 1, 3); leftLayout->addWidget(btnRunTests, 1, 4); QWidget *leftWidget = new QWidget(); leftWidget->setLayout(leftLayout); QVBoxLayout *rightLayout = new QVBoxLayout(); rightLayout->addWidget(webView, 3); rightLayout->addWidget(logWidget, 1); QWidget *rightWidget = new QWidget(); rightWidget->setLayout(rightLayout); splitter = new QSplitter(this); splitter->setOrientation(Qt::Horizontal); splitter->addWidget(leftWidget); splitter->addWidget(rightWidget); buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(doAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(doReject())); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(splitter, 1); layout->addStretch(); layout->addWidget(buttonBox); setLayout(layout); QSettings settings; splitter->restoreState(settings.value("UnitTestsWidget/SplitterState").toByteArray()); splitter->restoreGeometry(settings.value("UnitTestsWidget/SplitterGeometry").toByteArray()); restoreGeometry(settings.value("UnitTestsWidget/Geometry", saveGeometry()).toByteArray()); // init ctemplate // stylesheet std::string style; ctemplate::TemplateDictionary stylesheet("style"); stylesheet.SetValue("FONTFAMILY", htmlFontFamily().toStdString()); stylesheet.SetValue("FONTSIZE", (QString("%1").arg(htmlFontSize() + 1).toStdString())); ctemplate::ExpandTemplate(compatibleFilename(datadir() + TEMPLATEROOT + "/panels/style_results.css").toStdString(), ctemplate::DO_NOT_STRIP, &stylesheet, &style); m_cascadeStyleSheet = QString::fromStdString(style); // read tests from test_suite readTestsFromSuite(); readScenariosFromSuite(); // read last test QDir dirUser(QString("%1/tests").arg(userDataDir())); if (!dirUser.exists()) QDir(userDataDir()).mkpath(dirUser.absolutePath()); dirUser.setFilter(QDir::Files | QDir::NoSymLinks); if (!dirUser.entryInfoList().isEmpty()) { QString file = QString("%1").arg(dirUser.entryInfoList().last().absoluteFilePath()); readTestFromDisk(file); } }
/** * Обработка входящей станзы и вызов соответствующих методов */ bool GameSessions::processIncomingIqStanza(int account, const QDomElement &xml, const QString &acc_status, bool conf_priv) { const QString iq_type = xml.attribute("type"); if(iq_type == "set") { QDomElement childElem = xml.firstChildElement("create"); if(!childElem.isNull() && childElem.attribute("xmlns") == "games:board" && childElem.attribute("type") == constProtoType) { const QString from = xml.attribute("from"); const QString id = xml.attribute("id"); const QString protoId = childElem.attribute("id"); if (protoId != constProtoId) { sendErrorIq(account, from, id, "Incorrect protocol version"); return true; } Options *options = Options::instance(); if ((options->getOption(constDndDisable).toBool() && acc_status == "dnd") || (options->getOption(constConfDisable).toBool() && conf_priv)) { sendErrorIq(account, from, id, ""); return true; } if (incomingInvitation(account, from, childElem.attribute("color"), id)) { emit doInviteEvent(account, from, tr("%1: Invitation from %2").arg(constPluginName).arg(from), this, SLOT(showInvitation(QString))); } return true; } if (activeCount() == 0) // Нет ни одной активной игровой сессии (наиболее вероятный исход большую часть времени) return false; // Остальные проверки бессмысленны childElem = xml.firstChildElement("turn"); if (!childElem.isNull() && childElem.attribute("xmlns") == "games:board" && childElem.attribute("type") == constProtoType) { const QString from = xml.attribute("from"); const QString id = xml.attribute("id"); const QString protoId = childElem.attribute("id"); if (protoId != constProtoId) { sendErrorIq(account, from, id, "Incorrect protocol version"); return true; } QDomElement turnChildElem = childElem.firstChildElement("move"); if (!turnChildElem.isNull()) { return doTurnAction(account, from, id, turnChildElem.attribute("pos")); } turnChildElem = childElem.firstChildElement("resign"); if (!turnChildElem.isNull()) { return youWin(account, from, id); } turnChildElem = childElem.firstChildElement("draw"); if (!turnChildElem.isNull()) { return setDraw(account, from, id); } return false; } childElem = xml.firstChildElement("close"); if (!childElem.isNull() && childElem.attribute("xmlns") == "games:board" && childElem.attribute("type") == constProtoType) { const QString from = xml.attribute("from"); const QString id = xml.attribute("id"); const QString protoId = childElem.attribute("id"); if (protoId != constProtoId) { sendErrorIq(account, from, id, "Incorrect protocol version"); return true; } return closeRemoteGameBoard(account, from, id); } childElem = xml.firstChildElement("load"); if (!childElem.isNull() && childElem.attribute("xmlns") == "games:board" && childElem.attribute("type") == constProtoType) { const QString from = xml.attribute("from"); const QString id = xml.attribute("id"); const QString protoId = childElem.attribute("id"); if (protoId != constProtoId) { sendErrorIq(account, from, id, "Incorrect protocol version"); return true; } return remoteLoad(account, from, id, childElem.text()); } } else if (iq_type == "result") { if (doResult(account, xml.attribute("from"), xml.attribute("id"))) { return true; } } else if (iq_type == "error") { if (doReject(account, xml.attribute("from"), xml.attribute("id"))) { return true; } } return false; }