void UpdateCenterImpl::closeEvent(QCloseEvent *event) { if (!closedByButton) { event->ignore(); btnCancelClicked(); } }
UpdateCenterImpl::UpdateCenterImpl(Updates *updates, bool autoDownloadAndInstall, QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { setupUi(this); // resize for macosx #ifndef Q_OS_WIN32 resize(630, 366); #endif closedByButton = false; // version lblxVSTVersion->setText(QString(lblxVSTVersion->text()).arg(PROGRAM_VERSION)); // set update class this->updates = updates; // configure updates list QStringList headers; headers << tr(" File ") << tr(" Version ") << tr(" Size ") << tr(" Progress "); // add the headers lsvUpdates->setHeaderLabels(headers); // change headers sizes QFontMetrics fm = fontMetrics(); QHeaderView *header = lsvUpdates->header(); // resize header->resizeSection(1, fm.width(headers.at(0) + "9.99.999 alpha")); header->resizeSection(2, fm.width(headers.at(1) + " 1024,99Mb ")); // configure resize mode header->setHighlightSections(false); header->setStretchLastSection(false); header->setSectionResizeMode(0, QHeaderView::Stretch); // set header text aligment QTreeWidgetItem * headerItem = lsvUpdates->headerItem(); headerItem->setTextAlignment(1, Qt::AlignHCenter | Qt::AlignVCenter); headerItem->setTextAlignment(2, Qt::AlignRight | Qt::AlignVCenter); headerItem->setTextAlignment(3, Qt::AlignHCenter | Qt::AlignVCenter); // fill data fillUpdates(); // signals connect(lsvUpdates, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(itemChanged(QTreeWidgetItem*, int))); connect(btnCancel, SIGNAL(clicked()), this, SLOT(btnCancelClicked())); connect(btnUpdate, SIGNAL(clicked()), this, SLOT(btnUpdateClicked())); // updater connect(updates, SIGNAL(downloadingUpdate(int, int, int)), this, SLOT(downloadingUpdate(int, int, int))); connect(updates, SIGNAL(downloadUpdateFinished(int)), this, SLOT(downloadUpdateFinished(int))); connect(updates, SIGNAL(downloadUpdateError(int)), this, SLOT(downloadUpdateError(int))); connect(updates, SIGNAL(downloadsFinished()), this, SLOT(downloadsFinished())); connect(updates, SIGNAL(readyToInstallUpdates()), this, SLOT(readyToInstallUpdates())); connect(updates, SIGNAL(failedToInstallUpdates()), this, SLOT(failedToInstallUpdates())); // if auto download & install updates, then... if (autoDownloadAndInstall) { // disable update button lsvUpdates->setEnabled(false); btnUpdate->setEnabled(false); // start automatically to download updates (in 500ms) QTimer::singleShot(500, this, SLOT(btnUpdateClicked())); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->_leDefaultDirPath->setReadOnly(true); ui->_leNeuronPrecision->setValidator(new QDoubleValidator(MIN_PRECISION,MAX_PRECISION,DECIMAL_PLACE)); ui->_leWeightPrecision->setValidator(new QDoubleValidator(MIN_PRECISION,MAX_PRECISION,DECIMAL_PLACE)); ui->_leAxNNPrecision->setValidator(new QIntValidator()); ui->_leNumberOfCores->setValidator(new QIntValidator(MIN_CLUSTERS,MAX_CLUSTERS)); ui->_leNCInputPath->setReadOnly(true); ui->_leNCOutputPath->setReadOnly(true); ui->_leWCInputPath->setReadOnly(true); ui->_leWCOutputPath->setReadOnly(true); ui->_leAxNNInputPath->setReadOnly(true); ui->_leAxNNOutputPath->setReadOnly(true); _neuronAllPrecision = false; _weightAllPrecision = false; _axNNAllPrecision = false; _neuronClustering = new NeuronClustering(); _weightClustering = new WeightClustering(); _axNN = new AxNN(); connect(ui->_btnCancel,SIGNAL(clicked()),this,SLOT(btnCancelClicked())); connect(ui->_btnRunApproach1,SIGNAL(clicked()),this,SLOT(btnRunApproach1())); connect(ui->_btnRunApproach2,SIGNAL(clicked()),this,SLOT(btnRunApproach2())); connect(ui->_btnWCRun,SIGNAL(clicked()),this,SLOT(btnWCRunClicked())); connect(ui->_btnNCInputPath,SIGNAL(clicked()),this,SLOT(btnNCInputPathClicked())); connect(ui->_btnWCInputPath,SIGNAL(clicked()),this,SLOT(btnWCInputPathClicked())); connect(ui->_btnNCOutputPath,SIGNAL(clicked()),this,SLOT(btnNCOutputPathClicked())); connect(ui->_btnWCOutputPath,SIGNAL(clicked()),this,SLOT(btnWCOutputPathClicked())); connect(ui->_btnNCCluster,SIGNAL(clicked()),this,SLOT(btnNCClusterFiles())); connect(ui->_btnDefaultPathDialog,SIGNAL(clicked()),this,SLOT(SetOuputDefaultDir())); connect(ui->_cbxWeightAllPrecision,SIGNAL(stateChanged(int)),this,SLOT(WeightAllPrecision(int))); connect(ui->_cbxNeuronAllPrecision,SIGNAL(stateChanged(int)),this,SLOT(NeuronAllPrecision(int))); connect(ui->_cbxAxNNAllPrecision,SIGNAL(stateChanged(int)),this,SLOT(AxNNAllPrecision(int))); connect(ui->_btnAxNNErrorFile,SIGNAL(clicked()),this,SLOT(btnAxNNErrorFiles())); connect(ui->_btnAxNNOuputPath,SIGNAL(clicked()),this,SLOT(btnAxNNOutputPathClicked())); connect(ui->_btnAxNNInputPath,SIGNAL(clicked()),this,SLOT(btnAxNNInputPathClicked())); connect(ui->_btnAxNNRun,SIGNAL(clicked()),this,SLOT(btnAxNNRun())); ui->_cmbClusteringAlgorithm->addItem("K-means"); ui->_cmbClusteringAlgorithm->addItem("Load Balancing"); DefaultPathExistCheck(); }
void EnrollDialog::initializeUI() { grid = new QGridLayout(); lblMsg = new QLabel(tr("Introduzca su RUT")); lblMsg->setAlignment(Qt::AlignCenter); lblMsg->setStyleSheet("font-size: 12px;" "color: #FFFFFF;" "text-align: center;" "font-style: normal;" "font-weight: bold;"); edtRut = new QLineEdit(); edtRut->resize(100, 50); edtRut->setStyleSheet("background:rgb(0,102,153);" "color:rgb(255,255,255);" "font-size:18px;" "padding-right: 10px;"); btnDelete = new QPushButton(); btnDelete->resize(50, 50); btnDelete->setFlat(true); btnDelete->setStyleSheet("background-image: url(:/img/Resources/images/borrar.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btnDelete, SIGNAL(clicked()), this, SLOT(btnDeleteClicked())); btn1 = new QPushButton(); btn1->resize(50, 50); btn1->setFlat(true); btn1->setStyleSheet("background-image: url(:/img/Resources/images/1.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn1, SIGNAL(clicked()), this, SLOT(btn1Clicked())); btn2 = new QPushButton(); btn2->resize(50, 50); btn2->setFlat(true); btn2->setStyleSheet("background-image: url(:/img/Resources/images/2.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn2, SIGNAL(clicked()), this, SLOT(btn2Clicked())); btn3 = new QPushButton(); btn3->resize(50, 50); btn3->setFlat(true); btn3->setStyleSheet("background-image: url(:/img/Resources/images/3.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn3, SIGNAL(clicked()), this, SLOT(btn3Clicked())); btn4 = new QPushButton(); btn4->resize(50, 50); btn4->setFlat(true); btn4->setStyleSheet("background-image: url(:/img/Resources/images/4.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn4, SIGNAL(clicked()), this, SLOT(btn4Clicked())); btn5 = new QPushButton(); btn5->resize(50, 50); btn5->setFlat(true); btn5->setStyleSheet("background-image: url(:/img/Resources/images/5.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn5, SIGNAL(clicked()), this, SLOT(btn5Clicked())); btn6 = new QPushButton(); btn6->resize(50, 50); btn6->setFlat(true); btn6->setStyleSheet("background-image: url(:/img/Resources/images/6.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn6, SIGNAL(clicked()), this, SLOT(btn6Clicked())); btn7 = new QPushButton(); btn7->resize(50, 50); btn7->setFlat(true); btn7->setStyleSheet("background-image: url(:/img/Resources/images/7.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn7, SIGNAL(clicked()), this, SLOT(btn7Clicked())); btn8 = new QPushButton(); btn8->resize(50, 50); btn8->setFlat(true); btn8->setStyleSheet("background-image: url(:/img/Resources/images/8.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn8, SIGNAL(clicked()), this, SLOT(btn8Clicked())); btn9 = new QPushButton(); btn9->resize(50, 50); btn9->setFlat(true); btn9->setStyleSheet("background-image: url(:/img/Resources/images/9.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn9, SIGNAL(clicked()), this, SLOT(btn9Clicked())); btn0 = new QPushButton(); btn0->resize(50, 50); btn0->setFlat(true); btn0->setStyleSheet("background-image: url(:/img/Resources/images/0.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btn0, SIGNAL(clicked()), this, SLOT(btn0Clicked())); btnHyphen = new QPushButton(); btnHyphen->resize(50, 50); btnHyphen->setFlat(true); btnHyphen->setStyleSheet("background-image: url(:/img/Resources/images/guion.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btnHyphen, SIGNAL(clicked()), this, SLOT(btnHyphenClicked())); btnK = new QPushButton(); btnK->resize(50, 50); btnK->setFlat(true); btnK->setStyleSheet("background-image: url(:/img/Resources/images/k.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btnK, SIGNAL(clicked()), this, SLOT(btnKClicked())); btnOk = new QPushButton(); btnOk->resize(50, 50); btnOk->setFlat(true); btnOk->setStyleSheet("background-image: url(:/img/Resources/images/aceptar.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btnOk, SIGNAL(clicked()), this, SLOT(btnOkClicked())); btnCancel = new QPushButton(); btnCancel->resize(50, 50); btnCancel->setFlat(true); btnCancel->setStyleSheet("background-image: url(:/img/Resources/images/cancelar.bmp);" "background-repeat: no repeat;" "background-position: center center;" "color:rgb(255,255,255);" "font-size:18px"); connect(btnCancel, SIGNAL(clicked()), this, SLOT(btnCancelClicked())); lblEmpresa = new QLabel(); lblEmpresa->setAlignment(Qt::AlignCenter); lblEmpresa->setStyleSheet("font-size: 18px;" "color: #FFFFFF;" "font-style: normal;"); lblName= new QLabel(); lblName->setAlignment(Qt::AlignCenter); lblName->setStyleSheet("font-size: 18px;" "color: #FFFFFF;" "font-style: normal;"); lblMsgScreen2= new QLabel(); lblMsgScreen2->setAlignment(Qt::AlignCenter); lblMsgScreen2->setStyleSheet("font-size: 18px;" "color: #FFFFFF;" "font-style: normal;"); // widget, row, col, rowSpan, colSpan grid->addWidget(lblMsg, 0, 0, 1, 4, Qt::AlignCenter); grid->addWidget(edtRut, 1, 0, 1, 3, Qt::AlignCenter); grid->addWidget(btnDelete, 1, 3, 1, 1, Qt::AlignCenter); grid->addWidget(btn1, 2, 0, 1, 1, Qt::AlignCenter); grid->addWidget(btn2, 2, 1, 1, 1, Qt::AlignCenter); grid->addWidget(btn3, 2, 2, 1, 1, Qt::AlignCenter); grid->addWidget(btn4, 3, 0, 1, 1, Qt::AlignCenter); grid->addWidget(btn5, 3, 1, 1, 1, Qt::AlignCenter); grid->addWidget(btn6, 3, 2, 1, 1, Qt::AlignCenter); grid->addWidget(btnHyphen, 3, 3, 1, 1, Qt::AlignCenter); grid->addWidget(btn7, 4, 0, 1, 1, Qt::AlignCenter); grid->addWidget(btn8, 4, 1, 1, 1, Qt::AlignCenter); grid->addWidget(btn9, 4, 2, 1, 1, Qt::AlignCenter); grid->addWidget(btnK, 4, 3, 1, 1, Qt::AlignCenter); grid->addWidget(btnCancel, 5, 0, 1, 1, Qt::AlignCenter); grid->addWidget(btn0, 5, 1, 1, 1, Qt::AlignCenter); grid->addWidget(btnOk, 5, 2, 1, 1, Qt::AlignCenter); setStyleSheet("background:rgb(0,101,153);"); setLayout(grid); }