Fix Save Network Friends Headers Size

This commit is contained in:
Phenom 2020-11-12 18:47:50 +01:00
parent 4a7906376f
commit f8d7bd5d74

View file

@ -171,7 +171,7 @@ private:
bool m_showOfflineNodes; bool m_showOfflineNodes;
}; };
NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent),*/ ui(new Ui::NewFriendList()) NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,parent),*/ ui(new Ui::NewFriendList())
{ {
ui->setupUi(this); ui->setupUi(this);
@ -259,7 +259,7 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent)
} }
void NewFriendList::handleEvent(std::shared_ptr<const RsEvent> e) void NewFriendList::handleEvent(std::shared_ptr<const RsEvent> /*e*/)
{ {
// /!\ The function we're in is called from a different thread. It's very important // /!\ The function we're in is called from a different thread. It's very important
// to use this trick in order to avoid data races. // to use this trick in order to avoid data races.
@ -294,7 +294,7 @@ void NewFriendList::sortColumn(int col,Qt::SortOrder so)
restoreExpandedPathsAndSelection(expanded_indexes, selected_indexes); restoreExpandedPathsAndSelection(expanded_indexes, selected_indexes);
} }
void NewFriendList::headerContextMenuRequested(QPoint p) void NewFriendList::headerContextMenuRequested(QPoint /*p*/)
{ {
QMenu displayMenu(tr("Show Items"), this); QMenu displayMenu(tr("Show Items"), this);
@ -463,6 +463,7 @@ void NewFriendList::processSettings(bool load)
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());
// sort // sort
toggleSortByState(Settings->value("sortByState", mProxyModel->sortByState()).toBool()); toggleSortByState(Settings->value("sortByState", mProxyModel->sortByState()).toBool());
@ -488,6 +489,7 @@ void NewFriendList::processSettings(bool load)
Settings->setValue("showIP",isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP)); Settings->setValue("showIP",isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP));
Settings->setValue("showID",isColumnVisible(RsFriendListModel::COLUMN_THREAD_ID)); Settings->setValue("showID",isColumnVisible(RsFriendListModel::COLUMN_THREAD_ID));
Settings->setValue("showLastContact",isColumnVisible(RsFriendListModel::COLUMN_THREAD_LAST_CONTACT)); Settings->setValue("showLastContact",isColumnVisible(RsFriendListModel::COLUMN_THREAD_LAST_CONTACT));
Settings->setValue("headers",ui->peerTreeWidget->header()->saveState());
// sort // sort
Settings->setValue("sortByState", mProxyModel->sortByState()); Settings->setValue("sortByState", mProxyModel->sortByState());
@ -568,6 +570,8 @@ void NewFriendList::peerTreeWidgetCustomPopupMenu()
//this is a SSL key //this is a SSL key
textLabel->setText("<strong>" + tr("Node") + "</strong>"); textLabel->setText("<strong>" + tr("Node") + "</strong>");
break; break;
default:
textLabel->setText("<strong>" + tr("UNKNOWN TYPE") + "</strong>");
} }
switch (type) switch (type)
@ -695,6 +699,12 @@ void NewFriendList::peerTreeWidgetCustomPopupMenu()
contextMenu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_REMOVEFRIEND), tr("Remove Friend Node"), this, SLOT(removeNode())); contextMenu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_REMOVEFRIEND), tr("Remove Friend Node"), this, SLOT(removeNode()));
} }
break;
default:
{
contextMenu.addSection("Report it to Devs!");
}
} }
} }
@ -722,6 +732,7 @@ void NewFriendList::createNewGroup()
createGrpDialog.exec(); createGrpDialog.exec();
} }
#ifdef NOT_USED
static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay) static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay)
{ {
int avatarWidth = avatar.width(); int avatarWidth = avatar.width();
@ -740,6 +751,7 @@ static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay)
icon.addPixmap(pixmap); icon.addPixmap(pixmap);
return icon; return icon;
} }
#endif
void NewFriendList::addFriend() void NewFriendList::addFriend()
{ {
@ -1199,7 +1211,7 @@ bool NewFriendList::importExportFriendlistFileDialog(QString &fileName, bool imp
, tr("Select a file for exporting your friendlist to") , tr("Select a file for exporting your friendlist to")
, tr("XML File (*.xml);;All Files (*)") , tr("XML File (*.xml);;All Files (*)")
, fileName, NULL , fileName, NULL
, (QFileDialog::Options)0 , QFileDialog::Options()
); );
} }
if ( res && !fileName.endsWith(".xml",Qt::CaseInsensitive) ) if ( res && !fileName.endsWith(".xml",Qt::CaseInsensitive) )