Hello community, here is the log from the commit of package picmi for openSUSE:Factory checked in at 2013-07-22 17:20:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/picmi (Old) and /work/SRC/openSUSE:Factory/.picmi.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "picmi" Changes: -------- --- /work/SRC/openSUSE:Factory/picmi/picmi.changes 2013-07-08 07:28:18.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.picmi.new/picmi.changes 2013-07-22 17:20:57.000000000 +0200 @@ -1,0 +2,7 @@ +Mon Jul 15 08:14:24 UTC 2013 - cgiboude...@gmx.com + +- Update to 4.10.95 + * KDE 4.11 RC 1 release + * See http://www.kde.org/announcements/announce-4.11-rc1.php + +------------------------------------------------------------------- Old: ---- picmi-4.10.90.tar.xz New: ---- picmi-4.10.95.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ picmi.spec ++++++ --- /var/tmp/diff_new_pack.RXBdNZ/_old 2013-07-22 17:20:58.000000000 +0200 +++ /var/tmp/diff_new_pack.RXBdNZ/_new 2013-07-22 17:20:58.000000000 +0200 @@ -23,7 +23,7 @@ License: GPL-2.0+ Group: Amusements/Games/Board/Logic Url: http://www.kde.org -Version: 4.10.90 +Version: 4.10.95 Release: 0 Source0: picmi-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ picmi-4.10.90.tar.xz -> picmi-4.10.95.tar.xz ++++++ Files old/picmi-4.10.90/doc/index.cache.bz2 and new/picmi-4.10.95/doc/index.cache.bz2 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/picmi.desktop new/picmi-4.10.95/picmi.desktop --- old/picmi-4.10.90/picmi.desktop 2013-06-10 20:55:21.000000000 +0200 +++ new/picmi-4.10.95/picmi.desktop 2013-07-10 15:48:08.000000000 +0200 @@ -83,7 +83,7 @@ Comment[es]=Un juego de lógica con números Comment[et]=Arvuloogikamäng Comment[fi]=Lukulogiikkapeli -Comment[fr]=Un jeu de logique sur les chiffres +Comment[fr]=Un jeu de logique avec des chiffres Comment[gl]=Un xogo de lóxica numérica. Comment[hu]=Egy számos logikai játék Comment[it]=Un gioco di logica con i numeri diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/src/gui/mainwindow.cpp new/picmi-4.10.95/src/gui/mainwindow.cpp --- old/picmi-4.10.90/src/gui/mainwindow.cpp 2013-06-10 20:55:21.000000000 +0200 +++ new/picmi-4.10.95/src/gui/mainwindow.cpp 2013-07-10 01:40:56.000000000 +0200 @@ -64,6 +64,10 @@ m_action_pause = KStandardGameAction::pause(this, SLOT(togglePaused(bool)), actionCollection()); m_action_undo = KStandardGameAction::undo(this, SLOT(undo()), actionCollection()); m_action_hint = KStandardGameAction::hint(this, SLOT(hint()), actionCollection()); + m_action_solve = KStandardGameAction::solve(this, SLOT(solve()), actionCollection()); + + /* Prevent the default hint shortcut from overwriting our HJKL vim-like control mapping. */ + m_action_hint->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I)); m_action_save_state = actionCollection()->addAction("save-position"); m_action_save_state->setText(i18n("Save Position")); @@ -162,8 +166,16 @@ void MainWindow::hint() { QPoint p = m_game->hint(); - m_scene->refresh(p); - m_scene->hover(p.x(), p.y()); + + if (m_in_progress) { + m_scene->refresh(p); + m_scene->hover(p.x(), p.y()); + } +} + +void MainWindow::solve() +{ + m_game->solve(); } void MainWindow::saveState() { @@ -207,6 +219,7 @@ m_action_undo->setEnabled(false); m_action_hint->setEnabled(true); + m_action_solve->setEnabled(true); m_action_save_state->setEnabled(true); m_action_load_state->setEnabled(false); m_action_pause->setEnabled(true); @@ -224,6 +237,7 @@ connect(&m_timer, SIGNAL(timeout()), this, SLOT(updatePlayedTime())); connect(m_game.data(), SIGNAL(stateChanged()), this, SLOT(updatePositions())); + connect(m_game.data(), SIGNAL(gameCompleted()), this, SLOT(gameCompleted())); connect(m_game.data(), SIGNAL(gameWon()), this, SLOT(gameWon())); connect(m_game.data(), SIGNAL(undoStackSizeChanged(int)), this, SLOT(undoStackSizeChanged(int))); connect(m_game.data(), SIGNAL(saveStackSizeChanged(int)), this, SLOT(saveStackSizeChanged(int))); @@ -252,16 +266,6 @@ void MainWindow::gameWon() { KScoreDialog::FieldInfo score = m_game->endGame(); - m_view.setEnabled(false); - m_action_pause->setEnabled(false); - m_action_hint->setEnabled(false); - m_action_undo->setEnabled(false); - m_action_save_state->setEnabled(false); - m_action_load_state->setEnabled(false); - Kg::difficulty()->setGameRunning(false); - m_timer.stop(); - m_in_progress = false; - bool notified = false; if (m_mode == Random && Kg::difficultyLevel() != KgDifficultyLevel::Custom) { QSharedPointer<KScoreDialog> scoreDialog = createScoreDialog(); @@ -282,6 +286,19 @@ m_view.setFocus(); } +void MainWindow::gameCompleted() { + m_view.setEnabled(false); + m_action_pause->setEnabled(false); + m_action_solve->setEnabled(false); + m_action_hint->setEnabled(false); + m_action_undo->setEnabled(false); + m_action_save_state->setEnabled(false); + m_action_load_state->setEnabled(false); + Kg::difficulty()->setGameRunning(false); + m_timer.stop(); + m_in_progress = false; +} + void MainWindow::highscores() { pauseGame(); @@ -295,6 +312,7 @@ m_view.setPaused(paused); m_action_undo->setEnabled(!paused); m_action_hint->setEnabled(!paused); + m_action_solve->setEnabled(!paused); m_action_save_state->setEnabled(!paused); m_action_load_state->setEnabled(!paused); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/src/gui/mainwindow.h new/picmi-4.10.95/src/gui/mainwindow.h --- old/picmi-4.10.90/src/gui/mainwindow.h 2013-06-10 20:55:21.000000000 +0200 +++ new/picmi-4.10.95/src/gui/mainwindow.h 2013-07-10 01:40:56.000000000 +0200 @@ -50,9 +50,11 @@ void restartGame(); void togglePaused(bool paused); void settings(); + void gameCompleted(); void gameWon(); void undo(); void hint(); + void solve(); void saveState(); void loadState(); void highscores(); @@ -81,7 +83,11 @@ QSharedPointer<KScoreDialog> createScoreDialog(); void setupActions(); - KAction *m_action_undo, *m_action_save_state, *m_action_load_state, *m_action_hint; + KAction *m_action_undo, + *m_action_save_state, + *m_action_load_state, + *m_action_hint, + *m_action_solve; KToggleAction *m_action_pause; QLabel *m_status_time, *m_status_position; View m_view; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/src/gui/scene.cpp new/picmi-4.10.95/src/gui/scene.cpp --- old/picmi-4.10.90/src/gui/scene.cpp 2013-05-28 22:15:50.000000000 +0200 +++ new/picmi-4.10.95/src/gui/scene.cpp 2013-07-10 01:40:56.000000000 +0200 @@ -150,7 +150,7 @@ m_cells[0]->setFocus(); updateHighlights(); - connect(m_game.data(), SIGNAL(gameWon()), this, SLOT(onGameWon())); + connect(m_game.data(), SIGNAL(gameCompleted()), this, SLOT(onGameCompleted())); } void Scene::refresh() { @@ -193,7 +193,7 @@ refresh(QPoint(x, y)); } -void Scene::onGameWon() { +void Scene::onGameCompleted() { hideHighlights(); refresh(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/src/gui/scene.h new/picmi-4.10.95/src/gui/scene.h --- old/picmi-4.10.90/src/gui/scene.h 2013-05-28 22:15:50.000000000 +0200 +++ new/picmi-4.10.95/src/gui/scene.h 2013-07-10 01:40:56.000000000 +0200 @@ -60,7 +60,7 @@ void forwardKeyPressEvent(QKeyEvent *event); private slots: - void onGameWon(); + void onGameCompleted(); private: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/src/logic/boardstate.cpp new/picmi-4.10.95/src/logic/boardstate.cpp --- old/picmi-4.10.90/src/logic/boardstate.cpp 2013-05-28 22:15:50.000000000 +0200 +++ new/picmi-4.10.95/src/logic/boardstate.cpp 2013-07-10 01:40:56.000000000 +0200 @@ -122,3 +122,16 @@ } } } + +void BoardState::solve(const Board *board) { + assert(board->width() == width()); + assert(board->height() == height()); + + for (int y = 0; y < height(); y++) { + for (int x = 0; x < width(); x++) { + m_state[xy_to_i(x, y)] = board->get(x, y); + } + } + + replace(Board::Nothing, Board::Cross); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/src/logic/boardstate.h new/picmi-4.10.95/src/logic/boardstate.h --- old/picmi-4.10.90/src/logic/boardstate.h 2013-05-28 22:15:50.000000000 +0200 +++ new/picmi-4.10.95/src/logic/boardstate.h 2013-07-10 01:40:56.000000000 +0200 @@ -63,6 +63,10 @@ bookkeeping information (undo history, box count) is _not_ updated */ void replace(enum State prev, enum State next); + /* Copies the board to this state. Like replace(), bookkeeping + information is not updated since this is the final action in a game. */ + void solve(const Board *board); + signals: void undoStackSizeChanged(int size); void saveStackSizeChanged(int size); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/src/logic/picmi.cpp new/picmi-4.10.95/src/logic/picmi.cpp --- old/picmi-4.10.90/src/logic/picmi.cpp 2013-06-10 20:55:21.000000000 +0200 +++ new/picmi-4.10.95/src/logic/picmi.cpp 2013-07-10 01:40:56.000000000 +0200 @@ -169,31 +169,44 @@ QPoint Picmi::hint() { - QVector<QPoint> empty_cells; + QVector<QPoint> incorrect_cells; for (int x = 0; x != width(); ++x) { for (int y = 0; y != height(); ++y) { - if (stateAt(x, y) == Board::Nothing) { - empty_cells.push_back(QPoint(x, y)); + const Board::State m = m_map->get(x, y); + const Board::State s = m_state->get(x, y); + + if ((m == Board::Box && s != Board::Box) || + (m == Board::Nothing && s != Board::Cross)) { + incorrect_cells.push_back(QPoint(x, y)); } } } - if (empty_cells.size() == 0) { + if (incorrect_cells.size() == 0) { return QPoint(0, 0); } - const int idx = rand() % empty_cells.size(); - const QPoint cell(empty_cells.at(idx)); + const int idx = rand() % incorrect_cells.size(); + const QPoint cell(incorrect_cells.at(idx)); Board::State state = m_map->get(cell.x(), cell.y()); if (state == Board::Nothing) { state = Board::Cross; } + /* Clear the state in order to ensure the subsequent setState succeeds. */ + m_state->set(cell.x(), cell.y(), Board::Nothing); setState(cell.x(), cell.y(), state); m_timer.addPenaltyTime(); return cell; } +void Picmi::solve() { + m_state->solve(m_map.data()); + m_streaks->update(); + endGame(); + emit gameCompleted(); +} + KScoreDialog::FieldInfo Picmi::endGame() { m_timer.stop(); @@ -231,6 +244,7 @@ emit stateChanged(); if (m_state->boxCount() == m_map->boxCount() && won()) { m_state->replace(Board::Nothing, Board::Cross); + emit gameCompleted(); emit gameWon(); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.10.90/src/logic/picmi.h new/picmi-4.10.95/src/logic/picmi.h --- old/picmi-4.10.90/src/logic/picmi.h 2013-06-10 20:55:21.000000000 +0200 +++ new/picmi-4.10.95/src/logic/picmi.h 2013-07-10 01:40:56.000000000 +0200 @@ -73,8 +73,12 @@ /* undo last action (if it exists) and return the changed coordinate. */ QPoint undo(); + /* Uncovers a single, random, still uncovered cell. */ QPoint hint(); + /* Solves the entire board, but does not emit the gameWon signal. */ + void solve(); + /* if a saved state exists, load it. otherwise, do nothing */ void loadState() { m_state->loadState(); m_streaks->update(); emit stateChanged(); } void saveState() { m_state->saveState(); } @@ -87,6 +91,10 @@ QVector<QSharedPointer<Streaks::StreakElement> > getColStreak(int x) const; signals: + /** Emitted when the game has been completed in any way. Also triggered if "Solve" was used. */ + void gameCompleted(); + + /** Emitted when the game has actually been won (i.e. "Solve" wasn't used). */ void gameWon(); /** -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org