[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegames/katomic
From:       Nicolas Roffet <nicolas-kde () roffet ! com>
Date:       2007-08-19 12:36:41
Message-ID: 1187527001.117244.18458.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 701810 by roffet:

Added a new area in the statusbar to display the name of the current molecule. (This \
nice information was not displayed anymore in KDE 4 so far.)

CCMAIL:dimsuz@gmail.com


 M  +6 -0      gamewidget.cpp  
 M  +1 -0      gamewidget.h  
 M  +5 -0      playfield.cpp  
 M  +5 -0      playfield.h  
 M  +10 -6     toplevel.cpp  
 M  +1 -1      toplevel.h  


--- trunk/KDE/kdegames/katomic/gamewidget.cpp #701809:701810
@@ -76,6 +76,11 @@
     delete m_highscore;
 }
 
+QString GameWidget::currentMolecule() const
+{
+    return m_playField->moleculeName();
+}
+
 void GameWidget::moveUp()
 {
     if(!m_playField->isLevelFinished())
@@ -151,6 +156,7 @@
     m_playField->loadLevel(gr);
 
     m_levelHighscore = m_highscore->levelHighscore( m_level );
+
     emit statsChanged(m_level, 0, m_levelHighscore);
 }
 
--- trunk/KDE/kdegames/katomic/gamewidget.h #701809:701810
@@ -40,6 +40,7 @@
     PlayField* playfield() { return m_playField; }
 
     int currentLevel() const { return m_level; }
+    QString currentMolecule() const;
     int currentScore() const { return m_moves; }
     int currentHighScore() const;
 signals:
--- trunk/KDE/kdegames/katomic/playfield.cpp #701809:701810
@@ -744,4 +744,9 @@
     m_messageItem->showMessage( message, KGamePopupItem::BottomLeft );
 }
 
+QString PlayField::moleculeName()
+{
+    return m_mol->moleculeName();
+}
+
 #include "playfield.moc"
--- trunk/KDE/kdegames/katomic/playfield.h #701809:701810
@@ -86,6 +86,11 @@
      * Displays a passive popup message at the bottom of the scene
      */
     void showMessage( const QString& message );
+    /**
+     * Name of the current molecule
+     */
+    QString moleculeName();
+
 public slots:
     /**
      *  Selects next atom
--- trunk/KDE/kdegames/katomic/toplevel.cpp #701809:701810
@@ -50,13 +50,16 @@
     loadSettings();
     setCentralWidget(m_gameWid);
 
-    statusBar()->insertItem( i18n("Level:"), 0 );
-    statusBar()->insertItem( i18n("Current score:"), 1 );
-    statusBar()->insertItem( i18n("Highscore:"), 2 );
-    updateStatusBar( m_gameWid->currentLevel(), m_gameWid->currentScore(), \
m_gameWid->currentHighScore() ); +    statusBar()->insertItem( i18n("Level:"), 0 , \
1); +    statusBar()->insertItem( "", 3 , 1);
+    statusBar()->insertPermanentItem( i18n("Current score:"), 1, 1);
+    statusBar()->insertPermanentItem( i18n("Highscore:"), 2, 1 );
+    statusBar()->setItemAlignment(0, Qt::AlignLeft & Qt::AlignVCenter);
 
-    connect(m_gameWid, SIGNAL(statsChanged(int,int,int)), \
SLOT(updateStatusBar(int,int,int))); +    updateStatusBar( m_gameWid->currentLevel(), \
m_gameWid->currentMolecule(), m_gameWid->currentScore(), \
m_gameWid->currentHighScore() );  
+    connect(m_gameWid, SIGNAL(statsChanged(int,int,int)), SLOT(updateStatusBar(int, \
QString, int, int))); +
     setupGUI();
 }
 
@@ -180,9 +183,10 @@
     Preferences::self()->writeConfig();
 }
 
-void AtomTopLevel::updateStatusBar( int level, int score, int highscore )
+void AtomTopLevel::updateStatusBar( int level, QString molecule, int score, int \
highscore )  {
     statusBar()->changeItem( i18n("Level: %1", level), 0 );
+    statusBar()->changeItem( molecule, 3);
     statusBar()->changeItem( i18n("Current score: %1", score), 1 );
     QString str;
     if(highscore == 0)
--- trunk/KDE/kdegames/katomic/toplevel.h #701809:701810
@@ -50,7 +50,7 @@
     void enableHackMode();
 private slots:
     void slotAnimSpeedChanged(int);
-    void updateStatusBar(int level, int score, int highscore);
+    void updateStatusBar(int level, QString molecule, int score, int highscore);
 private:
     virtual bool queryClose(); // reimp
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic