X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fguiutil.cpp;h=090339b657b8079a5fe9ece4f9befaa6135e9b57;hb=ecfb608bb8dd6719b80d097ec4e2755cd373777f;hp=ab20bca81d4eebd352d9586f8d4f10f630da01ca;hpb=cd3bd74f7b0d4e9e9f0f3bcd3fb55262406f5097;p=novacoin.git diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index ab20bca..090339b 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -10,8 +10,12 @@ #include #include #include +#if QT_VERSION >= 0x050000 +#include +#else #include -#include // For Qt::escape +#endif +#include // For Qt::mightBeRichText #include #include #include @@ -19,8 +23,10 @@ #include #include +#ifndef Q_MOC_RUN #include #include +#endif #ifdef WIN32 #ifdef _WIN32_WINNT @@ -84,7 +90,12 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) SendCoinsRecipient rv; rv.address = uri.path(); rv.amount = 0; +#if QT_VERSION < 0x050000 QList > items = uri.queryItems(); +#else + QUrlQuery uriQuery(uri); + QList > items = uriQuery.queryItems(); +#endif for (QList >::iterator i = items.begin(); i != items.end(); i++) { bool fShouldReturnFalse = false; @@ -137,7 +148,11 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out) QString HtmlEscape(const QString& str, bool fMultiLine) { +#if QT_VERSION < 0x050000 QString escaped = Qt::escape(str); +#else + QString escaped = str.toHtmlEscaped(); +#endif if(fMultiLine) { escaped = escaped.replace("\n", "
\n"); @@ -172,7 +187,11 @@ QString getSaveFileName(QWidget *parent, const QString &caption, QString myDir; if(dir.isEmpty()) // Default to user documents location { +#if QT_VERSION < 0x050000 myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); +#else + myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); +#endif } else { @@ -246,6 +265,15 @@ void openDebugLogfile() QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathDebug.string()))); } +void openConfigfile() +{ + boost::filesystem::path pathConfig = GetConfigFile(); + + /* Open novacoin.conf with the associated application */ + if (boost::filesystem::exists(pathConfig)) + QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathConfig.string()))); +} + ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) : QObject(parent), size_threshold(size_threshold) { @@ -430,10 +458,15 @@ HelpMessageBox::HelpMessageBox(QWidget *parent) : " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; setWindowTitle(tr("NovaCoin-Qt")); + setFont(bitcoinAddressFont()); setTextFormat(Qt::PlainText); // setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider. setText(header + QString(QChar(0x2003)).repeated(50)); setDetailedText(coreOptions + "\n" + uiOptions); + addButton("OK", QMessageBox::RejectRole); //кнопка OK будет справа от кнопки "Скрыть подробности" + //addButton("OK", QMessageBox::NoRole); //кнопка OK будет слева от кнопки "Скрыть подробности" + setMouseTracking(true); + setSizeGripEnabled(true); } void HelpMessageBox::printToConsole() @@ -454,5 +487,25 @@ void HelpMessageBox::showOrPrint() #endif } +QString formatDurationStr(int secs) +{ + QStringList strList; + int days = secs / 86400; + int hours = (secs % 86400) / 3600; + int mins = (secs % 3600) / 60; + int seconds = secs % 60; + + if (days) + strList.append(QString(QObject::tr("%1 d")).arg(days)); + if (hours) + strList.append(QString(QObject::tr("%1 h")).arg(hours)); + if (mins) + strList.append(QString(QObject::tr("%1 m")).arg(mins)); + if (seconds || (!days && !hours && !mins)) + strList.append(QString(QObject::tr("%1 s")).arg(seconds)); + + return strList.join(" "); +} + } // namespace GUIUtil