void GitSubmitEditorWidget::initialize(CommitType commitType, const QString &repository, const GitSubmitEditorPanelData &data, const GitSubmitEditorPanelInfo &info, bool enablePush) { if (m_isInitialized) return; m_isInitialized = true; if (commitType == FixupCommit) { auto logChangeGroupBox = new QGroupBox(tr("Select Change")); auto logChangeLayout = new QVBoxLayout; logChangeGroupBox->setLayout(logChangeLayout); m_logChangeWidget = new LogChangeWidget; m_logChangeWidget->init(repository); connect(m_logChangeWidget, &LogChangeWidget::activated, this, &GitSubmitEditorWidget::show); logChangeLayout->addWidget(m_logChangeWidget); insertTopWidget(logChangeGroupBox); m_gitSubmitPanelUi.editGroup->hide(); hideDescription(); } insertTopWidget(m_gitSubmitPanel); setPanelData(data); setPanelInfo(info); if (enablePush) { auto menu = new QMenu(this); menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot())); menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot())); addSubmitButtonMenu(menu); } }
void GitSubmitEditorWidget::initialize(CommitType commitType, const QString &repository, const GitSubmitEditorPanelData &data, const GitSubmitEditorPanelInfo &info, bool enablePush) { if (m_isInitialized) return; m_isInitialized = true; if (commitType == FixupCommit) { QGroupBox *logChangeGroupBox = new QGroupBox(tr("Select Change")); QVBoxLayout *logChangeLayout = new QVBoxLayout; logChangeGroupBox->setLayout(logChangeLayout); m_logChangeWidget = new LogChangeWidget; m_logChangeWidget->init(repository, QString(), false); connect(m_logChangeWidget, SIGNAL(doubleClicked(QString)), this, SIGNAL(show(QString))); logChangeLayout->addWidget(m_logChangeWidget); insertTopWidget(logChangeGroupBox); m_gitSubmitPanelUi.editGroup->hide(); hideDescription(); } insertTopWidget(m_gitSubmitPanel); setPanelData(data); setPanelInfo(info); if (enablePush && commitType != FixupCommit) { QMenu *menu = new QMenu(this); menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot())); menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot())); menu->addAction(tr("Commit and Push to &Gerrit"), this, SLOT(commitAndPushToGerritSlot())); addSubmitButtonMenu(menu); } }
void PhoneWidget::showSignup() { showPhoneError(langFactory(lng_bad_phone_noreg)); if (!_signup) { auto signupText = lng_phone_notreg(lt_link_start, textcmdStartLink(1), lt_link_end, textcmdStopLink(), lt_signup_start, textcmdStartLink(2), lt_signup_end, textcmdStopLink()); auto inner = object_ptr<Ui::FlatLabel>(this, signupText, Ui::FlatLabel::InitType::Rich, st::introDescription); _signup.create(this, std::move(inner)); _signup->entity()->setLink(1, std::make_shared<UrlClickHandler>(qsl("https://telegram.org"), false)); _signup->entity()->setLink(2, std::make_shared<LambdaClickHandler>([this] { toSignUp(); })); _signup->hide(anim::type::instant); updateSignupGeometry(); } _signup->show(anim::type::normal); hideDescription(); }
void Inventory::selectTab(ItemType type) { hideDescription(); hideDocument(); deselectCurrentSlot(); m_currentTab = type; switch (type) { case ItemType::Equipment_weapon: m_selectedTabText.setString(g_textProvider->getText("Equipment")); break; case ItemType::Consumable: m_selectedTabText.setString(g_textProvider->getText("Consumables")); break; case ItemType::Document: m_selectedTabText.setString(g_textProvider->getText("Documents")); break; case ItemType::Quest: m_selectedTabText.setString(g_textProvider->getText("QuestItems")); break; case ItemType::Misc: m_selectedTabText.setString(g_textProvider->getText("Miscellaneous")); break; default: break; } // center text m_selectedTabText.setPosition( m_window->getPosition().x + INVENTORY_WIDTH / 2 - m_selectedTabText.getLocalBounds().width / 2, m_selectedTabText.getPosition().y); // color selected tab for (auto& it : m_tabs) { if (it.second == m_currentTab) { it.first.setMainLayerColor(CENDRIC_COLOR_LIGHT_GREY); } else { it.first.setMainLayerColor(CENDRIC_COLOR_TRANS_BLACK); } } }
void Inventory::reload() { // reload gold reloadGold(); // reload items clearAllSlots(); hideDescription(); hideDocument(); m_core->loadItems(); for (auto& itemData : m_core->getData().items) { const Item* item = m_core->getItem(itemData.first); if (item == nullptr || m_typeMap.find(item->getType()) == m_typeMap.end()) continue; m_typeMap.at(item->getType())->insert({ item->getID(), InventorySlot(*item, itemData.second) }); } calculateSlotPositions(m_consumableItems); calculateSlotPositions(m_equipmentItems); calculateSlotPositions(m_questItems); calculateSlotPositions(m_documentItems); calculateSlotPositions(m_miscItems); // reload equipment m_equipment->reload(); }