GameTheory::GameTheory(QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags) { ui.setupUi(this); connect( ui.heap_button_1, SIGNAL(clicked()), this, SLOT(HeapButtonClicked()) ); connect( ui.heap_button_2, SIGNAL(clicked()), this, SLOT(HeapButtonClicked()) ); connect( ui.heap_button_3, SIGNAL(clicked()), this, SLOT(HeapButtonClicked()) ); connect( ui.ok_button_1, SIGNAL(clicked()), this, SLOT(OkButtonClicked()) ); connect( ui.ok_button_2, SIGNAL(clicked()), this, SLOT(OkButtonClicked()) ); connect( ui.ok_button_3, SIGNAL(clicked()), this, SLOT(OkButtonClicked()) ); TurnOffOkButtons(); TurnOffHeapButtons(); connect (ui.ok_candies, SIGNAL(clicked()), this, SLOT(CandiesChosen())); start_timer = new QTimer(this); timer_to_watch_AI = new QTimer(this); connect(timer_to_watch_AI, SIGNAL(timeout()), this, SLOT(SwitchTurnToPlayer())); connect(start_timer, SIGNAL(timeout()), this, SLOT(StartGame())); current_active_player = 1; is_start_of_the_game = true; ai_player = 2; number_of_candies = 100; available_candies = number_of_candies; number_of_unselected_heaps = 3; game_finished = false; candies_in_heap.resize(3, 0); ui.informer->setText(QString("Choose a player and the number of candies")); }
void FontManagerDialog::ConnectToSignals() { //Connect signal and slots connect(ui->okButton, SIGNAL(clicked()), this, SLOT(OkButtonClicked())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); connect(ui->setDefaultButton, SIGNAL(clicked()), this, SLOT(SetDefaultButtonClicked())); }
NewContact::NewContact(QWidget *parent) : QDialog(parent), ui(new Ui::NewContact) { ui->setupUi(this); this->setFixedSize(width(),height()); setWindowTitle(tr("添加新联系人")); ui->whiteRadioButton->setChecked(true); connect(ui->cancelButton,SIGNAL(clicked()),this,SLOT(close())); connect(ui->OkButton,SIGNAL(clicked()),this,SLOT(OkButtonClicked())); }
HIDCalibrateDialog::~HIDCalibrateDialog() { delete layout; disconnect(ui.okButton, SIGNAL(clicked()), this, SLOT(OkButtonClicked())); disconnect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(CancelButtonClicked())); disconnect(ui.startButton, SIGNAL(clicked()), this, SLOT(StartButtonClicked())); disconnect(ui.stopButton, SIGNAL(clicked()), this, SLOT(StopButtonClicked())); disconnect(m_USBHIDDev, SIGNAL(CalibrateThreadStarted(QString)), this, SLOT(CalibrationStarted(QString))); disconnect(m_USBHIDDev, SIGNAL(CalibrateThreadStopped(QString)), this, SLOT(CalibrationStopped(QString))); disconnect(m_USBHIDDev, SIGNAL(CaptureThreadButtonTriggered(unsigned char,unsigned char)), this, SLOT(HIDButtonPressed(unsigned char,unsigned char))); StopCalibration(); if(m_bSuccesfullyInitialized) { m_USBHIDDev->StopCaptureThread(true); } delete renderArea; }
HIDCalibrateDialog::HIDCalibrateDialog(USBHIDDevice *pUSBHIDDEV, QWidget *parent) : QDialog(parent) { m_bSuccesfullyInitialized = false; m_bCalibrationActive = false; m_USBHIDDev = pUSBHIDDEV; ui.setupUi(this); setWindowTitle(tr("HID Calibration")); ResetCurrentCalibration(); layout = new QHBoxLayout(ui.groupBox); renderArea = new RenderArea; connect(ui.okButton, SIGNAL(clicked()), this, SLOT(OkButtonClicked())); connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(CancelButtonClicked())); connect(ui.startButton, SIGNAL(clicked()), this, SLOT(StartButtonClicked())); connect(ui.stopButton, SIGNAL(clicked()), this, SLOT(StopButtonClicked())); connect(m_USBHIDDev, SIGNAL(CalibrateThreadStarted(QString)), this, SLOT(CalibrationStarted(QString))); connect(m_USBHIDDev, SIGNAL(CalibrateThreadStopped(QString)), this, SLOT(CalibrationStopped(QString))); connect(m_USBHIDDev, SIGNAL(CaptureThreadButtonTriggered(unsigned char, unsigned char)), this, SLOT(HIDButtonPressed(unsigned char,unsigned char))); ui.label->setText("Ready to start the calibration.\nPress the 'Start' button or the Joysticks Left button to start the calibration.\nPress the Joysticks Right button to exit the calibration."); m_bSuccesfullyInitialized = Initialize(); }