Added info pane for unsubscribed channels

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7934 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-02-09 22:11:19 +00:00
parent 326501f1f7
commit d89cee8bdd
4 changed files with 107 additions and 17 deletions

View File

@ -23,7 +23,7 @@ List of fixes/improvements before 0.6
Raises an error if you click on it.
Channels
[ ] Unsubscribed channels should show an info page when selected, like forums
[X] Unsubscribed channels should show an info page when selected, like forums
[ ] marking all as read in channels takes time. The channel icon should show a waiting clock
during the operation to avoid the user to re-click many times in the hope to get
the posts marked as read.

View File

@ -52,7 +52,6 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
/* Invoke the Qt Designer generated object setup routine */
ui->setupUi(this);
mInProcessSettings = false;
/* Setup UI helper */
@ -83,6 +82,7 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
/* Initialize view button */
//setViewMode(VIEW_MODE_FEEDS); see processSettings
ui->infoWidget->hide();
QSignalMapper *signalMapper = new QSignalMapper(this);
connect(ui->feedToolButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
@ -133,19 +133,27 @@ GxsChannelPostsWidget::~GxsChannelPostsWidget()
void GxsChannelPostsWidget::processSettings(bool load)
{
mInProcessSettings = true;
Settings->beginGroup(QString("ChannelPostsWidget"));
if (load) {
// load settings
/* Filter */
ui->filterLineEdit->setCurrentFilter(Settings->value("filter", FILTER_TITLE).toInt());
/* View mode */
setViewMode(Settings->value("viewMode", VIEW_MODE_FEEDS).toInt());
} else {
// save settings
/* Filter */
Settings->setValue("filter", ui->filterLineEdit->currentFilter());
/* View mode */
Settings->setValue("viewMode", viewMode());
}
Settings->endGroup();
mInProcessSettings = false;
}
void GxsChannelPostsWidget::settingsChanged()
@ -243,6 +251,39 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
bool autoDownload = rsGxsChannels->getChannelAutoDownload(group.mMeta.mGroupId);
setAutoDownload(autoDownload);
if (IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)) {
ui->feedToolButton->setEnabled(true);
ui->fileToolButton->setEnabled(true);
ui->infoWidget->hide();
setViewMode(viewMode());
ui->infoPosts->clear();
ui->infoDescription->clear();
} else {
ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount));
ui->infoDescription->setText(QString::fromUtf8(group.mDescription.c_str()));
ui->infoWidget->show();
ui->feedWidget->hide();
ui->fileWidget->hide();
ui->feedToolButton->setEnabled(false);
ui->fileToolButton->setEnabled(false);
}
}
int GxsChannelPostsWidget::viewMode()
{
if (ui->feedToolButton->isChecked()) {
return VIEW_MODE_FEEDS;
} else if (ui->fileToolButton->isChecked()) {
return VIEW_MODE_FILES;
}
/* Default */
return VIEW_MODE_FEEDS;
}
void GxsChannelPostsWidget::setViewMode(int viewMode)
@ -268,22 +309,12 @@ void GxsChannelPostsWidget::setViewMode(int viewMode)
setViewMode(VIEW_MODE_FEEDS);
return;
}
if (!mInProcessSettings) {
/* Save view mode */
Settings->setValueToGroup("ChannelPostsWidget", "viewMode", viewMode);
}
}
void GxsChannelPostsWidget::filterChanged(int filter)
{
ui->feedWidget->setFilterType(filter);
ui->fileWidget->setFilterType(filter);
if (!mInProcessSettings) {
// save index
Settings->setValueToGroup("ChannelPostsWidget", "filter", filter);
}
}
/*static*/ bool GxsChannelPostsWidget::filterItem(FeedItem *feedItem, const QString &text, int filter)

View File

@ -89,6 +89,8 @@ private:
void setAutoDownload(bool autoDl);
static bool filterItem(FeedItem *feedItem, const QString &text, int filter);
int viewMode();
void insertChannelDetails(const RsGxsChannelGroup &group);
void insertChannelPosts(std::vector<RsGxsChannelPost> &posts, GxsMessageFramePostThread *thread, bool related);
@ -97,7 +99,6 @@ private:
private:
QAction *mAutoDownloadAction;
bool mInProcessSettings;
bool mUseThread;
/* UI - from Designer */

View File

@ -283,6 +283,63 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="infoWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="infoPosts">
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="infoDescriptionLabel">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="infoPostsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Posts (at neighbor nodes):</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="infoDescription">
<property name="text">
<string notr="true">Description</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<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>
</layout>
</widget>
</item>
<item>
<widget class="GxsChannelFilesWidget" name="fileWidget" native="true">
<property name="sizePolicy">
@ -318,6 +375,7 @@
<zorder>headFrame</zorder>
<zorder>feedWidget</zorder>
<zorder>fileWidget</zorder>
<zorder>infoWidget</zorder>
</widget>
<customwidgets>
<customwidget>