summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-07-03 17:23:05 +0300
committerAndrei Karas <akaras@inbox.ru>2011-07-03 17:23:05 +0300
commitd5eb424dcd214b4646a960e04b9271e70b096856 (patch)
treef36891e6406861ab0d4a82d233545e3f33a46ab4 /src
parent634149ac7d248d2e078ee9707379a5056d31077e (diff)
downloadmanaverse-d5eb424dcd214b4646a960e04b9271e70b096856.tar.gz
manaverse-d5eb424dcd214b4646a960e04b9271e70b096856.tar.bz2
manaverse-d5eb424dcd214b4646a960e04b9271e70b096856.tar.xz
manaverse-d5eb424dcd214b4646a960e04b9271e70b096856.zip
Add separator field to setup settings tabs.
Diffstat (limited to 'src')
-rw-r--r--src/gui/setup_chat.cpp44
-rw-r--r--src/gui/setup_other.cpp114
-rw-r--r--src/gui/setupitem.cpp54
-rw-r--r--src/gui/setupitem.h26
-rw-r--r--src/gui/widgets/setuptabscroll.cpp16
5 files changed, 188 insertions, 66 deletions
diff --git a/src/gui/setup_chat.cpp b/src/gui/setup_chat.cpp
index 87425b46c..7db61542a 100644
--- a/src/gui/setup_chat.cpp
+++ b/src/gui/setup_chat.cpp
@@ -52,38 +52,55 @@ Setup_Chat::Setup_Chat()
ContainerPlacer place = h.getPlacer(0, 0);
place(0, 0, mScroll, 10, 10);
+ new SetupItemLabel(_("Colors"), "", this);
+
new SetupItemCheckBox(_("Remove colors from received chat messages"), "",
"removeColors", this, "removeColorsEvent");
- new SetupItemCheckBox(_("Log magic messages in debug tab"), "",
- "showMagicInDebug", this, "showMagicInDebugEvent");
+ new SetupItemCheckBox(_("Show chat colors list"), "",
+ "showChatColorsList", this, "showChatColorsListEvent");
+
+
+ new SetupItemLabel(_("Commands"), "", this);
new SetupItemCheckBox(_("Allow magic and GM commands in all chat tabs"),
"", "allowCommandsInChatTabs", this, "allowCommandsInChatTabsEvent");
- new SetupItemCheckBox(_("Show server messages in debug tab"), "",
- "serverMsgInDebug", this, "serverMsgInDebugEvent");
- new SetupItemCheckBox(_("Show chat colors list"), "",
- "showChatColorsList", this, "showChatColorsListEvent");
+ new SetupItemLabel(_("Limits"), "", this);
new SetupItemIntTextField(_("Limit max chars in chat line"), "",
"chatMaxCharLimit", this, "chatMaxCharLimitEvent", 0, 500);
+ new SetupItemIntTextField(_("Limit max lines in chat"), "",
+ "chatMaxLinesLimit", this, "chatMaxLinesLimitEvent", 0, 500);
+
+
+ new SetupItemLabel(_("Logs"), "", this);
+
new SetupItemCheckBox(_("Enable chat Log"), "",
"enableChatLog", this, "enableChatLogEvent");
- new SetupItemIntTextField(_("Limit max lines in chat"), "",
- "chatMaxLinesLimit", this, "chatMaxLinesLimitEvent", 0, 500);
+ new SetupItemCheckBox(_("Show chat history"), "",
+ "showChatHistory", this, "showChatHistoryEvent");
- new SetupItemCheckBox(_("Enable trade tab"), "",
- "enableTradeTab", this, "enableTradeTabEvent");
+
+ new SetupItemLabel(_("Messages"), "", this);
new SetupItemCheckBox(_("Hide shop messages"), "",
"hideShopMessages", this, "hideShopMessagesEvent");
- new SetupItemCheckBox(_("Show chat history"), "",
- "showChatHistory", this, "showChatHistoryEvent");
+
+ new SetupItemLabel(_("Tabs"), "", this);
+
+ new SetupItemCheckBox(_("Log magic messages in debug tab"), "",
+ "showMagicInDebug", this, "showMagicInDebugEvent");
+
+ new SetupItemCheckBox(_("Show server messages in debug tab"), "",
+ "serverMsgInDebug", this, "serverMsgInDebugEvent");
+
+ new SetupItemCheckBox(_("Enable trade tab"), "",
+ "enableTradeTab", this, "enableTradeTabEvent");
new SetupItemCheckBox(_("Enable battle tab"), "",
"enableBattleTab", this, "enableBattleTabEvent");
@@ -94,6 +111,9 @@ Setup_Chat::Setup_Chat()
new SetupItemCheckBox(_("Resize chat tabs if need"), "",
"hideChatInput", this, "hideChatInputEvent");
+
+ new SetupItemLabel(_("Time"), "", this);
+
new SetupItemCheckBox(_("Use local time"), "",
"useLocalTime", this, "useLocalTimeEvent");
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index 1f5b254a1..0cad07bc1 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -43,100 +43,119 @@ Setup_Other::Setup_Other()
ContainerPlacer place = h.getPlacer(0, 0);
place(0, 0, mScroll, 10, 10);
+ new SetupItemLabel(_("Monsters"), "", this);
+
new SetupItemCheckBox(_("Show damage inflicted to monsters"), "",
"showMonstersTakedDamage", this, "showMonstersTakedDamageEvent");
- new SetupItemCheckBox(_("Enable server side attack"), "",
- "serverAttack", this, "serverAttackEvent");
-
new SetupItemCheckBox(_("Auto target only reachable monsters"), "",
"targetOnlyReachable", this, "targetOnlyReachableEvent");
- new SetupItemCheckBox(_("Auto fix position"), "",
- "autofixPos", this, "autofixPosEvent");
+ new SetupItemCheckBox(_("Highlight monster attack range"), "",
+ "highlightMonsterAttackRange", this,
+ "highlightMonsterAttackRangeEvent");
+
+ new SetupItemCheckBox(_("Show monster hp bar"), "",
+ "showMobHP", this, "showMobHPEvent");
+
+ new SetupItemCheckBox(_("Cycle monster targets"), "",
+ "cycleMonsters", this, "cycleMonstersEvent");
+
+
+ new SetupItemLabel(_("Map"), "", this);
+
+ new SetupItemCheckBox(_("Show warps particles"), "",
+ "warpParticle", this, "warpParticleEvent");
new SetupItemCheckBox(_("Highlight map portals"), "",
"highlightMapPortals", this, "highlightMapPortalsEvent");
- new SetupItemCheckBox(_("Attack while moving"), "",
- "attackMoving", this, "attackMovingEvent");
-
new SetupItemCheckBox(_("Highlight floor items"), "",
"floorItemsHighlight", this, "floorItemsHighlightEvent");
- new SetupItemCheckBox(_("Enable quick stats"), "",
- "quickStats", this, "quickStatsEvent");
-
new SetupItemCheckBox(_("Highlight player attack range"), "",
"highlightAttackRange", this, "highlightAttackRangeEvent");
- new SetupItemCheckBox(_("Show warps particles"), "",
- "warpParticle", this, "warpParticleEvent");
+ new SetupItemCheckBox(_("Show extended minimaps"), "",
+ "showExtMinimaps", this, "showExtMinimapsEvent");
- new SetupItemCheckBox(_("Highlight monster attack range"), "",
- "highlightMonsterAttackRange", this,
- "highlightMonsterAttackRangeEvent");
+ new SetupItemCheckBox(_("Draw path"), "", "drawPath",
+ this, "drawPathEvent");
- new SetupItemCheckBox(_("Accept sell/buy requests"), "",
- "autoShop", this, "autoShopEvent");
+ new SetupItemCheckBox(_("Draw hotkeys on map"), "", "drawHotKeys",
+ this, "drawHotKeysEvent");
- new SetupItemCheckBox(_("Cycle player targets"), "",
- "cyclePlayers", this, "cyclePlayersEvent");
- new SetupItemCheckBox(_("Show monster hp bar"), "",
- "showMobHP", this, "showMobHPEvent");
+ new SetupItemLabel(_("Moving"), "", this);
- new SetupItemCheckBox(_("Cycle monster targets"), "",
- "cycleMonsters", this, "cycleMonstersEvent");
+ new SetupItemCheckBox(_("Auto fix position"), "",
+ "autofixPos", this, "autofixPosEvent");
+
+ new SetupItemCheckBox(_("Attack while moving"), "",
+ "attackMoving", this, "attackMovingEvent");
+
+ new SetupItemCheckBox(_("Sync player move"), "", "syncPlayerMove",
+ this, "syncPlayerMoveEvent");
+
+ new SetupItemTextField(_("Crazy move A program"), "",
+ "crazyMoveProgram", this, "crazyMoveProgramEvent");
+
+
+ new SetupItemLabel(_("Player"), "", this);
new SetupItemCheckBox(_("Show own hp bar"), "",
"showOwnHP", this, "showOwnHPEvent");
- new SetupItemCheckBox(_("Enable bot checker"), "",
- "enableBotCheker", this, "enableBotChekerEvent");
+ new SetupItemCheckBox(_("Enable quick stats"), "",
+ "quickStats", this, "quickStatsEvent");
+
+ new SetupItemCheckBox(_("Cycle player targets"), "",
+ "cyclePlayers", this, "cyclePlayersEvent");
new SetupItemCheckBox(_("Show job exp messages"), "",
"showJobExp", this, "showJobExpEvent");
-
- new SetupItemTextField(_("Crazy move A program"), "",
- "crazyMoveProgram", this, "crazyMoveProgramEvent");
-
new SetupItemCheckBox(_("Show players popups"), "",
"showBeingPopup", this, "showBeingPopupEvent");
- new SetupItemCheckBox(_("Show extended minimaps"), "",
- "showExtMinimaps", this, "showExtMinimapsEvent");
-
new SetupItemTextField(_("Afk message"), "",
"afkMessage", this, "afkMessageEvent");
+ new SetupItemCheckBox(_("Show job"), "", "showJob",
+ this, "showJobEvent", false);
+
new SetupItemCheckBox(_("Enable attack filter"), "",
"enableAttackFilter", this, "enableAttackFilterEvent");
- new SetupItemCheckBox(_("Enable shop mode"), "",
- "tradebot", this, "tradebotEvent");
- new SetupItemCheckBox(_("Enable buggy servers protection"), "",
- "enableBuggyServers", this, "enableBuggyServersEvent", false);
+ new SetupItemLabel(_("Shop"), "", this);
- new SetupItemCheckBox(_("Enable debug log"), "",
- "debugLog", this, "debugLogEvent");
+ new SetupItemCheckBox(_("Accept sell/buy requests"), "",
+ "autoShop", this, "autoShopEvent");
- new SetupItemCheckBox(_("Draw path"), "", "drawPath",
- this, "drawPathEvent");
+ new SetupItemCheckBox(_("Enable shop mode"), "",
+ "tradebot", this, "tradebotEvent");
- new SetupItemCheckBox(_("Show job"), "", "showJob",
- this, "showJobEvent", false);
+
+ new SetupItemLabel(_("NPC"), "", this);
new SetupItemCheckBox(_("Log NPC dialogue"), "", "logNpcInGui",
this, "logNpcInGuiEvent");
- new SetupItemCheckBox(_("Draw hotkeys on map"), "", "drawHotKeys",
- this, "drawHotKeysEvent");
- new SetupItemCheckBox(_("Sync player move"), "", "syncPlayerMove",
- this, "syncPlayerMoveEvent");
+ new SetupItemLabel(_("Other"), "", this);
+
+ new SetupItemCheckBox(_("Enable server side attack"), "",
+ "serverAttack", this, "serverAttackEvent");
+
+ new SetupItemCheckBox(_("Enable bot checker"), "",
+ "enableBotCheker", this, "enableBotChekerEvent");
+
+ new SetupItemCheckBox(_("Enable buggy servers protection"), "",
+ "enableBuggyServers", this, "enableBuggyServersEvent", false);
+
+ new SetupItemCheckBox(_("Enable debug log"), "",
+ "debugLog", this, "debugLogEvent");
new SetupItemCheckBox(_("Low traffic mode"), "", "lowTraffic",
this, "lowTrafficEvent");
@@ -144,6 +163,7 @@ Setup_Other::Setup_Other()
new SetupItemCheckBox(_("Hide shield sprite"), "", "hideShield",
this, "hideShieldEvent");
+
setDimension(gcn::Rectangle(0, 0, 550, 350));
}
diff --git a/src/gui/setupitem.cpp b/src/gui/setupitem.cpp
index ecd6a9407..e41e9357d 100644
--- a/src/gui/setupitem.cpp
+++ b/src/gui/setupitem.cpp
@@ -111,6 +111,8 @@ void SetupItem::load()
case VINT:
mValue = toString(cfg->getIntValue(mKeyName));
break;
+ case VNONE:
+ break;
}
}
}
@@ -451,3 +453,55 @@ void SetupItemIntTextField::apply(std::string eventName)
fromWidget();
save();
}
+
+SetupItemLabel::SetupItemLabel(std::string text, std::string description,
+ SetupTabScroll *parent, bool separator) :
+ SetupItem(text, description, "", parent, "", "", true),
+ mLabel(0),
+ mIsSeparator(separator)
+{
+ mValueType = VNONE;
+ createControls();
+}
+
+SetupItemLabel::~SetupItemLabel()
+{
+ mWidget = 0;
+ mLabel = 0;
+}
+
+void SetupItemLabel::createControls()
+{
+ if (mIsSeparator)
+ {
+ const std::string str = " \342\200\225\342\200\225\342\200\225"
+ "\342\200\225\342\200\225 ";
+ mLabel = new Label(str + mText + str);
+ }
+ else
+ {
+ mLabel = new Label(mText);
+ }
+
+ mWidget = mLabel;
+ mParent->getContainer()->add(mWidget);
+ mParent->addControl(this);
+ mParent->addActionListener(this);
+ mWidget->addActionListener(this);
+}
+
+void SetupItemLabel::fromWidget()
+{
+}
+
+void SetupItemLabel::toWidget()
+{
+}
+
+void SetupItemLabel::action(const gcn::ActionEvent &event)
+{
+}
+
+void SetupItemLabel::apply(std::string eventName)
+{
+}
diff --git a/src/gui/setupitem.h b/src/gui/setupitem.h
index 81f85b0da..33fcbbf78 100644
--- a/src/gui/setupitem.h
+++ b/src/gui/setupitem.h
@@ -55,7 +55,8 @@ class SetupItem : public gcn::ActionListener
{
VBOOL = 0,
VSTR,
- VINT
+ VINT,
+ VNONE
};
SetupItem(std::string text, std::string description,
@@ -217,4 +218,27 @@ class SetupItemIntTextField : public SetupItem
EditDialog *mEditDialog;
};
+class SetupItemLabel : public SetupItem
+{
+ public:
+ SetupItemLabel(std::string text, std::string description,
+ SetupTabScroll *parent, bool separator = true);
+
+ ~SetupItemLabel();
+
+ void createControls();
+
+ void fromWidget();
+
+ void toWidget();
+
+ void action(const gcn::ActionEvent &event);
+
+ void apply(std::string eventName);
+
+ protected:
+ Label *mLabel;
+ bool mIsSeparator;
+};
+
#endif
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
index c3fd4dee8..805c0c8c7 100644
--- a/src/gui/widgets/setuptabscroll.cpp
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -61,14 +61,18 @@ SetupTabScroll::~SetupTabScroll()
void SetupTabScroll::addControl(SetupItem *widget)
{
- std::map<std::string, SetupItem*>::iterator iter
- = mItems.find(widget->getActionEventId());
- if (iter != mItems.end())
+ const std::string actionId = widget->getActionEventId();
+ if (!actionId.empty())
{
- delete (*iter).second;
- mItems.erase(iter);
+ std::map<std::string, SetupItem*>::iterator iter
+ = mItems.find(actionId);
+ if (iter != mItems.end())
+ {
+ delete (*iter).second;
+ mItems.erase(iter);
+ }
+ mItems[widget->getActionEventId()] = widget;
}
- mItems[widget->getActionEventId()] = widget;
mAllItems.insert(widget);
}