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

List:       kde-commits
Subject:    =?utf-8?q?=5Bgluon=5D_player=3A_KDE_Extended_Player=3A_Extend_th?=
From:       Laszlo Papp <djszapi () archlinux ! us>
Date:       2011-02-06 22:19:34
Message-ID: 20110206221934.8817AA60B0 () git ! kde ! org
[Download RAW message or body]

Git commit 43445778615b70cca2b867dd44c8c1711a668786 by Laszlo Papp.
Committed on 06/02/11 at 22:20.
Pushed by lpapp into branch 'master'.

KDE Extended Player: Extend the model with the projectfilename list.

M  +1    -1    player/kdeext/mainwindow.cpp     
M  +1    -1    player/kdeext/mainwindow.h     
M  +7    -2    player/kdeext/models/gameitemsmodel.cpp     
M  +1    -0    player/kdeext/models/gameitemsmodel.h     
M  +2    -8    player/kdeext/views/gamesviewitem.cpp     
M  +2    -1    player/kdeext/views/gamesviewitem.h     

http://commits.kde.org/gluon/43445778615b70cca2b867dd44c8c1711a668786

diff --git a/player/kdeext/mainwindow.cpp b/player/kdeext/mainwindow.cpp
index e4cee43..5707b13 100644
--- a/player/kdeext/mainwindow.cpp
+++ b/player/kdeext/mainwindow.cpp
@@ -128,7 +128,7 @@ void MainWindow::setupActions()
     KStandardAction::quit(kapp, SLOT(quit()), actionCollection());
 }
 
-void MainWindow::playGame( )
+void MainWindow::startGame( )
 {
     if( GluonEngine::Game::instance()->isRunning() )
     {
diff --git a/player/kdeext/mainwindow.h b/player/kdeext/mainwindow.h
index 0af1b70..9ca1e6f 100644
--- a/player/kdeext/mainwindow.h
+++ b/player/kdeext/mainwindow.h
@@ -59,7 +59,7 @@ namespace GluonKDEPlayer {
             virtual void resizeEvent( QResizeEvent* event );
 
         public slots:
-            void playGame();
+            void startGame();
             void pauseGame();
             void stopGame();
 
diff --git a/player/kdeext/models/gameitemsmodel.cpp b/player/kdeext/models/gameitemsmodel.cpp
index 08bce09..d9653ce 100644
--- a/player/kdeext/models/gameitemsmodel.cpp
+++ b/player/kdeext/models/gameitemsmodel.cpp
@@ -42,6 +42,7 @@ GameItemsModel::GameItemsModel( QObject* parent )
                 GluonEngine::GameProject project;
                 project.loadFromFile( projectFileName );
                 m_gamesViewItems.append(new GamesViewItem(project.name(), project.description()));
+                m_projectFileNames.append( projectFileName );
                 id.append(project.property( "id" ).toString());
         }
     }
@@ -49,9 +50,13 @@ GameItemsModel::GameItemsModel( QObject* parent )
 
 QVariant GameItemsModel::data( const QModelIndex& index, int role ) const
 {
-    if( role == Qt::UserRole )
-    {
+    switch (role) {
+    case Qt::UserRole:
         return QVariant::fromValue( m_gamesViewItems.at( index.row() ) );
+    case Qt::DisplayRole:
+        return m_projectFileNames.at( index.row() );
+    default:
+        break;
     }
 
     return QVariant();
diff --git a/player/kdeext/models/gameitemsmodel.h b/player/kdeext/models/gameitemsmodel.h
index a4db199..e6e1148 100644
--- a/player/kdeext/models/gameitemsmodel.h
+++ b/player/kdeext/models/gameitemsmodel.h
@@ -52,6 +52,7 @@ namespace GluonKDEPlayer
 
         private:
             QList<GamesViewItem*> m_gamesViewItems;
+            QStringList m_projectFileNames;
             QStringList id;
     };
 }
diff --git a/player/kdeext/views/gamesviewitem.cpp b/player/kdeext/views/gamesviewitem.cpp
index bfffc39..0deda08 100644
--- a/player/kdeext/views/gamesviewitem.cpp
+++ b/player/kdeext/views/gamesviewitem.cpp
@@ -39,7 +39,7 @@ GamesViewItem::GamesViewItem( QString gameName, QString gameDescription, QWidget
     , m_playButton( new KPushButton( this ) )
     , m_layout( new QGridLayout() )
 {
-    layoutWidgets(gameName, gameDescription);
+    setMembers(gameName, gameDescription);
 }
 
 GamesViewItem::GamesViewItem( const GamesViewItem& other, QWidget* parent )
@@ -47,7 +47,7 @@ GamesViewItem::GamesViewItem( const GamesViewItem& other, QWidget* parent )
 {
 }
 
-void GamesViewItem::layoutWidgets(const QString& gameName, const QString& gameDescription)
+void GamesViewItem::setMembers(const QString& gameName, const QString& gameDescription)
 {
     m_playButton->setIcon( KIcon( "media-playback-start" ) );
     m_playButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding );
@@ -56,12 +56,6 @@ void GamesViewItem::layoutWidgets(const QString& gameName, const QString& gameDe
     m_preview->setPixmap(KIcon( "gluon-creator").pixmap(32, 32));
     m_gameName->setText( gameName );
     m_gameDescription->setText( gameDescription );
-
-    // m_layout->addWidget( m_preview, 0, 0, 2, 1 );
-    // m_layout->addWidget( m_gameName, 0, 1 );
-    // m_layout->addWidget( m_gameDescription, 1, 1 );
-    // m_layout->addWidget( m_playButton, 0, 2, 2, 1 );
-    // setLayout( m_layout );
 }
 
 void GamesViewItem::setModelIndex( const QModelIndex& index )
diff --git a/player/kdeext/views/gamesviewitem.h b/player/kdeext/views/gamesviewitem.h
index da4c557..05c2bd6 100644
--- a/player/kdeext/views/gamesviewitem.h
+++ b/player/kdeext/views/gamesviewitem.h
@@ -52,7 +52,7 @@ namespace GluonKDEPlayer
             void gameSelected( const QModelIndex& index );
 
         protected:
-            void layoutWidgets(const QString& gameName, const QString& gameDescription);
+            void setMembers(const QString& gameName, const QString& gameDescription);
             virtual void mousePressEvent( QMouseEvent* event );
 
         public:
@@ -62,6 +62,7 @@ namespace GluonKDEPlayer
             QString gameDescription() const;
             void setGameDescription( QString newGameDescription );
 
+        private:
             QModelIndex m_index;
             KSqueezedTextLabel* m_preview;
             KSqueezedTextLabel* m_gameName;


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

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