5 #if defined(HAVE_CONFIG_H)
19 #include <chainparams.h>
40 #include <QAbstractButton>
41 #include <QAbstractItemView>
42 #include <QApplication>
45 #include <QDesktopServices>
47 #include <QDoubleValidator>
48 #include <QFileDialog>
50 #include <QFontDatabase>
51 #include <QFontMetrics>
52 #include <QGuiApplication>
53 #include <QJsonObject>
55 #include <QKeySequence>
56 #include <QLatin1String>
61 #include <QMouseEvent>
62 #include <QPluginLoader>
63 #include <QProgressDialog>
64 #include <QRegularExpression>
69 #include <QStandardPaths>
71 #include <QTextDocument>
83 #if defined(Q_OS_MACOS)
90 using namespace std::chrono_literals;
96 return QLocale::system().toString(date.date(), QLocale::ShortFormat) + QString(
" ") + date.toString(
"hh:mm");
101 return dateTimeStr(QDateTime::fromSecsSinceEpoch(nTime));
106 if (use_embedded_font) {
107 return {
"Roboto Mono"};
109 return QFontDatabase::systemFont(QFontDatabase::FixedFont);
118 addr =
"bc1p35yvjel7srp783ztf8v6jdra7dhfzk5jaun8xz2qp6ws7z80n4tq2jku9f";
122 addr =
"tb1p35yvjel7srp783ztf8v6jdra7dhfzk5jaun8xz2qp6ws7z80n4tqa6qnlg";
125 addr =
"bcrt1p35yvjel7srp783ztf8v6jdra7dhfzk5jaun8xz2qp6ws7z80n4tqsr2427";
136 parent->setFocusProxy(widget);
141 widget->setPlaceholderText(QObject::tr(
"Enter a Bitcoin address (e.g. %1)").arg(
149 QObject::connect(
new QShortcut(shortcut, button), &QShortcut::activated, [button]() { button->animateClick(); });
155 if(!uri.isValid() || uri.scheme() != QString(
"bitcoin"))
161 if (rv.
address.endsWith(
"/")) {
166 QUrlQuery uriQuery(uri);
167 QList<QPair<QString, QString> > items = uriQuery.queryItems();
168 for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
170 bool fShouldReturnFalse =
false;
171 if (i->first.startsWith(
"req-"))
173 i->first.remove(0, 4);
174 fShouldReturnFalse =
true;
177 if (i->first ==
"label")
179 rv.
label = i->second;
180 fShouldReturnFalse =
false;
182 if (i->first ==
"message")
185 fShouldReturnFalse =
false;
187 else if (i->first ==
"amount")
189 if(!i->second.isEmpty())
195 fShouldReturnFalse =
false;
198 if (fShouldReturnFalse)
210 QUrl uriInstance(uri);
216 bool bech_32 = info.
address.startsWith(QString::fromStdString(
Params().Bech32HRP() +
"1"));
218 QString
ret = QString(
"bitcoin:%1").arg(bech_32 ? info.
address.toUpper() : info.
address);
227 if (!info.
label.isEmpty())
229 QString lbl(QUrl::toPercentEncoding(info.
label));
230 ret += QString(
"%1label=%2").arg(paramCount == 0 ?
"?" :
"&").arg(lbl);
236 QString
msg(QUrl::toPercentEncoding(info.
message));
237 ret += QString(
"%1message=%2").arg(paramCount == 0 ?
"?" :
"&").arg(
msg);
248 CTxOut txOut(amount, script);
254 QString escaped = str.toHtmlEscaped();
257 escaped = escaped.replace(
"\n",
"<br>\n");
264 return HtmlEscape(QString::fromStdString(str), fMultiLine);
269 if(!view || !view->selectionModel())
271 QModelIndexList selection = view->selectionModel()->selectedRows(column);
273 if(!selection.isEmpty())
280 QList<QModelIndex>
getEntryData(
const QAbstractItemView *view,
int column)
282 if(!view || !view->selectionModel())
283 return QList<QModelIndex>();
284 return view->selectionModel()->selectedRows(column);
290 if (selection.isEmpty())
return false;
291 return !selection.at(0).data(role).toString().isEmpty();
296 const int id = QFontDatabase::addApplicationFont(file_name);
307 QRegularExpression filter_re(QStringLiteral(
".* \\(\\*\\.(.*)[ \\)]"), QRegularExpression::InvertedGreedinessOption);
309 QRegularExpressionMatch
m = filter_re.match(filter);
311 suffix =
m.captured(1);
317 const QString &filter,
318 QString *selectedSuffixOut)
320 QString selectedFilter;
324 myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
336 QFileInfo info(result);
337 if(!result.isEmpty())
339 if(info.suffix().isEmpty() && !selectedSuffix.isEmpty())
342 if(!result.endsWith(
"."))
344 result.append(selectedSuffix);
349 if(selectedSuffixOut)
351 *selectedSuffixOut = selectedSuffix;
357 const QString &filter,
358 QString *selectedSuffixOut)
360 QString selectedFilter;
364 myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
373 if(selectedSuffixOut)
383 if(QThread::currentThread() != qApp->thread())
385 return Qt::BlockingQueuedConnection;
389 return Qt::DirectConnection;
395 QWidget *atW = QApplication::widgetAt(w->mapToGlobal(p));
396 if (!atW)
return false;
397 return atW->window() == w;
405 &&
checkPoint(QPoint(w->width() - 1, w->height() - 1), w)
406 &&
checkPoint(QPoint(w->width() / 2, w->height() / 2), w));
417 if (w->isMinimized()) {
429 QObject::connect(
new QShortcut(QKeySequence(QObject::tr(
"Ctrl+W")), w), &QShortcut::activated, w, &QWidget::close);
438 QDesktopServices::openUrl(QUrl::fromLocalFile(
PathToQString(pathDebug)));
446 std::ofstream configFile{pathConfig, std::ios_base::app};
448 if (!configFile.good())
454 bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(
PathToQString(pathConfig)));
458 res = QProcess::startDetached(
"/usr/bin/open", QStringList{
"-t",
PathToQString(pathConfig)});
465 ToolTipToRichTextFilter::ToolTipToRichTextFilter(
int _size_threshold, QObject *parent) :
467 size_threshold(_size_threshold)
474 if(evt->type() == QEvent::ToolTipChange)
476 QWidget *widget =
static_cast<QWidget*
>(obj);
477 QString tooltip = widget->toolTip();
478 if(tooltip.size() >
size_threshold && !tooltip.startsWith(
"<qt") && !Qt::mightBeRichText(tooltip))
482 tooltip =
"<qt>" +
HtmlEscape(tooltip,
true) +
"</qt>";
483 widget->setToolTip(tooltip);
487 return QObject::eventFilter(obj, evt);
497 if (event->type() == QEvent::FocusOut) {
498 auto focus_out =
static_cast<QFocusEvent*
>(event);
499 if (focus_out->reason() != Qt::PopupFocusReason) {
500 auto label = qobject_cast<QLabel*>(watched);
502 auto flags = label->textInteractionFlags();
503 label->setTextInteractionFlags(Qt::NoTextInteraction);
504 label->setTextInteractionFlags(
flags);
509 return QObject::eventFilter(watched, event);
513 fs::path static StartupShortcutPath()
517 return GetSpecialFolderPath(CSIDL_STARTUP) /
"Bitcoin.lnk";
519 return GetSpecialFolderPath(CSIDL_STARTUP) /
"Bitcoin (testnet).lnk";
532 fs::remove(StartupShortcutPath());
536 CoInitialize(
nullptr);
539 IShellLinkW* psl =
nullptr;
540 HRESULT hres = CoCreateInstance(CLSID_ShellLink,
nullptr,
541 CLSCTX_INPROC_SERVER, IID_IShellLinkW,
542 reinterpret_cast<void**
>(&psl));
548 GetModuleFileNameW(
nullptr, pszExePath, ARRAYSIZE(pszExePath));
551 QString strArgs =
"-min";
556 psl->SetPath(pszExePath);
557 PathRemoveFileSpecW(pszExePath);
558 psl->SetWorkingDirectory(pszExePath);
559 psl->SetShowCmd(SW_SHOWMINNOACTIVE);
560 psl->SetArguments(strArgs.toStdWString().c_str());
564 IPersistFile* ppf =
nullptr;
565 hres = psl->QueryInterface(IID_IPersistFile,
reinterpret_cast<void**
>(&ppf));
569 hres = ppf->Save(StartupShortcutPath().wstring().c_str(), TRUE);
582 #elif defined(Q_OS_LINUX)
589 char* pszConfigHome = getenv(
"XDG_CONFIG_HOME");
590 if (pszConfigHome)
return fs::path(pszConfigHome) /
"autostart";
591 char* pszHome = getenv(
"HOME");
592 if (pszHome)
return fs::path(pszHome) /
".config" /
"autostart";
596 fs::path static GetAutostartFilePath()
600 return GetAutostartDir() /
"bitcoin.desktop";
606 std::ifstream optionFile{GetAutostartFilePath()};
607 if (!optionFile.good())
611 while (!optionFile.eof())
613 getline(optionFile, line);
614 if (line.find(
"Hidden") != std::string::npos &&
615 line.find(
"true") != std::string::npos)
626 fs::remove(GetAutostartFilePath());
630 ssize_t r = readlink(
"/proc/self/exe", pszExePath,
sizeof(pszExePath));
634 pszExePath[r] =
'\0';
638 std::ofstream optionFile{GetAutostartFilePath(),
std::ios_base::out | std::ios_base::trunc};
639 if (!optionFile.good())
643 optionFile <<
"[Desktop Entry]\n";
644 optionFile <<
"Type=Application\n";
646 optionFile <<
"Name=Bitcoin\n";
650 optionFile <<
"Terminal=false\n";
651 optionFile <<
"Hidden=false\n";
666 QClipboard* clipboard = QApplication::clipboard();
667 clipboard->setText(str, QClipboard::Clipboard);
668 if (clipboard->supportsSelection()) {
669 clipboard->setText(str, QClipboard::Selection);
680 return QString::fromStdString(path.
utf8string());
688 case NET_IPV4:
return QObject::tr(
"IPv4",
"network name");
690 case NET_IPV6:
return QObject::tr(
"IPv6",
"network name");
692 case NET_ONION:
return QObject::tr(
"Onion",
"network name");
694 case NET_I2P:
return QObject::tr(
"I2P",
"network name");
696 case NET_CJDNS:
return QObject::tr(
"CJDNS",
"network name");
706 if (prepend_direction) {
710 QObject::tr(
"Inbound") :
713 QObject::tr(
"Outbound") +
" ";
734 const auto d{std::chrono::duration_cast<std::chrono::days>(dur)};
735 const auto h{std::chrono::duration_cast<std::chrono::hours>(dur - d)};
736 const auto m{std::chrono::duration_cast<std::chrono::minutes>(dur - d - h)};
737 const auto s{std::chrono::duration_cast<std::chrono::seconds>(dur - d - h -
m)};
738 QStringList str_list;
739 if (
auto d2{d.count()}) str_list.append(QObject::tr(
"%1 d").arg(d2));
740 if (
auto h2{h.count()}) str_list.append(QObject::tr(
"%1 h").arg(h2));
741 if (
auto m2{
m.count()}) str_list.append(QObject::tr(
"%1 m").arg(m2));
742 const auto s2{s.count()};
743 if (s2 || str_list.empty()) str_list.append(QObject::tr(
"%1 s").arg(s2));
744 return str_list.join(
" ");
749 const auto time_now{GetTime<std::chrono::seconds>()};
750 const auto age{time_now - time_connected};
751 if (age >= 24h)
return QObject::tr(
"%1 d").arg(age / 24h);
752 if (age >= 1h)
return QObject::tr(
"%1 h").arg(age / 1h);
753 if (age >= 1min)
return QObject::tr(
"%1 m").arg(age / 1min);
754 return QObject::tr(
"%1 s").arg(age / 1s);
762 strList.append(QString::fromStdString(flag));
766 return strList.join(
", ");
768 return QObject::tr(
"None");
773 return (ping_time == std::chrono::microseconds::max() || ping_time == 0us) ?
775 QObject::tr(
"%1 ms").arg(QString::number((
int)(
count_microseconds(ping_time) / 1000), 10));
780 return QObject::tr(
"%1 s").arg(QString::number((
int)nTimeOffset, 10));
786 QString timeBehindText;
787 const int HOUR_IN_SECONDS = 60*60;
788 const int DAY_IN_SECONDS = 24*60*60;
789 const int WEEK_IN_SECONDS = 7*24*60*60;
790 const int YEAR_IN_SECONDS = 31556952;
793 timeBehindText = QObject::tr(
"%n second(s)",
"",secs);
795 else if(secs < 2*HOUR_IN_SECONDS)
797 timeBehindText = QObject::tr(
"%n minute(s)",
"",secs/60);
799 else if(secs < 2*DAY_IN_SECONDS)
801 timeBehindText = QObject::tr(
"%n hour(s)",
"",secs/HOUR_IN_SECONDS);
803 else if(secs < 2*WEEK_IN_SECONDS)
805 timeBehindText = QObject::tr(
"%n day(s)",
"",secs/DAY_IN_SECONDS);
807 else if(secs < YEAR_IN_SECONDS)
809 timeBehindText = QObject::tr(
"%n week(s)",
"",secs/WEEK_IN_SECONDS);
813 qint64 years = secs / YEAR_IN_SECONDS;
814 qint64 remainder = secs % YEAR_IN_SECONDS;
815 timeBehindText = QObject::tr(
"%1 and %2").arg(QObject::tr(
"%n year(s)",
"", years)).arg(QObject::tr(
"%n week(s)",
"", remainder/WEEK_IN_SECONDS));
817 return timeBehindText;
823 return QObject::tr(
"%1 B").arg(bytes);
824 if (bytes < 1'000'000)
825 return QObject::tr(
"%1 kB").arg(bytes / 1'000);
826 if (bytes < 1'000'000'000)
827 return QObject::tr(
"%1 MB").arg(bytes / 1'000'000);
829 return QObject::tr(
"%1 GB").arg(bytes / 1'000'000'000);
833 while(font_size >= minPointSize) {
834 font.setPointSizeF(font_size);
835 QFontMetrics fm(font);
845 : QLabel{parent}, m_platform_style{platform_style}
860 if (e->type() == QEvent::PaletteChange) {
864 QLabel::changeEvent(e);
889 if (event->type() == QEvent::KeyPress) {
890 if (
static_cast<QKeyEvent*
>(event)->key() == Qt::Key_Escape) {
894 return QItemDelegate::eventFilter(
object, event);
901 const int margin =
TextWidth(dialog->fontMetrics(), (
"X"));
902 dialog->resize(dialog->width() + 2 * margin, dialog->height());
908 dialog->setMinimumDuration(0);
911 int TextWidth(
const QFontMetrics& fm,
const QString& text)
913 return fm.horizontalAdvance(text);
919 const std::string qt_link{
"static"};
921 const std::string qt_link{
"dynamic"};
923 #ifdef QT_STATICPLUGIN
924 const std::string plugin_link{
"static"};
926 const std::string plugin_link{
"dynamic"};
928 LogPrintf(
"Qt %s (%s), plugin=%s (%s)\n", qVersion(), qt_link, QGuiApplication::platformName().toStdString(), plugin_link);
929 const auto static_plugins = QPluginLoader::staticPlugins();
930 if (static_plugins.empty()) {
934 for (
const QStaticPlugin& p : static_plugins) {
935 QJsonObject meta_data = p.metaData();
936 const std::string plugin_class = meta_data.take(QString(
"className")).toString().toStdString();
937 const int plugin_version = meta_data.take(QString(
"version")).toInt();
938 LogPrintf(
" %s, version %d\n", plugin_class, plugin_version);
942 LogPrintf(
"Style: %s / %s\n", QApplication::style()->objectName().toStdString(), QApplication::style()->metaObject()->className());
943 LogPrintf(
"System: %s, %s\n", QSysInfo::prettyProductName().toStdString(), QSysInfo::buildAbi().toStdString());
944 for (
const QScreen* s : QGuiApplication::screens()) {
945 LogPrintf(
"Screen: %s %dx%d, pixel ratio=%.1f\n", s->name().toStdString(), s->size().width(), s->size().height(), s->devicePixelRatio());
949 void PopupMenu(QMenu* menu,
const QPoint& point, QAction* at_action)
952 if (QApplication::platformName() ==
"minimal")
return;
953 menu->popup(point, at_action);
958 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
959 return date.startOfDay();
961 return QDateTime(date);
967 #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
968 return !label->pixmap(Qt::ReturnByValue).isNull();
970 return label->pixmap() !=
nullptr;
980 #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
981 return label->pixmap(Qt::ReturnByValue).toImage();
983 return label->pixmap()->toImage();
989 return QString(
source).replace(
991 QLatin1String(
"<a href=\"") + link + QLatin1String(
"\">") + link + QLatin1String(
"</a>"));
995 const std::exception* exception,
996 const QObject* sender,
997 const QObject* receiver)
999 std::string description = sender->metaObject()->className();
1000 description +=
"->";
1001 description += receiver->metaObject()->className();
1007 dialog->setAttribute(Qt::WA_DeleteOnClose);
1008 dialog->setWindowModality(Qt::ApplicationModal);
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
int64_t CAmount
Amount in satoshis (Can be negative)
fs::path GetDefaultDataDir()
const CChainParams & Params()
Return the currently selected parameters.
std::string ChainTypeToString(ChainType chain)
#define Assume(val)
Assume is the identity function.
ChainType GetChainType() const
Returns the appropriate chain type from the program arguments.
std::string GetChainTypeString() const
Returns the appropriate chain type string from the program arguments.
fs::path GetDataDirNet() const
Get data directory path with appended network identifier.
fs::path GetConfigFilePath() const
Return config file path (read-only)
Bitcoin address widget validator, checks for a valid bitcoin address.
Base58 entry widget validator, checks for valid characters and removes some whitespace.
static QString format(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD, bool justify=false)
Format as string.
static bool parse(Unit unit, const QString &value, CAmount *val_out)
Parse string to coin amount.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
ChainType GetChainType() const
Return the chain type.
Serialized script, used inside transaction inputs and outputs.
An output of a transaction.
void mouseReleaseEvent(QMouseEvent *event) override
ClickableLabel(const PlatformStyle *platform_style, QWidget *parent=nullptr)
void clicked(const QPoint &point)
Emitted when the label is clicked.
void mouseReleaseEvent(QMouseEvent *event) override
void clicked(const QPoint &point)
Emitted when the progressbar is clicked.
bool eventFilter(QObject *object, QEvent *event) override
bool eventFilter(QObject *watched, QEvent *event) override
LabelOutOfFocusEventFilter(QObject *parent)
const PlatformStyle * m_platform_style
void changeEvent(QEvent *e) override
ThemedLabel(const PlatformStyle *platform_style, QWidget *parent=nullptr)
void setThemedPixmap(const QString &image_filename, int width, int height)
void updateThemedPixmap()
bool eventFilter(QObject *obj, QEvent *evt) override
Line edit that can be marked as "invalid" to show input validation feedback.
void setCheckValidator(const QValidator *v)
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
std::string utf8string() const
Return a UTF-8 representation of the path as a std::string, for compatibility with code using std::st...
Top-level interface for a bitcoin node (bitcoind process).
ConnectionType
Different types of connections to a peer.
@ BLOCK_RELAY
We use block-relay-only connections to help prevent against partition attacks.
@ MANUAL
We open manual connections to addresses that users explicitly requested via the addnode RPC or the -a...
@ OUTBOUND_FULL_RELAY
These are the default connections that we use to connect with the network.
@ FEELER
Feeler connections are short-lived connections made to check that a node is alive.
@ INBOUND
Inbound connections are those initiated by a peer.
@ ADDR_FETCH
AddrFetch connections are short lived connections used to solicit addresses from peers.
void PrintExceptionContinue(const std::exception *pex, std::string_view thread_name)
bool IsValidDestinationString(const std::string &str, const CChainParams ¶ms)
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
void ForceActivation()
Force application activation on macOS.
Utility functions used by the Bitcoin Qt UI.
QString NetworkToQString(Network net)
Convert enum Network to QString.
bool isObscured(QWidget *w)
QImage GetImage(const QLabel *label)
Qt::ConnectionType blockingGUIThreadConnection()
Get connection type to call object slot in GUI thread with invokeMethod.
QString HtmlEscape(const QString &str, bool fMultiLine)
void PopupMenu(QMenu *menu, const QPoint &point, QAction *at_action)
Call QMenu::popup() only on supported QT_QPA_PLATFORM.
QList< QModelIndex > getEntryData(const QAbstractItemView *view, int column)
Return a field of the currently selected entry as a QString.
QFont fixedPitchFont(bool use_embedded_font)
QString formatBytes(uint64_t bytes)
void ShowModalDialogAsynchronously(QDialog *dialog)
Shows a QDialog instance asynchronously, and deletes it on close.
QString formatDurationStr(std::chrono::seconds dur)
Convert seconds into a QString with days, hours, mins, secs.
void AddButtonShortcut(QAbstractButton *button, const QKeySequence &shortcut)
Connects an additional shortcut to a QAbstractButton.
QString MakeHtmlLink(const QString &source, const QString &link)
Replaces a plain text link with an HTML tagged one.
void handleCloseWindowShortcut(QWidget *w)
QString ExtractFirstSuffixFromFilter(const QString &filter)
Extract first suffix from filter pattern "Description (*.foo)" or "Description (*....
void PolishProgressDialog(QProgressDialog *dialog)
bool isDust(interfaces::Node &node, const QString &address, const CAmount &amount)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
QString getDefaultDataDirectory()
Determine default data directory for operating system.
void copyEntryData(const QAbstractItemView *view, int column, int role)
Copy a field of the currently selected entry of a view to the clipboard.
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when ...
QDateTime StartOfDay(const QDate &date)
Returns the start-moment of the day in local time.
bool SetStartOnSystemStartup(bool fAutoStart)
static std::string DummyAddress(const CChainParams ¶ms)
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
void bringToFront(QWidget *w)
bool HasPixmap(const QLabel *label)
Returns true if pixmap has been set.
void LogQtInfo()
Writes to debug.log short info about the used Qt and the host system.
QString formatPingTime(std::chrono::microseconds ping_time)
Format a CNodeStats.m_last_ping_time into a user-readable string or display N/A, if 0.
QString PathToQString(const fs::path &path)
Convert OS specific boost path to QString through UTF-8.
void LoadFont(const QString &file_name)
Loads the font from the file specified by file_name, aborts if it fails.
void PrintSlotException(const std::exception *exception, const QObject *sender, const QObject *receiver)
bool checkPoint(const QPoint &p, const QWidget *w)
QString formatBitcoinURI(const SendCoinsRecipient &info)
QString formatTimeOffset(int64_t nTimeOffset)
Format a CNodeCombinedStats.nTimeOffset into a user-readable string.
QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction)
Convert enum ConnectionType to QString.
QString formatServicesStr(quint64 mask)
Format CNodeStats.nServices bitmask into a user-readable string.
QString formatNiceTimeOffset(qint64 secs)
QString FormatPeerAge(std::chrono::seconds time_connected)
Convert peer connection time to a QString denominated in the most relevant unit.
QString dateTimeStr(qint64 nTime)
QString HtmlEscape(const std::string &str, bool fMultiLine)
bool GetStartOnSystemStartup()
int TextWidth(const QFontMetrics &fm, const QString &text)
Returns the distance in pixels appropriate for drawing a subsequent character after text.
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
void setClipboard(const QString &str)
bool hasEntryData(const QAbstractItemView *view, int column, int role)
Returns true if the specified field of the currently selected view entry is not empty.
fs::path QStringToPath(const QString &path)
Convert QString to OS specific boost path through UTF-8.
qreal calculateIdealFontSize(int width, const QString &text, QFont font, qreal minPointSize, qreal font_size)
static path u8path(const std::string &utf8_str)
static bool create_directories(const std::filesystem::path &p)
Create directory (and if necessary its parents), unless the leaf directory already exists or is a sym...
static bool exists(const path &p)
@ NET_MAX
Dummy value to indicate the number of NET_* constants.
@ NET_ONION
TOR (v2 or v3)
@ NET_UNROUTABLE
Addresses from these networks are not publicly routable on the global Internet.
@ NET_INTERNAL
A set of addresses that represent the hash of a string or FQDN.
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
std::vector< std::string > serviceFlagsToStr(uint64_t flags)
Convert service flags (a bitmask of NODE_*) to human readable strings.
constexpr int64_t count_microseconds(std::chrono::microseconds t)