void WindowsManager::restore(const SessionMainWindow &session) { if (session.windows.isEmpty()) { open(); } else { for (int i = 0; i < session.windows.count(); ++i) { Window *window = new Window(m_isPrivate, NULL, m_mdi); window->setSession(session.windows.at(i)); addWindow(window); } } m_isRestored = true; connect(SessionsManager::getInstance(), SIGNAL(requestedRemoveStoredUrl(QString)), this, SLOT(removeStoredUrl(QString))); connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(setActiveWindow(int))); connect(m_tabBar, SIGNAL(requestedClone(int)), this, SLOT(cloneWindow(int))); connect(m_tabBar, SIGNAL(requestedDetach(int)), this, SLOT(detachWindow(int))); connect(m_tabBar, SIGNAL(requestedPin(int,bool)), this, SLOT(pinWindow(int,bool))); connect(m_tabBar, SIGNAL(requestedClose(int)), this, SLOT(closeWindow(int))); connect(m_tabBar, SIGNAL(requestedCloseOther(int)), this, SLOT(closeOther(int))); setActiveWindow(session.index); }
void KuickShow::viewerDeleted() { ImageWindow *viewer = (ImageWindow*) sender(); s_viewers.remove( viewer ); if ( viewer == m_viewer ) m_viewer = 0L; if ( !haveBrowser() && s_viewers.isEmpty() ) { saveSettings(); FileCache::shutdown(); ::exit(0); } else if ( haveBrowser() ) { setActiveWindow(); // This setFocus() call causes problems in the combiview (always the // directory view on the left gets the focus, which is not desired) // fileWidget->setFocus(); } if ( fileWidget ) // maybe a slideshow was stopped --> enable the action again fileWidget->actionCollection()->action("kuick_slideshow")->setEnabled( true ); m_slideTimer->stop(); }
bool App::loadXML(const QDomDocument& doc) { Q_ASSERT(m_doc != NULL); QDomElement root = doc.documentElement(); if (root.tagName() != KXMLQLCWorkspace) { qWarning() << Q_FUNC_INFO << "Workspace node not found"; return false; } QString activeWindowName = root.attribute(KXMLQLCWorkspaceWindow); QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCEngine) { m_doc->loadXML(tag); } else if (tag.tagName() == KXMLQLCVirtualConsole) { VirtualConsole::instance()->loadXML(tag); } else if (tag.tagName() == KXMLQLCSimpleDesk) { SimpleDesk::instance()->loadXML(tag); } else if (tag.tagName() == KXMLFixture) { /* Legacy support code, nowadays in Doc */ Fixture::loader(tag, m_doc); } else if (tag.tagName() == KXMLQLCFunction) { /* Legacy support code, nowadays in Doc */ Function::loader(tag, m_doc); } else if (tag.tagName() == KXMLQLCCreator) { /* Ignore creator information */ } else { qWarning() << Q_FUNC_INFO << "Unknown Workspace tag:" << tag.tagName(); } node = node.nextSibling(); } // Perform post-load operations VirtualConsole::instance()->postLoad(); // Set the active window to what was saved in the workspace file setActiveWindow(activeWindowName); return true; }
/*! Reimplemented to produce the Xt effect of getting focus when the mouse enters the widget. <em>This may be changed.</em> */ bool KXtWidget::x11Event( XEvent * e ) { if ( e->type == EnterNotify ) { if ( xtparent ) setActiveWindow(); } return QWidget::x11Event( e ); }
/** Quits the game and returns to the main menu. This event is prompted when the menu button is clicked. */ void onMainMenuClick(GuiButton* button) { // Create new window and set it as active GuiWindow* mainMenu = createMainMenu(); if (NULL == mainMenu) g_guiError = true; // Raise flag if an error occured, main loop will respond accordingly setActiveWindow(mainMenu); // Switch to main menu window }
void SlamDriver::changeWindowKey(bool isSpecial, unsigned char key) { int idx = (key-'0')-1; if(idx < 0) idx = 10; if(idx >= (int)mWindows.size()) idx = mWindows.size()-1; setActiveWindow(mWindows[idx].get()); }
bool CFrmSettings::loadGraph(MdiChild * m) { if (graph) { agclose(graph); graph = NULL; } graphData.clear(); graphData.append(m->toPlainText()); setActiveWindow(m); return true; }
void QWidget::raise() { QWidget *p = parentWidget(); if ( p && p->childObjects && p->childObjects->findRef(this) >= 0 ) p->childObjects->append( p->childObjects->take() ); if ( isTopLevel() ) { #ifdef QT_NO_WINDOWGROUPHINT if ( !testWFlags( WStyle_Tool ) ) setActiveWindow(); qwsDisplay()->setAltitude( winId(), 0 ); #else QWidget* act=0; if ( !testWFlags( WStyle_Tool ) ) act=this; qwsDisplay()->setAltitude( winId(), 0 ); if ( childObjects ) { QObjectListIt it(*childObjects); QObject* o; QWidgetList toraise; QWidget* w; while ((o=it.current())) { if ( o->isWidgetType() ) { w = (QWidget*)o; if ( w->isTopLevel() ) toraise.append(w); } ++it; } QWidgetListIt wit(toraise); while ((w=wit.current())) { if ( w->isVisible() ) { bool wastool = w->testWFlags( WStyle_Tool ); w->setWFlags( WStyle_Tool ); // avoid setActiveWindow flicker w->raise(); if ( !wastool ) { w->clearWFlags( WStyle_Tool ); act = w; } } ++wit; } } if ( act ) act->setActiveWindow(); #endif // QT_NO_WINDOWGROUPHINT } else if ( p ) { p->setChildrenAllocatedDirty( geometry(), this ); paint_heirarchy( this, TRUE ); } }
GHOST_TSuccess GHOST_WindowManager::beginFullScreen(GHOST_IWindow *window, bool /*stereoVisual*/) { GHOST_TSuccess success = GHOST_kFailure; GHOST_ASSERT(window, "GHOST_WindowManager::beginFullScreen(): invalid window"); GHOST_ASSERT(window->getValid(), "GHOST_WindowManager::beginFullScreen(): invalid window"); if (!getFullScreen()) { m_fullScreenWindow = window; m_activeWindowBeforeFullScreen = getActiveWindow(); setActiveWindow(m_fullScreenWindow); m_fullScreenWindow->beginFullScreen(); success = GHOST_kSuccess; } return success; }
void App::startup() { #if defined(__APPLE__) || defined(Q_OS_MAC) createProgressDialog(); #endif init(); slotModeDesign(); slotDocModified(false); #if defined(__APPLE__) || defined(Q_OS_MAC) destroyProgressDialog(); #endif // Activate FixtureManager setActiveWindow(FixtureManager::staticMetaObject.className()); }
void WindowsManager::addWindow(Window *window, OpenHints hints) { if (!window) { return; } int index = ((!(hints & EndOpen) && SettingsManager::getValue(QLatin1String("TabBar/OpenNextToActive")).toBool()) ? (m_tabBar->currentIndex() + 1) : m_tabBar->count()); if (!window->isPinned()) { const int offset = m_tabBar->getPinnedTabsAmount(); if (index < offset) { index = offset; } } m_tabBar->addTab(index, window); m_mdi->addWindow(window); if (!(hints & BackgroundOpen)) { m_tabBar->setCurrentIndex(index); if (m_isRestored) { setActiveWindow(index); } } connect(window, SIGNAL(titleChanged(QString)), this, SLOT(setTitle(QString))); connect(window, SIGNAL(requestedOpenUrl(QUrl,OpenHints)), this, SLOT(open(QUrl,OpenHints))); connect(window, SIGNAL(requestedOpenBookmark(BookmarksItem*,OpenHints)), this, SLOT(open(BookmarksItem*,OpenHints))); connect(window, SIGNAL(requestedSearch(QString,QString,OpenHints)), this, SLOT(search(QString,QString,OpenHints))); connect(window, SIGNAL(requestedAddBookmark(QUrl,QString)), this, SIGNAL(requestedAddBookmark(QUrl,QString))); connect(window, SIGNAL(requestedNewWindow(ContentsWidget*,OpenHints)), this, SLOT(openWindow(ContentsWidget*,OpenHints))); connect(window, SIGNAL(requestedCloseWindow(Window*)), this, SLOT(closeWindow(Window*))); emit windowAdded(index); }
GHOST_TSuccess GHOST_WindowManager::endFullScreen(void) { GHOST_TSuccess success = GHOST_kFailure; if (getFullScreen()) { if (m_fullScreenWindow != NULL) { //GHOST_PRINT("GHOST_WindowManager::endFullScreen(): deleting full-screen window\n"); setWindowInactive(m_fullScreenWindow); m_fullScreenWindow->endFullScreen(); delete m_fullScreenWindow; //GHOST_PRINT("GHOST_WindowManager::endFullScreen(): done\n"); m_fullScreenWindow = NULL; if (m_activeWindowBeforeFullScreen) { setActiveWindow(m_activeWindowBeforeFullScreen); } } success = GHOST_kSuccess; } return success; }
bool gMainWindow::doClose() { if (_closing) return false; if (opened) { if (isModal() && !gApplication::hasLoop(this)) return true; _closing = true; if (onClose) { if (!onClose(this)) opened = false; } else opened = false; _closing = false; if (!opened && isModal()) gApplication::exitLoop(this); } if (!opened) // && !modal()) { if (_active == this) setActiveWindow(NULL); if (!isModal()) { if (persistent) hide(); else destroy(); } return false; } else return opened; }
App::App() : QMainWindow() , m_tab(NULL) , m_progressDialog(NULL) , m_doc(NULL) , m_fileNewAction(NULL) , m_fileOpenAction(NULL) , m_fileSaveAction(NULL) , m_fileSaveAsAction(NULL) , m_modeToggleAction(NULL) , m_controlMonitorAction(NULL) , m_controlFullScreenAction(NULL) , m_controlBlackoutAction(NULL) , m_controlPanicAction(NULL) , m_helpIndexAction(NULL) , m_helpAboutAction(NULL) , m_toolbar(NULL) { QCoreApplication::setOrganizationName("qlcplus"); QCoreApplication::setOrganizationDomain("sf.net"); QCoreApplication::setApplicationName(APPNAME); #ifdef __APPLE__ createProgressDialog(); #endif init(); slotModeDesign(); slotDocModified(false); #ifdef __APPLE__ destroyProgressDialog(); #endif // Activate FixtureManager setActiveWindow(FixtureManager::staticMetaObject.className()); }
string Container::getState() { clearWndConfig(); string windows; list<UserWnd*> userWnds = m_tabBar->windows(); for (list<UserWnd*>::iterator it = userWnds.begin(); it != userWnds.end(); ++it){ if (!windows.empty()) windows += ','; windows += number((*it)->id()); setWndConfig((*it)->id(), (*it)->getConfig().c_str()); } setWindows(windows.c_str()); UserWnd *userWnd = m_tabBar->currentWnd(); if (userWnd) setActiveWindow(userWnd->id()); saveGeometry(this, data.geometry); saveToolbar(m_bar, data.barState); if (m_tabBar->isVisible()) setStatusSize(m_status->width()); return save_data(containerData, &data); }
KomposeGLViewWidget::KomposeGLViewWidget( int displayType , KomposeLayout *l ) : AbstractViewWidget( 0, l, 0 ) { m_menu = KomposeGlobal::self()->getViewMenu(); m_glWidget = new KomposeGLWidget(this,displayType,l); QDesktopWidget deskwidget; if (KomposeSettings::self()->viewScreen() == -1) { setGeometry( deskwidget.availableGeometry( this ) ); } else { QRect deskRect = deskwidget.availableGeometry(KomposeSettings::self()->viewScreen()); setGeometry(deskRect); } setActiveWindow(); // Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool | Qt::WPaintUnclipped | Qt::WNoAutoErase KWin::setType(winId(), NET::Dock); KWin::setOnAllDesktops( winId(), true ); }
KomposeFullscreenWidget::KomposeFullscreenWidget( int displayType, KomposeLayout *l ) : AbstractViewWidget( 0, l ) { // if ( QT_VERSION < 0x030300 ) /* use showMaximized instead of setWindowState to make it compile on qt 3.1 or whatever */ // showMaximized(); // KWin::setState( winId(), NET::KeepAbove ); // Set Desktop background as our background setBackgroundMode( Qt::FixedPixmap ); // setBackgroundPixmap(*(KomposeGlobal::self()->getDesktopBgPixmap())); rootpix = new KRootPixmap (this); rootpix->start(); m_menu = KomposeGlobal::self()->getViewMenu(); initView(); // Alternate showFullscreen setWindowState(windowState() | WindowFullScreen); if (KomposeSettings::self()->viewScreen() == -1) setGeometry( KGlobalSettings::desktopGeometry( this ) ); else { QDesktopWidget deskwidget; QRect deskRect = deskwidget.screenGeometry(KomposeSettings::self()->viewScreen()); setGeometry(deskRect); kdDebug() << deskRect << endl; } if (!isTopLevel()) QApplication::sendPostedEvents(this, QEvent::ShowFullScreen); setActiveWindow(); KWin::setOnAllDesktops( winId(), true ); }
void WindowManager::showConversation(const QString &localUid, const QString &remoteUid, unsigned type) { Q_UNUSED(type); QMetaObject::invokeMethod(mRootObject, "showConversation", Q_ARG(QVariant, localUid), Q_ARG(QVariant, remoteUid)); setActiveWindow(); }
void WindowManager::showGroupsWindow() { QMetaObject::invokeMethod(mRootObject, "showGroupsList"); setActiveWindow(); }
void QWidget::setWindowState(uint newstate) { in_show_maximized = 1; bool resized = testWFlags( WState_Resized ); uint oldstate = effectiveState(widget_state); widget_state &= ~(WState_Minimized | WState_Maximized | WState_FullScreen); if (newstate & WindowMinimized) widget_state |= WState_Minimized; if (newstate & WindowMaximized) widget_state |= WState_Maximized; if (newstate & WindowFullScreen) widget_state |= WState_FullScreen; uint state = effectiveState(widget_state); bool needShow = FALSE; if (isTopLevel() && state != oldstate) { createTLExtra(); if ( oldstate == 0 ) { //normal topData()->normalGeometry = geometry(); } else if ( oldstate == WState_FullScreen ) { reparent( 0, topData()->savedFlags, QPoint(0,0) ); needShow = isVisible(); } else if ( oldstate == WState_Minimized ) { needShow = TRUE; } if ( state == WState_Minimized ) { //### not ideal... hide(); needShow = FALSE; } else if ( state == WState_FullScreen ) { needShow = needShow || isVisible(); topData()->savedFlags = getWFlags(); reparent( 0, WType_TopLevel | WStyle_Customize | WStyle_NoBorder | // preserve some widget flags (getWFlags() & 0xffff0000), QPoint( 0, 0)); const QRect screen = qApp->desktop()->screenGeometry( qApp->desktop()->screenNumber( this ) ); move( screen.topLeft() ); resize( screen.size() ); if ( !resized ) clearWState( WState_Resized ); raise(); } else if ( state == WState_Maximized ) { #ifndef QT_NO_QWS_MANAGER if ( extra && extra->topextra && extra->topextra->qwsManager ) extra->topextra->qwsManager->maximize(); else #endif setGeometry( qt_maxWindowRect ); if ( !resized ) clearWState( WState_Resized ); } else { //normal QRect r = topData()->normalGeometry; if ( r.width() >= 0 ) { topData()->normalGeometry = QRect(0,0,-1,-1); setGeometry( r ); } } } in_show_maximized = 0; if (needShow) show(); if (newstate & WindowActive) setActiveWindow(); QEvent e(QEvent::WindowStateChange); QApplication::sendEvent(this, &e); }
void ofxFensterManager::setupOpenGL(int w, int h, int screenMode) { primaryWindow=createFenster(0, 0, w, h, screenMode); ofSetCurrentRenderer(ofPtr<ofBaseRenderer>(new ofGLRenderer)); setActiveWindow(primaryWindow); }
//---------------------------------------------------------------------------- void WorldViewWindowManager::setActiveWindowIndex(size_t _index) { WorldViewWindow* window = getWindow(_index); setActiveWindow(window); }
void starter::popupMenu() { if (popupBlocked) return; { // if (!isDialog_) // return; startMenu->setMinimumSize ( 0, 0 ); startMenu->setMaximumSize ( 32767, 32767 ); setActiveWindow(); startMenu->setPanelPosition((StartMenu::PanelPosition)configDialog->popupPanelPos->currentItem()); if (configDialog->customPopupSize->isChecked()) { startMenu->resize(configDialog->popupW->value(),configDialog->popupH->value()); startMenu->setFixedSize(startMenu->size()); // startMenu->setFixedSize(_MAX_(configDialog->popupW->value(), startMenu->minimumWidth()), _MAX_(configDialog->popupH->value(), startMenu->minimumHeight())); } else { QRect desktop = QDesktopWidget().availableGeometry( startMenu ); startMenu->resize(desktop.width()/5, 2*desktop.height()/3); startMenu->setFixedSize(startMenu->size()); // startMenu->setFixedSize(_MAX_(startMenu->minimumWidth(), desktop.width()/5) ,_MAX_(startMenu->minimumHeight(), 2*desktop.height()/3)); // 1/5 screen width, 2/3 screen height } QPoint pt = mapToGlobal(pos()); QRect desktop = QDesktopWidget().availableGeometry( startMenu ); int x = pt.x(); int y = pt.y(); switch(position()) { case pTop: y += height() + 1; if (x + startMenu->width() > desktop.right()) x = desktop.right() - startMenu->width(); if (x < 0) x = 0; break; case pLeft: x += width() + 1; if (y + startMenu->height() > desktop.bottom()) y = desktop.bottom() - startMenu->height(); if (y < 0) y = 0; break; case pBottom: y -= startMenu->height() - 1; if (x + startMenu->width() > desktop.right()) x = desktop.right() - startMenu->width(); if (x < 0) x = 0; break; case pRight: x -= startMenu->width() - 1; if (y + startMenu->height() > desktop.bottom()) y = desktop.bottom() - startMenu->height(); if (y < 0) y = 0; } pt = QPoint(x, y); startMenu->reparent(this, Qt::WType_Popup, pt, true); } }
// Initialization for this application bool SlamDriver::init(void) { std::cout << "SlamDriver init." << std::endl; #ifdef ENABLE_LOG std::cout << "Logging is enabled. This severely hits performance! It can be disabled in dtslam/log.h." << std::endl; #else std::cout << "Logging is disabled. See dtslam/log.h to enable it." << std::endl; #endif #ifdef ENABLE_PROFILER std::cout << "Profiling is enabled.\n"; #else std::cout << "Profiling is disabled. See dtslam/Profiler.h to enable it.\n"; #endif Profiler::Instance().setCurrentThreadName("render"); char glogstr[] = "dtslam"; google::InitGoogleLogging(glogstr); if (!initImageSrc()) { DTSLAM_LOG << "Couldn't initialize image source.\n"; return false; } // Initialize Shader if (!mShaders.init()) { DTSLAM_LOG << "Couldn't initialize shaders.\n"; return false; } //Determine downscale at input int width = mImageSrc->getSourceSize().width; mDownsampleInputCount = 0; while(width > FLAGS_DriverMaxImageWidth) { width = (width+1)/2; mDownsampleInputCount++; } int scale = 1<<mDownsampleInputCount; mImageSrc->setDownsample(mDownsampleInputCount); mImageSize = mImageSrc->getSize(); DTSLAM_LOG << "Input image size after downsampling: " << mImageSize << "\n"; //Check size vs calibration cv::Size expectedSize(FLAGS_CameraWidth/scale, FLAGS_CameraHeight/scale); if(mImageSize.width != expectedSize.width || mImageSize.height != expectedSize.height) { DTSLAM_LOG << "Warning: image size " << mImageSize << " does not match calibration size " << expectedSize << "\n"; } //Get first frame if(!mImageSrc->update()) { DTSLAM_LOG << "Couldn't get first frame from image source.\n"; return false; } //Init camera mCamera.reset(new CameraModel()); mCamera->init((float)FLAGS_CameraFx / scale, (float)FLAGS_CameraFy / scale, (float)FLAGS_CameraU0 / scale, (float)FLAGS_CameraV0 / scale, FLAGS_CameraWidth / scale, FLAGS_CameraHeight / scale); mCamera->getDistortionModel().init((float)FLAGS_CameraK1, (float)FLAGS_CameraK2); mCamera->getDistortionModel().setMaxRadius(mCamera->getMaxRadiusSq(mImageSize)); mCamera->initLUT(); //Slam system cv::Mat1b imageGray = mImageSrc->getImgGray(); cv::Mat3b imageColor = mImageSrc->getImgColor(); mSlam.init(mCamera.get(), mImageSrc->getCaptureTime(), imageColor, imageGray); mSlam.setSingleThreaded(FLAGS_DriverSingleThreaded); //Add windows mWindows.push_back(std::unique_ptr<BaseWindow>(new MatchesWindow())); mWindows.push_back(std::unique_ptr<BaseWindow>(new MapExpanderWindow())); mWindows.push_back(std::unique_ptr<BaseWindow>(new MapWindow())); mWindows.push_back(std::unique_ptr<BaseWindow>(new KeyFramePairWindow())); mWindows.push_back(std::unique_ptr<BaseWindow>(new ARWindow())); mWindows.push_back(std::unique_ptr<BaseWindow>(new TestMatchWindow())); mWindows.push_back(std::unique_ptr<BaseWindow>(new FrameLinkWindow())); //Add bindings mKeyBindings.addBinding(true,GLUT_KEY_F5,static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::runVideo),"Run the video stream."); mKeyBindings.addBinding(true, GLUT_KEY_F8, static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::saveMap), "Save the map to disk."); mKeyBindings.addBinding(true, GLUT_KEY_F9, static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::loadMap), "Load the map from disk."); mKeyBindings.addBinding(false, ' ', static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::stepVideo), "Advance one frame."); mKeyBindings.addBinding(false,'p',static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::toggleProfilerMode),"Toggle profiler mode."); mKeyBindings.addBinding(false,'P',static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::resetProfiler),"Reset profiler counts."); mKeyBindings.addBinding(false,'r',static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::resetSystem),"Reset the slam system."); mKeyBindings.addBinding(false,'R',static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::startRecording),"Reset and start recording."); mKeyBindings.addBinding(true,GLUT_KEY_F1,static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::resyncTracker),"Resyncs the tracker with/without 2D matches."); for(int i=0; i<(int)mWindows.size(); ++i) mKeyBindings.addBinding(false,i+'1',static_cast<KeyBindingHandler<SlamDriver>::BindingFunc>(&SlamDriver::changeWindowKey),"Show window: " + mWindows[i]->getName()); mKeyBindings.addBinding(false,27,static_cast<KeyBindingHandler<SlamDriver>::SimpleBindingFunc>(&SlamDriver::escapePressed),"Quit."); DTSLAM_LOG << "\nBasic keys:\n"; mKeyBindings.showHelp(); setActiveWindow(mWindows[0].get()); setARCube(cv::Point3f(0, 0,10), cv::Point3f(0.1, 0, 0), cv::Point3f(0, 0.1, 0), cv::Point3f(0, 0, 0.1)); //disableARCube(); glEnable(GL_POINT_SMOOTH); glEnable(GL_LINE_SMOOTH); mFPS = 0; mLastFPSCheck = std::chrono::high_resolution_clock::now(); mFPSUpdateDuration = std::chrono::duration_cast<std::chrono::high_resolution_clock::duration>(std::chrono::seconds(1)); mFPSSampleAccum = std::chrono::high_resolution_clock::duration(0); mFPSSampleCount = 0; mInitialized = true; return true; }
void X11Wnd::onMouseMove(void) { // Make sure input events are redirected to this window setActiveWindow(this); }