diff options
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r-- | src/qt/guiutil.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 33a50a078d..389a08d9e8 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -63,6 +63,13 @@ static boost::filesystem::detail::utf8_codecvt_facet utf8; #endif +#if defined(Q_OS_MAC) +extern double NSAppKitVersionNumber; +#if !defined(NSAppKitVersionNumber10_9) +#define NSAppKitVersionNumber10_9 1265 +#endif +#endif + namespace GUIUtil { QString dateTimeStr(const QDateTime &date) @@ -117,6 +124,10 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) SendCoinsRecipient rv; rv.address = uri.path(); + // Trim any following forward slash which may have been added by the OS + if (rv.address.endsWith("/")) { + rv.address.truncate(rv.address.length() - 1); + } rv.amount = 0; #if QT_VERSION < 0x050000 @@ -370,8 +381,29 @@ void openDebugLogfile() QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathDebug))); } +void SubstituteFonts() +{ +#if defined(Q_OS_MAC) +// Background: +// OSX's default font changed in 10.9 and QT is unable to find it with its +// usual fallback methods when building against the 10.7 sdk or lower. +// The 10.8 SDK added a function to let it find the correct fallback font. +// If this fallback is not properly loaded, some characters may fail to +// render correctly. +// +// Solution: If building with the 10.7 SDK or lower and the user's platform +// is 10.9 or higher at runtime, substitute the correct font. This needs to +// happen before the QApplication is created. +#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8 + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_9) + QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); +#endif +#endif +} + ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) : - QObject(parent), size_threshold(size_threshold) + QObject(parent), + size_threshold(size_threshold) { } @@ -804,4 +836,9 @@ QString formatServicesStr(uint64_t mask) return QObject::tr("None"); } +QString formatPingTime(double dPingTime) +{ + return dPingTime == 0 ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(dPingTime * 1000), 10)); +} + } // namespace GUIUtil |