/** * @brief Display a simple message box and attempt to capture a window using the mouse */ void AddEditAutoProfileDialog::showCaptureHelpWindow() { #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (QApplication::platformName() == QStringLiteral("xcb")) { #endif QMessageBox *box = new QMessageBox(this); box->setText(tr("Please select a window by using the mouse. Press Escape if you want to cancel.")); box->setWindowTitle(tr("Capture Application Window")); box->setStandardButtons(QMessageBox::NoButton); box->setModal(true); box->show(); UnixCaptureWindowUtility *util = new UnixCaptureWindowUtility(); QThread *thread = new QThread(this); util->moveToThread(thread); connect(thread, SIGNAL(started()), util, SLOT(attemptWindowCapture())); connect(util, SIGNAL(captureFinished()), thread, SLOT(quit())); connect(util, SIGNAL(captureFinished()), box, SLOT(hide())); connect(util, SIGNAL(captureFinished()), this, SLOT(checkForGrabbedWindow()), Qt::QueuedConnection); connect(thread, SIGNAL(finished()), box, SLOT(deleteLater())); connect(util, SIGNAL(destroyed()), thread, SLOT(deleteLater())); thread->start(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) } #endif #endif }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) , _inProgress(false) { // Preload icons for faster switching iconMicrophone = new QIcon(":/images/microphone.png"); iconRecord = new QIcon(":/images/record.png"); iconProcess = new QIcon(":/images/process.png"); iconNetwork = new QIcon(":/images/network.png"); connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged())); #ifdef Q_WS_MAEMO_5 setAttribute(Qt::WA_Maemo5StackedWindow); setAttribute(Qt::WA_Maemo5AutoOrientation); #endif ui->setupUi(this); QAction * aboutAction = new QAction(tr("About EchoPrint"), this); connect(aboutAction, SIGNAL(triggered()), this, SLOT(on_echoNestButton_clicked())); ui->menuBar->addAction(aboutAction); nam = new QNetworkAccessManager(this); recorder = new RecorderMobility(this, DEFAULT_FILE); connect(recorder, SIGNAL(durationChanged(qint64)), this, SLOT(updateProgress(qint64))); connect(recorder, SIGNAL(error(QMediaRecorder::Error)), this, SLOT(displayErrorMessage())); connect(this, SIGNAL(captureFinished()), this, SLOT(processAudio())); connect(this, SIGNAL(resultReady(const EchoNestSong *)), this, SLOT(showResult(const EchoNestSong *))); #ifdef USE_LIBECHONEST Echonest::Config::instance()->setAPIKey(API_KEY.toLatin1()); #endif timer = new QTimer(this); timer->setSingleShot(true); connect(timer, SIGNAL(timeout()), this, SLOT(stopCapture())); }
void MainWindow::stopCapture(void) { recorder->stop(); emit(captureFinished()); }
void VideoFile::finish() { if (m_file.isOpened()){ m_file.release(); emit captureFinished(); } }