Reworked/fixed some settings.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7469 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-07-24 16:52:11 +00:00
parent 42e579a294
commit d355e8dd88
7 changed files with 558 additions and 557 deletions

View File

@ -87,9 +87,11 @@ PostedListWidget::~PostedListWidget()
{
// save settings
processSettings(false);
delete(ui);
}
void PostedListWidget::processSettings(bool load)
void PostedListWidget::processSettings(bool /*load*/)
{
// Settings->beginGroup(QString("PostedListWidget"));
//

View File

@ -53,7 +53,7 @@ private:
/* GxsGroupFrameDialog */
virtual QString text(TextType type);
virtual QString icon(IconType type);
virtual QString settingsGroupName() { return "GxsChannelDialog"; }
virtual QString settingsGroupName() { return "ChannelDialog"; }
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue);
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
virtual int shareKeyType();

View File

@ -107,12 +107,14 @@ GxsChannelPostsWidget::~GxsChannelPostsWidget()
processSettings(false);
delete(mAutoDownloadAction);
delete ui;
}
void GxsChannelPostsWidget::processSettings(bool load)
void GxsChannelPostsWidget::processSettings(bool /*load*/)
{
mInProcessSettings = true;
// Settings->beginGroup(QString("GxsChannelDialog"));
// Settings->beginGroup(QString("ChannelPostsWidget"));
//
// if (load) {
// // load settings

View File

@ -210,6 +210,9 @@ GxsForumThreadWidget::~GxsForumThreadWidget()
mFillThread = NULL;
}
// save settings
processSettings(false);
delete ui;
// delete(mTimer);
@ -223,7 +226,7 @@ void GxsForumThreadWidget::processSettings(bool load)
QHeaderView *header = ui->threadTreeWidget->header();
Settings->beginGroup(QString("GxsForumsDialog"));
Settings->beginGroup(QString("ForumThreadWidget"));
if (load) {
// load settings
@ -449,7 +452,7 @@ bool GxsForumThreadWidget::eventFilter(QObject *obj, QEvent *event)
void GxsForumThreadWidget::togglethreadview()
{
// save state of button
Settings->setValueToGroup("GxsForumsDialog", "expandButton", ui->expandButton->isChecked());
Settings->setValueToGroup("ForumThreadWidget", "expandButton", ui->expandButton->isChecked());
togglethreadview_internal();
}
@ -873,7 +876,7 @@ void GxsForumThreadWidget::insertThreads()
{
#ifdef DEBUG_FORUMS
/* get the current Forum */
std::cerr << "GxsForumsDialog::insertThreads()" << std::endl;
std::cerr << "GxsForumThreadWidget::insertThreads()" << std::endl;
#endif
if (mFillThread) {
@ -905,7 +908,7 @@ void GxsForumThreadWidget::insertThreads()
mLastForumID.clear();
#ifdef DEBUG_FORUMS
std::cerr << "GxsForumsDialog::insertThreads() Current Thread Invalid" << std::endl;
std::cerr << "GxsForumThreadWidget::insertThreads() Current Thread Invalid" << std::endl;
#endif
return;
@ -927,7 +930,7 @@ void GxsForumThreadWidget::insertForumThreads(const RsGxsForumGroup &group)
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, true);
#ifdef DEBUG_FORUMS
std::cerr << "GxsForumsDialog::insertThreads() Start filling Forum threads" << std::endl;
std::cerr << "GxsForumThreadWidget::insertThreads() Start filling Forum threads" << std::endl;
#endif
// create fill thread
@ -978,7 +981,7 @@ void GxsForumThreadWidget::insertForumThreads(const RsGxsForumGroup &group)
void GxsForumThreadWidget::fillThreads(QList<QTreeWidgetItem *> &threadList, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand)
{
#ifdef DEBUG_FORUMS
std::cerr << "GxsForumsDialog::fillThreads()" << std::endl;
std::cerr << "GxsForumThreadWidget::fillThreads()" << std::endl;
#endif
int index = 0;
@ -1050,7 +1053,7 @@ void GxsForumThreadWidget::fillThreads(QList<QTreeWidgetItem *> &threadList, boo
}
#ifdef DEBUG_FORUMS
std::cerr << "GxsForumsDialog::fillThreads() done" << std::endl;
std::cerr << "GxsForumThreadWidget::fillThreads() done" << std::endl;
#endif
}
@ -1192,7 +1195,7 @@ void GxsForumThreadWidget::insertPostData(const RsGxsForumMsg &msg)
if ((msg.mMeta.mGroupId != mForumId) || (msg.mMeta.mMsgId != mThreadId))
{
std::cerr << "GxsForumsDialog::insertPostData() Ignoring Invalid Data....";
std::cerr << "GxsForumThreadWidget::insertPostData() Ignoring Invalid Data....";
std::cerr << std::endl;
std::cerr << "\t CurrForumId: " << mForumId << " != msg.GroupId: " << msg.mMeta.mGroupId;
std::cerr << std::endl;
@ -1333,13 +1336,13 @@ void GxsForumThreadWidget::nextUnreadMessage()
// TODO
#if 0
void GxsForumsDialog::removemessage()
void GxsForumThreadWidget::removemessage()
{
//std::cerr << "GxsForumsDialog::removemessage()" << std::endl;
//std::cerr << "GxsForumThreadWidget::removemessage()" << std::endl;
std::string cid, mid;
if (!getCurrentMsg(cid, mid))
{
//std::cerr << "GxsForumsDialog::removemessage()";
//std::cerr << "GxsForumThreadWidget::removemessage()";
//std::cerr << " No Message selected" << std::endl;
return;
}
@ -1569,14 +1572,14 @@ static QString buildReplyHeader(const RsMsgMetaData &meta)
link.createMessage(meta.mAuthorId, "");
QString from = link.toHtml();
QString header = QString("<span>-----%1-----").arg(QApplication::translate("GxsForumsDialog", "Original Message"));
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("GxsForumsDialog", "From"), from);
QString header = QString("<span>-----%1-----").arg(QApplication::translate("GxsForumThreadWidget", "Original Message"));
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("GxsForumThreadWidget", "From"), from);
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("GxsForumsDialog", "Sent"), DateTime::formatLongDateTime(meta.mPublishTs));
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(QApplication::translate("GxsForumsDialog", "Subject"), QString::fromUtf8(meta.mMsgName.c_str()));
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("GxsForumThreadWidget", "Sent"), DateTime::formatLongDateTime(meta.mPublishTs));
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(QApplication::translate("GxsForumThreadWidget", "Subject"), QString::fromUtf8(meta.mMsgName.c_str()));
header += "<br>";
header += QApplication::translate("GxsForumsDialog", "On %1, %2 wrote:").arg(DateTime::formatDateTime(meta.mPublishTs), from);
header += QApplication::translate("GxsForumThreadWidget", "On %1, %2 wrote:").arg(DateTime::formatDateTime(meta.mPublishTs), from);
return header;
}
@ -1597,7 +1600,7 @@ void GxsForumThreadWidget::replyMessageData(const RsGxsForumMsg &msg)
{
if ((msg.mMeta.mGroupId != mForumId) || (msg.mMeta.mMsgId != mThreadId))
{
std::cerr << "GxsForumsDialog::replyMessageData() ERROR Message Ids have changed!";
std::cerr << "GxsForumThreadWidget::replyMessageData() ERROR Message Ids have changed!";
std::cerr << std::endl;
return;
}
@ -1628,7 +1631,7 @@ void GxsForumThreadWidget::changedViewBox()
}
// save index
Settings->setValueToGroup("GxsForumsDialog", "viewBox", ui->viewBox->currentIndex());
Settings->setValueToGroup("ForumThreadWidget", "viewBox", ui->viewBox->currentIndex());
ui->threadTreeWidget->clear();
@ -1649,7 +1652,7 @@ void GxsForumThreadWidget::filterColumnChanged(int column)
}
// save index
Settings->setValueToGroup("GxsForumsDialog", "filterColumn", column);
Settings->setValueToGroup("ForumThreadWidget", "filterColumn", column);
}
void GxsForumThreadWidget::filterItems(const QString& text)
@ -1708,7 +1711,7 @@ void GxsForumThreadWidget::requestGroup_CurrentForum()
std::list<RsGxsGroupId> grpIds;
grpIds.push_back(mForumId);
std::cerr << "GxsForumsDialog::requestGroup_CurrentForum(" << mForumId << ")";
std::cerr << "GxsForumThreadWidget::requestGroup_CurrentForum(" << mForumId << ")";
std::cerr << std::endl;
uint32_t token;
@ -1717,7 +1720,7 @@ void GxsForumThreadWidget::requestGroup_CurrentForum()
void GxsForumThreadWidget::loadGroup_CurrentForum(const uint32_t &token)
{
std::cerr << "GxsForumsDialog::loadGroup_CurrentForum()";
std::cerr << "GxsForumThreadWidget::loadGroup_CurrentForum()";
std::cerr << std::endl;
std::vector<RsGxsForumGroup> groups;
@ -1729,7 +1732,7 @@ void GxsForumThreadWidget::loadGroup_CurrentForum(const uint32_t &token)
}
else
{
std::cerr << "GxsForumsDialog::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups...";
std::cerr << "GxsForumThreadWidget::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups...";
std::cerr << std::endl;
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, false);
@ -1753,7 +1756,7 @@ void GxsForumThreadWidget::requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &ms
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
std::cerr << "GxsForumsDialog::requestMsgData_InsertPost(" << msgId.first << "," << msgId.second << ")";
std::cerr << "GxsForumThreadWidget::requestMsgData_InsertPost(" << msgId.first << "," << msgId.second << ")";
std::cerr << std::endl;
std::vector<RsGxsGrpMsgIdPair> msgIds;
@ -1767,7 +1770,7 @@ void GxsForumThreadWidget::requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &ms
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
std::cerr << "GxsForumsDialog::requestMsgData_InsertPost(" << msgId.first << "," << msgId.second << ")";
std::cerr << "GxsForumThreadWidget::requestMsgData_InsertPost(" << msgId.first << "," << msgId.second << ")";
std::cerr << std::endl;
GxsMsgReq msgIds;
@ -1783,13 +1786,13 @@ void GxsForumThreadWidget::loadMsgData_InsertPost(const uint32_t &token)
{
mStateHelper->setLoading(TOKEN_TYPE_INSERT_POST, false);
std::cerr << "GxsForumsDialog::loadMsgData_InsertPost()";
std::cerr << "GxsForumThreadWidget::loadMsgData_InsertPost()";
std::cerr << std::endl;
std::vector<RsGxsForumMsg> msgs;
if (rsGxsForums->getMsgData(token, msgs)) {
if (msgs.size() != 1) {
std::cerr << "GxsForumsDialog::loadMsgData_InsertPost() ERROR Wrong number of answers";
std::cerr << "GxsForumThreadWidget::loadMsgData_InsertPost() ERROR Wrong number of answers";
std::cerr << std::endl;
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
@ -1797,7 +1800,7 @@ void GxsForumThreadWidget::loadMsgData_InsertPost(const uint32_t &token)
}
insertPostData(msgs[0]);
} else {
std::cerr << "GxsForumsDialog::loadMsgData_InsertPost() ERROR Missing Message Data...";
std::cerr << "GxsForumThreadWidget::loadMsgData_InsertPost() ERROR Missing Message Data...";
std::cerr << std::endl;
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
@ -1813,7 +1816,7 @@ void GxsForumThreadWidget::requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
std::cerr << "GxsForumsDialog::requestMsgData_ReplyMessage(" << msgId.first << "," << msgId.second << ")";
std::cerr << "GxsForumThreadWidget::requestMsgData_ReplyMessage(" << msgId.first << "," << msgId.second << ")";
std::cerr << std::endl;
GxsMsgReq msgIds;
@ -1826,7 +1829,7 @@ void GxsForumThreadWidget::requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &
void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token)
{
std::cerr << "GxsForumsDialog::loadMsgData_ReplyMessage()";
std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage()";
std::cerr << std::endl;
std::vector<RsGxsForumMsg> msgs;
@ -1834,7 +1837,7 @@ void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token)
{
if (msgs.size() != 1)
{
std::cerr << "GxsForumsDialog::loadMsgData_ReplyMessage() ERROR Wrong number of answers";
std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage() ERROR Wrong number of answers";
std::cerr << std::endl;
return;
}
@ -1843,7 +1846,7 @@ void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token)
}
else
{
std::cerr << "GxsForumsDialog::loadMsgData_ReplyMessage() ERROR Missing Message Data...";
std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage() ERROR Missing Message Data...";
std::cerr << std::endl;
}
}
@ -1853,7 +1856,7 @@ void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token)
void GxsForumThreadWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "GxsForumsDialog::loadRequest() UserType: " << req.mUserType;
std::cerr << "GxsForumThreadWidget::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;
if (queue == mThreadQueue)
@ -1874,7 +1877,7 @@ void GxsForumThreadWidget::loadRequest(const TokenQueue *queue, const TokenReque
break;
default:
std::cerr << "GxsForumsDialog::loadRequest() ERROR: INVALID TYPE";
std::cerr << "GxsForumThreadWidget::loadRequest() ERROR: INVALID TYPE";
std::cerr << std::endl;
break;
}

View File

@ -48,7 +48,7 @@ private:
/* GxsGroupFrameDialog */
virtual QString text(TextType type);
virtual QString icon(IconType type);
virtual QString settingsGroupName() { return "GxsForumsDialog"; }
virtual QString settingsGroupName() { return "ForumsDialog"; }
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue);
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
virtual int shareKeyType();

View File

@ -20,8 +20,6 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QDir>
#include <QCoreApplication>
#include <QStyleFactory>
@ -39,7 +37,6 @@
#include <util/win32.h>
#endif
/* Retroshare's Settings */
#define SETTING_LANGUAGE "LanguageCode"
#define SETTING_STYLE "InterfaceStyle"
@ -64,7 +61,6 @@
/* Default Retroshare Settings */
#define DEFAULT_OPACITY 100
#if defined(Q_OS_WIN32)
#define STARTUP_REG_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
#define RETROSHARE_REG_KEY "RetroShare"
@ -135,7 +131,7 @@ void RshareSettings::initSettings()
uint defNotify = (RS_POPUP_CONNECT | RS_POPUP_MSG);
uint defNewsFeed = (RS_FEED_TYPE_PEER |
// RS_FEED_TYPE_CHAN | RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG |
// RS_FEED_TYPE_CHAN | RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG |
RS_FEED_TYPE_CHAT | RS_FEED_TYPE_MSG |
RS_FEED_TYPE_FILES | RS_FEED_TYPE_SECURITY);
@ -531,7 +527,6 @@ void RshareSettings::setChatSendMessageWithCtrlReturn(bool bValue)
setValueToGroup("Chat", "SendMessageWithCtrlReturn", bValue);
}
void RshareSettings::setChatSearchCharToStartSearch(int iValue)
{
setValueToGroup("Chat", "SearchCharToStartSearch", iValue);
@ -571,6 +566,7 @@ bool RshareSettings::getChatSearchMoveToCursor()
{
return valueFromGroup("Chat", "SearchMoveToCursor", true).toBool();
}
void RshareSettings::setChatSearchSearchWithoutLimit(bool bValue)
{
setValueToGroup("Chat", "SearchSearchWithoutLimit", bValue);
@ -790,7 +786,7 @@ bool RshareSettings::canSetRetroShareProtocol()
#endif
}
/** Register retroshare:// as protocl */
/** Register retroshare:// as protocol */
bool RshareSettings::setRetroShareProtocol(bool value)
{
#if defined(Q_WS_WIN)
@ -915,30 +911,30 @@ void RshareSettings::setStatusBarFlag(uint flag, bool enable)
setStatusBarFlags(flags);
}
/* Messages */
/* Message */
bool RshareSettings::getMsgSetToReadOnActivate ()
{
return valueFromGroup("MessageDialog", "SetMsgToReadOnActivate", true).toBool();
return valueFromGroup("Message", "SetMsgToReadOnActivate", true).toBool();
}
void RshareSettings::setMsgSetToReadOnActivate (bool value)
{
setValueToGroup("MessageDialog", "SetMsgToReadOnActivate", value);
setValueToGroup("Message", "SetMsgToReadOnActivate", value);
}
bool RshareSettings::getMsgLoadEmbeddedImages()
{
return valueFromGroup("MessageDialog", "LoadEmbeddedImages", false).toBool();
return valueFromGroup("Message", "LoadEmbeddedImages", false).toBool();
}
void RshareSettings::setMsgLoadEmbeddedImages(bool value)
{
setValueToGroup("MessageDialog", "LoadEmbeddedImages", value);
setValueToGroup("Message", "LoadEmbeddedImages", value);
}
RshareSettings::enumMsgOpen RshareSettings::getMsgOpen()
{
enumMsgOpen value = (enumMsgOpen) valueFromGroup("MessageDialog", "msgOpen", MSG_OPEN_TAB).toInt();
enumMsgOpen value = (enumMsgOpen) valueFromGroup("Message", "msgOpen", MSG_OPEN_TAB).toInt();
switch (value) {
case MSG_OPEN_TAB:
@ -959,30 +955,41 @@ void RshareSettings::setMsgOpen(enumMsgOpen value)
value = MSG_OPEN_TAB;
}
setValueToGroup("MessageDialog", "msgOpen", value);
setValueToGroup("Message", "msgOpen", value);
}
/* Forums */
/* Forum */
bool RshareSettings::getForumMsgSetToReadOnActivate ()
{
return valueFromGroup("ForumDialog", "SetMsgToReadOnActivate", true).toBool();
return valueFromGroup("Forum", "SetMsgToReadOnActivate", true).toBool();
}
void RshareSettings::setForumMsgSetToReadOnActivate(bool value)
{
setValueToGroup("ForumDialog", "SetMsgToReadOnActivate", value);
setValueToGroup("Forum", "SetMsgToReadOnActivate", value);
}
bool RshareSettings::getForumExpandNewMessages()
{
return valueFromGroup("ForumDialog", "ExpandNewMessages", true).toBool();
return valueFromGroup("Forum", "ExpandNewMessages", true).toBool();
}
void RshareSettings::setForumExpandNewMessages(bool value)
{
setValueToGroup("ForumDialog", "ExpandNewMessages", value);
setValueToGroup("Forum", "ExpandNewMessages", value);
}
bool RshareSettings::getForumLoadEmbeddedImages()
{
return valueFromGroup("Forum", "LoadEmbeddedImages", false).toBool();
}
void RshareSettings::setForumLoadEmbeddedImages(bool value)
{
setValueToGroup("Forum", "LoadEmbeddedImages", value);
}
/* GroupFrame settings */
static QString groupFrameSettingsTypeToString(GroupFrameSettings::Type type)
{
switch (type) {
@ -1038,13 +1045,3 @@ void RshareSettings::setMaxTimeBeforeIdle(uint nValue)
m_maxTimeBeforeIdle = nValue;
setValue("maxTimeBeforeIdle", nValue);
}
bool RshareSettings::getForumLoadEmbeddedImages()
{
return valueFromGroup("ForumDialog", "LoadEmbeddedImages", false).toBool();
}
void RshareSettings::setForumLoadEmbeddedImages(bool value)
{
setValueToGroup("ForumDialog", "LoadEmbeddedImages", value);
}

View File

@ -20,7 +20,6 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _RSHARESETTINGS_H
#define _RSHARESETTINGS_H
@ -60,7 +59,6 @@
//Forward declaration.
class QWidget;
class QTableWidget;
class QToolBar;
class QMainWindow;
@ -306,7 +304,7 @@ public:
void setStatusBarFlags(uint flags);
void setStatusBarFlag(uint flag, bool enable);
/* Messages */
/* Message */
bool getMsgSetToReadOnActivate();
void setMsgSetToReadOnActivate(bool value);
bool getMsgLoadEmbeddedImages();
@ -315,7 +313,7 @@ public:
enumMsgOpen getMsgOpen();
void setMsgOpen(enumMsgOpen value);
/* Forums */
/* Forum */
bool getForumMsgSetToReadOnActivate();
void setForumMsgSetToReadOnActivate(bool value);
bool getForumExpandNewMessages();
@ -323,7 +321,7 @@ public:
bool getForumLoadEmbeddedImages();
void setForumLoadEmbeddedImages(bool value);
/* GroupFrameSettings */
/* GroupFrame settings */
bool getGroupFrameSettings(GroupFrameSettings::Type type, GroupFrameSettings &groupFrameSettings);
void setGroupFrameSettings(GroupFrameSettings::Type type, const GroupFrameSettings &groupFrameSettings);
@ -345,4 +343,3 @@ protected:
extern RshareSettings *Settings;
#endif