Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
UpdaterWindow Class Reference

Update progress window GUI. More...

#include <updaterwindow.h>

Inheritance diagram for UpdaterWindow:
Window

Public Member Functions

 UpdaterWindow (const std::string &updateHost, const std::string &updatesDir, bool applyUpdates)
 Constructor.
 
 ~UpdaterWindow () override
 
void action (const gcn::ActionEvent &event) override
 
void keyPressed (gcn::KeyEvent &keyEvent) override
 
void logic () override
 
- Public Member Functions inherited from Window
 Window (const std::string &caption="Window", bool modal=false, Window *parent=nullptr)
 Constructor.
 
 Window (SkinType skinType, const std::string &caption="Window", bool modal=false, Window *parent=nullptr)
 Constructor that allows customizing the SkinType used by the window.
 
 ~Window () override
 Destructor.
 
void draw (gcn::Graphics *graphics) override
 Draws the window contents.
 
void drawFrame (gcn::Graphics *graphics) override
 Draws the window frame.
 
void setContentSize (int width, int height)
 Sets the size of this window.
 
void setMinimumContentSize (int width, int height)
 Sets the minimum size of the window content.
 
void setLocationRelativeTo (gcn::Widget *widget)
 Sets the location relative to the given widget.
 
void setResizable (bool resize)
 Sets whether or not the window can be resized.
 
void redraw ()
 
void widgetResized (const gcn::Event &event) override
 Called whenever the widget changes size.
 
void widgetHidden (const gcn::Event &event) override
 Called whenever the widget is hidden.
 
void setCloseButton (bool flag)
 Sets whether or not the window has a close button.
 
bool isResizable () const
 Returns whether the window can be resized.
 
void setMinWidth (int width)
 Sets the minimum width of the window.
 
int getMinWidth () const
 
void setMinHeight (int height)
 Sets the minimum height of the window.
 
int getMinHeight () const
 
void setMaxWidth (int width)
 Sets the maximum width of the window.
 
int getMaxWidth () const
 
void setMaxHeight (int height)
 Sets the minimum height of the window.
 
int getMaxHeight () const
 
void setShowTitle (bool flag)
 Sets flag to show a title or not.
 
void setStickyButton (bool flag)
 Sets whether or not the window has a sticky button.
 
void setSticky (bool sticky)
 Sets whether the window is sticky.
 
bool isSticky () const
 Returns whether the window is sticky.
 
virtual void setVisible (bool visible)
 Overloads window setVisible by Guichan to allow sticky window handling.
 
void setVisible (bool visible, bool forceSticky)
 Overloads window setVisible by Guichan to allow sticky window handling, or not, if you force the sticky state.
 
bool isDefaultVisible () const
 Returns whether the window is visible by default.
 
void setDefaultVisible (bool save)
 Sets whether the window is visible by default.
 
bool willSaveVisible () const
 Returns whether the window will save it's visibility.
 
void setSaveVisible (bool save)
 Sets whether the window will save it's visibility.
 
WindowgetParentWindow () const
 Returns the parent window.
 
void scheduleDelete ()
 Schedule this window for deletion.
 
void mousePressed (gcn::MouseEvent &event) override
 Starts window resizing when appropriate.
 
void mouseDragged (gcn::MouseEvent &event) override
 Implements window resizing and makes sure the window is not dragged/resized outside of the screen.
 
void mouseMoved (gcn::MouseEvent &event) override
 Implements custom cursor image changing context, based on mouse relative position.
 
void mouseReleased (gcn::MouseEvent &event) override
 When the mouse button has been let go, this ensures that the mouse custom cursor is restored back to it's standard image.
 
void mouseExited (gcn::MouseEvent &event) override
 When the mouse leaves the window this ensures that the custom cursor is restored back to it's standard image.
 
void setWindowName (const std::string &name)
 Sets the name of the window.
 
const std::string & getWindowName () const
 Returns the name of the window.
 
void loadWindowState ()
 Reads the position (and the size for resizable windows) in the configuration based on the given string.
 
void saveWindowState () const
 Saves the window state so that when the window is reloaded, it'll maintain its previous state and location.
 
void setDefaultSize (int defaultX, int defaultY, int defaultWidth, int defaultHeight)
 Set the default win pos and size.
 
void setDefaultSize ()
 Set the default win pos and size to the current ones.
 
void setDefaultSize (int defaultWidth, int defaultHeight, WindowAlignment alignment, int offsetx=0, int offsetY=0)
 Set the default win pos and size.
 
virtual void resetToDefaultSize ()
 Reset the win pos and size to default.
 
void adjustPositionAfterResize (int oldScreenWidth, int oldScreenHeight)
 Adjusts the window position after the application window has been resized.
 
LayoutgetLayout ()
 Gets the layout handler for this window.
 
void clearLayout ()
 Clears the window's layout (useful for redesigning the window).
 
void reflowLayout (int w=0, int h=0)
 Computes the position of the widgets according to the current layout.
 
LayoutCellplace (int x, int y, gcn::Widget *, int w=1, int h=1)
 Adds a widget to the window and sets it at given cell.
 
ContainerPlacer getPlacer (int x, int y)
 Returns a proxy for adding widgets in an inner table of the layout.
 
void center ()
 Positions the window in the center of it's parent.
 
virtual void close ()
 Overrideable functionality for when the window is to close.
 
const SkingetSkin () const
 Returns the Skin used by this window.
 

Private Types

enum class  DialogState { DownloadNews , DownloadList , DownloadResources , Done }
 

Private Member Functions

bool cancel ()
 
void play ()
 
void setLabel (const std::string &)
 
void enablePlay ()
 
void startDownload (const std::string &fileName, bool storeInMemory, std::optional< unsigned long > adler32={})
 
void downloadCompleted ()
 
void loadNews ()
 Loads and display news.
 
void loadUpdates ()
 Loads the updates this window has gotten into the resource manager.
 

Private Attributes

DialogState mDialogState = DialogState::DownloadNews
 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::unique_ptr< Net::DownloadmDownload
 Download handle.
 
std::vector< UpdateFilemUpdateFiles
 List of files to download.
 
unsigned int mUpdateIndex = 0
 Index of the file to be downloaded.
 
bool mLoadUpdates
 Tells ~UpdaterWindow() if it should load updates.
 
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.
 
std::unique_ptr< LinkHandlermLinkHandler
 

Additional Inherited Members

- Static Public Member Functions inherited from Window
static void setWindowContainer (WindowContainer *windowContainer)
 Sets the window container to be used by new windows.
 
static int getGuiAlpha ()
 Gets the alpha value used by the window, in a Guichan usable format.
 
- Static Protected Attributes inherited from Window
static int mouseResize = 0
 Active resize handles.
 

Detailed Description

Update progress window GUI.

Definition at line 55 of file updaterwindow.h.

Member Enumeration Documentation

◆ DialogState

enum class UpdaterWindow::DialogState
strongprivate
Enumerator
DownloadNews 
DownloadList 
DownloadResources 
Done 

Definition at line 103 of file updaterwindow.h.

Constructor & Destructor Documentation

◆ UpdaterWindow()

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

Constructor.

Parameters
updateHostHost where to get the updated files.
updatesDirDirectory where to store updates (should be absolute and already created).
applyUpdatesIf true, the update window will pass the updates to the resource manager

Definition at line 120 of file updaterwindow.cpp.

◆ ~UpdaterWindow()

UpdaterWindow::~UpdaterWindow ( )
override

Definition at line 165 of file updaterwindow.cpp.

Member Function Documentation

◆ action()

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

Definition at line 184 of file updaterwindow.cpp.

◆ cancel()

bool UpdaterWindow::cancel ( )
private

Definition at line 210 of file updaterwindow.cpp.

◆ downloadCompleted()

void UpdaterWindow::downloadCompleted ( )
private

Definition at line 322 of file updaterwindow.cpp.

◆ enablePlay()

void UpdaterWindow::enablePlay ( )
private

Definition at line 177 of file updaterwindow.cpp.

◆ keyPressed()

void UpdaterWindow::keyPressed ( gcn::KeyEvent &  keyEvent)
override

Definition at line 192 of file updaterwindow.cpp.

◆ loadNews()

void UpdaterWindow::loadNews ( )
private

Loads and display news.

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

Definition at line 227 of file updaterwindow.cpp.

◆ loadUpdates()

void UpdaterWindow::loadUpdates ( )
private

Loads the updates this window has gotten into the resource manager.

Definition at line 253 of file updaterwindow.cpp.

◆ logic()

void UpdaterWindow::logic ( )
override

Definition at line 272 of file updaterwindow.cpp.

◆ play()

void UpdaterWindow::play ( )
private

Definition at line 221 of file updaterwindow.cpp.

◆ setLabel()

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

Definition at line 171 of file updaterwindow.cpp.

◆ startDownload()

void UpdaterWindow::startDownload ( const std::string &  fileName,
bool  storeInMemory,
std::optional< unsigned long >  adler32 = {} 
)
private

Definition at line 235 of file updaterwindow.cpp.

Member Data Documentation

◆ mBrowserBox

BrowserBox* UpdaterWindow::mBrowserBox
private

Box to display news.

Definition at line 139 of file updaterwindow.h.

◆ mCancelButton

Button* UpdaterWindow::mCancelButton
private

Button to stop the update process.

Definition at line 136 of file updaterwindow.h.

◆ mCurrentFile

std::string UpdaterWindow::mCurrentFile
private

The file currently downloading.

Definition at line 121 of file updaterwindow.h.

◆ mDialogState

DialogState UpdaterWindow::mDialogState = DialogState::DownloadNews
private

Status of the current download.

Definition at line 112 of file updaterwindow.h.

◆ mDownload

std::unique_ptr<Net::Download> UpdaterWindow::mDownload
private

Download handle.

Definition at line 124 of file updaterwindow.h.

◆ mLabel

gcn::Label* UpdaterWindow::mLabel
private

Progress bar caption.

Definition at line 135 of file updaterwindow.h.

◆ mLinkHandler

std::unique_ptr<LinkHandler> UpdaterWindow::mLinkHandler
private

Definition at line 141 of file updaterwindow.h.

◆ mLoadUpdates

bool UpdaterWindow::mLoadUpdates
private

Tells ~UpdaterWindow() if it should load updates.

Definition at line 133 of file updaterwindow.h.

◆ mPlayButton

Button* UpdaterWindow::mPlayButton
private

Button to start playing.

Definition at line 137 of file updaterwindow.h.

◆ mProgressBar

ProgressBar* UpdaterWindow::mProgressBar
private

Update progress bar.

Definition at line 138 of file updaterwindow.h.

◆ mScrollArea

ScrollArea* UpdaterWindow::mScrollArea
private

Used to scroll news box.

Definition at line 140 of file updaterwindow.h.

◆ mUpdateFiles

std::vector<UpdateFile> UpdaterWindow::mUpdateFiles
private

List of files to download.

Definition at line 127 of file updaterwindow.h.

◆ mUpdateHost

std::string UpdaterWindow::mUpdateHost
private

Host where we get the updated files.

Definition at line 115 of file updaterwindow.h.

◆ mUpdateIndex

unsigned int UpdaterWindow::mUpdateIndex = 0
private

Index of the file to be downloaded.

Definition at line 130 of file updaterwindow.h.

◆ mUpdatesDir

std::string UpdaterWindow::mUpdatesDir
private

Place where the updates are stored (absolute path).

Definition at line 118 of file updaterwindow.h.


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