mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
proper loading/saving of onLineFriendsOnTop and showOffLineFriends
This commit is contained in:
parent
e750a3fced
commit
30e59133cb
@ -213,7 +213,7 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
|||||||
|
|
||||||
/* Set sort */
|
/* Set sort */
|
||||||
sortColumn(RsFriendListModel::COLUMN_THREAD_NAME, Qt::AscendingOrder);
|
sortColumn(RsFriendListModel::COLUMN_THREAD_NAME, Qt::AscendingOrder);
|
||||||
toggleSortByState(false);
|
|
||||||
// workaround for Qt bug, should be solved in next Qt release 4.7.0
|
// workaround for Qt bug, should be solved in next Qt release 4.7.0
|
||||||
// http://bugreports.qt.nokia.com/browse/QTBUG-8270
|
// http://bugreports.qt.nokia.com/browse/QTBUG-8270
|
||||||
QShortcut *Shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), ui->peerTreeWidget, 0, 0, Qt::WidgetShortcut);
|
QShortcut *Shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), ui->peerTreeWidget, 0, 0, Qt::WidgetShortcut);
|
||||||
@ -236,6 +236,8 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
|||||||
QHeaderView *h = ui->peerTreeWidget->header();
|
QHeaderView *h = ui->peerTreeWidget->header();
|
||||||
h->setContextMenuPolicy(Qt::CustomContextMenu);
|
h->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
|
processSettings(true);
|
||||||
|
|
||||||
connect(ui->peerTreeWidget->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumn(int,Qt::SortOrder)));
|
connect(ui->peerTreeWidget->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumn(int,Qt::SortOrder)));
|
||||||
|
|
||||||
connect(ui->peerTreeWidget, SIGNAL(expanded(const QModelIndex&)), this, SLOT(itemExpanded(const QModelIndex&)));
|
connect(ui->peerTreeWidget, SIGNAL(expanded(const QModelIndex&)), this, SLOT(itemExpanded(const QModelIndex&)));
|
||||||
@ -473,20 +475,26 @@ void NewFriendList::processSettings(bool load)
|
|||||||
if (load) // load settings
|
if (load) // load settings
|
||||||
{
|
{
|
||||||
std::cerr <<"Re-loading settings..." << std::endl;
|
std::cerr <<"Re-loading settings..." << std::endl;
|
||||||
|
// sort
|
||||||
|
mProxyModel->setSortByState( Settings->value("sortByState", mProxyModel->sortByState()).toBool());
|
||||||
|
mProxyModel->setShowOfflineNodes(!Settings->value("hideUnconnected", !mProxyModel->showOfflineNodes()).toBool());
|
||||||
|
|
||||||
|
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||||
|
std::cerr << "Loading sortByState=" << mProxyModel->sortByState() << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
// states
|
// states
|
||||||
setShowUnconnected(!Settings->value("hideUnconnected", !mProxyModel->showOfflineNodes()).toBool());
|
setShowUnconnected(!Settings->value("hideUnconnected", !mProxyModel->showOfflineNodes()).toBool());
|
||||||
setShowState(Settings->value("showState", mModel->getDisplayStatusString()).toBool());
|
|
||||||
setShowGroups(Settings->value("showGroups", mModel->getDisplayGroups()).toBool());
|
mModel->setDisplayStatusString(Settings->value("showState", mModel->getDisplayStatusString()).toBool());
|
||||||
|
mModel->setDisplayGroups(Settings->value("showGroups", mModel->getDisplayGroups()).toBool());
|
||||||
|
|
||||||
setColumnVisible(RsFriendListModel::COLUMN_THREAD_IP,Settings->value("showIP", isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP)).toBool());
|
setColumnVisible(RsFriendListModel::COLUMN_THREAD_IP,Settings->value("showIP", isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP)).toBool());
|
||||||
setColumnVisible(RsFriendListModel::COLUMN_THREAD_ID,Settings->value("showID", isColumnVisible(RsFriendListModel::COLUMN_THREAD_ID)).toBool());
|
setColumnVisible(RsFriendListModel::COLUMN_THREAD_ID,Settings->value("showID", isColumnVisible(RsFriendListModel::COLUMN_THREAD_ID)).toBool());
|
||||||
setColumnVisible(RsFriendListModel::COLUMN_THREAD_LAST_CONTACT,Settings->value("showLastContact", isColumnVisible(RsFriendListModel::COLUMN_THREAD_LAST_CONTACT)).toBool());
|
setColumnVisible(RsFriendListModel::COLUMN_THREAD_LAST_CONTACT,Settings->value("showLastContact", isColumnVisible(RsFriendListModel::COLUMN_THREAD_LAST_CONTACT)).toBool());
|
||||||
ui->peerTreeWidget->header()->restoreState(Settings->value("headers").toByteArray());
|
ui->peerTreeWidget->header()->restoreState(Settings->value("headers").toByteArray());
|
||||||
|
|
||||||
// sort
|
// open groups
|
||||||
toggleSortByState(Settings->value("sortByState", mProxyModel->sortByState()).toBool());
|
|
||||||
|
|
||||||
// open groups
|
|
||||||
int arrayIndex = Settings->beginReadArray("Groups");
|
int arrayIndex = Settings->beginReadArray("Groups");
|
||||||
for (int index = 0; index < arrayIndex; ++index) {
|
for (int index = 0; index < arrayIndex; ++index) {
|
||||||
Settings->setArrayIndex(index);
|
Settings->setArrayIndex(index);
|
||||||
@ -511,8 +519,9 @@ void NewFriendList::processSettings(bool load)
|
|||||||
|
|
||||||
// sort
|
// sort
|
||||||
Settings->setValue("sortByState", mProxyModel->sortByState());
|
Settings->setValue("sortByState", mProxyModel->sortByState());
|
||||||
|
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||||
Settings->endArray();
|
std::cerr << "Saving sortByState=" << mProxyModel->sortByState() << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,6 +529,7 @@ void NewFriendList::toggleSortByState(bool sort)
|
|||||||
{
|
{
|
||||||
mProxyModel->setSortByState(sort);
|
mProxyModel->setSortByState(sort);
|
||||||
mProxyModel->setFilterRegExp(QRegExp(QString(RsFriendListModel::FilterString))) ;// triggers a re-display.
|
mProxyModel->setFilterRegExp(QRegExp(QString(RsFriendListModel::FilterString))) ;// triggers a re-display.
|
||||||
|
processSettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewFriendList::changeEvent(QEvent *e)
|
void NewFriendList::changeEvent(QEvent *e)
|
||||||
@ -1605,11 +1615,13 @@ void NewFriendList::toggleColumnVisible()
|
|||||||
void NewFriendList::setShowState(bool show)
|
void NewFriendList::setShowState(bool show)
|
||||||
{
|
{
|
||||||
applyWhileKeepingTree([show,this]() { mModel->setDisplayStatusString(show) ; });
|
applyWhileKeepingTree([show,this]() { mModel->setDisplayStatusString(show) ; });
|
||||||
|
processSettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewFriendList::setShowGroups(bool show)
|
void NewFriendList::setShowGroups(bool show)
|
||||||
{
|
{
|
||||||
applyWhileKeepingTree([show,this]() { mModel->setDisplayGroups(show) ; });
|
applyWhileKeepingTree([show,this]() { mModel->setDisplayGroups(show) ; });
|
||||||
|
processSettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user