UpdaterWindow Class Reference
[Core GUI related classes (widgets)]

#include <updatewindow.h>

Inheritance diagram for UpdaterWindow:

Window

List of all members.


Detailed Description

Update progress window GUI.

Definition at line 46 of file updatewindow.h.


Public Member Functions

 UpdaterWindow (const std::string &updateHost, const std::string &updatesDir)
 Constructor.
 ~UpdaterWindow ()
 Destructor.
void setProgress (float p)
 Set's progress bar status.
void setLabel (const std::string &)
 Set's label above progress.
void enable ()
 Enables play button.
void loadNews ()
 Loads and display news.
void action (const gcn::ActionEvent &event)
void logic ()

Public Attributes

int updateState

Private Types

enum  DownloadStatus {
  UPDATE_ERROR, UPDATE_IDLE, UPDATE_LIST, UPDATE_COMPLETE,
  UPDATE_NEWS, UPDATE_RESOURCES
}

Private Member Functions

void download ()

Static Private Member Functions

static int downloadThread (void *ptr)
 The thread function that download the files.
static int updateProgress (void *ptr, double dt, double dn, double ut, double un)
 A libcurl callback for progress updates.
static size_t memoryWrite (void *ptr, size_t size, size_t nmemb, FILE *stream)
 A libcurl callback for writing to memory.

Private Attributes

SDL_Thread * mThread
 A thread that use libcurl to download updates.
DownloadStatus mDownloadStatus
 Status of the current download.
std::string mUpdateHost
 Host where we get the updated files.
std::string mUpdatesDir
 Place where the updates are stored (absolute path).
std::string mCurrentFile
 The file currently downloading.
std::string mNewLabelCaption
 The new label caption to be set in the logic method.
Mutex mLabelMutex
 The mutex used to guard access to mNewLabelCaption.
unsigned long mCurrentChecksum
 The Adler32 checksum of the file currently downloading.
bool mStoreInMemory
 A flag to indicate whether to use a memory buffer or a regular file.
bool mDownloadComplete
 Flag that show if current download is complete.
bool mUserCancel
 Flag that show if the user has canceled the update.
int mDownloadedBytes
 Byte count currently downloaded in mMemoryBuffer.
char * mMemoryBuffer
 Buffer for files downloaded to memory.
char * mCurlError
 Buffer to handler human readable error provided by curl.
std::vector< std::string > mLines
 List of files to download.
unsigned int mLineIndex
 Index of the file to be downloaded.
gcn::Label * mLabel
 Progress bar caption.
ButtonmCancelButton
 Button to stop the update process.
ButtonmPlayButton
 Button to start playing.
ProgressBarmProgressBar
 Update progress bar.
BrowserBoxmBrowserBox
 Box to display news.
ScrollAreamScrollArea
 Used to scroll news box.

Member Enumeration Documentation

Enumerator:
UPDATE_ERROR 
UPDATE_IDLE 
UPDATE_LIST 
UPDATE_COMPLETE 
UPDATE_NEWS 
UPDATE_RESOURCES 

Definition at line 111 of file updatewindow.h.


Constructor & Destructor Documentation

UpdaterWindow::UpdaterWindow ( const std::string &  updateHost,
const std::string &  updatesDir 
)

Constructor.

Parameters:
updateHost Host where to get the updated files.
updatesDir Directory where to store updates (should be absolute and already created).

Definition at line 89 of file updatewindow.cpp.

UpdaterWindow::~UpdaterWindow (  ) 

Destructor.

Definition at line 140 of file updatewindow.cpp.


Member Function Documentation

void UpdaterWindow::setProgress ( float  p  ) 

Set's progress bar status.

Definition at line 153 of file updatewindow.cpp.

void UpdaterWindow::setLabel ( const std::string &  str  ) 

Set's label above progress.

Definition at line 158 of file updatewindow.cpp.

void UpdaterWindow::enable (  ) 

Enables play button.

Definition at line 165 of file updatewindow.cpp.

void UpdaterWindow::loadNews (  ) 

Loads and display news.

Assumes the news file contents have been loaded into the memory buffer.

Definition at line 190 of file updatewindow.cpp.

void UpdaterWindow::action ( const gcn::ActionEvent &  event  ) 

Definition at line 172 of file updatewindow.cpp.

void UpdaterWindow::logic (  ) 

Definition at line 416 of file updatewindow.cpp.

void UpdaterWindow::download (  )  [private]

Definition at line 404 of file updatewindow.cpp.

int UpdaterWindow::downloadThread ( void *  ptr  )  [static, private]

The thread function that download the files.

Definition at line 257 of file updatewindow.cpp.

int UpdaterWindow::updateProgress ( void *  ptr,
double  dt,
double  dn,
double  ut,
double  un 
) [static, private]

A libcurl callback for progress updates.

Definition at line 219 of file updatewindow.cpp.

size_t UpdaterWindow::memoryWrite ( void *  ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
) [static, private]

A libcurl callback for writing to memory.

Definition at line 242 of file updatewindow.cpp.


Member Data Documentation

Definition at line 89 of file updatewindow.h.

SDL_Thread* UpdaterWindow::mThread [private]

A thread that use libcurl to download updates.

Definition at line 122 of file updatewindow.h.

Status of the current download.

Definition at line 125 of file updatewindow.h.

std::string UpdaterWindow::mUpdateHost [private]

Host where we get the updated files.

Definition at line 128 of file updatewindow.h.

std::string UpdaterWindow::mUpdatesDir [private]

Place where the updates are stored (absolute path).

Definition at line 131 of file updatewindow.h.

std::string UpdaterWindow::mCurrentFile [private]

The file currently downloading.

Definition at line 134 of file updatewindow.h.

std::string UpdaterWindow::mNewLabelCaption [private]

The new label caption to be set in the logic method.

Definition at line 137 of file updatewindow.h.

The mutex used to guard access to mNewLabelCaption.

Definition at line 140 of file updatewindow.h.

unsigned long UpdaterWindow::mCurrentChecksum [private]

The Adler32 checksum of the file currently downloading.

Definition at line 143 of file updatewindow.h.

A flag to indicate whether to use a memory buffer or a regular file.

Definition at line 146 of file updatewindow.h.

Flag that show if current download is complete.

Definition at line 149 of file updatewindow.h.

Flag that show if the user has canceled the update.

Definition at line 152 of file updatewindow.h.

Byte count currently downloaded in mMemoryBuffer.

Definition at line 155 of file updatewindow.h.

Buffer for files downloaded to memory.

Definition at line 158 of file updatewindow.h.

char* UpdaterWindow::mCurlError [private]

Buffer to handler human readable error provided by curl.

Definition at line 161 of file updatewindow.h.

std::vector<std::string> UpdaterWindow::mLines [private]

List of files to download.

Definition at line 164 of file updatewindow.h.

unsigned int UpdaterWindow::mLineIndex [private]

Index of the file to be downloaded.

Definition at line 167 of file updatewindow.h.

gcn::Label* UpdaterWindow::mLabel [private]

Progress bar caption.

Definition at line 169 of file updatewindow.h.

Button to stop the update process.

Definition at line 170 of file updatewindow.h.

Button to start playing.

Definition at line 171 of file updatewindow.h.

Update progress bar.

Definition at line 172 of file updatewindow.h.

Box to display news.

Definition at line 173 of file updatewindow.h.

Used to scroll news box.

Definition at line 174 of file updatewindow.h.


The documentation for this class was generated from the following files:

Generated on Sun Apr 26 17:30:44 2009 for The Mana World by  doxygen 1.5.5