diff -Nru blinken-4.7.3/CMakeLists.txt blinken-4.7.90/CMakeLists.txt --- blinken-4.7.3/CMakeLists.txt 2011-10-02 13:23:35.000000000 +0000 +++ blinken-4.7.90/CMakeLists.txt 2011-07-27 18:37:45.000000000 +0000 @@ -5,6 +5,7 @@ include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}) set(CMAKE_MODULE_PATH ${blinken_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) +add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) add_subdirectory( doc ) add_subdirectory( src ) diff -Nru blinken-4.7.3/debian/changelog blinken-4.7.90/debian/changelog --- blinken-4.7.3/debian/changelog 2011-11-23 23:51:45.000000000 +0000 +++ blinken-4.7.90/debian/changelog 2011-12-20 23:52:44.000000000 +0000 @@ -1,3 +1,9 @@ +blinken (4:4.7.90-0ubuntu1) precise; urgency=low + + * new upstream beta release + + -- Jonathan Riddell Thu, 15 Dec 2011 14:17:53 +0000 + blinken (4:4.7.3-0ubuntu1) precise; urgency=low * New upstream release Binary files /tmp/4a5U16PX6q/blinken-4.7.3/doc/index.cache.bz2 and /tmp/hCk7u3gbZE/blinken-4.7.90/doc/index.cache.bz2 differ diff -Nru blinken-4.7.3/src/blinken.cpp blinken-4.7.90/src/blinken.cpp --- blinken-4.7.3/src/blinken.cpp 2011-10-02 13:23:35.000000000 +0000 +++ blinken-4.7.90/src/blinken.cpp 2011-11-04 14:33:48.000000000 +0000 @@ -42,7 +42,7 @@ static const double nonButtonRibbonX = 150.0; static const double nonButtonRibbonY = 125.0; -blinken::blinken() : KMainWindow(), m_overHighscore(false), m_overQuit(false), m_overCentralText(false), m_overMenu(false), m_overAboutKDE(false), m_overAboutBlinken(false), m_overSettings(false), m_overManual(false), m_overCentralLetters(false), m_overCounter(false), m_overFont(false), m_overSound(false), m_showPreferences(false), m_updateButtonHighlighting(false), m_highlighted(blinkenGame::none) +blinken::blinken() : m_overHighscore(false), m_overQuit(false), m_overCentralText(false), m_overMenu(false), m_overAboutKDE(false), m_overAboutBlinken(false), m_overSettings(false), m_overManual(false), m_overCentralLetters(false), m_overCounter(false), m_overFont(false), m_overSound(false), m_showPreferences(false), m_updateButtonHighlighting(false), m_highlighted(blinkenGame::none) { m_renderer = new QSvgRenderer(KStandardDirs::locate("appdata", "images/blinken.svg")); @@ -393,7 +393,7 @@ blinkenSettings::self()->writeConfig(); update(); } - else if (m_overQuit) close(); + else if (m_overQuit) qApp->quit(); else if (m_overAboutBlinken || m_overCentralLetters) m_helpMenu -> aboutApplication(); else if (m_overAboutKDE) m_helpMenu -> aboutKDE(); else if (m_overSettings) togglePreferences(); @@ -440,16 +440,17 @@ void blinken::checkHS() { - highScoreDialog *hsd = new highScoreDialog(this, m_renderer); - if (hsd->scoreGoodEnough(m_game.level(), m_game.score())) + highScoreManager hsm; + if (hsm.scoreGoodEnough(m_game.level(), m_game.score())) { bool ok; QString name = KInputDialog::getText(i18n("Enter Your Name"), i18nc("@label:textbox refers to the user's name", "Name:"), m_lastName, &ok); if (!name.isNull() && ok) { m_lastName = name; - hsd->addScore(m_game.level(), m_game.score(), name); + hsm.addScore(m_game.level(), m_game.score(), name); } + highScoreDialog *hsd = new highScoreDialog(this, m_renderer); hsd->showLevel(m_game.level()); } } @@ -612,8 +613,14 @@ p.resetMatrix(); p.translate( (double)width() / 50.875, (double)height() / 30); p.scale(xScaleSquareButtons, yScaleSquareButtons); - if (m_overHighscore) m_renderer->render(&p, "highscore_hover"); - else m_renderer->render(&p, "highscore_normal"); + if (m_overHighscore) + { + m_renderer->render(&p, "highscore_hover"); + } + else + { + m_renderer->render(&p, "highscore_normal"); + } m_highscoreRect = QRect(qRound((double)width() / 50.875), qRound((double)height() / 30.0), qRound((double)width() * xScaleSquareButtons), @@ -623,8 +630,14 @@ p.resetMatrix(); p.translate( (double)width() / 1.15, (double)height() / 30.0); p.scale(xScaleSquareButtons, yScaleSquareButtons); - if (m_overQuit) m_renderer->render(&p, "quit_hover"); - else m_renderer->render(&p, "quit_normal"); + if (m_overQuit) + { + m_renderer->render(&p, "quit_hover"); + } + else + { + m_renderer->render(&p, "quit_normal"); + } m_quitRect = QRect(qRound((double)width() / 1.15), qRound((double)height() / 30.0), qRound((double)width() * xScaleSquareButtons), @@ -764,30 +777,72 @@ break; case blinkenGame::waiting3: - if (m_overCentralText) text = restartText; - else text = i18n("Next sequence in 3..."); + if (m_overCentralText) + { + text = restartText; + } + else + { + text = i18n("Next sequence in 3..."); + } break; case blinkenGame::waiting2: - if (m_overCentralText) text = restartText; - else if (m_game.level() == 1) text = i18n("Next sequence in 3, 2..."); - else text = i18n("Next sequence in 2..."); + if (m_overCentralText) + { + text = restartText; + } + else + { + if (m_game.level() == 1) + { + text = i18n("Next sequence in 3, 2..."); + } + else + { + text = i18n("Next sequence in 2..."); + } + } break; case blinkenGame::waiting1: - if (m_overCentralText) text = restartText; - else if (m_game.level() == 1) text = i18n("Next sequence in 3, 2, 1..."); - else text = i18n("Next sequence in 2, 1..."); + if (m_overCentralText) + { + text = restartText; + } + else + { + if (m_game.level() == 1) + { + text = i18n("Next sequence in 3, 2, 1..."); + } + else + { + text = i18n("Next sequence in 2, 1..."); + } + } break; case blinkenGame::learningTheSequence: - if (m_overCentralText) text = restartText; - else text = i18n("Remember this sequence..."); + if (m_overCentralText) + { + text = restartText; + } + else + { + text = i18n("Remember this sequence..."); + } break; case blinkenGame::typingTheSequence: - if (m_overCentralText) text = restartText; - else text = i18n("Repeat the sequence"); + if (m_overCentralText) + { + text = restartText; + } + else + { + text = i18n("Repeat the sequence"); + } break; } } @@ -847,8 +902,14 @@ p.drawRoundRect(r, 15, 15); } - if (!highlight) p.setPen(m_fontColor); - else p.setPen(m_fontHighlightColor); + if (highlight) + { + p.setPen(m_fontHighlightColor); + } + else + { + p.setPen(m_fontColor); + } p.drawText(r, Qt::AlignCenter, text); if (rect) *rect = p.worldMatrix().mapRect(r); @@ -1081,4 +1142,3 @@ return it.value(); } -#include "blinken.moc" diff -Nru blinken-4.7.3/src/blinken.desktop blinken-4.7.90/src/blinken.desktop --- blinken-4.7.3/src/blinken.desktop 2011-10-28 07:43:02.000000000 +0000 +++ blinken-4.7.90/src/blinken.desktop 2011-11-04 14:33:48.000000000 +0000 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Blinken Name[ast]=Blinken +Name[bg]=Blinken Name[bs]=Blinken Name[ca]=Blinken Name[ca@valencia]=Blinken @@ -54,6 +55,7 @@ Name[zh_TW]=記憶_BlinKen GenericName=Memory Enhancement Game GenericName[ast]=Xuegu p'ameyorar la memoria +GenericName[bg]=Игра за упражнение на паметта GenericName[bs]=Igra za poboljšanje pamćenja GenericName[ca]=Un Joc per Millorar la Memòria GenericName[ca@valencia]=Un Joc per Millorar la Memòria diff -Nru blinken-4.7.3/src/blinkengame.cpp blinken-4.7.90/src/blinkengame.cpp --- blinken-4.7.3/src/blinkengame.cpp 2011-10-02 13:23:35.000000000 +0000 +++ blinken-4.7.90/src/blinkengame.cpp 2011-11-04 14:33:48.000000000 +0000 @@ -179,4 +179,3 @@ return c; } -#include "blinkengame.moc" diff -Nru blinken-4.7.3/src/highscoredialog.cpp blinken-4.7.90/src/highscoredialog.cpp --- blinken-4.7.3/src/highscoredialog.cpp 2011-10-02 13:23:35.000000000 +0000 +++ blinken-4.7.90/src/highscoredialog.cpp 2011-11-04 14:33:48.000000000 +0000 @@ -26,6 +26,8 @@ static const int smallMargin = 5; static const int namesFontSize = 25; +static QSet s_allHSM; + /* scoresWidget */ class scoresWidget : public QWidget @@ -38,7 +40,7 @@ void paintEvent(QPaintEvent *); private: - const QList< QPair > &m_scores; + const QList< QPair > m_scores; QSvgRenderer *m_renderer; }; @@ -140,21 +142,43 @@ m_tw = new myTabWidget(this); setMainWidget(m_tw); - for (int i = 1; i <= 3; i++) + highScoreManager hsm; + + m_tw -> addTab(new scoresWidget(0, hsm.scores(0), renderer), i18nc("@title:group High scores Level 1 tab title", "Level 1")); + m_tw -> addTab(new scoresWidget(0, hsm.scores(1), renderer), i18nc("@title:group High scores Level 2 tab title", "Level 2")); + m_tw -> addTab(new scoresWidget(0, hsm.scores(2), renderer), i18nc("@title:group High scores Level ? tab tible", "Level ?")); +} + +void highScoreDialog::showLevel(int level) +{ + QSize max, aux; + m_tw -> setCurrentIndex(level -1); + + for (int i = 0; i < 3; i++) { - KConfigGroup cfg(KGlobal::config(), QString("Level%1").arg(i)); - for (int j = 1; j <= 5; j++) - { - m_scores[i-1].append(qMakePair(cfg.readEntry(QString("Score%1").arg(j),QVariant(0)).toInt(),cfg.readEntry(QString("Name%1").arg(j),QString()))); - } + aux = static_cast(m_tw -> widget(i)) -> calcSize(); + max = max.expandedTo(aux); } + if (max.width() < m_tw -> tabBarSizeHint().width() + 5) m_tw -> setMinimumSize(m_tw -> tabBarSizeHint().width() + 5, max.height() + m_tw -> tabBarSizeHint().height() + 5); - m_tw -> addTab(new scoresWidget(0, m_scores[0], renderer), i18nc("@title:group High scores Level 1 tab title", "Level 1")); - m_tw -> addTab(new scoresWidget(0, m_scores[1], renderer), i18nc("@title:group High scores Level 2 tab title", "Level 2")); - m_tw -> addTab(new scoresWidget(0, m_scores[2], renderer), i18nc("@title:group High scores Level ? tab tible", "Level ?")); + exec(); + delete this; +} + +/* highScoreManager */ + +highScoreManager::highScoreManager() +{ + s_allHSM << this; + update(); } -bool highScoreDialog::scoreGoodEnough(int level, int score) +highScoreManager::~highScoreManager() +{ + s_allHSM.remove(this); +} + +bool highScoreManager::scoreGoodEnough(int level, int score) { level--; QList< QPair >::iterator it, itEnd; @@ -165,7 +189,7 @@ return (it != itEnd); } -void highScoreDialog::addScore(int level, int score, const QString &name) +void highScoreManager::addScore(int level, int score, const QString &name) { level--; QList< QPair >::iterator it, itEnd; @@ -186,21 +210,44 @@ cfg.writeEntry(QString("Name%1").arg(j), (*it).second); } cfg.sync(); + + foreach(highScoreManager *hsm, s_allHSM) + { + if (hsm != this) + { + hsm->update(); + } + } } } -void highScoreDialog::showLevel(int level) +void highScoreManager::update() { - QSize max, aux; - m_tw -> setCurrentIndex(level -1); - - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) { - aux = static_cast(m_tw -> widget(i)) -> calcSize(); - max = max.expandedTo(aux); + m_scores[i].clear(); } - if (max.width() < m_tw -> tabBarSizeHint().width() + 5) m_tw -> setMinimumSize(m_tw -> tabBarSizeHint().width() + 5, max.height() + m_tw -> tabBarSizeHint().height() + 5); - - exec(); - delete this; + for (int i = 1; i <= 3; i++) + { + KConfigGroup cfg(KGlobal::config(), QString("Level%1").arg(i)); + for (int j = 1; j <= 5; j++) + { + m_scores[i-1].append(qMakePair(cfg.readEntry(QString("Score%1").arg(j),QVariant(0)).toInt(),cfg.readEntry(QString("Name%1").arg(j),QString()))); + } + } +} + +QList< QPair > highScoreManager::scores(int level) const +{ + return m_scores[level]; +} + +int highScoreManager::score(int level, int position) const +{ + return m_scores[level][position].first; +} + +QString highScoreManager::name(int level, int position) const +{ + return m_scores[level][position].second; } diff -Nru blinken-4.7.3/src/highscoredialog.h blinken-4.7.90/src/highscoredialog.h --- blinken-4.7.3/src/highscoredialog.h 2011-10-02 13:23:35.000000000 +0000 +++ blinken-4.7.90/src/highscoredialog.h 2011-11-04 14:33:48.000000000 +0000 @@ -24,12 +24,30 @@ public: highScoreDialog(QWidget *parent, QSvgRenderer *renderer); - bool scoreGoodEnough(int level, int score); - void addScore(int level, int score, const QString &name); void showLevel(int level); - QList< QPair > m_scores[3]; myTabWidget *m_tw; }; +class highScoreManager : public QObject +{ +Q_OBJECT + public: + highScoreManager(); + ~highScoreManager(); + + bool scoreGoodEnough(int level, int score); + void addScore(int level, int score, const QString &name); + + QList< QPair > scores(int level) const; + + Q_INVOKABLE int score(int level, int position) const; + Q_INVOKABLE QString name(int level, int position) const; + + private: + void update(); + + QList< QPair > m_scores[3]; +}; + #endif diff -Nru blinken-4.7.3/src/main.cpp blinken-4.7.90/src/main.cpp --- blinken-4.7.3/src/main.cpp 2011-10-02 13:23:35.000000000 +0000 +++ blinken-4.7.90/src/main.cpp 2011-10-20 20:53:14.000000000 +0000 @@ -12,7 +12,6 @@ #include #include #include -#include #include #include diff -Nru blinken-4.7.3/src/soundsplayer.cpp blinken-4.7.90/src/soundsplayer.cpp --- blinken-4.7.3/src/soundsplayer.cpp 2011-10-02 13:23:35.000000000 +0000 +++ blinken-4.7.90/src/soundsplayer.cpp 2011-11-04 14:33:48.000000000 +0000 @@ -13,7 +13,7 @@ #include #include -#include +#include #include "settings.h" @@ -88,4 +88,3 @@ } } -#include "soundsplayer.moc" diff -Nru blinken-4.7.3/src/soundsplayer.h blinken-4.7.90/src/soundsplayer.h --- blinken-4.7.3/src/soundsplayer.h 2011-10-02 13:23:35.000000000 +0000 +++ blinken-4.7.90/src/soundsplayer.h 2011-11-04 14:33:48.000000000 +0000 @@ -10,7 +10,7 @@ #ifndef SOUNDSPLAYER_H #define SOUNDSPLAYER_H -#include +#include #include #include