mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge pull request #6864
268b79e
[qt] rpcconsole: Scale monospace font to 95% (MarcoFalke)28313b8
[qt] Use fixed pitch font for the rpc console (MarcoFalke)
This commit is contained in:
commit
c702521a85
7 changed files with 18 additions and 11 deletions
|
@ -218,7 +218,7 @@ QVariant AddressTableModel::data(const QModelIndex &index, int role) const
|
||||||
QFont font;
|
QFont font;
|
||||||
if(index.column() == Address)
|
if(index.column() == Address)
|
||||||
{
|
{
|
||||||
font = GUIUtil::bitcoinAddressFont();
|
font = GUIUtil::fixedPitchFont();
|
||||||
}
|
}
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ QString dateTimeStr(qint64 nTime)
|
||||||
return dateTimeStr(QDateTime::fromTime_t((qint32)nTime));
|
return dateTimeStr(QDateTime::fromTime_t((qint32)nTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont bitcoinAddressFont()
|
QFont fixedPitchFont()
|
||||||
{
|
{
|
||||||
QFont font("Monospace");
|
QFont font("Monospace");
|
||||||
#if QT_VERSION >= 0x040800
|
#if QT_VERSION >= 0x040800
|
||||||
|
@ -103,7 +103,7 @@ void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
|
||||||
{
|
{
|
||||||
parent->setFocusProxy(widget);
|
parent->setFocusProxy(widget);
|
||||||
|
|
||||||
widget->setFont(bitcoinAddressFont());
|
widget->setFont(fixedPitchFont());
|
||||||
#if QT_VERSION >= 0x040700
|
#if QT_VERSION >= 0x040700
|
||||||
// We don't want translators to use own addresses in translations
|
// We don't want translators to use own addresses in translations
|
||||||
// and this is the only place, where this address is supplied.
|
// and this is the only place, where this address is supplied.
|
||||||
|
|
|
@ -37,8 +37,8 @@ namespace GUIUtil
|
||||||
QString dateTimeStr(const QDateTime &datetime);
|
QString dateTimeStr(const QDateTime &datetime);
|
||||||
QString dateTimeStr(qint64 nTime);
|
QString dateTimeStr(qint64 nTime);
|
||||||
|
|
||||||
// Render Bitcoin addresses in monospace font
|
// Return a monospace font
|
||||||
QFont bitcoinAddressFont();
|
QFont fixedPitchFont();
|
||||||
|
|
||||||
// Set up widgets for address and amounts
|
// Set up widgets for address and amounts
|
||||||
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent);
|
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent);
|
||||||
|
|
|
@ -462,12 +462,18 @@ void RPCConsole::clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set default style sheet
|
// Set default style sheet
|
||||||
|
QFontInfo fixedFontInfo(GUIUtil::fixedPitchFont());
|
||||||
|
// Try to make fixed font adequately large on different OS
|
||||||
|
QString ptSize = QString("%1pt").arg(QFontInfo(QFont()).pointSize() * 8.5 / 9);
|
||||||
ui->messagesWidget->document()->setDefaultStyleSheet(
|
ui->messagesWidget->document()->setDefaultStyleSheet(
|
||||||
|
QString(
|
||||||
"table { }"
|
"table { }"
|
||||||
"td.time { color: #808080; padding-top: 3px; } "
|
"td.time { color: #808080; padding-top: 3px; } "
|
||||||
|
"td.message { font-family: %1; font-size: %2; white-space:pre-wrap; } "
|
||||||
"td.cmd-request { color: #006060; } "
|
"td.cmd-request { color: #006060; } "
|
||||||
"td.cmd-error { color: red; } "
|
"td.cmd-error { color: red; } "
|
||||||
"b { color: #006060; } "
|
"b { color: #006060; } "
|
||||||
|
).arg(fixedFontInfo.family(), ptSize)
|
||||||
);
|
);
|
||||||
|
|
||||||
message(CMD_REPLY, (tr("Welcome to the Bitcoin Core RPC console.") + "<br>" +
|
message(CMD_REPLY, (tr("Welcome to the Bitcoin Core RPC console.") + "<br>" +
|
||||||
|
@ -494,7 +500,7 @@ void RPCConsole::message(int category, const QString &message, bool html)
|
||||||
if(html)
|
if(html)
|
||||||
out += message;
|
out += message;
|
||||||
else
|
else
|
||||||
out += GUIUtil::HtmlEscape(message, true);
|
out += GUIUtil::HtmlEscape(message, false);
|
||||||
out += "</td></tr></table>";
|
out += "</td></tr></table>";
|
||||||
ui->messagesWidget->append(out);
|
ui->messagesWidget->append(out);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ private Q_SLOTS:
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void clear();
|
void clear();
|
||||||
|
/** Append the message to the message widget */
|
||||||
void message(int category, const QString &message, bool html = false);
|
void message(int category, const QString &message, bool html = false);
|
||||||
/** Set number of connections shown in the UI */
|
/** Set number of connections shown in the UI */
|
||||||
void setNumConnections(int count);
|
void setNumConnections(int count);
|
||||||
|
|
|
@ -40,7 +40,7 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *platformStyle, QWidget *pare
|
||||||
// normal bitcoin address field
|
// normal bitcoin address field
|
||||||
GUIUtil::setupAddressWidget(ui->payTo, this);
|
GUIUtil::setupAddressWidget(ui->payTo, this);
|
||||||
// just a label for displaying bitcoin address(es)
|
// just a label for displaying bitcoin address(es)
|
||||||
ui->payTo_is->setFont(GUIUtil::bitcoinAddressFont());
|
ui->payTo_is->setFont(GUIUtil::fixedPitchFont());
|
||||||
|
|
||||||
// Connect signals
|
// Connect signals
|
||||||
connect(ui->payAmount, SIGNAL(valueChanged()), this, SIGNAL(payAmountChanged()));
|
connect(ui->payAmount, SIGNAL(valueChanged()), this, SIGNAL(payAmountChanged()));
|
||||||
|
|
|
@ -51,8 +51,8 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *platformSt
|
||||||
ui->messageIn_VM->installEventFilter(this);
|
ui->messageIn_VM->installEventFilter(this);
|
||||||
ui->signatureIn_VM->installEventFilter(this);
|
ui->signatureIn_VM->installEventFilter(this);
|
||||||
|
|
||||||
ui->signatureOut_SM->setFont(GUIUtil::bitcoinAddressFont());
|
ui->signatureOut_SM->setFont(GUIUtil::fixedPitchFont());
|
||||||
ui->signatureIn_VM->setFont(GUIUtil::bitcoinAddressFont());
|
ui->signatureIn_VM->setFont(GUIUtil::fixedPitchFont());
|
||||||
}
|
}
|
||||||
|
|
||||||
SignVerifyMessageDialog::~SignVerifyMessageDialog()
|
SignVerifyMessageDialog::~SignVerifyMessageDialog()
|
||||||
|
|
Loading…
Add table
Reference in a new issue