Commit 1aaf059a authored by Gerhard Stein's avatar Gerhard Stein

Much cooler progress bar, better Audio-Settings

parent 9a51fad6
Subproject commit 55806926f375c2a7d56cc06737d3f4e4bae82afc
Subproject commit c169f11757d3ed81a9b70047d588e812f676c77a
......@@ -587,6 +587,8 @@ void CGameLauncher::pumpEvent(const CEvent *evPtr)
else if( dynamic_cast<const CancelDownloadEvent*>(evPtr))
{
mCancelDownload = true;
mpDloadCancel->enable(false);
mpDloadProgressCtrl->setBad(true);
}
......
......@@ -16,6 +16,7 @@
#include <widgets/GsText.h>
#include <widgets/GsButton.h>
#include <widgets/GsTextSelectionList.h>
#include <widgets/GsProgressbar.h>
#include <string>
#include <vector>
......@@ -92,7 +93,9 @@ public:
void ponder(const float deltaT);
void render();
int getChosengame(){ return m_chosenGame; }
int getChosengame()
{ return m_chosenGame; }
bool setChosenGame(int chosengame) { m_chosenGame = chosengame; return waschosen(); }
bool waschosen(){ return (m_chosenGame>=0); }
void letchooseagain()
......@@ -143,6 +146,7 @@ private:
std::shared_ptr<GsButton> mpDloadBack;
std::shared_ptr<GsButton> mpDloadCancel;
std::shared_ptr<GsButton> mpDloadDownload;
std::shared_ptr<GsProgressBar> mpDloadProgressCtrl;
std::shared_ptr<CGUIBitmap> mpCurrentDownloadBmp;
std::vector< std::shared_ptr<GsBitmap> > mpDownloadPrevievBmpVec;
std::vector<GameCatalogueEntry> mGameCatalogue;
......
......@@ -70,17 +70,18 @@ void CGameLauncher::pullGame(const int selection)
mCancelDownload = false;
mpDloadProgressCtrl->enableFancyAnimation(true);
mpGameDownloader = threadPool->start(new GameDownloader(mDownloadProgress,
mCancelDownload,
gameFileName,
gameName), "Game Downloader started!");
gameName),
"Game Downloader started!");
}
void CGameLauncher::ponderDownloadDialog()
{
// TODO: This is yet no way to cancel the download progress
// Update the description if selection changed
int sel = mpGSSelList->getSelection();
if(mLastStoreSelection != sel)
......@@ -94,7 +95,7 @@ void CGameLauncher::ponderDownloadDialog()
mLastStoreSelection = sel;
}
// Disable Some Elements while downloading
// Disable some dialog elements while downloading
if(mDownloading)
{
mpDloadSelectionList->enable(false);
......@@ -113,7 +114,9 @@ void CGameLauncher::ponderDownloadDialog()
// When everything is done, The launcher should be restarted, for searching new games.
if( mFinishedDownload && mpGameDownloader->finished )
if( mFinishedDownload &&
mpGameDownloader->finished &&
mpDloadProgressCtrl->finished() )
{
mpGameStoreDialog = nullptr;
gEventManager.add(new GMSwitchToGameLauncher() );
......@@ -155,11 +158,13 @@ void CGameLauncher::setupDownloadDialog()
// Title
mpDloadTitleText = std::dynamic_pointer_cast<CGUIText>(
mpGameStoreDialog->addControl(new CGUIText("Select your Game for Download"), GsRect<float>(0.0f, 0.0f, 1.0f, 0.05f)) );
mpGameStoreDialog->addControl(new CGUIText("Select your Game for Download"),
GsRect<float>(0.0f, 0.0f, 1.0f, 0.05f)) );
// Selection List
mpDloadSelectionList = std::dynamic_pointer_cast<CGUITextSelectionList>(
mpGameStoreDialog->addControl(mpGSSelList, GsRect<float>(0.01f, 0.04f, 0.50f, 0.65f)) );
mpGameStoreDialog->addControl(mpGSSelList,
GsRect<float>(0.01f, 0.04f, 0.50f, 0.65f)) );
// Create an empty Bitmap control for the preview
mpCurrentDownloadBmp = std::dynamic_pointer_cast<CGUIBitmap>(
......@@ -169,17 +174,19 @@ void CGameLauncher::setupDownloadDialog()
// Description Text Box
mpDDescriptionText = std::dynamic_pointer_cast<CGUIText>(
mpGameStoreDialog->addControl(new CGUIText("Description"), GsRect<float>(0.01f, 0.70f, 0.98f, 0.1f)) );
mpGameStoreDialog->addControl(new CGUIText("Description"),
GsRect<float>(0.01f, 0.70f, 0.98f, 0.1f)) );
// Progress Bar
mpGameStoreDialog->addControl(new GsProgressBar(mDownloadProgress), GsRect<float>(0.1f, 0.8f, 0.8f, 0.05f));
mpDloadProgressCtrl = std::dynamic_pointer_cast<GsProgressBar>(
mpGameStoreDialog->addControl(new GsProgressBar(mDownloadProgress),
GsRect<float>(0.1f, 0.8f, 0.8f, 0.05f)) );
// Bottom Controls
mpDloadBack = std::dynamic_pointer_cast<GsButton>(
mpGameStoreDialog->addControl( new GsButton( "< Back", new CloseBoxEvent() ),
//GsRect<float>(0.165f, 0.865f, 0.2f, 0.07f) ) );
GsRect<float>(0.100f, 0.865f, 0.25f, 0.07f) ) );
mpDloadCancel = std::dynamic_pointer_cast<GsButton>(
......@@ -189,7 +196,6 @@ void CGameLauncher::setupDownloadDialog()
mpDloadDownload = std::dynamic_pointer_cast<GsButton>(
mpGameStoreDialog->addControl( new GsButton( "Download", new GameStorePullGame() ),
//GsRect<float>(0.635f, 0.865f, 0.2f, 0.07f) ) );
GsRect<float>(0.650f, 0.865f, 0.25f, 0.07f) ) );
......
......@@ -93,7 +93,6 @@ size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
int downloadFile(const std::string &filename, int &progress,
const std::string &downloadDirPath)
{
progressPtr = &progress;
const std::string urlString = "http://downloads.sourceforge.net/project/clonekeenplus/Downloads/" + filename;
......@@ -149,13 +148,15 @@ int downloadFile(const std::string &filename, int &progress,
res = curl_easy_perform(curl);
gLogging.ftextOut( FONTCOLORS::GREEN, "Finished downloading from \"%s\", destination: \"%s\"", urlString.c_str(), outputPath.c_str());
progress = 1000;
}
else
{
{
/* always cleanup */
curl_easy_cleanup(curl);
gLogging.ftextOut( FONTCOLORS::GREEN, "Error creating path \"%s\" for writing", outputPath.c_str());
gLogging.ftextOut( FONTCOLORS::RED, "Error creating path \"%s\" for writing", outputPath.c_str());
return 1;
}
......@@ -187,7 +188,6 @@ bool GameDownloader::loadCatalogue(const std::string &catalogueFile)
try
{
// Load the XML file into the property tree. If reading fails
// (cannot open file, parse error), an exception is thrown.
read_xml(catalogueFile, pt);
......
......@@ -29,13 +29,13 @@ class CAudioSettings : public GalaxyMenu
public:
CAudioSettings();
void init();
void init();
void ponder(const float deltaT);
void ponder(const float deltaT) override;
void release();
void release() override;
void refresh();
void refresh() override;
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment