MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { // Set window title and size setWindowTitle("Asteroids"); resize(1024, 768); m_stackWidget = new QStackedWidget(this); // Create start screen widget m_startWidget = new StartWidget; m_stackWidget->addWidget(m_startWidget); // Read css file and apply the styles to the // stack widget QFile file("style.css"); file.open(QFile::ReadOnly); QString css = QLatin1String(file.readAll()); m_stackWidget->setStyleSheet(css); // Set central widget setCentralWidget(m_stackWidget); // Connect events connect(m_startWidget->m_start, SIGNAL(clicked()), this, SLOT(startButtonClicked())); connect(m_startWidget->m_quit, SIGNAL(clicked()), this, SLOT(close())); }
//建立信号与槽 void Widget::initConnect() { connect(ui->addTravelerButton, SIGNAL(clicked()), this, SLOT(addTravelerButtonClicked())); QObject::connect(ui->TravelerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(travelerChanged())); QObject::connect(ui->ThroughCityCheckBox, SIGNAL(toggled(bool)), this, SLOT(activeThroughCity())); QObject::connect(ui->city0cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity0())); QObject::connect(ui->city1cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity1())); QObject::connect(ui->city2cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity2())); QObject::connect(ui->city3cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity3())); QObject::connect(ui->city4cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity4())); QObject::connect(ui->city5cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity5())); QObject::connect(ui->city6cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity6())); QObject::connect(ui->city7cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity7())); QObject::connect(ui->city8cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity8())); QObject::connect(ui->city9cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity9())); QObject::connect(ui->city10cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity10())); QObject::connect(ui->city11cbox, SIGNAL(toggled(bool)), this, SLOT(setThroungCity11())); QObject::connect(ui->StartButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); QObject::connect(ui->StrategyComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enOrDisAbleDeadline(int))); QObject::connect(mstimer, SIGNAL(timeout()), this, SLOT(displaySpentTime())); QObject::connect(ui->StartButton, SIGNAL(clicked()), this, SLOT(timeStart())); QObject::connect(this, SIGNAL(DoStartTimer()), mstimer, SLOT(start())); }
CentreControl::CentreControl(QWidget *parent) : QMainWindow(parent) { view = NULL; scene = NULL; startButton = NULL; handerIndex = 0; master = 0; leftUser = NULL; rightUser = NULL; setFixedSize(1000,700); scene = new QGraphicsScene(); scene->setSceneRect(0,0,998,698); scene->addPixmap(QPixmap(":images/image/background.jpg")); view = new JokerView(this); view->setScene(scene); view->setFixedSize(1000,700); view->show(); startButton = new ButtonItem; startButton->picHight = 56; startButton->picWidth = 294; startButton->picNum = 2; startButton->setPos(QPoint(230,150)); startButton->pic = QPixmap(":images/image/start.png"); scene->addItem(startButton); connect(startButton,SIGNAL(onClick()),this,SLOT(startButtonClicked())); // layer = new QMediaPlayer; // player->setMedia(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3")); // player->setVolume(50); // player->play(); }
void WorldView::stopButtonClicked() { mutex.lock(); commThread.stop(); startButton->setText(QString("Start World Viewer")); disconnect(startButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked())); connect(startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); mutex.unlock(); }
CFullTestSelfPowerWindow::CFullTestSelfPowerWindow(QWidget *parent) : QWidget(parent) { setProperty("testFlag",0); setProperty("index",0); //***UI components _statusLabel = new QLabel(tr("点击测试按钮开始仪表自供电测试,请观察仪表是否在主电,常电切换过程中是否工作正常。")); _statusLabel->setStyleSheet("font:bold 14px;color:#0099FF;max-height:26px;min-height:26px;background:#CCFF99;"); _testResult = new QLabel(tr("...自供电状态...")); _testResult->setStyleSheet("background:wheat;min-width:240px;min-height:30px;border:1px solid blue;"); _testResult->setAlignment(Qt::AlignCenter); _startButton = new QPushButton(tr("开始自供电测试")); //***Layout QVBoxLayout *globalVLayout = new QVBoxLayout; QGroupBox *_mainGroupBox =new QGroupBox(tr("自供电测试")); QVBoxLayout *_vl = new QVBoxLayout(_mainGroupBox); _vl->addWidget(_statusLabel); QGridLayout *grid = new QGridLayout(); _label1 = new QLabel(tr(" 主电开 ")); _label1->setStyleSheet("font:bold 18px;color:green;max-height:30px;min-height:30px;background:#CCFF99;"); _label2 = new QLabel(tr(" 常电关 ")); _label2->setStyleSheet("font:bold 18px;color:red;max-height:30px;min-height:30px;background:wheat;"); grid->addWidget(_label1,0,0); grid->addWidget(_label2,0,1); grid->addWidget(new QLabel(tr("仪表反馈:")),1,0); grid->addWidget(_testResult,1,1); grid->addWidget(_startButton,2,1); _vl->addLayout(grid); globalVLayout->addWidget(_mainGroupBox); setLayout(globalVLayout); //***signal connect(_startButton,SIGNAL(clicked()),this,SLOT(startButtonClicked())); connect((CApp*)qApp,SIGNAL(sendBackFullTestData_selfpower(QByteArray)),this,SLOT(sendBackData(QByteArray))); _timer = new QTimer; connect(_timer,SIGNAL(timeout()),this,SLOT(timerUpdate())); cf = ((CApp*)qApp)->_tjob->_mconfig; }
EscCalibrationPage::EscCalibrationPage(SetupWizard *wizard, QWidget *parent) : AbstractWizardPage(wizard, parent), ui(new Ui::EscCalibrationPage), m_isCalibrating(false) { ui->setupUi(this); ui->outputHigh->setEnabled(false); ui->outputLow->setEnabled(true); ui->outputLevel->setEnabled(true); ui->outputLevel->setText(QString(tr("%1 µs")).arg(OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS)); connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked())); connect(ui->securityCheckBox1, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled())); connect(ui->securityCheckBox2, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled())); connect(ui->securityCheckBox3, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled())); }
void MainWindow::createMainWindowMenu(){ // Creates the 3 buttons that go on the main window start = new QPushButton(tr("&Start")); start->setFixedSize(140,40); start->setFont(QFont("MS Shell Dlg 2", 10, QFont::Bold)); start->setStyleSheet("QPushButton{background-image:url(:/Resource/images/Default.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}" "QPushButton:hover{background-image:url(:/Resource/images/Hover.png);}" "QPushButton:pressed{background-image:url(:/Resource/images/Clicked.png);}"); connect(start, SIGNAL(clicked()), this, SLOT(startButtonClicked())); viewHighScores = new QPushButton(tr("&View High Scores")); viewHighScores->setFixedSize(140,40); viewHighScores->setFont(QFont("MS Shell Dlg 2", 10, QFont::Bold)); viewHighScores->setStyleSheet("QPushButton{background-image:url(:/Resource/images/Default.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}" "QPushButton:hover{background-image:url(:/Resource/images/Hover.png);}" "QPushButton:pressed{background-image:url(:/Resource/images/Clicked.png);}"); connect(viewHighScores, SIGNAL(clicked()), this, SLOT(viewHighScoresButtonClicked())); quit = new QPushButton(tr("&Quit")); quit->setFixedSize(140,40); quit->setFont(QFont("MS Shell Dlg 2", 10, QFont::Bold)); quit->setStyleSheet("QPushButton{background-image:url(:/Resource/images/Exit.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}" "QPushButton:hover{background-image:url(:/Resource/images/Exit-Hover.png);}" "QPushButton:pressed{background-image:url(:/Resource/images/Exit-Clicked.png);}"); connect(quit, SIGNAL(clicked()), qApp, SLOT(quit())); // Creates a label for the game's name QPixmap titleImage(":/Resource/images/BrickBreak.png"); titleName = new QLabel(tr("")); titleName->setPixmap(titleImage); titleName->setFixedSize(476,148); // Sets up the layout for the main window QVBoxLayout *buttonLayout = new QVBoxLayout; buttonLayout->addWidget(titleName, 10, Qt::AlignHCenter); buttonLayout->addWidget(start, 0, Qt::AlignHCenter); buttonLayout->addWidget(viewHighScores, 0, Qt::AlignHCenter); buttonLayout->addWidget(quit, 0, Qt::AlignHCenter); menuWidget = new QWidget; menuWidget->setLayout(buttonLayout); }
StreamOutputWidget::StreamOutputWidget(QWidget *parent) : QWidget(parent), m_mutex(QMutex::Recursive), m_audioOutput(NULL), m_IODevice(NULL), m_enabled(false) { //Create GUI components m_ui.setupUi(this); m_timer =new QTimer(this); //Connect signals connect(m_ui.m_startButton,SIGNAL(clicked()),this,SLOT(startButtonClicked())); connect(m_ui.m_stopButton,SIGNAL(clicked()),this,SLOT(stopButtonClicked())); connect(m_ui.m_clearButton,SIGNAL(clicked()),this,SLOT(clearButtonClicked())); connect(m_timer,SIGNAL(timeout()),this,SLOT(refreshTimeout())); connect(m_ui.m_enabledCheckbox,SIGNAL(toggled(bool)),this,SLOT(enabledButtonClicked(bool))); //Scan audio output devices scanOutputDevice(); m_timer->start(100); //100ms timer }
HITLWidget::HITLWidget(QWidget *parent) : QWidget(parent), simulator(0) { widget = new Ui_HITLWidget(); widget->setupUi(this); widget->startButton->setEnabled(true); widget->stopButton->setEnabled(false); greenColor = "rgb(35, 221, 35)"; // Change the green color in order to make it a bit more vibrant strStyleEnable = QString("QFrame{background-color: %1; color: white}").arg(greenColor); strStyleDisable = "QFrame{background-color: red; color: white}"; strAutopilotDisconnected = " Autopilot OFF "; strSimulatorDisconnected = " Simulator OFF "; strAutopilotConnected = " Autopilot ON "; widget->apLabel->setText(strAutopilotDisconnected); widget->simLabel->setText(strSimulatorDisconnected); connect(widget->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); connect(widget->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked())); connect(widget->buttonClearLog, SIGNAL(clicked()), this, SLOT(buttonClearLogClicked())); }
HITLWidget::HITLWidget(QWidget *parent) : QWidget(parent), simulator(0) { widget = new Ui_HITLWidget(); widget->setupUi(this); widget->startButton->setEnabled(true); widget->stopButton->setEnabled(false); greenColor = "rgb(35, 221, 35)"; strAutopilotDisconnected = " Autopilot OFF "; strSimulatorDisconnected = " Simulator OFF "; strAutopilotConnected = " Autopilot ON "; strSimulatorConnected = " Simulator ON "; widget->apLabel->setText(strAutopilotDisconnected); widget->simLabel->setText(strSimulatorDisconnected); connect(widget->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); connect(widget->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked())); connect(widget->buttonClearLog, SIGNAL(clicked()), this, SLOT(buttonClearLogClicked())); }
UI_ZScoreWindow::UI_ZScoreWindow(QWidget *w_parent, UI_ZScoreWindow **w_zscoredialog, int w_zscore_dialognumber, int w_signalnr) { zscore_epoch_buf = NULL; zscore_page_buf = NULL; zscore_sleepstage_buf = NULL; crossoverfreq = 7.0; z_threshold = 0.0; zscore_page_len = 15; zscore_pages = 0; epoch_cntr = 0; zscore_wake = 1; mainwindow = (UI_Mainwindow *)w_parent; zscore_dialognumber = w_zscore_dialognumber; signalnr = w_signalnr; zscoredialog = w_zscoredialog; zscore_dialog_is_destroyed = 0; zscore_dialog = new QDialog(); zscore_dialog->setMinimumSize(600, 550); zscore_dialog->setWindowTitle("Z-EEG"); zscore_dialog->setModal(false); zscore_dialog->setAttribute(Qt::WA_DeleteOnClose, true); zscore_dialog->setWindowIcon(QIcon(":/images/edf.png")); zscore_dialog->setSizeGripEnabled(true); zscore_dialog->setWindowFlags(Qt::Window | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); crossoverbinLabel = new QLabel; crossoverbinLabel->setMinimumSize(100, 25); crossoverbinLabel->setMaximumSize(100, 25); crossoverbinLabel->setText("Cross-over"); crossoverSpinbox = new QDoubleSpinBox; crossoverSpinbox->setMinimumSize(100, 25); crossoverSpinbox->setMaximumSize(100, 25); crossoverSpinbox->setRange(5.0, 9.5); crossoverSpinbox->setDecimals(1); crossoverSpinbox->setSingleStep(0.5); crossoverSpinbox->setSuffix(" Hz"); crossoverSpinbox->setValue(mainwindow->z_score_var.crossoverfreq); crossoverSpinbox->setToolTip("Threshold between low-frequency and high-frequency"); thresholdLabel = new QLabel; thresholdLabel->setMinimumSize(100, 25); thresholdLabel->setMaximumSize(100, 25); thresholdLabel->setText("Z-threshold"); thresholdSpinbox = new QDoubleSpinBox; thresholdSpinbox->setMinimumSize(100, 25); thresholdSpinbox->setMaximumSize(100, 25); thresholdSpinbox->setRange(-0.5, 0.5); thresholdSpinbox->setDecimals(2); thresholdSpinbox->setSingleStep(0.05); thresholdSpinbox->setValue(mainwindow->z_score_var.z_threshold); pagelenLabel = new QLabel; pagelenLabel->setMinimumSize(100, 25); pagelenLabel->setMaximumSize(100, 25); pagelenLabel->setText("Z-page"); pagelenSpinbox = new QSpinBox; pagelenSpinbox->setMinimumSize(100, 25); pagelenSpinbox->setMaximumSize(100, 25); pagelenSpinbox->setRange(10, 60); pagelenSpinbox->setSingleStep(2); pagelenSpinbox->setSuffix(" sec"); pagelenSpinbox->setValue(mainwindow->z_score_var.zscore_page_len); // errordetectionLabel = new QLabel; // errordetectionLabel->setMinimumSize(100, 25); // errordetectionLabel->setMaximumSize(100, 25); // errordetectionLabel->setText("Error detection"); // // errordetectionSpinbox = new QSpinBox; // errordetectionSpinbox->setMinimumSize(100, 25); // errordetectionSpinbox->setMaximumSize(100, 25); // errordetectionSpinbox->setRange(50, 100); // errordetectionSpinbox->setSingleStep(1); // errordetectionSpinbox->setSuffix(" \%"); // errordetectionSpinbox->setValue(mainwindow->z_score_var.zscore_error_detection); // errordetectionSpinbox->setToolTip("Enter value of \% total power when any of the four\n" // "standard bandwidths: delta, theta, alpha, beta\n" // "exceeds this percent of total power.\n" // "This value will be evaluated when annotating."); hysteresisLabel = new QLabel; hysteresisLabel->setMinimumSize(100, 25); hysteresisLabel->setMaximumSize(100, 25); hysteresisLabel->setText("Sleep/Wake\ndifferentiation"); hysteresisSpinbox = new QDoubleSpinBox; hysteresisSpinbox->setMinimumSize(100, 25); hysteresisSpinbox->setMaximumSize(100, 25); hysteresisSpinbox->setDecimals(2); hysteresisSpinbox->setRange(0.0, 0.25); hysteresisSpinbox->setSingleStep(0.01); hysteresisSpinbox->setValue(mainwindow->z_score_var.z_hysteresis); hysteresisSpinbox->setToolTip("Hysteresis applied to the z-threshold."); curve1 = new SignalCurve; curve1->setSignalColor(Qt::green); curve1->setBackgroundColor(Qt::black); curve1->setRasterColor(Qt::gray); curve1->setCrosshairColor(Qt::red); curve1->setTraceWidth(0); curve1->setDashBoardEnabled(false); curve1->setUpsidedownEnabled(true); StartButton = new QPushButton; StartButton->setMinimumSize(100, 25); StartButton->setMaximumSize(100, 25); StartButton->setText("Calculate"); StartButton->setToolTip("Plot the Z-ratio / Z-pages"); jumpButton = new QPushButton; jumpButton->setMinimumSize(100, 25); jumpButton->setMaximumSize(100, 25); jumpButton->setText("Jump"); jumpButton->setToolTip("Jump to cursor-position"); get_annotButton = new QPushButton; get_annotButton->setMinimumSize(100, 25); get_annotButton->setMaximumSize(100, 25); get_annotButton->setText("Annotate"); get_annotButton->setToolTip("Create annotations from the Z-EEG"); defaultButton = new QPushButton; defaultButton->setMinimumSize(100, 25); defaultButton->setMaximumSize(100, 25); defaultButton->setText("Default"); defaultButton->setToolTip("Set parameters to default values"); CloseButton = new QPushButton; CloseButton->setMinimumSize(100, 25); CloseButton->setMaximumSize(100, 25); CloseButton->setText("Close"); CloseButton->setToolTip("Close this window"); addTraceButton = new QPushButton; addTraceButton->setMinimumSize(100, 25); addTraceButton->setMaximumSize(100, 25); addTraceButton->setText("Add Trace"); addTraceButton->setToolTip("Add this Z-ratio trace to the mainwindow"); epochRadioButton = new QRadioButton; epochRadioButton->setMinimumSize(100, 25); epochRadioButton->setMaximumSize(100, 25); epochRadioButton->setText("Epochs"); pageRadioButton = new QRadioButton; pageRadioButton->setMinimumSize(100, 25); pageRadioButton->setMaximumSize(100, 25); pageRadioButton->setText("Pages"); wakesleepRadioButton = new QRadioButton; wakesleepRadioButton->setMinimumSize(100, 25); wakesleepRadioButton->setMaximumSize(100, 25); wakesleepRadioButton->setText("Sleep/Wake"); pageRadioButton->setChecked(true); plot_type = 1; hlayout1 = new QHBoxLayout; hlayout1->setSpacing(20); hlayout1->addWidget(crossoverbinLabel); hlayout1->addWidget(crossoverSpinbox); hlayout1->addStretch(100); hlayout1->addWidget(epochRadioButton); hlayout1->addStretch(100); hlayout1->addWidget(StartButton); hlayout2 = new QHBoxLayout; hlayout2->setSpacing(20); hlayout2->addWidget(thresholdLabel); hlayout2->addWidget(thresholdSpinbox); hlayout2->addStretch(100); hlayout2->addWidget(pageRadioButton); hlayout2->addStretch(100); hlayout2->addWidget(jumpButton); hlayout3 = new QHBoxLayout; hlayout3->setSpacing(20); hlayout3->addWidget(pagelenLabel); hlayout3->addWidget(pagelenSpinbox); hlayout3->addStretch(100); hlayout3->addWidget(wakesleepRadioButton); hlayout3->addStretch(100); hlayout3->addWidget(get_annotButton); // hlayout4 = new QHBoxLayout; // hlayout4->setSpacing(20); // hlayout4->addWidget(errordetectionLabel); // hlayout4->addWidget(errordetectionSpinbox); // hlayout4->addStretch(100); hlayout4 = new QHBoxLayout; hlayout4->setSpacing(20); hlayout4->addStretch(100); hlayout4->addWidget(addTraceButton); hlayout5 = new QHBoxLayout; hlayout5->setSpacing(20); hlayout5->addWidget(hysteresisLabel); hlayout5->addWidget(hysteresisSpinbox); hlayout5->addStretch(100); hlayout5->addWidget(defaultButton); hlayout5->addStretch(100); hlayout5->addWidget(CloseButton); vlayout2 = new QVBoxLayout; vlayout2->setSpacing(20); vlayout2->addLayout(hlayout1); vlayout2->addLayout(hlayout2); vlayout2->addLayout(hlayout3); vlayout2->addLayout(hlayout4); vlayout2->addLayout(hlayout5); vlayout3 = new QVBoxLayout; vlayout3->setSpacing(20); vlayout3->setContentsMargins(20, 20, 20, 20); vlayout3->addWidget(curve1); vlayout3->addLayout(vlayout2); zscore_dialog->setLayout(vlayout3); shift_page_left_Act = new QAction(this); shift_page_left_Act->setShortcut(QKeySequence::MoveToPreviousChar); connect(shift_page_left_Act, SIGNAL(triggered()), this, SLOT(shift_page_left())); zscore_dialog->addAction(shift_page_left_Act); shift_page_right_Act = new QAction(this); shift_page_right_Act->setShortcut(QKeySequence::MoveToNextChar); connect(shift_page_right_Act, SIGNAL(triggered()), this, SLOT(shift_page_right())); zscore_dialog->addAction(shift_page_right_Act); QObject::connect(CloseButton, SIGNAL(clicked()), zscore_dialog, SLOT(close())); QObject::connect(StartButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); QObject::connect(get_annotButton, SIGNAL(clicked()), this, SLOT(get_annotationsButtonClicked())); QObject::connect(jumpButton, SIGNAL(clicked()), this, SLOT(jumpButtonClicked())); QObject::connect(zscore_dialog, SIGNAL(destroyed(QObject *)), this, SLOT(ZscoreDialogDestroyed(QObject *))); QObject::connect(epochRadioButton, SIGNAL(clicked(bool)), this, SLOT(RadioButtonsClicked(bool))); QObject::connect(pageRadioButton, SIGNAL(clicked(bool)), this, SLOT(RadioButtonsClicked(bool))); QObject::connect(wakesleepRadioButton, SIGNAL(clicked(bool)), this, SLOT(RadioButtonsClicked(bool))); QObject::connect(defaultButton, SIGNAL(clicked()), this, SLOT(defaultButtonClicked())); QObject::connect(curve1, SIGNAL(markerHasMoved()), this, SLOT(markersMoved())); QObject::connect(addTraceButton, SIGNAL(clicked()), this, SLOT(addTraceButtonClicked())); zscore_dialog->show(); }
void StartAndHelpScreen::on_startButton_clicked() { emit startButtonClicked(); }
UI_AveragerWindow::UI_AveragerWindow(QWidget *w_parent, int annot_nr) { int i, n; long long recording_duration; struct annotationblock *annot; mainwindow = (UI_Mainwindow *)w_parent; averager_dialog = new QDialog(w_parent); averager_dialog->setMinimumSize(600, 400); averager_dialog->setMaximumSize(600, 400); averager_dialog->setWindowTitle("Average waveforms"); averager_dialog->setModal(true); averager_dialog->setAttribute(Qt::WA_DeleteOnClose, true); annotLabel = new QLabel(averager_dialog); annotLabel->setGeometry(20, 20, 100, 25); annotLabel->setText("Use annotation:"); annotNameLabel = new QLabel(averager_dialog); annotNameLabel->setGeometry(130, 20, 200, 25); signalLabel = new QLabel(averager_dialog); signalLabel->setGeometry(340, 20, 100, 25); signalLabel->setText("Select signal(s):"); list = new QListWidget(averager_dialog); list->setGeometry(450, 20, 130, 360); list->setSelectionBehavior(QAbstractItemView::SelectRows); list->setSelectionMode(QAbstractItemView::ExtendedSelection); time1.setHMS(0, 0, 0, 0); recording_duration = (mainwindow->edfheaderlist[0]->datarecords * mainwindow->edfheaderlist[0]->long_data_record_duration) / TIME_DIMENSION; time2.setHMS((recording_duration / 3600) % 24, (recording_duration % 3600) / 60, recording_duration % 60, 0); time1Label = new QLabel(averager_dialog); time1Label->setGeometry(20, 65, 100, 25); time1Label->setText("From (hh:mm:ss)"); timeEdit1 = new QTimeEdit(averager_dialog); timeEdit1->setGeometry(130, 65, 110, 25); timeEdit1->setDisplayFormat("hh:mm:ss.zzz"); timeEdit1->setMinimumTime(QTime(0, 0, 0, 0)); timeEdit1->setMaximumTime(time2); time2Label = new QLabel(averager_dialog); time2Label->setGeometry(20, 110, 100, 25); time2Label->setText("To (hh:mm:ss)"); timeEdit2 = new QTimeEdit(averager_dialog); timeEdit2->setGeometry(130, 110, 110, 25); timeEdit2->setDisplayFormat("hh:mm:ss.zzz"); timeEdit2->setMinimumTime(QTime(0, 0, 0, 0)); timeEdit2->setMaximumTime(time2); timeEdit2->setTime(time2); ratioLabel = new QLabel(averager_dialog); ratioLabel->setGeometry(20, 155, 100, 75); ratioLabel->setText("Ratio of time\n" "before and after\n" "trigger:"); ratioBox = new QComboBox(averager_dialog); ratioBox->setGeometry(130, 180, 100, 25); ratioBox->addItem("10 / 90"); ratioBox->addItem("25 / 75"); ratioBox->addItem("50 / 50"); ratioBox->setCurrentIndex(mainwindow->average_ratio); bufsizeLabel = new QLabel(averager_dialog); bufsizeLabel->setGeometry(20, 250, 100, 25); bufsizeLabel->setText("Average period:"); avg_periodspinbox = new QDoubleSpinBox(averager_dialog); avg_periodspinbox->setGeometry(130, 250, 100, 25); avg_periodspinbox->setDecimals(3); avg_periodspinbox->setRange(0.01, 300.0); avg_periodspinbox->setSuffix(" sec"); avg_periodspinbox->setValue(mainwindow->average_period); CloseButton = new QPushButton(averager_dialog); CloseButton->setGeometry(20, 355, 100, 25); CloseButton->setText("Cancel"); StartButton = new QPushButton(averager_dialog); StartButton->setGeometry(310, 355, 100, 25); StartButton->setText("Start"); for(i=0; i<mainwindow->signalcomps; i++) { if(mainwindow->signalcomp[i]->alias[0] != 0) { new QListWidgetItem(mainwindow->signalcomp[i]->alias, list); } else { new QListWidgetItem(mainwindow->signalcomp[i]->signallabel, list); } } list->setCurrentRow(0, QItemSelectionModel::Select); annot = mainwindow->annotationlist[0]; n = annot_nr; while(n) { annot = annot->next_annotation; n--; } strcpy(annot_str, annot->annotation); remove_trailing_spaces(annot_str); annotNameLabel->setText(annot_str); QObject::connect(CloseButton, SIGNAL(clicked()), averager_dialog, SLOT(close())); QObject::connect(StartButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); averager_dialog->exec(); }
WorldView::WorldView(QWidget* parent) : portals::Module(), QWidget(parent), commThread("comm", COMM_FRAME_LENGTH_uS), wviewComm(16,0), sharedBallOut(base()), locOut(base()), wviewShared(1), newTeam(0), mutex() { commThread.addModule(*this); commThread.addModule(wviewComm); commThread.addModule(wviewShared); #ifdef USE_LAB_FIELD fieldPainter = new WorldViewPainter(this, 2.); #else fieldPainter = new WorldViewPainter(this, 1.); #endif QHBoxLayout *mainLayout = new QHBoxLayout(this); QHBoxLayout *field = new QHBoxLayout(); field->addWidget(fieldPainter); QVBoxLayout *rightBar = new QVBoxLayout(); QVBoxLayout *options = new QVBoxLayout(); options->setAlignment(Qt::AlignTop); startButton = new QPushButton(QString("Start World Viewer")); flipButton = new QPushButton(QString("FLIP")); options->addWidget(flipButton); options->addWidget(startButton); QHBoxLayout *teamLayout = new QHBoxLayout(); QLabel *teamLabel = new QLabel(tr("Listening to Team: ")); teamSelector = new QLineEdit(tr("16")); QValidator *teamVal = new QIntValidator(1, 255); teamSelector->setValidator(teamVal); teamLayout->addWidget(teamLabel); teamLayout->addWidget(teamSelector); options->addLayout(teamLayout); connect(teamSelector, SIGNAL(editingFinished()), this, SLOT(teamChanged())); QVBoxLayout *stateLayout = new QVBoxLayout(); stateLayout->setAlignment(Qt::AlignTop); QGroupBox *stateBox = new QGroupBox(tr("Robot States")); QVBoxLayout *boxLayout = new QVBoxLayout(); for (int i = 0; i < NUM_PLAYERS_PER_TEAM; ++i) { roleLabels[i] = new QLabel(tr("Inactive")); } QHBoxLayout *p1Layout = new QHBoxLayout(); QLabel *p1Label = new QLabel(tr("Player 1: ")); QHBoxLayout *p2Layout = new QHBoxLayout(); QLabel *p2Label = new QLabel(tr("Player 2: ")); QHBoxLayout *p3Layout = new QHBoxLayout(); QLabel *p3Label = new QLabel(tr("Player 3: ")); QHBoxLayout *p4Layout = new QHBoxLayout(); QLabel *p4Label = new QLabel(tr("Player 4: ")); QHBoxLayout *p5Layout = new QHBoxLayout(); QLabel *p5Label = new QLabel(tr("Player 5: ")); p1Layout->addWidget(p1Label); p1Layout->addWidget(roleLabels[0]); p2Layout->addWidget(p2Label); p2Layout->addWidget(roleLabels[1]); p3Layout->addWidget(p3Label); p3Layout->addWidget(roleLabels[2]); p4Layout->addWidget(p4Label); p4Layout->addWidget(roleLabels[3]); p5Layout->addWidget(p5Label); p5Layout->addWidget(roleLabels[4]); boxLayout->addLayout(p1Layout); boxLayout->addLayout(p2Layout); boxLayout->addLayout(p3Layout); boxLayout->addLayout(p4Layout); boxLayout->addLayout(p5Layout); boxLayout->setSpacing(20); stateBox->setFlat(false); stateBox->setLayout(boxLayout); stateLayout->addWidget(stateBox); rightBar->addLayout(options); rightBar->addLayout(stateLayout); mainLayout->addLayout(field); mainLayout->addLayout(rightBar); this->setLayout(mainLayout); connect(startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); connect(flipButton, SIGNAL(clicked()), this, SLOT(flipButtonClicked())); for (int i = 0; i < NUM_PLAYERS_PER_TEAM; ++i) { commIn[i].wireTo(wviewComm._worldModels[i]); wviewShared.worldModelIn[i].wireTo(wviewComm._worldModels[i]); } wviewShared.ballIn.wireTo(&sharedBallOut,true); wviewShared.locIn.wireTo(&locOut,true); sharedIn.wireTo(&wviewShared.sharedBallOutput); }
void MainWindow::createMainMenuWidget() { // Sets up each menu button along with their styleSheet QPushButton *start = new QPushButton(tr("Start")); start->setFixedSize(172,48); start->setFont(QFont("MS Shell Dlg 2", 11, QFont::Bold)); start->setStyleSheet("QPushButton{background-image:url(:/program/images/Default.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}" "QPushButton:hover{background-image:url(:/program/images/Hover.png);}" "QPushButton:pressed{background-image:url(:/program/images/Clicked.png);}"); connect(start, SIGNAL(clicked()), this, SLOT(startButtonClicked())); QPushButton *howToPlay = new QPushButton(tr("How to Play")); howToPlay->setFixedSize(172,48); howToPlay->setFont(QFont("MS Shell Dlg 2", 11, QFont::Bold)); howToPlay->setStyleSheet("QPushButton{background-image:url(:/program/images/About.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}" "QPushButton:hover{background-image:url(:/program/images/About-Hover.png);}" "QPushButton:pressed{background-image:url(:/program/images/About-Clicked.png);}" "QPushButton:disabled{background-image:url(:/program/images/Quit.png);};"); connect(howToPlay, SIGNAL(clicked()), this, SLOT(howToPlayButtonClicked())); QPushButton *about = new QPushButton(tr("About Guess Who")); about->setFixedSize(172,48); about->setFont(QFont("MS Shell Dlg 2", 11, QFont::Bold)); about->setStyleSheet("QPushButton{background-image:url(:/program/images/About.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}" "QPushButton:hover{background-image:url(:/program/images/About-Hover.png);}" "QPushButton:pressed{background-image:url(:/program/images/About-Clicked.png);}"); connect(about, SIGNAL(clicked()), this, SLOT(aboutButtonClicked())); QPushButton *quit = new QPushButton(tr("Quit")); quit->setFixedSize(172,48); quit->setFont(QFont("MS Shell Dlg 2", 11, QFont::Bold)); quit->setStyleSheet("QPushButton{background-image:url(:/program/images/Quit.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}" "QPushButton:hover{background-image:url(:/program/images/Quit-Hover.png);}" "QPushButton:pressed{background-image:url(:/program/images/Quit-Clicked.png);}"); connect(quit, SIGNAL(clicked()), qApp, SLOT(quit())); // Creates the layout for the buttons QVBoxLayout *buttonLayout = new QVBoxLayout; buttonLayout->addSpacing(20); buttonLayout->addWidget(start, 0, Qt::AlignHCenter); buttonLayout->addSpacing(15); buttonLayout->addWidget(howToPlay, 0, Qt::AlignHCenter); buttonLayout->addSpacing(15); buttonLayout->addWidget(about, 0, Qt::AlignHCenter); buttonLayout->addSpacing(15); buttonLayout->addWidget(quit, 0, Qt::AlignHCenter); buttonLayout->addSpacing(20); QGroupBox *choiceGroupBox = new QGroupBox(tr("")); choiceGroupBox->setStyleSheet("QGroupBox{color:white}"); choiceGroupBox->setLayout(buttonLayout); choiceGroupBox->setFixedSize(260, 400); // Creates 2 labels that will hold images for the menu screen QLabel *leftLabel = new QLabel(tr("")); QPixmap leftImage(":/program/images/Left.png"); leftLabel->setPixmap(leftImage); leftLabel->setFixedSize(480,570); QLabel *rightLabel = new QLabel(tr("")); QPixmap rightImage(":/program/images/Right.png"); rightLabel->setPixmap(rightImage); rightLabel->setFixedSize(480,570); // Creates the bottom layout for the page QHBoxLayout *bottomLayout = new QHBoxLayout; bottomLayout->addWidget(leftLabel, 0, Qt::AlignHCenter); bottomLayout->addWidget(choiceGroupBox); bottomLayout->addWidget(rightLabel, 0, Qt::AlignHCenter); // Creates the main layout for the page QVBoxLayout *mainLayout = new QVBoxLayout; QPixmap titleImage(":/program/images/Title.png"); QLabel *titleName = new QLabel(tr("")); titleName->setPixmap(titleImage); titleName->setFixedSize(980,300); mainLayout->addSpacing(100); mainLayout->addWidget(titleName, 0, Qt::AlignHCenter); mainLayout->addLayout(bottomLayout); mainMenuWidget = new QWidget; mainMenuWidget->setLayout(mainLayout); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); connect(ui.browsePushButton,SIGNAL(clicked()),this,SLOT(browseButtonClicked())); connect(ui.startPushButton,SIGNAL(clicked()),this,SLOT(startButtonClicked())); }