Add a new Channel Page in settings (Patch from Phenom)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7355 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-05-08 17:17:48 +00:00
parent 78f3ab21fd
commit 097ba1655d
9 changed files with 196 additions and 24 deletions

View File

@ -24,6 +24,8 @@
#include "GxsChannelPostsWidget.h"
#include "gui/channels/ShareKey.h"
#include "gui/feeds/GxsChannelPostItem.h"
#include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h"
/****
* #define DEBUG_CHANNEL
@ -33,14 +35,20 @@
GxsChannelDialog::GxsChannelDialog(QWidget *parent)
: GxsGroupFrameDialog(rsGxsChannels, parent)
{
//#TODO: add settings like forums
setSingleTab(true);
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged();
}
GxsChannelDialog::~GxsChannelDialog()
{
}
//UserNotify *GxsChannelDialog::getUserNotify(QObject *parent)
//{
// return new ChannelUserNotify(parent);
//}
QString GxsChannelDialog::text(TextType type)
{
switch (type) {
@ -94,10 +102,10 @@ QString GxsChannelDialog::icon(IconType type)
return "";
}
//UserNotify *GxsChannelDialog::getUserNotify(QObject *parent)
//{
// return new ChannelUserNotify(parent);
//}
void GxsChannelDialog::settingsChanged()
{
setSingleTab(!Settings->getChannelOpenAllInNewTab());
}
GxsGroupDialog *GxsChannelDialog::createNewGroupDialog(TokenQueue *tokenQueue)
{

View File

@ -37,6 +37,7 @@ public:
// virtual UserNotify *getUserNotify(QObject *parent);
private slots:
void settingsChanged();
void toggleAutoDownload();
private:

View File

@ -0,0 +1,49 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* 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 "ChannelPage.h"
#include "rshare.h"
#include "rsharesettings.h"
ChannelPage::ChannelPage(QWidget * parent, Qt::WindowFlags flags)
: ConfigPage(parent, flags)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
}
ChannelPage::~ChannelPage()
{
}
/** Saves the changes on this page */
bool ChannelPage::save(QString &/*errmsg*/)
{
Settings->setChannelOpenAllInNewTab(ui.openAllInNewTabCheckBox->isChecked());
return true;
}
/** Loads the settings for this page */
void ChannelPage::load()
{
ui.openAllInNewTabCheckBox->setChecked(Settings->getChannelOpenAllInNewTab());
}

View File

@ -0,0 +1,50 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* 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 CHANNELPAGE_H
#define CHANNELPAGE_H
#include <retroshare-gui/configpage.h>
#include "ui_ChannelPage.h"
class ChannelPage : public ConfigPage
{
Q_OBJECT
public:
ChannelPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~ChannelPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
virtual QPixmap iconPixmap() const { return QPixmap(":/images/channels.png") ; }
virtual QString pageName() const { return tr("Channels") ; }
virtual QString helpText() const { return ""; }
private:
Ui::ChannelPage ui;
};
#endif // !CHANNELPAGE_H

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChannelPage</class>
<widget class="QWidget" name="ChannelPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>340</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="gxsGroupBox">
<property name="title">
<string>New channel</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="openAllInNewTabCheckBox">
<property name="text">
<string>Open all forums in new tab</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -35,6 +35,7 @@
#include "TransferPage.h"
#include "RelayPage.h"
#include "ChatPage.h"
#include "ChannelPage.h"
#include "MessagePage.h"
#include "ForumPage.h"
#include "PluginsPage.h"
@ -132,6 +133,7 @@ RSettingsWin::initStackedWidget()
addPage(new NotifyPage());
addPage(new CryptoPage());
addPage(new MessagePage());
addPage(new ChannelPage());
addPage(new ForumPage());
addPage(new ChatPage());
addPage(new AppearancePage());

View File

@ -778,6 +778,16 @@ void RshareSettings::setForumOpenAllInNewTab(bool value)
setValueToGroup("ForumDialog", "OpenAllInNewTab", value);
}
bool RshareSettings::getChannelOpenAllInNewTab()
{
return valueFromGroup("ChannelDialog", "OpenAllInNewTab", true).toBool();
}
void RshareSettings::setChannelOpenAllInNewTab(bool value)
{
setValueToGroup("ChannelDialog", "OpenAllInNewTab", value);
}
/* time before idle */
uint RshareSettings::getMaxTimeBeforeIdle()
{

View File

@ -256,6 +256,8 @@ public:
void setForumOpenAllInNewTab(bool value);
bool getForumLoadEmbeddedImages();
void setForumLoadEmbeddedImages(bool value);
bool getChannelOpenAllInNewTab();
void setChannelOpenAllInNewTab(bool value);
/* time before idle */
uint getMaxTimeBeforeIdle();

View File

@ -406,12 +406,13 @@ HEADERS += rshare.h \
gui/settings/PluginItem.h \
gui/settings/AppearancePage.h \
gui/settings/FileAssociationsPage.h \
gui/settings/SoundPage.h \
gui/settings/TransferPage.h \
gui/settings/ChatPage.h \
gui/settings/RelayPage.h \
gui/settings/ServicePermissionsPage.h \
gui/settings/AddFileAssociationDialog.h \
gui/settings/SoundPage.h \
gui/settings/TransferPage.h \
gui/settings/ChatPage.h \
gui/settings/ChannelPage.h \
gui/settings/RelayPage.h \
gui/settings/ServicePermissionsPage.h \
gui/settings/AddFileAssociationDialog.h \
gui/toaster/MessageToaster.h \
gui/toaster/OnlineToaster.h \
gui/toaster/DownloadToaster.h \
@ -565,12 +566,13 @@ FORMS += gui/StartDialog.ui \
gui/settings/ForumPage.ui \
gui/settings/PluginsPage.ui \
gui/settings/AppearancePage.ui \
gui/settings/TransferPage.ui \
gui/settings/SoundPage.ui \
gui/settings/ChatPage.ui \
gui/settings/RelayPage.ui \
gui/settings/ServicePermissionsPage.ui \
gui/settings/GlobalRouterStatistics.ui \
gui/settings/TransferPage.ui \
gui/settings/SoundPage.ui \
gui/settings/ChatPage.ui \
gui/settings/ChannelPage.ui \
gui/settings/RelayPage.ui \
gui/settings/ServicePermissionsPage.ui \
gui/settings/GlobalRouterStatistics.ui \
gui/settings/PluginItem.ui \
gui/toaster/MessageToaster.ui \
gui/toaster/OnlineToaster.ui \
@ -766,12 +768,13 @@ SOURCES += main.cpp \
gui/settings/PluginItem.cpp \
gui/settings/AppearancePage.cpp \
gui/settings/FileAssociationsPage.cpp \
gui/settings/SoundPage.cpp \
gui/settings/TransferPage.cpp \
gui/settings/ChatPage.cpp \
gui/settings/RelayPage.cpp \
gui/settings/ServicePermissionsPage.cpp \
gui/settings/AddFileAssociationDialog.cpp \
gui/settings/SoundPage.cpp \
gui/settings/TransferPage.cpp \
gui/settings/ChatPage.cpp \
gui/settings/ChannelPage.cpp \
gui/settings/RelayPage.cpp \
gui/settings/ServicePermissionsPage.cpp \
gui/settings/AddFileAssociationDialog.cpp \
gui/statusbar/peerstatus.cpp \
gui/statusbar/natstatus.cpp \
gui/statusbar/dhtstatus.cpp \