Hello community, here is the log from the commit of package picmi for openSUSE:Factory checked in at 2014-03-18 17:17:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2014-02-20 07:58:23.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.picmi.new/picmi.changes 2014-03-18 17:17:39.000000000 +0100 @@ -1,0 +2,14 @@ +Thu Mar 13 20:48:08 UTC 2014 - tittiatc...@gmail.com + +- Update to 4.12.90 + * KDE 4.13 Beta 2 release + * See http://www.kde.org/announcements/announce-4.13-beta2.php + +------------------------------------------------------------------- +Fri Mar 7 11:32:11 UTC 2014 - tittiatc...@gmail.com + +- Update to 4.12.80 + * KDE 4.13 Beta 1 release + * See http://www.kde.org/announcements/announce-4.13-beta1.php + +------------------------------------------------------------------- Old: ---- picmi-4.12.2.tar.xz New: ---- picmi-4.12.90.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ picmi.spec ++++++ --- /var/tmp/diff_new_pack.Eoqe8B/_old 2014-03-18 17:17:40.000000000 +0100 +++ /var/tmp/diff_new_pack.Eoqe8B/_new 2014-03-18 17:17:40.000000000 +0100 @@ -23,7 +23,7 @@ License: GPL-2.0+ Group: Amusements/Games/Board/Logic Url: http://www.kde.org -Version: 4.12.2 +Version: 4.12.90 Release: 0 Source0: picmi-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ picmi-4.12.2.tar.xz -> picmi-4.12.90.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.12.2/picmi.desktop new/picmi-4.12.90/picmi.desktop --- old/picmi-4.12.2/picmi.desktop 2013-11-29 08:06:58.000000000 +0100 +++ new/picmi-4.12.90/picmi.desktop 2014-03-04 06:57:03.000000000 +0100 @@ -2,7 +2,6 @@ Name=picmi Name[bs]=picmi Name[ca]=picmi -Name[ca@valencia]=picmi Name[cs]=picmi Name[da]=picmi Name[de]=picmi @@ -16,6 +15,7 @@ Name[hu]=picmi Name[it]=picmi Name[kk]=picmi +Name[ko]=picmi Name[lv]=picmi Name[mr]=पिक्मि Name[nb]=picmi @@ -42,7 +42,6 @@ GenericName=Logic Game GenericName[bs]=Logička igra GenericName[ca]=Joc de lògica -GenericName[ca@valencia]=Joc de lògica GenericName[cs]=Logická hra GenericName[da]=Logikspil GenericName[de]=Logikspiel @@ -56,6 +55,7 @@ GenericName[hu]=Logikai játék GenericName[it]=Gioco di logica GenericName[kk]=Логикалық ойын +GenericName[ko]=논리 게임 GenericName[lv]=Loģikas spēle GenericName[mr]=तर्क खेळ GenericName[nb]=Logikkspill @@ -83,7 +83,6 @@ Comment=A number logic game Comment[bs]=Logička igra s brojevima Comment[ca]=Un joc de lògica de nombres -Comment[ca@valencia]=Un joc de lògica de nombres Comment[cs]=Logická hra s čísly Comment[da]=Et spil med tallogik Comment[de]=Ein Logikspiel mit Zahlen @@ -96,6 +95,7 @@ Comment[hu]=Egy számos logikai játék Comment[it]=Un gioco di logica con i numeri Comment[kk]=Сандық логика ойны +Comment[ko]=숫자 논리 게임 Comment[lv]=Skaitļu loģikas spēle Comment[mr]=संख्या तर्क खेळ Comment[nb]=Et spill med tall-logikk diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.12.2/src/gui/graphicsitems/cellitem.cpp new/picmi-4.12.90/src/gui/graphicsitems/cellitem.cpp --- old/picmi-4.12.2/src/gui/graphicsitems/cellitem.cpp 2013-11-29 08:06:58.000000000 +0100 +++ new/picmi-4.12.90/src/gui/graphicsitems/cellitem.cpp 2014-03-04 06:57:03.000000000 +0100 @@ -20,6 +20,8 @@ #include <QGraphicsSceneMouseEvent> #include <QKeyEvent> +#include <QParallelAnimationGroup> +#include <QPropertyAnimation> #include <assert.h> #include "src/constants.h" @@ -47,6 +49,7 @@ const QSharedPointer<Picmi> m_game; const QPoint m_start; + QPoint m_prev_pos; Scene *m_scene; Board::State m_before, m_after, m_request; DragManager::DragDirection m_direction; @@ -54,7 +57,7 @@ }; DragManager::DragManager(QSharedPointer<Picmi> game, Scene *scene, QPoint start) : - m_game(game), m_start(start), m_scene(scene), m_initialized(false) + m_game(game), m_start(start), m_prev_pos(start), m_scene(scene), m_initialized(false) { m_direction = Undefined; } @@ -68,13 +71,33 @@ } void DragManager::move(int x, int y) { - QPoint normed = normCoordinates(x, y); - Board::State current = m_game->stateAt(normed.x(), normed.y()); - if (current == m_before && current != m_after && m_initialized) { - m_scene->press(normed.x(), normed.y(), m_request); - } else { - m_scene->hover(normed.x(), normed.y()); + const QPoint curr_pos = normCoordinates(x, y); + if (curr_pos == m_prev_pos) { + return; + } + + /* When moving the mouse quickly, it can happen that subsequent calls to move() + * skip a tile. Ensure that all tiles between m_prev_pos and curr_pos are processed. */ + + QPoint step = curr_pos - m_prev_pos; + assert(step.x() == 0 || step.y() == 0); + step /= qMax(qAbs(step.x()), qAbs(step.y())); + assert(qAbs(step.x()) == 1 || qAbs(step.y()) == 1); + + for (QPoint i = m_prev_pos + step; ; i += step) { + const Board::State current = m_game->stateAt(i.x(), i.y()); + if (current == m_before && current != m_after && m_initialized) { + m_scene->press(i.x(), i.y(), m_request); + } else { + m_scene->hover(i.x(), i.y()); + } + + if (i == curr_pos) { + break; + } } + + m_prev_pos = curr_pos; } QPoint DragManager::normCoordinates(int x, int y) { @@ -144,14 +167,60 @@ } GameCellItem::GameCellItem(int x, int y, QSharedPointer<Picmi> game, Scene *scene, QGraphicsItem *parent) : - CellItem(x, y, game, parent), m_scene(scene) + CellItem(x, y, game, parent), m_scene(scene), m_state(Board::Nothing) { setFlag(QGraphicsItem::ItemIsFocusable); setAcceptHoverEvents(true); + m_anim = createAnimation(); + reload(QSize()); } +QAbstractAnimation *GameCellItem::createAnimation() { + QParallelAnimationGroup *anim_group = new QParallelAnimationGroup(this); + + QPropertyAnimation *anim = new QPropertyAnimation(this, "opacity"); + anim->setDuration(150); + anim->setStartValue(0.1); + anim->setEndValue(1.0); + anim_group->addAnimation(anim); + + anim = new QPropertyAnimation(this, "scale"); + anim->setDuration(150); + anim->setStartValue(0.3); + anim->setEndValue(1.0); + anim_group->addAnimation(anim); + + return anim_group; +} + +void GameCellItem::refresh() { + CellItem::refresh(); + + /* Only start animation when the cell state has changed. */ + + const Board::State curr_state = m_game->stateAt(m_x, m_y); + if (curr_state == m_state) { + return; + } + + m_state = curr_state; + m_anim->start(); +} + +void GameCellItem::reload(const QSize &size) { + /* Reset the transformation origin point for our scaling animation. */ + const int tilesize = getTilesize(); + setTransformOriginPoint(tilesize / 2, tilesize / 2); + + CellItem::reload(size); + + /* Save the original scene position - setTransformOriginPoint() together + * with scaling modify it. */ + m_sceneorigin = scenePos(); +} + QPixmap GameCellItem::getPixmap() const { switch(m_game->stateAt(m_x, m_y)) { case Board::Nothing: return Renderer::instance()->getPixmap(Renderer::Transparent); @@ -187,13 +256,9 @@ m_scene->hover(m_x, m_y); } -int GameCellItem::drag_offset(int pos) const { - const int tilesize = Renderer::instance()->getTilesize(); - int offset = pos / tilesize; - if (pos < 0) { - offset--; - } - return offset; +QPoint GameCellItem::sceneToGame(const QPointF &p) const { + const QPointF pf = (p - m_sceneorigin) / Renderer::instance()->getTilesize(); + return QPoint(m_x + pf.x(), m_y + pf.y()); } void GameCellItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { @@ -201,14 +266,12 @@ return; } - int dx = drag_offset(event->pos().x()); - int dy = drag_offset(event->pos().y()); - - if (m_game->outOfBounds(m_x + dx, m_y + dy)) { + const QPoint p = sceneToGame(event->scenePos()); + if (m_game->outOfBounds(p.x(), p.y())) { return; } - m_dragmanager->move(m_x + dx, m_y + dy); + m_dragmanager->move(p.x(), p.y()); } void GameCellItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.12.2/src/gui/graphicsitems/cellitem.h new/picmi-4.12.90/src/gui/graphicsitems/cellitem.h --- old/picmi-4.12.2/src/gui/graphicsitems/cellitem.h 2013-11-29 08:06:58.000000000 +0100 +++ new/picmi-4.12.90/src/gui/graphicsitems/cellitem.h 2014-03-04 06:57:03.000000000 +0100 @@ -26,6 +26,7 @@ class Scene; class DragManager; +class QAbstractAnimation; class CellItem : public QGraphicsPixmapItem, public ReloadableItem { @@ -56,8 +57,11 @@ virtual QPixmap getPixmap() const; }; -class GameCellItem : public CellItem +class GameCellItem : public QObject, public CellItem { + Q_OBJECT + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) + Q_PROPERTY(qreal scale READ scale WRITE setScale) public: /* creates the item with field coordinates (x,y) and the specified game and scene */ @@ -65,6 +69,9 @@ void keyPressEvent(QKeyEvent *event); + void refresh(); + void reload(const QSize &size); + protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); @@ -75,13 +82,19 @@ virtual QPixmap getPixmap() const; private: - - int drag_offset(int pos) const; + /** Converts scene- to game coordinates. */ + QPoint sceneToGame(const QPointF &p) const; + QAbstractAnimation *createAnimation(); private: Scene *m_scene; QSharedPointer<DragManager> m_dragmanager; Qt::MouseButton m_dragbutton; + QPointF m_sceneorigin; + + /* Animation members. */ + Board::State m_state; + QAbstractAnimation *m_anim; }; #endif // CELLITEM_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.12.2/src/gui/selectboardwindow.cpp new/picmi-4.12.90/src/gui/selectboardwindow.cpp --- old/picmi-4.12.2/src/gui/selectboardwindow.cpp 2013-11-29 08:06:58.000000000 +0100 +++ new/picmi-4.12.90/src/gui/selectboardwindow.cpp 2014-03-04 06:57:03.000000000 +0100 @@ -21,23 +21,17 @@ #include <assert.h> #include <klocale.h> #include <kpushbutton.h> +#include <qalgorithms.h> #include "src/logic/elapsedtime.h" #include "src/logic/levelloader.h" +static QString diffString(const int difficulty); + class LevelTableModel : public QAbstractTableModel { public: - LevelTableModel(const QList<QSharedPointer<Level> > &levels, QObject * parent = 0); - -protected: - int rowCount(const QModelIndex &parent) const; - int columnCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - -private: - const QList<QSharedPointer<Level> > &m_levels; + LevelTableModel(QList<QSharedPointer<Level> > &levels, QObject * parent = 0); enum Columns { Name, @@ -47,9 +41,18 @@ Solved, ColumnCount /* not a real column */ }; + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + +private: + QList<QSharedPointer<Level> > &m_levels; }; -LevelTableModel::LevelTableModel(const QList<QSharedPointer<Level> > &levels, QObject *parent) : +LevelTableModel::LevelTableModel(QList<QSharedPointer<Level> > &levels, QObject *parent) : QAbstractTableModel(parent), m_levels(levels) { @@ -78,9 +81,9 @@ switch (index.column()) { case Name: return level->visibleName(); case LevelSet: return level->levelset(); - case Difficulty: return level->difficulty(); + case Difficulty: return diffString(level->difficulty()); case Size: return QString("%1x%2").arg(level->width()).arg(level->height()); - case Solved: return "TODO"; + case Solved: return (level->solved()) ? Time(level->solvedTime()).toString() : "-"; default: assert(0); } @@ -101,28 +104,101 @@ return QAbstractTableModel::headerData(section, orientation, role); } +typedef bool (*LevelComparator)(const QSharedPointer<Level> &, + const QSharedPointer<Level> &); + +static bool levelLessThan(const QSharedPointer<Level> &lhs, + const QSharedPointer<Level> &rhs) { + return lhs->name() < rhs->name(); +} + +static bool levelGreaterThan(const QSharedPointer<Level> &lhs, + const QSharedPointer<Level> &rhs) { + return levelLessThan(rhs, lhs); +} + +static bool diffLessThan(const QSharedPointer<Level> &lhs, + const QSharedPointer<Level> &rhs) { + return lhs->difficulty() < rhs->difficulty(); +} + +static bool diffGreaterThan(const QSharedPointer<Level> &lhs, + const QSharedPointer<Level> &rhs) { + return diffLessThan(rhs, lhs); +} + +static bool solvedLessThan(const QSharedPointer<Level> &lhs, + const QSharedPointer<Level> &rhs) { + if (!lhs->solved() && !rhs->solved()) { + return false; + } else if (!lhs->solved() || !rhs->solved()) { + return lhs->solved(); + } else { + return (lhs->solvedTime() < rhs->solvedTime()); + } +} + +static bool solvedGreaterThan(const QSharedPointer<Level> &lhs, + const QSharedPointer<Level> &rhs) { + return solvedLessThan(rhs, lhs); +} + +void LevelTableModel::sort(int column, Qt::SortOrder order) { + LevelComparator cmp = NULL; + switch (column) { + case Name: cmp = (order == Qt::AscendingOrder) ? levelLessThan : levelGreaterThan; break; + case Difficulty: cmp = (order == Qt::AscendingOrder) ? diffLessThan : diffGreaterThan; break; + case Solved: cmp = (order == Qt::AscendingOrder) ? solvedLessThan : solvedGreaterThan; break; + default: assert(0); + } + + qStableSort(m_levels.begin(), m_levels.end(), cmp); + emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() -1)); +} + SelectBoardWindow::SelectBoardWindow(QWidget *parent) : KDialog(parent) { setModal(true); setCaption(i18n("Level Selection")); - setMinimumSize(600, 350); ui = new Ui::LevelSelectUi; ui->setupUi(mainWidget()); m_levels = LevelLoader::load(); m_model = QSharedPointer<LevelTableModel>(new LevelTableModel(m_levels)); - ui->listView->setModel(m_model.data()); + + ui->tableView->setUpdatesEnabled(false); + ui->tableView->setModel(m_model.data()); + + /* Hide all columns except Level, Difficulty and Solved. */ + + for (int i = 0; i < m_model->columnCount(); i++) { + ui->tableView->hideColumn(i); + } + ui->tableView->showColumn(LevelTableModel::Name); + ui->tableView->showColumn(LevelTableModel::Difficulty); + ui->tableView->showColumn(LevelTableModel::Solved); + + ui->tableView->sortByColumn(LevelTableModel::Name, Qt::AscendingOrder); + ui->tableView->sortByColumn(LevelTableModel::Solved, Qt::DescendingOrder); + ui->tableView->sortByColumn(LevelTableModel::Difficulty, Qt::AscendingOrder); + + ui->tableView->resizeColumnsToContents(); + ui->tableView->resizeRowsToContents(); if (m_levels.empty()) { button(KDialog::Ok)->setEnabled(false); } else { - QModelIndex index = m_model->index(0, 0); - ui->listView->selectionModel()->select(index, QItemSelectionModel::Select); - connect(ui->listView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(selectedLevelChanged(QModelIndex,QModelIndex))); + resetSelection(); + connect(ui->tableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), + this, SLOT(selectedLevelChanged(QModelIndex,QModelIndex))); + connect(m_model.data(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(levelDataChanged(QModelIndex,QModelIndex))); updateDetails(m_levels[0]); } + + ui->tableView->setUpdatesEnabled(true); } void SelectBoardWindow::showEvent(QShowEvent *event) { @@ -144,7 +220,15 @@ updateDetails(m_levels[current.row()]); } -QString SelectBoardWindow::diffString(int difficulty) const { +void SelectBoardWindow::levelDataChanged(const QModelIndex &topLeft, const + QModelIndex &bottomRight) { + Q_UNUSED(topLeft); + Q_UNUSED(bottomRight); + resetSelection(); + updateDetails(selectedBoard()); +} + +static QString diffString(const int difficulty) { if (difficulty < 0) { return diffString(0); } else if (difficulty > 7) { @@ -182,7 +266,14 @@ } } +void SelectBoardWindow::resetSelection() { + QModelIndex index = m_model->index(0, 0); + QItemSelectionModel::SelectionFlags flags = + QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows; + ui->tableView->selectionModel()->select(index, flags); +} + QSharedPointer<Level> SelectBoardWindow::selectedBoard() const { - int index = ui->listView->selectionModel()->selectedIndexes().at(0).row(); + int index = ui->tableView->selectionModel()->selectedIndexes().at(0).row(); return m_levels[index]; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.12.2/src/gui/selectboardwindow.h new/picmi-4.12.90/src/gui/selectboardwindow.h --- old/picmi-4.12.2/src/gui/selectboardwindow.h 2013-11-29 08:06:58.000000000 +0100 +++ new/picmi-4.12.90/src/gui/selectboardwindow.h 2014-03-04 06:57:03.000000000 +0100 @@ -42,10 +42,11 @@ private slots: void selectedLevelChanged(const QModelIndex ¤t, const QModelIndex &previous); + void levelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); private: void updateDetails(QSharedPointer<Level> level); - QString diffString(int difficulty) const; + void resetSelection(); Ui::LevelSelectUi *ui; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.12.2/src/gui/selectboardwindow.ui new/picmi-4.12.90/src/gui/selectboardwindow.ui --- old/picmi-4.12.2/src/gui/selectboardwindow.ui 2013-11-29 08:06:58.000000000 +0100 +++ new/picmi-4.12.90/src/gui/selectboardwindow.ui 2014-03-04 06:57:03.000000000 +0100 @@ -9,10 +9,16 @@ <rect> <x>0</x> <y>0</y> - <width>600</width> + <width>700</width> <height>350</height> </rect> </property> + <property name="minimumSize"> + <size> + <width>700</width> + <height>350</height> + </size> + </property> <property name="windowTitle"> <string>Level Selection</string> </property> @@ -20,13 +26,49 @@ <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QListView" name="listView"> + <widget class="QTableView" name="tableView"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <property name="showDropIndicator" stdset="0"> + <bool>false</bool> + </property> + <property name="alternatingRowColors"> + <bool>false</bool> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::SingleSelection</enum> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectRows</enum> + </property> + <property name="showGrid"> + <bool>false</bool> + </property> + <property name="gridStyle"> + <enum>Qt::NoPen</enum> + </property> + <property name="sortingEnabled"> + <bool>true</bool> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="cornerButtonEnabled"> + <bool>false</bool> + </property> + <attribute name="horizontalHeaderVisible"> + <bool>true</bool> + </attribute> + <attribute name="horizontalHeaderStretchLastSection"> + <bool>true</bool> + </attribute> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> </widget> </item> <item> @@ -45,27 +87,6 @@ </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="labelSize"> - <property name="text"> - <string>Size: -</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="labelDifficulty"> - <property name="text"> - <string>Difficulty: -</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="labelSolved"> - <property name="text"> - <string>Solved: -</string> - </property> - </widget> - </item> <item row="5" column="0"> <widget class="QLabel" name="labelImage"> <property name="sizePolicy"> @@ -93,6 +114,27 @@ </property> </widget> </item> + <item row="4" column="0"> + <widget class="QLabel" name="labelSolved"> + <property name="text"> + <string>Solved: -</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="labelSize"> + <property name="text"> + <string>Size: -</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="labelDifficulty"> + <property name="text"> + <string>Difficulty: -</string> + </property> + </widget> + </item> </layout> </item> </layout> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.12.2/src/logic/boardmap.cpp new/picmi-4.12.90/src/logic/boardmap.cpp --- old/picmi-4.12.2/src/logic/boardmap.cpp 2013-11-29 08:06:58.000000000 +0100 +++ new/picmi-4.12.90/src/logic/boardmap.cpp 2014-03-04 06:57:03.000000000 +0100 @@ -18,9 +18,9 @@ #include "boardmap.h" +#include <qglobal.h> +#include <QTime> #include <QVector> -#include <stdlib.h> -#include <time.h> static int box_count(const QList<Board::State> &data) { int count = 0; @@ -47,16 +47,24 @@ } void BoardMap::genRandom() { + /* To maintain a uniformly random selection of k elements: + * element i enters the selection with probability k/i. */ - QVector<int> indices; + qsrand(QTime::currentTime().msec()); + + QVector<int> indices(m_box_count); for (int i = 0; i < m_size; i++) { - indices.push_back(i); + if (i < m_box_count) { + indices[i] = i; + continue; + } + + if (qrand() % i <= m_box_count) { + indices[qrand() % indices.size()] = i; + } } - srand(time(NULL)); - for (int i = 0; i < m_box_count; i++) { - int ind = rand() % indices.size(); - m_state[indices[ind]] = Box; - indices.remove(ind); + for (int i = 0; i < indices.size(); i++) { + m_state[indices[i]] = Box; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/picmi-4.12.2/themes/picmi.desktop new/picmi-4.12.90/themes/picmi.desktop --- old/picmi-4.12.2/themes/picmi.desktop 2013-11-29 08:06:58.000000000 +0100 +++ new/picmi-4.12.90/themes/picmi.desktop 2014-03-04 06:57:03.000000000 +0100 @@ -3,7 +3,6 @@ Name=Picmi Name[bs]=Picmi Name[ca]=Picmi -Name[ca@valencia]=Picmi Name[cs]=Picmi Name[da]=Picmi Name[de]=Picmi @@ -17,6 +16,7 @@ Name[hu]=Picmi Name[it]=Picmi Name[kk]=Picmi +Name[ko]=Picmi Name[lv]=Picmi Name[mr]=पिक्मि Name[nb]=Picmi -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org