X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fidentityeditwidget.cpp;h=9085ae9014ea1870c182a3d918e598005ab474e2;hp=eb93ff42e22f2b6b4039fa8657f327f40d3fb977;hb=4c5b4bf5355413e3f3df3704512ff350fa062961;hpb=921e54680da16fcf2adb7a90506875aceb6633a4 diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp index eb93ff42..9085ae90 100644 --- a/src/qtui/settingspages/identityeditwidget.cpp +++ b/src/qtui/settingspages/identityeditwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -85,6 +85,52 @@ IdentityEditWidget::IdentityEditWidget(QWidget *parent) ui.sslCertGroupBox->setAcceptDrops(true); ui.sslCertGroupBox->installEventFilter(this); #endif + + if (Client::coreFeatures() & Quassel::AwayFormatTimestamp) { + // Core allows formatting %%timestamp%% messages in away strings. Update tooltips. + QString strFormatTooltip; + QTextStream formatTooltip( &strFormatTooltip, QIODevice::WriteOnly ); + formatTooltip << ""; + + // Function to add a row to the tooltip table + auto addRow = [&](const QString& key, const QString& value, bool condition) { + if (condition) { + formatTooltip << "" + << key << "" << value << ""; + } + }; + + // Original tooltip goes here + formatTooltip << "

%1

"; + // New timestamp formatting guide here + formatTooltip << "

" << tr("You can add date/time to this message " + "using the syntax: " + "
%%<format>%%, where " + "<format> is:") << "

"; + formatTooltip << ""; + addRow("hh", tr("the hour"), true); + addRow("mm", tr("the minutes"), true); + addRow("ss", tr("seconds"), true); + addRow("AP", tr("AM/PM"), true); + addRow("dd", tr("day"), true); + addRow("MM", tr("month"), true); +#if QT_VERSION > 0x050000 + // Alas, this was only added in Qt 5. We don't know what version the core has, just hope + // for the best (Qt 4 will soon be dropped). + addRow("t", tr("current timezone"), true); +#endif + formatTooltip << "
"; + formatTooltip << "

" << tr("Example: Away since %%hh:mm%% on %%dd.MM%%.") << "

"; + formatTooltip << "

" << tr("%%%% without anything inside represents %%. Other format " + "codes are available.") << "

"; + formatTooltip << "
"; + + // Split up the message to allow re-using translations: + // [Original tool-tip] [Timestamp format message] + ui.awayReason->setToolTip(strFormatTooltip.arg(ui.awayReason->toolTip())); + ui.detachAwayEnabled->setToolTip(strFormatTooltip.arg(ui.detachAwayEnabled->toolTip())); + } // else: Do nothing, leave the original translated string }