#define GUIUTIL_H
#include <QString>
+#include <QObject>
+#include <QMessageBox>
+#include <QWidget>
+#include <QEvent>
+#include <QTextEdit>
+
+#include <boost/filesystem.hpp>
QT_BEGIN_NAMESPACE
class QFont;
*/
namespace GUIUtil
{
+ /* Convert QString to OS specific boost path through UTF-8 */
+ boost::filesystem::path qstringToBoostPath(const QString &path);
+ /* Convert OS specific boost path to QString through UTF-8 */
+ QString boostPathToQString(const boost::filesystem::path &path);
+
// Create human-readable string from date
QString dateTimeStr(const QDateTime &datetime);
QString dateTimeStr(qint64 nTime);
- // Render bitcoin addresses in monospace font
+ // Render Bitcoin addresses in monospace font
QFont bitcoinAddressFont();
// Set up widgets for address and amounts
void setupAddressWidget(QLineEdit *widget, QWidget *parent);
void setupAmountWidget(QLineEdit *widget, QWidget *parent);
- // Parse "bitcoin:" URI into recipient object, return true on succesful parsing
+ // Parse "novacoin:" URI into recipient object, return true on successful parsing
// See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
*/
void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole);
- /** Get save file name, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
+ /** Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
when no suffix is provided by the user.
@param[in] parent Parent window (or 0)
// Determine whether a widget is hidden behind other windows
bool isObscured(QWidget *w);
+ // Open debug.log
+ void openDebugLogfile();
+ // Open novacoin.conf
+ void openConfigfile();
+ /** Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text
+ representation if needed. This assures that Qt can word-wrap long tooltip messages.
+ Tooltips longer than the provided size threshold (in characters) are wrapped.
+ */
+ class ToolTipToRichTextFilter : public QObject
+ {
+ Q_OBJECT
+
+ public:
+ explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0);
+
+ protected:
+ bool eventFilter(QObject *obj, QEvent *evt);
+
+ private:
+ int size_threshold;
+ };
+
+ bool GetStartOnSystemStartup();
+ bool SetStartOnSystemStartup(bool fAutoStart);
+
+ /** Help message for Bitcoin-Qt, shown with --help. */
+ class HelpMessageBox : public QMessageBox
+ {
+ Q_OBJECT
+
+ public:
+ HelpMessageBox(QWidget *parent = 0);
+
+ /** Show message box or print help message to standard output, based on operating system. */
+ void showOrPrint();
+
+ /** Print help message to console */
+ void printToConsole();
+
+ private:
+ QString header;
+ QString coreOptions;
+ QString uiOptions;
+
+ virtual bool event(QEvent *e)
+ {
+ bool res = QMessageBox::event(e);
+ if (e->type() == QEvent::MouseMove || e->type() == QEvent::MouseButtonPress)
+ {
+ setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
+ if (QWidget *textEdit = findChild<QTextEdit *>())
+ {
+ textEdit->setMaximumHeight(QWIDGETSIZE_MAX);
+ }
+ }
+
+ return res;
+ }
+ };
+ /* Convert seconds into a QString with days, hours, mins, secs */
+ QString formatDurationStr(int secs);
+
} // namespace GUIUtil
#endif // GUIUTIL_H