LauncherView::LauncherView(QWidget* parent) : Unity2DDeclarativeView(parent), m_superKeyPressed(false), m_superKeyHeld(false) { setTransparentBackground(QX11Info::isCompositingManagerRunning()); m_superKeyHoldTimer.setSingleShot(true); m_superKeyHoldTimer.setInterval(KEY_HOLD_THRESHOLD); connect(&m_superKeyHoldTimer, SIGNAL(timeout()), SLOT(updateSuperKeyHoldState())); connect(this, SIGNAL(superKeyTapped()), SLOT(toggleDash())); m_dconf_launcher = new QConf(LAUNCHER_DCONF_SCHEMA); connect(m_dconf_launcher, SIGNAL(superKeyEnableChanged(bool)), SLOT(updateSuperKeyMonitoring())); updateSuperKeyMonitoring(); /* Alt+F1 gives the keyboard focus to the launcher. */ Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier); connect(altF1, SIGNAL(pressed()), SLOT(forceActivateWindow())); /* Alt+F2 shows the dash with the commands lens activated. */ Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier); connect(altF2, SIGNAL(pressed()), SLOT(showCommandsLens())); /* Super+{n} for 0 ≤ n ≤ 9 activates the item with index (n + 9) % 10. */ for (Qt::Key key = Qt::Key_0; key <= Qt::Key_9; key = (Qt::Key) (key + 1)) { Hotkey* hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier); connect(hotkey, SIGNAL(pressed()), SLOT(forwardNumericHotkey())); hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier | Qt::ShiftModifier); connect(hotkey, SIGNAL(pressed()), SLOT(forwardNumericHotkey())); } }
HouseChoiceMenu::HouseChoiceMenu() : MenuBase() { currentHouseChoiceScrollPos = 0; // set up window int xpos = std::max(0,(screen->w - 640)/2); int ypos = std::max(0,(screen->h - 400)/2); setCurrentPosition(xpos,ypos,640,400); setTransparentBackground(true); setWindowWidget(&windowWidget); selectYourHouseLabel.setSurface(pGFXManager->getUIGraphic(UI_SelectYourHouseLarge), false); windowWidget.addWidget(&selectYourHouseLabel, Point(0,0), Point(100, 640)); // set up buttons house1Button.setOnClick(std::bind(&HouseChoiceMenu::onHouseButton, this, 0)); windowWidget.addWidget(&house1Button, Point(40,108), Point(168,182)); house2Button.setOnClick(std::bind(&HouseChoiceMenu::onHouseButton, this, 1)); windowWidget.addWidget(&house2Button, Point(235,108), Point(168,182)); house3Button.setOnClick(std::bind(&HouseChoiceMenu::onHouseButton, this, 2)); windowWidget.addWidget(&house3Button, Point(430,108), Point(168,182)); SDL_Surface* surf; SDL_Surface* surfPressed; surf = pGFXManager->getUIGraphic(UI_Herald_ArrowLeftLarge); surfPressed = pGFXManager->getUIGraphic(UI_Herald_ArrowLeftHighlightLarge); houseLeftButton.setSurfaces(surf, false, surf, false, surfPressed, false); houseLeftButton.setOnClick(std::bind(&HouseChoiceMenu::onHouseLeft, this)); houseLeftButton.setVisible(false); windowWidget.addWidget( &houseLeftButton, Point(320 - surf->w - 85, 360), Point(surf->w,surf->h)); surf = pGFXManager->getUIGraphic(UI_Herald_ArrowRightLarge); surfPressed = pGFXManager->getUIGraphic(UI_Herald_ArrowRightHighlightLarge); houseRightButton.setSurfaces(surf, false, surf, false, surfPressed, false); houseRightButton.setOnClick(std::bind(&HouseChoiceMenu::onHouseRight, this)); windowWidget.addWidget( &houseRightButton, Point(320 + 85, 360), Point(surf->w,surf->h)); updateHouseChoice(); }