From 3675b1fd0f358758abb568f51c536237cb174adb Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 4 May 2014 23:09:54 +0000 Subject: [PATCH] Added missing files git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7330 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/gxsforums/GxsForumsDialog.cpp | 128 ++++++++++++++++++ .../src/gui/gxsforums/GxsForumsDialog.h | 51 +++++++ 2 files changed, 179 insertions(+) create mode 100644 retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp create mode 100644 retroshare-gui/src/gui/gxsforums/GxsForumsDialog.h diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp new file mode 100644 index 000000000..6367000c2 --- /dev/null +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp @@ -0,0 +1,128 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008 Robert Fernie + * + * 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 (at your option) 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + +#include "GxsForumsDialog.h" +#include "GxsForumGroupDialog.h" +#include "GxsForumThreadWidget.h" +#include "gui/settings/rsharesettings.h" +#include "gui/notifyqt.h" +#include "gui/channels/ShareKey.h" + +// These should be in retroshare/ folder. +//#include "retroshare/rsgxsflags.h" + +//#define DEBUG_FORUMS + +/** Constructor */ +GxsForumsDialog::GxsForumsDialog(QWidget *parent) + : GxsGroupFrameDialog(rsGxsForums, parent) +{ + connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); + + settingsChanged(); +} + +GxsForumsDialog::~GxsForumsDialog() +{ +} + +//UserNotify *GxsForumsDialog::getUserNotify(QObject *parent) +//{ +// return new GxsForumUserNotify(parent); +//} + +QString GxsForumsDialog::text(TextType type) +{ + switch (type) { + case TEXT_NAME: + return tr("Forums"); + case TEXT_NEW: + return tr("Create Forum"); + case TEXT_TODO: + return "Open points:"; + + case TEXT_YOUR_GROUP: + return tr("My Forums"); + case TEXT_SUBSCRIBED_GROUP: + return tr("Subscribed Forums"); + case TEXT_POPULAR_GROUP: + return tr("Popular Forums"); + case TEXT_OTHER_GROUP: + return tr("Other Forums"); + } + + return ""; +} + +QString GxsForumsDialog::icon(IconType type) +{ + switch (type) { + case ICON_NAME: + return ":/images/konversation.png"; + case ICON_NEW: + return ":/images/new_forum16.png"; + case ICON_YOUR_GROUP: + return ":/images/folder16.png"; + case ICON_SUBSCRIBED_GROUP: + return ":/images/folder_red.png"; + case ICON_POPULAR_GROUP: + return ":/images/folder_green.png"; + case ICON_OTHER_GROUP: + return ":/images/folder_yellow.png"; + case ICON_DEFAULT: + return ":/images/konversation.png"; + } + + return ""; +} + +void GxsForumsDialog::settingsChanged() +{ + setSingleTab(!Settings->getForumOpenAllInNewTab()); +} + +GxsGroupDialog *GxsForumsDialog::createNewGroupDialog(TokenQueue *tokenQueue) +{ + return new GxsForumGroupDialog(tokenQueue, this); +} + +GxsGroupDialog *GxsForumsDialog::createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId) +{ + return new GxsForumGroupDialog(tokenQueue, tokenService, mode, groupId, this); +} + +int GxsForumsDialog::shareKeyType() +{ + return FORUM_KEY_SHARE; +} + +GxsMessageFrameWidget *GxsForumsDialog::createMessageFrameWidget(const RsGxsGroupId &groupId) +{ + return new GxsForumThreadWidget(groupId); +} diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.h b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.h new file mode 100644 index 000000000..36936d8c8 --- /dev/null +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.h @@ -0,0 +1,51 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008 Robert Fernie + * + * 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 (at your option) 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + +#ifndef _GXSFORUMSDIALOG_H +#define _GXSFORUMSDIALOG_H + +#include "gui/gxs/GxsGroupFrameDialog.h" + +class GxsForumsDialog : public GxsGroupFrameDialog +{ + Q_OBJECT + +public: + GxsForumsDialog(QWidget *parent = 0); + ~GxsForumsDialog(); + +// virtual UserNotify *getUserNotify(QObject *parent); + +private slots: + void settingsChanged(); + +private: + /* GxsGroupFrameDialog */ + virtual QString text(TextType type); + virtual QString icon(IconType type); + virtual QString settingsGroupName() { return "GxsForumsDialog"; } + virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue); + virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId); + virtual int shareKeyType(); + virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId); +}; + +#endif