Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions CastItDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,22 +545,13 @@ void CCastItDlg::config_read()
m_colBW2Width = GetPrivateProfileInt(gAppName, "colBW2Width", 125, gConfigFile);
m_colBW3Width = GetPrivateProfileInt(gAppName, "colBW3Width", 125, gConfigFile);

GetPrivateProfileString(gAppName, "dbUsername", "", buf, sizeof(buf), gConfigFile);
configDialog.m_Username = buf;
GetPrivateProfileString(gAppName, "dbPassword", "", buf, sizeof(buf), gConfigFile);
configDialog.m_Password = buf;
GetPrivateProfileString(gAppName, "dbDatabase", "", buf, sizeof(buf), gConfigFile);
configDialog.m_Database = buf;
GetPrivateProfileString(gAppName, "dbHostname", "", buf, sizeof(buf), gConfigFile);
configDialog.m_Hostname = buf;
GetPrivateProfileString(gAppName, "dbTableprefix", "", buf, sizeof(buf), gConfigFile);
configDialog.m_TablePrefix = buf;
configDialog.m_DBEnabled = GetPrivateProfileInt(gAppName, "dbEnabledFlag", 1, gConfigFile);

configDialog.m_PollInterval = GetPrivateProfileInt(gAppName, "pollInterval", 120, gConfigFile);

configDialog.m_Aggregate = GetPrivateProfileInt(gAppName, "Aggregate", 0, gConfigFile);
configDialog.m_DeleteSongHistoryInterval = GetPrivateProfileInt(gAppName, "DeleteSongHistoryInterval", 0, gConfigFile);

GetPrivateProfileString(gAppName, "storageFile", "", buf, sizeof(buf), gConfigFile);
configDialog.m_StorageFile = buf;

//iterate through server list and read ini data
int serverCount = GetPrivateProfileInt(gAppName, "serverCount", 0, gConfigFile);
Expand Down Expand Up @@ -705,13 +696,7 @@ void CCastItDlg::config_write()
// WritePrivateProfileString(gAppName, "CC_Password", configDialog.m_CC_Password, gConfigFile);


WritePrivateProfileString(gAppName, "dbUsername", configDialog.m_Username, gConfigFile);
WritePrivateProfileString(gAppName, "dbPassword", configDialog.m_Password, gConfigFile);
WritePrivateProfileString(gAppName, "dbDatabase", configDialog.m_Database, gConfigFile);
WritePrivateProfileString(gAppName, "dbHostname", configDialog.m_Hostname, gConfigFile);
WritePrivateProfileString(gAppName, "dbTableprefix", configDialog.m_TablePrefix, gConfigFile);
SAFE_SPRINTF(buf, "%d", configDialog.m_DBEnabled);
WritePrivateProfileString(gAppName, "dbEnabledFlag", buf, gConfigFile);
WritePrivateProfileString(gAppName, "storageFile", configDialog.m_StorageFile, gConfigFile);
SAFE_SPRINTF(buf, "%d", configDialog.m_PollInterval);
WritePrivateProfileString(gAppName, "pollInterval", buf, gConfigFile);

Expand Down Expand Up @@ -1417,8 +1402,6 @@ void CCastItDlg::getServerData()
if (configDialog.m_GenerateTemplate) {
SubstituteTagsInTemplate(&sData, i);
}
if (configDialog.m_DBEnabled) {
}
}
/* if (configDialog.m_UpdateCC) {
CString serverType = "";
Expand Down Expand Up @@ -1917,13 +1900,7 @@ void CCastItDlg::OnCciniBackup()
WritePrivateProfileString(gAppName, "col7Width", buf, gBackupConfig);


WritePrivateProfileString(gAppName, "dbUsername", configDialog.m_Username, gBackupConfig);
WritePrivateProfileString(gAppName, "dbPassword", configDialog.m_Password, gBackupConfig);
WritePrivateProfileString(gAppName, "dbDatabase", configDialog.m_Database, gBackupConfig);
WritePrivateProfileString(gAppName, "dbHostname", configDialog.m_Hostname, gBackupConfig);
WritePrivateProfileString(gAppName, "dbTableprefix", configDialog.m_TablePrefix, gBackupConfig);
SAFE_SPRINTF(buf, "%d", configDialog.m_DBEnabled);
WritePrivateProfileString(gAppName, "dbEnabledFlag", buf, gBackupConfig);
WritePrivateProfileString(gAppName, "storageFile", configDialog.m_StorageFile, gBackupConfig);
SAFE_SPRINTF(buf, "%d", configDialog.m_PollInterval);
WritePrivateProfileString(gAppName, "pollInterval", buf, gBackupConfig);

Expand Down
7 changes: 1 addition & 6 deletions Castit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@ col4Width=322
col5Width=322
col6Width=322
col7Width=322
dbUsername=YOUR_DB_USERNAME
dbPassword=YOUR_DB_PASSWORD
dbDatabase=
dbHostname=YOUR_DB_HOST
dbTableprefix=
dbEnabledFlag=0
pollInterval=10
Aggregate=0
DeleteSongHistoryInterval=0
serverCount=10
storageFile=
templateIn=example_templateIn.html
templateOut=D:\PROJECTS\CastIt_9.0\Release\example_templateOut.html
generateTemplate=1
Expand Down
60 changes: 9 additions & 51 deletions ConfigurationDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ CConfigurationDialog::CConfigurationDialog(CWnd* pParent /*=NULL*/)
: CDialog(CConfigurationDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CConfigurationDialog)
m_Database = _T("");
m_Hostname = _T("");
m_Password = _T("");
m_TablePrefix = _T("");
m_Username = _T("");
m_DBEnabled = FALSE;
m_Aggregate = 0;
m_DeleteSongHistoryInterval = 0;
m_PollInterval = 0;
m_StorageFile = _T("");
m_Aggregate = 0;
m_DeleteSongHistoryInterval = 0;
m_PollInterval = 0;
m_URL = _T("");
m_CallURL = FALSE;
m_TemplateIn = _T("");
Expand All @@ -50,20 +45,9 @@ void CConfigurationDialog::DoDataExchange(CDataExchange* pDX)
//{{AFX_DATA_MAP(CConfigurationDialog)
DDX_Control(pDX, IDC_DELETE_SONGHISTORY_INTERVAL, m_DeleteSongCtl);
DDX_Control(pDX, IDC_AGGREGATE, m_AggregateCtl);
DDX_Control(pDX, IDC_MY_USERNAME, m_UsernameCtl);
DDX_Control(pDX, IDC_MY_TABLEPREFIX, m_TablePrefixCtl);
DDX_Control(pDX, IDC_MY_PASSWORD, m_PasswordCtl);
DDX_Control(pDX, IDC_MY_HOSTNAME, m_HostnameCtl);
DDX_Control(pDX, IDC_MY_DATABASE, m_DatabaseCtl);
DDX_Text(pDX, IDC_MY_DATABASE, m_Database);
DDX_Text(pDX, IDC_MY_HOSTNAME, m_Hostname);
DDX_Text(pDX, IDC_MY_PASSWORD, m_Password);
DDX_Text(pDX, IDC_MY_TABLEPREFIX, m_TablePrefix);
DDX_Text(pDX, IDC_MY_USERNAME, m_Username);
DDX_Check(pDX, IDC_database_FLAG, m_DBEnabled);
DDX_Text(pDX, IDC_AGGREGATE, m_Aggregate);
DDX_Text(pDX, IDC_DELETE_SONGHISTORY_INTERVAL, m_DeleteSongHistoryInterval);
DDX_Text(pDX, IDC_POLLINTERVAL, m_PollInterval);
DDX_Text(pDX, IDC_AGGREGATE, m_Aggregate);
DDX_Text(pDX, IDC_DELETE_SONGHISTORY_INTERVAL, m_DeleteSongHistoryInterval);
DDX_Text(pDX, IDC_POLLINTERVAL, m_PollInterval);
DDX_Text(pDX, IDC_URL, m_URL);
DDX_Check(pDX, IDC_CALLURL, m_CallURL);
DDX_Text(pDX, IDC_TEMPLATEIN, m_TemplateIn);
Expand All @@ -81,7 +65,6 @@ void CConfigurationDialog::DoDataExchange(CDataExchange* pDX)

BEGIN_MESSAGE_MAP(CConfigurationDialog, CDialog)
//{{AFX_MSG_MAP(CConfigurationDialog)
ON_BN_CLICKED(IDC_database_FLAG, OnDatabaseFlag)
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_BROWSE1, OnBrowse1)
ON_BN_CLICKED(IDC_BROWSE2, OnBrowse2)
Expand All @@ -102,30 +85,6 @@ END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConfigurationDialog message handlers

void CConfigurationDialog::OnDatabaseFlag()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if (m_DBEnabled) {
m_UsernameCtl.EnableWindow(TRUE);
m_PasswordCtl.EnableWindow(TRUE);
m_HostnameCtl.EnableWindow(TRUE);
m_DatabaseCtl.EnableWindow(TRUE);
m_DeleteSongCtl.EnableWindow(TRUE);
m_AggregateCtl.EnableWindow(TRUE);
m_TablePrefixCtl.EnableWindow(TRUE);
}
else {
m_UsernameCtl.EnableWindow(FALSE);
m_PasswordCtl.EnableWindow(FALSE);
m_HostnameCtl.EnableWindow(FALSE);
m_DatabaseCtl.EnableWindow(FALSE);
m_DeleteSongCtl.EnableWindow(FALSE);
m_AggregateCtl.EnableWindow(FALSE);
m_TablePrefixCtl.EnableWindow(FALSE);
}
}



BOOL CConfigurationDialog::OnInitDialog()
Expand Down Expand Up @@ -160,9 +119,8 @@ BOOL CConfigurationDialog::OnInitDialog()

// TODO: Add extra initialization here

OnDatabaseFlag();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE


}
Expand Down
13 changes: 1 addition & 12 deletions ConfigurationDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,7 @@ class CConfigurationDialog : public CDialog
enum { IDD = IDD_CONFIG_DIALOG };
CEdit m_DeleteSongCtl;
CEdit m_AggregateCtl;
CEdit m_UsernameCtl;
CEdit m_TablePrefixCtl;
CEdit m_PasswordCtl;
CEdit m_HostnameCtl;
CEdit m_DatabaseCtl;
CString m_Database;
CString m_Hostname;
CString m_Password;
CString m_TablePrefix;
CString m_Username;
BOOL m_DBEnabled;
CString m_StorageFile;
int m_Aggregate;
int m_DeleteSongHistoryInterval;
int m_PollInterval;
Expand All @@ -71,7 +61,6 @@ class CConfigurationDialog : public CDialog

// Generated message map functions
//{{AFX_MSG(CConfigurationDialog)
afx_msg void OnDatabaseFlag();
afx_msg void OnClose();
virtual BOOL OnInitDialog();
afx_msg void OnBrowse1();
Expand Down
Loading