Commit a1a969a0 authored by Ed "oddsock" Zaleski's avatar Ed "oddsock" Zaleski

Fixed some peculiarities when shutting down server...

svn path=/trunk/icecast/; revision=5732
parent 25fca813
......@@ -2,7 +2,7 @@
[General Info]
Version=1
LastClass=CIcecast2winDlg
LastClass=CStatus
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "Icecast2win.h"
......@@ -13,18 +13,18 @@ Class2=CIcecast2winDlg
Class3=CAboutDlg
ResourceCount=10
Resource1=IDD_SSTATUS
Resource1=IDD_ABOUTBOX
Resource2=IDR_MAINFRAME
Resource3=IDD_ABOUTBOX
Resource4=IDD_ICECAST2WIN_DIALOG
Resource3=IDD_SSTATUS
Resource4=IDR_TRAY
Class4=CStatus
Resource5=IDR_TRAY
Resource5=IDR_MENU2
Class5=CConfigTab
Class6=CStatsTab
Resource6=IDD_STATSDIALOG
Resource7=IDR_MENU2
Resource8=IDD_CONFIGDIALOG
Resource9=IDR_MENU3
Resource6=IDR_MENU3
Resource7=IDD_CONFIGDIALOG
Resource8=IDD_ICECAST2WIN_DIALOG
Resource9=IDD_STATSDIALOG
Resource10=IDR_MENU4
[CLS:CIcecast2winApp]
......
......@@ -574,6 +574,10 @@ void StartStats(void *dummy)
Sleep(5000);
}
if (global.running != ICE_RUNNING) {
numMainStats = 0;
g_mainDialog->statusTab.m_GlobalStatList.DeleteAllItems();
g_mainDialog->statsTab.m_SourceListCtrl.DeleteAllItems();
g_mainDialog->statsTab.m_StatsListCtrl.DeleteAllItems();
_endthread();
}
}
......
// StatsTab.cpp : implementation file
//
#include "stdafx.h"
#include "Icecast2win.h"
#include "StatsTab.h"
#include "Icecast2winDlg.h"
extern CIcecast2winDlg *g_mainDialog;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern void AddToAdditionalGlobalStats(CString source, CString name);
/////////////////////////////////////////////////////////////////////////////
// CStatsTab dialog
CStatsTab::CStatsTab(CWnd* pParent /*=NULL*/)
: CTabPageSSL(CStatsTab::IDD, pParent)
{
//{{AFX_DATA_INIT(CStatsTab)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CStatsTab::DoDataExchange(CDataExchange* pDX)
{
CTabPageSSL::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStatsTab)
DDX_Control(pDX, IDC_STATIC_SLS, m_SLS);
DDX_Control(pDX, IDC_STATSLIST, m_StatsListCtrl);
DDX_Control(pDX, IDC_SOURCELIST, m_SourceListCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStatsTab, CTabPageSSL)
//{{AFX_MSG_MAP(CStatsTab)
ON_NOTIFY(NM_DBLCLK, IDC_SOURCELIST, OnDblclkSourcelist)
ON_NOTIFY(NM_RCLICK, IDC_STATSLIST, OnRclickStatslist)
ON_NOTIFY(NM_CLICK, IDC_SOURCELIST, OnClickSourcelist)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStatsTab message handlers
BOOL CStatsTab::OnInitDialog()
{
CTabPageSSL::OnInitDialog();
// TODO: Add extra initialization here
m_SourceListCtrl.InsertColumn(0, _T("Source"), LVCFMT_LEFT, m_colSource0Width);
m_StatsListCtrl.InsertColumn(0, _T("Statistic"), LVCFMT_LEFT, m_colStats0Width);
m_StatsListCtrl.InsertColumn(1, _T("Value"), LVCFMT_LEFT, m_colStats1Width);
AddAnchor(IDC_STATSLIST, TOP_LEFT, BOTTOM_RIGHT);
AddAnchor(IDC_SOURCELIST, TOP_LEFT, BOTTOM_LEFT);
AddAnchor(IDC_FILLER1, BOTTOM_LEFT, BOTTOM_RIGHT);
m_SourceListCtrl.SetSelectionMark(0);
m_SLS.SetFont(&(g_mainDialog->labelFont), TRUE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CStatsTab::OnDblclkSourcelist(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
g_mainDialog->UpdateStatsLists();
*pResult = 0;
}
void CStatsTab::OnRclickStatslist(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CMenu menu;
CPoint point;
::GetCursorPos(&point); //where is the mouse?
DWORD dwSelectionMade;
menu.LoadMenu(IDR_MENU2);
CMenu *pmenuPopup = menu.GetSubMenu(0);
dwSelectionMade = pmenuPopup->TrackPopupMenu( (TPM_LEFTALIGN|TPM_LEFTBUTTON|
TPM_NONOTIFY|TPM_RETURNCMD),
point.x, point.y, this);
pmenuPopup->DestroyMenu();
char msg[255] ="";
char buffer[1024] = "";
char buffer2[1024] = "";
CString name;
CString source;
POSITION pos;
switch (dwSelectionMade) {
case ID_POPUP_ADDTOGLOBALSTATLIST :
pos = m_StatsListCtrl.GetFirstSelectedItemPosition();
if (pos != NULL) {
int nItem = m_StatsListCtrl.GetNextSelectedItem(pos);
LVITEM lvi;
lvi.mask = LVIF_TEXT;
lvi.iItem = nItem;
lvi.iSubItem = 0;
lvi.pszText = buffer;
lvi.cchTextMax = sizeof(buffer);
m_StatsListCtrl.GetItem(&lvi);
name = buffer;
}
pos = m_SourceListCtrl.GetFirstSelectedItemPosition();
if (pos != NULL) {
int nItem = m_SourceListCtrl.GetNextSelectedItem(pos);
LVITEM lvi;
lvi.mask = LVIF_TEXT;
lvi.iItem = nItem;
lvi.iSubItem = 0;
lvi.pszText = buffer2;
lvi.cchTextMax = sizeof(buffer2);
m_SourceListCtrl.GetItem(&lvi);
source = buffer2;
}
AddToAdditionalGlobalStats(source, name);
break;
default :
break;
}
*pResult = 0;
}
void CStatsTab::OnClickSourcelist(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
OnDblclkSourcelist(pNMHDR, pResult);
*pResult = 0;
}
// StatsTab.cpp : implementation file
//
#include "stdafx.h"
#include "Icecast2win.h"
#include "StatsTab.h"
#include "Icecast2winDlg.h"
extern CIcecast2winDlg *g_mainDialog;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern void AddToAdditionalGlobalStats(CString source, CString name);
/////////////////////////////////////////////////////////////////////////////
// CStatsTab dialog
CStatsTab::CStatsTab(CWnd* pParent /*=NULL*/)
: CTabPageSSL(CStatsTab::IDD, pParent)
{
//{{AFX_DATA_INIT(CStatsTab)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CStatsTab::DoDataExchange(CDataExchange* pDX)
{
CTabPageSSL::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStatsTab)
DDX_Control(pDX, IDC_STATIC_SLS, m_SLS);
DDX_Control(pDX, IDC_STATSLIST, m_StatsListCtrl);
DDX_Control(pDX, IDC_SOURCELIST, m_SourceListCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStatsTab, CTabPageSSL)
//{{AFX_MSG_MAP(CStatsTab)
ON_NOTIFY(NM_DBLCLK, IDC_SOURCELIST, OnDblclkSourcelist)
ON_NOTIFY(NM_RCLICK, IDC_STATSLIST, OnRclickStatslist)
ON_NOTIFY(NM_CLICK, IDC_SOURCELIST, OnClickSourcelist)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStatsTab message handlers
BOOL CStatsTab::OnInitDialog()
{
CTabPageSSL::OnInitDialog();
// TODO: Add extra initialization here
m_SourceListCtrl.InsertColumn(0, _T("Source"), LVCFMT_LEFT, m_colSource0Width);
m_StatsListCtrl.InsertColumn(0, _T("Statistic"), LVCFMT_LEFT, m_colStats0Width);
m_StatsListCtrl.InsertColumn(1, _T("Value"), LVCFMT_LEFT, m_colStats1Width);
AddAnchor(IDC_STATSLIST, TOP_LEFT, BOTTOM_RIGHT);
AddAnchor(IDC_SOURCELIST, TOP_LEFT, BOTTOM_LEFT);
AddAnchor(IDC_FILLER1, BOTTOM_LEFT, BOTTOM_RIGHT);
m_SourceListCtrl.SetSelectionMark(0);
m_SLS.SetFont(&(g_mainDialog->labelFont), TRUE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CStatsTab::OnDblclkSourcelist(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
g_mainDialog->statsTab.m_StatsListCtrl.DeleteAllItems();
g_mainDialog->UpdateStatsLists();
*pResult = 0;
}
void CStatsTab::OnRclickStatslist(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CMenu menu;
CPoint point;
::GetCursorPos(&point); //where is the mouse?
DWORD dwSelectionMade;
menu.LoadMenu(IDR_MENU2);
CMenu *pmenuPopup = menu.GetSubMenu(0);
dwSelectionMade = pmenuPopup->TrackPopupMenu( (TPM_LEFTALIGN|TPM_LEFTBUTTON|
TPM_NONOTIFY|TPM_RETURNCMD),
point.x, point.y, this);
pmenuPopup->DestroyMenu();
char msg[255] ="";
char buffer[1024] = "";
char buffer2[1024] = "";
CString name;
CString source;
POSITION pos;
switch (dwSelectionMade) {
case ID_POPUP_ADDTOGLOBALSTATLIST :
pos = m_StatsListCtrl.GetFirstSelectedItemPosition();
if (pos != NULL) {
int nItem = m_StatsListCtrl.GetNextSelectedItem(pos);
LVITEM lvi;
lvi.mask = LVIF_TEXT;
lvi.iItem = nItem;
lvi.iSubItem = 0;
lvi.pszText = buffer;
lvi.cchTextMax = sizeof(buffer);
m_StatsListCtrl.GetItem(&lvi);
name = buffer;
}
pos = m_SourceListCtrl.GetFirstSelectedItemPosition();
if (pos != NULL) {
int nItem = m_SourceListCtrl.GetNextSelectedItem(pos);
LVITEM lvi;
lvi.mask = LVIF_TEXT;
lvi.iItem = nItem;
lvi.iSubItem = 0;
lvi.pszText = buffer2;
lvi.cchTextMax = sizeof(buffer2);
m_SourceListCtrl.GetItem(&lvi);
source = buffer2;
}
AddToAdditionalGlobalStats(source, name);
break;
default :
break;
}
*pResult = 0;
}
void CStatsTab::OnClickSourcelist(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
OnDblclkSourcelist(pNMHDR, pResult);
*pResult = 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment