diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defaults.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/chattab.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/chattab.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_chat.cpp | 9 | ||||
-rw-r--r-- | src/manaplus.rc | 1 |
5 files changed, 14 insertions, 11 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp index 32084a1b5..eae83e1ab 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -232,7 +232,7 @@ void setConfigDefaults(Configuration &cfg) AddDEF("allowCommandsInChatTabs", true); AddDEF("serverMsgInDebug", true); AddDEF("hideShopMessages", true); - AddDEF("showChatHistory", true); + AddDEF("loadChatHistoryLines", 100); AddDEF("chatMaxLinesLimit", 100); AddDEF("chatColor", 0); AddDEF("showJob", true); diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index 9809287d2..3773df55f 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -98,8 +98,9 @@ ChatTab::ChatTab(const Widget2 *const widget, chatWindow->addTab(this); mTextOutput->updateSize(true); - if (config.getBoolValue("showChatHistory")) - loadFromLogFile(logName); + const int maxLines = config.getIntValue("loadChatHistoryLines"); + if (maxLines > 0) + loadFromLogFile(logName, maxLines); } ChatTab::~ChatTab() @@ -513,12 +514,13 @@ void ChatTab::addRow(std::string &line) false); } -void ChatTab::loadFromLogFile(const std::string &name) +void ChatTab::loadFromLogFile(const std::string &name, + const unsigned maxLines) { if (chatLogger != nullptr) { std::list<std::string> list; - chatLogger->loadLast(name, list, 5); + chatLogger->loadLast(name, list, maxLines); std::list<std::string>::const_iterator i = list.begin(); while (i != list.end()) { diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h index 7a3774fc2..7aeeeebdb 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -153,7 +153,8 @@ class ChatTab notfinal : public Tab bool hasRows() const A_WARN_UNUSED { return mTextOutput->hasRows(); } - void loadFromLogFile(const std::string &name); + void loadFromLogFile(const std::string &name, + const unsigned maxLines); bool getAllowHighlight() const noexcept2 A_WARN_UNUSED { return mAllowHightlight; } diff --git a/src/gui/widgets/tabs/setup_chat.cpp b/src/gui/widgets/tabs/setup_chat.cpp index f42f34c5a..ae9043962 100644 --- a/src/gui/widgets/tabs/setup_chat.cpp +++ b/src/gui/widgets/tabs/setup_chat.cpp @@ -148,11 +148,12 @@ Setup_Chat::Setup_Chat(const Widget2 *const widget) : MainConfig_true); // TRANSLATORS: settings option - new SetupItemCheckBox(_("Show chat history"), + new SetupItemIntTextField(_("Show chat history lines"), // TRANSLATORS: settings description - _("If this setting enabled, client will load old chat tabs content " - "from logs on startup instead of starting with empty chat tabs."), - "showChatHistory", this, "showChatHistoryEvent", + _("If this number is set to above 0, the client will load old chat" + " tabs content from logs on startup instead of starting with empty" + " chat tabs."), + "loadChatHistoryLines", this, "loadChatHistoryLinesEvent", 0, 10000, MainConfig_true); // TRANSLATORS: settings option diff --git a/src/manaplus.rc b/src/manaplus.rc index 53095ceb1..b9b0d9e57 100644 --- a/src/manaplus.rc +++ b/src/manaplus.rc @@ -3,7 +3,6 @@ #include "winver.h" A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "../data/icons/manaplus.ico" -evol ICON MOVEABLE PURE LOADONCALL DISCARDABLE "../data/evol/icons/evol-client.ico" tmw ICON MOVEABLE PURE LOADONCALL DISCARDABLE "../data/tmw/icons/tmw-client.ico" 1 VERSIONINFO |