diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-28 20:06:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-28 20:06:11 +0300 |
commit | be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4 (patch) | |
tree | 30427f083bce1d1a67ab3ad17d33a87ee9b21565 /src | |
parent | 861c503c608b41256bca47dedee15dc01e09527d (diff) | |
download | mv-be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4.tar.gz mv-be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4.tar.bz2 mv-be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4.tar.xz mv-be9b998b2ee87c0238c2ed1b41c8c2bc723f4ce4.zip |
Fix formatting in gui files.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/models/langlistmodel.h | 62 | ||||
-rw-r--r-- | src/gui/models/tablemodel.h | 203 | ||||
-rw-r--r-- | src/gui/sdlinput.h | 116 | ||||
-rw-r--r-- | src/gui/widgets/avatarlistbox.h | 38 | ||||
-rw-r--r-- | src/gui/widgets/guitable.h | 213 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_relations.h | 44 | ||||
-rw-r--r-- | src/gui/windows/socialwindow.h | 162 | ||||
-rw-r--r-- | src/gui/windows/textdialog.h | 62 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.h | 292 | ||||
-rw-r--r-- | src/gui/windows/whoisonline.h | 169 |
10 files changed, 684 insertions, 677 deletions
diff --git a/src/gui/models/langlistmodel.h b/src/gui/models/langlistmodel.h index 124d86cf4..0404fc5ae 100644 --- a/src/gui/models/langlistmodel.h +++ b/src/gui/models/langlistmodel.h @@ -81,48 +81,48 @@ const Language LANG_NAME[langs_count] = class LangListModel final : public ExtendedListModel { -public: - LangListModel() - { - ResourceManager *const resman = ResourceManager::getInstance(); - for (int f = 0; f < langs_count; f ++) + public: + LangListModel() { - mIcons[f] = resman->getImage("graphics/flags/" - + LANG_NAME[f].icon); + ResourceManager *const resman = ResourceManager::getInstance(); + for (int f = 0; f < langs_count; f ++) + { + mIcons[f] = resman->getImage("graphics/flags/" + + LANG_NAME[f].icon); + } } - } - A_DELETE_COPY(LangListModel) + A_DELETE_COPY(LangListModel) - ~LangListModel() - { - for (int f = 0; f < langs_count; f ++) + ~LangListModel() { - Image *const img = mIcons[f]; - if (img) - img->decRef(); + for (int f = 0; f < langs_count; f ++) + { + Image *const img = mIcons[f]; + if (img) + img->decRef(); + } } - } - int getNumberOfElements() override final A_WARN_UNUSED - { return langs_count; } + int getNumberOfElements() override final A_WARN_UNUSED + { return langs_count; } - std::string getElementAt(int i) override final A_WARN_UNUSED - { - if (i >= getNumberOfElements() || i < 0) - return "???"; + std::string getElementAt(int i) override final A_WARN_UNUSED + { + if (i >= getNumberOfElements() || i < 0) + return "???"; - return gettext(LANG_NAME[i].name.c_str()); - } + return gettext(LANG_NAME[i].name.c_str()); + } - const Image *getImageAt(int i) override final A_WARN_UNUSED - { - if (i >= getNumberOfElements() || i < 0) - return nullptr; - return mIcons[i]; - } + const Image *getImageAt(int i) override final A_WARN_UNUSED + { + if (i >= getNumberOfElements() || i < 0) + return nullptr; + return mIcons[i]; + } - Image *mIcons[langs_count]; + Image *mIcons[langs_count]; }; #endif // GUI_MODELS_LANGLISTMODEL_H diff --git a/src/gui/models/tablemodel.h b/src/gui/models/tablemodel.h index 1f3f86af7..ca33a9390 100644 --- a/src/gui/models/tablemodel.h +++ b/src/gui/models/tablemodel.h @@ -37,111 +37,114 @@ class TableModelListener; */ class TableModel notfinal { -public: - virtual ~TableModel() - { } - - /** - * Determines the number of rows (lines) in the table - */ - virtual int getRows() const A_WARN_UNUSED = 0; - - /** - * Determines the number of columns in each row - */ - virtual int getColumns() const A_WARN_UNUSED = 0; - - /** - * Determines the height for each row - */ - virtual int getRowHeight() const A_WARN_UNUSED = 0; - - /** - * Determines the width of each individual column - */ - virtual int getColumnWidth(const int index) const A_WARN_UNUSED = 0; - - /** - * Retrieves the widget stored at the specified location within the table. - */ - virtual Widget *getElementAt(const int row, const int column) - const A_WARN_UNUSED = 0; - - virtual void installListener(TableModelListener *const listener); - - virtual void removeListener(TableModelListener *const listener); - -protected: - TableModel() : - listeners() - { - } - - /** - * Tells all listeners that the table is about to see an update - */ - virtual void signalBeforeUpdate(); - - /** - * Tells all listeners that the table has seen an update - */ - virtual void signalAfterUpdate(); - -private: - std::set<TableModelListener *> listeners; + public: + virtual ~TableModel() + { } + + /** + * Determines the number of rows (lines) in the table + */ + virtual int getRows() const A_WARN_UNUSED = 0; + + /** + * Determines the number of columns in each row + */ + virtual int getColumns() const A_WARN_UNUSED = 0; + + /** + * Determines the height for each row + */ + virtual int getRowHeight() const A_WARN_UNUSED = 0; + + /** + * Determines the width of each individual column + */ + virtual int getColumnWidth(const int index) const A_WARN_UNUSED = 0; + + /** + * Retrieves the widget stored at the specified location + * within the table. + */ + virtual Widget *getElementAt(const int row, const int column) + const A_WARN_UNUSED = 0; + + virtual void installListener(TableModelListener *const listener); + + virtual void removeListener(TableModelListener *const listener); + + protected: + TableModel() : + listeners() + { + } + + /** + * Tells all listeners that the table is about to see an update + */ + virtual void signalBeforeUpdate(); + + /** + * Tells all listeners that the table has seen an update + */ + virtual void signalAfterUpdate(); + + private: + std::set<TableModelListener *> listeners; }; class StaticTableModel final : public TableModel { -public: - StaticTableModel(const int width, const int height); - - A_DELETE_COPY(StaticTableModel) - - ~StaticTableModel(); - - /** - * Inserts a widget into the table model. - * The model is resized to accomodate the widget's width and height, - * unless column width / row height have been fixed. - */ - void set(const int row, const int column, Widget *const widget); - - /** - * Fixes the column width for a given column; this overrides dynamic width - * inference. - * - * Semantics are undefined for width 0. - */ - void fixColumnWidth(const int column, const int width); - - /** - * Fixes the row height; this overrides dynamic height inference. - * - * Semantics are undefined for width 0. - */ - void fixRowHeight(const int height); - - /** - * Resizes the table model - */ - void resize(); - - int getRows() const override final A_WARN_UNUSED; - int getColumns() const override final A_WARN_UNUSED; - int getRowHeight() const override final A_WARN_UNUSED; - int getWidth() const A_WARN_UNUSED; - int getHeight() const A_WARN_UNUSED; - int getColumnWidth(const int index) const override final A_WARN_UNUSED; - Widget *getElementAt(const int row, - const int column) const override final A_WARN_UNUSED; - -protected: - int mRows, mColumns; - int mHeight; - std::vector<Widget *> mTableModel; - std::vector<int> mWidths; + public: + StaticTableModel(const int width, const int height); + + A_DELETE_COPY(StaticTableModel) + + ~StaticTableModel(); + + /** + * Inserts a widget into the table model. + * The model is resized to accomodate the widget's width and height, + * unless column width / row height have been fixed. + */ + void set(const int row, const int column, Widget *const widget); + + /** + * Fixes the column width for a given column; this overrides dynamic + * width inference. + * + * Semantics are undefined for width 0. + */ + void fixColumnWidth(const int column, const int width); + + /** + * Fixes the row height; this overrides dynamic height inference. + * + * Semantics are undefined for width 0. + */ + void fixRowHeight(const int height); + + /** + * Resizes the table model + */ + void resize(); + + int getRows() const override final A_WARN_UNUSED; + int getColumns() const override final A_WARN_UNUSED; + int getRowHeight() const override final A_WARN_UNUSED; + int getWidth() const A_WARN_UNUSED; + int getHeight() const A_WARN_UNUSED; + int getColumnWidth(const int index) const override final A_WARN_UNUSED; + Widget *getElementAt(const int row, + const int column) const override final + A_WARN_UNUSED; + + protected: + int mRows; + int mColumns; + int mHeight; + std::vector<Widget *> mTableModel; + std::vector<int> mWidths; }; #endif // GUI_MODELS_TABLEMODEL_H diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index eddfe65a1..54965ab89 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -91,65 +91,63 @@ */ class SDLInput final { -public: - /** - * Constructor. - */ - SDLInput(); - - A_DELETE_COPY(SDLInput) - - /** - * Pushes an SDL event. It should be called at least once per frame to - * update input with user input. - * - * @param event an event from SDL. - */ - void pushInput(const SDL_Event &event); - - KeyInput dequeueKeyInput() A_WARN_UNUSED; - - // Inherited from SDLInput - - bool isKeyQueueEmpty() const A_WARN_UNUSED - { return mKeyInputQueue.empty(); } - - bool isMouseQueueEmpty() const A_WARN_UNUSED - { return mMouseInputQueue.empty(); } - - MouseInput dequeueMouseInput() A_WARN_UNUSED; - - void simulateMouseClick(const int x, const int y, - const MouseButton::Type button); - -protected: - /** - * Converts a mouse button from SDL to a Guichan mouse button - * representation. - * - * @param button an SDL mouse button. - * @return a Guichan mouse button. - */ - static MouseButton::Type convertMouseButton(const int button) - A_WARN_UNUSED; - - /** - * Converts an SDL event key to a key value. - * - * @param event an SDL event with a key to convert. - * @return a key value. - * @see Key - */ - static int convertKeyCharacter(const SDL_Event &event) A_WARN_UNUSED; - - static void convertKeyEventToKey(const SDL_Event &event, - KeyInput &keyInput); - - std::queue<KeyInput> mKeyInputQueue; - std::queue<MouseInput> mMouseInputQueue; - - bool mMouseDown; - bool mMouseInWindow; + public: + /** + * Constructor. + */ + SDLInput(); + + A_DELETE_COPY(SDLInput) + + /** + * Pushes an SDL event. It should be called at least once per frame to + * update input with user input. + * + * @param event an event from SDL. + */ + void pushInput(const SDL_Event &event); + + KeyInput dequeueKeyInput() A_WARN_UNUSED; + + bool isKeyQueueEmpty() const A_WARN_UNUSED + { return mKeyInputQueue.empty(); } + + bool isMouseQueueEmpty() const A_WARN_UNUSED + { return mMouseInputQueue.empty(); } + + MouseInput dequeueMouseInput() A_WARN_UNUSED; + + void simulateMouseClick(const int x, const int y, + const MouseButton::Type button); + + protected: + /** + * Converts a mouse button from SDL to a Guichan mouse button + * representation. + * + * @param button an SDL mouse button. + * @return a Guichan mouse button. + */ + static MouseButton::Type convertMouseButton(const int button) + A_WARN_UNUSED; + + /** + * Converts an SDL event key to a key value. + * + * @param event an SDL event with a key to convert. + * @return a key value. + * @see Key + */ + static int convertKeyCharacter(const SDL_Event &event) A_WARN_UNUSED; + + static void convertKeyEventToKey(const SDL_Event &event, + KeyInput &keyInput); + + std::queue<KeyInput> mKeyInputQueue; + std::queue<MouseInput> mMouseInputQueue; + + bool mMouseDown; + bool mMouseInWindow; }; #endif // GUI_SDLINPUT_H diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index e0711a7b7..0ae0b5ee9 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -34,33 +34,33 @@ class Image; class AvatarListBox final : public ListBox, public ConfigListener { -public: - AvatarListBox(const Widget2 *const widget, - AvatarListModel *const model); + public: + AvatarListBox(const Widget2 *const widget, + AvatarListModel *const model); - A_DELETE_COPY(AvatarListBox) + A_DELETE_COPY(AvatarListBox) - ~AvatarListBox(); + ~AvatarListBox(); - /** - * Draws the list box. - */ - void draw(Graphics *gcnGraphics) override final; + /** + * Draws the list box. + */ + void draw(Graphics *gcnGraphics) override final; - void mousePressed(MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; - void mouseReleased(MouseEvent &event A_UNUSED) override final; + void mouseReleased(MouseEvent &event A_UNUSED) override final; - void optionChanged(const std::string &value) override final; + void optionChanged(const std::string &value) override final; -private: - int mImagePadding; - bool mShowGender; - bool mShowLevel; + private: + int mImagePadding; + bool mShowGender; + bool mShowLevel; - static int instances; - static Image *onlineIcon; - static Image *offlineIcon; + static int instances; + static Image *onlineIcon; + static Image *offlineIcon; }; #endif // GUI_WIDGETS_AVATARLISTBOX_H diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 4f4e2cfa3..d0deb9ba0 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -53,150 +53,153 @@ class GuiTable final : public Widget, // so that the action listener can call distributeActionEvent friend class GuiTableActionListener; -public: - GuiTable(const Widget2 *const widget, - TableModel *const initial_model, - const bool opacity = true); + public: + GuiTable(const Widget2 *const widget, + TableModel *const initial_model, + const bool opacity = true); - A_DELETE_COPY(GuiTable) + A_DELETE_COPY(GuiTable) - ~GuiTable(); + ~GuiTable(); - /** - * Retrieves the active table model - */ - const TableModel *getModel() const A_WARN_UNUSED; + /** + * Retrieves the active table model + */ + const TableModel *getModel() const A_WARN_UNUSED; - /** - * Sets the table model - * - * Note that actions issued by widgets returned from the model will update - * the table selection, but only AFTER any event handlers installed within - * the widget have been triggered. To be notified after such an update, add - * an action listener to the table instead. - */ - void setModel(TableModel *const m); + /** + * Sets the table model + * + * Note that actions issued by widgets returned from the model will + * update the table selection, but only AFTER any event handlers + * installed within the widget have been triggered. To be notified + * after such an update, add an action listener to the table instead. + */ + void setModel(TableModel *const m); - void setSelected(const int row, const int column); + void setSelected(const int row, const int column); - int getSelectedRow() const A_WARN_UNUSED; + int getSelectedRow() const A_WARN_UNUSED; - int getSelectedColumn() const A_WARN_UNUSED; + int getSelectedColumn() const A_WARN_UNUSED; - void setSelectedRow(const int selected); + void setSelectedRow(const int selected); - void setSelectedColumn(const int selected); + void setSelectedColumn(const int selected); - bool isWrappingEnabled() const A_WARN_UNUSED - { return mWrappingEnabled; } + bool isWrappingEnabled() const A_WARN_UNUSED + { return mWrappingEnabled; } - void setWrappingEnabled(bool wrappingEnabled) - { mWrappingEnabled = wrappingEnabled; } + void setWrappingEnabled(bool wrappingEnabled) + { mWrappingEnabled = wrappingEnabled; } - Rect getChildrenArea() override final A_WARN_UNUSED; + Rect getChildrenArea() override final A_WARN_UNUSED; - /** - * Toggle whether to use linewise selection mode, in which the table selects - * an entire line at a time, rather than a single cell. - * - * Note that column information is tracked even in linewise selection mode; - * this mode therefore only affects visualisation. - * - * Disabled by default. - * - * \param linewise: Whether to enable linewise selection mode - */ - void setLinewiseSelection(bool linewise) - { - mLinewiseMode = linewise; - } + /** + * Toggle whether to use linewise selection mode, in which the table + * selects an entire line at a time, rather than a single cell. + * + * Note that column information is tracked even in linewise selection + * mode; + * + * this mode therefore only affects visualisation. + * + * Disabled by default. + * + * \param linewise: Whether to enable linewise selection mode + */ + void setLinewiseSelection(bool linewise) + { mLinewiseMode = linewise;} - // Inherited from Widget - void draw(Graphics* graphics) override final; + // Inherited from Widget + void draw(Graphics* graphics) override final; - Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED; + Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED; - void moveToTop(Widget *child) override final; + void moveToTop(Widget *child) override final; - void moveToBottom(Widget *child) override final; + void moveToBottom(Widget *child) override final; - void setFocusHandler(FocusHandler *const focusHandler) override final; + void setFocusHandler(FocusHandler *const focusHandler) override final; - // Inherited from KeyListener - void keyPressed(KeyEvent& event) override final; + // Inherited from KeyListener + void keyPressed(KeyEvent& event) override final; - /** - * Sets the table to be opaque, that is sets the table - * to display its background. - * - * @param opaque True if the table should be opaque, false otherwise. - */ - void setOpaque(bool opaque) - { mOpaque = opaque; } + /** + * Sets the table to be opaque, that is sets the table + * to display its background. + * + * @param opaque True if the table should be opaque, false otherwise. + */ + void setOpaque(bool opaque) + { mOpaque = opaque; } - /** - * Checks if the table is opaque, that is if the table area displays its - * background. - * - * @return True if the table is opaque, false otherwise. - */ - bool isOpaque() const A_WARN_UNUSED - { return mOpaque; } + /** + * Checks if the table is opaque, that is if the table area displays + * its background. + * + * @return True if the table is opaque, false otherwise. + */ + bool isOpaque() const A_WARN_UNUSED + { return mOpaque; } - // Inherited from MouseListener - void mousePressed(MouseEvent& event) override final; + // Inherited from MouseListener + void mousePressed(MouseEvent& event) override final; - void mouseWheelMovedUp(MouseEvent& event) override final; + void mouseWheelMovedUp(MouseEvent& event) override final; - void mouseWheelMovedDown(MouseEvent& event) override final; + void mouseWheelMovedDown(MouseEvent& event) override final; - void mouseDragged(MouseEvent& event) override final; + void mouseDragged(MouseEvent& event) override final; - // Constraints inherited from TableModelListener - void modelUpdated(const bool completed) override final; + // Constraints inherited from TableModelListener + void modelUpdated(const bool completed) override final; - void requestFocus(); + void requestFocus(); - void setSelectable(bool b) - { mSelectable = b; } + void setSelectable(bool b) + { mSelectable = b; } -protected: - /** Frees all action listeners on inner widgets. */ - void uninstallActionListeners(); - /** Installs all action listeners on inner widgets. */ - void installActionListeners(); + protected: + /** Frees all action listeners on inner widgets. */ + void uninstallActionListeners(); - int getRowHeight() const A_WARN_UNUSED; + /** Installs all action listeners on inner widgets. */ + void installActionListeners(); - int getColumnWidth(const int i) const A_WARN_UNUSED; + int getRowHeight() const A_WARN_UNUSED; -private: - int getRowForY(int y) const A_WARN_UNUSED; // -1 on error - int getColumnForX(int x) const A_WARN_UNUSED; // -1 on error - void recomputeDimensions(); + int getColumnWidth(const int i) const A_WARN_UNUSED; - static float mAlpha; + private: + int getRowForY(int y) const A_WARN_UNUSED; // -1 on error - TableModel *mModel; + int getColumnForX(int x) const A_WARN_UNUSED; // -1 on error - /** If someone moves a fresh widget to the top, we must display it. */ - Widget *mTopWidget; + void recomputeDimensions(); - /** Vector for compactness; used as a list in practice. */ - std::vector<GuiTableActionListener *> mActionListeners2; + static float mAlpha; - /** - * Holds the background color of the table. - */ - Color mHighlightColor; + TableModel *mModel; - int mSelectedRow; - int mSelectedColumn; + /** If someone moves a fresh widget to the top, we must display it. */ + Widget *mTopWidget; - bool mLinewiseMode; - bool mWrappingEnabled; - bool mOpaque; - bool mSelectable; + /** Vector for compactness; used as a list in practice. */ + std::vector<GuiTableActionListener *> mActionListeners2; + + /** + * Holds the background color of the table. + */ + Color mHighlightColor; + + int mSelectedRow; + int mSelectedColumn; + + bool mLinewiseMode; + bool mWrappingEnabled; + bool mOpaque; + bool mSelectable; }; #endif // GUI_WIDGETS_GUITABLE_H diff --git a/src/gui/widgets/tabs/setup_relations.h b/src/gui/widgets/tabs/setup_relations.h index 9fc197ffc..7d133f9c9 100644 --- a/src/gui/widgets/tabs/setup_relations.h +++ b/src/gui/widgets/tabs/setup_relations.h @@ -41,41 +41,41 @@ class StaticTableModel; class Setup_Relations final : public SetupTab, public PlayerRelationsListener { -public: - explicit Setup_Relations(const Widget2 *const widget); + public: + explicit Setup_Relations(const Widget2 *const widget); - A_DELETE_COPY(Setup_Relations) + A_DELETE_COPY(Setup_Relations) - ~Setup_Relations(); + ~Setup_Relations(); - void apply() override final; + void apply() override final; - void cancel() override final; + void cancel() override final; - void reset(); + void reset(); - void action(const ActionEvent &event) override final; + void action(const ActionEvent &event) override final; - void updatedPlayer(const std::string &name); + void updatedPlayer(const std::string &name); - void updateAll(); + void updateAll(); - void externalUpdated() override final; + void externalUpdated() override final; -private: - StaticTableModel *mPlayerTableTitleModel; - PlayerTableModel *mPlayerTableModel; - GuiTable *mPlayerTable; - GuiTable *mPlayerTitleTable; - ScrollArea *mPlayerScrollArea; + private: + StaticTableModel *mPlayerTableTitleModel; + PlayerTableModel *mPlayerTableModel; + GuiTable *mPlayerTable; + GuiTable *mPlayerTitleTable; + ScrollArea *mPlayerScrollArea; - CheckBox *mDefaultTrading; - CheckBox *mDefaultWhisper; + CheckBox *mDefaultTrading; + CheckBox *mDefaultWhisper; - Button *mDeleteButton; + Button *mDeleteButton; - ListModel *mIgnoreActionChoicesModel; - DropDown *mIgnoreActionChoicesBox; + ListModel *mIgnoreActionChoicesModel; + DropDown *mIgnoreActionChoicesBox; }; #endif // GUI_WIDGETS_TABS_SETUP_RELATIONS_H diff --git a/src/gui/windows/socialwindow.h b/src/gui/windows/socialwindow.h index 6ce903a5a..80cc38b0e 100644 --- a/src/gui/windows/socialwindow.h +++ b/src/gui/windows/socialwindow.h @@ -50,127 +50,127 @@ class SocialWindow final : public Window, private ActionListener, public PlayerRelationsListener { -public: - SocialWindow(); + public: + SocialWindow(); - A_DELETE_COPY(SocialWindow) + A_DELETE_COPY(SocialWindow) - ~SocialWindow(); + ~SocialWindow(); - void postInit() override final; + void postInit() override final; - bool addTab(Guild *const guild); + bool addTab(Guild *const guild); - bool removeTab(Guild *const guild); + bool removeTab(Guild *const guild); - bool addTab(Party *const party); + bool addTab(Party *const party); - bool removeTab(Party *const party); + bool removeTab(Party *const party); - void action(const ActionEvent &event) override final; + void action(const ActionEvent &event) override final; - void showGuildInvite(const std::string &restrict guildName, - const int guildId, - const std::string &restrict inviterName); + void showGuildInvite(const std::string &restrict guildName, + const int guildId, + const std::string &restrict inviterName); - void showGuildCreate(); + void showGuildCreate(); - void showPartyInvite(const std::string &restrict partyName, - const std::string &restrict inviter = ""); + void showPartyInvite(const std::string &restrict partyName, + const std::string &restrict inviter = ""); - void showPartyCreate(); + void showPartyCreate(); - void updateActiveList(); + void updateActiveList(); - void updateAvatar(const std::string &name); + void updateAvatar(const std::string &name); - void resetDamage(const std::string &name); + void resetDamage(const std::string &name); - void slowLogic(); + void slowLogic(); - void updatePortals(); + void updatePortals(); - void updatePortalNames(); + void updatePortalNames(); - void updateParty(); + void updateParty(); - int getPortalIndex(const int x, const int y) A_WARN_UNUSED; + int getPortalIndex(const int x, const int y) A_WARN_UNUSED; - void addPortal(const int x, const int y); + void addPortal(const int x, const int y); - void removePortal(const int x, const int y); + void removePortal(const int x, const int y); - void nextTab(); + void nextTab(); - void prevTab(); + void prevTab(); - const Map* getMap() const A_WARN_UNUSED - { return mMap; } + const Map* getMap() const A_WARN_UNUSED + { return mMap; } - void setMap(Map *const map) - { mMap = map; mProcessedPortals = false; } + void setMap(Map *const map) + { mMap = map; mProcessedPortals = false; } - bool getProcessedPortals() const A_WARN_UNUSED - { return mProcessedPortals; } + bool getProcessedPortals() const A_WARN_UNUSED + { return mProcessedPortals; } - void setProcessedPortals(const bool n) - { mProcessedPortals = n; } + void setProcessedPortals(const bool n) + { mProcessedPortals = n; } - void selectPortal(const unsigned num); + void selectPortal(const unsigned num); - void updateAttackFilter(); + void updateAttackFilter(); - void updatePickupFilter(); + void updatePickupFilter(); - void widgetResized(const Event &event) override final; + void widgetResized(const Event &event) override final; - void setCounter(const SocialTab *const tab, const std::string &str); + void setCounter(const SocialTab *const tab, const std::string &str); - void updateGuildCounter(const int online = 0, const int total = 0); + void updateGuildCounter(const int online = 0, const int total = 0); - void updatedPlayer(const std::string &name); + void updatedPlayer(const std::string &name); - void updateAll(); + void updateAll(); #ifdef USE_PROFILER - void logicChildren(); + void logicChildren(); #endif -protected: - friend class SocialTab; - typedef std::map<Guild*, SocialTab*> GuildMap; - typedef std::map<Party*, SocialTab*> PartyMap; - - void updateButtons(); - - int mGuildInvited; - ConfirmDialog *mGuildAcceptDialog; - TextDialog *mGuildCreateDialog; - std::string mPartyInviter; - GuildMap mGuilds; - PartyMap mParties; - - ConfirmDialog *mPartyAcceptDialog; - TextDialog *mPartyCreateDialog; - - SocialTab *mAttackFilter; - SocialTab *mPickupFilter; - SocialTab *mPlayers; - SocialTab *mNavigation; - SocialTab *mFriends; - - CreatePartyPopup *mCreatePopup; - - Button *mCreateButton; - Button *mInviteButton; - Button *mLeaveButton; - Label *mCountLabel; - TabbedArea *mTabs; - Map *mMap; - - int mLastUpdateTime; - bool mNeedUpdate; - bool mProcessedPortals; + protected: + friend class SocialTab; + typedef std::map<Guild*, SocialTab*> GuildMap; + typedef std::map<Party*, SocialTab*> PartyMap; + + void updateButtons(); + + int mGuildInvited; + ConfirmDialog *mGuildAcceptDialog; + TextDialog *mGuildCreateDialog; + std::string mPartyInviter; + GuildMap mGuilds; + PartyMap mParties; + + ConfirmDialog *mPartyAcceptDialog; + TextDialog *mPartyCreateDialog; + + SocialTab *mAttackFilter; + SocialTab *mPickupFilter; + SocialTab *mPlayers; + SocialTab *mNavigation; + SocialTab *mFriends; + + CreatePartyPopup *mCreatePopup; + + Button *mCreateButton; + Button *mInviteButton; + Button *mLeaveButton; + Label *mCountLabel; + TabbedArea *mTabs; + Map *mMap; + + int mLastUpdateTime; + bool mNeedUpdate; + bool mProcessedPortals; }; extern SocialWindow *socialWindow; diff --git a/src/gui/windows/textdialog.h b/src/gui/windows/textdialog.h index 8e69e8a3d..f1dc70792 100644 --- a/src/gui/windows/textdialog.h +++ b/src/gui/windows/textdialog.h @@ -39,47 +39,47 @@ class TextField; class TextDialog final : public Window, public ActionListener { -public: - /** - * Constructor. - * - * @see Window::Window - */ - TextDialog(const std::string &restrict title, - const std::string &restrict msg, - Window *const parent = nullptr, - const bool isPassword = false); + public: + /** + * Constructor. + * + * @see Window::Window + */ + TextDialog(const std::string &restrict title, + const std::string &restrict msg, + Window *const parent = nullptr, + const bool isPassword = false); - A_DELETE_COPY(TextDialog) + A_DELETE_COPY(TextDialog) - ~TextDialog(); + ~TextDialog(); - void postInit() override final; + void postInit() override final; - /** - * Called when receiving actions from the widgets. - */ - void action(const ActionEvent &event) override final; + /** + * Called when receiving actions from the widgets. + */ + void action(const ActionEvent &event) override final; - /** - * Get the text in the textfield - */ - const std::string &getText() const A_WARN_UNUSED; + /** + * Get the text in the textfield + */ + const std::string &getText() const A_WARN_UNUSED; - void setText(const std::string &text); + void setText(const std::string &text); - static bool isActive() A_WARN_UNUSED - { return instances; } + static bool isActive() A_WARN_UNUSED + { return instances; } - void close() override final; + void close() override final; -private: - static int instances; + private: + static int instances; - TextField *mTextField; - PasswordField *mPasswordField; - Button *mOkButton; - bool mEnabledKeyboard; + TextField *mTextField; + PasswordField *mPasswordField; + Button *mOkButton; + bool mEnabledKeyboard; }; #endif // GUI_WINDOWS_TEXTDIALOG_H 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; diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h index 6e49308d4..504013712 100644 --- a/src/gui/windows/whoisonline.h +++ b/src/gui/windows/whoisonline.h @@ -49,124 +49,125 @@ class WhoIsOnline final : public Window, public ActionListener, public ConfigListener { -public: - /** - * Constructor. - */ - WhoIsOnline(); + public: + /** + * Constructor. + */ + WhoIsOnline(); - A_DELETE_COPY(WhoIsOnline) + A_DELETE_COPY(WhoIsOnline) - /** - * Destructor - */ - ~WhoIsOnline(); + /** + * Destructor + */ + ~WhoIsOnline(); - void postInit() override final; + void postInit() override final; - /** - * Loads and display online list from the memory buffer. - */ - void loadWebList(); + /** + * Loads and display online list from the memory buffer. + */ + void loadWebList(); - void loadList(const std::vector<OnlinePlayer*> &list); + void loadList(const std::vector<OnlinePlayer*> &list); - void handleLink(const std::string& link, - MouseEvent *event) override final; + void handleLink(const std::string& link, + MouseEvent *event) override final; - void logic() override final; + void logic() override final; - void slowLogic(); + void slowLogic(); - void action(const ActionEvent &event) override final; + void action(const ActionEvent &event) override final; - void widgetResized(const Event &event) override final; + void widgetResized(const Event &event) override final; - const std::set<OnlinePlayer*> &getOnlinePlayers() const A_WARN_UNUSED - { return mOnlinePlayers; } + const std::set<OnlinePlayer*> &getOnlinePlayers() const A_WARN_UNUSED + { return mOnlinePlayers; } - const std::set<std::string> &getOnlineNicks() const A_WARN_UNUSED - { return mOnlineNicks; } + const std::set<std::string> &getOnlineNicks() const A_WARN_UNUSED + { return mOnlineNicks; } - void setAllowUpdate(const bool n) - { mAllowUpdate = n; } + void setAllowUpdate(const bool n) + { mAllowUpdate = n; } - void optionChanged(const std::string &name) override final; + void optionChanged(const std::string &name) override final; - void updateList(StringVect &list); + void updateList(StringVect &list); - void readFromWeb(); + void readFromWeb(); - static void setNeutralColor(OnlinePlayer *const player); + static void setNeutralColor(OnlinePlayer *const player); - void getPlayerNames(StringVect &names); + void getPlayerNames(StringVect &names); -private: - void download(); + private: + void download(); - void updateSize(); + void updateSize(); - void handlerPlayerRelation(const std::string &nick, - OnlinePlayer *const player); - /** - * The thread function that download the files. - */ - static int downloadThread(void *ptr); + void handlerPlayerRelation(const std::string &nick, + OnlinePlayer *const player); + /** + * The thread function that download the files. + */ + static int downloadThread(void *ptr); - /** - * A libcurl callback for writing to memory. - */ - static size_t memoryWrite(void *ptr, size_t size, size_t nmemb, - FILE *stream); + /** + * A libcurl callback for writing to memory. + */ + static size_t memoryWrite(void *ptr, size_t size, + size_t nmemb, + FILE *stream); - const std::string prepareNick(const std::string &restrict nick, - const int level, - const std::string &restrict color) - const A_WARN_UNUSED; + const std::string prepareNick(const std::string &restrict nick, + const int level, + const std::string &restrict color) + const A_WARN_UNUSED; - void updateWindow(size_t numOnline); + void updateWindow(size_t numOnline); - enum DownloadStatus - { - UPDATE_ERROR = 0, - UPDATE_COMPLETE, - UPDATE_LIST - }; + enum DownloadStatus + { + UPDATE_ERROR = 0, + UPDATE_COMPLETE, + UPDATE_LIST + }; - int mUpdateTimer; + int mUpdateTimer; - /** A thread that use libcurl to download updates. */ - SDL_Thread *mThread; + /** A thread that use libcurl to download updates. */ + SDL_Thread *mThread; - /** Buffer for files downloaded to memory. */ - char *mMemoryBuffer; + /** Buffer for files downloaded to memory. */ + char *mMemoryBuffer; - /** Buffer to handler human readable error provided by curl. */ - char *mCurlError; + /** Buffer to handler human readable error provided by curl. */ + char *mCurlError; - BrowserBox *mBrowserBox; - ScrollArea *mScrollArea; - std::set<OnlinePlayer*> mOnlinePlayers; - std::set<std::string> mOnlineNicks; + BrowserBox *mBrowserBox; + ScrollArea *mScrollArea; + std::set<OnlinePlayer*> mOnlinePlayers; + std::set<std::string> mOnlineNicks; - Button *mUpdateButton; - std::vector<OnlinePlayer*> mFriends; - std::vector<OnlinePlayer*> mNeutral; - std::vector<OnlinePlayer*> mDisregard; - std::vector<OnlinePlayer*> mEnemy; + Button *mUpdateButton; + std::vector<OnlinePlayer*> mFriends; + std::vector<OnlinePlayer*> mNeutral; + std::vector<OnlinePlayer*> mDisregard; + std::vector<OnlinePlayer*> mEnemy; - /** Byte count currently downloaded in mMemoryBuffer. */ - int mDownloadedBytes; + /** Byte count currently downloaded in mMemoryBuffer. */ + int mDownloadedBytes; - /** Status of the current download. */ - DownloadStatus mDownloadStatus; + /** Status of the current download. */ + DownloadStatus mDownloadStatus; - /** Flag that show if current download is complete. */ - bool mDownloadComplete; - bool mAllowUpdate; - bool mShowLevel; - bool mUpdateOnlineList; - bool mGroupFriends; + /** Flag that show if current download is complete. */ + bool mDownloadComplete; + bool mAllowUpdate; + bool mShowLevel; + bool mUpdateOnlineList; + bool mGroupFriends; }; extern WhoIsOnline *whoIsOnline; |