#include <updatewindow.h>
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. | |
Button * | mCancelButton |
Button to stop the update process. | |
Button * | mPlayButton |
Button to start playing. | |
ProgressBar * | mProgressBar |
Update progress bar. | |
BrowserBox * | mBrowserBox |
Box to display news. | |
ScrollArea * | mScrollArea |
Used to scroll news box. |
enum UpdaterWindow::DownloadStatus [private] |
Definition at line 111 of file updatewindow.h.
UpdaterWindow::UpdaterWindow | ( | const std::string & | updateHost, | |
const std::string & | updatesDir | |||
) |
Constructor.
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 | ( | ) |
void UpdaterWindow::setProgress | ( | float | p | ) |
void UpdaterWindow::setLabel | ( | const std::string & | str | ) |
void UpdaterWindow::enable | ( | ) |
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] |
int UpdaterWindow::updateProgress | ( | void * | ptr, | |
double | dt, | |||
double | dn, | |||
double | ut, | |||
double | un | |||
) | [static, private] |
size_t UpdaterWindow::memoryWrite | ( | void * | ptr, | |
size_t | size, | |||
size_t | nmemb, | |||
FILE * | stream | |||
) | [static, private] |
Definition at line 89 of file updatewindow.h.
SDL_Thread* UpdaterWindow::mThread [private] |
DownloadStatus UpdaterWindow::mDownloadStatus [private] |
std::string UpdaterWindow::mUpdateHost [private] |
std::string UpdaterWindow::mUpdatesDir [private] |
std::string UpdaterWindow::mCurrentFile [private] |
std::string UpdaterWindow::mNewLabelCaption [private] |
Mutex UpdaterWindow::mLabelMutex [private] |
unsigned long UpdaterWindow::mCurrentChecksum [private] |
The Adler32 checksum of the file currently downloading.
Definition at line 143 of file updatewindow.h.
bool UpdaterWindow::mStoreInMemory [private] |
A flag to indicate whether to use a memory buffer or a regular file.
Definition at line 146 of file updatewindow.h.
bool UpdaterWindow::mDownloadComplete [private] |
bool UpdaterWindow::mUserCancel [private] |
int UpdaterWindow::mDownloadedBytes [private] |
char* UpdaterWindow::mMemoryBuffer [private] |
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] |
unsigned int UpdaterWindow::mLineIndex [private] |
gcn::Label* UpdaterWindow::mLabel [private] |
Button* UpdaterWindow::mCancelButton [private] |
Button* UpdaterWindow::mPlayButton [private] |
ProgressBar* UpdaterWindow::mProgressBar [private] |
BrowserBox* UpdaterWindow::mBrowserBox [private] |
ScrollArea* UpdaterWindow::mScrollArea [private] |