void ShortcutsWidget::addShortcutRow(MenuAction &action) { QTableWidget *table = ui->tableWidget; const int row = table->rowCount(); table->insertRow(row); auto tableItem = new QTableWidgetItem(); action.tableItem = tableItem; table->setItem(row, Columns::Icon, tableItem); tableItem->setFlags(Qt::ItemIsEnabled); tableItem = new QTableWidgetItem(uiText(action.text)); table->setItem(row, Columns::Text, tableItem); tableItem->setFlags(Qt::ItemIsEnabled); tableItem = new QTableWidgetItem(); table->setItem(row, Columns::Type, tableItem); tableItem->setFlags(Qt::ItemIsEnabled); if (action.command.type() & CommandType::GlobalShortcut) { tableItem->setIcon( getIcon("", IconExternalLinkSquareAlt) ); tableItem->setToolTip( tr("Shortcut can be triggered from any application") ); } action.shortcutButton = new ShortcutButton(table); table->setCellWidget(row, Columns::Shortcut, action.shortcutButton); m_actions.append(action); connect( action.shortcutButton, &ShortcutButton::shortcutAdded, this, &ShortcutsWidget::onShortcutAdded ); connect( action.shortcutButton, &ShortcutButton::shortcutRemoved, this, &ShortcutsWidget::onShortcutRemoved ); }
void GamePlay::River() { Setup(); tablehand = hands.dealCards(deck, tablehand, 1); Cards(); //creating the hands getValues(); uiText(); betSystem(); finalCards(); }
void GamePlay::Turn() { Setup(); tablehand = hands.dealCards(deck, tablehand, 1); Cards(); getValues(); uiText(); betSystem(); River(); }
void ShortcutsWidget::loadShortcuts(QSettings &settings) { MenuItems items = menuItems(); ::loadShortcuts(&items, settings); m_actions.clear(); m_shortcuts.clear(); QTableWidget *table = ui->tableWidget; while (table->rowCount() > 0) table->removeRow(0); foreach (const MenuItem &item, items) { MenuAction action; action.iconName = item.iconName; action.iconId = item.iconId; action.text = item.text; action.settingsKey = item.settingsKey; const int row = table->rowCount(); table->insertRow(row); QTableWidgetItem *tableItem = new QTableWidgetItem(); table->setItem(row, Columns::Empty, tableItem); tableItem->setFlags(Qt::NoItemFlags); tableItem = new QTableWidgetItem(); action.tableItem = tableItem; table->setItem(row, Columns::Icon, tableItem); tableItem->setFlags(Qt::ItemIsEnabled); tableItem = new QTableWidgetItem(uiText(action.text)); table->setItem(row, Columns::Text, tableItem); tableItem->setFlags(Qt::ItemIsEnabled); action.shortcutButton = new ShortcutButton(table); table->setCellWidget(row, Columns::Shortcut, action.shortcutButton); action.shortcutButton->setDefaultShortcut(item.defaultShortcut); foreach (const QKeySequence &shortcut, item.shortcuts) action.shortcutButton->addShortcut(shortcut); action.iconId = item.iconId; m_actions.append(action); m_shortcuts << item.shortcuts; m_timerCheckAmbiguous.start(); connect( action.shortcutButton, SIGNAL(shortcutAdded(QKeySequence)), this, SLOT(onShortcutAdded(QKeySequence)) ); connect( action.shortcutButton, SIGNAL(shortcutRemoved(QKeySequence)), this, SLOT(onShortcutRemoved(QKeySequence)) ); }
void GamePlay::Flop() { for (size_t i = 0; i < listOfComputerPlayers.size(); i++) { listOfComputerPlayers[i].cardbackColor = 31; listOfComputerPlayers[i].didFold = false; } gameoverCheck(); Setup(); makeHands(); getValues(); uiText(); betSystem(); Turn(); }
void ShortcutsWidget::onLineEditFilterTextChanged(const QString &text) { const QString needle = text.toLower(); for ( const auto &action : m_actions ) { bool found = uiText(action.text).toLower().contains(needle); if (!found) { for ( const auto &shortcut : action.shortcutButton->shortcuts() ) { if ( shortcut.toString(QKeySequence::NativeText).toLower().contains(needle) ) { found = true; break; } } } const int row = action.tableItem->row(); if (found) ui->tableWidget->showRow(row); else ui->tableWidget->hideRow(row); } }
void GamePlay::finalCards() { //CHANGE ME PlayerHandValue = 0; listOfComputerPlayers[0].CpuHandValue = 0; showComputer = true; shows = true; system("cls"); if (tablehand.size() < 4) { tablehand = hands.dealCards(deck, tablehand, 2); } if (tablehand.size() < 5) { tablehand = hands.dealCards(deck, tablehand, 1); } Cards(); getValues(); if (playerFold == true) { PlayerHandValue = 0; } for (size_t i = 0; i < listOfComputerPlayers.size(); i++) { listOfComputerPlayers[i].computerHandText = checks.handText(listOfComputerPlayers[i].CpuHandValue); } determine(); uiText(); if (listOfComputerPlayers.size() == 1) { drawcard.createhand(hand, 25, 40); drawcard.createhand(tablehand, 5, 20); drawcard.createhand(listOfComputerPlayers[0].cpuhand, 24, 3); } if (listOfComputerPlayers.size() == 2) { drawcard.createhand(hand, 25, 40); drawcard.createhand(tablehand, 5, 20); drawcard.createhand(listOfComputerPlayers[0].cpuhand, 1, 3); drawcard.createhand(listOfComputerPlayers[1].cpuhand, 60, 3); } if (listOfComputerPlayers.size() == 3) { drawcard.createhand(hand, 1, 40); drawcard.createhand(tablehand, 5, 20); drawcard.createhand(listOfComputerPlayers[0].cpuhand, 1, 3); drawcard.createhand(listOfComputerPlayers[1].cpuhand, 60, 3); drawcard.createhand(listOfComputerPlayers[2].cpuhand, 60, 40); } cin.get(); gameoverCheck(); Clear(); system("cls"); Flop(); }