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

List:       kde-commits
Subject:    [gluon/creator-distributionsupport-shreya] /: Showing comments, Allow Game rating through Social Doc
From:       Shreya Pandit <shreya () shreyapandit ! com>
Date:       2012-08-17 17:38:32
Message-ID: 20120817173832.D9E35A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 25414a72a7ec9dae3a7c8719b9013650967430a5 by Shreya Pandit.
Committed on 17/08/2012 at 19:38.
Pushed by pandit into branch 'creator-distributionsupport-shreya'.

Showing comments, Allow Game rating through Social Dock

M  +1    -0    creator/plugins/docks/distributiondock/CMakeLists.txt
M  +41   -32   creator/plugins/docks/distributiondock/distributiondock.cpp
M  +12   -8    creator/plugins/docks/distributiondock/distributiondock.h
M  +73   -27   creator/plugins/docks/distributiondock/distributiondock.ui
M  +1    -1    player/lib/models/commentitemsmodel.h

http://commits.kde.org/gluon/25414a72a7ec9dae3a7c8719b9013650967430a5

diff --git a/creator/plugins/docks/distributiondock/CMakeLists.txt \
b/creator/plugins/docks/distributiondock/CMakeLists.txt index 12a933a..582a6d0 100644
--- a/creator/plugins/docks/distributiondock/CMakeLists.txt
+++ b/creator/plugins/docks/distributiondock/CMakeLists.txt
@@ -2,6 +2,7 @@ set(distributiondock_SRCS
     distributiondock.cpp
     distributiondockplugin.cpp
     distributionwizard/distributionwizard.cpp
+    commentsDelegate.cpp
 )
 
 kde4_add_ui_files(
diff --git a/creator/plugins/docks/distributiondock/distributiondock.cpp \
b/creator/plugins/docks/distributiondock/distributiondock.cpp index 89b9126..7c30ba2 \
                100644
--- a/creator/plugins/docks/distributiondock/distributiondock.cpp
+++ b/creator/plugins/docks/distributiondock/distributiondock.cpp
@@ -20,9 +20,8 @@
 
 #include "distributiondock.h"
 #include "ui_distributiondock.h"
-
+#include "commentsDelegate.h"
 #include <engine/game.h>
-
 #include <player/lib/serviceprovider.h>
 #include <player/lib/addgamejob.h>
 #include <player/lib/categorylistjob.h>
@@ -41,8 +40,8 @@
 #include <QtGui/QPushButton>
 #include <QtCore/QStateMachine>
 #include <QtCore/QHistoryState>
-#include "distributionwizard/distributionwizard.h"
 using namespace GluonCreator;	
+#include "distributionwizard/distributionwizard.h"
 
 class DistributionDock::DistributionDockPrivate
 {
@@ -64,14 +63,12 @@ class DistributionDock::DistributionDockPrivate
         QStateMachine machine;
         QStringList licenseIds;
         QListView* m_commentsView;
-        GluonKDEPlayer::CommentItemsViewDelegate* m_commentsDelegate;
+        CommentsDelegate* m_commentsDelegate;
 	GluonPlayer::CommentItemsModel* m_commentsModel;
-        NewCommentForm* m_newCommentForm;
 
         QState* loggedOutState;
         QState* loggingInState;
         QState* optionState;
-	QState* parentSocialState;
 	QState* initial;
 	QState* statsState;
 	QState* eventState;
@@ -97,11 +94,6 @@ DistributionDock::DistributionDock( const QString& title, QWidget* \
                parent, Qt::W
     QAction* uploadNewAction = toolBar->addAction( KIcon( "document-upload" ), i18n( \
"Upload New Game" ), this, SLOT(testWizard()));  setWidget( &d->widget );
     
-    d->m_commentsView =  new QListView( this );
-    d->m_commentsDelegate =  new CommentItemsViewDelegate( m_commentsView, this );
-    d->m_commentsModel =  new GluonPlayer::CommentItemsModel( \
                metaData->projectId());
-    d->m_newCommentForm =  new NewCommentForm( this );
-
     d->ui.menuLayout->addWidget(toolBar);
     d->statsButton = new KPushButton(this);
     d->eventsButton = new KPushButton(this);
@@ -127,9 +119,8 @@ DistributionDock::DistributionDock( const QString& title, \
QWidget* parent, Qt::W  updateCategories();
     updateLicenses();
     loadCredentials();
-    
-
 }
+
 void DistributionDock::changedetailsChosen()
 {
   qDebug()<<"change details is chosen";
@@ -287,14 +278,13 @@ void DistributionDock::initGuiStates()
     d->loggingInState = new QState();
     d->loggedInState = new QState();
     d->optionState = new QState();
-    d->parentSocialState = new QState( d->loggedInState );
-    d->statsState = new QState( d->parentSocialState);
-    d->eventState = new QState( d->parentSocialState );
-    d->initial = new QState( d->parentSocialState );
+    d->initial = new QState( d->loggedInState);
+    d->statsState = new QState( d->loggedInState);
+    d->eventState = new QState( d->loggedInState);
     d->fetchingState = new QState( d->loggedInState );
     d->editingState = new QState( d->loggedInState);
-    d->loggedInState->setInitialState( d->parentSocialState );
-    d->parentSocialState->setInitialState(d->initial);
+    d->loggedInState->setInitialState( d->initial );
+//    d->parentSocialState->setInitialState(d->initial);
     d->createState = new QState( d->editingState );
     d->updateState = new QState( d->editingState );
     d->editingState->setInitialState( d->createState );
@@ -307,7 +297,7 @@ void DistributionDock::initGuiStates()
     d->machine.addState( d->loggedOutState );
     d->machine.addState( d->loggingInState );
     d->machine.addState( d->loggedInState );
-    d->machine.addState(d->parentSocialState);
+//    d->machine.addState(d->parentSocialState);
     d->machine.addState(d->initial);
     d->machine.addState(d->statsState);
     d->machine.addState(d->eventState);
@@ -328,26 +318,21 @@ void DistributionDock::initGuiStates()
     d->loggingInState->assignProperty( d->ui.loginButton, "text", i18n( "Logging In" \
                ) );
     d->loggingInState->assignProperty( d->ui.loginPage, "enabled", false );
 
-    d->loggedInState->assignProperty( d->ui.stackedWidget, "currentIndex", \
d->ui.stackedWidget->indexOf( d->ui.parentSocialPage ) ); +    \
d->initial->assignProperty( d->ui.stackedWidget, "currentIndex", \
d->ui.stackedWidget->indexOf( d->ui.parentSocialPage ) );  \
d->initial->assignProperty(d->statsButton,"enabled",true);  \
                d->initial->assignProperty(d->eventsButton,"enabled",true);
     d->initial->addTransition(d->statsButton, SIGNAL(clicked()), d->statsState);
     d->initial->addTransition(d->eventsButton, SIGNAL(clicked()), d->eventState);
 
     d->statsState->assignProperty( d->ui.stackedWidget, "currentIndex", \
                d->ui.stackedWidget->indexOf( d->ui.statsPage ) );
-    d->statsState->addTransition(d->backButton1, SIGNAL(clicked()), \
                d->loggedOutState);
     d->eventState->assignProperty( d->ui.stackedWidget, "currentIndex", \
                d->ui.stackedWidget->indexOf( d->ui.eventsPage ) );
-    d->eventState->addTransition(d->backButton2, SIGNAL(clicked()), \
                d->loggedOutState);
-
-
+    d->eventState->addTransition(d->backButton2, SIGNAL(clicked()), d->initial);
+    d->statsState->addTransition(d->backButton1, SIGNAL(clicked()), d->initial);
+  
     d->optionState->assignProperty( d->ui.loginChanged, "enabled", true );
     d->optionState->assignProperty( d->ui.changeDetails, "enabled", true );
     d->optionState->addTransition(d->ui.loginChanged, SIGNAL(clicked()), \
                d->loggedOutState);
     d->optionState->addTransition(d->ui.changeDetails, SIGNAL(clicked()), \
                d->fetchingState);
-
-//    d->parentSocialState->addTransition(d->ui.statsButton, SIGNAL(clicked()), \
                d->loggedOutState);
- //   d->optionState->addTransition(d->ui.eventsButton, SIGNAL(clicked()), \
                d->fetchingState);
-
     d->editingState->assignProperty( d->ui.gamePage, "enabled", true );
 
     d->fetchingState->assignProperty( d->ui.detailsGroupBox, "enabled", false );
@@ -378,17 +363,42 @@ void DistributionDock::initGuiStates()
 
     connect( d->loggingInState, SIGNAL(entered()), this, SLOT(doLogin()));
     connect( d->ui.uploadNew, SIGNAL(clicked()), this, SLOT(testWizard()));
-    connect( d->backButton1, SIGNAL(clicked()), this, SLOT(goBack()));
-    connect( d->backButton2, SIGNAL(clicked()), this, SLOT(goBack()));
+//    connect( d->backButton1, SIGNAL(clicked()), this, SLOT(goBack()));
+//    connect( d->backButton2, SIGNAL(clicked()), this, SLOT(goBack()));
     connect( d->ui.registerButton, SIGNAL(clicked()), this, SLOT(registerOnline()));
     connect( d->optionState, SIGNAL(entered()), this, SLOT(setLoginName()));
     connect( d->fetchingState, SIGNAL(entered()), this, \
SLOT(updateUiFromGameProject()) );  connect( d->fetchingState, SIGNAL(entered()), \
                this, SLOT(onFetch()));
     connect( d->uploadingState, SIGNAL(entered()), this, SLOT(createOrUpdateGame()) \
                );
     connect( d->updateState, SIGNAL(entered()), SLOT(initEditGameProvider()) );
+    connect( d->eventState, SIGNAL(entered()), SLOT(commentsFetched()));
+    connect(d->ui.submitButton,SIGNAL(clicked()),SLOT(uploadReview()));
 
     d->machine.start();
 }
+void DistributionDock::commentsFetched()
+{ 
+    d->m_commentsView =  new QListView( this );
+    d->m_commentsDelegate =  new CommentsDelegate( d->ui.commentsListView, this );
+    QString id = GluonEngine::Game::instance()->gameProject()->property( "id" \
).toString(); +    qDebug()<<"ID IS "<<id;
+    if(!id.isEmpty())
+      {
+        d->m_commentsModel =  new GluonPlayer::CommentItemsModel(id);
+      }
+   d->ui.commentsListView->setItemDelegate( d->m_commentsDelegate );
+   d->ui.commentsListView->setModel( d->m_commentsModel );
+}
+void DistributionDock::uploadReview()
+{
+    uint ratingVal = d->ui.ratingEdit->text().toUInt();
+    QString id = GluonEngine::Game::instance()->gameProject()->property( "id" \
).toString(); +    GluonPlayer::RatingJob* ratejob = \
GluonPlayer::ServiceProvider::instance()->setRating(id,ratingVal); +    connect(this, \
SIGNAL(rate()),ratejob,SLOT(startSocialService())); +    emit rate();
+}
+
+
 void DistributionDock::onFetch()
 {
     d->ui.stackedWidget->setCurrentIndex( d->ui.stackedWidget->indexOf( \
d->ui.gamePage )); @@ -396,7 +406,6 @@ void DistributionDock::onFetch()
 }
 void DistributionDock::goBack()
 {
-    qDebug()<<"IN GO BACK SLOT";
     d->ui.stackedWidget->setCurrentIndex(d->ui.stackedWidget->indexOf(d->ui.parentSocialPage));
  }
 
diff --git a/creator/plugins/docks/distributiondock/distributiondock.h \
b/creator/plugins/docks/distributiondock/distributiondock.h index 2844be6..acf3cf0 \
                100644
--- a/creator/plugins/docks/distributiondock/distributiondock.h
+++ b/creator/plugins/docks/distributiondock/distributiondock.h
@@ -21,14 +21,14 @@
   #ifndef GLUON_CREATOR_DISTRIBUTIONDOCK_H
   #define GLUON_CREATOR_DISTRIBUTIONDOCK_H
 
+ 
   #include <QtGui/QDockWidget>
   #include <QListView>
-  #include <player/desktop/delegates/commentitemsviewdelegate.h>
   #include <player/lib/models/commentitemsmodel.h>
-  #include <player/desktop/views/newcommentform.h>
+  #include <player/lib/ratingjob.h>
   #include <engine/projectmetadata.h>
-
-
+//  #include <player/desktop/delegates/commentitemsviewdelegate.h>
+ 
   namespace GluonPlayer
   {
       class CategoryItem;
@@ -51,6 +51,7 @@
 	      virtual ~DistributionDock();
 	      class DistributionDockPrivate;
 	      DistributionDockPrivate* const d;
+	      GluonPlayer::RatingJob* ratejob;
 	      void loadComments();
 	      void initGuiStates();
 	      void fetchExistingGameDetails();
@@ -70,8 +71,10 @@
 	      void gameDetailsFetched();
 	      void updateLicenses();
 	      void licensesFetched();
+	      void commentsFetched();
 	      void setLoginName();
 	      void onFetch();
+	      void uploadReview();
 	      void testWizard();
 	      QString createArchive( );
 	      void uploadGameArchive();
@@ -79,16 +82,17 @@
 	      void goBack();
 	      void changedetailsChosen();
 	      
-	      void addNewComment( QModelIndex parentIndex, QString title, QString body );
-	      void cancelNewComment( );
-	      void showReplyForm( const QModelIndex& index );
-	      void commentFailed( );
+//	      void addNewComment( QModelIndex parentIndex, QString title, QString body );
+//	      void cancelNewComment( );
+//	      void showReplyForm( const QModelIndex& index );
+//	      void commentFailed( );
 
 
 	  Q_SIGNALS:
 	      void switchToCreateMode();
 	      void switchToUpdateMode();
 	      void gameUploadFinished();
+	      void rate();
 
       };
 
diff --git a/creator/plugins/docks/distributiondock/distributiondock.ui \
b/creator/plugins/docks/distributiondock/distributiondock.ui index e2216e2..1fdf173 \
                100644
--- a/creator/plugins/docks/distributiondock/distributiondock.ui
+++ b/creator/plugins/docks/distributiondock/distributiondock.ui
@@ -20,7 +20,7 @@
    <item>
     <widget class="QStackedWidget" name="stackedWidget">
      <property name="currentIndex">
-      <number>2</number>
+      <number>3</number>
      </property>
      <widget class="QWidget" name="loginPage">
       <layout class="QVBoxLayout" name="verticalLayout_11">
@@ -125,8 +125,8 @@
        <property name="geometry">
         <rect>
          <x>0</x>
-         <y>10</y>
-         <width>451</width>
+         <y>0</y>
+         <width>421</width>
          <height>31</height>
         </rect>
        </property>
@@ -625,13 +625,6 @@
           </property>
          </widget>
         </item>
-        <item>
-         <widget class="QPushButton" name="backbutton">
-          <property name="text">
-           <string>Back</string>
-          </property>
-         </widget>
-        </item>
        </layout>
       </widget>
       <widget class="QGroupBox" name="groupBox_2">
@@ -751,15 +744,9 @@
          <string/>
         </property>
        </widget>
-       <zorder>verticalLayoutWidget_4</zorder>
-       <zorder>label_16</zorder>
-       <zorder>verticalLayoutWidget_5</zorder>
-       <zorder>monthDownloadLabel</zorder>
-       <zorder>label_19</zorder>
-       <zorder>playtimeLabel</zorder>
       </widget>
      </widget>
-     <widget class="QWidget" name="evenstPage">
+     <widget class="QWidget" name="eventsPage">
       <widget class="QWidget" name="horizontalLayoutWidget_6">
        <property name="geometry">
         <rect>
@@ -785,12 +772,18 @@
        </property>
        <property name="geometry">
         <rect>
-         <x>20</x>
-         <y>70</y>
-         <width>391</width>
-         <height>311</height>
+         <x>0</x>
+         <y>40</y>
+         <width>431</width>
+         <height>351</height>
         </rect>
        </property>
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
        <property name="currentIndex">
         <number>2</number>
        </property>
@@ -799,8 +792,8 @@
          <rect>
           <x>0</x>
           <y>0</y>
-          <width>381</width>
-          <height>220</height>
+          <width>421</width>
+          <height>260</height>
          </rect>
         </property>
         <attribute name="label">
@@ -812,15 +805,45 @@
          <rect>
           <x>0</x>
           <y>0</y>
-          <width>381</width>
-          <height>220</height>
+          <width>421</width>
+          <height>260</height>
          </rect>
         </property>
         <attribute name="label">
          <string>Comments</string>
         </attribute>
+        <widget class="QWidget" name="verticalLayoutWidget_7">
+         <property name="geometry">
+          <rect>
+           <x>-1</x>
+           <y>9</y>
+           <width>381</width>
+           <height>201</height>
+          </rect>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout_15">
+          <item>
+           <layout class="QVBoxLayout" name="timeLine">
+            <property name="sizeConstraint">
+             <enum>QLayout::SetMaximumSize</enum>
+            </property>
+            <item>
+             <widget class="QListView" name="commentsListView"/>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
        </widget>
        <widget class="QWidget" name="reviewTab">
+        <property name="geometry">
+         <rect>
+          <x>0</x>
+          <y>0</y>
+          <width>421</width>
+          <height>260</height>
+         </rect>
+        </property>
         <attribute name="label">
          <string>New Review</string>
         </attribute>
@@ -837,8 +860,8 @@
         <widget class="QPushButton" name="submitButton">
          <property name="geometry">
           <rect>
-           <x>230</x>
-           <y>190</y>
+           <x>320</x>
+           <y>230</y>
            <width>91</width>
            <height>24</height>
           </rect>
@@ -847,6 +870,29 @@
           <string>Submit</string>
          </property>
         </widget>
+        <widget class="QLabel" name="label_15">
+         <property name="geometry">
+          <rect>
+           <x>10</x>
+           <y>200</y>
+           <width>201</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="text">
+          <string>Rate this Game (on a scale of 1-100)</string>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="ratingEdit">
+         <property name="geometry">
+          <rect>
+           <x>230</x>
+           <y>200</y>
+           <width>51</width>
+           <height>23</height>
+          </rect>
+         </property>
+        </widget>
        </widget>
       </widget>
      </widget>
diff --git a/player/lib/models/commentitemsmodel.h \
b/player/lib/models/commentitemsmodel.h index f324d68..3a7f2c8 100644
--- a/player/lib/models/commentitemsmodel.h
+++ b/player/lib/models/commentitemsmodel.h
@@ -21,7 +21,7 @@
 #ifndef GLUON_PLAYER_COMMENTITEMSMODEL_H
 #define GLUON_PLAYER_COMMENTITEMSMODEL_H
 
-#include "lib/gluon_player_export.h"
+#include "player/lib/gluon_player_export.h"
 
 #include <attica/providermanager.h>
 #include <attica/provider.h>


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

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