mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-04 09:05:34 -05:00
Added and modified patch from Henry
Modified the date format according to the chosen language (locale). git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5798 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
59ed165c81
commit
a573211629
@ -41,6 +41,7 @@
|
||||
#include "channels/ShareKey.h"
|
||||
#include "notifyqt.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "rshare.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsforums.h>
|
||||
@ -1519,11 +1520,11 @@ static QString buildReplyHeader(const ForumMsgInfo &msgInfo)
|
||||
QString header = QString("<span>-----%1-----").arg(QApplication::translate("ForumsDialog", "Original Message"));
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("ForumsDialog", "From"), from);
|
||||
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("ForumsDialog", "Sent"), qtime.toString(Qt::SystemLocaleLongDate));
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("ForumsDialog", "Sent"), Rshare::customLongDate(msgInfo.ts));
|
||||
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(QApplication::translate("ForumsDialog", "Subject"), QString::fromStdWString(msgInfo.title));
|
||||
header += "<br>";
|
||||
|
||||
header += QApplication::translate("ForumsDialog", "On %1, %2 wrote:").arg(qtime.toString(Qt::SystemLocaleShortDate), from);
|
||||
header += QApplication::translate("ForumsDialog", "On %1, %2 wrote:").arg(qtime.toString(Qt::DefaultLocaleShortDate), from);
|
||||
|
||||
return header;
|
||||
}
|
||||
@ -1834,14 +1835,12 @@ void ForumsFillThread::run()
|
||||
else
|
||||
qtime.setTime_t(tit->ts);
|
||||
|
||||
text = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
text = qtime.toString(Qt::DefaultLocaleShortDate);
|
||||
if (useChildTS)
|
||||
{
|
||||
QDateTime qtime2;
|
||||
qtime2.setTime_t(tit->ts);
|
||||
QString timestamp2 = qtime2.toString("yyyy-MM-dd hh:mm:ss");
|
||||
qtime.setTime_t(tit->ts);
|
||||
text += " / ";
|
||||
text += timestamp2;
|
||||
text += qtime.toString(Qt::DefaultLocaleShortDate);
|
||||
}
|
||||
item->setText(COLUMN_THREAD_DATE, text);
|
||||
}
|
||||
@ -1947,15 +1946,13 @@ void ForumsFillThread::run()
|
||||
else
|
||||
qtime.setTime_t(mit->ts);
|
||||
|
||||
text = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
text = qtime.toString(Qt::DefaultLocaleShortDate);
|
||||
|
||||
if (useChildTS)
|
||||
{
|
||||
QDateTime qtime2;
|
||||
qtime2.setTime_t(mit->ts);
|
||||
QString timestamp2 = qtime2.toString("yyyy-MM-dd hh:mm:ss");
|
||||
qtime.setTime_t(mit->ts);
|
||||
text += " / ";
|
||||
text += timestamp2;
|
||||
text += qtime.toString(Qt::DefaultLocaleShortDate);
|
||||
}
|
||||
child->setText(COLUMN_THREAD_DATE, text);
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ void FriendsDialog::setChatInfo(QString info, QColor color)
|
||||
ui.msgText->clear();
|
||||
nbLines = 1;
|
||||
}
|
||||
ui.msgText->append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + info + QString::fromUtf8("</i></font>"));
|
||||
ui.msgText->append("<font color='grey'>" + QTime::currentTime().toString(Qt::DefaultLocaleShortDate) + "</font> - <font color='" + color.name() + "'><i>" + info + "</i></font>");
|
||||
}
|
||||
|
||||
void FriendsDialog::on_actionClear_Chat_History_triggered()
|
||||
|
@ -29,9 +29,6 @@
|
||||
#include <time.h>
|
||||
#include <iostream>
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||
|
||||
/** Default constructor */
|
||||
GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mOnlyGenerateIdentity(onlyGenerateIdentity)
|
||||
|
@ -19,6 +19,7 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
#include "ChannelDetails.h"
|
||||
#include "rshare.h"
|
||||
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
@ -33,9 +34,6 @@
|
||||
#include <string>
|
||||
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||
|
||||
/** Default constructor */
|
||||
ChannelDetails::ChannelDetails(QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
@ -53,8 +51,6 @@ ChannelDetails::ChannelDetails(QWidget *parent)
|
||||
|
||||
ui.typeEncrypted->setEnabled(false);
|
||||
ui.typePrivate->setEnabled(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -71,11 +67,6 @@ ChannelDetails::show()
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelDetails::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
void ChannelDetails::showDetails(std::string mChannelId)
|
||||
{
|
||||
cId = mChannelId;
|
||||
@ -84,7 +75,6 @@ void ChannelDetails::showDetails(std::string mChannelId)
|
||||
|
||||
void ChannelDetails::loadChannel()
|
||||
{
|
||||
|
||||
if (!rsChannels)
|
||||
{
|
||||
return;
|
||||
@ -105,10 +95,7 @@ void ChannelDetails::loadChannel()
|
||||
|
||||
// Set Last Channel Post Date
|
||||
if (ci.lastPost) {
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(ci.lastPost);
|
||||
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
ui.postline -> setText(timestamp);
|
||||
ui.postline->setText(Rshare::customLongDate(ci.lastPost));
|
||||
}
|
||||
|
||||
// Set Channel ID
|
||||
@ -127,5 +114,4 @@ void ChannelDetails::loadChannel()
|
||||
ui.typeEncrypted->setChecked(true);
|
||||
ui.typePrivate->setChecked(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,9 +44,6 @@ public slots:
|
||||
/** Overloaded QWidget.show */
|
||||
void show();
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
|
||||
private:
|
||||
void loadChannel();
|
||||
|
||||
|
@ -323,8 +323,8 @@ QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, co
|
||||
#endif
|
||||
|
||||
QString formatMsg = style.replace("%name%", name)
|
||||
.replace("%date%", timestamp.date().toString("dd.MM.yyyy"))
|
||||
.replace("%time%", timestamp.time().toString("hh:mm:ss"))
|
||||
.replace("%date%", timestamp.date().toString(Qt::DefaultLocaleShortDate))
|
||||
.replace("%time%", timestamp.time().toString(Qt::DefaultLocaleShortDate))
|
||||
#ifdef COLORED_NICKNAMES
|
||||
.replace("%color%", color.name())
|
||||
#endif
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "rshare.h"
|
||||
|
||||
static QMap<std::string, ConfCertDialog*> instances;
|
||||
|
||||
@ -56,9 +57,6 @@ ConfCertDialog *ConfCertDialog::instance(const std::string& peer_id)
|
||||
return d;
|
||||
}
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||
|
||||
/** Default constructor */
|
||||
ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags), mId(id)
|
||||
@ -167,9 +165,7 @@ void ConfCertDialog::load()
|
||||
|
||||
ui.loc->setText(QString::fromUtf8(detail.location.c_str()));
|
||||
// Dont Show a timestamp in RS calculate the day
|
||||
QDateTime date = QDateTime::fromTime_t(detail.lastConnect);
|
||||
QString stime = date.toString(Qt::LocalDate);
|
||||
ui.lastcontact-> setText(stime);
|
||||
ui.lastcontact->setText(Rshare::customLongDate(detail.lastConnect));
|
||||
|
||||
/* set retroshare version */
|
||||
std::map<std::string, std::string>::iterator vit;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QTimer>
|
||||
#include <QFileInfo>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "rshare.h"
|
||||
#include "ChanMsgItem.h"
|
||||
@ -188,10 +188,7 @@ void ChanMsgItem::updateItemStatic()
|
||||
msgLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
msgFrame->setVisible(!cmi.msg.empty());
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(cmi.ts);
|
||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
||||
datetimelabel->setText(timestamp);
|
||||
datetimelabel->setText(Rshare::customLongDate(cmi.ts));
|
||||
|
||||
filelabel->setText(QString("(%1 %2) %3").arg(cmi.count).arg(tr("Files")).arg(misc::friendlyUnit(cmi.size)));
|
||||
|
||||
@ -210,11 +207,11 @@ void ChanMsgItem::updateItemStatic()
|
||||
/* add file */
|
||||
SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size,
|
||||
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
|
||||
mFileItems.push_back(fi);
|
||||
|
||||
/* check if the file is a media file */
|
||||
if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix()))
|
||||
fi->mediatype();
|
||||
mFileItems.push_back(fi);
|
||||
|
||||
/* check if the file is a media file */
|
||||
if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix()))
|
||||
fi->mediatype();
|
||||
|
||||
|
||||
QLayout *layout = expandFrame->layout();
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "util/HandleRichText.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "rshare.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
@ -137,8 +138,7 @@ void ChatMsgItem::insertChat(const std::string &message)
|
||||
std::cerr << "ChatMsgItem::insertChat(): " << msg << std::endl;
|
||||
#endif
|
||||
|
||||
QString timestamp = QDateTime::currentDateTime().toString("hh:mm:ss");
|
||||
timestampLabel->setText(timestamp);
|
||||
timestampLabel->setText(Rshare::customLongDate(QDateTime::currentDateTime()));
|
||||
|
||||
QString formatMsg = QString::fromUtf8(message.c_str());
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/ForumsDialog.h"
|
||||
#include "rshare.h"
|
||||
//#include "gui/settings/rsharesettings.h"
|
||||
|
||||
/****
|
||||
@ -64,7 +65,9 @@ ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::strin
|
||||
|
||||
subjectLabel->setMinimumWidth(20);
|
||||
|
||||
small();
|
||||
nextFrame->hide();
|
||||
prevFrame->hide();
|
||||
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
textEdit->hide();
|
||||
@ -158,10 +161,7 @@ void ForumMsgItem::updateItemStatic()
|
||||
prevSubLabel->setText(link.toHtml());
|
||||
prevMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(msg.ts);
|
||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
||||
timestamplabel->setText(timestamp);
|
||||
timestamplabel->setText(Rshare::customLongDate(msg.ts));
|
||||
|
||||
nextFrame->hide();
|
||||
}
|
||||
@ -183,10 +183,7 @@ void ForumMsgItem::updateItemStatic()
|
||||
nextSubLabel->setText(link.toHtml());
|
||||
nextMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(msg.ts);
|
||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
||||
timestamplabel->setText(timestamp);
|
||||
timestamplabel->setText(Rshare::customLongDate(msg.ts));
|
||||
|
||||
prevSHLabel->setText(tr("In Reply to") + ": ");
|
||||
|
||||
@ -244,12 +241,6 @@ void ForumMsgItem::updateItem()
|
||||
#endif
|
||||
}
|
||||
|
||||
void ForumMsgItem::small()
|
||||
{
|
||||
nextFrame->hide();
|
||||
prevFrame->hide();
|
||||
}
|
||||
|
||||
void ForumMsgItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
@ -36,7 +36,6 @@ public:
|
||||
ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include "rshare.h"
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
@ -56,7 +56,8 @@ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId,
|
||||
connect( deleteButton, SIGNAL( clicked( void ) ), this, SLOT( deleteMsg ( void ) ) );
|
||||
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyMsg ( void ) ) );
|
||||
|
||||
small();
|
||||
expandFrame->hide();
|
||||
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
}
|
||||
@ -92,9 +93,7 @@ void MsgItem::updateItemStatic()
|
||||
}
|
||||
|
||||
{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mi.ts);
|
||||
timestampLabel->setText(qtime.toString("dd.MMMM yyyy hh:mm:ss"));
|
||||
timestampLabel->setText(Rshare::customLongDate(mi.ts));
|
||||
}
|
||||
|
||||
if (!mIsHome)
|
||||
@ -188,12 +187,6 @@ void MsgItem::updateItem()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MsgItem::small()
|
||||
{
|
||||
expandFrame->hide();
|
||||
}
|
||||
|
||||
void MsgItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/common/StatusDefs.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "rshare.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
@ -71,7 +72,8 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const std::string &peerI
|
||||
|
||||
avatar->setId(mPeerId, false);
|
||||
|
||||
small();
|
||||
expandFrame->hide();
|
||||
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
}
|
||||
@ -116,10 +118,7 @@ void PeerItem::updateItemStatic()
|
||||
{
|
||||
/* set peer name */
|
||||
peerNameLabel->setText(QString::fromUtf8(details.name.c_str()));
|
||||
|
||||
QDateTime date = QDateTime::fromTime_t(details.lastConnect);
|
||||
QString stime = date.toString("dd.MMMM yyyy hh:mm");
|
||||
lastLabel-> setText(stime);
|
||||
lastLabel-> setText(Rshare::customLongDate(details.lastConnect));
|
||||
|
||||
/* expanded Info */
|
||||
nameLabel->setText(QString::fromUtf8(details.name.c_str()));
|
||||
@ -208,11 +207,6 @@ void PeerItem::updateItem()
|
||||
return;
|
||||
}
|
||||
|
||||
void PeerItem::small()
|
||||
{
|
||||
expandFrame->hide();
|
||||
}
|
||||
|
||||
void PeerItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
@ -41,7 +41,6 @@ public:
|
||||
PeerItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, uint32_t type, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include "rshare.h"
|
||||
|
||||
/*****
|
||||
* #define DEBUG_ITEM 1
|
||||
@ -84,7 +85,8 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const std::strin
|
||||
|
||||
avatar->setId(mSslId, false);
|
||||
|
||||
small();
|
||||
expandFrame->hide();
|
||||
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
}
|
||||
@ -143,7 +145,7 @@ void SecurityItem::updateItemStatic()
|
||||
titleLabel->setText(title);
|
||||
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
timeLabel->setText(currentTime.toString("dd.MMMM yyyy hh:mm"));
|
||||
timeLabel->setText(Rshare::customLongDate(currentTime.toTime_t()));
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
@ -274,11 +276,6 @@ void SecurityItem::updateItem()
|
||||
return;
|
||||
}
|
||||
|
||||
void SecurityItem::small()
|
||||
{
|
||||
expandFrame->hide();
|
||||
}
|
||||
|
||||
void SecurityItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
@ -41,7 +41,6 @@ public:
|
||||
SecurityItem(FeedHolder *parent, uint32_t feedId, const std::string &gpgId, const std::string &sslId, const std::string& ip_addr,uint32_t type, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
|
||||
bool isSame(const std::string &sslId, uint32_t type);
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
#include "ForumDetails.h"
|
||||
#include "rshare.h"
|
||||
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
@ -32,10 +33,6 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||
|
||||
/** Default constructor */
|
||||
ForumDetails::ForumDetails(QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
@ -69,11 +66,6 @@ ForumDetails::show()
|
||||
}
|
||||
}
|
||||
|
||||
void ForumDetails::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
void ForumDetails::showDetails(std::string mCurrForumId)
|
||||
{
|
||||
fId = mCurrForumId;
|
||||
@ -98,10 +90,7 @@ void ForumDetails::loadDialog()
|
||||
|
||||
// Set Last Post Date
|
||||
if (fi.lastPost) {
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(fi.lastPost);
|
||||
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
ui.postline->setText(timestamp);
|
||||
ui.postline->setText(Rshare::customLongDate(fi.lastPost));
|
||||
}
|
||||
|
||||
// Set Forum ID
|
||||
|
@ -44,9 +44,6 @@ public slots:
|
||||
/** Overloaded QWidget.show */
|
||||
void show();
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
|
||||
private:
|
||||
void loadDialog();
|
||||
|
||||
|
@ -957,11 +957,11 @@ QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
|
||||
header += QString("<font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("Cc"), cc);
|
||||
}
|
||||
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("Sent"), qtime.toString(Qt::SystemLocaleLongDate));
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("Sent"), Rshare::customLongDate(qtime));
|
||||
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(tr("Subject"), QString::fromStdWString(msgInfo.title));
|
||||
header += "<br>";
|
||||
|
||||
header += tr("On %1, %2 wrote:").arg(qtime.toString(Qt::SystemLocaleShortDate), from);
|
||||
header += tr("On %1, %2 wrote:").arg(qtime.toString(Qt::DefaultLocaleShortDate), from);
|
||||
|
||||
return header;
|
||||
}
|
||||
|
@ -536,8 +536,7 @@ void MessageWidget::fill(const std::string &msgId)
|
||||
{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(msgInfo.ts);
|
||||
QString timestamp = qtime.toString("dd.MM.yyyy hh:mm:ss");
|
||||
ui.dateText->setText(timestamp);
|
||||
ui.dateText->setText(qtime.toString(Qt::DefaultLocaleShortDate));
|
||||
}
|
||||
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
@ -116,7 +116,7 @@ void BlogDetails::loadBlog()
|
||||
{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(it->lastPost);
|
||||
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QString timestamp = qtime.toString(Qt::DefaultLocaleShortDate);
|
||||
ui.postline -> setText(timestamp);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
|
||||
#include <retroshare/rsblogs.h>
|
||||
|
||||
#include "rshare.h"
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
@ -93,10 +93,7 @@ void BlogsMsgItem::updateItemStatic()
|
||||
//msgLabel->setText(QString::fromStdWString(cmi.msg));
|
||||
//msgcommentstextEdit->setHtml(QString::fromStdWString(cmi.msg));
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(cmi.ts);
|
||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm:ss");
|
||||
datetimelabel->setText(timestamp);
|
||||
datetimelabel->setText(Rshare::customDate(cmi.ts));
|
||||
|
||||
//playButton->setEnabled(false);
|
||||
|
||||
|
@ -65,6 +65,36 @@ LanguageSupport::languages()
|
||||
}
|
||||
return languages;
|
||||
}
|
||||
QMap<QString, QLocale>
|
||||
LanguageSupport::locales()
|
||||
{
|
||||
static QMap<QString, QLocale> locales;
|
||||
if (locales.isEmpty()) {
|
||||
//locales.insert("af", QLocale(QLocale::Afrikaans, QLocale::SouthAfrica));
|
||||
//locales.insert("bg", QLocale(QLocale::Bulgarian, QLocale::Bulgaria),);
|
||||
//locales.insert("cy", QLocale(QLocale::Welsh, QLocale::UnitedKingdom));
|
||||
locales.insert("cs", QLocale(QLocale::Czech, QLocale::CzechRepublic));
|
||||
locales.insert("de", QLocale(QLocale::German, QLocale::Germany));
|
||||
locales.insert("da", QLocale(QLocale::Danish, QLocale::Denmark));
|
||||
locales.insert("en", QLocale(QLocale::English, QLocale::UnitedStates));
|
||||
locales.insert("es", QLocale(QLocale::Spanish, QLocale::Spain));
|
||||
locales.insert("fr", QLocale(QLocale::French, QLocale::France));
|
||||
locales.insert("fi", QLocale(QLocale::Finnish, QLocale::Finland));
|
||||
//locales.insert("gr", QLocale(QLocale::Greek, QLocale::Greece));
|
||||
//locales.insert("it", QLocale(QLocale::Italian, QLocale::Italy));
|
||||
locales.insert("ja", QLocale(QLocale::Japanese, QLocale::Japan));
|
||||
locales.insert("ko", QLocale(QLocale::Korean, QLocale::RepublicOfKorea));
|
||||
locales.insert("pl", QLocale(QLocale::Polish, QLocale::Poland));
|
||||
//locales.insert("pt", QLocale(QLocale::Portuguese, QLocale::Brazil));
|
||||
locales.insert("ru", QLocale(QLocale::Russian, QLocale::RussianFederation));
|
||||
//locales.insert("sl", QLocale(QLocale::Slovenian, QLocale::Slovenia));
|
||||
//locales.insert("sr", QLocale(QLocale::Serbian, QLocale::SerbiaAndMontenegro));
|
||||
locales.insert("sv", QLocale(QLocale::Swedish, QLocale::Sweden));
|
||||
locales.insert("tr", QLocale(QLocale::Turkish, QLocale::Turkey));
|
||||
locales.insert("zh", QLocale(QLocale::Chinese, QLocale::China));
|
||||
}
|
||||
return locales;
|
||||
}
|
||||
|
||||
/** Returns the default language code for the system locale. */
|
||||
QString
|
||||
@ -221,3 +251,11 @@ bool LanguageSupport::translatePlugins(const QString &languageCode)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/** Sets the application's locale according to the specified language. */
|
||||
bool LanguageSupport::localize(const QString &languageCode)
|
||||
{
|
||||
if (!isValidLanguageCode(languageCode))
|
||||
return false;
|
||||
QLocale::setDefault(locales().key(languageCode));
|
||||
return true;
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
static QStringList languageNames();
|
||||
/** Returns a list of all supported language codes and names. */
|
||||
static QMap<QString, QString> languages();
|
||||
/** Returns a list of all supported language codes and locales. */
|
||||
static QMap<QString, QLocale> locales();
|
||||
/** Returns true if we understand the given language code. */
|
||||
static bool isValidLanguageCode(const QString &languageCode);
|
||||
/** Returns true if <b>languageCode</b> requires a right-to-left layout. */
|
||||
@ -50,6 +52,8 @@ public:
|
||||
static bool translate(const QString &languageCode);
|
||||
/** Sets the application's translator to the specified language for the plugins. */
|
||||
static bool translatePlugins(const QString &languageCode);
|
||||
/** Sets the application's locale according to the specified language. */
|
||||
static bool localize(const QString &languageCode);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include <QShortcut>
|
||||
#include <QStyleFactory>
|
||||
#include <QStyle>
|
||||
#include <QString>
|
||||
#include <QLocale>
|
||||
#include <QRegExp>
|
||||
#include <QDateTime>
|
||||
#include <gui/common/vmessagebox.h>
|
||||
#include <gui/common/html.h>
|
||||
#include <util/stringutil.h>
|
||||
@ -53,6 +57,8 @@ QMap<QString, QString> Rshare::_args; /**< List of command-line arguments. */
|
||||
QString Rshare::_style; /**< The current GUI style. */
|
||||
QString Rshare::_language; /**< The current language. */
|
||||
QString Rshare::_stylesheet; /**< The current GUI stylesheet. */
|
||||
QString Rshare::_datetimeformat; /**< The format of dates in feed items etc. */
|
||||
QLocale Rshare::_locale; /**< The locale. */
|
||||
Log Rshare::_log;
|
||||
bool Rshare::useConfigDir;
|
||||
QString Rshare::configDir;
|
||||
@ -330,6 +336,53 @@ Rshare::setLanguage(QString languageCode)
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Sets the locale RetroShare will use. If a language was specified on the
|
||||
* command-line, we will use one according to that. Otherwise, we'll check to see if a language was
|
||||
* saved previously. If not, we'll default to the system
|
||||
* locale. */
|
||||
bool
|
||||
Rshare::setLocale(QString languageCode)
|
||||
{
|
||||
bool retVal = false;
|
||||
/* If the language code is empty, use the previously-saved setting */
|
||||
if (languageCode.isEmpty()) {
|
||||
languageCode = Settings->getLanguageCode();
|
||||
}
|
||||
/* Set desired locale as default locale */
|
||||
if (LanguageSupport::localize(languageCode)) {
|
||||
retVal=true;
|
||||
}
|
||||
customizeDateFormat();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/** return custom formatted date */
|
||||
QString Rshare::customLongDate(uint fromTime)
|
||||
{
|
||||
return customLongDate(QDateTime::fromTime_t(fromTime));
|
||||
}
|
||||
|
||||
QString Rshare::customLongDate(const QDateTime &fromTime)
|
||||
{
|
||||
if (_datetimeformat.isEmpty()) {
|
||||
return fromTime.toString(Qt::ISODate);
|
||||
} else {
|
||||
return _locale.toString(fromTime, _datetimeformat);
|
||||
}
|
||||
}
|
||||
|
||||
/** customize date format for feeds etc. */
|
||||
void Rshare::customizeDateFormat()
|
||||
{
|
||||
_locale = QLocale(); // set to default locale
|
||||
/* get long date format without weekday */
|
||||
QString dateformat = _locale.dateFormat(QLocale::LongFormat);
|
||||
dateformat.replace(QRegExp("^dddd,*[^ ]* *('[^']+' )*"), "");
|
||||
dateformat.replace(QRegExp(",* *dddd"), "");
|
||||
dateformat = dateformat.trimmed();
|
||||
_datetimeformat = dateformat + " " + _locale.timeFormat(QLocale::ShortFormat);
|
||||
}
|
||||
|
||||
/** Sets the GUI style RetroShare will use. If one was specified on the
|
||||
* command-line, we will use that. Otherwise, we'll check to see if one was
|
||||
* saved previously. If not, we'll default to one appropriate for the
|
||||
@ -370,7 +423,10 @@ void Rshare::resetLanguageAndStyle()
|
||||
/** Translate the GUI to the appropriate language. */
|
||||
setLanguage(_args.value(ARG_LANGUAGE));
|
||||
|
||||
/** Set the GUI style appropriately. */
|
||||
/** Set the locale appropriately. */
|
||||
setLocale(_args.value(ARG_LANGUAGE));
|
||||
|
||||
/** Set the GUI style appropriately. */
|
||||
setStyle(_args.value(ARG_GUISTYLE));
|
||||
|
||||
/** Set the GUI stylesheet appropriately. */
|
||||
|
@ -73,6 +73,11 @@ public:
|
||||
|
||||
/** Sets the current language. */
|
||||
static bool setLanguage(QString languageCode = QString());
|
||||
/** Sets the current locale. */
|
||||
static bool setLocale(QString languageCode = QString());
|
||||
/** Returns custom formatted date */
|
||||
static QString customLongDate(uint fromTime);
|
||||
static QString customLongDate(const QDateTime &fromTime);
|
||||
/** Sets the current GUI style. */
|
||||
static bool setStyle(QString styleKey = QString());
|
||||
/** Sets the current GUI stylesheet. */
|
||||
@ -149,6 +154,8 @@ private slots:
|
||||
void blinkTimer();
|
||||
|
||||
private:
|
||||
/** customize the date format (defaultlongformat) */
|
||||
static void customizeDateFormat();
|
||||
/** Catches debugging messages from Qt and sends them to
|
||||
* RetroShare's logs. */
|
||||
static void qt_msg_handler(QtMsgType type, const char *msg);
|
||||
@ -162,6 +169,8 @@ private:
|
||||
static QString _style; /**< The current GUI style. */
|
||||
static QString _stylesheet; /**< The current GUI stylesheet. */
|
||||
static QString _language; /**< The current language. */
|
||||
static QString _datetimeformat; /**< The format for dates in feed items etc. */
|
||||
static QLocale _locale; /**< The locale (object). */
|
||||
static Log _log; /**< Logs debugging messages to file or stdout. */
|
||||
|
||||
static bool useConfigDir;
|
||||
|
Loading…
x
Reference in New Issue
Block a user