diff options
| author | Wladimir J. van der Laan <[email protected]> | 2014-03-26 10:42:37 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2014-03-26 10:42:54 +0100 |
| commit | f284b5998a13c08f637c8f874234c8f3a6b2580a (patch) | |
| tree | 771e6d98297d33e7250c8c8a4d208d5d36b76cee /src/qt/guiutil.cpp | |
| parent | Fix test build after d138598 (diff) | |
| parent | qt: Only override -datadir if different from the default (diff) | |
| download | discoin-f284b5998a13c08f637c8f874234c8f3a6b2580a.tar.xz discoin-f284b5998a13c08f637c8f874234c8f3a6b2580a.zip | |
Merge pull request #3935
c61fe44 qt: Only override -datadir if different from the default (Wladimir J. van der Laan)
7e591c1 qt: Do proper boost::path conversion (Wladimir J. van der Laan)
Diffstat (limited to 'src/qt/guiutil.cpp')
| -rw-r--r-- | src/qt/guiutil.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 4a4fece3e..26c56c5be 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -33,6 +33,9 @@ #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> +#if BOOST_FILESYSTEM_VERSION >= 3 +#include <boost/filesystem/detail/utf8_codecvt_facet.hpp> +#endif #include <QAbstractItemView> #include <QApplication> @@ -54,6 +57,10 @@ #include <QUrlQuery> #endif +#if BOOST_FILESYSTEM_VERSION >= 3 +static boost::filesystem::detail::utf8_codecvt_facet utf8; +#endif + namespace GUIUtil { QString dateTimeStr(const QDateTime &date) @@ -352,7 +359,7 @@ void openDebugLogfile() /* Open debug.log with the associated application */ if (boost::filesystem::exists(pathDebug)) - QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathDebug.string()))); + QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathDebug))); } ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) : @@ -718,4 +725,27 @@ void setClipboard(const QString& str) QApplication::clipboard()->setText(str, QClipboard::Selection); } +#if BOOST_FILESYSTEM_VERSION >= 3 +boost::filesystem::path qstringToBoostPath(const QString &path) +{ + return boost::filesystem::path(path.toStdString(), utf8); +} + +QString boostPathToQString(const boost::filesystem::path &path) +{ + return QString::fromStdString(path.string(utf8)); +} +#else +#warning Conversion between boost path and QString can use invalid character encoding with boost_filesystem v2 and older +boost::filesystem::path qstringToBoostPath(const QString &path) +{ + return boost::filesystem::path(path.toStdString()); +} + +QString boostPathToQString(const boost::filesystem::path &path) +{ + return QString::fromStdString(path.string()); +} +#endif + } // namespace GUIUtil |