X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fguiutil.cpp;fp=src%2Fqt%2Fguiutil.cpp;h=57f3355ac1ec86108304cc1eeee41f466f7fcf87;hb=87d5c520124b8fcc14111d6e3b38c80651932e25;hp=090339b657b8079a5fe9ece4f9befaa6135e9b57;hpb=0068ce8ee8d23110a8d892f3213fe7335bf98813;p=novacoin.git diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 090339b..57f3355 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -26,6 +26,9 @@ #ifndef Q_MOC_RUN #include #include +#if BOOST_FILESYSTEM_VERSION >= 3 +#include +#endif #endif #ifdef WIN32 @@ -46,8 +49,33 @@ #include "shellapi.h" #endif +#if BOOST_FILESYSTEM_VERSION >= 3 +static boost::filesystem::detail::utf8_codecvt_facet utf8; +#endif + namespace GUIUtil { +#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 + QString dateTimeStr(const QDateTime &date) { return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm");