Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

guiutil.cpp File Reference
#include <qt/guiutil.h>
#include <qt/appearancewidget.h>
#include <qt/bitcoinaddressvalidator.h>
#include <qt/bitcoingui.h>
#include <qt/bitcoinunits.h>
#include <qt/optionsdialog.h>
#include <qt/qvalidatedlineedit.h>
#include <qt/walletmodel.h>
#include <primitives/transaction.h>
#include <init.h>
#include <policy/policy.h>
#include <protocol.h>
#include <script/script.h>
#include <script/standard.h>
#include <ui_interface.h>
#include <util.h>
#include <boost/scoped_array.hpp>
#include <QAbstractButton>
#include <QAbstractItemView>
#include <QApplication>
#include <QClipboard>
#include <QDateTime>
#include <QDebug>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QDialogButtonBox>
#include <QDoubleValidator>
#include <QFileDialog>
#include <QFont>
#include <QLineEdit>
#include <QSettings>
#include <QTextDocument>
#include <QThread>
#include <QTimer>
#include <QMouseEvent>
#include <QVBoxLayout>
#include <QUrl>
+ Include dependency graph for guiutil.cpp:

Go to the source code of this file.

Namespaces

 GUIUtil
 Utility functions used by the Dash Qt UI.
 

Functions

QColor GUIUtil::getThemedQColor (ThemedColor color)
 Helper to get colors for various themes which can't be applied via css for some reason. More...
 
QString GUIUtil::getThemedStyleQString (ThemedStyle style)
 Helper to get css style strings which are injected into rich text through qt. More...
 
QIcon GUIUtil::getIcon (const QString &strIcon, ThemedColor color, ThemedColor colorAlternative, const QString &strIconPath=ICONS_PATH)
 Helper to get an icon colorized with the given color (replaces black) and colorAlternative (replaces white) More...
 
QIcon GUIUtil::getIcon (const QString &strIcon, const ThemedColor color, const QString &strIconPath)
 
void GUIUtil::setIcon (QAbstractButton *button, const QString &strIcon, ThemedColor color, ThemedColor colorAlternative, const QSize &size)
 Helper to set an icon for a button with the given color (replaces black) and colorAlternative (replaces white). More...
 
void GUIUtil::setIcon (QAbstractButton *button, const QString &strIcon, const ThemedColor color, const QSize &size)
 
QString GUIUtil::dateTimeStr (const QDateTime &date)
 
QString GUIUtil::dateTimeStr (qint64 nTime)
 
static std::string GUIUtil::DummyAddress (const CChainParams &params)
 
void GUIUtil::setupAddressWidget (QValidatedLineEdit *widget, QWidget *parent, bool fAllowURI)
 
void GUIUtil::setupAmountWidget (QLineEdit *widget, QWidget *parent)
 
void GUIUtil::setupAppearance (QWidget *parent, OptionsModel *model)
 
bool GUIUtil::parseBitcoinURI (const QUrl &uri, SendCoinsRecipient *out)
 
bool GUIUtil::parseBitcoinURI (QString uri, SendCoinsRecipient *out)
 
bool GUIUtil::validateBitcoinURI (const QString &uri)
 
QString GUIUtil::formatBitcoinURI (const SendCoinsRecipient &info)
 
bool GUIUtil::isDust (const QString &address, const CAmount &amount)
 
QString GUIUtil::HtmlEscape (const QString &str, bool fMultiLine)
 
QString GUIUtil::HtmlEscape (const std::string &str, bool fMultiLine)
 
void GUIUtil::copyEntryData (QAbstractItemView *view, int column, int role=Qt::EditRole)
 Copy a field of the currently selected entry of a view to the clipboard. More...
 
QList< QModelIndex > GUIUtil::getEntryData (QAbstractItemView *view, int column)
 Return a field of the currently selected entry as a QString. More...
 
QString GUIUtil::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 no suffix is provided by the user. More...
 
QString GUIUtil::getOpenFileName (QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
 Get open filename, convenience wrapper for QFileDialog::getOpenFileName. More...
 
Qt::ConnectionType GUIUtil::blockingGUIThreadConnection ()
 Get connection type to call object slot in GUI thread with invokeMethod. More...
 
bool GUIUtil::checkPoint (const QPoint &p, const QWidget *w)
 
bool GUIUtil::isObscured (QWidget *w)
 
void GUIUtil::bringToFront (QWidget *w)
 
void GUIUtil::openDebugLogfile ()
 
void GUIUtil::openConfigfile ()
 
void GUIUtil::showBackups ()
 
void GUIUtil::SubstituteFonts (const QString &language)
 
bool GUIUtil::GetStartOnSystemStartup ()
 
bool GUIUtil::SetStartOnSystemStartup (bool fAutoStart)
 
void GUIUtil::migrateQtSettings ()
 Modify Qt network specific settings on migration. More...
 
void GUIUtil::setStyleSheetDirectory (const QString &path)
 Change the stylesheet directory. More...
 
bool GUIUtil::isStyleSheetDirectoryCustom ()
 Check if a custom css directory has been set with -custom-css-dir. More...
 
const std::vector< QString > GUIUtil::listStyleSheets ()
 Return a list of all required css files. More...
 
const std::vector< QString > GUIUtil::listThemes ()
 Return a list of all theme css files. More...
 
const QString GUIUtil::getDefaultTheme ()
 Return the name of the default theme `. More...
 
void GUIUtil::loadStyleSheet (QWidget *widget=nullptr, bool fForceUpdate=false)
 Updates the widgets stylesheet and adds it to the list of ui debug elements. More...
 
FontFamily GUIUtil::fontFamilyFromString (const QString &strFamily)
 
QString GUIUtil::fontFamilyToString (FontFamily family)
 
void GUIUtil::setFontFamily (FontFamily family)
 
FontFamily GUIUtil::getFontFamilyDefault ()
 set/get font family: GUIUtil::fontFamily More...
 
FontFamily GUIUtil::getFontFamily ()
 
bool GUIUtil::weightFromArg (int nArg, QFont::Weight &weight)
 Convert weight value from args (0-8) to QFont::Weight. More...
 
int GUIUtil::weightToArg (const QFont::Weight weight)
 Convert QFont::Weight to an arg value (0-8) More...
 
QFont::Weight GUIUtil::getFontWeightNormalDefault ()
 set/get normal font weight: GUIUtil::fontWeightNormal More...
 
QFont::Weight GUIUtil::toQFontWeight (FontWeight weight)
 Convert GUIUtil::FontWeight to QFont::Weight. More...
 
QFont::Weight GUIUtil::getFontWeightNormal ()
 
void GUIUtil::setFontWeightNormal (QFont::Weight weight)
 
QFont::Weight GUIUtil::getFontWeightBoldDefault ()
 set/get bold font weight: GUIUtil::fontWeightBold More...
 
QFont::Weight GUIUtil::getFontWeightBold ()
 
void GUIUtil::setFontWeightBold (QFont::Weight weight)
 
int GUIUtil::getFontScaleDefault ()
 set/get font scale: GUIUtil::fontScale More...
 
int GUIUtil::getFontScale ()
 
void GUIUtil::setFontScale (int nScale)
 
double GUIUtil::getScaledFontSize (int nSize)
 get font size with GUIUtil::fontScale applied More...
 
bool GUIUtil::loadFonts ()
 Load dash specific appliciation fonts. More...
 
void GUIUtil::setApplicationFont ()
 Set an application wide default font, depends on the selected theme. More...
 
void GUIUtil::setFont (const std::vector< QWidget * > &vecWidgets, FontWeight weight, int nPointSize=-1, bool fItalic=false)
 Workaround to set correct font styles in all themes since there is a bug in macOS which leads to issues loading variations of montserrat in css it also keeps track of the set fonts to update on theme changes. More...
 
void GUIUtil::updateFonts ()
 Update the font of all widgets where a custom font has been set with GUIUtil::setFont. More...
 
QFont GUIUtil::getFont (FontFamily family, QFont::Weight qWeight, bool fItalic=false, int nPointSize=-1)
 Get a properly weighted QFont object with the selected font. More...
 
QFont GUIUtil::getFont (QFont::Weight qWeight, bool fItalic, int nPointSize)
 
QFont GUIUtil::getFont (FontWeight weight, bool fItalic, int nPointSize)
 
QFont GUIUtil::getFontNormal ()
 Get the default normal QFont. More...
 
QFont GUIUtil::getFontBold ()
 Get the default bold QFont. More...
 
std::vector< QFont::Weight > GUIUtil::getSupportedWeights ()
 Return supported weights for the current font family. More...
 
QFont::Weight GUIUtil::supportedWeightFromIndex (int nIndex)
 Convert an index to a weight in the supported weights vector. More...
 
int GUIUtil::supportedWeightToIndex (QFont::Weight weight)
 Convert a weight to an index in the supported weights vector. More...
 
QString GUIUtil::getActiveTheme ()
 Return the name of the currently active theme. More...
 
bool GUIUtil::dashThemeActive ()
 Check if a dash specific theme is activated (light/dark). More...
 
void GUIUtil::loadTheme (QWidget *widget=nullptr, bool fForce=false)
 Load the theme and update all UI elements according to the appearance settings. More...
 
void GUIUtil::disableMacFocusRect (const QWidget *w)
 Disable the OS default focus rect for macOS because we have custom focus rects set in the css files. More...
 
void GUIUtil::updateMacFocusRects ()
 Enable/Disable the macOS focus rects depending on the current theme. More...
 
void GUIUtil::setClipboard (const QString &str)
 
fs::path GUIUtil::qstringToBoostPath (const QString &path)
 
QString GUIUtil::boostPathToQString (const fs::path &path)
 
QString GUIUtil::formatDurationStr (int secs)
 
QString GUIUtil::formatServicesStr (quint64 mask)
 
QString GUIUtil::formatPingTime (double dPingTime)
 
QString GUIUtil::formatTimeOffset (int64_t nTimeOffset)
 
QString GUIUtil::formatNiceTimeOffset (qint64 secs)
 
QString GUIUtil::formatBytes (uint64_t bytes)
 
qreal GUIUtil::calculateIdealFontSize (int width, const QString &text, QFont font, qreal minPointSize, qreal font_size)
 

Variables

static fs::detail::utf8_codecvt_facet utf8
 
static CCriticalSection GUIUtil::cs_css
 
static const QString GUIUtil::defaultStylesheetDirectory = ":css"
 
static QString GUIUtil::stylesheetDirectory = defaultStylesheetDirectory
 
static const QString GUIUtil::traditionalTheme = "Traditional"
 
static const QString GUIUtil::defaultTheme = "Light"
 
static const QString GUIUtil::darkThemePrefix = "Dark"
 
static const std::map< QString, QString > GUIUtil::mapStyleToTheme
 
static std::unique_ptr< QFont > GUIUtil::osDefaultFont
 loadFonts stores the SystemDefault font in osDefaultFont to be able to reference it later again More...
 
static const FontFamily GUIUtil::defaultFontFamily = FontFamily::SystemDefault
 Font related default values. More...
 
static const int GUIUtil::defaultFontSize = 12
 
static const double GUIUtil::fontScaleSteps = 0.01
 
static const QFont::Weight GUIUtil::defaultFontWeightNormal = QFont::Light
 
static const QFont::Weight GUIUtil::defaultFontWeightBold = QFont::Medium
 
static const int GUIUtil::defaultFontScale = 0
 
static FontFamily GUIUtil::fontFamily = defaultFontFamily
 Font related variables. More...
 
static int GUIUtil::fontScale = defaultFontScale
 
static QFont::Weight GUIUtil::fontWeightNormal = defaultFontWeightNormal
 
static QFont::Weight GUIUtil::fontWeightBold = defaultFontWeightBold
 
static std::map< QWidget *, std::tuple< FontWeight, bool, int > > GUIUtil::mapNormalFontUpdates
 
static std::map< FontFamily, std::vector< QFont::Weight > > GUIUtil::mapSupportedWeights
 
static const std::map< ThemedColor, QColor > GUIUtil::themedColors
 
static const std::map< ThemedColor, QColor > GUIUtil::themedDarkColors
 
static const std::map< ThemedStyle, QString > GUIUtil::themedStyles
 
static const std::map< ThemedStyle, QString > GUIUtil::themedDarkStyles
 
static const uint8_t GUIUtil::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}
 

Variable Documentation

◆ utf8

fs::detail::utf8_codecvt_facet utf8
static
Released under the MIT license