DISABLE_COMPILER_WARNINGS #include <QCloseEvent> #include <QMessageBox> RESTORE_COMPILER_WARNINGS CDeleteProgressDialog::CDeleteProgressDialog(std::vector<CFileSystemObject> source, QString destination, CMainWindow *mainWindow) : QWidget(0, Qt::Window), ui(new Ui::CDeleteProgressDialog), _performer(new COperationPerformer(operationDelete, source, destination)), _mainWindow(mainWindow) { ui->setupUi(this); ui->_progress->linkToWidgetstaskbarButton(this); assert(mainWindow); ui->_lblNumFiles->clear(); ui->_lblFileName->clear(); connect (ui->_btnCancel, SIGNAL(clicked()), SLOT(cancelPressed())); connect (ui->_btnBackground, SIGNAL(clicked()), SLOT(background())); connect (ui->_btnPause, SIGNAL(clicked()), SLOT(pauseResume())); setWindowTitle(tr("Deleting...")); _eventsProcessTimer.setInterval(100); _eventsProcessTimer.start(); connect(&_eventsProcessTimer, SIGNAL(timeout()), SLOT(processEvents())); _performer->setWatcher(this); _performer->start(); }
ControlWidget::ControlWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ControlWidget) { ui->setupUi(this); connect(ui->pushButton_add, SIGNAL(clicked()), this, SLOT(addSineWave())); connect(ui->pushButton_clear, SIGNAL(clicked()), this, SIGNAL(signalClear())); connect(ui->pushButton_step, SIGNAL(clicked()), this, SIGNAL(signalStep())); connect(ui->pushButton_control, SIGNAL(clicked()), this, SLOT(pauseResume())); connect(ui->pushButton_squareWave, SIGNAL(clicked()), this, SLOT(square())); connect(ui->pushButton_sawtooth, SIGNAL(clicked()), this, SLOT(sawtooth())); }
void level::keyboardFunction(unsigned char key,int x,int y) { switch (key) { case 27: pauseResume(); break; case 'w': playerShip->accelerate(); break; case 'a': playerShip->turn_left(); break; case 's': playerShip->decelerate(); break; case 'd': playerShip->turn_right(); break; case 'q': playerShip->turbo_boost(); break; case 'e': playerShip->e_brake(); break; case 'p': pauseResume(); break; case 'r': if (!playerShip->isAlive()) { reset(); } break; } }
MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { m_mpv = new MpvWidget(this); m_slider = new QSlider(); m_slider->setOrientation(Qt::Horizontal); m_openBtn = new QPushButton("Open"); m_playBtn = new QPushButton("Pause"); QHBoxLayout *hb = new QHBoxLayout(); hb->addWidget(m_openBtn); hb->addWidget(m_playBtn); QVBoxLayout *vl = new QVBoxLayout(); vl->addWidget(m_mpv); vl->addWidget(m_slider); vl->addLayout(hb); setLayout(vl); connect(m_slider, SIGNAL(sliderMoved(int)), SLOT(seek(int))); connect(m_openBtn, SIGNAL(clicked()), SLOT(openMedia())); connect(m_playBtn, SIGNAL(clicked()), SLOT(pauseResume())); connect(m_mpv, SIGNAL(positionChanged(int)), m_slider, SLOT(setValue(int))); connect(m_mpv, SIGNAL(durationChanged(int)), this, SLOT(setSliderRange(int))); }
CCopyMoveDialog::CCopyMoveDialog(Operation operation, std::vector<CFileSystemObject> source, QString destination, CMainWindow * mainWindow) : QWidget(0, Qt::Window), ui(new Ui::CCopyMoveDialog), _performer(new COperationPerformer(operation, source, destination)), _mainWindow(mainWindow), _op(operation), _titleTemplate(_op == operationCopy ? "%1% Copying %2/s" : "%1% Moving %2/s"), _labelTemplate(_op == operationCopy ? "Copying files... %2/s" : "Moving files... %2/s"), _speed(0) { ui->setupUi(this); ui->_overallProgress->linkToWidgetstaskbarButton(this); ui->_lblFileName->clear(); assert(mainWindow); if (operation == operationCopy) ui->_lblOperationName->setText("Copying files..."); else if (operation == operationMove) ui->_lblOperationName->setText("Moving files..."); else assert(false); connect (ui->_btnCancel, SIGNAL(clicked()), SLOT(cancelPressed())); connect (ui->_btnBackground, SIGNAL(clicked()), SLOT(background())); connect (ui->_btnPause, SIGNAL(clicked()), SLOT(pauseResume())); setWindowTitle(ui->_lblOperationName->text()); _eventsProcessTimer.setInterval(100); _eventsProcessTimer.start(); connect(&_eventsProcessTimer, SIGNAL(timeout()), SLOT(processEvents())); _performer->setWatcher(this); _performer->start(); }
void level::playStick() { vector2D current_speed; current_speed=(playerShip->get_speed()); static wwvi_js_event js_state; static bool use_flag = false; static bool brake_flag = true; static bool boost_flag = true; js_state.button[9]=0; //start button if (get_joystick_status(&js_state)==0) { double out = 0; if (js_state.button[9]) { pauseResume(); } if (js_state.button[7]) { use_flag = true; playerShip->accelerate(); } else if (js_state.button[6]==1) { use_flag = true; playerShip->decelerate(); } else if (js_state.button[5] && boost_flag) { use_flag = true; playerShip->turbo_boost(); boost_flag = false; } else if (!js_state.button[5] && ! boost_flag) { use_flag = true; playerShip->e_brake(); boost_flag = true; } else if (js_state.button[4] && brake_flag) { use_flag = true; playerShip->e_brake(); brake_flag = false; } else if (!js_state.button[4] && ! brake_flag) { use_flag = true; playerShip->turbo_boost(); brake_flag = true; } else if (use_flag) { playerShip->release_acc(); } double newAngle=playerShip->get_angle(); double newX = (double) js_state.stick1_x; double newY = (double) js_state.stick1_y; if (newX != 0) { jX = newX; } if (newY != 0) { jY = -newY; } if (jX > 0) { newAngle = atan(jY/jX); playerShip->set_angle(newAngle); } else if (jX < 0 ) { newAngle = M_PI+atan(jY/jX); playerShip->set_angle(newAngle); } else { if (jY != 0) { newAngle = ((jY > 0) ? -1 : ((jY < 0) ? 1 : 0) )*atan(M_PI/2); playerShip->set_angle(newAngle); } } out = (double) js_state.stick2_x; if (out != 0) { mX = out; } out = (double) js_state.stick2_y; if (out != 0) { mY = -out; } } }