summaryrefslogtreecommitdiff
path: root/src/gui/windows/updaterwindow.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-28 20:06:11 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-28 20:06:11 +0300
commitbe9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4 (patch)
tree30427f083bce1d1a67ab3ad17d33a87ee9b21565 /src/gui/windows/updaterwindow.h
parent861c503c608b41256bca47dedee15dc01e09527d (diff)
downloadplus-be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4.tar.gz
plus-be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4.tar.bz2
plus-be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4.tar.xz
plus-be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4.zip
Fix formatting in gui files.
Diffstat (limited to 'src/gui/windows/updaterwindow.h')
-rw-r--r--src/gui/windows/updaterwindow.h292
1 files changed, 147 insertions, 145 deletions
diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h
index fec31fce0..59afa5a24 100644
--- a/src/gui/windows/updaterwindow.h
+++ b/src/gui/windows/updaterwindow.h
@@ -60,204 +60,206 @@ class UpdaterWindow final : public Window,
public LinkHandler,
public KeyListener
{
- public:
- /**
- * Constructor.
- *
- * @param updateHost Host where to get the updated files.
- * @param updatesDir Directory where to store updates (should be absolute
- * and already created).
- * @param applyUpdates If true, the update window will pass the updates to teh
- * resource manager
- */
- UpdaterWindow(const std::string &restrict updateHost,
- const std::string &restrict updatesDir,
- const bool applyUpdates, const int updateType);
+ public:
+ /**
+ * Constructor.
+ *
+ * @param updateHost Host where to get the updated files.
+ * @param updatesDir Directory where to store updates (should be
+ * absolute and already created).
+ * @param applyUpdates If true, the update window will pass the updates
+ * to teh resource manager.
+ */
+ UpdaterWindow(const std::string &restrict updateHost,
+ const std::string &restrict updatesDir,
+ const bool applyUpdates, const int updateType);
- A_DELETE_COPY(UpdaterWindow)
+ A_DELETE_COPY(UpdaterWindow)
- /**
- * Destructor
- */
- ~UpdaterWindow();
+ /**
+ * Destructor
+ */
+ ~UpdaterWindow();
- void postInit() override final;
+ void postInit() override final;
- /**
- * Set's progress bar status
- */
- void setProgress(const float p);
-
- /**
- * Set's label above progress
- */
- void setLabel(const std::string &);
+ /**
+ * Set's progress bar status
+ */
+ void setProgress(const float p);
+
+ /**
+ * Set's label above progress
+ */
+ void setLabel(const std::string &);
- /**
- * Enables play button
- */
- void enable();
+ /**
+ * Enables play button
+ */
+ void enable();
- /**
- * Loads and display news. Assumes the news file contents have been loaded
- * into the memory buffer.
- */
- void loadNews();
+ /**
+ * Loads and display news. Assumes the news file contents have been
+ * loaded into the memory buffer.
+ */
+ void loadNews();
- void loadPatch();
+ void loadPatch();
- void action(const ActionEvent &event) override final;
+ void action(const ActionEvent &event) override final;
- void keyPressed(KeyEvent &event) override final;
+ void keyPressed(KeyEvent &event) override final;
- void logic() override final;
+ void logic() override final;
- void handleLink(const std::string &link,
- MouseEvent *event A_UNUSED) override final;
+ void handleLink(const std::string &link,
+ MouseEvent *event A_UNUSED) override final;
- void loadFile(std::string file);
+ void loadFile(std::string file);
- void deleteSelf();
+ void deleteSelf();
- static void loadLocalUpdates(const std::string &dir);
+ static void loadLocalUpdates(const std::string &dir);
- static void unloadUpdates(const std::string &dir);
+ static void unloadUpdates(const std::string &dir);
- static void addUpdateFile(const ResourceManager *const resman,
- const std::string &restrict path,
- const std::string &restrict fixPath,
- const std::string &restrict file,
- const bool append);
+ static void addUpdateFile(const ResourceManager *const resman,
+ const std::string &restrict path,
+ const std::string &restrict fixPath,
+ const std::string &restrict file,
+ const bool append);
- static void removeUpdateFile(const ResourceManager *const resman,
- const std::string &restrict path,
- const std::string &restrict fixPath,
- const std::string &filerestrict);
+ static void removeUpdateFile(const ResourceManager *const resman,
+ const std::string &restrict path,
+ const std::string &restrict fixPath,
+ const std::string &filerestrict);
- static void loadManaPlusUpdates(const std::string &dir,
- const ResourceManager *const resman);
+ static void loadManaPlusUpdates(const std::string &dir,
+ const ResourceManager *const resman);
- static void unloadManaPlusUpdates(const std::string &dir,
- const ResourceManager *const resman);
+ static void unloadManaPlusUpdates(const std::string &dir,
+ const ResourceManager *const resman);
- static unsigned long getFileHash(const std::string &filePath);
+ static unsigned long getFileHash(const std::string &filePath);
- static void loadMods(const std::string &dir,
- const ResourceManager *const resman,
- const std::vector<UpdateFile> &updateFiles);
+ static void loadMods(const std::string &dir,
+ const ResourceManager *const resman,
+ const std::vector<UpdateFile> &updateFiles);
- static void loadDirMods(const std::string &dir);
+ static void loadDirMods(const std::string &dir);
- static void unloadMods(const std::string &dir);
+ static void unloadMods(const std::string &dir);
-private:
- void download();
+ private:
+ void download();
- /**
- * Loads the updates this window has gotten into the resource manager
- */
- void loadUpdates();
+ /**
+ * Loads the updates this window has gotten into the resource manager
+ */
+ void loadUpdates();
- /**
- * A download callback for progress updates.
- */
- static int updateProgress(void *ptr, DownloadStatus::Type status,
- size_t dt, size_t dn);
+ /**
+ * A download callback for progress updates.
+ */
+ static int updateProgress(void *ptr, DownloadStatus::Type status,
+ size_t dt, size_t dn);
- /**
- * A libcurl callback for writing to memory.
- */
- static size_t memoryWrite(void *ptr, size_t size, size_t nmemb,
- void *stream);
+ /**
+ * A libcurl callback for writing to memory.
+ */
+ static size_t memoryWrite(void *ptr, size_t size, size_t nmemb,
+ void *stream);
- static bool validateFile(const std::string &filePath,
- const unsigned long hash) A_WARN_UNUSED;
+ static bool validateFile(const std::string &filePath,
+ const unsigned long hash) A_WARN_UNUSED;
- enum UpdateDownloadStatus
- {
- UPDATE_ERROR = 0,
- UPDATE_IDLE,
- UPDATE_LIST,
- UPDATE_COMPLETE,
- UPDATE_NEWS,
- UPDATE_RESOURCES,
- UPDATE_PATCH,
- UPDATE_LIST2,
- UPDATE_RESOURCES2
- };
+ enum UpdateDownloadStatus
+ {
+ UPDATE_ERROR = 0,
+ UPDATE_IDLE,
+ UPDATE_LIST,
+ UPDATE_COMPLETE,
+ UPDATE_NEWS,
+ UPDATE_RESOURCES,
+ UPDATE_PATCH,
+ UPDATE_LIST2,
+ UPDATE_RESOURCES2
+ };
- /** The new progress value to be set in the logic method. */
- float mDownloadProgress;
+ /** The new progress value to be set in the logic method. */
+ float mDownloadProgress;
- /** Host where we get the updated files. */
- std::string mUpdateHost;
+ /** Host where we get the updated files. */
+ std::string mUpdateHost;
- /** Place where the updates are stored (absolute path). */
- std::string mUpdatesDir;
+ /** Place where the updates are stored (absolute path). */
+ std::string mUpdatesDir;
- std::string mUpdatesDirReal;
+ std::string mUpdatesDirReal;
- /** The file currently downloading. */
- std::string mCurrentFile;
+ /** The file currently downloading. */
+ std::string mCurrentFile;
- /** The new label caption to be set in the logic method. */
- std::string mNewLabelCaption;
+ /** The new label caption to be set in the logic method. */
+ std::string mNewLabelCaption;
- // The mutex used to guard access to mNewLabelCaption
- // and mDownloadProgress.
- Mutex mDownloadMutex;
+ // The mutex used to guard access to mNewLabelCaption
+ // and mDownloadProgress.
+ Mutex mDownloadMutex;
- /** The Adler32 checksum of the file currently downloading. */
- unsigned long mCurrentChecksum;
+ /** The Adler32 checksum of the file currently downloading. */
+ unsigned long mCurrentChecksum;
- /** Buffer for files downloaded to memory. */
- char *mMemoryBuffer;
+ /** Buffer for files downloaded to memory. */
+ char *mMemoryBuffer;
- /** Download handle. */
- Net::Download *mDownload;
+ /** Download handle. */
+ Net::Download *mDownload;
- /** List of files to download. */
- std::vector<UpdateFile> mUpdateFiles;
+ /** List of files to download. */
+ std::vector<UpdateFile> mUpdateFiles;
- /** List of temp files to download. */
- std::vector<UpdateFile> mTempUpdateFiles;
+ /** List of temp files to download. */
+ std::vector<UpdateFile> mTempUpdateFiles;
- std::string mUpdateServerPath;
+ std::string mUpdateServerPath;
- 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. */
+ 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. */
- /** Status of the current download. */
- UpdateDownloadStatus mDownloadStatus;
+ /** Status of the current download. */
+ UpdateDownloadStatus mDownloadStatus;
- /** Byte count currently downloaded in mMemoryBuffer. */
- int mDownloadedBytes;
+ /** Byte count currently downloaded in mMemoryBuffer. */
+ int mDownloadedBytes;
- /** Index of the file to be downloaded. */
- unsigned int mUpdateIndex;
+ /** Index of the file to be downloaded. */
+ unsigned int mUpdateIndex;
- /** Index offset for disaplay downloaded file. */
- unsigned int mUpdateIndexOffset;
+ /** Index offset for disaplay downloaded file. */
+ unsigned int mUpdateIndexOffset;
- int mUpdateType;
+ int mUpdateType;
- /** A flag to indicate whether to use a memory buffer or a regular file. */
- bool mStoreInMemory;
+ /** A flag to indicate whether to use a memory buffer or a regular
+ * file.
+ */
+ bool mStoreInMemory;
- /** Flag that show if current download is complete. */
- bool mDownloadComplete;
+ /** Flag that show if current download is complete. */
+ bool mDownloadComplete;
- /** Flag that show if the user has canceled the update. */
- bool mUserCancel;
+ /** Flag that show if the user has canceled the update. */
+ bool mUserCancel;
- /** Tells ~UpdaterWindow() if it should load updates */
- bool mLoadUpdates;
+ /** Tells ~UpdaterWindow() if it should load updates */
+ bool mLoadUpdates;
- bool mValidateXml;
+ bool mValidateXml;
};
extern UpdaterWindow *updaterWindow;