Changeset View
Changeset View
Standalone View
Standalone View
src/gui/ksudoku.cpp
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | 79 | void KSudoku::onCompleted(bool isCorrect, const QTime& required, bool withHelp) { | |||
---|---|---|---|---|---|
97 | else | 97 | else | ||
98 | if (mins == 0) | 98 | if (mins == 0) | ||
99 | msg = i18np("Congratulations! You made it in 1 second.", "Congratulations! You made it in %1 seconds.", secs); | 99 | msg = i18np("Congratulations! You made it in 1 second.", "Congratulations! You made it in %1 seconds.", secs); | ||
100 | else if (secs == 0) | 100 | else if (secs == 0) | ||
101 | msg = i18np("Congratulations! You made it in 1 minute.", "Congratulations! You made it in %1 minutes.", mins); | 101 | msg = i18np("Congratulations! You made it in 1 minute.", "Congratulations! You made it in %1 minutes.", mins); | ||
102 | else | 102 | else | ||
103 | msg = i18nc("The two parameters are strings like '2 minutes' or '1 second'.", "Congratulations! You made it in %1 and %2.", i18np("1 minute", "%1 minutes", mins), i18np("1 second", "%1 seconds", secs)); | 103 | msg = i18nc("The two parameters are strings like '2 minutes' or '1 second'.", "Congratulations! You made it in %1 and %2.", i18np("1 minute", "%1 minutes", mins), i18np("1 second", "%1 seconds", secs)); | ||
104 | 104 | | |||
105 | onModified(true); // make sure buttons have the correct enabled state | ||||
106 | | ||||
105 | KMessageBox::information(this, msg); | 107 | KMessageBox::information(this, msg); | ||
106 | 108 | | |||
107 | } | 109 | } | ||
108 | 110 | | |||
109 | // void KSudoku::updateStatusBar() | 111 | // void KSudoku::updateStatusBar() | ||
110 | // { | 112 | // { | ||
111 | // QString m=""; | 113 | // QString m=""; | ||
112 | // // QWidget* current = m_tabs->currentPage(); | 114 | // // QWidget* current = m_tabs->currentPage(); | ||
▲ Show 20 Lines • Show All 432 Lines • ▼ Show 20 Line(s) | 546 | void KSudoku::adaptActions2View() { | |||
545 | Game game = currentGame(); | 547 | Game game = currentGame(); | ||
546 | 548 | | |||
547 | m_gameSave->setEnabled(game.isValid()); | 549 | m_gameSave->setEnabled(game.isValid()); | ||
548 | m_gameSaveAs->setEnabled(game.isValid()); | 550 | m_gameSaveAs->setEnabled(game.isValid()); | ||
549 | action("game_new")->setEnabled(game.isValid()); | 551 | action("game_new")->setEnabled(game.isValid()); | ||
550 | action("game_restart")->setEnabled(game.isValid()); | 552 | action("game_restart")->setEnabled(game.isValid()); | ||
551 | action("game_print")->setEnabled(game.isValid()); | 553 | action("game_print")->setEnabled(game.isValid()); | ||
552 | if(game.isValid()) { | 554 | if(game.isValid()) { | ||
555 | bool isEnterPuzzleMode = !game.puzzle()->hasSolution(); | ||||
556 | action("move_hint")->setVisible(!isEnterPuzzleMode); | ||||
557 | action("move_solve")->setVisible(!isEnterPuzzleMode); | ||||
558 | action("move_dub_puzzle")->setVisible(isEnterPuzzleMode); | ||||
559 | | ||||
553 | action("move_undo")->setEnabled(game.canUndo()); | 560 | action("move_undo")->setEnabled(game.canUndo()); | ||
554 | action("move_redo")->setEnabled(game.canRedo()); | 561 | action("move_redo")->setEnabled(game.canRedo()); | ||
555 | 562 | | |||
556 | action("move_hint") ->setEnabled( game.puzzle()->hasSolution()); | 563 | action("move_hint") ->setEnabled( game.puzzle()->hasSolution()); | ||
557 | action("move_solve") ->setEnabled( game.puzzle()->hasSolution()); | 564 | action("move_solve") ->setEnabled( game.puzzle()->hasSolution()); | ||
558 | action("move_dub_puzzle")->setEnabled( ! game.puzzle()->hasSolution()); | 565 | action("move_dub_puzzle")->setEnabled( ! game.puzzle()->hasSolution()); | ||
559 | } else { | 566 | } else { | ||
560 | action("move_undo")->setEnabled(false); | 567 | action("move_undo")->setEnabled(false); | ||
561 | action("move_redo")->setEnabled(false); | 568 | action("move_redo")->setEnabled(false); | ||
562 | 569 | | |||
563 | action("move_hint")->setEnabled(false); | 570 | action("move_hint")->setVisible(false); | ||
564 | action("move_solve")->setEnabled(false); | 571 | action("move_solve")->setVisible(false); | ||
565 | action("move_dub_puzzle")->setEnabled(false); | 572 | action("move_dub_puzzle")->setVisible(false); | ||
566 | } | 573 | } | ||
567 | } | 574 | } | ||
568 | 575 | | |||
569 | void KSudoku::onModified(bool /*isModified*/) { | 576 | void KSudoku::onModified(bool /*isModified*/) { | ||
570 | Game game = currentGame(); | 577 | Game game = currentGame(); | ||
571 | if(game.isValid()) { | 578 | if(game.isValid()) { | ||
572 | action("move_undo")->setEnabled(game.canUndo()); | 579 | action("move_undo")->setEnabled(game.canUndo()); | ||
573 | action("move_redo")->setEnabled(game.canRedo()); | 580 | action("move_redo")->setEnabled(game.canRedo()); | ||
581 | action("move_hint")->setEnabled(!game.allValuesSetAndUsable()); | ||||
582 | action("move_solve")->setEnabled(!game.wasFinished()); | ||||
574 | } | 583 | } | ||
575 | } | 584 | } | ||
576 | 585 | | |||
577 | void KSudoku::undo() { | 586 | void KSudoku::undo() { | ||
578 | Game game = currentGame(); | 587 | Game game = currentGame(); | ||
579 | if(!game.isValid()) return; | 588 | if(!game.isValid()) return; | ||
580 | 589 | | |||
581 | game.interface()->undo(); | 590 | game.interface()->undo(); | ||
▲ Show 20 Lines • Show All 336 Lines • Show Last 20 Lines |