void MainMenuScreen::loadedFromFile() { LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->setScrollSpeed(15); RibbonWidget* rw_top = getWidget<RibbonWidget>("menu_toprow"); assert(rw_top != NULL); if (track_manager->getTrack("overworld") == NULL || track_manager->getTrack("introcutscene") == NULL || track_manager->getTrack("introcutscene2") == NULL) { rw_top->removeChildNamed("story"); } #if DEBUG_MENU_ITEM != 1 RibbonWidget* rw = getWidget<RibbonWidget>("menu_bottomrow"); rw->removeChildNamed("test_gpwin"); rw->removeChildNamed("test_gplose"); rw->removeChildNamed("test_unlocked"); rw->removeChildNamed("test_unlocked2"); rw->removeChildNamed("test_intro"); rw->removeChildNamed("test_outro"); #endif } // loadedFromFile
// ---------------------------------------------------------------------------- void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver) { IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons"); if (addons_icon != NULL) { if (addons_manager->wasError()) { addons_icon->setActivated(); addons_icon->resetAllBadges(); addons_icon->setBadge(BAD_BADGE); } else if (addons_manager->isLoading() && UserConfigParams::m_internet_status == INetworkHttp::IPERM_ALLOWED) { // Addons manager is still initialising/downloading. addons_icon->setDeactivated(); addons_icon->resetAllBadges(); addons_icon->setBadge(LOADING_BADGE); } else { addons_icon->setActivated(); addons_icon->resetAllBadges(); } // maybe add a new badge when not allowed to access the net } LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->update(delta); if(w->scrolledOff()) { const core::stringw &news_text = news_manager->getNextNewsMessage(); w->setText(news_text, true); } } // onUpdate
// ---------------------------------------------------------------------------- void CreateServerScreen::init() { Screen::init(); DemoWorld::resetIdleTime(); m_info_widget->setText("", false); LabelWidget *title = getWidget<LabelWidget>("title"); title->setText(NetworkConfig::get()->isLAN() ? _("Create LAN Server") : _("Create Server") , false); // I18n: Name of the server. %s is either the online or local user name m_name_widget->setText(_("%s's server", NetworkConfig::get()->isLAN() ? PlayerManager::getCurrentPlayer()->getName() : PlayerManager::getCurrentOnlineUserName() ) ); // -- Difficulty RibbonWidget* difficulty = getWidget<RibbonWidget>("difficulty"); assert(difficulty != NULL); difficulty->setSelection(UserConfigParams::m_difficulty, PLAYER_ID_GAME_MASTER); // -- Game modes RibbonWidget* gamemode = getWidget<RibbonWidget>("gamemode"); assert(gamemode != NULL); gamemode->setSelection(0, PLAYER_ID_GAME_MASTER); } // init
// ---------------------------------------------------------------------------- // void MainMenuScreen::init() { Screen::init(); m_user_id = getWidget<ButtonWidget>("user-id"); assert(m_user_id); // reset in case we're coming back from a race StateManager::get()->resetActivePlayers(); input_manager->getDeviceManager()->setAssignMode(NO_ASSIGN); input_manager->getDeviceManager()->setSinglePlayer( NULL ); input_manager->setMasterPlayerOnly(false); // Avoid incorrect behaviour in certain race circumstances: // If a multi-player game is played with two keyboards, the 2nd // player selects his kart last, and only the keyboard is used // to select all other settings - then if the next time the kart // selection screen comes up, the default device will still be // the 2nd player. So if the first player presses 'select', it // will instead add a second player (so basically the key // binding for the second player become the default, so pressing // select will add a new player). See bug 3090931 // To avoid this, we will clean the last used device, making // the key bindings for the first player the default again. input_manager->getDeviceManager()->clearLatestUsedDevice(); if (addons_manager->isLoading()) { IconButtonWidget* w = getWidget<IconButtonWidget>("addons"); w->setDeactivated(); w->resetAllBadges(); w->setBadge(LOADING_BADGE); } m_online = getWidget<IconButtonWidget>("online"); if(!m_enable_online) m_online->setDeactivated(); LabelWidget* w = getWidget<LabelWidget>("info_addons"); const core::stringw &news_text = NewsManager::get()->getNextNewsMessage(); w->setText(news_text, true); w->update(0.01f); RibbonWidget* r = getWidget<RibbonWidget>("menu_bottomrow"); // FIXME: why do I need to do this manually ((IconButtonWidget*)r->getChildren().get(0))->unfocused(PLAYER_ID_GAME_MASTER, NULL); ((IconButtonWidget*)r->getChildren().get(1))->unfocused(PLAYER_ID_GAME_MASTER, NULL); ((IconButtonWidget*)r->getChildren().get(2))->unfocused(PLAYER_ID_GAME_MASTER, NULL); r = getWidget<RibbonWidget>("menu_toprow"); r->setFocusForPlayer(PLAYER_ID_GAME_MASTER); DemoWorld::resetIdleTime(); #if _IRR_MATERIAL_MAX_TEXTURES_ < 8 getWidget<IconButtonWidget>("logo")->setImage("gui/logo_broken.png", IconButtonWidget::ICON_PATH_TYPE_RELATIVE); #endif } // init
CharacterMenu::CharacterMenu( Drawer & drawer ) { WidgetFactory& factory = WidgetFactory::getInstance(); // MAIN CONTAINER Style * style = new Style(); style->setBackgroundImage( factory.getMenuBackground() ); rootContainer = new VerCenterContainer( style ); // TITLE LabelWidget * lw = factory.getTitleLabel( Locale::get( "CHARACTER" ) ); lw->prepare( drawer ); rootContainer->addWidget( *lw ); // FORRM playerNameForm = new Form( "setPlayerName" ); // BUTTONS TextInputWidget* tiw = factory.getLargeTextInput( ".{1,15}", Config::playerName ); interactiveWidgets.push_back( tiw ); rootContainer->addWidget( *tiw ); playerNameForm->addWidget( *tiw ); ButtonWidget* bw = factory.getLargeSubmitButton( Locale::get( "BACK" ), "setmenu settings", *playerNameForm ); this->interactiveWidgets.push_back( bw ); rootContainer->addWidget( *bw ); }
// ---------------------------------------------------------------------------- void MessageDialog::loadedFromFile() { LabelWidget* message = getWidget<LabelWidget>("title"); message->setText( m_msg, false ); // If the dialog is a simple 'OK' dialog, then hide the "Yes" button and // change "Cancel" to "OK" if (m_type == MessageDialog::MESSAGE_DIALOG_OK) { ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm"); yesbtn->setVisible(false); ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel"); cancelbtn->setText(_("OK")); cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } else if (m_type == MessageDialog::MESSAGE_DIALOG_YESNO) { ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel"); cancelbtn->setText(_("No")); } else if (m_type == MessageDialog::MESSAGE_DIALOG_OK_CANCEL) { // In case of a OK_CANCEL dialog, change the text from 'Yes' to 'Ok' ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm"); yesbtn->setText(_("OK")); } }
// ---------------------------------------------------------------------------- void MainMenuScreen::onUpdate(float delta) { PlayerProfile *player = PlayerManager::getCurrentPlayer(); if(PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST || PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN) { m_user_id->setText(player->getLastOnlineName() + "@stk"); m_online->setActivated(); m_online->setLabel( _("Online")); } else if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_OUT) { m_online->setActivated(); m_online->setLabel( _("Login" )); m_user_id->setText(player->getName()); } else { // now must be either logging in or logging out m_online->setDeactivated(); m_user_id->setText(player->getName()); } m_online->setLabel(PlayerManager::getCurrentOnlineId() ? _("Online") : _("Login" ) ); IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons"); if (addons_icon != NULL) { if (addons_manager->wasError()) { addons_icon->setActivated(); addons_icon->resetAllBadges(); addons_icon->setBadge(BAD_BADGE); } else if (addons_manager->isLoading() && UserConfigParams::m_internet_status == Online::RequestManager::IPERM_ALLOWED) { // Addons manager is still initialising/downloading. addons_icon->setDeactivated(); addons_icon->resetAllBadges(); addons_icon->setBadge(LOADING_BADGE); } else { addons_icon->setActivated(); addons_icon->resetAllBadges(); } // maybe add a new badge when not allowed to access the net } LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->update(delta); if(w->scrolledOff()) { const core::stringw &news_text = NewsManager::get()->getNextNewsMessage(); w->setText(news_text, true); } } // onUpdate
void MainMenuScreen::loadedFromFile() { LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->setScrollSpeed(15); #if DEBUG_MENU_ITEM != 1 RibbonWidget* rw = getWidget<RibbonWidget>("menu_bottomrow"); rw->removeChildNamed("test_gpwin"); rw->removeChildNamed("test_gplose"); rw->removeChildNamed("test_unlocked"); rw->removeChildNamed("test_unlocked2"); #endif } // loadedFromFile
AboutDialog::AboutDialog() { LabelWidget *label = new LabelWidget; label->setLabel(tr("Doomsday Shell %1\nCopyright (c) %2\n\n" "The Shell is a utility for controlling and monitoring " "Doomsday servers using a text-based (curses) user interface.") .arg(SHELL_VERSION) .arg("2013-2018 Deng Team")); label->setExpandsToFitLines(true); label->rule() .setLeftTop(rule().left(), rule().top()) .setInput(Rule::Width, rule().width()); add(label); rule().setSize(Const(40), label->rule().height()); }
// ----------------------------------------------------------------------------- void EnterGPNameDialog::onEnterPressedInternal() { //Cancel button pressed ButtonWidget* cancelButton = getWidget<ButtonWidget>("cancel"); if (GUIEngine::isFocusedForPlayer(cancelButton, PLAYER_ID_GAME_MASTER)) { std::string fakeEvent = "cancel"; processEvent(fakeEvent); return; } //Otherwise, see if we can accept the new name TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield"); assert(textCtrl != NULL); stringw name = textCtrl->getText().trim(); if (name.size() > 0) { // check for duplicate names for (int i = 0; i < grand_prix_manager->getNumberOfGrandPrix(); i++) { const GrandPrixData* gp = grand_prix_manager->getGrandPrix(i); if (gp->getName() == name) { LabelWidget* label = getWidget<LabelWidget>("title"); assert(label != NULL); label->setText(_("Another grand prix with this name already exists."), false); sfx_manager->quickSound("anvil"); return; } } // It's unsafe to delete from inside the event handler so we do it // in onUpdate (which checks for m_self_destroy) m_self_destroy = true; } else { LabelWidget* label = getWidget<LabelWidget>("title"); assert(label != NULL); label->setText(_("Cannot add a grand prix with this name"), false); sfx_manager->quickSound("anvil"); } }
void MessageDialog::doInit(MessageDialogType type, IConfirmDialogListener* listener, bool own_listener) { if (StateManager::get()->getGameState() == GUIEngine::GAME) { World::getWorld()->schedulePause(World::IN_GAME_MENU_PHASE); } loadFromFile("confirm_dialog.stkgui"); m_listener = listener; m_own_listener = own_listener; LabelWidget* message = getWidget<LabelWidget>("title"); message->setText( m_msg.c_str(), false ); // If the dialog is a simple 'OK' dialog, then hide the "Yes" button and // change "Cancel" to "OK" if (type == MessageDialog::MESSAGE_DIALOG_OK) { ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm"); yesbtn->setVisible(false); ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel"); cancelbtn->setText(_("OK")); cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } else if (type == MessageDialog::MESSAGE_DIALOG_YESNO) { ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm"); ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel"); cancelbtn->setText(_("No")); } else if (type == MessageDialog::MESSAGE_DIALOG_OK_CANCEL) { // In case of a OK_CANCEL dialog, change the text from 'Yes' to 'Ok' ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm"); yesbtn->setText(_("OK")); } }
// ---------------------------------------------------------------------------- void CreateServerScreen::init() { Screen::init(); DemoWorld::resetIdleTime(); m_info_widget->setText("", false); LabelWidget *title = getWidget<LabelWidget>("title"); title->setText(NetworkConfig::get()->isLAN() ? _("Create LAN Server") : _("Create Server") , false); // I18n: Name of the server. %s is either the online or local user name m_name_widget->setText(_("%s's server", NetworkConfig::get()->isLAN() ? PlayerManager::getCurrentPlayer()->getName() : PlayerManager::getCurrentOnlineUserName() ) ); } // init
// ----------------------------------------------------------------------------- void EditGPScreen::init() { if (m_action.empty()) { LabelWidget* header = getWidget<LabelWidget>("title"); assert(header != NULL); header->setText(m_gp->getName(), true); IconButtonWidget* button = getWidget<IconButtonWidget>("save"); assert(button != NULL); button->setDeactivated(); loadList(0); setModified(false); } else { EditTrackScreen* edit = EditTrackScreen::getInstance(); assert(edit != NULL); if (edit->getResult()) { if (m_action == "add") { m_gp->addTrack(edit->getTrack(), edit->getLaps(), edit->getReverse(), m_selected); setSelected(m_selected + 1); } else if (m_action == "edit") { m_gp->editTrack(m_selected, edit->getTrack(), edit->getLaps(), edit->getReverse()); } setModified(true); } loadList(m_selected); m_action.clear(); } }
void MessageDialog::doInit(irr::core::stringw msg, MessageDialogType type, IConfirmDialogListener* listener, bool own_listener) { loadFromFile("confirm_dialog.stkgui"); m_listener = listener; m_own_listener = own_listener; LabelWidget* message = getWidget<LabelWidget>("title"); message->setText( msg.c_str(), false ); // If the dialog is a simple 'OK' dialog, then hide the "Yes" button and // change "Cancel" to "OK" if (type == MessageDialog::MESSAGE_DIALOG_OK) { ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm"); yesbtn->setVisible(false); ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel"); cancelbtn->setText(_("OK")); cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } }
GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const float h) : ModalDialog(w, h) { doInit(); m_curr_time = 0.0f; const int y1 = m_area.getHeight()/7; const int y2 = m_area.getHeight()*6/7; m_gp_ident = gpIdent; const GrandPrixData* gp = grand_prix_manager->getGrandPrix(gpIdent); if (gp == NULL) { assert(false); std::cerr << "ERROR at " << __FILE__ << " : " << __LINE__ << "; trying to continue\n"; ModalDialog::dismiss(); return; } // ---- GP Name core::rect< s32 > area_top(0, 0, m_area.getWidth(), y1); IGUIStaticText* title = GUIEngine::getGUIEnv()->addStaticText( translations->fribidize(gp->getName()), area_top, false, true, // border, word wrap m_irrlicht_window); title->setTabStop(false); title->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER); // ---- Track listings const std::vector<std::string>& tracks = gp->getTrackNames(); const int trackAmount = tracks.size(); int height_of_one_line = (y2 - y1)/(trackAmount+1); const int textHeight = GUIEngine::getFontHeight(); if (height_of_one_line > (int)(textHeight*1.5f)) height_of_one_line = (int)(textHeight*1.5f); bool gp_ok = true; for (int t=0; t<trackAmount; t++) { const int from_y = y1 + height_of_one_line*(t+1); Track* track = track_manager->getTrack(tracks[t]); stringw lineText; if (track == NULL) { lineText = L"MISSING : "; lineText.append( stringw(tracks[t].c_str()) ); gp_ok = false; } else { lineText = track->getName(); } LabelWidget* widget = new LabelWidget(); widget->setText(translations->fribidize(lineText), false); widget->m_x = 20; widget->m_y = from_y; widget->m_w = m_area.getWidth()/2 - 20; widget->m_h = height_of_one_line; widget->setParent(m_irrlicht_window); m_widgets.push_back(widget); widget->add(); // IGUIStaticText* line = GUIEngine::getGUIEnv()->addStaticText( lineText.c_str(), // entry_area, false , true , // border, word wrap // m_irrlicht_window); } // ---- Track screenshot m_screenshot_widget = new IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO, false /* tab stop */, false /* focusable */, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE /* Track gives us absolute paths */); // images are saved squared, but must be stretched to 4:3 m_screenshot_widget->setCustomAspectRatio(4.0f / 3.0f); m_screenshot_widget->m_x = m_area.getWidth()/2; m_screenshot_widget->m_y = y1; m_screenshot_widget->m_w = m_area.getWidth()/2; m_screenshot_widget->m_h = y2 - y1 - 10; Track* track = track_manager->getTrack(tracks[0]); m_screenshot_widget->m_properties[PROP_ICON] = (track != NULL ? track->getScreenshotFile().c_str() : file_manager->getAsset(FileManager::GUI,"main_help.png")); m_screenshot_widget->setParent(m_irrlicht_window); m_screenshot_widget->add(); m_widgets.push_back(m_screenshot_widget); // ---- Start button ButtonWidget* okBtn = new ButtonWidget(); ButtonWidget* continueBtn = new ButtonWidget(); SavedGrandPrix* saved_gp = SavedGrandPrix::getSavedGP( StateManager::get() ->getActivePlayerProfile(0) ->getUniqueID(), gpIdent, race_manager->getDifficulty(), race_manager->getNumberOfKarts(), race_manager->getNumLocalPlayers()); if (gp_ok) { okBtn->m_properties[PROP_ID] = "start"; okBtn->setText(_("Start Grand Prix")); continueBtn->m_properties[PROP_ID] = "continue"; continueBtn->setText(_("Continue")); } else { okBtn->m_properties[PROP_ID] = "cannot_start"; okBtn->setText(_("This Grand Prix is broken!")); okBtn->setBadge(BAD_BADGE); } if (saved_gp && gp_ok) { continueBtn->m_x = m_area.getWidth()/2 + 110; continueBtn->m_y = y2; continueBtn->m_w = 200; continueBtn->m_h = m_area.getHeight() - y2 - 15; continueBtn->setParent(m_irrlicht_window); m_widgets.push_back(continueBtn); continueBtn->add(); continueBtn->getIrrlichtElement()->setTabStop(true); continueBtn->getIrrlichtElement()->setTabGroup(false); okBtn->m_x = m_area.getWidth()/2 - 310; } else { okBtn->m_x = m_area.getWidth()/2 - 200; } okBtn->m_y = y2; okBtn->m_w = 400; okBtn->m_h = m_area.getHeight() - y2 - 15; okBtn->setParent(m_irrlicht_window); m_widgets.push_back(okBtn); okBtn->add(); okBtn->getIrrlichtElement()->setTabStop(true); okBtn->getIrrlichtElement()->setTabGroup(false); okBtn->setFocusForPlayer( PLAYER_ID_GAME_MASTER ); }
AudioSettingsDialog::AudioSettingsDialog(String const &name) : DialogWidget(name, WithHeading), d(new Impl(this)) { bool const gameLoaded = DoomsdayApp::isGameLoaded(); heading().setText(tr("Audio Settings")); heading().setImage(style().images().image("audio")); GridLayout layout(area().contentRule().left(), area().contentRule().top()); layout.setGridSize(2, 0); layout.setColumnAlignment(0, ui::AlignRight); if (gameLoaded) { auto *sfxVolLabel = LabelWidget::newWithText(tr("SFX Volume:" ), &area()); auto *musicVolLabel = LabelWidget::newWithText(tr("Music Volume:" ), &area()); auto *rvbVolLabel = LabelWidget::newWithText(tr("Reverb Strength:"), &area()); d->sound3D ->setText(tr("3D Effects & Reverb" )); d->overlapStop->setText(tr("One Sound per Emitter")); d->sound16bit ->setText(tr("16-bit Resampling" )); auto *rateLabel = LabelWidget::newWithText(tr("Resampling:"), &area()); d->sampleRate->items() << new ChoiceItem(tr("1x @ 11025 Hz"), 11025) << new ChoiceItem(tr("2x @ 22050 Hz"), 22050) << new ChoiceItem(tr("4x @ 44100 Hz"), 44100); auto *musSrcLabel = LabelWidget::newWithText(tr("Preferred Music:"), &area()); d->musicSource->items() << new ChoiceItem(tr("MUS lumps"), AudioSystem::MUSP_MUS) << new ChoiceItem(tr("External files"), AudioSystem::MUSP_EXT) << new ChoiceItem(tr("CD"), AudioSystem::MUSP_CD); auto *sfLabel = LabelWidget::newWithText(tr("MIDI Sound Font:"), &area()); // Layout. layout << *sfxVolLabel << *d->sfxVolume << *musicVolLabel << *d->musicVolume << *rvbVolLabel << *d->reverbVolume << Const(0) << *d->sound3D << Const(0) << *d->overlapStop << *rateLabel << *d->sampleRate << Const(0) << *d->sound16bit << *musSrcLabel << *d->musicSource << *sfLabel << *d->musicSoundfont; } auto *soundPluginLabel = LabelWidget::newWithText(tr("SFX Plugin:" ), &area()); auto *musicPluginLabel = LabelWidget::newWithText(tr("Music Plugin:"), &area()); auto *cdPluginLabel = LabelWidget::newWithText(tr("CD Plugin:" ), &area()); LabelWidget *pluginLabel = LabelWidget::newWithText(_E(D) + tr("Audio Backend"), &area()); pluginLabel->setFont("separator.label"); pluginLabel->margins().setTop("gap"); layout.setCellAlignment(Vector2i(0, layout.gridSize().y), ui::AlignLeft); layout.append(*pluginLabel, 2); layout << *soundPluginLabel << *d->soundPlugin << *musicPluginLabel << *d->musicPlugin << *cdPluginLabel << *d->cdPlugin; area().setContentSize(layout.width(), layout.height()); buttons() << new DialogButtonItem(DialogWidget::Default | DialogWidget::Accept, tr("Close")) << new DialogButtonItem(DialogWidget::Action, tr("Reset to Defaults"), new SignalAction(this, SLOT(resetToDefaults()))); if (gameLoaded) { buttons() << new DialogButtonItem(DialogWidget::ActionPopup | Id1, style().images().image("gauge")); popupButtonWidget(Id1)->setPopup(*d->devPopup); } d->fetch(); }
SelectChallengeDialog::SelectChallengeDialog(const float percentWidth, const float percentHeight, std::string challenge_id) : ModalDialog(percentWidth, percentHeight) { loadFromFile("select_challenge.stkgui"); m_challenge_id = challenge_id; World::getWorld()->schedulePause(WorldStatus::IN_GAME_MENU_PHASE); switch (UserConfigParams::m_difficulty) { case 0: getWidget("novice")->setFocusForPlayer(PLAYER_ID_GAME_MASTER); break; case 1: getWidget("intermediate")->setFocusForPlayer(PLAYER_ID_GAME_MASTER); break; case 2: getWidget("expert")->setFocusForPlayer(PLAYER_ID_GAME_MASTER); break; } const ChallengeStatus* c = PlayerManager::getCurrentPlayer() ->getChallengeStatus(challenge_id); if (c->isSolved(RaceManager::DIFFICULTY_EASY)) { IconButtonWidget* btn = getWidget<IconButtonWidget>("novice"); btn->setImage(file_manager->getAsset(FileManager::GUI, "cup_bronze.png"), IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); } if (c->isSolved(RaceManager::DIFFICULTY_MEDIUM)) { IconButtonWidget* btn = getWidget<IconButtonWidget>("intermediate"); btn->setImage(file_manager->getAsset(FileManager::GUI,"cup_silver.png"), IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); } if (c->isSolved(RaceManager::DIFFICULTY_HARD)) { IconButtonWidget* btn = getWidget<IconButtonWidget>("expert"); btn->setImage(file_manager->getAsset(FileManager::GUI,"cup_gold.png"), IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); } LabelWidget* novice_label = getWidget<LabelWidget>("novice_label"); LabelWidget* medium_label = getWidget<LabelWidget>("intermediate_label"); LabelWidget* expert_label = getWidget<LabelWidget>("difficult_label"); novice_label->setText( getLabel(RaceManager::DIFFICULTY_EASY, c->getData()), false ); medium_label->setText( getLabel(RaceManager::DIFFICULTY_MEDIUM, c->getData()), false ); expert_label->setText( getLabel(RaceManager::DIFFICULTY_HARD, c->getData()), false ); if (c->getData()->isGrandPrix()) { const GrandPrixData* gp = grand_prix_manager->getGrandPrix(c->getData()->getGPId()); getWidget<LabelWidget>("title")->setText( gp->getName(), true ); } else { const wchar_t* track_name = track_manager->getTrack(c->getData()->getTrackId())->getName(); getWidget<LabelWidget>("title")->setText( track_name, true ); } LabelWidget* typeLbl = getWidget<LabelWidget>("race_type_val"); if (c->getData()->isGrandPrix()) typeLbl->setText(_("Grand Prix"), false ); else if (c->getData()->getEnergy(RaceManager::DIFFICULTY_EASY) > 0) typeLbl->setText(_("Nitro challenge"), false ); else typeLbl->setText( RaceManager::getNameOf(c->getData()->getMinorMode()), false ); }
Impl(Public *i, Mode mode) : Base(i) { ScrollAreaWidget &area = self().area(); // Create the widgets. area.add(autoCheck = new ToggleWidget); area.add(freqs = new ChoiceWidget); area.add(lastChecked = new LabelWidget); area.add(channels = new ChoiceWidget); area.add(autoDown = new ToggleWidget); //area.add(paths = new ChoiceWidget); area.add(deleteAfter = new ToggleWidget); // The updater Config is changed when the widget state is modified. QObject::connect(autoCheck, SIGNAL(stateChangedByUser(ToggleWidget::ToggleState)), thisPublic, SLOT(apply())); QObject::connect(freqs, SIGNAL(selectionChangedByUser(uint)), thisPublic, SLOT(apply())); QObject::connect(channels, SIGNAL(selectionChangedByUser(uint)), thisPublic, SLOT(apply())); QObject::connect(autoDown, SIGNAL(stateChangedByUser(ToggleWidget::ToggleState)), thisPublic, SLOT(apply())); //QObject::connect(paths, SIGNAL(selectionChangedByUser(uint)), thisPublic, SLOT(apply())); QObject::connect(deleteAfter, SIGNAL(stateChangedByUser(ToggleWidget::ToggleState)), thisPublic, SLOT(apply())); LabelWidget *releaseLabel = new LabelWidget; area.add(releaseLabel); /*LabelWidget *pathLabel = new LabelWidget; area.add(pathLabel);*/ autoCheck->setText(tr("Check for Updates:")); freqs->items() << new ChoiceItem(tr("At startup"), UpdaterSettings::AtStartup) << new ChoiceItem(tr("Daily"), UpdaterSettings::Daily) << new ChoiceItem(tr("Biweekly"), UpdaterSettings::Biweekly) << new ChoiceItem(tr("Weekly"), UpdaterSettings::Weekly) << new ChoiceItem(tr("Monthly"), UpdaterSettings::Monthly); lastChecked->margins().setTop(""); lastChecked->setFont("separator.annotation"); lastChecked->setTextColor("altaccent"); releaseLabel->setText("Release Type:"); channels->items() << new ChoiceItem(tr("Stable only"), UpdaterSettings::Stable) << new ChoiceItem(tr("RC or stable"), UpdaterSettings::StableOrCandidate) << new ChoiceItem(tr("Unstable/nightly"), UpdaterSettings::Unstable); /*pathLabel->setText(tr("Download location:")); paths->items() << new ChoiceItem(defaultLocationName(), UpdaterSettings::defaultDownloadPath().toString());*/ autoDown->setText(tr("Download Automatically")); deleteAfter->setText(tr("Delete File After Install")); fetch(); autoCheck->audienceForToggle() += this; // Place the widgets into a grid. GridLayout layout(area.contentRule().left(), area.contentRule().top()); layout.setGridSize(2, 0); layout.setColumnAlignment(0, ui::AlignRight); // Labels aligned to the right. layout << *autoCheck << *freqs << Const(0) << *lastChecked << *releaseLabel << *channels << Const(0) << *autoDown << Const(0) << *deleteAfter; //<< *pathLabel << *paths; area.setContentSize(layout); self().buttons() << new DialogButtonItem(DialogWidget::Default | DialogWidget::Accept, tr("Close")); if (mode == WithApplyAndCheckButton) { self().buttons() << new DialogButtonItem(DialogWidget::Action, tr("Check Now"), new SignalAction(thisPublic, SLOT(applyAndCheckNow()))); } }
void OptionsScreenInput2::init() { Screen::init(); RibbonWidget* tabBar = getWidget<RibbonWidget>("options_choice"); if (tabBar != NULL) tabBar->select( "tab_controls", PLAYER_ID_GAME_MASTER ); tabBar->getRibbonChildren()[0].setTooltip( _("Graphics") ); tabBar->getRibbonChildren()[1].setTooltip( _("Audio") ); tabBar->getRibbonChildren()[2].setTooltip( _("User Interface") ); tabBar->getRibbonChildren()[3].setTooltip( _("Players") ); ButtonWidget* deleteBtn = getWidget<ButtonWidget>("delete"); if (m_config->getType() != DEVICE_CONFIG_TYPE_KEYBOARD) { core::stringw label = (m_config->isEnabled() ? //I18N: button to disable a gamepad configuration _("Disable Device") : //I18N: button to enable a gamepad configuration _("Enable Device")); // Make sure button is wide enough as the text is being changed away // from the original value core::dimension2d<u32> size = GUIEngine::getFont()->getDimension(label.c_str()); const int needed = size.Width + deleteBtn->getWidthNeededAroundLabel(); if (deleteBtn->m_w < needed) deleteBtn->m_w = needed; deleteBtn->setLabel(label); } else { deleteBtn->setLabel(_("Delete Configuration")); if (input_manager->getDeviceList()->getKeyboardAmount() < 2) { // don't allow deleting the last config deleteBtn->setDeactivated(); } else { deleteBtn->setActivated(); } } // Make the two buttons the same length, not strictly needed but will // look nicer... ButtonWidget* backBtn = getWidget<ButtonWidget>("back_to_device_list"); if (backBtn->m_w < deleteBtn->m_w) backBtn->m_w = deleteBtn->m_w; else deleteBtn->m_w = backBtn->m_w; backBtn->moveIrrlichtElement(); deleteBtn->moveIrrlichtElement(); LabelWidget* label = getWidget<LabelWidget>("title"); label->setText( m_config->getName().c_str(), false ); GUIEngine::ListWidget* actions = getWidget<GUIEngine::ListWidget>("actions"); assert( actions != NULL ); // ---- create list skeleton (right number of items, right internal names) // their actualy contents will be adapted as needed after //I18N: Key binding section addListItemSubheader(actions, "game_keys_section", _("Game Keys")); addListItem(actions, PA_STEER_LEFT); addListItem(actions, PA_STEER_RIGHT); addListItem(actions, PA_ACCEL); addListItem(actions, PA_BRAKE); addListItem(actions, PA_FIRE); addListItem(actions, PA_NITRO); addListItem(actions, PA_DRIFT); addListItem(actions, PA_LOOK_BACK); addListItem(actions, PA_RESCUE); addListItem(actions, PA_PAUSE_RACE); //I18N: Key binding section addListItemSubheader(actions, "menu_keys_section", _("Menu Keys")); addListItem(actions, PA_MENU_UP); addListItem(actions, PA_MENU_DOWN); addListItem(actions, PA_MENU_LEFT); addListItem(actions, PA_MENU_RIGHT); addListItem(actions, PA_MENU_SELECT); addListItem(actions, PA_MENU_CANCEL); updateInputButtons(); // Disable deletion keyboard configurations if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU) { getWidget<ButtonWidget>("delete")->setDeactivated(); } else { getWidget<ButtonWidget>("delete")->setActivated(); } } // init
PatientSearchForm::PatientSearchForm(QWidget *parent) : QWidget(parent) { ui.setupUi(this); /* set the background image */ setBackgroundImage(); this->setContentsMargins(0,0,0,0); creditsFooter = new CreditsFooterWidget(this); creditsFooter->setMinimumHeight(43); creditsFooter->setMaximumHeight(43); creditsFooter->setBackgroundImage(); /* create the GUI object */ LabelWidget *surnameLabel = new LabelWidget("Cognome", this); //surnameLabel->setMaximumHeight(30); surnameLabel->setBackgroundImage(); surnameTextBox = new TextBoxWidget(QPixmap(":/icons/textBoxBg.png")); LabelWidget *nameLabel = new LabelWidget("Nome", this); nameLabel->setBackgroundImage(); nameTextBox = new TextBoxWidget(QPixmap(":/icons/textBoxBg.png")); LabelWidget *cityLabel = new LabelWidget("Comune di Residenza", this); cityLabel->setBackgroundImage(); cityTextBox = new TextBoxWidget(QPixmap(":/icons/textBoxBg.png")); LabelWidget *codeLabel = new LabelWidget("Id Paziente", this); codeLabel->setBackgroundImage(); codeTextBox = new TextBoxWidget(QPixmap(":/icons/textBoxLineBg.png")); searchButton = new ButtonLabel(QPixmap(":/icons/findButton.png"), QPixmap(":/icons/findButtonPushed.png"), this); connect(searchButton, SIGNAL(released()), this, SLOT(searchButtonSlot())); creditsButton = new ButtonLabel(QPixmap(":/icons/creditsButton.png"), QPixmap(":/icons/creditsButton.png"), this); connect(creditsButton, SIGNAL(released()), this, SLOT(creditsButtonSlot())); quitButton = new ButtonLabel(QPixmap(":/icons/quitButton.png"), QPixmap(":/icons/quitButton.png"), this); connect(quitButton, SIGNAL(released()), QApplication::instance(), SLOT(quit())); personLogo = new QLabel(this); personLogo->setPixmap(QPixmap(":/icons/userIcon.png")); /* layout operations */ QHBoxLayout *headerLayout = new QHBoxLayout(); headerLayout->setContentsMargins(13, 13, 13, 0); headerLayout->addWidget(personLogo); headerLayout->addStretch(); headerLayout->addWidget(quitButton); QVBoxLayout *vLayout = new QVBoxLayout(); vLayout->setSpacing(0); vLayout->setContentsMargins(0,0,0,0); vLayout->addLayout(headerLayout); vLayout->addStretch(5); vLayout->addWidget(surnameLabel); QHBoxLayout *surnameHLayout = new QHBoxLayout(); surnameHLayout->addWidget(surnameTextBox); surnameTextBox->setBackgroundImage(); vLayout->addLayout(surnameHLayout); vLayout->addWidget(nameLabel); QHBoxLayout *nameHLayout = new QHBoxLayout(); nameHLayout->addWidget(nameTextBox); nameTextBox->setBackgroundImage(); vLayout->addLayout(nameHLayout); vLayout->addWidget(cityLabel); QHBoxLayout *cityHLayout = new QHBoxLayout(); cityHLayout->addWidget(cityTextBox); cityTextBox->setBackgroundImage(); vLayout->addLayout(cityHLayout); vLayout->addWidget(codeLabel); QHBoxLayout *codeHLayout = new QHBoxLayout(); codeHLayout->addWidget(codeTextBox); codeTextBox->setBackgroundImage(); vLayout->addLayout(codeHLayout); vLayout->addStretch(1); vLayout->addWidget(searchButton); vLayout->setAlignment(searchButton, Qt::AlignCenter); vLayout->addStretch(4); vLayout->addWidget(creditsFooter); QHBoxLayout *mainLayout = new QHBoxLayout(); mainLayout->setContentsMargins(0,0,0,0); mainLayout->addLayout(vLayout); mainLayout->setAlignment(Qt::AlignCenter); setLayout(mainLayout); /* connect the patient change signal to the close slot */ connect(MobiState::getInstance(), SIGNAL(changeCurrentPatientSignal()), this, SLOT(close())); loadingImage = new QLabel(this); loadingImage->setPixmap(QPixmap(":/icons/loadingBg.png")); loadingImage->setFixedSize(360, 640); loadingImage->setVisible(false); }
void MainMenuScreen::loadedFromFile() { LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->setScrollSpeed(15); } // loadedFromFile