summaryrefslogtreecommitdiffabout
path: root/Preferences.cpp
Unidiff
Diffstat (limited to 'Preferences.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--Preferences.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/Preferences.cpp b/Preferences.cpp
new file mode 100644
index 0000000..b975d00
--- a/dev/null
+++ b/Preferences.cpp
@@ -0,0 +1,93 @@
1// Preferences.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6#include "Preferences.h"
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14/////////////////////////////////////////////////////////////////////////////
15// CPreferences dialog
16
17
18CPreferences::CPreferences(CWnd* pParent /*=NULL*/)
19 : CDialog(CPreferences::IDD, pParent)
20{
21 //{{AFX_DATA_INIT(CPreferences)
22 m_AutosaveMinutes = 0;
23 m_LogFile = _T("");
24 m_MaxThreads = 0;
25 m_PingSize = 0;
26 m_SaveOnShutdown = FALSE;
27 m_LogMins = 0;
28 m_bStoreLastActivity = FALSE;
29 //}}AFX_DATA_INIT
30}
31
32
33void CPreferences::DoDataExchange(CDataExchange* pDX)
34{
35 CDialog::DoDataExchange(pDX);
36 //{{AFX_DATA_MAP(CPreferences)
37 DDX_Control(pDX, IDC_LOGMINSPIN, m_LogMinSpinCtl);
38 DDX_Control(pDX, IDC_LOGFILE, m_LogFileCtl);
39 DDX_Control(pDX, IDC_THREADSPIN, m_ThreadsSpinCtl);
40 DDX_Control(pDX, IDC_DATASIZESPIN, m_DatasizeSpinCtl);
41 DDX_Control(pDX, IDC_BROWSE, m_BrowseCtl);
42 DDX_Control(pDX, IDC_AUTOSPIN, m_AutosaveSpinCtl);
43 DDX_Text(pDX, IDC_AUTOSAVEMINS, m_AutosaveMinutes);
44 DDV_MinMaxUInt(pDX, m_AutosaveMinutes, 0, 300);
45 DDX_Text(pDX, IDC_LOGFILE, m_LogFile);
46 DDX_Text(pDX, IDC_MAXTHREADS, m_MaxThreads);
47 DDV_MinMaxUInt(pDX, m_MaxThreads, 1, 50);
48 DDX_Text(pDX, IDC_PINGSIZE, m_PingSize);
49 DDV_MinMaxUInt(pDX, m_PingSize, 0, 32768);
50 DDX_Check(pDX, IDC_SAVEONSHUTDOWN, m_SaveOnShutdown);
51 DDX_Text(pDX, IDC_LOGMINS, m_LogMins);
52 DDV_MinMaxUInt(pDX, m_LogMins, 1, 1440);
53 DDX_Check(pDX, IDC_STOREACTIVITY, m_bStoreLastActivity);
54 //}}AFX_DATA_MAP
55}
56
57
58BEGIN_MESSAGE_MAP(CPreferences, CDialog)
59 //{{AFX_MSG_MAP(CPreferences)
60 ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
61 //}}AFX_MSG_MAP
62END_MESSAGE_MAP()
63
64/////////////////////////////////////////////////////////////////////////////
65// CPreferences message handlers
66
67BOOL CPreferences::OnInitDialog()
68{
69 CDialog::OnInitDialog();
70
71 m_BrowseCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_BROWSESOUND));
72 m_AutosaveSpinCtl.SetRange(0,300);
73 m_DatasizeSpinCtl.SetRange(1,32767);
74 m_ThreadsSpinCtl.SetRange(1,50);
75 m_LogMinSpinCtl.SetRange(1,1440);
76
77 return TRUE; // return TRUE unless you set the focus to a control
78 // EXCEPTION: OCX Property Pages should return FALSE
79}
80
81void CPreferences::OnBrowse()
82{
83CString filter;
84 filter.LoadString(IDS_LOGFILTER);
85CString title;
86 title.LoadString(IDS_LOGFILE_SELECT);
87CFileDialog cfd(FALSE,NULL,m_LogFile,OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_NOTESTFILECREATE,filter,this);
88 cfd.m_ofn.lpstrTitle=title;
89 if(cfd.DoModal()==IDOK){
90 m_LogFile=cfd.GetPathName();
91 m_LogFileCtl.SetWindowText(cfd.GetPathName());
92 }
93}