12 class QAbstractItemView;
14 class SendCoinsRecipient;
16 /** Utility functions used by the Bitcoin Qt UI.
20 // Create human-readable string from date
21 QString dateTimeStr(const QDateTime &datetime);
22 QString dateTimeStr(qint64 nTime);
24 // Render bitcoin addresses in monospace font
25 QFont bitcoinAddressFont();
27 // Set up widgets for address and amounts
28 void setupAddressWidget(QLineEdit *widget, QWidget *parent);
29 void setupAmountWidget(QLineEdit *widget, QWidget *parent);
31 // Parse "bitcoin:" URI into recipient object, return true on succesful parsing
32 // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
33 bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
34 bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
36 // HTML escaping for rich text controls
37 QString HtmlEscape(const QString& str, bool fMultiLine=false);
38 QString HtmlEscape(const std::string& str, bool fMultiLine=false);
40 /** Copy a field of the currently selected entry of a view to the clipboard. Does nothing if nothing
42 @param[in] column Data column to extract from the model
43 @param[in] role Data role to extract from the model
44 @see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress
46 void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole);
48 /** Get save file name, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
49 when no suffix is provided by the user.
51 @param[in] parent Parent window (or 0)
52 @param[in] caption Window caption (or empty, for default)
53 @param[in] dir Starting directory (or empty, to default to documents directory)
54 @param[in] filter Filter specification such as "Comma Separated Files (*.csv)"
55 @param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0).
56 Can be useful when choosing the save file format based on suffix.
58 QString getSaveFileName(QWidget *parent=0, const QString &caption=QString(),
59 const QString &dir=QString(), const QString &filter=QString(),
60 QString *selectedSuffixOut=0);
62 /** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking.
64 @returns If called from the GUI thread, return a Qt::DirectConnection.
65 If called from another thread, return a Qt::BlockingQueuedConnection.
67 Qt::ConnectionType blockingGUIThreadConnection();
69 // Determine whether a widget is hidden behind other windows
70 bool isObscured(QWidget *w);
72 } // namespace GUIUtil