summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-16 22:46:32 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-16 22:46:32 +0300
commitee8cf11ee976b74167549b3e74c1c092e1623c49 (patch)
tree8cfab7fb00c36b619dee2d7296ec9d0650ad46ed /src
parent0f51cc8fb7f07c0d7d8354685897df193426de9e (diff)
downloadmv-ee8cf11ee976b74167549b3e74c1c092e1623c49.tar.gz
mv-ee8cf11ee976b74167549b3e74c1c092e1623c49.tar.bz2
mv-ee8cf11ee976b74167549b3e74c1c092e1623c49.tar.xz
mv-ee8cf11ee976b74167549b3e74c1c092e1623c49.zip
Move socialtab into separate file.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/gui/widgets/tabs/socialtab.h114
-rw-r--r--src/gui/windows/socialwindow.cpp83
4 files changed, 117 insertions, 82 deletions
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 <http://www.gnu.org/licenses/>.
+ */
+
+#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: