[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [gluon/creator-distributionsupport-shreya] creator/plugins/docks/distributiondock/distributionwizard
From: Shreya Pandit <shreya () shreyapandit ! com>
Date: 2012-08-16 7:57:11
Message-ID: 20120816075711.3A57FA60A6 () git ! kde ! org
[Download RAW message or body]
Git commit 10e935f20b6de824944d73a646b878b9126f3e34 by Shreya Pandit.
Committed on 16/08/2012 at 09:56.
Pushed by pandit into branch 'creator-distributionsupport-shreya'.
few changes to Wizard code, upload game too
M +145 -29 creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.cpp
M +16 -2 creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.h
M +116 -2 creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.ui
http://commits.kde.org/gluon/10e935f20b6de824944d73a646b878b9126f3e34
diff --git a/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.cpp \
b/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.cpp \
index db35576..d420f44 100644
--- a/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.cpp
+++ b/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.cpp
@@ -32,6 +32,7 @@
#include <QDebug>
+
class DistributionWizard::DistributionWizardPrivate
{
public:
@@ -40,20 +41,90 @@ class DistributionWizard::DistributionWizardPrivate
}
Ui::Wizard wizard;
QWizard wizardobj;
-
+ GluonPlayer::EditGameJob* editGameJob;
};
DistributionWizard::DistributionWizard():QObject(),d( new \
DistributionWizardPrivate() ) {
d->wizard.setupUi(&d->wizardobj);
- // updateCategories();
-// updateLicenses();
+ connect(&d->wizardobj,SIGNAL(currentIdChanged( int)),this,SLOT(pageChanged(int)));
+ updateCategories();
+ updateLicenses();
+}
+void DistributionWizard::uploadGameArchive()
+{
+// const QString id = d->ui.idEdit->text();
+
+ if( gameid.isEmpty() || apiKey.isEmpty() )
+ {
+ return;
+ }
+ const QString dirName = \
GluonEngine::Game::instance()->gameProject()->dirname().toLocalFile(); + const \
QString gameName = GluonEngine::Game::instance()->gameProject()->name(); + const \
QString archivePath = dirName + "/../" + gameName + ".gluonarchive"; + Archiver \
archiver( dirName, archivePath ); + archiver.start();
+
+ GluonPlayer::GameUploadJob* uploadJob = \
GluonPlayer::ServiceProvider::instance()->uploadGame( gameid, archivePath ); + \
connect( uploadJob, SIGNAL(succeeded()), SLOT(editGameFinished()) ); +// connect( \
uploadJob, SIGNAL(failed()), SLOT(editGameFailed()) ); + \
uploadJob->setApiKey(apiKey ); + uploadJob->start();
+}
+
+void DistributionWizard::editGameFinished()
+{
+ qDebug()<<"upload job is succeeding";
}
DistributionWizard::~DistributionWizard()
{
delete d;
}
+void DistributionWizard::pageChanged(int pageId)
+{
+ qDebug()<< "Page id of new page is"<<pageId;
+ switch(pageId)
+ {
+ case(1):
+ { apiKey = d->wizard.apiKeyEdit->text();
+ qDebug()<<"API Key filled by you is"<<apiKey;
+ d->wizard.gameIdEdit->setEnabled(false);
+ d->wizard.versionEdit_2->setEnabled(false);
+ d->wizard.homePageEdit->setEnabled(false);
+ d->wizard.licenseComboBox->setEnabled(false);
+ }
+ break;
+ case(2):
+ {
+ if( d->wizard.gameIdEdit->text().isEmpty() )
+ {
+ gameName = d->wizard.nameEdit->text();
+ chosenCategory = categoryIds.at( d->wizard.categoryComboBox->currentIndex() );
+ GluonPlayer::AddGameJob* addGameJob = \
GluonPlayer::ServiceProvider::instance()->addGame( gameName,chosenCategory ); \
+ connect( addGameJob, SIGNAL(succeeded()), SLOT(uploadFinished())); +// connect( \
addGameJob, SIGNAL(failed()), SLOT(newGameUploadFailed()) ); + addGameJob->start();
+ }
+ }
+ break;
+ case(3):
+ { homepage = d->wizard.nexthomePageEdit->text();
+ version = d->wizard.nextversionEdit->text();
+ chosenLicense = licenseIds.at( d->wizard.nextlicenseComboBox->currentIndex());
+ chosenCategory = categoryIds.at( d->wizard.nextCategory->currentIndex());
+ updateUi();
+ }
+ case(4):
+ { description = d->wizard.descriptionEdit->toPlainText();}
+ case(5):
+ { changeLog = d->wizard.changelogEdit->toPlainText();}
+ break;
+ default:
+ break;
+
+ }
+}
void DistributionWizard::startWizard()
{
@@ -62,40 +133,85 @@ void DistributionWizard::startWizard()
}
void DistributionWizard::updateCategories()
{
- /* GluonPlayer::CategoryListJob* categoryListJob = \
GluonPlayer::ServiceProvider::instance()->fetchCategories(); + \
GluonPlayer::CategoryListJob* categoryListJob = \
GluonPlayer::ServiceProvider::instance()->fetchCategories();
connect( categoryListJob, SIGNAL(succeeded()), SLOT(categoriesFetched()) );
- categoryListJob->start();*/
+ categoryListJob->start();
}
-void DistributionWizard::uploadGame()
-{
-/* GluonPlayer::AddGameJob* addGameJob = \
GluonPlayer::ServiceProvider::instance()->addGame(d->wizard.nameEdit->text(),categoryIds.at( \
d->wizard.categoryComboBox->currentIndex()));
- connect( addGameJob, SIGNAL(succeeded()), SLOT(uploadFinished()));
- // connect( addGameJob, SIGNAL(failed()), SLOT(newGameUploadFailed()) );
- addGameJob->start();*/
-}
void DistributionWizard::uploadFinished()
{
- /* QString id = qobject_cast<GluonPlayer::AddGameJob*>( sender() \
)->data().toString();
- d->wizard.gameIdEdit->setText( id );
+ QString id = qobject_cast<GluonPlayer::AddGameJob*>( sender() \
)->data().toString(); +// d->wizard.gameIdEdit->setText( id );
GluonEngine::Game::instance()->gameProject()->setProperty( "id", id );
- updateUi();
- emit gameUploadFinished();*/
+ qDebug()<<"ID OF GAME IS NOW "<<id;
+// updateUi();
}
void DistributionWizard::updateUi()
{
-/* GluonPlayer::GameDetailsJob* gameDetailsJob = \
GluonPlayer::ServiceProvider::instance()->fetchOneGame( id );
- connect( gameDetailsJob, SIGNAL(succeeded()), SLOT(gameDetailsFetched()) ) ;
- gameDetailsJob->start();*/
+ if( !GluonEngine::Game::instance()->gameProject() )
+ return;
+
+ QString id = GluonEngine::Game::instance()->gameProject()->property( "id" \
).toString(); + d->wizard.gameIdEdit->setText( id );
+ gameid = id;
+ qDebug()<<"IN UPDATE UI,ID OF GAME IS NOW "<<id;
+ if( id.isEmpty() )
+ {
+ d->wizard.detailsPage->setSubTitle("Failed to generate a proper game ID, \
please specify name and category both"); + }
+ else
+ {
+ d->wizard.nextdetailsPage->setSubTitle("Please fill rest of the required fields");
+ d->wizard.nextgameIdEdit->setText(id);
+ d->wizard.nextnameEdit->setText(gameName);
+ d->wizard.nextCategory->setCurrentIndex(categoryIds.indexOf( chosenCategory));
+ d->wizard.nextgameIdEdit->setEnabled(false);
+ d->wizard.nextnameEdit->setEnabled(false);
+ d->wizard.nextCategory->setEnabled(false);
+
+ }
}
+void DistributionWizard::finalUploading()
+{
+ d->editGameJob = GluonPlayer::ServiceProvider::instance()->editGame(
+ d->wizard.gameIdEdit->text() );
+ connect( d->editGameJob, SIGNAL(failed()),this ,SLOT(editGamefailed()));
+
+ d->editGameJob->setName( gameName );
+ d->editGameJob->setCategory( chosenCategory);
+ d->editGameJob->setChangelog(description);
+ d->editGameJob->setDescription(changeLog);
+ d->editGameJob->setHomepage(homepage);
+ d->editGameJob->setVersion(version);
+ d->editGameJob->setLicense(chosenLicense);
+ d->editGameJob->start();
+ uploadGameArchive();
+
+}
+
+void DistributionWizard::editGamefailed()
+{
+ qDebug()<< "Failed";
+}
+
+void DistributionWizard::gamedetailsFetched()
+{
+ GluonPlayer::GameDetailItem* gameDetails = \
qobject_cast<GluonPlayer::GameDetailsJob*>( sender() \
)->data().value<GluonPlayer::GameDetailItem*>(); + \
d->wizard.nextversionEdit->setText( gameDetails->version() ); + \
d->wizard.nexthomePageEdit->setText( gameDetails->homePage() ); + \
d->wizard.licenseComboBox->setCurrentIndex( licenseIds.indexOf( \
gameDetails->license() ) ); + // d->ui.descriptionEdit->setPlainText( \
gameDetails->gameDescription() ); + // d->ui.changelogEdit->setPlainText( \
gameDetails->changelog() ); +}
+
void DistributionWizard::categoriesFetched()
{
-/* QList<GluonPlayer::CategoryItem*> categories = \
qobject_cast<GluonPlayer::CategoryListJob*>( sender() )->data().value< \
QList<GluonPlayer::CategoryItem*> >();
- wizard.categoryComboBox->clear();
+ QList<GluonPlayer::CategoryItem*> categories = \
qobject_cast<GluonPlayer::CategoryListJob*>( sender() )->data().value< \
QList<GluonPlayer::CategoryItem*> >(); + d->wizard.categoryComboBox->clear();
categoryIds.clear();
foreach( GluonPlayer::CategoryItem * category, categories )
@@ -104,31 +220,31 @@ void DistributionWizard::categoriesFetched()
if( categoryString.startsWith( QLatin1String("Gluon"), Qt::CaseInsensitive ) \
) {
categoryIds.append( category->id() );
- wizard.categoryComboBox->addItem( categoryString );
+ d->wizard.categoryComboBox->addItem( categoryString );
}
}
-*/
+
}
void DistributionWizard::updateLicenses()
{
- /* GluonPlayer::LicenseJob* licenseJob = \
GluonPlayer::ServiceProvider::instance()->fetchLicenses(); + \
GluonPlayer::LicenseJob* licenseJob = \
GluonPlayer::ServiceProvider::instance()->fetchLicenses(); connect( licenseJob, \
SIGNAL(succeeded()), SLOT(licensesFetched()) );
- licenseJob->start();*/
+ licenseJob->start();
}
void DistributionWizard::licensesFetched()
-{/*
+{
QList<GluonPlayer::LicenseItem*> licenses = \
qobject_cast<GluonPlayer::LicenseJob*>( sender() )->data().value< \
QList<GluonPlayer::LicenseItem*> >();
- wizard.licenseComboBox->clear();
+ d->wizard.nextlicenseComboBox->clear();
licenseIds.clear();
foreach( GluonPlayer::LicenseItem * license, licenses )
{
licenseIds.append( license->id() );
- wizard.licenseComboBox->addItem( license->licenseName() );
- }*/
+ d->wizard.nextlicenseComboBox->addItem( license->licenseName() );
+ }
}
#include "distributionwizard.moc"
diff --git a/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.h \
b/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.h \
index f49ab50..e23c5a6 100644
--- a/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.h
+++ b/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.h
@@ -34,7 +34,6 @@ class DistributionWizard: public QObject
void startWizard();
void updateCategories();
void updateLicenses();
- void uploadGame();
void updateUi();
class DistributionWizardPrivate;
DistributionWizardPrivate* const d;
@@ -42,11 +41,26 @@ class DistributionWizard: public QObject
public slots:
void categoriesFetched();
void uploadFinished();
+ void editGamefailed();
+ void editGameFinished();
void licensesFetched();
+ void gamedetailsFetched();
+ void pageChanged(int pageId);
+ void uploadGameArchive();
+ void finalUploading();
+
private:
QStringList categoryIds;
QStringList licenseIds;
-
+ QString apiKey;
+ QString gameid;
+ QString gameName;
+ QString chosenCategory;
+ QString description;
+ QString changeLog;
+ QString homepage;
+ QString version;
+ QString chosenLicense;
};
#endif // DISTRIBUTIONWIZARD_H
diff --git a/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.ui \
b/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.ui \
index 17a2f15..13161b3 100644
--- a/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.ui
+++ b/creator/plugins/docks/distributiondock/distributionwizard/distributionwizard.ui
@@ -56,8 +56,8 @@
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
- <x>10</x>
- <y>-20</y>
+ <x>50</x>
+ <y>0</y>
<width>381</width>
<height>201</height>
</rect>
@@ -151,6 +151,120 @@
</widget>
</widget>
</widget>
+ <widget class="QWizardPage" name="nextdetailsPage">
+ <property name="subTitle">
+ <string>Updating Game details, please wait</string>
+ </property>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>0</y>
+ <width>381</width>
+ <height>201</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <widget class="QWidget" name="verticalLayoutWidget_4">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>160</width>
+ <height>161</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Game ID</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Category</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>Version</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>Home Page</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>License</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="verticalLayoutWidget_5">
+ <property name="geometry">
+ <rect>
+ <x>190</x>
+ <y>20</y>
+ <width>160</width>
+ <height>162</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QLineEdit" name="nextgameIdEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="nextCategory">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="nextnameEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="nextversionEdit"/>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="nexthomePageEdit"/>
+ </item>
+ <item>
+ <widget class="QComboBox" name="nextlicenseComboBox"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
<widget class="QWizardPage" name="descriptionPage">
<property name="subTitle">
<string>A few words about your game</string>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic