diff options
Diffstat (limited to 'src/gui/widgets/tabs/chat')
22 files changed, 103 insertions, 82 deletions
diff --git a/src/gui/widgets/tabs/chat/battletab.cpp b/src/gui/widgets/tabs/chat/battletab.cpp index 5dd5ff987..57870bcf7 100644 --- a/src/gui/widgets/tabs/chat/battletab.cpp +++ b/src/gui/widgets/tabs/chat/battletab.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2008-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,8 +36,6 @@ BattleTab::BattleTab(const Widget2 *const widget) : ChatTab(widget, _("Battle"), "", "#Battle", ChatTabType::BATTLE) { setTabColors(ThemeColorId::BATTLE_CHAT_TAB); - if (config.getBoolValue("showChatHistory")) - loadFromLogFile("#Battle"); } BattleTab::~BattleTab() diff --git a/src/gui/widgets/tabs/chat/battletab.h b/src/gui/widgets/tabs/chat/battletab.h index f3bfec156..a88945393 100644 --- a/src/gui/widgets/tabs/chat/battletab.h +++ b/src/gui/widgets/tabs/chat/battletab.h @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/channeltab.cpp b/src/gui/widgets/tabs/chat/channeltab.cpp index a2fbeb3a6..44d76453a 100644 --- a/src/gui/widgets/tabs/chat/channeltab.cpp +++ b/src/gui/widgets/tabs/chat/channeltab.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2008-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/channeltab.h b/src/gui/widgets/tabs/chat/channeltab.h index 73a633ee3..f7e68c4b1 100644 --- a/src/gui/widgets/tabs/chat/channeltab.h +++ b/src/gui/widgets/tabs/chat/channeltab.h @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index ec9042694..b09e57585 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2008-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +38,7 @@ #include "gui/windows/chatwindow.h" #include "gui/windows/helpwindow.h" +#include "gui/widgets/browserbox.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/itemlinkhandler.h" #include "gui/widgets/tabbedarea.h" @@ -51,9 +52,9 @@ #include "utils/delete2.h" #include "utils/gettext.h" -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #include <sstream> @@ -97,6 +98,10 @@ ChatTab::ChatTab(const Widget2 *const widget, if (chatWindow != nullptr) chatWindow->addTab(this); mTextOutput->updateSize(true); + + const int maxLines = config.getIntValue("loadChatHistoryLines"); + if (maxLines > 0) + loadFromLogFile(logName, maxLines); } ChatTab::~ChatTab() @@ -228,7 +233,7 @@ void ChatTab::chatLog(std::string line, // if configured, move magic messages log to debug chat tab if (Net::getNetworkType() == ServerType::TMWATHENA - && (localChatTab != nullptr) && this == localChatTab + && this == localChatTab && ((config.getBoolValue("showMagicInDebug") && own == ChatMsgType::BY_PLAYER && tmp.text.length() > 1 @@ -433,6 +438,16 @@ void ChatTab::clearText() mTextOutput->clearRows(); } +const std::list<std::string> &ChatTab::getRows() const +{ + return mTextOutput->getRows(); +} + +bool ChatTab::hasRows() const +{ + return mTextOutput->hasRows(); +} + void ChatTab::handleInput(const std::string &msg) { if (chatHandler) @@ -510,12 +525,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..3cab5f54d 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +31,11 @@ #include "enums/simpletypes/online.h" #include "enums/simpletypes/tryremovecolors.h" -#include "gui/widgets/browserbox.h" - #include "gui/widgets/tabs/tab.h" #include "localconsts.h" +class BrowserBox; class ScrollArea; #define debugMsg(str) \ @@ -115,10 +114,23 @@ class ChatTab notfinal : public Tab /** * Clears the text from the tab + * @see BrowserBox::clearRows */ void clearText(); /** + * Returns lines of text from the widget, + * @see BrowserBox::getRows + */ + const std::list<std::string> &getRows() const A_WARN_UNUSED; + + /** + * true if the widget has any lines + * @see BrowserBox::hasRows + */ + bool hasRows() const A_WARN_UNUSED; + + /** * Handle special commands. Allows a tab to handle commands it * defines itself. * @@ -147,13 +159,8 @@ class ChatTab notfinal : public Tab void saveToLogFile(const std::string &msg) const; - const std::list<std::string> &getRows() const A_WARN_UNUSED - { return mTextOutput->getRows(); } - - 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/chat/clantab.cpp b/src/gui/widgets/tabs/chat/clantab.cpp index ea9f8e3f5..c1efb710d 100644 --- a/src/gui/widgets/tabs/chat/clantab.cpp +++ b/src/gui/widgets/tabs/chat/clantab.cpp @@ -1,9 +1,9 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/clantab.h b/src/gui/widgets/tabs/chat/clantab.h index f032d51ea..3e611fb2e 100644 --- a/src/gui/widgets/tabs/chat/clantab.h +++ b/src/gui/widgets/tabs/chat/clantab.h @@ -1,9 +1,9 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.cpp b/src/gui/widgets/tabs/chat/emulateguildtab.cpp index 97d4e6c07..bfa40de5b 100644 --- a/src/gui/widgets/tabs/chat/emulateguildtab.cpp +++ b/src/gui/widgets/tabs/chat/emulateguildtab.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2008-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.h b/src/gui/widgets/tabs/chat/emulateguildtab.h index bc297cdf4..3533a6f0c 100644 --- a/src/gui/widgets/tabs/chat/emulateguildtab.h +++ b/src/gui/widgets/tabs/chat/emulateguildtab.h @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/gmtab.cpp b/src/gui/widgets/tabs/chat/gmtab.cpp index bd9696e89..1dbf39cfd 100644 --- a/src/gui/widgets/tabs/chat/gmtab.cpp +++ b/src/gui/widgets/tabs/chat/gmtab.cpp @@ -1,9 +1,9 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2013-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/gmtab.h b/src/gui/widgets/tabs/chat/gmtab.h index 21e360ccd..f0f91b773 100644 --- a/src/gui/widgets/tabs/chat/gmtab.h +++ b/src/gui/widgets/tabs/chat/gmtab.h @@ -1,9 +1,9 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2013-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/guildtab.cpp b/src/gui/widgets/tabs/chat/guildtab.cpp index 7204a9a45..7c751a921 100644 --- a/src/gui/widgets/tabs/chat/guildtab.cpp +++ b/src/gui/widgets/tabs/chat/guildtab.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2008-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/guildtab.h b/src/gui/widgets/tabs/chat/guildtab.h index 0e74be6ee..6f75a43d4 100644 --- a/src/gui/widgets/tabs/chat/guildtab.h +++ b/src/gui/widgets/tabs/chat/guildtab.h @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/langtab.cpp b/src/gui/widgets/tabs/chat/langtab.cpp index 5098bc5b1..bb15ef734 100644 --- a/src/gui/widgets/tabs/chat/langtab.cpp +++ b/src/gui/widgets/tabs/chat/langtab.cpp @@ -1,9 +1,9 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/langtab.h b/src/gui/widgets/tabs/chat/langtab.h index 83878a8a2..5cb4f1c26 100644 --- a/src/gui/widgets/tabs/chat/langtab.h +++ b/src/gui/widgets/tabs/chat/langtab.h @@ -1,9 +1,9 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp index ee241f918..374f7f214 100644 --- a/src/gui/widgets/tabs/chat/partytab.cpp +++ b/src/gui/widgets/tabs/chat/partytab.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2008-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/partytab.h b/src/gui/widgets/tabs/chat/partytab.h index e22b37d23..6c250770b 100644 --- a/src/gui/widgets/tabs/chat/partytab.h +++ b/src/gui/widgets/tabs/chat/partytab.h @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/tradetab.cpp b/src/gui/widgets/tabs/chat/tradetab.cpp index 9b0da9a8e..a7dba471f 100644 --- a/src/gui/widgets/tabs/chat/tradetab.cpp +++ b/src/gui/widgets/tabs/chat/tradetab.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2008-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/tradetab.h b/src/gui/widgets/tabs/chat/tradetab.h index c65ecb624..2dd6168e3 100644 --- a/src/gui/widgets/tabs/chat/tradetab.h +++ b/src/gui/widgets/tabs/chat/tradetab.h @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/whispertab.cpp b/src/gui/widgets/tabs/chat/whispertab.cpp index 04702ae4d..777441be9 100644 --- a/src/gui/widgets/tabs/chat/whispertab.cpp +++ b/src/gui/widgets/tabs/chat/whispertab.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabs/chat/whispertab.h b/src/gui/widgets/tabs/chat/whispertab.h index eaa032273..d29b91653 100644 --- a/src/gui/widgets/tabs/chat/whispertab.h +++ b/src/gui/widgets/tabs/chat/whispertab.h @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |