void EditViewBase::windowActivationChange(bool /* oldState */) { if (isActiveWindow()) { emit windowActivated(); } }
void MixerWindow::windowActivationChange(bool) { if (isActiveWindow()) { emit windowActivated(); sendControllerRefresh(); } }
bool QWorkspace::qt_emit( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->signalOffset() ) { case 0: windowActivated((QWidget*)static_QUType_ptr.get(_o+1)); break; default: return QWidget::qt_emit(_id,_o); } return TRUE; }
void KviMainWindow::changeEvent(QEvent * e) { #ifndef COMPILE_ON_MAC // For Qt5 this should be used to minimize to tray if( (e->type() == QEvent::WindowStateChange) && (windowState() & Qt::WindowMinimized) && KVI_OPTION_BOOL(KviOption_boolMinimizeInTray) && e->spontaneous()) { if(!trayIcon()) { executeInternalCommand(KVI_INTERNALCOMMAND_TRAYICON_SHOW); } if(trayIcon()) { QWindowStateChangeEvent * ev = (QWindowStateChangeEvent *)e; KVI_OPTION_BOOL(KviOption_boolFrameIsMaximized) = ev->oldState() & Qt::WindowMaximized; QTimer::singleShot(0, this, SLOT(hide())); } return; } #endif if(e->type() == QEvent::ActivationChange) { //WINDOW (DE)ACTIVATION // if we have just been activated by the WM // then update the active window task bar item // It will then reset its highlight state // and hopefully make the dock widget work correctly // in this case. // This will also trigger the OnWindowActivated event :) if(isActiveWindow()) { if(g_pActiveWindow) windowActivated(g_pActiveWindow, true); } else { if(g_pActiveWindow) g_pActiveWindow->lostUserFocus(); } } KviTalMainWindow::changeEvent(e); }
PlaYUVerApp::PlaYUVerApp() : m_pcCurrentSubWindow( NULL ), m_pcCurrentVideoSubWindow( NULL ), m_pcAboutDialog( NULL ) { setWindowModality( Qt::ApplicationModal ); setWindowModality( Qt::NonModal ); // DBus #ifdef USE_QTDBUS m_pDBusAdaptor = new PlaYUVerAppAdaptor( this ); #endif m_pcWindowHandle = new PlaYUVerSubWindowHandle( this ); m_appModuleVideo = new VideoHandle( this, m_pcWindowHandle ); m_appModuleQuality = new QualityHandle( this, m_pcWindowHandle ); m_appModuleExtensions = new ModulesHandle( this, m_pcWindowHandle, m_appModuleVideo ); createActions(); createToolBars(); createDockWidgets(); createMenus(); createStatusBar(); updateMenus(); readSettings(); setWindowTitle( QApplication::applicationName() ); setWindowIcon( QIcon( ":/images/playuver.png" ) ); setUnifiedTitleAndToolBarOnMac( true ); setCentralWidget( m_pcWindowHandle ); setAcceptDrops( true ); setBackgroundRole( QPalette::Background ); connect( m_pcWindowHandle, SIGNAL( windowActivated() ), this, SLOT( update() ) ); connect( m_pcWindowHandle, SIGNAL( changed() ), this, SLOT( update() ) ); connect( m_appModuleVideo, SIGNAL( changed() ), this, SLOT( update() ) ); connect( m_appModuleQuality, SIGNAL( changed() ), this, SLOT( update() ) ); connect( m_appModuleExtensions, SIGNAL( changed() ), this, SLOT( update() ) ); }
bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event) { if (!event->spontaneous()) return false; switch (event->type()) { case QEvent::WindowActivate: emit windowActivated(target, true); break; case QEvent::WindowDeactivate: emit windowActivated(target, false); break; case QEvent::KeyPress: case QEvent::KeyRelease: { QKeyEvent *keyEvent = static_cast <QKeyEvent *>(event); QSpiDeviceEvent de; if (event->type() == QEvent::KeyPress) de.type = QSPI_KEY_EVENT_PRESS; else de.type = QSPI_KEY_EVENT_RELEASE; de.id = keyEvent->nativeVirtualKey(); de.hardwareCode = keyEvent->nativeScanCode(); de.modifiers = keyEvent->nativeModifiers(); de.timestamp = QDateTime::currentMSecsSinceEpoch(); if (keyEvent->key() == Qt::Key_Tab) de.text = QStringLiteral("Tab"); else if (keyEvent->key() == Qt::Key_Backtab) de.text = QStringLiteral("Backtab"); else if (keyEvent->key() == Qt::Key_Left) de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Left") : QStringLiteral("Left"); else if (keyEvent->key() == Qt::Key_Right) de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Right") : QStringLiteral("Right"); else if (keyEvent->key() == Qt::Key_Up) de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Up") : QStringLiteral("Up"); else if (keyEvent->key() == Qt::Key_Down) de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Down") : QStringLiteral("Down"); else if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) de.text = QStringLiteral("Return"); else if (keyEvent->key() == Qt::Key_Backspace) de.text = QStringLiteral("BackSpace"); else if (keyEvent->key() == Qt::Key_Delete) de.text = QStringLiteral("Delete"); else if (keyEvent->key() == Qt::Key_PageUp) de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Page_Up") : QStringLiteral("Page_Up"); else if (keyEvent->key() == Qt::Key_PageDown) de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Page_Up") : QStringLiteral("Page_Down"); else if (keyEvent->key() == Qt::Key_Home) de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_Home") : QStringLiteral("Home"); else if (keyEvent->key() == Qt::Key_End) de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? QStringLiteral("KP_End") : QStringLiteral("End"); else if (keyEvent->key() == Qt::Key_Clear && (keyEvent->modifiers() & Qt::KeypadModifier)) de.text = QStringLiteral("KP_Begin"); // Key pad 5 else if (keyEvent->key() == Qt::Key_Escape) de.text = QStringLiteral("Escape"); else if (keyEvent->key() == Qt::Key_Space) de.text = QStringLiteral("space"); else if (keyEvent->key() == Qt::Key_CapsLock) de.text = QStringLiteral("Caps_Lock"); else if (keyEvent->key() == Qt::Key_NumLock) de.text = QStringLiteral("Num_Lock"); else if (keyEvent->key() == Qt::Key_Insert) de.text = QStringLiteral("Insert"); else de.text = keyEvent->text(); // This is a bit dubious, Gnome uses some gtk function here. // Long term the spec will hopefully change to just use keycodes. de.isText = !de.text.isEmpty(); #ifdef KEYBOARD_DEBUG qDebug() << QStringLiteral("Key event text: ") << event->type() << de.isText << QStringLiteral(" ") << de.text << QStringLiteral(" hardware code: ") << de.hardwareCode << QStringLiteral(" native sc: ") << keyEvent->nativeScanCode() << QStringLiteral(" native mod: ") << keyEvent->nativeModifiers() << QStringLiteral("native virt: ") << keyEvent->nativeVirtualKey(); #endif QDBusMessage m = QDBusMessage::createMethodCall(QStringLiteral("org.a11y.atspi.Registry"), QStringLiteral("/org/a11y/atspi/registry/deviceeventcontroller"), QStringLiteral("org.a11y.atspi.DeviceEventController"), QStringLiteral("NotifyListenersSync")); m.setArguments(QVariantList() <<QVariant::fromValue(de)); // FIXME: this is critical, the timeout should probably be pretty low to allow normal processing int timeout = 100; bool sent = dbusConnection.callWithCallback(m, this, SLOT(notifyKeyboardListenerCallback(QDBusMessage)), SLOT(notifyKeyboardListenerError(QDBusError, QDBusMessage)), timeout); if (sent) { //queue the event and send it after callback keyEvents.enqueue(QPair<QObject*, QKeyEvent*> (target, copyKeyEvent(keyEvent))); #ifdef KEYBOARD_DEBUG qDebug() << QStringLiteral("Sent key: ") << de.text; #endif return true; } } default: break; } return false; }
void KviMainWindow::addWindow(KviWindow * wnd, bool bShow) { m_pWinList->append(wnd); wnd->createWindowListItem(); // create the window WindowList item AFTER it has been constructed QString group; wnd->getConfigGroupName(group); bool bDefaultDocking = false; if(g_pWinPropertiesConfig->hasGroup(group)) { g_pWinPropertiesConfig->setGroup(group); } else if(wnd->type() == KviWindow::Channel && g_pWinPropertiesConfig->hasGroup(group = wnd->windowName())) { // try to load pre-4.2 channel settings g_pWinPropertiesConfig->setGroup(group); } else { if(g_pWinPropertiesConfig->hasGroup(wnd->typeString())) { g_pWinPropertiesConfig->setGroup(wnd->typeString()); } else { g_pWinPropertiesConfig->setGroup("no_settings_group"); wnd->loadProperties(g_pWinPropertiesConfig); // load it anyway (will set defaults if windows don't remember properties) bDefaultDocking = true; // no settings stored } } wnd->loadProperties(g_pWinPropertiesConfig); // load it anyway (will set defaults if windows don't remember properties) if(KVI_OPTION_BOOL(KviOption_boolWindowsRememberProperties) && !bDefaultDocking) { bool bDocked = g_pWinPropertiesConfig->readBoolEntry("IsDocked", true); if(bDocked) { // when group settings are used, we always cascade the windows // this means that windows that have no specialized config group name // are always cascaded : this is true for consoles, queries (and other windows) but not channels (and some other windows) // FIXME: Since the introduction of QMdiArea cascading (and positioning of windows in general) no longer works dockWindow(wnd); wnd->triggerCreationEvents(); if(bShow) { m_pWindowStack->showAndActivate(wnd); // Handle the special case of this top level widget not being the active one. // In this situation the child will not get the focusInEvent // and thus will not call out windowActivated() method if(!isActiveWindow()) windowActivated(wnd); } } else { wnd->triggerCreationEvents(); if(bShow) wnd->show(); wnd->youAreUndocked(); if(bShow) { wnd->raise(); wnd->setFocus(); } } } else { dockWindow(wnd); wnd->triggerCreationEvents(); if(bShow) { m_pWindowStack->showAndActivate(wnd); // Handle the special case of this top level widget not being the active one. // In this situation the child will not get the focusInEvent // and thus will not call out windowActivated() method if(!isActiveWindow()) windowActivated(wnd); } } // we like to have an active window.. but don't trigger the events until it is really shown if(!g_pActiveWindow) { g_pActiveWindow = wnd; m_pActiveContext = wnd->context(); } }
void KviMainWindow::closeWindow(KviWindow * wnd) { if(wnd->inherits("KviConsoleWindow")) { if(consoleCount() <= 1) { KVS_TRIGGER_EVENT_0(KviEvent_OnFrameWindowDestroyed, wnd); KVS_TRIGGER_EVENT_0(KviEvent_OnKVIrcShutdown, wnd); } } // notify the destruction wnd->triggerDestructionEvents(); // save it's properties if(KVI_OPTION_BOOL(KviOption_boolWindowsRememberProperties)) // && (wnd->type() == KviWindow::Channel)) { QString group; wnd->getConfigGroupName(group); // not uses default settings : store it always saveWindowProperties(wnd, group); } // forget it... m_pWinList->removeRef(wnd); #if 0 // hide it if(wnd->parentWidget()) wnd->mdiParent()->hide(); else wnd->hide(); #endif if(wnd == g_pActiveWindow) { if(!g_pApp->kviClosingDown()) { qDebug("Have no active window: trying to pick one"); // this happens when there are only minimized windows in the Mdi area // just pick another window to be the active one bool bGotIt = false; for(KviWindow * pOther = m_pWinList->first(); pOther; pOther = m_pWinList->next()) { if(wnd != pOther) { windowActivated(pOther); bGotIt = true; break; } } if(!bGotIt) { // :/ g_pActiveWindow = nullptr; m_pActiveContext = nullptr; } } else { g_pActiveWindow = nullptr; m_pActiveContext = nullptr; } } // and shut it down... // KviWindow will call childWindowDestroyed() here if(wnd->isDocked()) { //this deletes the wnd, too m_pWindowStack->destroyWindow(wnd); } else { delete wnd; } }
void HaikuWindowProxy::WindowActivated(bool activated) { Q_EMIT windowActivated(activated); }
bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event) { if (!event->spontaneous()) return false; switch (event->type()) { case QEvent::WindowActivate: { emit windowActivated(target, true); break; case QEvent::WindowDeactivate: emit windowActivated(target, false); break; } case QEvent::KeyPress: case QEvent::KeyRelease: { QKeyEvent *keyEvent = static_cast <QKeyEvent *>(event); QSpiDeviceEvent de; if (event->type() == QEvent::KeyPress) de.type = QSPI_KEY_EVENT_PRESS; else de.type = QSPI_KEY_EVENT_RELEASE; de.id = keyEvent->nativeVirtualKey(); de.hardwareCode = keyEvent->nativeScanCode(); de.modifiers = keyEvent->nativeModifiers(); de.timestamp = QDateTime::currentMSecsSinceEpoch(); // FIXME: how to generate key strings? // FIXME: localize? if (keyEvent->key() == Qt::Key_Tab) { de.text = "Tab"; } else if (keyEvent->key() == Qt::Key_Backtab) { de.text = "Backtab"; } else if (keyEvent->key() == Qt::Key_Left) { de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? "KP_Left" : "Left"; } else if (keyEvent->key() == Qt::Key_Right) { de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? "KP_Right" : "Right"; } else if (keyEvent->key() == Qt::Key_Up) { de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? "KP_Up" : "Up"; } else if (keyEvent->key() == Qt::Key_Down) { de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? "KP_Down" : "Down"; } else if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) { de.text = "Return"; } else if (keyEvent->key() == Qt::Key_Backspace) { de.text = "BackSpace"; } else if (keyEvent->key() == Qt::Key_Delete) { de.text = "Delete"; } else if (keyEvent->key() == Qt::Key_PageUp) { de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? "KP_Page_Up" : "Page_Up"; } else if (keyEvent->key() == Qt::Key_PageDown) { de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? "KP_Page_Up" : "Page_Down"; } else if (keyEvent->key() == Qt::Key_Home) { de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? "KP_Home" : "Home"; } else if (keyEvent->key() == Qt::Key_End) { de.text = (keyEvent->modifiers() & Qt::KeypadModifier) ? "KP_End" : "End"; } else if (keyEvent->key() == Qt::Key_Clear && (keyEvent->modifiers() & Qt::KeypadModifier)) { de.text = "KP_Begin"; // Key pad 5 } else if (keyEvent->key() == Qt::Key_Escape) { de.text = "Escape"; } else if (keyEvent->key() == Qt::Key_Space) { de.text = "space"; } else if (keyEvent->key() == Qt::Key_CapsLock) { de.text = "Caps_Lock"; } else if (keyEvent->key() == Qt::Key_NumLock) { de.text = "Num_Lock"; } else if (keyEvent->key() == Qt::Key_Insert) { de.text = "Insert"; } else { de.text = keyEvent->text(); } // "F1", "F2", "F3", "F4", "F5", "F6", // "F7", "F8", "F9", "F10", "F11", "F12" // FIXME de.isText = !de.text.isEmpty(); #ifdef KEYBOARD_DEBUG qDebug() << "Key event text: " << event->type() << de.isText << " " << de.text << " hardware code: " << de.hardwareCode << " native sc: " << keyEvent->nativeScanCode() << " native mod: " << keyEvent->nativeModifiers() << "native virt: " << keyEvent->nativeVirtualKey(); #endif QDBusMessage m = QDBusMessage::createMethodCall("org.a11y.atspi.Registry", "/org/a11y/atspi/registry/deviceeventcontroller", "org.a11y.atspi.DeviceEventController", "NotifyListenersSync"); m.setArguments(QVariantList() <<QVariant::fromValue(de)); // FIXME: this is critical, the timeout should probably be pretty low to allow normal processing int timeout = 300; bool sent = dbusConnection.callWithCallback(m, this, SLOT(notifyKeyboardListenerCallback(QDBusMessage)), SLOT(notifyKeyboardListenerError(QDBusError, QDBusMessage)), timeout); if (sent) { //queue the event and send it after callback keyEvents.enqueue(QPair<QObject*, QKeyEvent*> (target, copyKeyEvent(keyEvent))); return true; } } default: break; } return false; }
void PhoneUiHouseHoldPrivate::ConstructL() { new( ELeave ) CPhoneLogger( KUidPhoneUILoggerSingleton ); FeatureManager::InitializeLibL(); HbTranslator *translator = new HbTranslator(QString("telephone")); if (translator) { translator->loadCommon(); m_translators.append(translator); } HbTranslator *translator2 = new HbTranslator(QString("telephone_cp")); if (translator2) { m_translators.append(translator2); } PhoneUIQtView *view = new PhoneUIQtView(m_window); iViewAdapter = new PhoneUIQtViewAdapter(*view); iPhoneUIController = CPhoneUIController::NewL(iViewAdapter); iViewAdapter->setEngineInfo(iPhoneUIController->EngineInfo()); m_window.addView (view); m_window.setCurrentView (view); m_window.scene ()->setFocusItem (view); iKeyEventAdapter = new PhoneUIKeyEventAdapter (*iPhoneUIController); iCommandAdapter = new PhoneUiCommandAdapter (*iPhoneUIController); QObject::connect(view, SIGNAL(dialpadIsAboutToClose()), iViewAdapter, SLOT(dialpadClosed())); QObject::connect(view, SIGNAL(keyReleased(QKeyEvent *)), iViewAdapter, SLOT(keyReleased (QKeyEvent *))); QObject::connect(view, SIGNAL(keyPressed (QKeyEvent *)), iKeyEventAdapter, SLOT(keyPressed (QKeyEvent *))); QObject::connect(view, SIGNAL(keyReleased (QKeyEvent *)), iKeyEventAdapter, SLOT(keyReleased (QKeyEvent *))); QObject::connect(view, SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int)), Qt::QueuedConnection); // async to enable deletion of widget during signal handling QObject::connect(view, SIGNAL(windowActivated()), iViewAdapter, SLOT(handleWindowActivated())); QObject::connect(view, SIGNAL(windowDeactivated()), iViewAdapter, SLOT(handleWindowDeactivated())); QObject::connect(&m_window, SIGNAL(focusLost()),iViewAdapter, SLOT(onFocusLost())); QObject::connect(&m_window, SIGNAL(focusGained()),iViewAdapter, SLOT(onFocusGained())); QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int))); // Disable default Send key functionality in application framework // avkon removal // CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()); // appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | // CAknAppUiBase::EDisableSendKeyLong ); // CLI Name. TInt err = RProperty::Define( KPSUidTelRemotePartyInformation, KTelCLIName, RProperty::EText, KPhoneReadPolicy, KPhoneWritePolicy ); // CLI Number. err = RProperty::Define( KPSUidTelRemotePartyInformation, KTelCLINumber, RProperty::EText, KPhoneReadPolicy, KPhoneWritePolicy ); // Startup event signalling // Define the telephony application system property err = RProperty::Define( KPSUidTelInformation, KTelPhoneUid, RProperty::EInt, KPhoneReadPolicy, KPhoneWritePolicy ); // DefineNewPSKeys: // UID: KPSUidTelInternalInformation: err = RProperty::Define( KPSUidTelInternalInformation, KTelRemotePartyContactInfo, RProperty::EByteArray, KPhoneReadPolicy, KPhoneWritePolicy ); // VT UID. err = RProperty::Define( KPSUidTelInternalInformation, KTelVideoCallUid, RProperty::EInt, KPhoneReadPolicy, KPhoneWritePolicy ); // TELINTERNALPSKEY CHANGE // Move to AudioHandling // UID: KPSUidTelAudioPreference // Call Audio Routing err = RProperty::Define( KPSUidTelAudioPreference, KTelAudioOutput, RProperty::EInt, KPhoneReadPolicyAlwaysPass, KPhoneWritePolicy ); // UID: KPSUidNEInformation err = RProperty::Define( KPSUidNEInformation, KTelNumberEntryInfo, RProperty::EInt, KPhoneReadPolicyAlwaysPass, KPhoneWritePolicy ); // Add DoStartupSignalL to the recovery system iStartupSignalRecoveryId = CPhoneRecoverySystem::Instance()->AddL( TCallBack( DoStartupSignalL, this ), CTeleRecoverySystem::EPhonePriorityHigh, CTeleRecoverySystem::EPhoneStateIdle ); // Call DoStartupSignalL within recovery system const TInt startupState = CPhonePubSubProxy::Instance()->Value( KPSUidStartup, KPSGlobalSystemState ); PHONE_DEBUG2("phoneui::main() startupState value=", startupState ); if ( startupState == ESwStateCriticalPhaseOK || startupState == ESwStateEmergencyCallsOnly || startupState == ESwStateNormalRfOn || startupState == ESwStateNormalRfOff || startupState == ESwStateNormalBTSap ) { PHONE_DEBUG("phoneui::main() Notify Starter that phone is ready..."); CPhoneRecoverySystem::Instance()->RecoverNow( iStartupSignalRecoveryId, CTeleRecoverySystem::EPhonePriorityHigh ); } else { PHONE_DEBUG("phoneui::main() Startup not ready yet. Start listening..."); CPhonePubSubProxy::Instance()->NotifyChangeL( KPSUidStartup, KPSGlobalSystemState, this ); } if ( err == KErrNone || err == KErrAlreadyExists ) { // Indicate to the system that the Phone has been started CPhonePubSubProxy::Instance()->ChangePropertyValue( KPSUidTelInformation, KTelPhoneUid, KUidPhoneApplication.iUid ); } // Update the Apps ready flag iAppsReady += EPhoneStartedUp; HbMainWindow *main = hbInstance->allMainWindows().at(0); RWindow *win = static_cast<RWindow *>(main->effectiveWinId()->DrawableWindow()); CEikonEnv* env = CEikonEnv::Static(); if ( env ) { env->SetSystem(ETrue); // Blacklist singleton is initialized here CPhoneClearBlacklist::CreateL( env->WsSession(), *win); } }