mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 09:41:29 -05:00
Added a new setting to channels to enable/disable threaded loading.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7484 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
27c2ed0a97
commit
f60b37a213
@ -311,6 +311,9 @@ bool UIStateHelper::isWidgetVisible(QWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
int visibleCount = 0;
|
||||||
|
int invisibleCount = 0;
|
||||||
|
|
||||||
QMap<long, UIStateHelperData*>::iterator dataIt;
|
QMap<long, UIStateHelperData*>::iterator dataIt;
|
||||||
for (dataIt = mData.begin(); dataIt != mData.end(); ++dataIt) {
|
for (dataIt = mData.begin(); dataIt != mData.end(); ++dataIt) {
|
||||||
UIStateHelperData *data = dataIt.value();
|
UIStateHelperData *data = dataIt.value();
|
||||||
@ -323,32 +326,42 @@ bool UIStateHelper::isWidgetVisible(QWidget *widget)
|
|||||||
|
|
||||||
if (states & (UISTATE_LOADING_VISIBLE | UISTATE_LOADING_INVISIBLE)) {
|
if (states & (UISTATE_LOADING_VISIBLE | UISTATE_LOADING_INVISIBLE)) {
|
||||||
if (states & UISTATE_LOADING_VISIBLE) {
|
if (states & UISTATE_LOADING_VISIBLE) {
|
||||||
if (!data->mLoading) {
|
if (data->mLoading) {
|
||||||
visible = false;
|
++visibleCount;
|
||||||
break;
|
} else {
|
||||||
|
++invisibleCount;
|
||||||
}
|
}
|
||||||
} else if (states & UISTATE_LOADING_INVISIBLE) {
|
} else if (states & UISTATE_LOADING_INVISIBLE) {
|
||||||
if (data->mLoading) {
|
if (data->mLoading) {
|
||||||
visible = false;
|
++invisibleCount;
|
||||||
break;
|
} else {
|
||||||
|
++visibleCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (states & (UISTATE_ACTIVE_VISIBLE | UISTATE_ACTIVE_INVISIBLE)) {
|
if (states & (UISTATE_ACTIVE_VISIBLE | UISTATE_ACTIVE_INVISIBLE)) {
|
||||||
if (states & UISTATE_ACTIVE_VISIBLE) {
|
if (states & UISTATE_ACTIVE_VISIBLE) {
|
||||||
if (!data->mActive) {
|
if (data->mActive) {
|
||||||
visible = false;
|
++visibleCount;
|
||||||
break;
|
} else {
|
||||||
|
++invisibleCount;
|
||||||
}
|
}
|
||||||
} else if (states & UISTATE_ACTIVE_INVISIBLE) {
|
} else if (states & UISTATE_ACTIVE_INVISIBLE) {
|
||||||
if (data->mActive) {
|
if (data->mActive) {
|
||||||
visible = false;
|
++invisibleCount;
|
||||||
break;
|
} else {
|
||||||
|
++visibleCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (visibleCount + invisibleCount) {
|
||||||
|
if (!visibleCount) {
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return visible;
|
return visible;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/feeds/SubFileItem.h"
|
#include "gui/feeds/SubFileItem.h"
|
||||||
|
#include "gui/notifyqt.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
||||||
@ -57,6 +57,7 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
|
|||||||
/* Setup UI helper */
|
/* Setup UI helper */
|
||||||
|
|
||||||
mStateHelper->addWidget(mTokenTypePosts, ui->progressBar, UISTATE_LOADING_VISIBLE);
|
mStateHelper->addWidget(mTokenTypePosts, ui->progressBar, UISTATE_LOADING_VISIBLE);
|
||||||
|
mStateHelper->addWidget(mTokenTypePosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE);
|
||||||
mStateHelper->addWidget(mTokenTypePosts, ui->filterLineEdit);
|
mStateHelper->addWidget(mTokenTypePosts, ui->filterLineEdit);
|
||||||
|
|
||||||
mStateHelper->addWidget(mTokenTypeRelatedPosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE);
|
mStateHelper->addWidget(mTokenTypeRelatedPosts, ui->loadingLabel, UISTATE_LOADING_VISIBLE);
|
||||||
@ -67,8 +68,10 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
|
|||||||
mStateHelper->addWidget(mTokenTypeGroupData, ui->logoLabel);
|
mStateHelper->addWidget(mTokenTypeGroupData, ui->logoLabel);
|
||||||
mStateHelper->addWidget(mTokenTypeGroupData, ui->subscribeToolButton);
|
mStateHelper->addWidget(mTokenTypeGroupData, ui->subscribeToolButton);
|
||||||
|
|
||||||
|
/* Connect signals */
|
||||||
connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
||||||
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
|
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
|
||||||
|
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||||
|
|
||||||
/* add filter actions */
|
/* add filter actions */
|
||||||
ui->filterLineEdit->addFilter(QIcon(), tr("Title"), FILTER_TITLE, tr("Search Title"));
|
ui->filterLineEdit->addFilter(QIcon(), tr("Title"), FILTER_TITLE, tr("Search Title"));
|
||||||
@ -114,6 +117,7 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
|
|||||||
|
|
||||||
/* Initialize GUI */
|
/* Initialize GUI */
|
||||||
setAutoDownload(false);
|
setAutoDownload(false);
|
||||||
|
settingsChanged();
|
||||||
setGroupId(channelId);
|
setGroupId(channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +148,13 @@ void GxsChannelPostsWidget::processSettings(bool load)
|
|||||||
mInProcessSettings = false;
|
mInProcessSettings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsChannelPostsWidget::settingsChanged()
|
||||||
|
{
|
||||||
|
mUseThread = Settings->getChannelLoadThread();
|
||||||
|
|
||||||
|
mStateHelper->setWidgetVisible(ui->progressBar, mUseThread);
|
||||||
|
}
|
||||||
|
|
||||||
void GxsChannelPostsWidget::groupNameChanged(const QString &name)
|
void GxsChannelPostsWidget::groupNameChanged(const QString &name)
|
||||||
{
|
{
|
||||||
if (groupId().isNull()) {
|
if (groupId().isNull()) {
|
||||||
|
@ -71,7 +71,7 @@ protected:
|
|||||||
virtual void insertPosts(const uint32_t &token, GxsMessageFramePostThread *thread);
|
virtual void insertPosts(const uint32_t &token, GxsMessageFramePostThread *thread);
|
||||||
virtual void insertRelatedPosts(const uint32_t &token);
|
virtual void insertRelatedPosts(const uint32_t &token);
|
||||||
virtual void clearPosts();
|
virtual void clearPosts();
|
||||||
virtual bool useThread() { return true; }
|
virtual bool useThread() { return mUseThread; }
|
||||||
virtual void fillThreadCreatePost(const QVariant &post, bool related, int current, int count);
|
virtual void fillThreadCreatePost(const QVariant &post, bool related, int current, int count);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -80,6 +80,7 @@ private slots:
|
|||||||
void subscribeGroup(bool subscribe);
|
void subscribeGroup(bool subscribe);
|
||||||
void filterChanged(int filter);
|
void filterChanged(int filter);
|
||||||
void setViewMode(int viewMode);
|
void setViewMode(int viewMode);
|
||||||
|
void settingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
@ -96,6 +97,7 @@ private:
|
|||||||
QAction *mAutoDownloadAction;
|
QAction *mAutoDownloadAction;
|
||||||
|
|
||||||
bool mInProcessSettings;
|
bool mInProcessSettings;
|
||||||
|
bool mUseThread;
|
||||||
|
|
||||||
/* UI - from Designer */
|
/* UI - from Designer */
|
||||||
Ui::GxsChannelPostsWidget *ui;
|
Ui::GxsChannelPostsWidget *ui;
|
||||||
|
@ -36,6 +36,7 @@ ChannelPage::~ChannelPage()
|
|||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool ChannelPage::save(QString &/*errmsg*/)
|
bool ChannelPage::save(QString &/*errmsg*/)
|
||||||
{
|
{
|
||||||
|
Settings->setChannelLoadThread(ui.loadThreadCheckBox->isChecked());
|
||||||
ui.groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Channel);
|
ui.groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Channel);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -44,5 +45,6 @@ bool ChannelPage::save(QString &/*errmsg*/)
|
|||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void ChannelPage::load()
|
void ChannelPage::load()
|
||||||
{
|
{
|
||||||
|
ui.loadThreadCheckBox->setChecked(Settings->getChannelLoadThread());
|
||||||
ui.groupFrameSettingsWidget->loadSettings(GroupFrameSettings::Channel);
|
ui.groupFrameSettingsWidget->loadSettings(GroupFrameSettings::Channel);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,34 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
<widget class="QGroupBox" name="tabsGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Tabs</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="GroupFrameSettingsWidget" name="groupFrameSettingsWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="generalGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>General</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="loadThreadCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Load posts in background (Thread)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -24,18 +52,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QGroupBox" name="tabsGroupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Tabs</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="GroupFrameSettingsWidget" name="groupFrameSettingsWidget" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
@ -968,6 +968,17 @@ void RshareSettings::setForumLoadEmbeddedImages(bool value)
|
|||||||
setValueToGroup("Forum", "LoadEmbeddedImages", value);
|
setValueToGroup("Forum", "LoadEmbeddedImages", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Channel */
|
||||||
|
bool RshareSettings::getChannelLoadThread()
|
||||||
|
{
|
||||||
|
return valueFromGroup("Channel", "LoadThread", true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RshareSettings::setChannelLoadThread(bool value)
|
||||||
|
{
|
||||||
|
setValueToGroup("Channel", "LoadThread", value);
|
||||||
|
}
|
||||||
|
|
||||||
/* GroupFrame settings */
|
/* GroupFrame settings */
|
||||||
static QString groupFrameSettingsTypeToString(GroupFrameSettings::Type type)
|
static QString groupFrameSettingsTypeToString(GroupFrameSettings::Type type)
|
||||||
{
|
{
|
||||||
|
@ -292,6 +292,10 @@ public:
|
|||||||
bool getForumLoadEmbeddedImages();
|
bool getForumLoadEmbeddedImages();
|
||||||
void setForumLoadEmbeddedImages(bool value);
|
void setForumLoadEmbeddedImages(bool value);
|
||||||
|
|
||||||
|
/* Channel */
|
||||||
|
bool getChannelLoadThread();
|
||||||
|
void setChannelLoadThread(bool value);
|
||||||
|
|
||||||
/* GroupFrame settings */
|
/* GroupFrame settings */
|
||||||
bool getGroupFrameSettings(GroupFrameSettings::Type type, GroupFrameSettings &groupFrameSettings);
|
bool getGroupFrameSettings(GroupFrameSettings::Type type, GroupFrameSettings &groupFrameSettings);
|
||||||
void setGroupFrameSettings(GroupFrameSettings::Type type, const GroupFrameSettings &groupFrameSettings);
|
void setGroupFrameSettings(GroupFrameSettings::Type type, const GroupFrameSettings &groupFrameSettings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user