KWizard::KWizard( QWidget *parent, const char *name, bool modal, WFlags f ) : QWizard( parent, name, modal, f ) { bool useIcons = KGlobalSettings::showIconsOnPushButtons(); if ( useIcons ) { KGuiItem back = KStdGuiItem::back( KStdGuiItem::UseRTL ); KGuiItem forward = KStdGuiItem::forward( KStdGuiItem::UseRTL ); backButton()->setIconSet( back.iconSet() ); nextButton()->setIconSet( forward.iconSet() ); finishButton()->setIconSet( SmallIconSet( "apply" ) ); cancelButton()->setIconSet( SmallIconSet( "button_cancel" ) ); helpButton()->setIconSet( SmallIconSet( "help" ) ); backButton()->setText( i18n( "&Back" ) ); nextButton()->setText( i18n( "Opposite to Back","&Next" ) ); } QFont font = titleFont(); font.setBold( true ); setTitleFont( font ); }
void ReportAssistantDialog::currentPageChanged_slot(KPageWidgetItem * current , KPageWidgetItem * before) { //Page changed buttonBox()->button(QDialogButtonBox::Cancel)->setEnabled(true); m_canClose = false; //Save data of the previous page if (before) { ReportAssistantPage* beforePage = dynamic_cast<ReportAssistantPage*>(before->widget()); beforePage->aboutToHide(); } //Load data of the current(new) page if (current) { ReportAssistantPage* currentPage = dynamic_cast<ReportAssistantPage*>(current->widget()); nextButton()->setEnabled(currentPage->isComplete()); currentPage->aboutToShow(); } //If the current page is the last one, disable all the buttons until the bug is sent if (current->name() == QLatin1String(PAGE_BZSEND_ID)) { nextButton()->setEnabled(false); backButton()->setEnabled(false); finishButton()->setEnabled(false); } }
K3Wizard::K3Wizard( QWidget *parent, const char *name, bool modal, Qt::WFlags f ) : Q3Wizard( parent, name, modal, f ) { bool useIcons = KGlobalSettings::showIconsOnPushButtons(); if ( useIcons ) { KGuiItem back = KStandardGuiItem::back( KStandardGuiItem::UseRTL ); KGuiItem forward = KStandardGuiItem::forward( KStandardGuiItem::UseRTL ); backButton()->setIcon( back.icon() ); nextButton()->setIcon( forward.icon() ); finishButton()->setIcon( KIcon( "dialog-ok-apply" ) ); cancelButton()->setIcon( KIcon( "dialog-cancel" ) ); helpButton()->setIcon( KIcon( "help-contents" ) ); backButton()->setText( i18n( "&Back" ) ); nextButton()->setText( i18nc( "Opposite to Back","&Next" ) ); } QFont font = titleFont(); font.setBold( true ); setTitleFont( font ); }
void Wizard::keyChanged( const QString &text ) { if ( text.length() == 4 ) nextButton()->setEnabled( TRUE ); else nextButton()->setEnabled( FALSE ); }
void Wizard::dataChanged( const QString & ) { if ( !firstName->text().isEmpty() && !lastName->text().isEmpty() && !email->text().isEmpty() ) nextButton()->setEnabled( TRUE ); else nextButton()->setEnabled( FALSE ); }
void MythWizard::showPage( QWidget * page ) { MythWizardPrivate::Page * p = d->page( page ); if ( p ) { int i; for( i = 0; i < d->pages.size() && d->pages[i] != p; i++ ); bool notFirst( false ); if (i) { i--; while ((i >= 0) && !notFirst) { notFirst |= appropriate(d->pages[i]->w); i--; } } setBackEnabled( notFirst ); setNextEnabled( true ); d->ws->setCurrentWidget(page); d->current = p; } layOut(); updateButtons(); emit selected( p ? p->t : QString() ); if (indexOf(page) == pageCount()-1) { // last page finishButton()->setEnabled(true); finishButton()->setFocus(); } else { nextButton()->setFocus(); } }
void Raspbed::mouseSelectEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { if (numRightClicks > 0) { numLeftClicks++; qDebug() << "Pressed Left Click, R=" << QString::number(numRightClicks) << ", L=" << QString::number(numLeftClicks); } selected = false; selectedButton->setStyleSheet(""); selectedButton = nextButton(); if(settings.isDarkHighlight()){ selectedButton->setStyleSheet("border: 3px solid black"); } else { selectedButton->setStyleSheet("border: 3px solid white"); } } else if (event->button() == Qt::RightButton) { QTimer::singleShot(500, this, SLOT(resetClicks())); numRightClicks++; if ((numRightClicks >= 2) && (numLeftClicks >= 1)) { on_callButton_clicked(); } if (bed.getSerialPort()->isConnected() && selected) { if (selectedButton == ui->headUpButton) { // Set correct button headUpHoldButton(); } else if (selectedButton == ui->headDownButton) { headDownHoldButton(); } else if (selectedButton == ui->feetUpButton) { feetUpHoldButton(); } else if (selectedButton == ui->feetDownButton) { feetDownHoldButton(); } else if (selectedButton == ui->trendButton) { trendHoldButton(); } else if (selectedButton == ui->bedUpButton) { bedUpHoldButton(); } else if (selectedButton == ui->bedDownButton) { bedDownHoldButton(); } else if (selectedButton == ui->lowerWheelsButton) { lowerWheelsHoldButton(); } else { qDebug() << "Error, button doesn't exist."; } } if(settings.isDarkHighlight()){ selectedButton->setStyleSheet("background-color: black"); } else { selectedButton->setStyleSheet("background-color: white"); } selected = true; qDebug() << "Pressed Right Click, R=" << QString::number(numRightClicks) << ", L=" << QString::number(numLeftClicks); } }
void ConnectionWizard::setState(bool patch, bool end, bool back, bool next, bool finish) { setAppropriate(pagePatch, patch ? true : false); setAppropriate(pageEnd, end ? true : false); backButton()->setEnabled(back ? true : false); nextButton()->setEnabled(next ? true : false); finishButton()->setEnabled(finish ? true : false); }
/** Question data changed */ void KControlAddEdit::slotDataChanged() { if( _pageQuestion == currentPage() ) { nextButton()->setEnabled( !_questionText->text().isEmpty() ); } if( _pageAnswer == currentPage() ) { _buttonInsert->setEnabled( !_answerText->text().isEmpty() ); } }
void ReportAssistantDialog::assistantFinished(bool showBack) { //The assistant finished: allow the user to close the dialog normally nextButton()->setEnabled(false); backButton()->setEnabled(showBack); finishButton()->setEnabled(true); buttonBox()->button(QDialogButtonBox::Cancel)->setEnabled(false); m_canClose = true; }
KPrWebPresentationWizard::KPrWebPresentationWizard( const QString &_config, KPrDocument *_doc, KPrView *_view ) : KWizard( 0, "", false ), config( _config ), webPres( config, _doc, _view ) { doc = _doc; view = _view; setupPage1(); setupPage2(); setupPage3(); setupPage4(); setupPage5(); connect( nextButton(), SIGNAL( clicked() ), this, SLOT( pageChanged() ) ); connect( backButton(), SIGNAL( clicked() ), this, SLOT( pageChanged() ) ); connect( finishButton(), SIGNAL( clicked() ), this, SLOT( finish() ) ); }
ProviderDB::ProviderDB(QWidget *parent) : KWizard(parent, "", true), cfg(0) { setCaption(i18n("Create New Account")); wiz = this; page1 = new PDB_Intro(this); addPage(page1, ""); setHelpEnabled(page1, false); // TODO p1->w->setFocusPolicy(StrongFocus); page2 = new PDB_Country(this); addPage(page2, ""); setHelpEnabled(page2, false); page3 = new PDB_Provider(this); addPage(page3, ""); setHelpEnabled(page3, false); page4 = new PDB_UserInfo(this); addPage(page4, ""); setHelpEnabled(page4, false); page5 = new PDB_DialPrefix(this); addPage(page5, ""); setHelpEnabled(page5, false); page9 = new PDB_Finished(this); addPage(page9, ""); setHelpEnabled(page9, false); setFinish(page9, true); setFinishEnabled(page9, true); connect((const QObject *)nextButton(), SIGNAL(clicked()), this, SLOT(pageSelected())); connect((const QObject *)backButton(), SIGNAL(clicked()), this, SLOT(pageSelected())); // resize(minimumSize()); adjustSize(); }
void JabberWizard::setNext() { nextButton()->setEnabled(m_search->canSearch()); }
void ReportAssistantDialog::completeChanged(ReportAssistantPage* page, bool isComplete) { if (page == dynamic_cast<ReportAssistantPage*>(currentPage()->widget())) { nextButton()->setEnabled(isComplete); } }
int main() { //RNG srand((unsigned int)time(NULL)); //Load up our textures loadGlobalTextures(); //Load Our Font loadGlobalFonts(); //Load up the Game mainWindow.create(sf::VideoMode(WINDOW_WIDTH,WINDOW_HEIGHT), windowName); Game theGame; //Frame Clock sf::Clock frameClock; frameClock.restart(); //Menu Stuff - TODO, make separate class? sf::Texture splashTex; if (EXTERNAL_FILE_MODE) splashTex.loadFromFile(PROJECT_DIRECTORY + SPLASH_IMAGE); else splashTex.loadFromFile(SPLASH_IMAGE); sf::Sprite splashBox(splashTex); //New Game TextButton newGameButton("New Game", 64, sf::Color::Green); newGameButton.setSelectedColor(sf::Color::Red); newGameButton.text.setPosition(WINDOW_WIDTH/2 - newGameButton.text.getGlobalBounds().width/2, 160); //Load Game TextButton loadGameButton("Load Game", 64, sf::Color::Green); loadGameButton.setSelectedColor(sf::Color::Red); loadGameButton.text.setPosition(WINDOW_WIDTH/2 - loadGameButton.text.getGlobalBounds().width/2, 260); //Instant Play TextButton playButton("Instant Play", 64, sf::Color::Green); playButton.setSelectedColor(sf::Color::Red); playButton.text.setPosition(WINDOW_WIDTH/2 - playButton.text.getGlobalBounds().width/2, 360); //Settings Button TextButton settingsButton("Settings", 64, sf::Color::Green); settingsButton.setSelectedColor(sf::Color::Red); settingsButton.text.setPosition(WINDOW_WIDTH/2 - settingsButton.text.getGlobalBounds().width/2, 460); //Quit Button TextButton quitButton("Quit Game", 64, sf::Color::Green); quitButton.setSelectedColor(sf::Color::Red); quitButton.text.setPosition(WINDOW_WIDTH/2 - quitButton.text.getGlobalBounds().width/2, 560); //Logo sf::Text logo = createText("Chap Shmup", 96, sf::Color::Green, FONT_2); logo.setPosition(WINDOW_WIDTH/2 - logo.getGlobalBounds().width/2, 16); //Settings Screen //Title sf::Text settingsTitle = createText("Settings", 96, sf::Color::Green, FONT_2); settingsTitle.setPosition(WINDOW_WIDTH/2 - settingsTitle.getGlobalBounds().width/2, 16); //TODO //Actual Settings //Back TextButton backButton("Back", 64, sf::Color::Green); backButton.setSelectedColor(sf::Color::Red); backButton.text.setPosition(WINDOW_WIDTH/2 - backButton.text.getGlobalBounds().width/2, 560); //New Game Screen //Title sf::Text newGameTitle = createText("New Game", 96, sf::Color::Green, FONT_2); newGameTitle.setPosition(WINDOW_WIDTH/2 - newGameTitle.getGlobalBounds().width/2, 16); //Story Blurb sf::Text storyText = createText("2:00am, 21 Dec 2712", 32, sf::Color::Green); storyText.setPosition(WINDOW_WIDTH/4 - storyText.getGlobalBounds().width/2, 160); //Character Input sf::Text charInputText = createText("Character Info:", 32, sf::Color::Green); charInputText.setPosition(3*WINDOW_WIDTH/4 - charInputText.getGlobalBounds().width/2, 160); sf::Text nameInputText = createText("Your Name:", 32, sf::Color::Green); nameInputText.setPosition(3*WINDOW_WIDTH/4 - nameInputText.getGlobalBounds().width, 260); //Next Button TextButton nextButton("Next", 64, sf::Color::Green); nextButton.setSelectedColor(sf::Color::Red); nextButton.text.setPosition(WINDOW_WIDTH/2 - nextButton.text.getGlobalBounds().width/2, 560); //Run the window while (mainWindow.isOpen()) { //Get elapsed time sf::Time elapsedTime = frameClock.restart(); sf::Event e; while(mainWindow.pollEvent(e)) { if (e.type == sf::Event::Closed) { mainWindow.close(); } if (e.type == sf::Event::KeyPressed && e.key.code == sf::Keyboard::Escape) { if (GAME_MODE == "Main Menu") { mainWindow.close(); } else { GAME_MODE = "Main Menu"; } } if (e.type == sf::Event::MouseButtonPressed) { if (GAME_MODE == "Main Menu") { //Buttons! if (mouseWithin(newGameButton.text)) { GAME_MODE = "New Game"; } else if (mouseWithin(loadGameButton.text)) { GAME_MODE = "Load Game"; } else if (mouseWithin(playButton.text)) { GAME_MODE = "Play Level"; theGame.start(); } else if (mouseWithin(settingsButton.text)) { GAME_MODE = "Settings"; } else if (mouseWithin(quitButton.text)) { mainWindow.close(); } } else if (GAME_MODE == "Settings") { if (mouseWithin(backButton.text)) { GAME_MODE = "Main Menu"; } } else if (GAME_MODE == "New Game") { if (mouseWithin((nextButton.text))) { GAME_MODE = "Play Level"; theGame.start(); } } } } //GAME_MODE: Main Menu if (GAME_MODE == "Main Menu") { //Updating playButton.update(elapsedTime.asSeconds()); settingsButton.update(elapsedTime.asSeconds()); quitButton.update(elapsedTime.asSeconds()); newGameButton.update(elapsedTime.asSeconds()); loadGameButton.update(elapsedTime.asSeconds()); //Drawing mainWindow.clear(); playButton.draw(mainWindow); settingsButton.draw(mainWindow); quitButton.draw(mainWindow); loadGameButton.draw(mainWindow); newGameButton.draw(mainWindow); mainWindow.draw(logo); mainWindow.display(); } //GAME_MODE: Play Game else if (GAME_MODE == "Play Level") { //Updating theGame.update(elapsedTime.asSeconds()); //Drawing mainWindow.clear(); theGame.draw(mainWindow); mainWindow.display(); //Game ended? if (theGame.isLevelOver()) GAME_MODE = "Main Menu"; } //GAME_MODE: Settings else if (GAME_MODE == "Settings") { //Updating backButton.update(elapsedTime.asSeconds()); //Drawing mainWindow.clear(); mainWindow.draw(settingsTitle); backButton.draw(mainWindow); mainWindow.display(); } else if (GAME_MODE == "New Game") { //Update nextButton.update(elapsedTime.asSeconds()); //Draw mainWindow.clear(); mainWindow.draw(newGameTitle); mainWindow.draw(storyText); mainWindow.draw(charInputText); mainWindow.draw(nameInputText); nextButton.draw(mainWindow); mainWindow.display(); } else if (GAME_MODE == "Load Game") { //Update //Draw mainWindow.clear(); mainWindow.draw(splashBox); mainWindow.display(); } //Try to keep approx 60 fps sf::Time timeToPause = sf::milliseconds(16) - frameClock.getElapsedTime(); sf::sleep(timeToPause); } //Terminate //system("pause"); return EXIT_SUCCESS; }
void ConnectionWizard::selected(const QString &page) { if (page == "Connection target") { switch (rtype) { case None: rbNone->setChecked(true); setState(false, false, false, false, true); break; case FX: rbFX->setChecked(true); setState(false, true, false, true, false); break; case In: rbInput->setChecked(true); setState(false, true, false, true, false); break; case Out: rbOutput->setChecked(true); setState(false, true, false, true, false); break; case PIn: case POut: rbPatch->setChecked(true); setState(true, true, false, true, false); break; } } else if (page == "Patch") { finishButton()->setEnabled(false); if (pto) { // find patch lbPatch->setCurrentItem(patchList.find(pto)); nextButton()->setEnabled(true); } else { QListBoxItem *si = lbPatch->selectedItem(); if (si) lbPatch->setSelected(si, false); lbPatch->setCurrentItem(-1); nextButton()->setEnabled(false); } cbMulti->setChecked(route.getMulti()); cbSimple->setChecked(route.getSimple()); } else if (page == "End") { nextButton()->setEnabled(false); switch (rtype) { case None: break; case FX: case In: case Out: loadEnd(rtype); break; case PIn: case POut: // load patch in or out ios.clear(); lbEnd->clear(); for (int i = 0; i < (int)pto->getMaxIOIdx(out); i++) { RSItemIO *io = pto->getIO(out, i); if (io) { ios.append(io); lbEnd->insertItem(io->getDesc()); } } route.setMulti(cbMulti->isChecked()); route.setSimple(cbSimple->isChecked()); break; } if (route.getToIO()) { lbEnd->setCurrentItem(ios.find(route.getToIO())); finishButton()->setEnabled(true); } else { QListBoxItem *si = lbEnd->selectedItem(); if (si) lbEnd->setSelected(si, false); lbEnd->setCurrentItem(-1); finishButton()->setEnabled(false); } } }
int ChoosePlayerScreen::Run(sf::RenderWindow & App, Game &game) { sf::Event event; bool running = true; windowWidth = App.getSize().x; windowHeight = App.getSize().y; sf::Font font; if (!font.loadFromFile("fonts/arial.ttf")) std::cerr << "Problem with loading fonts" << std::endl; const float BACK_MENU_BUTTON_POS_X = 0.08; const float BACK_MENU_BUTTON_POS_Y = 0.10; sf::String backToMenuButtonPath("image/MenuButton.png"); sf::String backToMenuHoverButtonPath("image/MenuButtonShadow.png"); ButtonView backToMenuButton(backToMenuButtonPath, backToMenuHoverButtonPath, false); float backToMenuButtonWidth = backToMenuButton.getGlobalBounds().width; float backToMenuButtonHeight = backToMenuButton.getGlobalBounds().height; float backToMenuButtonPosX = windowWidth * BACK_MENU_BUTTON_POS_X - backToMenuButtonWidth * 0.5; float backToMenuButtonPosY = windowHeight * BACK_MENU_BUTTON_POS_Y - backToMenuButtonHeight * 0.5; backToMenuButton.setPosition(sf::Vector2f(backToMenuButtonPosX, backToMenuButtonPosY)); const int MAX_PLAYERS = 6; vector<string> players; std::string choosePlayerText = "Wpisz nazwe gracza"; sf::Text choosePlayerLabel(choosePlayerText, font, 50); choosePlayerLabel.setColor(sf::Color(255, 255, 255, 255)); float choosePlayerPosX = windowWidth * 0.50 - choosePlayerLabel.getGlobalBounds().width * 0.5; float choosePlayerPosY = windowHeight * 0.10 - choosePlayerLabel.getGlobalBounds().height * 0.5; choosePlayerLabel.setPosition(choosePlayerPosX, choosePlayerPosY); std::string playerName; sf::Color textColor = sf::Color::Black; sf::Vector2f frameSize(310, 45); sf::Color frameColor = sf::Color::White; float playerNamePosX = windowWidth * 0.35; float playerNamePosY = windowHeight * 0.32; playerNameTextField = TextField(playerName, font, 35, textColor); playerNameTextField.setFrame(frameSize, frameColor); playerNameTextField.setPositon(sf::Vector2f(playerNamePosX, playerNamePosY)); sf::String addPlayerButtonPath("image/Accept.png"); sf::String addPlayerHoverButtonPath("image/AcceptShadow.png"); ButtonView addPlayerButton(addPlayerButtonPath, addPlayerHoverButtonPath, false); float addPlayerButtonPosX = windowWidth * 0.70 - addPlayerButton.getGlobalBounds().width * 0.5; float addPlayerButtonPosY = windowHeight * 0.35 - addPlayerButton.getGlobalBounds().height * 0.5; addPlayerButton.setPosition(addPlayerButtonPosX, addPlayerButtonPosY); std::string playerText = "Wprowadz nazwy graczy"; sf::Text playerLabel(playerText, font, 30); playerLabel.setColor(sf::Color(255, 255, 255, 255)); float playerLabelPosX = windowWidth * 0.50 - playerLabel.getGlobalBounds().width * 0.5; float playerLabelPosY = windowHeight * 0.50 - playerLabel.getGlobalBounds().height * 0.5; playerLabel.setPosition(playerLabelPosX, playerLabelPosY); sf::String nextButtonPath("image/ForwardButton.png"); ButtonView nextButton(nextButtonPath, nextButtonPath, false); float nextButtonPosX = windowWidth * 0.80 - nextButton.getGlobalBounds().width * 0.5; float nextButtonPosY = windowHeight * 0.80 - nextButton.getGlobalBounds().height * 0.5; nextButton.setPosition(nextButtonPosX, nextButtonPosY); while (running) { while (App.pollEvent(event)) { sf::Mouse mouse; sf::Vector2i mousePos = mouse.getPosition(App); switch (event.type) { case sf::Event::Closed: App.close(); break; case sf::Event::MouseMoved: if (backToMenuButton.isButtonHoverd(mousePos) && mouse.isButtonPressed(sf::Mouse::Left)) { return (0); } if (nextButton.isButtonHoverd(mousePos) && mouse.isButtonPressed(sf::Mouse::Left)) { game.setPlayersNames(players); return (2); } if (addPlayerButton.isButtonHoverd(mousePos) && mouse.isButtonPressed(sf::Mouse::Left) && playerName.size() > 0) { players.push_back(playerName); playerName = ""; playerNameTextField.setString(playerName); playerText = ""; for (string name : players) { if (players.size() < MAX_PLAYERS || name != players.back()) playerText += name + " vs "; else playerText += name; } playerLabel.setString(playerText); playerLabelPosX = windowWidth * 0.50 - playerLabel.getGlobalBounds().width * 0.5; playerLabel.setPosition(playerLabelPosX, playerLabelPosY); } break; case sf::Event::TextEntered: playerName = playerNameTextField.action(event); break; default: break; } } App.clear(sf::Color(56, 134, 185, 255)); App.draw(playerLabel); App.draw(choosePlayerLabel); App.draw(backToMenuButton); playerNameTextField.draw(App); if (!addPlayerButton.isHidden()) App.draw(addPlayerButton); if (players.size() >= 2) App.draw(nextButton); App.display(); } return (-1); }
void ConnectionWizard::patchListClicked(QListBoxItem *item) { pto = patchList.at(lbPatch->index(item)); route.setToIO(NULL); nextButton()->setEnabled(true); }