void Document::selectNone() { if(m_canvas && m_canvas->selection()) { m_client->sendMessages(m_canvas->selection()->pasteToCanvas(m_toolctrl->activeLayer())); cancelSelection(); } }
void Document::undo() { if(!m_canvas) return; if(m_canvas->selection()) { cancelSelection(); } else { m_client->sendMessage(protocol::MessagePtr(new protocol::Undo(0, 0, 1))); } }
void GamePairs::mainGameLoop() { displayDelegate->showRound(round); displayDelegate->showBoard(); Card& cardFirst = displayDelegate->letUserChooseCard(cards()); Card& cardSecond = displayDelegate->letUserChooseCard(cards()); if (cardFirst.isSameCard(cardSecond)) return cancelSelection(cardFirst, cardSecond); if (tryTakeCards(cardFirst, cardSecond)) { displayDelegate->showCurrentPlayerSuccess(); } else { displayDelegate->showCurrentPlayerFail(); nextRound(); } }
bool GamePairs::tryTakeCards(Card& card1, Card& card2) { card1.setVisible(true); card2.setVisible(true); displayDelegate->showBoard(); std::this_thread::sleep_for(kPauseDuration); cancelSelection(card1, card2); if (!validChoice(card1, card2)) return false; player.incrementScore(); board.decreaseVisibleCardsCounter(); card1.removeFromBoard(); card2.removeFromBoard(); return true; }
ChooseServerDialog::ChooseServerDialog(QStringList * serverNames) { setWindowTitle("Choose Your Server"); setModal(true); QVBoxLayout* box = new QVBoxLayout(this); box->setMargin(50); box->setSpacing(25); serverList = new QListWidget(this); serverList->setSelectionMode(QAbstractItemView::SingleSelection); serverList->clear(); serverList->insertItems(0, (*serverNames)); label = new QLabel("Please choose the server from which you want to download the plugin", this); QPalette pal; pal.setColor(label->foregroundRole(), Qt::blue); label->setAutoFillBackground(true); label->setPalette(pal); QFont font; font.setBold(true); font.setPixelSize(12); label->setFont(font); cancel = new QPushButton("Cancel",this); ok = new QPushButton("Ok",this); connect(cancel,SIGNAL(clicked()),this,SLOT(cancelSelection())); connect(ok,SIGNAL(clicked()),this,SLOT(selectServer())); QHBoxLayout *boxButtons = new QHBoxLayout(this); boxButtons->addWidget(ok); boxButtons->addWidget(cancel); box->addWidget(label); box->addWidget(serverList); box->addLayout(boxButtons); setLayout(box); }
bool SelectionHandler::findNextString(const WTF::String& searchString) { if (searchString.isEmpty()) { cancelSelection(); return false; } ASSERT(m_webPage->m_page); m_webPage->m_page->unmarkAllTextMatches(); bool result = m_webPage->m_page->findString(searchString, WTF::TextCaseInsensitive, WebCore::FindDirectionForward, true /*should wrap*/); if (result && m_webPage->focusedOrMainFrame()->selection()->selectionType() == VisibleSelection::NoSelection) { // Word was found but could not be selected on this page. result = m_webPage->m_page->markAllMatchesForText(searchString, WTF::TextCaseInsensitive, true /*should highlight*/, 0 /*limit to match 0 = unlimited*/); } // Defocus the input field if one is active. if (m_webPage->m_inputHandler->isInputMode()) m_webPage->m_inputHandler->nodeFocused(0); return result; }