Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

GUIUtil Namespace Reference

Utility functions used by the Dash Qt UI. More...

Classes

class  ClickableLabel
 
class  ClickableProgressBar
 
class  TableViewLastColumnResizingFixer
 Makes a QTableView last column feel as if it was being resized from its left border. More...
 
class  ToolTipToRichTextFilter
 Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text representation if needed. More...
 

Typedefs

typedef ClickableProgressBar ProgressBar
 

Enumerations

enum  ThemedColor {
  ThemedColor::DEFAULT, ThemedColor::UNCONFIRMED, ThemedColor::BLUE, ThemedColor::ORANGE,
  ThemedColor::RED, ThemedColor::GREEN, ThemedColor::BAREADDRESS, ThemedColor::TX_STATUS_OPENUNTILDATE,
  ThemedColor::BACKGROUND_WIDGET, ThemedColor::BORDER_WIDGET, ThemedColor::BORDER_NETSTATS, ThemedColor::BACKGROUND_NETSTATS,
  ThemedColor::QR_PIXEL, ThemedColor::ICON_ALTERNATIVE_COLOR
}
 
enum  ThemedStyle {
  ThemedStyle::TS_INVALID, ThemedStyle::TS_ERROR, ThemedStyle::TS_SUCCESS, ThemedStyle::TS_COMMAND,
  ThemedStyle::TS_PRIMARY, ThemedStyle::TS_SECONDARY
}
 
enum  FontFamily { FontFamily::SystemDefault, FontFamily::Montserrat }
 
enum  FontWeight { FontWeight::Normal, FontWeight::Bold }
 

Functions

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

Variables

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

Detailed Description

Utility functions used by the Dash Qt UI.

Typedef Documentation

◆ ProgressBar

Definition at line 430 of file guiutil.h.

Enumeration Type Documentation

◆ FontFamily

enum GUIUtil::FontFamily
strong
Enumerator
SystemDefault 
Montserrat 

Definition at line 277 of file guiutil.h.

◆ FontWeight

enum GUIUtil::FontWeight
strong
Enumerator
Normal 
Bold 

Definition at line 290 of file guiutil.h.

◆ ThemedColor

enum GUIUtil::ThemedColor
strong
Enumerator
DEFAULT 
UNCONFIRMED 
BLUE 
ORANGE 
RED 
GREEN 
BAREADDRESS 
TX_STATUS_OPENUNTILDATE 
BACKGROUND_WIDGET 
BORDER_WIDGET 
BORDER_NETSTATS 
BACKGROUND_NETSTATS 
QR_PIXEL 
ICON_ALTERNATIVE_COLOR 

Definition at line 40 of file guiutil.h.

◆ ThemedStyle

enum GUIUtil::ThemedStyle
strong
Enumerator
TS_INVALID 
TS_ERROR 
TS_SUCCESS 
TS_COMMAND 
TS_PRIMARY 
TS_SECONDARY 

Definition at line 72 of file guiutil.h.

Function Documentation

◆ blockingGUIThreadConnection()

Qt::ConnectionType GUIUtil::blockingGUIThreadConnection ( )

Get connection type to call object slot in GUI thread with invokeMethod.

The call will be blocking.

Returns
If called from the GUI thread, return a Qt::DirectConnection. If called from another thread, return a Qt::BlockingQueuedConnection.

Definition at line 606 of file guiutil.cpp.

Referenced by ThreadSafeMessageBox().

◆ boostPathToQString()

QString GUIUtil::boostPathToQString ( const fs::path &  path)

◆ bringToFront()

void GUIUtil::bringToFront ( QWidget *  w)

◆ calculateIdealFontSize()

qreal GUIUtil::calculateIdealFontSize ( int  width,
const QString &  text,
QFont  font,
qreal  minPointSize,
qreal  font_size 
)

Definition at line 1947 of file guiutil.cpp.

Referenced by ReceiveRequestDialog::update().

◆ checkPoint()

bool GUIUtil::checkPoint ( const QPoint &  p,
const QWidget *  w 
)

Definition at line 618 of file guiutil.cpp.

Referenced by isObscured().

◆ copyEntryData()

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.

Does nothing if nothing is selected.

Parameters
[in]columnData column to extract from the model
[in]roleData role to extract from the model
See also
TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress

Definition at line 501 of file guiutil.cpp.

References setClipboard().

Referenced by TransactionView::copyAddress(), TransactionView::copyAmount(), TransactionView::copyLabel(), TransactionView::copyTxHex(), TransactionView::copyTxID(), TransactionView::copyTxPlainText(), TransactionView::eventFilter(), AddressBookPage::on_copyAddress_clicked(), and AddressBookPage::onCopyLabelAction().

◆ dashThemeActive()

bool GUIUtil::dashThemeActive ( )

Check if a dash specific theme is activated (light/dark).

Definition at line 1775 of file guiutil.cpp.

References traditionalTheme.

Referenced by RPCConsole::changeEvent(), disableMacFocusRect(), loadStyleSheet(), AmountLineEdit::minimumSizeHint(), and updateMacFocusRects().

◆ dateTimeStr() [1/2]

◆ dateTimeStr() [2/2]

QString GUIUtil::dateTimeStr ( qint64  nTime)

Definition at line 263 of file guiutil.cpp.

References dateTimeStr().

◆ disableMacFocusRect()

◆ DummyAddress()

static std::string GUIUtil::DummyAddress ( const CChainParams params)
static

◆ fontFamilyFromString()

FontFamily GUIUtil::fontFamilyFromString ( const QString &  strFamily)

Definition at line 1273 of file guiutil.cpp.

References Montserrat, strprintf, and SystemDefault.

Referenced by loadFonts(), and main().

◆ fontFamilyToString()

QString GUIUtil::fontFamilyToString ( FontFamily  family)

◆ formatBitcoinURI()

◆ formatBytes()

QString GUIUtil::formatBytes ( uint64_t  bytes)

◆ formatDurationStr()

QString GUIUtil::formatDurationStr ( int  secs)

Definition at line 1833 of file guiutil.cpp.

Referenced by RPCConsole::setTrafficGraphRange(), and RPCConsole::updateNodeDetail().

◆ formatNiceTimeOffset()

QString GUIUtil::formatNiceTimeOffset ( qint64  secs)

◆ formatPingTime()

QString GUIUtil::formatPingTime ( double  dPingTime)

Definition at line 1888 of file guiutil.cpp.

Referenced by PeerTableModel::data(), and RPCConsole::updateNodeDetail().

◆ formatServicesStr()

QString GUIUtil::formatServicesStr ( quint64  mask)

◆ formatTimeOffset()

QString GUIUtil::formatTimeOffset ( int64_t  nTimeOffset)

Definition at line 1893 of file guiutil.cpp.

References nTimeOffset.

Referenced by RPCConsole::updateNodeDetail().

◆ getActiveTheme()

QString GUIUtil::getActiveTheme ( )

Return the name of the currently active theme.

Definition at line 1769 of file guiutil.cpp.

References defaultTheme.

Referenced by loadStyleSheet(), AppearanceWidget::updateTheme(), and AppearanceWidget::~AppearanceWidget().

◆ getDefaultTheme()

const QString GUIUtil::getDefaultTheme ( )

Return the name of the default theme `.

Definition at line 1150 of file guiutil.cpp.

References defaultTheme.

Referenced by OptionsModel::Init().

◆ getEntryData()

QList< QModelIndex > GUIUtil::getEntryData ( QAbstractItemView *  view,
int  column 
)

Return a field of the currently selected entry as a QString.

Does nothing if nothing is selected.

Parameters
[in]columnData column to extract from the model
See also
TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress

Definition at line 514 of file guiutil.cpp.

Referenced by RPCConsole::banSelectedNode(), RPCConsole::disconnectSelectedNode(), AddressBookPage::on_showAddressQRCode_clicked(), TransactionView::showAddressQRCode(), and RPCConsole::unbanSelectedNode().

◆ getFont() [1/3]

QFont GUIUtil::getFont ( FontFamily  family,
QFont::Weight  qWeight,
bool  fItalic = false,
int  nPointSize = -1 
)

◆ getFont() [2/3]

QFont GUIUtil::getFont ( QFont::Weight  qWeight,
bool  fItalic,
int  nPointSize 
)

Definition at line 1726 of file guiutil.cpp.

References fontFamily, and getFont().

◆ getFont() [3/3]

QFont GUIUtil::getFont ( FontWeight  weight,
bool  fItalic,
int  nPointSize 
)

Definition at line 1730 of file guiutil.cpp.

References getFont(), and toQFontWeight().

◆ getFontBold()

QFont GUIUtil::getFontBold ( )

Get the default bold QFont.

Definition at line 1740 of file guiutil.cpp.

References Bold, and getFont().

Referenced by SplashScreen::SplashScreen().

◆ getFontFamily()

FontFamily GUIUtil::getFontFamily ( )

Definition at line 1308 of file guiutil.cpp.

References fontFamily.

Referenced by AppearanceWidget::~AppearanceWidget().

◆ getFontFamilyDefault()

FontFamily GUIUtil::getFontFamilyDefault ( )

set/get font family: GUIUtil::fontFamily

Definition at line 1303 of file guiutil.cpp.

References defaultFontFamily.

Referenced by HelpMessageDialog::HelpMessageDialog(), OptionsModel::Init(), and main().

◆ getFontNormal()

◆ getFontScale()

int GUIUtil::getFontScale ( )

Definition at line 1393 of file guiutil.cpp.

References fontScale.

Referenced by main(), and AppearanceWidget::~AppearanceWidget().

◆ getFontScaleDefault()

int GUIUtil::getFontScaleDefault ( )

set/get font scale: GUIUtil::fontScale

Definition at line 1388 of file guiutil.cpp.

References defaultFontScale.

Referenced by HelpMessageDialog::HelpMessageDialog(), and OptionsModel::Init().

◆ getFontWeightBold()

QFont::Weight GUIUtil::getFontWeightBold ( )

Definition at line 1377 of file guiutil.cpp.

References fontWeightBold.

Referenced by main(), toQFontWeight(), and AppearanceWidget::~AppearanceWidget().

◆ getFontWeightBoldDefault()

QFont::Weight GUIUtil::getFontWeightBoldDefault ( )

set/get bold font weight: GUIUtil::fontWeightBold

Definition at line 1372 of file guiutil.cpp.

References defaultFontWeightBold.

Referenced by HelpMessageDialog::HelpMessageDialog(), and OptionsModel::Init().

◆ getFontWeightNormal()

QFont::Weight GUIUtil::getFontWeightNormal ( )

◆ getFontWeightNormalDefault()

QFont::Weight GUIUtil::getFontWeightNormalDefault ( )

set/get normal font weight: GUIUtil::fontWeightNormal

Definition at line 1351 of file guiutil.cpp.

References defaultFontWeightNormal.

Referenced by HelpMessageDialog::HelpMessageDialog(), OptionsModel::Init(), and setApplicationFont().

◆ getIcon() [1/2]

◆ getIcon() [2/2]

QIcon GUIUtil::getIcon ( const QString &  strIcon,
const ThemedColor  color,
const QString &  strIconPath 
)

Definition at line 242 of file guiutil.cpp.

References getIcon(), and ICON_ALTERNATIVE_COLOR.

◆ getOpenFileName()

QString GUIUtil::getOpenFileName ( QWidget *  parent,
const QString &  caption,
const QString &  dir,
const QString &  filter,
QString *  selectedSuffixOut 
)

Get open filename, convenience wrapper for QFileDialog::getOpenFileName.

Parameters
[in]parentParent window (or 0)
[in]captionWindow caption (or empty, for default)
[in]dirStarting directory (or empty, to default to documents directory)
[in]filterFilter specification such as "Comma Separated Files (*.csv)"
[out]selectedSuffixOutPointer to return the suffix (file type) that was selected (or 0). Can be useful when choosing the save file format based on suffix.

Definition at line 571 of file guiutil.cpp.

Referenced by OpenURIDialog::on_selectFileButton_clicked().

◆ getSaveFileName()

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.

Parameters
[in]parentParent window (or 0)
[in]captionWindow caption (or empty, for default)
[in]dirStarting directory (or empty, to default to documents directory)
[in]filterFilter specification such as "Comma Separated Files (*.csv)"
[out]selectedSuffixOutPointer to return the suffix (file type) that was selected (or 0). Can be useful when choosing the save file format based on suffix.

Definition at line 521 of file guiutil.cpp.

Referenced by WalletView::backupWallet(), TransactionView::exportClicked(), AddressBookPage::on_exportButton_clicked(), QRGeneralImageWidget::saveImage(), and QRImageWidget::saveImage().

◆ getScaledFontSize()

double GUIUtil::getScaledFontSize ( int  nSize)

get font size with GUIUtil::fontScale applied

Definition at line 1404 of file guiutil.cpp.

References fontScale, and fontScaleSteps.

Referenced by getFont(), TxViewDelegate::paint(), and updateFonts().

◆ GetStartOnSystemStartup()

bool GUIUtil::GetStartOnSystemStartup ( )

Definition at line 1103 of file guiutil.cpp.

Referenced by OptionsModel::data(), and OptionsModel::Reset().

◆ getSupportedWeights()

std::vector< QFont::Weight > GUIUtil::getSupportedWeights ( )

Return supported weights for the current font family.

Definition at line 1745 of file guiutil.cpp.

References fontFamily, and mapSupportedWeights.

Referenced by setupAppearance(), supportedWeightFromIndex(), supportedWeightToIndex(), and AppearanceWidget::updateWeightSlider().

◆ getThemedQColor()

◆ getThemedStyleQString()

◆ HtmlEscape() [1/2]

◆ HtmlEscape() [2/2]

QString GUIUtil::HtmlEscape ( const std::string &  str,
bool  fMultiLine 
)

Definition at line 496 of file guiutil.cpp.

References HtmlEscape().

◆ isDust()

bool GUIUtil::isDust ( const QString &  address,
const CAmount amount 
)

Definition at line 473 of file guiutil.cpp.

References DecodeDestination(), dustRelayFee, GetScriptForDestination(), and IsDust().

Referenced by SendCoinsEntry::validate().

◆ isObscured()

bool GUIUtil::isObscured ( QWidget *  w)

Definition at line 625 of file guiutil.cpp.

References checkPoint().

Referenced by BitcoinGUI::showNormalIfMinimized().

◆ isStyleSheetDirectoryCustom()

bool GUIUtil::isStyleSheetDirectoryCustom ( )

Check if a custom css directory has been set with -custom-css-dir.

Definition at line 1125 of file guiutil.cpp.

References defaultStylesheetDirectory, and stylesheetDirectory.

Referenced by loadStyleSheet().

◆ listStyleSheets()

const std::vector< QString > GUIUtil::listStyleSheets ( )

Return a list of all required css files.

Definition at line 1130 of file guiutil.cpp.

References mapStyleToTheme.

Referenced by main().

◆ listThemes()

const std::vector< QString > GUIUtil::listThemes ( )

Return a list of all theme css files.

Definition at line 1139 of file guiutil.cpp.

References mapStyleToTheme.

Referenced by AppearanceWidget::AppearanceWidget().

◆ loadFonts()

◆ loadStyleSheet()

void GUIUtil::loadStyleSheet ( QWidget *  widget = nullptr,
bool  fForceUpdate = false 
)

Updates the widgets stylesheet and adds it to the list of ui debug elements.

Beeing on that list means the stylesheet of the widget gets updated if the related css files has been changed if -debug-ui mode is active.

Definition at line 1155 of file guiutil.cpp.

References AssertLockNotHeld, cs_css, dashThemeActive(), BitcoinGUI::DEFAULT_UIPLATFORM, gArgs, getActiveTheme(), ArgsManager::GetArg(), ArgsManager::GetBoolArg(), isStyleSheetDirectoryCustom(), LOCK, ShutdownRequested(), strprintf, and stylesheetDirectory.

Referenced by loadTheme(), Intro::pickDataDirectory(), RPCConsole::setClientModel(), and ShutdownWindow::ShutdownWindow().

◆ loadTheme()

void GUIUtil::loadTheme ( QWidget *  widget = nullptr,
bool  fForce = false 
)

Load the theme and update all UI elements according to the appearance settings.

Definition at line 1782 of file guiutil.cpp.

References loadStyleSheet(), updateFonts(), and updateMacFocusRects().

Referenced by BitcoinApplication::createWindow(), and AppearanceWidget::updateTheme().

◆ migrateQtSettings()

void GUIUtil::migrateQtSettings ( )

Modify Qt network specific settings on migration.

Definition at line 1108 of file guiutil.cpp.

Referenced by NetworkStyle::NetworkStyle().

◆ openConfigfile()

void GUIUtil::openConfigfile ( )

◆ openDebugLogfile()

void GUIUtil::openDebugLogfile ( )

Definition at line 652 of file guiutil.cpp.

References boostPathToQString(), and GetDataDir().

Referenced by RPCConsole::on_openDebugLogfileButton_clicked().

◆ parseBitcoinURI() [1/2]

◆ parseBitcoinURI() [2/2]

bool GUIUtil::parseBitcoinURI ( QString  uri,
SendCoinsRecipient out 
)

Definition at line 425 of file guiutil.cpp.

References parseBitcoinURI().

◆ qstringToBoostPath()

fs::path GUIUtil::qstringToBoostPath ( const QString &  path)

Definition at line 1823 of file guiutil.cpp.

References utf8.

Referenced by FreespaceChecker::check(), and Intro::pickDataDirectory().

◆ setApplicationFont()

void GUIUtil::setApplicationFont ( )

Set an application wide default font, depends on the selected theme.

Definition at line 1522 of file guiutil.cpp.

References defaultFontSize, fontFamily, fontFamilyToString(), getFontNormal(), getFontWeightNormal(), getFontWeightNormalDefault(), and Montserrat.

Referenced by loadFonts(), and setFontFamily().

◆ setClipboard()

◆ setFont()

void GUIUtil::setFont ( const std::vector< QWidget * > &  vecWidgets,
FontWeight  weight,
int  nPointSize = -1,
bool  fItalic = false 
)

◆ setFontFamily()

void GUIUtil::setFontFamily ( FontFamily  family)

◆ setFontScale()

void GUIUtil::setFontScale ( int  nScale)

◆ setFontWeightBold()

void GUIUtil::setFontWeightBold ( QFont::Weight  weight)

◆ setFontWeightNormal()

void GUIUtil::setFontWeightNormal ( QFont::Weight  weight)

◆ setIcon() [1/2]

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).

Definition at line 247 of file guiutil.cpp.

References getIcon().

Referenced by SendCoinsEntry::setButtonIcons(), RPCConsole::setButtonIcons(), setIcon(), and SignVerifyMessageDialog::SignVerifyMessageDialog().

◆ setIcon() [2/2]

void GUIUtil::setIcon ( QAbstractButton *  button,
const QString &  strIcon,
const ThemedColor  color,
const QSize &  size 
)

Definition at line 253 of file guiutil.cpp.

References ICON_ALTERNATIVE_COLOR, and setIcon().

◆ SetStartOnSystemStartup()

bool GUIUtil::SetStartOnSystemStartup ( bool  fAutoStart)

Definition at line 1104 of file guiutil.cpp.

Referenced by OptionsModel::Reset(), and OptionsModel::setData().

◆ setStyleSheetDirectory()

void GUIUtil::setStyleSheetDirectory ( const QString &  path)

Change the stylesheet directory.

This is used by the parameter -custom-css-dir.

Definition at line 1120 of file guiutil.cpp.

References stylesheetDirectory.

Referenced by main().

◆ setupAddressWidget()

void GUIUtil::setupAddressWidget ( QValidatedLineEdit widget,
QWidget *  parent,
bool  fAllowURI 
)

◆ setupAmountWidget()

void GUIUtil::setupAmountWidget ( QLineEdit *  widget,
QWidget *  parent 
)

Definition at line 300 of file guiutil.cpp.

◆ setupAppearance()

◆ showBackups()

void GUIUtil::showBackups ( )

Definition at line 670 of file guiutil.cpp.

References boostPathToQString(), and GetBackupsDir().

Referenced by BitcoinGUI::showBackups().

◆ SubstituteFonts()

void GUIUtil::SubstituteFonts ( const QString &  language)

Definition at line 679 of file guiutil.cpp.

Referenced by main().

◆ supportedWeightFromIndex()

QFont::Weight GUIUtil::supportedWeightFromIndex ( int  nIndex)

Convert an index to a weight in the supported weights vector.

Definition at line 1751 of file guiutil.cpp.

References getSupportedWeights().

Referenced by OptionsModel::setData(), AppearanceWidget::updateFontWeightBold(), and AppearanceWidget::updateFontWeightNormal().

◆ supportedWeightToIndex()

int GUIUtil::supportedWeightToIndex ( QFont::Weight  weight)

Convert a weight to an index in the supported weights vector.

Definition at line 1758 of file guiutil.cpp.

References getSupportedWeights().

Referenced by OptionsModel::data().

◆ toQFontWeight()

QFont::Weight GUIUtil::toQFontWeight ( FontWeight  weight)

Convert GUIUtil::FontWeight to QFont::Weight.

Definition at line 1356 of file guiutil.cpp.

References Bold, getFontWeightBold(), and getFontWeightNormal().

Referenced by getFont().

◆ updateFonts()

◆ updateMacFocusRects()

void GUIUtil::updateMacFocusRects ( )

Enable/Disable the macOS focus rects depending on the current theme.

Definition at line 1801 of file guiutil.cpp.

References dashThemeActive().

Referenced by loadTheme().

◆ validateBitcoinURI()

bool GUIUtil::validateBitcoinURI ( const QString &  uri)

Definition at line 439 of file guiutil.cpp.

References parseBitcoinURI().

Referenced by BitcoinAddressEntryValidator::validate().

◆ weightFromArg()

bool GUIUtil::weightFromArg ( int  nArg,
QFont::Weight &  weight 
)

Convert weight value from args (0-8) to QFont::Weight.

Definition at line 1313 of file guiutil.cpp.

References Bold, and Normal.

Referenced by OptionsModel::data(), loadFonts(), and main().

◆ weightToArg()

int GUIUtil::weightToArg ( const QFont::Weight  weight)

Convert QFont::Weight to an arg value (0-8)

Definition at line 1334 of file guiutil.cpp.

References Bold, and Normal.

Referenced by HelpMessageDialog::HelpMessageDialog(), OptionsModel::Init(), main(), OptionsModel::setData(), and setupAppearance().

Variable Documentation

◆ cs_css

CCriticalSection GUIUtil::cs_css
static

Definition at line 97 of file guiutil.cpp.

Referenced by loadStyleSheet().

◆ darkThemePrefix

const QString GUIUtil::darkThemePrefix = "Dark"
static

Definition at line 107 of file guiutil.cpp.

Referenced by getThemedQColor(), and getThemedStyleQString().

◆ defaultFontFamily

const FontFamily GUIUtil::defaultFontFamily = FontFamily::SystemDefault
static

Font related default values.

Definition at line 119 of file guiutil.cpp.

Referenced by getFontFamilyDefault().

◆ defaultFontScale

const int GUIUtil::defaultFontScale = 0
static

Definition at line 129 of file guiutil.cpp.

Referenced by getFontScaleDefault().

◆ defaultFontSize

const int GUIUtil::defaultFontSize = 12
static

Definition at line 120 of file guiutil.cpp.

Referenced by loadFonts(), setApplicationFont(), and updateFonts().

◆ defaultFontWeightBold

const QFont::Weight GUIUtil::defaultFontWeightBold = QFont::Medium
static

Definition at line 128 of file guiutil.cpp.

Referenced by getFontWeightBoldDefault().

◆ defaultFontWeightNormal

const QFont::Weight GUIUtil::defaultFontWeightNormal = QFont::Light
static

Definition at line 127 of file guiutil.cpp.

Referenced by getFontWeightNormalDefault().

◆ defaultStylesheetDirectory

const QString GUIUtil::defaultStylesheetDirectory = ":css"
static

Definition at line 99 of file guiutil.cpp.

Referenced by isStyleSheetDirectoryCustom().

◆ defaultTheme

const QString GUIUtil::defaultTheme = "Light"
static

Definition at line 105 of file guiutil.cpp.

Referenced by getActiveTheme(), and getDefaultTheme().

◆ dummydata

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}
static

Definition at line 269 of file guiutil.cpp.

Referenced by DummyAddress().

◆ fontFamily

FontFamily GUIUtil::fontFamily = defaultFontFamily
static

Font related variables.

Definition at line 134 of file guiutil.cpp.

Referenced by getFont(), getFontFamily(), getSupportedWeights(), loadFonts(), setApplicationFont(), setFontFamily(), and setupAppearance().

◆ fontScale

int GUIUtil::fontScale = defaultFontScale
static

Definition at line 136 of file guiutil.cpp.

Referenced by getFontScale(), getScaledFontSize(), loadFonts(), and setFontScale().

◆ fontScaleSteps

const double GUIUtil::fontScaleSteps = 0.01
static

Definition at line 121 of file guiutil.cpp.

Referenced by getScaledFontSize().

◆ fontWeightBold

QFont::Weight GUIUtil::fontWeightBold = defaultFontWeightBold
static

Definition at line 140 of file guiutil.cpp.

Referenced by getFontWeightBold(), loadFonts(), setFontWeightBold(), and setupAppearance().

◆ fontWeightNormal

QFont::Weight GUIUtil::fontWeightNormal = defaultFontWeightNormal
static

Definition at line 138 of file guiutil.cpp.

Referenced by getFontWeightNormal(), loadFonts(), setFontWeightNormal(), and setupAppearance().

◆ mapNormalFontUpdates

std::map<QWidget*, std::tuple<FontWeight, bool, int> > GUIUtil::mapNormalFontUpdates
static

Definition at line 143 of file guiutil.cpp.

Referenced by setFont(), and updateFonts().

◆ mapStyleToTheme

const std::map<QString, QString> GUIUtil::mapStyleToTheme
static
Initial value:
{
{"general.css", ""},
{"dark.css", "Dark"},
{"light.css", "Light"},
{"traditional.css", "Traditional"}
}

Definition at line 109 of file guiutil.cpp.

Referenced by listStyleSheets(), and listThemes().

◆ mapSupportedWeights

std::map<FontFamily, std::vector<QFont::Weight> > GUIUtil::mapSupportedWeights
static

Definition at line 145 of file guiutil.cpp.

Referenced by getSupportedWeights(), loadFonts(), and setupAppearance().

◆ osDefaultFont

std::unique_ptr<QFont> GUIUtil::osDefaultFont
static

loadFonts stores the SystemDefault font in osDefaultFont to be able to reference it later again

Definition at line 117 of file guiutil.cpp.

Referenced by getFont(), loadFonts(), and updateFonts().

◆ stylesheetDirectory

QString GUIUtil::stylesheetDirectory = defaultStylesheetDirectory
static

◆ themedColors

const std::map<ThemedColor, QColor> GUIUtil::themedColors
static
Initial value:
= {
{ ThemedColor::DEFAULT, QColor(85, 85, 85) },
{ ThemedColor::UNCONFIRMED, QColor(128, 128, 128) },
{ ThemedColor::BLUE, QColor(0, 141, 228) },
{ ThemedColor::ORANGE, QColor(199, 147, 4) },
{ ThemedColor::RED, QColor(168, 72, 50) },
{ ThemedColor::GREEN, QColor(94, 140, 65) },
{ ThemedColor::BAREADDRESS, QColor(140, 140, 140) },
{ ThemedColor::TX_STATUS_OPENUNTILDATE, QColor(64, 64, 255) },
{ ThemedColor::BACKGROUND_WIDGET, QColor(234, 234, 236) },
{ ThemedColor::BORDER_WIDGET, QColor(220, 220, 220) },
{ ThemedColor::BACKGROUND_NETSTATS, QColor(210, 210, 210, 230) },
{ ThemedColor::BORDER_NETSTATS, QColor(180, 180, 180) },
{ ThemedColor::QR_PIXEL, QColor(85, 85, 85) },
{ ThemedColor::ICON_ALTERNATIVE_COLOR, QColor(167, 167, 167) },
}

Definition at line 152 of file guiutil.cpp.

Referenced by getThemedQColor().

◆ themedDarkColors

const std::map<ThemedColor, QColor> GUIUtil::themedDarkColors
static
Initial value:
= {
{ ThemedColor::DEFAULT, QColor(199, 199, 199) },
{ ThemedColor::UNCONFIRMED, QColor(170, 170, 170) },
{ ThemedColor::BLUE, QColor(0, 89, 154) },
{ ThemedColor::ORANGE, QColor(199, 147, 4) },
{ ThemedColor::RED, QColor(168, 72, 50) },
{ ThemedColor::GREEN, QColor(94, 140, 65) },
{ ThemedColor::BAREADDRESS, QColor(140, 140, 140) },
{ ThemedColor::TX_STATUS_OPENUNTILDATE, QColor(64, 64, 255) },
{ ThemedColor::BACKGROUND_WIDGET, QColor(45, 45, 46) },
{ ThemedColor::BORDER_WIDGET, QColor(74, 74, 75) },
{ ThemedColor::BACKGROUND_NETSTATS, QColor(45, 45, 46, 230) },
{ ThemedColor::BORDER_NETSTATS, QColor(74, 74, 75) },
{ ThemedColor::QR_PIXEL, QColor(199, 199, 199) },
{ ThemedColor::ICON_ALTERNATIVE_COLOR, QColor(74, 74, 75) },
}

Definition at line 169 of file guiutil.cpp.

Referenced by getThemedQColor().

◆ themedDarkStyles

const std::map<ThemedStyle, QString> GUIUtil::themedDarkStyles
static
Initial value:
= {
{ ThemedStyle::TS_INVALID, "background:#a84832;" },
{ ThemedStyle::TS_ERROR, "color:#a84832;" },
{ ThemedStyle::TS_SUCCESS, "color:#5e8c41;" },
{ ThemedStyle::TS_COMMAND, "color:#00599a;" },
{ ThemedStyle::TS_PRIMARY, "color:#c7c7c7;" },
{ ThemedStyle::TS_SECONDARY, "color:#aaa;" },
}

Definition at line 195 of file guiutil.cpp.

Referenced by getThemedStyleQString().

◆ themedStyles

const std::map<ThemedStyle, QString> GUIUtil::themedStyles
static
Initial value:
= {
{ ThemedStyle::TS_INVALID, "background:#a84832;" },
{ ThemedStyle::TS_ERROR, "color:#a84832;" },
{ ThemedStyle::TS_SUCCESS, "color:#5e8c41;" },
{ ThemedStyle::TS_COMMAND, "color:#008de4;" },
{ ThemedStyle::TS_PRIMARY, "color:#333;" },
{ ThemedStyle::TS_SECONDARY, "color:#444;" },
}

Definition at line 186 of file guiutil.cpp.

Referenced by getThemedStyleQString().

◆ traditionalTheme

const QString GUIUtil::traditionalTheme = "Traditional"
static

Definition at line 103 of file guiutil.cpp.

Referenced by dashThemeActive().

Released under the MIT license