summaryrefslogtreecommitdiff
path: root/plugins/!NotAdopted/HistoryStats/column_nick.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-04 20:41:13 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-04 20:41:13 +0000
commit6b3ded37e4a4825be2df3612bdcbb7dfc00a1800 (patch)
treed6b6290439e207be3bb28718a2829e298db08342 /plugins/!NotAdopted/HistoryStats/column_nick.cpp
parentd4ed74b1750b5389f22fd67246985ba782d2648b (diff)
HistoryStats sources
git-svn-id: http://svn.miranda-ng.org/main/trunk@8397 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/!NotAdopted/HistoryStats/column_nick.cpp')
-rw-r--r--plugins/!NotAdopted/HistoryStats/column_nick.cpp114
1 files changed, 114 insertions, 0 deletions
diff --git a/plugins/!NotAdopted/HistoryStats/column_nick.cpp b/plugins/!NotAdopted/HistoryStats/column_nick.cpp
new file mode 100644
index 0000000000..f61744a545
--- /dev/null
+++ b/plugins/!NotAdopted/HistoryStats/column_nick.cpp
@@ -0,0 +1,114 @@
+#include "_globals.h"
+#include "column_nick.h"
+
+/*
+ * ColNick
+ */
+
+ColNick::ColNick()
+ : m_bDetail(true)
+ , m_bContactCount(true)
+ , m_hDetail(NULL)
+ , m_hContactCount(NULL)
+{
+}
+
+void ColNick::impl_copyConfig(const Column* pSource)
+{
+ const ColNick& src = *reinterpret_cast<const ColNick*>(pSource);
+
+ m_bDetail = src.m_bDetail;
+ m_bContactCount = src.m_bContactCount;
+}
+
+void ColNick::impl_configRead(const SettingsTree& settings)
+{
+ m_bDetail = settings.readBool(con::KeyDetail, true);
+ m_bContactCount = settings.readBool(con::KeyContactCount, true);
+}
+
+void ColNick::impl_configWrite(SettingsTree& settings) const
+{
+ settings.writeBool(con::KeyDetail, m_bDetail);
+ settings.writeBool(con::KeyContactCount, m_bContactCount);
+}
+
+void ColNick::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
+{
+ /**/m_hDetail = Opt.insertCheck(hGroup, i18n(muT("First/last message time (tooltip)")));
+ /**/m_hContactCount = Opt.insertCheck(hGroup, i18n(muT("Show countact count for omitted/totals (tooltip)")));
+
+ Opt.checkItem(m_hDetail , m_bDetail );
+ Opt.checkItem(m_hContactCount, m_bContactCount);
+}
+
+void ColNick::impl_configFromUI(OptionsCtrl& Opt)
+{
+ m_bDetail = Opt.isItemChecked(m_hDetail);
+ m_bContactCount = Opt.isItemChecked(m_hContactCount);
+}
+
+void ColNick::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
+{
+ if (row == 1)
+ {
+ writeRowspanTD(tos, getCustomTitle(i18n(muT("Nick")), i18n(muT("Nick"))), row, 1, rowSpan);
+ }
+}
+
+void ColNick::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, DisplayType display)
+{
+ tos << muT("<td");
+
+ if (m_bDetail || (m_bContactCount && display != asContact))
+ {
+ ext::string strFirstTime = i18n(muT("(unknown)"));
+ ext::string strLastTime = i18n(muT("(unknown)"));
+
+ if (contact.isFirstLastTimeValid())
+ {
+ strFirstTime = utils::timestampToDateTime(contact.getFirstTime());
+ strLastTime = utils::timestampToDateTime(contact.getLastTime());
+ }
+
+ ext::string strTooltip;
+
+ if (m_bDetail && !(m_bContactCount && display != asContact))
+ {
+ strTooltip = utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[First] #{first_time} / [Last] #{last_time}")))
+ % muT("#{first_time}") * strFirstTime
+ % muT("#{last_time}") * strLastTime));
+ }
+ else if (m_bDetail && (m_bContactCount && display != asContact))
+ {
+ strTooltip = utils::htmlEscape(ext::str(ext::kformat(i18n(muT("#{count} contacts / [First] #{first_time} / [Last] #{last_time}")))
+ % muT("#{count}") * contact.getNumContacts()
+ % muT("#{first_time}") * strFirstTime
+ % muT("#{last_time}") * strLastTime));
+ }
+ else // if (!m_bDetail && (m_bContactCount && display != asContact))
+ {
+ strTooltip = utils::htmlEscape(ext::str(ext::kformat(i18n(muT("#{count} contacts")))
+ % muT("#{count}") * contact.getNumContacts()));
+ }
+
+ tos << muT(" title=\"") << strTooltip << muT("\">");
+ }
+ else
+ {
+ tos << muT(">");
+ }
+
+ if (display == asContact)
+ {
+ tos << utils::htmlEscape(contact.getNick()) << muT("</td>") << ext::endl;
+ }
+ else if (display == asOmitted)
+ {
+ tos << i18n(muT("Omitted")) << muT("</td>") << ext::endl;
+ }
+ else
+ {
+ tos << i18n(muT("Totals")) << muT("</td>") << ext::endl;
+ }
+}