14 class QAbstractItemView;
16 class SendCoinsRecipient;
18 /** Utility functions used by the Bitcoin Qt UI.
22 // Create human-readable string from date
23 QString dateTimeStr(const QDateTime &datetime);
24 QString dateTimeStr(qint64 nTime);
26 // Render Bitcoin addresses in monospace font
27 QFont bitcoinAddressFont();
29 // Set up widgets for address and amounts
30 void setupAddressWidget(QLineEdit *widget, QWidget *parent);
31 void setupAmountWidget(QLineEdit *widget, QWidget *parent);
33 // Parse "novacoin:" URI into recipient object, return true on successful parsing
34 // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
35 bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
36 bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
38 // HTML escaping for rich text controls
39 QString HtmlEscape(const QString& str, bool fMultiLine=false);
40 QString HtmlEscape(const std::string& str, bool fMultiLine=false);
42 /** Copy a field of the currently selected entry of a view to the clipboard. Does nothing if nothing
44 @param[in] column Data column to extract from the model
45 @param[in] role Data role to extract from the model
46 @see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress
48 void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole);
50 /** Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
51 when no suffix is provided by the user.
53 @param[in] parent Parent window (or 0)
54 @param[in] caption Window caption (or empty, for default)
55 @param[in] dir Starting directory (or empty, to default to documents directory)
56 @param[in] filter Filter specification such as "Comma Separated Files (*.csv)"
57 @param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0).
58 Can be useful when choosing the save file format based on suffix.
60 QString getSaveFileName(QWidget *parent=0, const QString &caption=QString(),
61 const QString &dir=QString(), const QString &filter=QString(),
62 QString *selectedSuffixOut=0);
64 /** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking.
66 @returns If called from the GUI thread, return a Qt::DirectConnection.
67 If called from another thread, return a Qt::BlockingQueuedConnection.
69 Qt::ConnectionType blockingGUIThreadConnection();
71 // Determine whether a widget is hidden behind other windows
72 bool isObscured(QWidget *w);
75 void openDebugLogfile();
77 /** Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text
78 representation if needed. This assures that Qt can word-wrap long tooltip messages.
79 Tooltips longer than the provided size threshold (in characters) are wrapped.
81 class ToolTipToRichTextFilter : public QObject
86 explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0);
89 bool eventFilter(QObject *obj, QEvent *evt);
95 bool GetStartOnSystemStartup();
96 bool SetStartOnSystemStartup(bool fAutoStart);
98 /** Help message for Bitcoin-Qt, shown with --help. */
99 class HelpMessageBox : public QMessageBox
104 HelpMessageBox(QWidget *parent = 0);
106 /** Show message box or print help message to standard output, based on operating system. */
109 /** Print help message to console */
110 void printToConsole();
118 } // namespace GUIUtil