BrowseRefs: Context menu enhancements
[TortoiseGit.git] / src / TortoiseProc / LogCacheStatisticsDlg.cpp
blobd30a3381020b4187ec431bfdcf5312aeb42fcf5c
1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2007-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include "stdafx.h"
20 #include "TortoiseProc.h"
21 #include "LogCacheStatisticsDlg.h"
22 #include "LogCacheStatistics.h"
23 #include "RepositoryInfo.h"
24 #include "SVN.h"
26 // CLogCacheStatisticsDlg-Dialogfeld
28 IMPLEMENT_DYNAMIC(CLogCacheStatisticsDlg, CDialog)
30 CLogCacheStatisticsDlg::CLogCacheStatisticsDlg
31 ( const LogCache::CLogCacheStatisticsData& data, CWnd * pParentWnd)
32 : CDialog(CLogCacheStatisticsDlg::IDD, pParentWnd)
34 sizeRAM = ToString (data.ramSize / 1024);
35 sizeDisk = ToString (data.fileSize / 1024);
37 switch (data.connectionState)
39 case LogCache::CRepositoryInfo::online:
40 connectionState.LoadString (IDS_CONNECTIONSTATE_ONLINE);
41 break;
42 case LogCache::CRepositoryInfo::tempOffline:
43 connectionState.LoadString (IDS_CONNECTIONSTATE_TEMPOFFLINE);
44 break;
45 case LogCache::CRepositoryInfo::offline:
46 connectionState.LoadString (IDS_CONNECTIONSTATE_OFFLINE);
47 break;
50 lastRead = DateToString (data.lastReadAccess);
51 lastWrite = DateToString (data.lastWriteAccess);
52 lastHeadUpdate = DateToString (data.headTimeStamp);
54 authors = ToString (data.authorCount);
55 paths = ToString (data.pathCount);
56 pathElements = ToString (data.pathElementCount);
57 skipRanges = ToString (data.skipDeltaCount);
58 wordTokens = ToString (data.wordTokenCount);
59 pairTokens = ToString (data.pairTokenCount);
60 textSize = ToString (data.textSize);
61 uncompressedSize = ToString (data.uncompressedSize);
63 maxRevision = ToString (data.maxRevision);
64 revisionCount = ToString (data.revisionCount);
66 changesTotal = ToString (data.changesCount);
67 changedRevisions = ToString (data.changesRevisionCount);
68 changesMissing = ToString (data.changesMissingRevisionCount);
69 mergesTotal = ToString (data.mergeInfoCount);
70 mergesRevisions = ToString (data.mergeInfoRevisionCount);
71 mergesMissing = ToString (data.mergeInfoMissingRevisionCount);
72 userRevpropsTotal = ToString (data.userRevPropCount);
73 userRevpropsRevisions = ToString (data.userRevPropRevisionCount);
74 userRevpropsMissing = ToString (data.userRevPropMissingRevisionCount);
77 CLogCacheStatisticsDlg::~CLogCacheStatisticsDlg()
81 void CLogCacheStatisticsDlg::DoDataExchange(CDataExchange* pDX)
83 CDialog::DoDataExchange(pDX);
84 DDX_Text(pDX, IDC_SIZERAM, sizeRAM);
85 DDX_Text(pDX, IDC_SIZEDISK, sizeDisk);
86 DDX_Text(pDX, IDC_CONNECTIONSTATE, connectionState);
87 DDX_Text(pDX, IDC_LASTREAD, lastRead);
88 DDX_Text(pDX, IDC_LASTWRITE, lastWrite);
89 DDX_Text(pDX, IDC_LASTHEADUPDATE, lastHeadUpdate);
90 DDX_Text(pDX, IDC_AUTHORS, authors);
91 DDX_Text(pDX, IDC_PATHELEMENTS, pathElements);
92 DDX_Text(pDX, IDC_PATHS, paths);
93 DDX_Text(pDX, IDC_SKIPRANGES, skipRanges);
94 DDX_Text(pDX, IDC_WORDTOKENS, wordTokens);
95 DDX_Text(pDX, IDC_PAIRTOKENS, pairTokens);
96 DDX_Text(pDX, IDC_TEXTSIZE, textSize);
97 DDX_Text(pDX, IDC_UNCOMPRESSEDSIZE, uncompressedSize);
98 DDX_Text(pDX, IDC_MAXREVISION, maxRevision);
99 DDX_Text(pDX, IDC_REVISIONCOUNT, revisionCount);
100 DDX_Text(pDX, IDC_CHANGESTOTAL, changesTotal);
101 DDX_Text(pDX, IDC_CHANGEDREVISIONS, changedRevisions);
102 DDX_Text(pDX, IDC_CHANGESMISSING, changesMissing);
103 DDX_Text(pDX, IDC_MERGESTOTAL, mergesTotal);
104 DDX_Text(pDX, IDC_MERGESREVISIONS, mergesRevisions);
105 DDX_Text(pDX, IDC_MERGESMISSING, mergesMissing);
106 DDX_Text(pDX, IDC_USERREVPROPSTOTAL, userRevpropsTotal);
107 DDX_Text(pDX, IDC_USERREVPROPSREVISISONS, userRevpropsRevisions);
108 DDX_Text(pDX, IDC_USERREVPROPSMISSING, userRevpropsMissing);
112 BEGIN_MESSAGE_MAP(CLogCacheStatisticsDlg, CDialog)
113 END_MESSAGE_MAP()
115 CString CLogCacheStatisticsDlg::DateToString (__time64_t time)
117 // transform to 1-second base
119 __time64_t systime = time / 1000000L;
120 __time64_t now = CTime::GetCurrentTime().GetTime();
122 // return time when younger than 1 day
123 // return date otherwise
125 return (now - systime >= 0) && (now - systime < 86400)
126 ? SVN::formatTime (time)
127 : SVN::formatDate (time);
130 CString CLogCacheStatisticsDlg::ToString (__int64 value)
132 TCHAR buffer[20];
133 _i64tot_s (value, buffer, sizeof (buffer) / sizeof (TCHAR), 10);
134 return buffer;
136 BOOL CLogCacheStatisticsDlg::OnInitDialog()
138 CDialog::OnInitDialog();
140 m_tooltips.Create(this);
142 m_tooltips.AddTool(IDC_SIZERAM, IDS_SETTINGS_LOGCACHESTATS_RAM);
143 m_tooltips.AddTool(IDC_SIZEDISK, IDS_SETTINGS_LOGCACHESTATS_DISK);
144 m_tooltips.AddTool(IDC_CONNECTIONSTATE, IDS_SETTINGS_LOGCACHESTATS_CONNECTION);
145 m_tooltips.AddTool(IDC_LASTREAD, IDS_SETTINGS_LOGCACHESTATS_LASTREAD);
146 m_tooltips.AddTool(IDC_LASTWRITE, IDS_SETTINGS_LOGCACHESTATS_LASTWRITE);
147 m_tooltips.AddTool(IDC_LASTHEADUPDATE, IDS_SETTINGS_LOGCACHESTATS_LASTHEADUPDATE);
148 m_tooltips.AddTool(IDC_AUTHORS, IDS_SETTINGS_LOGCACHESTATS_AUTHORS);
149 m_tooltips.AddTool(IDC_PATHELEMENTS, IDS_SETTINGS_LOGCACHESTATS_PATHELEMENTS);
150 m_tooltips.AddTool(IDC_PATHS, IDS_SETTINGS_LOGCACHESTATS_PATHS);
151 m_tooltips.AddTool(IDC_SKIPRANGES, IDS_SETTINGS_LOGCACHESTATS_SKIPRANGES);
152 m_tooltips.AddTool(IDC_WORDTOKENS, IDS_SETTINGS_LOGCACHESTATS_WORDTOKENS);
153 m_tooltips.AddTool(IDC_PAIRTOKENS, IDS_SETTINGS_LOGCACHESTATS_PAIRTOKENS);
154 m_tooltips.AddTool(IDC_TEXTSIZE, IDS_SETTINGS_LOGCACHESTATS_TEXTSIZE);
155 m_tooltips.AddTool(IDC_UNCOMPRESSEDSIZE, IDS_SETTINGS_LOGCACHESTATS_UNCOMPRESSEDSIZE);
156 m_tooltips.AddTool(IDC_MAXREVISION, IDS_SETTINGS_LOGCACHESTATS_MAXREVISION);
157 m_tooltips.AddTool(IDC_REVISIONCOUNT, IDS_SETTINGS_LOGCACHESTATS_REVISIONCOUNT);
158 m_tooltips.AddTool(IDC_CHANGESTOTAL, IDS_SETTINGS_LOGCACHESTATS_CHANGESTOTAL);
159 m_tooltips.AddTool(IDC_CHANGEDREVISIONS, IDS_SETTINGS_LOGCACHESTATS_CHANGEDREVISIONS);
160 m_tooltips.AddTool(IDC_CHANGESMISSING, IDS_SETTINGS_LOGCACHESTATS_CHANGESMISSING);
161 m_tooltips.AddTool(IDC_MERGESTOTAL, IDS_SETTINGS_LOGCACHESTATS_MERGESTOTAL);
162 m_tooltips.AddTool(IDC_MERGESREVISIONS, IDS_SETTINGS_LOGCACHESTATS_MERGESREVISIONS);
163 m_tooltips.AddTool(IDC_MERGESMISSING, IDS_SETTINGS_LOGCACHESTATS_MERGESMISSING);
164 m_tooltips.AddTool(IDC_USERREVPROPSTOTAL, IDS_SETTINGS_LOGCACHESTATS_USERREVPROPSTOTAL);
165 m_tooltips.AddTool(IDC_USERREVPROPSREVISISONS, IDS_SETTINGS_LOGCACHESTATS_USERREVPROPSREVISIONS);
166 m_tooltips.AddTool(IDC_USERREVPROPSMISSING, IDS_SETTINGS_LOGCACHESTATS_USERREVPROPSMISSING);
169 return TRUE;
172 BOOL CLogCacheStatisticsDlg::PreTranslateMessage(MSG* pMsg)
174 m_tooltips.RelayEvent(pMsg);
175 return CDialog::PreTranslateMessage(pMsg);