mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Moved checkbox for news feed sort order from settings to NewsFeed
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7852 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2b0bdc73bb
commit
32c9fe7eca
@ -108,10 +108,14 @@ NewsFeed::NewsFeed(QWidget *parent) :
|
||||
|
||||
ui->feedWidget->enableRemove(true);
|
||||
|
||||
ui->sortComboBox->addItem(tr("Newest on top"), Qt::DescendingOrder);
|
||||
ui->sortComboBox->addItem(tr("Oldest on top"), Qt::AscendingOrder);
|
||||
|
||||
connect(ui->sortComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sortChanged(int)));
|
||||
|
||||
connect(ui->removeAllButton, SIGNAL(clicked()), ui->feedWidget, SLOT(clear()));
|
||||
connect(ui->feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions()));
|
||||
connect(ui->feedWidget, SIGNAL(feedCountChanged()), this, SLOT(sendNewsFeedChanged()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||
|
||||
QString hlp_str = tr(
|
||||
" <h1><img width=\"32\" src=\":/images/64px_help.png\"> News Feed</h1> \
|
||||
@ -129,11 +133,15 @@ QString hlp_str = tr(
|
||||
|
||||
registerHelpButton(ui->helpButton,hlp_str) ;
|
||||
|
||||
settingsChanged();
|
||||
// load settings
|
||||
processSettings(true);
|
||||
}
|
||||
|
||||
NewsFeed::~NewsFeed()
|
||||
{
|
||||
// save settings
|
||||
processSettings(false);
|
||||
|
||||
if (instance == this) {
|
||||
instance = NULL;
|
||||
}
|
||||
@ -154,9 +162,31 @@ UserNotify *NewsFeed::getUserNotify(QObject *parent)
|
||||
return new NewsFeedUserNotify(this, parent);
|
||||
}
|
||||
|
||||
void NewsFeed::settingsChanged()
|
||||
void NewsFeed::processSettings(bool load)
|
||||
{
|
||||
ui->feedWidget->setSortRole(ROLE_RECEIVED, Settings->getAddFeedsAtEnd() ? Qt::AscendingOrder : Qt::DescendingOrder);
|
||||
Settings->beginGroup("NewsFeed");
|
||||
|
||||
if (load) {
|
||||
// load settings
|
||||
|
||||
// state of sort order
|
||||
Qt::SortOrder sortOrder = (Qt::SortOrder) Settings->value("SortOrder", Qt::AscendingOrder).toInt();
|
||||
ui->sortComboBox->setCurrentIndex(ui->sortComboBox->findData(sortOrder));
|
||||
sortChanged(ui->sortComboBox->currentIndex());
|
||||
} else {
|
||||
// save settings
|
||||
|
||||
// state of sort order
|
||||
Settings->setValue("SortOrder", ui->sortComboBox->itemData(ui->sortComboBox->currentIndex()).toInt());
|
||||
}
|
||||
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
void NewsFeed::sortChanged(int index)
|
||||
{
|
||||
Qt::SortOrder sortOrder = (Qt::SortOrder) ui->sortComboBox->itemData(index).toInt();
|
||||
ui->feedWidget->setSortRole(ROLE_RECEIVED, sortOrder);
|
||||
}
|
||||
|
||||
void NewsFeed::updateDisplay()
|
||||
@ -735,7 +765,7 @@ void NewsFeed::addFeedItem(FeedItem *item)
|
||||
|
||||
// costly, but not really a problem here
|
||||
int feedItemCount;
|
||||
bool fromTop = Settings->getAddFeedsAtEnd();
|
||||
bool fromTop = (ui->sortComboBox->itemData(ui->sortComboBox->currentIndex()).toInt() == Qt::AscendingOrder);
|
||||
|
||||
while ((feedItemCount = ui->feedWidget->feedItemCount()) >= MAX_FEEDITEM_COUNT) {
|
||||
FeedItem *feedItem = ui->feedWidget->feedItem(fromTop ? 0 : feedItemCount - 1);
|
||||
|
@ -69,13 +69,15 @@ signals:
|
||||
void newsFeedChanged(int count);
|
||||
|
||||
protected:
|
||||
void processSettings(bool load);
|
||||
|
||||
/* TokenResponse */
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
private slots:
|
||||
// void toggleChanMsgItems(bool on);
|
||||
void feedoptions();
|
||||
void settingsChanged();
|
||||
void sortChanged(int index);
|
||||
|
||||
void sendNewsFeedChanged();
|
||||
|
||||
|
@ -77,6 +77,9 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="sortComboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="feedOptionsButton">
|
||||
<property name="text">
|
||||
|
@ -198,8 +198,6 @@ NotifyPage::save(QString &/*errmsg*/)
|
||||
MainWindow::installGroupChatNotifier();
|
||||
MainWindow::installNotifyIcons();
|
||||
|
||||
Settings->setAddFeedsAtEnd(ui.addFeedsAtEnd->isChecked());
|
||||
|
||||
int index = ui.comboBoxToasterPosition->currentIndex();
|
||||
if (index != -1) {
|
||||
Settings->setToasterPosition((RshareSettings::enumToasterPosition) ui.comboBoxToasterPosition->itemData(index).toInt());
|
||||
@ -244,8 +242,6 @@ void NotifyPage::load()
|
||||
ui.systray_GroupChat->setChecked(Settings->getDisplayTrayGroupChat());
|
||||
ui.systray_ChatLobby->setChecked(Settings->getDisplayTrayChatLobby());
|
||||
|
||||
ui.addFeedsAtEnd->setChecked(Settings->getAddFeedsAtEnd());
|
||||
|
||||
ui.pushButtonDisableAll->setChecked(NotifyQt::isAllDisable());
|
||||
|
||||
RshareSettings::enumToasterPosition toasterPosition = Settings->getToasterPosition();
|
||||
|
@ -86,20 +86,6 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="feedLayout"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="addFeedsAtEnd">
|
||||
<property name="text">
|
||||
<string>Add feeds at end</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -486,16 +486,6 @@ void RshareSettings::setDisplayTrayGroupChat(bool bValue)
|
||||
setValue("DisplayTrayGroupChat", bValue);
|
||||
}
|
||||
|
||||
bool RshareSettings::getAddFeedsAtEnd()
|
||||
{
|
||||
return value("AddFeedsAtEnd").toBool();
|
||||
}
|
||||
|
||||
void RshareSettings::setAddFeedsAtEnd(bool bValue)
|
||||
{
|
||||
setValue("AddFeedsAtEnd", bValue);
|
||||
}
|
||||
|
||||
bool RshareSettings::getChatSendMessageWithCtrlReturn()
|
||||
{
|
||||
return valueFromGroup("Chat", "SendMessageWithCtrlReturn", false).toBool();
|
||||
|
@ -199,9 +199,6 @@ public:
|
||||
bool getDisplayTrayGroupChat();
|
||||
void setDisplayTrayGroupChat(bool bValue);
|
||||
|
||||
bool getAddFeedsAtEnd();
|
||||
void setAddFeedsAtEnd(bool bValue);
|
||||
|
||||
bool getChatSendMessageWithCtrlReturn();
|
||||
void setChatSendMessageWithCtrlReturn(bool bValue);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user