32 #include <QAbstractButton>
33 #include <QAbstractItemView>
34 #include <QApplication>
37 #include <QDesktopServices>
39 #include <QDoubleValidator>
40 #include <QFileDialog>
42 #include <QFontDatabase>
43 #include <QFontMetrics>
44 #include <QGuiApplication>
45 #include <QJsonObject>
47 #include <QKeySequence>
48 #include <QLatin1String>
53 #include <QMouseEvent>
54 #include <QPluginLoader>
55 #include <QProgressDialog>
56 #include <QRegularExpression>
61 #include <QStandardPaths>
63 #include <QTextDocument>
75 #if defined(Q_OS_MACOS)
82 using namespace std::chrono_literals;
88 return QLocale::system().toString(date.date(), QLocale::ShortFormat) + QString(
" ") + date.toString(
"hh:mm");
93 return dateTimeStr(QDateTime::fromSecsSinceEpoch(nTime));
98 if (use_embedded_font) {
99 return {
"Roboto Mono"};
101 return QFontDatabase::systemFont(QFontDatabase::FixedFont);
105 static const uint8_t
dummydata[] = {0xeb,0x15,0x23,0x1d,0xfc,0xeb,0x60,0x92,0x58,0x86,0xb6,0x7d,0x06,0x52,0x99,0x92,0x59,0x15,0xae,0xb1,0x72,0xc0,0x66,0x47};
112 for(
int i=0; i<256; ++i) {
117 sourcedata[sourcedata.size()-1] += 1;
124 parent->setFocusProxy(widget);
129 widget->setPlaceholderText(QObject::tr(
"Enter a Bitcoin address (e.g. %1)").arg(
137 QObject::connect(
new QShortcut(shortcut, button), &QShortcut::activated, [button]() { button->animateClick(); });
143 if(!uri.isValid() || uri.scheme() != QString(
"bitcoin"))
149 if (rv.
address.endsWith(
"/")) {
154 QUrlQuery uriQuery(uri);
155 QList<QPair<QString, QString> > items = uriQuery.queryItems();
156 for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
158 bool fShouldReturnFalse =
false;
159 if (i->first.startsWith(
"req-"))
161 i->first.remove(0, 4);
162 fShouldReturnFalse =
true;
165 if (i->first ==
"label")
167 rv.
label = i->second;
168 fShouldReturnFalse =
false;
170 if (i->first ==
"message")
173 fShouldReturnFalse =
false;
175 else if (i->first ==
"amount")
177 if(!i->second.isEmpty())
183 fShouldReturnFalse =
false;
186 if (fShouldReturnFalse)
198 QUrl uriInstance(uri);
204 bool bech_32 = info.
address.startsWith(QString::fromStdString(
Params().Bech32HRP() +
"1"));
206 QString
ret = QString(
"bitcoin:%1").arg(bech_32 ? info.
address.toUpper() : info.
address);
215 if (!info.
label.isEmpty())
217 QString lbl(QUrl::toPercentEncoding(info.
label));
218 ret += QString(
"%1label=%2").arg(paramCount == 0 ?
"?" :
"&").arg(lbl);
224 QString msg(QUrl::toPercentEncoding(info.
message));
225 ret += QString(
"%1message=%2").arg(paramCount == 0 ?
"?" :
"&").arg(msg);
236 CTxOut txOut(amount, script);
242 QString escaped = str.toHtmlEscaped();
245 escaped = escaped.replace(
"\n",
"<br>\n");
252 return HtmlEscape(QString::fromStdString(str), fMultiLine);
257 if(!view || !view->selectionModel())
259 QModelIndexList selection = view->selectionModel()->selectedRows(column);
261 if(!selection.isEmpty())
268 QList<QModelIndex>
getEntryData(
const QAbstractItemView *view,
int column)
270 if(!view || !view->selectionModel())
271 return QList<QModelIndex>();
272 return view->selectionModel()->selectedRows(column);
278 if (selection.isEmpty())
return false;
279 return !selection.at(0).data(role).toString().isEmpty();
284 const int id = QFontDatabase::addApplicationFont(file_name);
295 QRegularExpression filter_re(QStringLiteral(
".* \\(\\*\\.(.*)[ \\)]"), QRegularExpression::InvertedGreedinessOption);
297 QRegularExpressionMatch
m = filter_re.match(filter);
299 suffix =
m.captured(1);
305 const QString &filter,
306 QString *selectedSuffixOut)
308 QString selectedFilter;
312 myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
324 QFileInfo info(result);
325 if(!result.isEmpty())
327 if(info.suffix().isEmpty() && !selectedSuffix.isEmpty())
330 if(!result.endsWith(
"."))
332 result.append(selectedSuffix);
337 if(selectedSuffixOut)
339 *selectedSuffixOut = selectedSuffix;
345 const QString &filter,
346 QString *selectedSuffixOut)
348 QString selectedFilter;
352 myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
361 if(selectedSuffixOut)
371 if(QThread::currentThread() != qApp->thread())
373 return Qt::BlockingQueuedConnection;
377 return Qt::DirectConnection;
383 QWidget *atW = QApplication::widgetAt(w->mapToGlobal(p));
384 if (!atW)
return false;
385 return atW->window() == w;
393 &&
checkPoint(QPoint(w->width() - 1, w->height() - 1), w)
394 &&
checkPoint(QPoint(w->width() / 2, w->height() / 2), w));
405 if (w->isMinimized()) {
417 QObject::connect(
new QShortcut(QKeySequence(QObject::tr(
"Ctrl+W")), w), &QShortcut::activated, w, &QWidget::close);
426 QDesktopServices::openUrl(QUrl::fromLocalFile(
PathToQString(pathDebug)));
434 std::ofstream configFile{pathConfig, std::ios_base::app};
436 if (!configFile.good())
442 bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(
PathToQString(pathConfig)));
446 res = QProcess::startDetached(
"/usr/bin/open", QStringList{
"-t",
PathToQString(pathConfig)});
453 ToolTipToRichTextFilter::ToolTipToRichTextFilter(
int _size_threshold, QObject *parent) :
455 size_threshold(_size_threshold)
462 if(evt->type() == QEvent::ToolTipChange)
464 QWidget *widget =
static_cast<QWidget*
>(obj);
465 QString tooltip = widget->toolTip();
466 if(tooltip.size() >
size_threshold && !tooltip.startsWith(
"<qt") && !Qt::mightBeRichText(tooltip))
470 tooltip =
"<qt>" +
HtmlEscape(tooltip,
true) +
"</qt>";
471 widget->setToolTip(tooltip);
475 return QObject::eventFilter(obj, evt);
485 if (event->type() == QEvent::FocusOut) {
486 auto focus_out =
static_cast<QFocusEvent*
>(event);
487 if (focus_out->reason() != Qt::PopupFocusReason) {
488 auto label = qobject_cast<QLabel*>(watched);
490 auto flags = label->textInteractionFlags();
491 label->setTextInteractionFlags(Qt::NoTextInteraction);
492 label->setTextInteractionFlags(
flags);
497 return QObject::eventFilter(watched, event);
501 fs::path static StartupShortcutPath()
505 return GetSpecialFolderPath(CSIDL_STARTUP) /
"Bitcoin.lnk";
507 return GetSpecialFolderPath(CSIDL_STARTUP) /
"Bitcoin (testnet).lnk";
508 return GetSpecialFolderPath(CSIDL_STARTUP) /
fs::u8path(
strprintf(
"Bitcoin (%s).lnk", chain));
520 fs::remove(StartupShortcutPath());
524 CoInitialize(
nullptr);
527 IShellLinkW* psl =
nullptr;
528 HRESULT hres = CoCreateInstance(CLSID_ShellLink,
nullptr,
529 CLSCTX_INPROC_SERVER, IID_IShellLinkW,
530 reinterpret_cast<void**
>(&psl));
536 GetModuleFileNameW(
nullptr, pszExePath, ARRAYSIZE(pszExePath));
539 QString strArgs =
"-min";
544 psl->SetPath(pszExePath);
545 PathRemoveFileSpecW(pszExePath);
546 psl->SetWorkingDirectory(pszExePath);
547 psl->SetShowCmd(SW_SHOWMINNOACTIVE);
548 psl->SetArguments(strArgs.toStdWString().c_str());
552 IPersistFile* ppf =
nullptr;
553 hres = psl->QueryInterface(IID_IPersistFile,
reinterpret_cast<void**
>(&ppf));
557 hres = ppf->Save(StartupShortcutPath().wstring().c_str(), TRUE);
570 #elif defined(Q_OS_LINUX)
577 char* pszConfigHome = getenv(
"XDG_CONFIG_HOME");
578 if (pszConfigHome)
return fs::path(pszConfigHome) /
"autostart";
579 char* pszHome = getenv(
"HOME");
580 if (pszHome)
return fs::path(pszHome) /
".config" /
"autostart";
584 fs::path static GetAutostartFilePath()
588 return GetAutostartDir() /
"bitcoin.desktop";
594 std::ifstream optionFile{GetAutostartFilePath()};
595 if (!optionFile.good())
599 while (!optionFile.eof())
601 getline(optionFile, line);
602 if (line.find(
"Hidden") != std::string::npos &&
603 line.find(
"true") != std::string::npos)
614 fs::remove(GetAutostartFilePath());
618 ssize_t r = readlink(
"/proc/self/exe", pszExePath,
sizeof(pszExePath));
622 pszExePath[r] =
'\0';
626 std::ofstream optionFile{GetAutostartFilePath(), std::ios_base::out | std::ios_base::trunc};
627 if (!optionFile.good())
631 optionFile <<
"[Desktop Entry]\n";
632 optionFile <<
"Type=Application\n";
634 optionFile <<
"Name=Bitcoin\n";
636 optionFile <<
strprintf(
"Name=Bitcoin (%s)\n", chain);
637 optionFile <<
"Exec=" << pszExePath <<
strprintf(
" -min -chain=%s\n", chain);
638 optionFile <<
"Terminal=false\n";
639 optionFile <<
"Hidden=false\n";
654 QClipboard* clipboard = QApplication::clipboard();
655 clipboard->setText(str, QClipboard::Clipboard);
656 if (clipboard->supportsSelection()) {
657 clipboard->setText(str, QClipboard::Selection);
668 return QString::fromStdString(path.
u8string());
689 if (prepend_direction) {
693 QObject::tr(
"Inbound") :
696 QObject::tr(
"Outbound") +
" ";
717 using days = std::chrono::duration<int, std::ratio<86400>>;
718 const auto d{std::chrono::duration_cast<days>(dur)};
719 const auto h{std::chrono::duration_cast<std::chrono::hours>(dur - d)};
720 const auto m{std::chrono::duration_cast<std::chrono::minutes>(dur - d - h)};
721 const auto s{std::chrono::duration_cast<std::chrono::seconds>(dur - d - h -
m)};
722 QStringList str_list;
723 if (
auto d2{d.count()}) str_list.append(QObject::tr(
"%1 d").arg(d2));
724 if (
auto h2{h.count()}) str_list.append(QObject::tr(
"%1 h").arg(h2));
725 if (
auto m2{
m.count()}) str_list.append(QObject::tr(
"%1 m").arg(m2));
726 const auto s2{s.count()};
727 if (s2 || str_list.empty()) str_list.append(QObject::tr(
"%1 s").arg(s2));
728 return str_list.join(
" ");
733 const auto time_now{GetTime<std::chrono::seconds>()};
734 const auto age{time_now - time_connected};
735 if (age >= 24h)
return QObject::tr(
"%1 d").arg(age / 24h);
736 if (age >= 1h)
return QObject::tr(
"%1 h").arg(age / 1h);
737 if (age >= 1min)
return QObject::tr(
"%1 m").arg(age / 1min);
738 return QObject::tr(
"%1 s").arg(age / 1s);
746 strList.append(QString::fromStdString(flag));
750 return strList.join(
", ");
752 return QObject::tr(
"None");
757 return (ping_time == std::chrono::microseconds::max() || ping_time == 0us) ?
759 QObject::tr(
"%1 ms").arg(QString::number((
int)(
count_microseconds(ping_time) / 1000), 10));
764 return QObject::tr(
"%1 s").arg(QString::number((
int)nTimeOffset, 10));
770 QString timeBehindText;
771 const int HOUR_IN_SECONDS = 60*60;
772 const int DAY_IN_SECONDS = 24*60*60;
773 const int WEEK_IN_SECONDS = 7*24*60*60;
774 const int YEAR_IN_SECONDS = 31556952;
777 timeBehindText = QObject::tr(
"%n second(s)",
"",secs);
779 else if(secs < 2*HOUR_IN_SECONDS)
781 timeBehindText = QObject::tr(
"%n minute(s)",
"",secs/60);
783 else if(secs < 2*DAY_IN_SECONDS)
785 timeBehindText = QObject::tr(
"%n hour(s)",
"",secs/HOUR_IN_SECONDS);
787 else if(secs < 2*WEEK_IN_SECONDS)
789 timeBehindText = QObject::tr(
"%n day(s)",
"",secs/DAY_IN_SECONDS);
791 else if(secs < YEAR_IN_SECONDS)
793 timeBehindText = QObject::tr(
"%n week(s)",
"",secs/WEEK_IN_SECONDS);
797 qint64 years = secs / YEAR_IN_SECONDS;
798 qint64 remainder = secs % YEAR_IN_SECONDS;
799 timeBehindText = QObject::tr(
"%1 and %2").arg(QObject::tr(
"%n year(s)",
"", years)).arg(QObject::tr(
"%n week(s)",
"", remainder/WEEK_IN_SECONDS));
801 return timeBehindText;
807 return QObject::tr(
"%1 B").arg(bytes);
808 if (bytes < 1'000'000)
809 return QObject::tr(
"%1 kB").arg(bytes / 1'000);
810 if (bytes < 1'000'000'000)
811 return QObject::tr(
"%1 MB").arg(bytes / 1'000'000);
813 return QObject::tr(
"%1 GB").arg(bytes / 1'000'000'000);
817 while(font_size >= minPointSize) {
818 font.setPointSizeF(font_size);
819 QFontMetrics fm(font);
829 : QLabel{parent}, m_platform_style{platform_style}
844 if (e->type() == QEvent::PaletteChange) {
848 QLabel::changeEvent(e);
873 if (event->type() == QEvent::KeyPress) {
874 if (
static_cast<QKeyEvent*
>(event)->key() == Qt::Key_Escape) {
878 return QItemDelegate::eventFilter(
object, event);
885 const int margin =
TextWidth(dialog->fontMetrics(), (
"X"));
886 dialog->resize(dialog->width() + 2 * margin, dialog->height());
892 dialog->setMinimumDuration(0);
895 int TextWidth(
const QFontMetrics& fm,
const QString& text)
897 return fm.horizontalAdvance(text);
903 const std::string qt_link{
"static"};
905 const std::string qt_link{
"dynamic"};
907 #ifdef QT_STATICPLUGIN
908 const std::string plugin_link{
"static"};
910 const std::string plugin_link{
"dynamic"};
912 LogPrintf(
"Qt %s (%s), plugin=%s (%s)\n", qVersion(), qt_link, QGuiApplication::platformName().toStdString(), plugin_link);
913 const auto static_plugins = QPluginLoader::staticPlugins();
914 if (static_plugins.empty()) {
918 for (
const QStaticPlugin& p : static_plugins) {
919 QJsonObject meta_data = p.metaData();
920 const std::string plugin_class = meta_data.take(QString(
"className")).toString().toStdString();
921 const int plugin_version = meta_data.take(QString(
"version")).toInt();
922 LogPrintf(
" %s, version %d\n", plugin_class, plugin_version);
926 LogPrintf(
"Style: %s / %s\n", QApplication::style()->objectName().toStdString(), QApplication::style()->metaObject()->className());
927 LogPrintf(
"System: %s, %s\n", QSysInfo::prettyProductName().toStdString(), QSysInfo::buildAbi().toStdString());
928 for (
const QScreen* s : QGuiApplication::screens()) {
929 LogPrintf(
"Screen: %s %dx%d, pixel ratio=%.1f\n", s->name().toStdString(), s->size().width(), s->size().height(), s->devicePixelRatio());
933 void PopupMenu(QMenu* menu,
const QPoint& point, QAction* at_action)
936 if (QApplication::platformName() ==
"minimal")
return;
937 menu->popup(point, at_action);
942 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
943 return date.startOfDay();
945 return QDateTime(date);
951 #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
952 return !label->pixmap(Qt::ReturnByValue).isNull();
954 return label->pixmap() !=
nullptr;
964 #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
965 return label->pixmap(Qt::ReturnByValue).toImage();
967 return label->pixmap()->toImage();
973 return QString(
source).replace(
975 QLatin1String(
"<a href=\"") + link + QLatin1String(
"\">") + link + QLatin1String(
"</a>"));
979 const std::exception* exception,
980 const QObject* sender,
981 const QObject* receiver)
983 std::string description = sender->metaObject()->className();
985 description += receiver->metaObject()->className();
991 dialog->setAttribute(Qt::WA_DeleteOnClose);
992 dialog->setWindowModality(Qt::ApplicationModal);
int64_t CAmount
Amount in satoshis (Can be negative)
std::string EncodeBase58(Span< const unsigned char > input)
Why base-58 instead of standard base-64 encoding?
const CChainParams & Params()
Return the currently selected parameters.
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
fs::path GetPathArg(std::string arg, const fs::path &default_value={}) const
Return path argument or default value.
std::string GetChainName() const
Returns the appropriate chain name from the program arguments.
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.
static const std::string TESTNET
static const std::string MAIN
Chain name strings.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
const std::vector< unsigned char > & Base58Prefix(Base58Type type) const
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 u8string() const
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.
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.
static const uint8_t dummydata[]
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.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
constexpr int64_t count_microseconds(std::chrono::microseconds t)
fs::path GetDefaultDataDir()
fs::path GetConfigFile(const fs::path &configuration_file_path)
const char *const BITCOIN_CONF_FILENAME
void PrintExceptionContinue(const std::exception *pex, std::string_view thread_name)