Пример #1
0
// -----------------------------------------------------------------------------
// Exit the preview window
// -----------------------------------------------------------------------------
void TTCutPreview::exitPreview()
{
  QString   rm_command = "rm ";
  QString   file_name  = "preview*";
  QFileInfo file_info;

  if ( !isPlaying ) {
    // clean up preview* files in temp directory
    file_info.setFile( QDir(TTCut::tempDirPath), file_name );
    rm_command += file_info.absoluteFilePath();
    rm_command += " 2>/dev/null";

    system( rm_command.toAscii().data());

    releaseKeyboard();
    
    done( 0 );
  } else {
    if(stopMPlayer()) {
      releaseKeyboard();
      done(0);
    } else {
      qDebug( "Cant't exit, mplayer still running ???" );
    }
  }
}
void EventPropertyWidgetQt::keyReleaseEvent(QKeyEvent* event) {
    if (keyMatcher_ && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)) {
        releaseKeyboard();
        eventproperty_->setEventMatcher(std::unique_ptr<EventMatcher>(keyMatcher_->clone()));
        setButtonText();
        button_->setEnabled(true);
    } else if (keyMatcher_ && event->key() == Qt::Key_Escape) {
        releaseKeyboard();
        setButtonText();
        button_->setEnabled(true);
    } else {
        QWidget::keyReleaseEvent(event);
    }
}
Пример #3
0
void ColorPickerWidget::closeEventFilter()
{
    m_filterActive = false;
    releaseMouse();
    releaseKeyboard();
    removeEventFilter(this);
}
Пример #4
0
void QuickButton::mouseMoveEvent(QMouseEvent *e)
{
    if((e->state() & LeftButton) == 0)
        return;
    QPoint p(e->pos() - _dragPos);
    if(p.manhattanLength() <= KGlobalSettings::dndEventDelay())
        return;
    DEBUGSTR << "dragstart" << endl << flush;
    setDown(false);
    if(_dragEnabled)
    {
        KURL::List uris;
        uris.append(_qurl->kurl());
        DEBUGSTR << "creating KURLDrag" << endl << flush;
        KURLDrag *dd = new KURLDrag(uris, this);
        dd->setPixmap(_icon); // PIX
        DEBUGSTR << "ready to drag" << endl << flush;
        grabKeyboard();
        dd->drag();
        releaseKeyboard();
    }
    else
    {
        setCursor(Qt::ForbiddenCursor);
    }
}
Пример #5
0
void PixelWidget::keyPressEvent(QKeyEvent *e)
{
    switch (e->key()) {
    case Qt::Key_Plus:
        increaseZoom();
        break;
    case Qt::Key_Minus:
        decreaseZoom();
        break;
    case Qt::Key_PageUp:
        setGridSize(m_gridSize + 1);
        break;
    case Qt::Key_PageDown:
        setGridSize(m_gridSize - 1);
        break;
    case Qt::Key_G:
        toggleGrid();
        break;
    case Qt::Key_C:
        if (e->modifiers() & Qt::ControlModifier)
            copyToClipboard();
        break;
    case Qt::Key_S:
        if (e->modifiers() & Qt::ControlModifier) {
            releaseKeyboard();
            saveToFile();
        }
        break;
    case Qt::Key_Control:
        grabKeyboard();
        break;
    }
}
Пример #6
0
		void EditSingleShortcut::stopRecording_()
		{
			if(is_recording_) {
				releaseKeyboard();
				is_recording_ = false;
			}
		}
Пример #7
0
bool HotkeyWidget::event(QEvent *event)
{
    if (event->type() == QEvent::LanguageChange) {
        setHotkeyText();
    } else if (event->type() == QEvent::KeyPress) {
        keyPressEvent(static_cast<QKeyEvent *>(event));
        return true;
    } else if (event->type() == QEvent::FocusIn) {
        QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event);

        if (focusEvent->reason() != Qt::TabFocusReason) {
            setText(tr("Type your hotkey"));
            mKeyboardFocus = false;
            grabKeyboard();
        } else {
            mKeyboardFocus = true;
        }
    } else if (event->type() == QEvent::FocusOut) {
        if (text() == tr("Invalid hotkey")) {
            emit invalidHotkeyError();
            showError();
        }

        releaseKeyboard();
        setHotkeyText(); // Reset the text
    } else if ((event->type() == QEvent::KeyPress || event->type() == QEvent::ShortcutOverride || event->type() == QEvent::Shortcut) && hasFocus()) {
        event->accept();
        return true;
    }

    return QPushButton::event(event);
}
Пример #8
0
void QKeyButton::endGrab()
{
    if (!m_bGrab) return;
    m_bGrab = false;
    releaseKeyboard();
    releaseMouse();
}
Пример #9
0
void MainWindow::fullScreenMode(bool mode)
{
    isFullScreenMouse = mode;
    if(mode)
    {

        _toolbar->hide();
        menuBar()->hide();
        //setWindowFlags(Qt::FramelessWindowHint);
        //showMaximized();
        showFullScreen();
        grabKeyboard();

    }
    else
    {

        _toolbar->show();
        menuBar()->show();
        //	setWindowFlags((Qt::WindowFlags)(~Qt::FramelessWindowHint));
        showNormal();
        releaseKeyboard();
    }
    show();
}
Пример #10
0
void MainWindow::toggleFullscreen()
{
    if (fullScreen_)
    {
        fullScreen_ = false;
        fsGlWidget_->showNormal();
        fsGlWidget_->hide();
        releaseKeyboard();
        mainGlWidget_->makeCurrent();
//		mainGlWidget_->show();
    }
    else
    {
        fullScreen_ = true;
        grabKeyboard();
//		mainGlWidget_->hide();
        fsGlWidget_->makeCurrent();
        fsGlWidget_->showFullScreen();
        int numScreens = QApplication::desktop()->numScreens();
        if (numScreens >= 2)
        {
            // Two Screens used by output widget
            QRect s2 = QApplication::desktop()->screenGeometry(0);
            s2 = s2.united(QApplication::desktop()->screenGeometry(1));
            fsGlWidget_->setGeometry(s2);
        }
    }
}
Пример #11
0
int WProcess::execute(const QString &command,
    const QStringList &arguments,
    const QString &title,
    bool close_when_finished)
{
  grabKeyboard();
  setWindowTitle(title);
  connect(cmd_p,SIGNAL(readyReadStandardOutput()),this,SLOT(readyReadStandardOutput()));
  connect(cmd_p,SIGNAL(readyReadStandardError()),this,SLOT(readyReadStandardError()));
  connect(cmd_p,SIGNAL(error(QProcess::ProcessError )),this,SLOT(error(QProcess::ProcessError )));
  connect(cmd_p,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(finished(int,QProcess::ExitStatus)));
  close_p->setText(tr("Cancel"));
  text_p->clear();
  status_p->setText(tr("Executing %1 ...").arg(command));
  cmd_p->start(command,arguments);
  returned_code=-1;
  if (cmd_p->waitForStarted())
  {
    status_p->setText(tr("%1 is running").arg(command));
    this->close_when_finished=close_when_finished;

    if (! exec() )
      returned_code=-1;
  }

  releaseKeyboard();
  stdout_p=NULL;
  return returned_code;
}
Пример #12
0
void IOWindow::OnDetectButtonPressed()
{
  installEventFilter(BlockUserInputFilter::Instance());
  grabKeyboard();
  grabMouse();

  std::thread([this] {
    auto* btn = m_type == IOWindow::Type::Input ? m_detect_button : m_test_button;
    const auto old_label = btn->text();

    btn->setText(QStringLiteral("..."));

    const auto expr = MappingCommon::DetectExpression(
        m_reference, g_controller_interface.FindDevice(m_devq).get(), m_devq,
        MappingCommon::Quote::Off);

    btn->setText(old_label);

    if (!expr.isEmpty())
    {
      const auto list = m_option_list->findItems(expr, Qt::MatchFixedString);

      if (list.size() > 0)
        m_option_list->setCurrentItem(list[0]);
    }

    releaseMouse();
    releaseKeyboard();
    removeEventFilter(BlockUserInputFilter::Instance());
  })
      .detach();
}
Пример #13
0
void KeyButton::keyPressEvent(QKeyEvent *keyEvent) {
	std::string keyText = QKeyUtil::keyName(keyEvent);
	if (keyEvent->key() == Key_Return) {
	    grabKeyboard();
	    return;
	}
	if (keyEvent->key() == Key_Up ||
	    keyEvent->key() == Key_Down) {
	    clearFocus();
	    releaseKeyboard();
	    return;
	}

	if (!keyText.empty()) {
		myKeyView.myCurrentKey = keyText;
		myKeyView.myLabel->setText("Action For " + QString::fromUtf8(keyText.c_str()));
		myKeyView.myLabel->show();
#if 0
    QSizePolicy pol = myKeyView.myLabel->sizePolicy();
    pol.setHorData(QSizePolicy::Fixed);
    myKeyView.myLabel->setSizePolicy(pol);
    myKeyView.myLabel->setLineWidth(80);
    pol = myKeyView.myComboBox->sizePolicy();
    pol.setHorData(QSizePolicy::Fixed);
    myKeyView.myComboBox->setSizePolicy(pol);
#endif
		myKeyView.myComboBox->setCurrentItem(((ZLKeyOptionEntry*)myKeyView.myOption)->actionIndex(keyText));
		myKeyView.myComboBox->show();
	}
}
void ShutdownManager::hideEvent(QHideEvent *e)
{
    releaseKeyboard();
    m_hotZoneInterface->EnableZoneDetected(true);

    QWidget::hideEvent(e);
}
Пример #15
0
void Calibrate::reset()
{
    penPos = QPoint();
    location = QWSPointerCalibrationData::TopLeft;
    crossPos = fromDevice( cd.screenPoints[location] );
    releaseMouse();
    releaseKeyboard();
}
Пример #16
0
void ColorSelector::keyReleaseEvent ( QKeyEvent * e )
{
  if (e->key() == mHotKey) {
    mCtrlPressed = false;
    releaseKeyboard();
  }
  emit (keyRelease(e));
}
Пример #17
0
// -----------------------------------------------------------------------------
// Stop the current playing preview
// -----------------------------------------------------------------------------
void TTCutPreview::stopPreview()
{
  // release the keyboard, so other widgets can receive keyboard input
  releaseKeyboard();

  if ( !stopMPlayer() )
    qDebug( "No playing preview ???" );
}
Пример #18
0
void imodvObjedForm::keyReleaseEvent( QKeyEvent * e )
{
  if (e->key() == hotSliderKey()) {
    imodvObjedCtrlKey(false);
    releaseKeyboard();
  }
  imodvKeyRelease(e);
}
Пример #19
0
void PreferencesDialog::cancelSetAccelKey() {
    if( grabAccelKeyFor != NULL ) {
        KeyActionListViewItem* ka = (KeyActionListViewItem*)grabAccelKeyFor;
        ka->updateText();
        grabAccelKeyFor = NULL;
        releaseKeyboard();
    }
}
Пример #20
0
// pass on key release; watch for hot slider release
void ImodvImage::keyReleaseEvent ( QKeyEvent * e )
{
  if (e->key() == hotSliderKey()) {
    mCtrlPressed = false;
    releaseKeyboard();
  }
  imodvKeyRelease(e);
}
Пример #21
0
void ContSurfPoint::keyReleaseEvent( QKeyEvent * e )
{
  if (e->key() == hotSliderKey()) {
    mCtrlPressed = false;
    releaseKeyboard();
  }
  ivwControlKey(1, e);
}
Пример #22
0
void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
    Q_D(QWidget);
    d->aboutToDestroy();
    if (!isWindow() && parentWidget())
        parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));

    d->deactivateWidgetCleanup();
    if (testAttribute(Qt::WA_WState_Created)) {
        setAttribute(Qt::WA_WState_Created, false);
        QObjectList childObjects =  children();
        for (int i = 0; i < childObjects.size(); ++i) {
            QObject *obj = childObjects.at(i);
            if (obj->isWidgetType())
                static_cast<QWidget*>(obj)->destroy(destroySubWindows,
                                                     destroySubWindows);
        }
        releaseMouse();
        if (qt_pressGrab == this)
          qt_pressGrab = 0;

        if (keyboardGrb == this)
            releaseKeyboard();
        if (testAttribute(Qt::WA_ShowModal))                // just be sure we leave modal
            QApplicationPrivate::leaveModal(this);
        else if ((windowType() == Qt::Popup))
            qApp->d_func()->closePopup(this);
#ifndef QT_NO_IM
        if (d->ic) {
            delete d->ic;
            d->ic =0;
        } else {
            // release previous focus information participating with
            // preedit preservation of qic -- while we still have a winId
            QInputContext *qic = QApplicationPrivate::inputContext;
            if (qic)
                qic->widgetDestroyed(this);
        }
#endif //QT_NO_IM

        if ((windowType() == Qt::Desktop)) {
        } else {
            if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) {
                d->hide_sys();
            }
            if (destroyWindow && isWindow()) {
                if (d->extra && d->extra->topextra && d->extra->topextra->backingStore)
                    d->extra->topextra->backingStore->windowSurface->setGeometry(QRect());
                qwsDisplay()->destroyRegion(internalWinId());
            }
        }
        QT_TRY {
            d->setWinId(0);
        } QT_CATCH (const std::bad_alloc &) {
            // swallow - destructors must not throw
        }
    }
}
Пример #23
0
void VirtualKeyboardQt::hide()
{
    releaseKeyboard();

    if (m_parentEdit)
        m_parentEdit->setFocus();

    MythDialog::hide();
}
Пример #24
0
//
// Set the mode (Design/Operate)
//
void VirtualConsole::slotModeChanged()
{
    QString config;

    //
    // Key repeat
    //
    _app->settings()->get(KEY_VIRTUAL_CONSOLE_KEYREPEAT, config);
    if (config == Settings::trueValue())
    {
        Display* display;
        display = XOpenDisplay(NULL);
        ASSERT(display != NULL);

        if (_app->mode() == App::Design)
        {
            XAutoRepeatOn(display);
        }
        else
        {
            XAutoRepeatOff(display);
        }

        XCloseDisplay(display);
    }

    //
    // Grab keyboard
    //
    _app->settings()->get(KEY_VIRTUAL_CONSOLE_GRABKB, config);
    if (config == Settings::trueValue())
    {
        if (_app->mode() == App::Design)
        {
            releaseKeyboard();
        }
        else
        {
            grabKeyboard();
        }
    }

    if (_app->mode() == App::Operate)
    {
        // Don't allow editing in operate mode
        m_editMenu->setEnabled(false);
        m_addMenu->setEnabled(false);
        m_toolsMenu->setItemEnabled(KVCMenuToolsSettings, false);
    }
    else
    {
        // Allow editing in design mode
        m_editMenu->setEnabled(true);
        m_addMenu->setEnabled(true);
        m_toolsMenu->setItemEnabled(KVCMenuToolsSettings, true);
    }
}
Пример #25
0
void GameView::disableInputHandling()
{
	m_isInputHandling = false;
	releaseMouse();
	releaseKeyboard();
	setMouseTracking(false);
	unsetCursor();
	m_editor->getEngine().getInputSystem().enable(false);
}
Пример #26
0
 void KeyActionSettingsWidget::ungrab()
 {
     if(grabbing_)
     {
         grabbing_ = false;
         releaseKeyboard();
         keyLabel->setText(key.name().c_str());
     }
 }
Пример #27
0
void ScreenSelector::release()
{
    QApplication::instance()->removeEventFilter(m_eventFilter);
    releaseMouse();
    releaseKeyboard();
    MAIN.setCursor(Qt::ArrowCursor);
    m_selectionInProgress = false;
    hide();
}
Пример #28
0
void RemoteView::focusOutEvent(QFocusEvent *event)
{
    if (m_grabAllKeys || m_keyboardIsGrabbed) {
        m_keyboardIsGrabbed = false;
        releaseKeyboard();
    }

    QWidget::focusOutEvent(event);
}
Пример #29
0
void PixelWidget::keyReleaseEvent(QKeyEvent *e)
{
    switch(e->key()) {
    case Qt::Key_Control:
        releaseKeyboard();
        break;
    default:
        break;
    }
}
Пример #30
0
// ...
void GLWidget::disableTracking()
{
	// If current cursor is the click cursor, update mouse cursor (POP on the cursor stack).
	if (cursor().shape() == cursorClick.shape()) { unsetCursor(); }
	// Deactivate mouse tracking even while not clicking.
	setMouseTracking(false);
	// Deactivate keyboard tracking.
	flagGrabKeyboard = false;
	releaseKeyboard(); // Using a private flag since this call seems not working!
}