From e67412cc8c56e3dcbcee461da8e00883bbadd5b9 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Wed, 1 Sep 2010 20:54:24 +0000 Subject: [PATCH] New setting for adding the feeds at the end in friend storm. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3422 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/NewsFeed.cpp | 41 +++++++++++-------- retroshare-gui/src/gui/NewsFeed.h | 1 + .../src/gui/settings/NotifyPage.cpp | 6 +-- retroshare-gui/src/gui/settings/NotifyPage.ui | 14 +++++++ .../src/gui/settings/rsharesettings.cpp | 11 +++++ .../src/gui/settings/rsharesettings.h | 3 ++ 6 files changed, 55 insertions(+), 21 deletions(-) diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index 0c71ffe52..43f893754 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -155,6 +155,15 @@ void NewsFeed::updateFeed() } } +void NewsFeed::addFeedItem(QWidget *item) +{ + if (Settings->getAddFeedsAtEnd()) { + verticalLayout->addWidget(item); + } else { + verticalLayout->insertWidget(0, item); + } +} + void NewsFeed::addFeedItemPeerConnect(RsFeedItem &fi) { /* make new widget */ @@ -163,7 +172,7 @@ void NewsFeed::addFeedItemPeerConnect(RsFeedItem &fi) /* store */ /* add to layout */ - verticalLayout->insertWidget(0, pi); + addFeedItem(pi); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemPeerConnect()"; @@ -181,9 +190,7 @@ void NewsFeed::addFeedItemPeerDisconnect(RsFeedItem &fi) /* store */ /* add to layout */ - verticalLayout->insertWidget(0, pi); - - + addFeedItem(pi); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemPeerDisconnect()"; @@ -200,8 +207,7 @@ void NewsFeed::addFeedItemPeerHello(RsFeedItem &fi) /* store */ /* add to layout */ - verticalLayout->insertWidget(0, pi); - + addFeedItem(pi); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemPeerHello()"; @@ -218,7 +224,7 @@ void NewsFeed::addFeedItemPeerNew(RsFeedItem &fi) /* store */ /* add to layout */ - verticalLayout->insertWidget(0, pi); + addFeedItem(pi); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemPeerNew()"; @@ -235,7 +241,7 @@ void NewsFeed::addFeedItemChanNew(RsFeedItem &fi) /* store in list */ /* add to layout */ - verticalLayout->insertWidget(0, cni); + addFeedItem(cni); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemChanNew()"; @@ -252,7 +258,7 @@ void NewsFeed::addFeedItemChanUpdate(RsFeedItem &fi) /* store in list */ /* add to layout */ - verticalLayout->insertWidget(0, cni); + addFeedItem(cni); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemChanUpdate()"; @@ -269,7 +275,7 @@ void NewsFeed::addFeedItemChanMsg(RsFeedItem &fi) /* store in forum list */ /* add to layout */ - verticalLayout->insertWidget(0, cm); + addFeedItem(cm); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemChanMsg()"; @@ -287,8 +293,7 @@ void NewsFeed::addFeedItemForumNew(RsFeedItem &fi) mForumNewItems.push_back(fni); /* add to layout */ - verticalLayout->insertWidget(0, fni); - + addFeedItem(fni); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemForumNew()"; @@ -306,7 +311,7 @@ void NewsFeed::addFeedItemForumUpdate(RsFeedItem &fi) mForumNewItems.push_back(fni); /* add to layout */ - verticalLayout->insertWidget(0, fni); + addFeedItem(fni); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemForumUpdate()"; @@ -323,7 +328,7 @@ void NewsFeed::addFeedItemForumMsg(RsFeedItem &fi) /* store in forum list */ /* add to layout */ - verticalLayout->insertWidget(0, fm); + addFeedItem(fm); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemForumMsg()"; @@ -340,7 +345,7 @@ void NewsFeed::addFeedItemBlogNew(RsFeedItem &fi) /* store in list */ /* add to layout */ - verticalLayout->insertWidget(0, bni); + addFeedItem(bni); #endif #ifdef NEWS_DEBUG @@ -358,7 +363,7 @@ void NewsFeed::addFeedItemBlogMsg(RsFeedItem &fi) /* store in forum list */ /* add to layout */ - verticalLayout->insertWidget(0, bm); + addFeedItem(bm); #endif #ifdef NEWS_DEBUG @@ -386,7 +391,7 @@ void NewsFeed::addFeedItemChatNew(RsFeedItem &fi) /* store in forum list */ /* add to layout */ - verticalLayout->insertWidget(0, cm); + addFeedItem(cm); } void NewsFeed::addFeedItemMessage(RsFeedItem &fi) @@ -397,7 +402,7 @@ void NewsFeed::addFeedItemMessage(RsFeedItem &fi) /* store in list */ /* add to layout */ - verticalLayout->insertWidget(0, mi); + addFeedItem(mi); #ifdef NEWS_DEBUG std::cerr << "NewsFeed::addFeedItemMessage()"; diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h index 93bb23bed..a33f84a24 100644 --- a/retroshare-gui/src/gui/NewsFeed.h +++ b/retroshare-gui/src/gui/NewsFeed.h @@ -51,6 +51,7 @@ private slots: void updateFeed(); private: + void addFeedItem(QWidget *item); void addFeedItemPeerConnect(RsFeedItem &fi); void addFeedItemPeerDisconnect(RsFeedItem &fi); diff --git a/retroshare-gui/src/gui/settings/NotifyPage.cpp b/retroshare-gui/src/gui/settings/NotifyPage.cpp index 819a65ac1..07b31d470 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.cpp +++ b/retroshare-gui/src/gui/settings/NotifyPage.cpp @@ -113,6 +113,8 @@ NotifyPage::save(QString &errmsg) Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked()); MainWindow::installGroupChatNotifier(); + Settings->setAddFeedsAtEnd(ui.addFeedsAtEnd->isChecked()); + load(); return true; } @@ -128,7 +130,6 @@ void NotifyPage::load() ui.popup_Connect->setChecked(notifyflags & RS_POPUP_CONNECT); ui.popup_NewMsg->setChecked(notifyflags & RS_POPUP_MSG); - ui.systray_GroupChat->setChecked(true) ; //ui.popup_NewChat->setChecked(notifyflags & RS_POPUP_CHAT); //ui.popup_Call->setChecked(notifyflags & RS_POPUP_CALL); @@ -146,8 +147,7 @@ void NotifyPage::load() ui.systray_GroupChat->setChecked(Settings->getDisplayTrayGroupChat()); - /* disable ones that don't work yet */ - + ui.addFeedsAtEnd->setChecked(Settings->getAddFeedsAtEnd()); } diff --git a/retroshare-gui/src/gui/settings/NotifyPage.ui b/retroshare-gui/src/gui/settings/NotifyPage.ui index ee2572b5f..54455c3a7 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.ui +++ b/retroshare-gui/src/gui/settings/NotifyPage.ui @@ -558,6 +558,20 @@ + + + + Qt::Horizontal + + + + + + + Add feeds at end + + + diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 429c28e38..5c6fab44a 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -136,6 +136,7 @@ void RshareSettings::initSettings() setDefault(SETTING_NOTIFY_FLAGS, defNotify); setDefault("DisplayTrayGroupChat", true); + setDefault("AddFeedsAtEnd", false); } /** Gets/sets the currently saved chat avatar. */ @@ -278,6 +279,16 @@ void RshareSettings::setDisplayTrayGroupChat(bool bValue) setValue("DisplayTrayGroupChat", bValue); } +bool RshareSettings::getAddFeedsAtEnd() +{ + return value("AddFeedsAtEnd").toBool(); +} + +void RshareSettings::setAddFeedsAtEnd(bool bValue) +{ + setValue("AddFeedsAtEnd", bValue); +} + /** Returns true if RetroShare is set to run on system boot. */ bool RshareSettings::runRetroshareOnBoot() diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h index c10688009..0e145590f 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.h +++ b/retroshare-gui/src/gui/settings/rsharesettings.h @@ -117,6 +117,9 @@ public: bool getDisplayTrayGroupChat(); void setDisplayTrayGroupChat(bool bValue); + bool getAddFeedsAtEnd(); + void setAddFeedsAtEnd(bool bValue); + //! Save placement, state and size information of a window. void saveWidgetInformation(QWidget *widget);