mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-01 15:02:34 +02:00
qt: Add "Alternating Row Color" settings for the Peers Tab
Github-Pull: gui#307 Rebased-From: b124c2fe600b343a2bc66ff8eb0aaf43aa99f4db
This commit is contained in:
parent
55bd5d8015
commit
9166bb76d5
@ -893,9 +893,6 @@
|
|||||||
<property name="tabKeyNavigation">
|
<property name="tabKeyNavigation">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textElideMode">
|
<property name="textElideMode">
|
||||||
<enum>Qt::ElideMiddle</enum>
|
<enum>Qt::ElideMiddle</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -957,9 +954,6 @@
|
|||||||
<property name="tabKeyNavigation">
|
<property name="tabKeyNavigation">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>560</width>
|
<width>646</width>
|
||||||
<height>440</height>
|
<height>529</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -796,6 +796,16 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="peersTabAlternatingRowColors">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Alternate the row colors for the "Peers" and "Banned peers" tables in the Peers tab.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Alternate row colors in the Peers tab</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_Display">
|
<spacer name="verticalSpacer_Display">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -319,6 +319,7 @@ void OptionsDialog::setMapper()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Display */
|
/* Display */
|
||||||
|
mapper->addMapping(ui->peersTabAlternatingRowColors, OptionsModel::PeersTabAlternatingRowColors);
|
||||||
mapper->addMapping(ui->lang, OptionsModel::Language);
|
mapper->addMapping(ui->lang, OptionsModel::Language);
|
||||||
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
|
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
|
||||||
mapper->addMapping(ui->thirdPartyTxUrls, OptionsModel::ThirdPartyTxUrls);
|
mapper->addMapping(ui->thirdPartyTxUrls, OptionsModel::ThirdPartyTxUrls);
|
||||||
|
@ -258,6 +258,12 @@ bool OptionsModel::Init(bilingual_str& error)
|
|||||||
}
|
}
|
||||||
Q_EMIT fontForMoneyChanged(getFontForMoney());
|
Q_EMIT fontForMoneyChanged(getFontForMoney());
|
||||||
|
|
||||||
|
if (!settings.contains("PeersTabAlternatingRowColors")) {
|
||||||
|
settings.setValue("PeersTabAlternatingRowColors", "false");
|
||||||
|
}
|
||||||
|
m_peers_tab_alternating_row_colors = settings.value("PeersTabAlternatingRowColors").toBool();
|
||||||
|
Q_EMIT peersTabAlternatingRowColorsChanged(m_peers_tab_alternating_row_colors);
|
||||||
|
|
||||||
m_mask_values = settings.value("mask_values", false).toBool();
|
m_mask_values = settings.value("mask_values", false).toBool();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -466,6 +472,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
|||||||
return QString::fromStdString(SettingToString(setting(), ""));
|
return QString::fromStdString(SettingToString(setting(), ""));
|
||||||
case FontForMoney:
|
case FontForMoney:
|
||||||
return QVariant::fromValue(m_font_money);
|
return QVariant::fromValue(m_font_money);
|
||||||
|
case PeersTabAlternatingRowColors:
|
||||||
|
return m_peers_tab_alternating_row_colors;
|
||||||
case CoinControlFeatures:
|
case CoinControlFeatures:
|
||||||
return fCoinControlFeatures;
|
return fCoinControlFeatures;
|
||||||
case EnablePSBTControls:
|
case EnablePSBTControls:
|
||||||
@ -649,6 +657,11 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
|||||||
Q_EMIT fontForMoneyChanged(getFontForMoney());
|
Q_EMIT fontForMoneyChanged(getFontForMoney());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PeersTabAlternatingRowColors:
|
||||||
|
m_peers_tab_alternating_row_colors = value.toBool();
|
||||||
|
settings.setValue("PeersTabAlternatingRowColors", m_peers_tab_alternating_row_colors);
|
||||||
|
Q_EMIT peersTabAlternatingRowColorsChanged(m_peers_tab_alternating_row_colors);
|
||||||
|
break;
|
||||||
case CoinControlFeatures:
|
case CoinControlFeatures:
|
||||||
fCoinControlFeatures = value.toBool();
|
fCoinControlFeatures = value.toBool();
|
||||||
settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
|
settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
ThirdPartyTxUrls, // QString
|
ThirdPartyTxUrls, // QString
|
||||||
Language, // QString
|
Language, // QString
|
||||||
FontForMoney, // FontChoice
|
FontForMoney, // FontChoice
|
||||||
|
PeersTabAlternatingRowColors, // bool
|
||||||
CoinControlFeatures, // bool
|
CoinControlFeatures, // bool
|
||||||
SubFeeFromAmount, // bool
|
SubFeeFromAmount, // bool
|
||||||
ThreadsScriptVerif, // int
|
ThreadsScriptVerif, // int
|
||||||
@ -104,6 +105,7 @@ public:
|
|||||||
BitcoinUnit getDisplayUnit() const { return m_display_bitcoin_unit; }
|
BitcoinUnit getDisplayUnit() const { return m_display_bitcoin_unit; }
|
||||||
QString getThirdPartyTxUrls() const { return strThirdPartyTxUrls; }
|
QString getThirdPartyTxUrls() const { return strThirdPartyTxUrls; }
|
||||||
QFont getFontForMoney() const;
|
QFont getFontForMoney() const;
|
||||||
|
bool getPeersTabAlternatingRowColors() const { return m_peers_tab_alternating_row_colors; }
|
||||||
bool getCoinControlFeatures() const { return fCoinControlFeatures; }
|
bool getCoinControlFeatures() const { return fCoinControlFeatures; }
|
||||||
bool getSubFeeFromAmount() const { return m_sub_fee_from_amount; }
|
bool getSubFeeFromAmount() const { return m_sub_fee_from_amount; }
|
||||||
bool getEnablePSBTControls() const { return m_enable_psbt_controls; }
|
bool getEnablePSBTControls() const { return m_enable_psbt_controls; }
|
||||||
@ -131,6 +133,7 @@ private:
|
|||||||
BitcoinUnit m_display_bitcoin_unit;
|
BitcoinUnit m_display_bitcoin_unit;
|
||||||
QString strThirdPartyTxUrls;
|
QString strThirdPartyTxUrls;
|
||||||
FontChoice m_font_money{FontChoiceAbstract::EmbeddedFont};
|
FontChoice m_font_money{FontChoiceAbstract::EmbeddedFont};
|
||||||
|
bool m_peers_tab_alternating_row_colors;
|
||||||
bool fCoinControlFeatures;
|
bool fCoinControlFeatures;
|
||||||
bool m_sub_fee_from_amount;
|
bool m_sub_fee_from_amount;
|
||||||
bool m_enable_psbt_controls;
|
bool m_enable_psbt_controls;
|
||||||
@ -153,6 +156,7 @@ Q_SIGNALS:
|
|||||||
void coinControlFeaturesChanged(bool);
|
void coinControlFeaturesChanged(bool);
|
||||||
void showTrayIconChanged(bool);
|
void showTrayIconChanged(bool);
|
||||||
void fontForMoneyChanged(const QFont&);
|
void fontForMoneyChanged(const QFont&);
|
||||||
|
void peersTabAlternatingRowColorsChanged(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(OptionsModel::FontChoice)
|
Q_DECLARE_METATYPE(OptionsModel::FontChoice)
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <qt/bantablemodel.h>
|
#include <qt/bantablemodel.h>
|
||||||
#include <qt/clientmodel.h>
|
#include <qt/clientmodel.h>
|
||||||
#include <qt/guiutil.h>
|
#include <qt/guiutil.h>
|
||||||
|
#include <qt/optionsmodel.h>
|
||||||
#include <qt/peertablesortproxy.h>
|
#include <qt/peertablesortproxy.h>
|
||||||
#include <qt/platformstyle.h>
|
#include <qt/platformstyle.h>
|
||||||
#include <qt/walletmodel.h>
|
#include <qt/walletmodel.h>
|
||||||
@ -489,6 +490,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
|
|||||||
|
|
||||||
m_peer_widget_header_state = settings.value("PeersTabPeerHeaderState").toByteArray();
|
m_peer_widget_header_state = settings.value("PeersTabPeerHeaderState").toByteArray();
|
||||||
m_banlist_widget_header_state = settings.value("PeersTabBanlistHeaderState").toByteArray();
|
m_banlist_widget_header_state = settings.value("PeersTabBanlistHeaderState").toByteArray();
|
||||||
|
m_alternating_row_colors = settings.value("PeersTabAlternatingRowColors").toBool();
|
||||||
|
|
||||||
constexpr QChar nonbreaking_hyphen(8209);
|
constexpr QChar nonbreaking_hyphen(8209);
|
||||||
const std::vector<QString> CONNECTION_TYPE_DOC{
|
const std::vector<QString> CONNECTION_TYPE_DOC{
|
||||||
@ -684,6 +686,11 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
|||||||
|
|
||||||
connect(model, &ClientModel::mempoolSizeChanged, this, &RPCConsole::setMempoolSize);
|
connect(model, &ClientModel::mempoolSizeChanged, this, &RPCConsole::setMempoolSize);
|
||||||
|
|
||||||
|
connect(model->getOptionsModel(), &OptionsModel::peersTabAlternatingRowColorsChanged, [this](bool alternating_row_colors) {
|
||||||
|
ui->peerWidget->setAlternatingRowColors(alternating_row_colors);
|
||||||
|
ui->banlistWidget->setAlternatingRowColors(alternating_row_colors);
|
||||||
|
});
|
||||||
|
|
||||||
// set up peer table
|
// set up peer table
|
||||||
ui->peerWidget->setModel(model->peerTableSortProxy());
|
ui->peerWidget->setModel(model->peerTableSortProxy());
|
||||||
ui->peerWidget->verticalHeader()->hide();
|
ui->peerWidget->verticalHeader()->hide();
|
||||||
@ -699,6 +706,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
|||||||
ui->peerWidget->horizontalHeader()->setSectionResizeMode(PeerTableModel::Age, QHeaderView::ResizeToContents);
|
ui->peerWidget->horizontalHeader()->setSectionResizeMode(PeerTableModel::Age, QHeaderView::ResizeToContents);
|
||||||
ui->peerWidget->horizontalHeader()->setStretchLastSection(true);
|
ui->peerWidget->horizontalHeader()->setStretchLastSection(true);
|
||||||
ui->peerWidget->setItemDelegateForColumn(PeerTableModel::NetNodeId, new PeerIdViewDelegate(this));
|
ui->peerWidget->setItemDelegateForColumn(PeerTableModel::NetNodeId, new PeerIdViewDelegate(this));
|
||||||
|
ui->peerWidget->setAlternatingRowColors(m_alternating_row_colors);
|
||||||
|
|
||||||
// create peer table context menu
|
// create peer table context menu
|
||||||
peersTableContextMenu = new QMenu(this);
|
peersTableContextMenu = new QMenu(this);
|
||||||
@ -731,6 +739,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
|||||||
}
|
}
|
||||||
ui->banlistWidget->horizontalHeader()->setSectionResizeMode(BanTableModel::Address, QHeaderView::ResizeToContents);
|
ui->banlistWidget->horizontalHeader()->setSectionResizeMode(BanTableModel::Address, QHeaderView::ResizeToContents);
|
||||||
ui->banlistWidget->horizontalHeader()->setStretchLastSection(true);
|
ui->banlistWidget->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
ui->banlistWidget->setAlternatingRowColors(m_alternating_row_colors);
|
||||||
|
|
||||||
// create ban table context menu
|
// create ban table context menu
|
||||||
banTableContextMenu = new QMenu(this);
|
banTableContextMenu = new QMenu(this);
|
||||||
|
@ -179,6 +179,7 @@ private:
|
|||||||
bool m_is_executing{false};
|
bool m_is_executing{false};
|
||||||
QByteArray m_peer_widget_header_state;
|
QByteArray m_peer_widget_header_state;
|
||||||
QByteArray m_banlist_widget_header_state;
|
QByteArray m_banlist_widget_header_state;
|
||||||
|
bool m_alternating_row_colors{false};
|
||||||
|
|
||||||
/** Update UI with latest network info from model. */
|
/** Update UI with latest network info from model. */
|
||||||
void updateNetworkState();
|
void updateNetworkState();
|
||||||
|
Loading…
Reference in New Issue
Block a user