|
|
|
@ -57,7 +57,6 @@
@@ -57,7 +57,6 @@
|
|
|
|
|
PeerListWidget::PeerListWidget(PropertiesWidget *parent) |
|
|
|
|
: QTreeView(parent) |
|
|
|
|
, m_properties(parent) |
|
|
|
|
, m_resolveCountries(false) |
|
|
|
|
{ |
|
|
|
|
// Load settings
|
|
|
|
|
loadSettings(); |
|
|
|
@ -91,9 +90,9 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
@@ -91,9 +90,9 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
|
|
|
|
|
setModel(m_proxyModel); |
|
|
|
|
hideColumn(PeerListDelegate::IP_HIDDEN); |
|
|
|
|
hideColumn(PeerListDelegate::COL_COUNT); |
|
|
|
|
if (!Preferences::instance()->resolvePeerCountries()) |
|
|
|
|
m_resolveCountries = Preferences::instance()->resolvePeerCountries(); |
|
|
|
|
if (!m_resolveCountries) |
|
|
|
|
hideColumn(PeerListDelegate::COUNTRY); |
|
|
|
|
m_wasCountryColHidden = isColumnHidden(PeerListDelegate::COUNTRY); |
|
|
|
|
//Ensure that at least one column is visible at all times
|
|
|
|
|
bool atLeastOne = false; |
|
|
|
|
for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; i++) { |
|
|
|
@ -108,7 +107,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
@@ -108,7 +107,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
|
|
|
|
|
//its size is 0, because explicitly 'showing' the column isn't enough
|
|
|
|
|
//in the above scenario.
|
|
|
|
|
for (unsigned int i = 0; i < PeerListDelegate::IP_HIDDEN; i++) |
|
|
|
|
if (!columnWidth(i)) |
|
|
|
|
if ((columnWidth(i) <= 0) && !isColumnHidden(i)) |
|
|
|
|
resizeColumnToContents(i); |
|
|
|
|
// Context menu
|
|
|
|
|
setContextMenuPolicy(Qt::CustomContextMenu); |
|
|
|
@ -208,14 +207,12 @@ void PeerListWidget::updatePeerCountryResolutionState()
@@ -208,14 +207,12 @@ void PeerListWidget::updatePeerCountryResolutionState()
|
|
|
|
|
m_resolveCountries = !m_resolveCountries; |
|
|
|
|
if (m_resolveCountries) { |
|
|
|
|
loadPeers(m_properties->getCurrentTorrent()); |
|
|
|
|
if (!m_wasCountryColHidden) { |
|
|
|
|
showColumn(PeerListDelegate::COUNTRY); |
|
|
|
|
showColumn(PeerListDelegate::COUNTRY); |
|
|
|
|
if (columnWidth(PeerListDelegate::COUNTRY) <= 0) |
|
|
|
|
resizeColumnToContents(PeerListDelegate::COUNTRY); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
hideColumn(PeerListDelegate::COUNTRY); |
|
|
|
|
m_wasCountryColHidden = false; // to forcefully enable that column if the user decides to resolve countries again
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|