]> Git Repo - VerusCoin.git/blame - src/qt/guiutil.h
Merge branch 'master' into async-ipv6-rpc
[VerusCoin.git] / src / qt / guiutil.h
CommitLineData
0856c1a0
WL
1#ifndef GUIUTIL_H
2#define GUIUTIL_H
3
4#include <QString>
3793fa09 5#include <QObject>
5d6b3027 6#include <QMessageBox>
0856c1a0 7
e457b021
WL
8QT_BEGIN_NAMESPACE
9class QFont;
10class QLineEdit;
11class QWidget;
a99ac8d3 12class QDateTime;
db7f0234 13class QUrl;
c58e7d4e 14class QAbstractItemView;
e457b021 15QT_END_NAMESPACE
db7f0234 16class SendCoinsRecipient;
e457b021 17
86d56349 18/** Utility functions used by the Bitcoin Qt UI.
af836ad5 19 */
86d56349 20namespace GUIUtil
e457b021 21{
db7f0234 22 // Create human-readable string from date
86d56349 23 QString dateTimeStr(const QDateTime &datetime);
24 QString dateTimeStr(qint64 nTime);
e457b021 25
ff0ee876 26 // Render Bitcoin addresses in monospace font
86d56349 27 QFont bitcoinAddressFont();
e457b021 28
db7f0234 29 // Set up widgets for address and amounts
86d56349 30 void setupAddressWidget(QLineEdit *widget, QWidget *parent);
31 void setupAmountWidget(QLineEdit *widget, QWidget *parent);
db7f0234 32
fa2544e7
LD
33 // Parse "bitcoin:" URI into recipient object, return true on succesful parsing
34 // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
86d56349 35 bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
36 bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
e0734571
WL
37
38 // HTML escaping for rich text controls
86d56349 39 QString HtmlEscape(const QString& str, bool fMultiLine=false);
40 QString HtmlEscape(const std::string& str, bool fMultiLine=false);
c58e7d4e
WL
41
42 /** Copy a field of the currently selected entry of a view to the clipboard. Does nothing if nothing
43 is selected.
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
47 */
86d56349 48 void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole);
c58e7d4e 49
303a47c0
WL
50 /** Get save file name, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
51 when no suffix is provided by the user.
52
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.
59 */
86d56349 60 QString getSaveFileName(QWidget *parent=0, const QString &caption=QString(),
303a47c0
WL
61 const QString &dir=QString(), const QString &filter=QString(),
62 QString *selectedSuffixOut=0);
63
7e7bcce2
WL
64 /** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking.
65
66 @returns If called from the GUI thread, return a Qt::DirectConnection.
67 If called from another thread, return a Qt::BlockingQueuedConnection.
68 */
86d56349 69 Qt::ConnectionType blockingGUIThreadConnection();
70
71 // Determine whether a widget is hidden behind other windows
72 bool isObscured(QWidget *w);
7e7bcce2 73
4d3dda5d
PK
74 // Open debug.log
75 void openDebugLogfile();
76
3793fa09
WL
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.
80 */
58b01afc 81 class ToolTipToRichTextFilter : public QObject
3793fa09
WL
82 {
83 Q_OBJECT
5d6b3027 84
3793fa09 85 public:
58b01afc 86 explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0);
3793fa09
WL
87
88 protected:
89 bool eventFilter(QObject *obj, QEvent *evt);
90
91 private:
92 int size_threshold;
93 };
94
67d4cbab
WL
95 bool GetStartOnSystemStartup();
96 bool SetStartOnSystemStartup(bool fAutoStart);
97
5d6b3027
PK
98 /** Help message for Bitcoin-Qt, shown with --help. */
99 class HelpMessageBox : public QMessageBox
100 {
101 Q_OBJECT
102
103 public:
104 HelpMessageBox(QWidget *parent = 0);
105
106 void exec();
107
108 private:
109 QString header;
110 QString coreOptions;
111 QString uiOptions;
112 };
113
86d56349 114} // namespace GUIUtil
0856c1a0
WL
115
116#endif // GUIUTIL_H
This page took 0.080096 seconds and 4 git commands to generate.