static PyObject *mouse_toggle(PyObject *self, PyObject *args) { PyObject *downBool; MMMouseButton button = LEFT_BUTTON; if (!PyArg_ParseTuple(args, "O!|I", &PyBool_Type, &downBool, &button)) { return NULL; } if (!MMMouseButtonIsValid(button)) { PyErr_SetString(PyExc_ValueError, "Invalid mouse button"); return NULL; } toggleMouse(downBool == Py_True, button); Py_RETURN_NONE; }
INLINE void clickMouse(MMMouseButton button) { toggleMouse(true, button); toggleMouse(false, button); }
bool MainWindow::eventFilter(QObject *obj, QEvent *event) { if (obj == this && event->type() == QEvent::Hide) { qDebug() << "Event:" << "Hide"; if (_muteOnMinimize) { _muteOnMinimizeCurrent = ui->actionMute->isChecked(); ui->actionMute->setChecked(true); } } else if (obj == this && event->type() == QEvent::Show) { qDebug() << "Event:" << "Show"; if (_rememberGui && _posX && _posY) { move(_posX, _posY); _posX = 0; _posY = 0; } if (_muteOnMinimize) { ui->actionMute->setChecked(_muteOnMinimizeCurrent); } } else if (event->type() == QEvent::MouseMove) { toggleMouse(true); if (ui->actionFullscreen->isChecked()) { QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); showOsd(mouseEvent->globalPos()); } if (obj == _mediaPlayer->video() && ui->actionFullscreen->isChecked()) { _mouseTimer->start(1000); } } else if (obj == _mediaPlayer->video() && event->type() == QEvent::MouseButtonDblClick) { toggleMouse(true); qDebug() << "Event:" << "Double click"; ui->actionFullscreen->trigger(); } else if (obj == _mediaPlayer->video() && event->type() == QEvent::MouseButtonPress) { toggleMouse(true); qDebug() << "Event:" << "Click"; QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); switch (mouseEvent->button()) { case Qt::RightButton: _rightMenu->exec(mouseEvent->globalPos()); break; case Qt::NoButton: default: break; } } else if (obj == _mediaPlayer->video() && event->type() == QEvent::Wheel) { toggleMouse(true); qDebug() << "Event:" << "Wheel"; QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event); bool wheel = wheelEvent->delta() > 0; if (_wheelType == "volume") { _mediaPlayer->osd()->volumeSlider()->volumeControl(wheel); } else { _select->channel(wheel); } } return QMainWindow::eventFilter(obj, event); }
connect(_mediaPlayer, SIGNAL(vout(int)), this, SLOT(showVideo(int))); connect(_mediaPlayer, SIGNAL(sessionChannel(int)), _playlistTab->playlist(), SLOT(channelSelected(int))); connect(ui->actionRecorder, SIGNAL(triggered(bool)), this, SLOT(showRecorder())); connect(ui->actionRecordNow, SIGNAL(toggled(bool)), this, SLOT(recordNow(bool))); connect(ui->actionSnapshot, SIGNAL(triggered()), _mediaPlayer, SLOT(takeSnapshot())); connect(_showInfoTab, SIGNAL(requestRecord(QString)), _xmltv, SLOT(requestProgrammeRecord(QString))); connect(_scheduleTab, SIGNAL(requestRecord(QString)), _xmltv, SLOT(requestProgrammeRecord(QString))); connect(_xmltv, SIGNAL(programmeRecord(XmltvProgramme *)), this, SLOT(recordProgramme(XmltvProgramme *))); connect(ui->actionRecordQuick, SIGNAL(triggered()), _recorder, SLOT(quickRecord())); connect(ui->actionRecordTimer, SIGNAL(triggered()), _recorder, SLOT(newTimer())); connect(_recorder, SIGNAL(play(Timer *)), this, SLOT(playRecording(Timer *))); connect(_mouseTimer, SIGNAL(timeout()), this, SLOT(toggleMouse())); qDebug() << "Initialised: Event connections"; } void MainWindow::createMenus() { _rightMenu = new QMenu(); _rightMenu->addAction(ui->actionPlay); _rightMenu->addAction(ui->actionStop); _rightMenu->addAction(ui->actionBack); _rightMenu->addAction(ui->actionNext); _rightMenu->addSeparator(); _rightMenu->addAction(ui->actionTop); _rightMenu->addAction(ui->actionLite); _rightMenu->addAction(ui->actionFullscreen);