From ee8cf11ee976b74167549b3e74c1c092e1623c49 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 16 May 2014 22:46:32 +0300 Subject: Move socialtab into separate file. --- src/CMakeLists.txt | 1 + src/Makefile.am | 1 + src/gui/widgets/tabs/socialtab.h | 114 +++++++++++++++++++++++++++++++++++++++ src/gui/windows/socialwindow.cpp | 83 +--------------------------- 4 files changed, 117 insertions(+), 82 deletions(-) create mode 100644 src/gui/widgets/tabs/socialtab.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f401efa42..2b177e673 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -260,6 +260,7 @@ SET(SRCS gui/widgets/sliderlist.h gui/widgets/tabs/shortcuttab.h gui/widgets/tabs/skilltab.h + gui/widgets/tabs/socialtab.h gui/widgets/tabs/tab.cpp gui/widgets/tabs/tab.h gui/widgets/tabbedarea.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 42fb2195f..7ad4eacf1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -358,6 +358,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/sliderlist.h \ gui/widgets/tabs/shortcuttab.h \ gui/widgets/tabs/skilltab.h \ + gui/widgets/tabs/socialtab.h \ gui/widgets/tabs/tab.cpp \ gui/widgets/tabs/tab.h \ gui/widgets/tabbedarea.cpp \ diff --git a/src/gui/widgets/tabs/socialtab.h b/src/gui/widgets/tabs/socialtab.h new file mode 100644 index 000000000..433655c9d --- /dev/null +++ b/src/gui/widgets/tabs/socialtab.h @@ -0,0 +1,114 @@ +/* + * The ManaPlus Client + * Copyright (C) 2010 The Mana Developers + * Copyright (C) 2011-2014 The ManaPlus Developers + * + * This file is part of The ManaPlus 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 + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GUI_WIDGETS_TABS_SOCIALTAB_H +#define GUI_WIDGETS_TABS_SOCIALTAB_H + +#include "gui/windows/socialwindow.h" + +#include "gui/widgets/tabs/tab.h" + +#include "localconsts.h" + +class SocialTab : public Tab +{ + public: + A_DELETE_COPY(SocialTab) + + virtual void invite() + { + } + + virtual void leave() + { + } + + virtual void updateList() + { + } + + virtual void updateAvatar(const std::string &name A_UNUSED) + { + } + + virtual void resetDamage(const std::string &name A_UNUSED) + { + } + + virtual void selectIndex(const unsigned num A_UNUSED) + { + } + + virtual void buildCounter(const int online A_UNUSED = 0, + const int total A_UNUSED = 0) + { + } + + protected: + friend class SocialWindow; + + explicit SocialTab(const Widget2 *const widget): + Tab(widget), + mInviteDialog(nullptr), + mConfirmDialog(nullptr), + mScroll(nullptr), + mList(nullptr), + mCounterString() + { + } + + virtual ~SocialTab() + { + // Cleanup dialogs + if (mInviteDialog) + { + mInviteDialog->close(); + mInviteDialog->scheduleDelete(); + mInviteDialog = nullptr; + } + + if (mConfirmDialog) + { + mConfirmDialog->close(); + mConfirmDialog->scheduleDelete(); + mConfirmDialog = nullptr; + } + } + + void setCurrent() override final + { + updateCounter(); + } + + void updateCounter() const + { + if (socialWindow) + socialWindow->setCounter(this, mCounterString); + } + + TextDialog *mInviteDialog; + ConfirmDialog *mConfirmDialog; + ScrollArea *mScroll; + AvatarListBox *mList; + std::string mCounterString; +}; + +#endif // GUI_WIDGETS_TABS_SOCIALTAB_H diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 711f5b8bc..eb16cddf8 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -55,6 +55,7 @@ #include "gui/widgets/tabbedarea.h" #include "gui/widgets/tabs/chattab.h" +#include "gui/widgets/tabs/socialtab.h" #include "net/net.h" #include "net/guildhandler.h" @@ -94,88 +95,6 @@ namespace } friendSorter; } // namespace -class SocialTab : public Tab -{ -public: - A_DELETE_COPY(SocialTab) - - virtual void invite() - { - } - - virtual void leave() - { - } - - virtual void updateList() - { - } - - virtual void updateAvatar(const std::string &name A_UNUSED) - { - } - - virtual void resetDamage(const std::string &name A_UNUSED) - { - } - - virtual void selectIndex(const unsigned num A_UNUSED) - { } - - virtual void buildCounter(const int online A_UNUSED = 0, - const int total A_UNUSED = 0) - { - } - -protected: - friend class SocialWindow; - - explicit SocialTab(const Widget2 *const widget): - Tab(widget), - mInviteDialog(nullptr), - mConfirmDialog(nullptr), - mScroll(nullptr), - mList(nullptr), - mCounterString() - { - } - - virtual ~SocialTab() - { - // Cleanup dialogs - if (mInviteDialog) - { - mInviteDialog->close(); - mInviteDialog->scheduleDelete(); - mInviteDialog = nullptr; - } - - if (mConfirmDialog) - { - mConfirmDialog->close(); - mConfirmDialog->scheduleDelete(); - mConfirmDialog = nullptr; - } - } - - void setCurrent() override final - { - updateCounter(); - } - - void updateCounter() const - { - if (socialWindow) - socialWindow->setCounter(this, mCounterString); - } - - TextDialog *mInviteDialog; - ConfirmDialog *mConfirmDialog; - ScrollArea *mScroll; - AvatarListBox *mList; - std::string mCounterString; -}; - class SocialGuildTab final : public SocialTab, public ActionListener { public: -- cgit v1.2.3-60-g2f50