summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-07-29 20:59:54 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-08-09 20:15:12 (GMT)
commit42defb3516a8b7f06c7b0fbc832332a4e60c0f86 (patch)
treeb833bc3cf0166947da16345be511b71dcb04baca /Swift/Controllers/Chat
parent3c7b2b3dc884f347771f6e3036779193e7e45627 (diff)
downloadswift-42defb3516a8b7f06c7b0fbc832332a4e60c0f86.zip
swift-42defb3516a8b7f06c7b0fbc832332a4e60c0f86.tar.bz2
Enable better date formatting in the UI
This adds the ability to provide more specific date formatting via the Translator interface. The default translator will use Boost's formatting capabilities. The QtTranslator use more localized and better readable formatting. Test-Information: Tested with Qt 5.5.1 on OS X 10.11.6. Checked that tooltips and presence text in new chat views show the new formatting. Change-Id: I90ff5ab8b31fb41f2dcbea2c40b8846c534c355f
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp6
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp1
2 files changed, 3 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index e36728a..41a34b9 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -12,7 +12,6 @@
#include <Swiften/Avatars/AvatarManager.h>
#include <Swiften/Base/Algorithm.h>
-#include <Swiften/Base/DateTime.h>
#include <Swiften/Base/Log.h>
#include <Swiften/Base/format.h>
#include <Swiften/Chat/ChatStateNotifier.h>
@@ -33,6 +32,7 @@
#include <Swift/Controllers/Intl.h>
#include <Swift/Controllers/SettingConstants.h>
#include <Swift/Controllers/StatusUtil.h>
+#include <Swift/Controllers/Translator.h>
#include <Swift/Controllers/UIEvents/AcceptWhiteboardSessionUIEvent.h>
#include <Swift/Controllers/UIEvents/CancelWhiteboardSessionUIEvent.h>
#include <Swift/Controllers/UIEvents/InviteToMUCUIEvent.h>
@@ -74,7 +74,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ
}
Idle::ref idle;
if (theirPresence && (idle = theirPresence->getPayload<Idle>())) {
- startMessage += str(format(QT_TRANSLATE_NOOP("", ", who has been idle since %1%")) % dateTimeToLocalString(idle->getSince()));
+ startMessage += str(format(QT_TRANSLATE_NOOP("", ", who has been idle since %1%")) % Swift::Translator::getInstance()->ptimeToHumanReadableString(idle->getSince()));
}
startMessage += ": " + statusShowTypeToFriendlyName(theirPresence ? theirPresence->getShow() : StatusShow::None);
if (theirPresence && !theirPresence->getStatus().empty()) {
@@ -466,7 +466,7 @@ std::string ChatController::getStatusChangeString(std::shared_ptr<Presence> pres
}
Idle::ref idle;
if ((idle = presence->getPayload<Idle>())) {
- response += str(format(QT_TRANSLATE_NOOP("", " and has been idle since %1%")) % dateTimeToLocalString(idle->getSince()));
+ response += str(format(QT_TRANSLATE_NOOP("", " and has been idle since %1%")) % Swift::Translator::getInstance()->ptimeToHumanReadableString(idle->getSince()));
}
if (!response.empty()) {
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index a54c89e..b339bd0 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -12,7 +12,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Avatars/AvatarManager.h>