KoToolDocker::KoToolDocker(QWidget *parent) : QDockWidget(QObject::tr("Tool Options"), parent), d(new Private(this)) { setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::TopDockWidgetArea); //KConfigGroup cfg = KGlobal::config()->group("DockWidget sharedtooldocker"); QSettings cfg("QCalligra", QCoreApplication::applicationName()); cfg.beginGroup("DockWidget sharedtooldocker"); d->tabbed = cfg.value("TabbedMode", false).toBool(); cfg.endGroup(); toggleViewAction()->setVisible(false); //should always be visible, so hide option in menu setFeatures(DockWidgetMovable|DockWidgetFloatable); setTitleBarWidget(new KoDockWidgetTitleBar(this)); connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea )), this, SLOT(locationChanged(Qt::DockWidgetArea))); d->housekeeperWidget = new QWidget(); d->housekeeperLayout = new QGridLayout(); d->housekeeperWidget->setLayout(d->housekeeperLayout); d->housekeeperLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); d->hiderWidget = new QWidget(d->housekeeperWidget); d->hiderWidget->setVisible(false); d->scrollArea = new QScrollArea(); d->scrollArea->setWidget(d->housekeeperWidget); d->scrollArea->setFrameShape(QFrame::NoFrame); d->scrollArea->setWidgetResizable(true); d->scrollArea->setFocusPolicy(Qt::NoFocus); setWidget(d->scrollArea); d->tabButton = new QToolButton(this); // parent hack in toggleLock to keep it clickable d->tabButton->setIcon(d->tabIcon); d->tabButton->setToolTip(QObject::tr("Toggles organising the options in tabs or not")); d->tabButton->setAutoRaise(true); connect(d->tabButton, SIGNAL(clicked()), SLOT(toggleTab())); d->tabButton->resize(d->tabButton->sizeHint()); }
CLobbyScreen::CLobbyScreen(ESelectionScreen screenType) : CSelectionBase(screenType), bonusSel(nullptr) { OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; tabSel = std::make_shared<SelectionTab>(screenType); curTab = tabSel; auto initLobby = [&]() { tabSel->callOnSelect = std::bind(&IServerAPI::setMapInfo, CSH, _1, nullptr); buttonSelect = std::make_shared<CButton>(Point(411, 80), "GSPBUTT.DEF", CGI->generaltexth->zelp[45], 0, SDLK_s); buttonSelect->addCallback([&]() { toggleTab(tabSel); CSH->setMapInfo(tabSel->getSelectedMapInfo()); }); buttonOptions = std::make_shared<CButton>(Point(411, 510), "GSPBUTT.DEF", CGI->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabOpt), SDLK_a); }; buttonChat = std::make_shared<CButton>(Point(619, 83), "GSPBUT2.DEF", CGI->generaltexth->zelp[48], std::bind(&CLobbyScreen::toggleChat, this), SDLK_h); buttonChat->addTextOverlay(CGI->generaltexth->allTexts[532], FONT_SMALL); switch(screenType) { case ESelectionScreen::newGame: { tabOpt = std::make_shared<OptionsTab>(); tabRand = std::make_shared<RandomMapTab>(); tabRand->mapInfoChanged += std::bind(&IServerAPI::setMapInfo, CSH, _1, _2); buttonRMG = std::make_shared<CButton>(Point(411, 105), "GSPBUTT.DEF", CGI->generaltexth->zelp[47], 0, SDLK_r); buttonRMG->addCallback([&]() { toggleTab(tabRand); tabRand->updateMapInfoByHost(); // TODO: This is only needed to force-update mapInfo in CSH when tab is opened }); card->iconDifficulty->addCallback(std::bind(&IServerAPI::setDifficulty, CSH, _1)); buttonStart = std::make_shared<CButton>(Point(411, 535), "SCNRBEG.DEF", CGI->generaltexth->zelp[103], std::bind(&CLobbyScreen::startScenario, this, false), SDLK_b); initLobby(); break; } case ESelectionScreen::loadGame: { tabOpt = std::make_shared<OptionsTab>(); buttonStart = std::make_shared<CButton>(Point(411, 535), "SCNRLOD.DEF", CGI->generaltexth->zelp[103], std::bind(&CLobbyScreen::startScenario, this, false), SDLK_l); initLobby(); break; } case ESelectionScreen::campaignList: tabSel->callOnSelect = std::bind(&IServerAPI::setMapInfo, CSH, _1, nullptr); buttonStart = std::make_shared<CButton>(Point(411, 535), "SCNRLOD.DEF", CButton::tooltip(), std::bind(&CLobbyScreen::startCampaign, this), SDLK_b); break; } buttonStart->assignedKeys.insert(SDLK_RETURN); buttonBack = std::make_shared<CButton>(Point(581, 535), "SCNRBACK.DEF", CGI->generaltexth->zelp[105], [&]() { CSH->sendClientDisconnecting(); close(); }, SDLK_ESCAPE); }