[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/krippendorf/kmahjongg
From: Christian Krippendorf <coding () christian-krippendorf ! de>
Date: 2012-07-13 12:17:18
Message-ID: 20120713121718.463ADAC7A9 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1305536 by krippendorf:
Clean up the code of kmahjongg.cpp/.h.
M +12 -0 GameView.cpp
M +12 -0 GameView.h
M +12 -24 kmahjongg.cpp
M +9 -17 kmahjongg.h
--- branches/work/krippendorf/kmahjongg/GameView.cpp #1305535:1305536
@@ -106,6 +106,11 @@
return m_pGameData->allow_redo;
}
+long GameView::getGameNumber() const
+{
+ return m_lGameNumber;
+}
+
bool GameView::undo()
{
// Clear user selections.
@@ -913,6 +918,13 @@
return *m_pBoardLayoutPath;
}
+QString GameView::getBoardLayoutName() const
+{
+ QString key("Name");
+
+ return m_pBoardLayout->authorProperty(key);
+}
+
void GameView::setMatch(bool bMatch)
{
m_bMatch = bMatch;
--- branches/work/krippendorf/kmahjongg/GameView.h #1305535:1305536
@@ -174,6 +174,12 @@
QString getBoardLayoutPath() const;
/**
+ * Return the name of the boar dlayout.
+ *
+ * @return The name of the board layout. */
+ QString getBoardLayoutName() const;
+
+ /**
* Undo the last move.
*
* @return True if successfull, else false. */
@@ -197,6 +203,12 @@
* @return True if allowed, else false. */
bool checkRedoAllowed();
+ /**
+ * Get the game number.
+ *
+ * @return The game number or -1 if no game number set. */
+ long getGameNumber() const;
+
public slots:
/**
* Add a new item with the given position.
--- branches/work/krippendorf/kmahjongg/kmahjongg.cpp #1305535:1305536
@@ -3,19 +3,17 @@
* Copyright (C) 1997 Mathias Mueller <in5y158@public.uni-hamburg.de>
* Copyright (C) 2006-2007 Mauricio Piacentini <mauricio@tabuleiro.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Kmahjongg is free software; you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ * You should have received a copy of the GNU General Public License along with this program; if
+ * not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA. */
#include "kmahjongg.h"
@@ -120,8 +118,6 @@
connect(m_pGameView, SIGNAL(gameOver(unsigned short, unsigned short)), this,
SLOT(gameOver(unsigned short, unsigned short)));
-// connect(bw, SIGNAL(demoModeChanged(bool)), SLOT(demoModeChanged(bool)));
-
loadSettings();
startNewGame();
}
@@ -341,9 +337,6 @@
if (!bDemoModeActive) {
m_pGameView->createNewGame(item);
- // initialise button states
-// bw->Game->allow_redo = bw->Game->allow_undo = 0;
-
timerReset();
// update the initial enabled/disabled state for
@@ -380,9 +373,9 @@
int score;
gameTimer->pause();
-// long gameNum = bw->getGameNum();
- long gameNum = 0;
+ long gameNum = m_pGameView->getGameNumber();
+
KMessageBox::information(this, i18n("You have won!"));
mFinished = true;
@@ -411,7 +404,7 @@
}
//TODO: add gameNum as a Custom KScoreDialog field?
-// theHighScores->checkHighScore(score, elapsed, gameNum, bw->getBoardName());
+// theHighScores->checkHighScore(score, elapsed, gameNum, m_pGameView->getBoardName());
KScoreDialog ksdialog(KScoreDialog::Name | KScoreDialog::Time, this);
// ksdialog.setConfigGroup(bw->getLayoutName());
KScoreDialog::FieldInfo scoreInfo;
@@ -436,8 +429,6 @@
void KMahjongg::showItemNumber(int iMaximum, int iCurrent, int iLeft)
{
- // Hmm... seems iCurrent is the number of remaining tiles, not removed ...
- //QString szBuffer = i18n("Removed: %1/%2").arg(iCurrent).arg(iMaximum);
QString szBuffer = i18n("Removed: %1/%2 Combinations left: %3", iMaximum-iCurrent, iMaximum,
iLeft);
tilesLeftLabel->setText(szBuffer);
@@ -473,9 +464,6 @@
if (!bDemoModeActive) {
m_pGameView->createNewGame(43/* bw->getGameNum() */);
- // initialise button states
-// bw->Game->allow_redo = bw->Game->allow_undo = 0;
-
timerReset();
// update the initial enabled/disabled state for
--- branches/work/krippendorf/kmahjongg/kmahjongg.h #1305535:1305536
@@ -3,19 +3,17 @@
* Copyright (C) 1997 Mathias Mueller <in5y158@public.uni-hamburg.de>
* Copyright (C) 2006-2007 Mauricio Piacentini <mauricio@tabuleiro.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Kmahjongg is free software; you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ * You should have received a copy of the GNU General Public License along with this program; if
+ * not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA. */
#ifndef _KMAHJONGG_H
#define _KMAHJONGG_H
@@ -97,12 +95,6 @@
void gameOver(unsigned short removed, unsigned short cheats);
/**
- * Load BoardLayout from file
- *
- * @param file */
-// void loadBoardLayout(const QString &file);
-
- /**
* Slot Description */
void newGame();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic