bool MainWindow::eventFilter(QObject* receiver, QEvent* event) { if (receiver != ui_.editInput) return QMainWindow::eventFilter(receiver, event); if (event->type() != QEvent::KeyPress) return QMainWindow::eventFilter(receiver, event); const auto* press = static_cast<const QKeyEvent*>(event); const auto& input = ui_.editInput->text(); if (press->key() == Qt::Key_Backspace) { if (input.isEmpty()) { if (!line_.empty()) { const auto key = line_.back().key; line_.pop_back(); updateTranslation(); updateDictionary(key); ui_.editInput->setText(key); } return true; } return QMainWindow::eventFilter(receiver, event); } int wordindex = 0; switch (press->key()) { case Qt::Key_F1: wordindex = 1; break; case Qt::Key_F2: wordindex = 2; break; case Qt::Key_F3: wordindex = 3; break; case Qt::Key_F4: wordindex = 4; break; case Qt::Key_F5: wordindex = 5; break; case Qt::Key_F6: wordindex = 6; break; case Qt::Key_F7: wordindex = 7; break; case Qt::Key_F8: wordindex = 8; break; case Qt::Key_F9: wordindex = 9; break; case Qt::Key_F10: wordindex = 10; break; case Qt::Key_F11: wordindex = 11; break; case Qt::Key_F12: wordindex = 12; break; case Qt::Key_Space: wordindex = 1; break; } if (!wordindex) return QMainWindow::eventFilter(receiver, event); qDebug() << "List index: " << wordindex; qDebug() << "Input word: " << input; translate(wordindex-1, input); updateTranslation(); updateDictionary(""); ui_.editInput->clear(); return true; }
icqAccount::icqAccount(QString string, const QString &profile_name, QObject *parent) : QObject(parent) , icqUin(string) , m_profile_name(profile_name) , m_icq_plugin_system(IcqPluginSystem::instance()) { currentTrayStatus = false; statusTrayMenuExist = false; deleteingAccount = false; menuExist = false; firsTrayMessageIsShown = false; positionInStack = 1; currentXstatus = 0; statusIconIndex = 0; iAmConnected = false; thisIcqProtocol = new oscarProtocol(icqUin, m_profile_name, this); connect(thisIcqProtocol, SIGNAL(statusChanged(accountStatus)), this, SLOT(setStatusIcon(accountStatus))); connect(thisIcqProtocol, SIGNAL(statusChanged(accountStatus)), this, SLOT(onOscarStatusChanged(accountStatus))); connect(thisIcqProtocol, SIGNAL(accountConnected(bool)), this, SLOT(accountConnected(bool))); connect(thisIcqProtocol, SIGNAL(systemMessage(const QString &)), this, SLOT(systemMessage(const QString &))); connect(thisIcqProtocol, SIGNAL(userMessage(const QString &, const QString &, const QString &, userMessageType, bool)), this, SLOT(userMessage(const QString &, const QString &, const QString &, userMessageType, bool))); connect(thisIcqProtocol, SIGNAL(getNewMessage()), this, SIGNAL(getNewMessage())); connect(thisIcqProtocol, SIGNAL(readAllMessages()), this, SIGNAL(readAllMessages())); connect(thisIcqProtocol->getContactListClass(), SIGNAL(updateStatusMenu(bool)), this, SLOT(updateStatusMenu(bool))); connect(this, SIGNAL(updateTranslation()), thisIcqProtocol, SIGNAL(updateTranslation())); createIcons(); createStatusMenu(); chooseStatus = new QAction(currentIcon, icqUin, this); chooseStatus->setCheckable(true); connect ( chooseStatus, SIGNAL(triggered()), this, SLOT(emitChangeStatus())); loadAccountSettings(); QSettings settings(QSettings::NativeFormat, QSettings::UserScope, "qutim/qutim."+m_profile_name, "icqsettings"); configPath = settings.fileName().section('/', 0, -2); createMenuAccount(); m_restore_xstatus_num = -10; m_restore_status = restoreAccount; }
bool GHOST_NDOFManagerUnix::processEvents() { bool anyProcessed = false; if (m_available) { spnav_event e; #ifdef USE_FINISH_GLITCH_WORKAROUND bool motion_test = false; #endif while (spnav_poll_event(&e)) { switch (e.type) { case SPNAV_EVENT_MOTION: { /* convert to blender view coords */ GHOST_TUns64 now = m_system.getMilliSeconds(); const short t[3] = {(short)e.motion.x, (short)e.motion.y, (short)-e.motion.z}; const short r[3] = {(short)-e.motion.rx, (short)-e.motion.ry, (short)e.motion.rz}; updateTranslation(t, now); updateRotation(r, now); #ifdef USE_FINISH_GLITCH_WORKAROUND motion_test = true; #endif break; } case SPNAV_EVENT_BUTTON: GHOST_TUns64 now = m_system.getMilliSeconds(); updateButton(e.button.bnum, e.button.press, now); break; } anyProcessed = true; } #ifdef USE_FINISH_GLITCH_WORKAROUND if (motion_test_prev == true && motion_test == false) { GHOST_TUns64 now = m_system.getMilliSeconds(); const short v[3] = {0, 0, 0}; updateTranslation(v, now); updateRotation(v, now); anyProcessed = true; } motion_test_prev = motion_test; #endif } return anyProcessed; }
void icqAccount::onUpdateTranslation() { onlineAction->setText(tr("Online")); offlineAction->setText(tr("Offline")); ffcAction->setText(tr("Free for chat")); awayAction->setText(tr("Away")); naAction->setText(tr("NA")); occupiedAction->setText(tr("Occupied")); dndAction->setText(tr("DND")); invisibleAction->setText(tr("Invisible")); lunchAction->setText(tr("Lunch")); evilAction->setText(tr("Evil")); depressionAction->setText(tr("Depression")); atHomeAction->setText(tr("At Home")); atWorkAction->setText(tr("At Work")); customStatus->setText(tr("Custom status")); privacyStatus->setTitle(tr("Privacy status")); visibleForAll->setText(tr("Visible for all")); visibleForVis->setText(tr("Visible only for visible list")); notVisibleForInv->setText(tr("Invisible only for invisible list")); visibleForContact->setText(tr("Visible only for contact list")); invisibleForAll->setText(tr("Invisible for all")); emit updateTranslation(); }
void NAMESPACE::Trackball::update(uint x, uint y) { if (m_Locked) return; if (m_Status & TRANSLATING) updateTranslation(x, y); if (m_Status & ROTATING) updateRotation(x, y); if (m_Status & ZOOMING) updateZoom(x, y); }
void MainWindow::on_actionSimplified_triggered() { ui_.actionTraditional->setChecked(false); model_->toggleTraditional(false); updateTranslation(); }
void MainWindow::on_actionNewText_triggered() { ui_.editInput->clear(); ui_.editInput->setFocus(); line_.clear(); updateTranslation(); updateDictionary(""); }
void LangManager::updateTranslationsFromSettings() { QSettings settings; QString langBaseName = settings.value(TYM_PATH_LANGUAGE, TYM_DEFAULT_LANGUAGE).toString(); if(!langBaseName.isEmpty() && _langMap.contains(langBaseName)) { LOG_DEBUG(QString("\"%1\" found as preferred language in the settings").arg(langBaseName)); updateTranslation(langBaseName); } }
void MainWindow::on_tableView_doubleClicked(const QModelIndex& index) { const auto input = ui_.editInput->text(); if (input.isEmpty()) return; const auto row = index.row(); translate(row, input); updateTranslation(); updateDictionary(""); ui_.editInput->clear(); ui_.editInput->setFocus(); }
int HideToolWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: hideWidget((*reinterpret_cast< bool(*)>(_a[1]))); break; case 1: setVisible((*reinterpret_cast< bool(*)>(_a[1]))); break; case 2: updateTranslation(); break; default: ; } _id -= 3; } return _id; }
int ImagePoint::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: deletePointSignal(); break; case 1: stateChange(); break; case 2: updateTranslation(); break; default: ; } _id -= 3; } return _id; }
//---------------------------------------- void ofEasyCam::update(ofEventArgs & args){ viewport = getViewport(this->viewport); if(!bDistanceSet && bAutoDistance){ setDistance(getImagePlaneDistance(viewport), true); } if(bMouseInputEnabled){ if(events->getMousePressed()) prevMouse = glm::vec2(events->getMouseX(),events->getMouseY()); if (bDoRotate) { updateRotation(); }else if (bDoTranslate || bDoScrollZoom || bIsBeingScrolled) { updateTranslation(); bDoScrollZoom = false; } } }
//---------------------------------------- void ofEasyCam::update(ofEventArgs & args){ if(bMouseInputEnabled){ if(!bDistanceSet){ setDistance(getImagePlaneDistance(viewport), true); } rotationFactor = sensitivityRot * 180 / min(viewport.width, viewport.height); if (bMouseInputEnabled) { updateMouse(); } if (bDoRotate) { updateRotation(); }else if (bDoTranslate) { updateTranslation(); } } }
//---------------------------------------- void ofEasyCam::update(ofEventArgs & args){ if(!bDistanceSet && bAutoDistance){ setDistance(getImagePlaneDistance(viewport), true); } if(bMouseInputEnabled){ rotationFactor = sensitivityRot * 180 / min(viewport.width, viewport.height); if(ofGetMousePressed()) prevMouse = ofVec2f(ofGetMouseX(),ofGetMouseY()); if (bDoRotate) { updateRotation(); }else if (bDoTranslate || bDoScrollZoom) { updateTranslation(); bDoScrollZoom = false; } } }
PreferencesDialog::PreferencesDialog(QWidget *parent) : QDialog(parent), d(new PreferencesDialogPrivate) { Q_ASSERT(d); setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); splitter->setOpaqueResize(Config::instance()->opaqueResize()); splitter->setStretchFactor(0, 1); splitter->setStretchFactor(1, 10); categoryList->header()->hide(); initCategoryList(); initConnectionPage(); initServerPage(); initLookAndFeelPage(); initIconSetPage(); initLibraryPage(); initDirectoriesPage(); initPlaylistPage(); initStylePage(); initCoverArtPage(); initDynamicPlaylistPage(); initLanguagePage(); initNotificationsPage(); initShortcutPage(); initTagGuesserPage(); initTrayIconPage(); initLastFmPage(); updateTranslation(); categoryList->setCurrentItem(d->connectionItem); for (int i = 0; i < d->serverModel->columnCount(); i++) serverList->resizeColumnToContents(i); // set alternating QList<QAbstractItemView*> children = findChildren<QAbstractItemView*>(QString()); foreach(QObject *child, children) { if (!child->setProperty("alternatingRowColors", Config::instance()->alternatingRowColors())) qWarning("Couldn't set alternatingRowColors for object: %s", qPrintable(child->objectName())); } exec(); }
//---------------------------------------- void ofEasyCam::update(ofEventArgs & args){ if(!bDistanceSet && bAutoDistance){ setDistance(getImagePlaneDistance(viewport), true); } if(bMouseInputEnabled){ rotationFactor = sensitivityRot * 180 / min(viewport.width, viewport.height); if (bMouseInputEnabled) { updateMouse(); } if (bDoRotate) { // <>< # Added extra boolean bRotation. Now you can disable the camera rotation/oll with disableRotation() if(bRotation) updateRotation(); // updateRotation(); <-- PREVIOUS LINE }else if (bDoTranslate) { updateTranslation(); } } }
bool DampenedInput::update (float elapsedTime, Ibl::Vector3f& translation, Ibl::Vector3f& rotate, bool& updatecamerainput) { _elapsedTime = elapsedTime; Ibl::Vector3f ttrans = translation; Ibl::Vector3f trotate = rotate; bool userRotated = false; bool userTranslated = false; userRotated = updateRotation(rotate); userTranslated = updateTranslation(translation); if (!userRotated ) { continueRotation (_lastRotation.x, rotate.z, _lastRotation.x * _elapsedTime); continueRotation (_lastRotation.y, rotate.y, -(_lastRotation.y * _elapsedTime)); } bool translationEqual = (ttrans == translation); bool rotationEqual = (trotate == rotate); if ((translationEqual == false) || (rotationEqual == false)) { return true; } else { return false; } }
//---------------------------------------- void ofEasyCamExt::update(ofEventArgs & args) { if( isDoingMove ) { float tmpFraction = ofMap( ofGetElapsedTimef(), moveStartEndTimeParameters.getMin(), moveStartEndTimeParameters.getMax(), 0.0f, 1.0f ); if( tmpFraction >= 1.0f ) { isDoingMove = false; } tmpFraction = ofClamp( tmpFraction, 0.0f, 1.0f ); tmpFraction = EasingEquations::ease( tmpFraction, easeType ); ofVec3f newPos = positionEaseParameters.getMin().interpolate( positionEaseParameters.getMax(), tmpFraction ); //ofVec3f newLookAtDir = lookAtEaseParameters.getMin().interpolate( lookAtEaseParameters.getMax(), tmpFraction ); ofQuaternion newOrientation; newOrientation.slerp( tmpFraction, orientationEaseStart, orientationEaseEnd ); //resetTransform(); setPosition(newPos); //target.resetTransform(); //target.setPosition(newLookAtDir); //lookAt(target, getUpDir() ); setOrientation( newOrientation ); moveX = 0; moveY = 0; moveZ = 0; } else { if(!bDistanceSet && bAutoDistance) { setDistance(getImagePlaneDistance(viewport), true); } if(bMouseInputEnabled) { rotationFactor = sensitivityRot * 180 / min(viewport.width, viewport.height); if (bMouseInputEnabled) { updateMouse(); } if (bDoRotate) { updateRotation(); } else if (bDoTranslate) { updateTranslation(); } } if( dollyForwardKey != 0 ) { if( ofGetKeyPressed(dollyForwardKey) ) { dollyImpulse( -dollyImpulseAmount ); } } if( dollyBackwardKey != 0 ) { if( ofGetKeyPressed(dollyBackwardKey) ) { dollyImpulse( dollyImpulseAmount ); } } // if (bApplyInertia) { moveX *= drag; moveY *= drag; moveZ *= drag; if (ABS(moveX) <= minDifference && ABS(moveY) <= minDifference && ABS(moveZ) <= minDifference) { //bApplyInertia = false; bDoTranslate = false; } // } move((getXAxis() * moveX) + (getYAxis() * moveY) + (getZAxis() * moveZ)); } }
bool TrWindow::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: doneAndNext(); break; case 1: prev(); break; case 2: next(); break; case 3: recentFileActivated((int)static_QUType_int.get(_o+1)); break; case 4: setupRecentFilesMenu(); break; case 5: open(); break; case 6: save(); break; case 7: saveAs(); break; case 8: release(); break; case 9: print(); break; case 10: find(); break; case 11: findAgain(); break; case 12: replace(); break; case 13: newPhraseBook(); break; case 14: openPhraseBook(); break; case 15: closePhraseBook((int)static_QUType_int.get(_o+1)); break; case 16: editPhraseBook((int)static_QUType_int.get(_o+1)); break; case 17: printPhraseBook((int)static_QUType_int.get(_o+1)); break; case 18: manual(); break; case 19: revertSorting(); break; case 20: about(); break; case 21: aboutQt(); break; case 22: setupPhrase(); break; case 23: static_QUType_bool.set(_o,maybeSave()); break; case 24: updateCaption(); break; case 25: showNewScope((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 26: showNewCurrent((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 27: updateTranslation((const QString&)static_QUType_QString.get(_o+1)); break; case 28: updateFinished((bool)static_QUType_bool.get(_o+1)); break; case 29: toggleFinished((QListViewItem*)static_QUType_ptr.get(_o+1),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+2)),(int)static_QUType_int.get(_o+3)); break; case 30: prevUnfinished(); break; case 31: nextUnfinished(); break; case 32: findNext((const QString&)static_QUType_QString.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break; case 33: revalidate(); break; case 34: toggleGuessing(); break; case 35: focusSourceList(); break; case 36: focusPhraseList(); break; case 37: updateClosePhraseBook(); break; case 38: toggleStatistics(); break; case 39: updateStatistics(); break; default: return QMainWindow::qt_invoke( _id, _o ); } return TRUE; }