42#define RELATION_CHOICE_COLUMN 1
47#define NAME_COLUMN_WIDTH 230
48#define RELATION_CHOICE_COLUMN_WIDTH 80
50#define WIDGET_AT(row, column) (((row) * COLUMNS_NR) + column)
80 return gettext(RELATION_NAMES[i]);
133 gcn::Widget *widget =
new Label(name);
146 auto *choicebox =
static_cast<gcn::DropDown *
>(
150 choicebox->getSelected()));
200#define ACTION_DELETE "delete"
201#define ACTION_TABLE "table"
202#define ACTION_STRATEGY "strategy"
205 mShowGender(
config.showGender),
208 mPlayerTable(new
GuiTable(mPlayerTableModel)),
209 mPlayerTitleTable(new
GuiTable(mPlayerTableTitleModel)),
210 mPlayerScrollArea(new
ScrollArea(mPlayerTable)),
211 mDefaultTrading(new
CheckBox(
_(
"Allow trading"),
213 mDefaultWhisper(new
CheckBox(
_(
"Allow whispers"),
216 mWhisperTabCheckBox(new
CheckBox(
_(
"Put all whispers in tabs"),
config.whisperTab)),
217 mShowGenderCheckBox(new
CheckBox(
_(
"Show gender"),
config.showGender)),
218 mEnableChatLogCheckBox(new
CheckBox(
_(
"Enable Chat log"),
config.enableChatLog))
245 gcn::Label *ignore_action_label =
new Label(
_(
"When ignoring:"));
252 int ignoreStrategyIndex = 0;
257 ignoreStrategy->mShortName);
258 if (ignoreStrategyIndex < 0)
259 ignoreStrategyIndex = 0;
272 place(2, 5, ignore_action_label);
294 auto i = std::find(strategies.begin(), strategies.end(),
297 int selection = i == strategies.end() ? 0 : i - strategies.begin();
348 if (player_index < 0)
362 else if (event.getId() ==
"showgender")
LayoutCell & place(int x, int y, gcn::Widget *wg, int w=1, int h=1)
Adds a widget to the container and sets it at given cell.
A drop down box from which you can select different values.
A table, with rows and columns made out of sub-widgets.
void setOpaque(bool opaque)
Sets the table to be opaque, that is sets the table to display its background.
int getSelectedRow() const
void setLinewiseSelection(bool linewise)
Toggle whether to use linewise selection mode, in which the table selects an entire line at a time,...
Class for choosing one of the various ‘what to do when ignoring a player’ options.
std::string getElementAt(int i) override
int getNumberOfElements() override
~IgnoreChoicesListModel() override
LayoutCell & setPadding(int p)
Sets the padding around the cell content.
Ignore strategy: describes how we should handle ignores.
std::string getElementAt(int i) override
~PlayerRelationListModel() override
int getNumberOfElements() override
void store()
Save configuration to our config file.
std::vector< std::string > getPlayers() const
Retrieves a sorted vector of all players for which we have any relations recorded.
PlayerRelation getRelation(const std::string &name) const
Updates the relationship with this player.
unsigned int getDefault() const
Retrieves the default permissions.
void removeListener(PlayerRelationsListener *listener)
void addListener(PlayerRelationsListener *listener)
std::vector< PlayerIgnoreStrategy * > & getPlayerIgnoreStrategies()
Retrieves all known player ignore strategies.
void setDefault(unsigned int permissions)
Sets the default permissions.
PlayerIgnoreStrategy * getPlayerIgnoreStrategy() const
Return the current player ignore strategy.
int getPlayerIgnoreStrategyIndex(const std::string &shortName)
For a given ignore strategy short name, find the appropriate index in the ignore strategies vector.
void setPlayerIgnoreStrategy(PlayerIgnoreStrategy *strategy)
Sets the strategy to call when ignoring players.
void setRelation(const std::string &name, PlayerRelation relation)
Updates the relationship with this player.
void removePlayer(const std::string &name)
Deletes the information recorded for a player.
int getRowHeight() const override
Determines the height for each row.
int getColumns() const override
Determines the number of columns in each row.
std::vector< gcn::Widget * > mWidgets
gcn::Widget * getElementAt(int row, int column) const override
Retrieves the widget stored at the specified location within the table.
int getRows() const override
Determines the number of rows (lines) in the table.
~PlayerTableModel() override
virtual void updateModelInRow(int row)
const std::string & getPlayerAt(int index) const
void playerRelationsUpdated()
virtual void freeWidgets()
PlayerRelationListModel * mListModel
std::vector< std::string > mPlayers
int getColumnWidth(int index) const override
Determines the width of each individual column.
void setName(const std::string &name)
Sets the name displayed on the tab.
StaticTableModel * mPlayerTableTitleModel
PlayerTableModel * mPlayerTableModel
gcn::Button * mDeleteButton
gcn::DropDown * mIgnoreActionChoicesBox
gcn::CheckBox * mWhisperTabCheckBox
gcn::CheckBox * mEnableChatLogCheckBox
GuiTable * mPlayerTitleTable
void cancel() override
Called when the Cancel button is pressed in the setup window.
gcn::CheckBox * mDefaultWhisper
void action(const gcn::ActionEvent &event) override
gcn::CheckBox * mDefaultTrading
~Setup_Players() override
void playerRelationsUpdated() override
void apply() override
Called when the Apply button is pressed in the setup window.
gcn::CheckBox * mShowGenderCheckBox
gcn::ScrollArea * mPlayerScrollArea
gcn::ListModel * mIgnoreActionChoicesModel
virtual void set(int row, int column, gcn::Widget *widget)
Inserts a widget into the table model.
virtual void fixColumnWidth(int column, int width)
Fixes the column width for a given column; this overrides dynamic width inference.
A model for a regular table of widgets.
void signalAfterUpdate()
Tells all listeners that the table has seen an update.
void signalBeforeUpdate()
Tells all listeners that the table is about to see an update.
Config config
Global settings (config.xml)
void setConfigValue(T Config::*member, const T &value)
Sets the given Config member and sends a change event.
void delete_all(Container &c)
PlayerRelationsManager player_relations
constexpr unsigned int RELATIONS_NR
#define WIDGET_AT(row, column)
#define RELATION_CHOICE_COLUMN
#define NAME_COLUMN_WIDTH
#define RELATION_CHOICE_COLUMN_WIDTH