1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-02-02 15:07:36 -05:00

removed tab for editing configuration file, opted for a much simpler approach (spwan a notepad session)

fixed the "Make this stat the window title" logic
Added menu to the dialog

svn path=/trunk/icecast/; revision=3884
This commit is contained in:
oddsock 2002-08-28 20:37:44 +00:00
parent 08061569bd
commit e38af3f13c
12 changed files with 2609 additions and 2677 deletions

View File

@ -12,11 +12,11 @@ Class1=CIcecast2winApp
Class2=CIcecast2winDlg Class2=CIcecast2winDlg
Class3=CAboutDlg Class3=CAboutDlg
ResourceCount=9 ResourceCount=10
Resource1=IDR_MENU3 Resource1=IDD_ABOUTBOX
Resource2=IDR_MAINFRAME Resource2=IDR_MAINFRAME
Resource3=IDD_ABOUTBOX Resource3=IDR_MENU3
Resource4=IDD_STATSDIALOG Resource4=IDR_TRAY
Class4=CStatus Class4=CStatus
Resource5=IDR_MENU2 Resource5=IDR_MENU2
Class5=CConfigTab Class5=CConfigTab
@ -24,7 +24,8 @@ Class6=CStatsTab
Resource6=IDD_SSTATUS Resource6=IDD_SSTATUS
Resource7=IDD_CONFIGDIALOG Resource7=IDD_CONFIGDIALOG
Resource8=IDD_ICECAST2WIN_DIALOG Resource8=IDD_ICECAST2WIN_DIALOG
Resource9=IDR_TRAY Resource9=IDD_STATSDIALOG
Resource10=IDR_MENU4
[CLS:CIcecast2winApp] [CLS:CIcecast2winApp]
Type=0 Type=0
@ -37,7 +38,7 @@ Type=0
HeaderFile=Icecast2winDlg.h HeaderFile=Icecast2winDlg.h
ImplementationFile=Icecast2winDlg.cpp ImplementationFile=Icecast2winDlg.cpp
Filter=C Filter=C
LastObject=IDC_HIDESYSTRAY LastObject=ID_ABOUT_HELP
BaseClass=CResizableDialog BaseClass=CResizableDialog
VirtualFilter=dWC VirtualFilter=dWC
@ -140,3 +141,12 @@ Class=CIcecast2winDlg
Command1=ID_BLANK_RESTORE Command1=ID_BLANK_RESTORE
CommandCount=1 CommandCount=1
[MNU:IDR_MENU4]
Type=1
Class=CIcecast2winDlg
Command1=ID_FILE_EXIT
Command2=ID_FILE_EDITCONFIGURATION
Command3=ID_ABOUT_HELP
Command4=ID_ABOUT_CREDITS
CommandCount=4

View File

@ -23,6 +23,7 @@ class CIcecast2winApp : public CWinApp
{ {
public: public:
char m_configFile[1024]; char m_configFile[1024];
HICON m_pIconList[2];
CIcecast2winApp(); CIcecast2winApp();
// Overrides // Overrides
@ -47,4 +48,5 @@ public:
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
extern CIcecast2winApp theApp;
#endif // !defined(AFX_ICECAST2WIN_H__76A528C9_A424_4417_BFDF_0E556A9EE4F1__INCLUDED_) #endif // !defined(AFX_ICECAST2WIN_H__76A528C9_A424_4417_BFDF_0E556A9EE4F1__INCLUDED_)

View File

@ -79,6 +79,7 @@ STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW EXSTYLE WS_EX_APPWINDOW
CAPTION "icecast2" CAPTION "icecast2"
MENU IDR_MENU4
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
CONTROL "Tab1",IDC_MAINTAB,"SysTabControl32",0x0,0,48,318,201 CONTROL "Tab1",IDC_MAINTAB,"SysTabControl32",0x0,0,48,318,201
@ -102,7 +103,7 @@ BEGIN
LTEXT "",IDC_FILLER2,0,199,319,11 LTEXT "",IDC_FILLER2,0,199,319,11
CONTROL "List1",IDC_GLOBALSTAT_LIST,"SysListView32",LVS_REPORT | CONTROL "List1",IDC_GLOBALSTAT_LIST,"SysListView32",LVS_REPORT |
WS_BORDER | WS_TABSTOP,9,34,300,147 WS_BORDER | WS_TABSTOP,9,34,300,147
CTEXT "Global Statistics",IDC_STATIC_GS,9,9,300,21 CTEXT "Global Statistics",IDC_STATIC_GS,9,6,300,10
LTEXT "Server Has Been Running For ",IDC_STATIC_RUN,46,184,100, LTEXT "Server Has Been Running For ",IDC_STATIC_RUN,46,184,100,
8 8
LTEXT "",IDC_RUNNINGFOR,149,184,156,8 LTEXT "",IDC_RUNNINGFOR,149,184,156,8
@ -125,7 +126,7 @@ BEGIN
CONTROL "List2",IDC_SOURCELIST,"SysListView32",LVS_REPORT | CONTROL "List2",IDC_SOURCELIST,"SysListView32",LVS_REPORT |
WS_BORDER | WS_TABSTOP,9,34,111,159 WS_BORDER | WS_TABSTOP,9,34,111,159
LTEXT "",IDC_FILLER1,0,199,320,11 LTEXT "",IDC_FILLER1,0,199,320,11
CTEXT "Source Level Statistics",IDC_STATIC_SLS,9,7,300,15 CTEXT "Source Level Statistics",IDC_STATIC_SLS,9,7,300,10
LTEXT "Click source to view statistics",IDC_STATIC,18,25,111,8 LTEXT "Click source to view statistics",IDC_STATIC,18,25,111,8
END END
@ -243,6 +244,23 @@ BEGIN
END END
END END
IDR_MENU4 MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "C&onfiguration"
BEGIN
MENUITEM "&Edit Configuration", ID_FILE_EDITCONFIGURATION
END
POPUP "&About"
BEGIN
MENUITEM "H&elp", ID_ABOUT_HELP
MENUITEM "Cr&edits", ID_ABOUT_CREDITS
END
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View File

@ -63,7 +63,6 @@ typedef struct tagElementAdditional {
typedef struct tagMainElement { typedef struct tagMainElement {
// char source[1024];
CString source; CString source;
long numStats; long numStats;
Element stats[MAXSTATSPERSOURCE]; Element stats[MAXSTATSPERSOURCE];
@ -125,6 +124,8 @@ void AddToTitleAdditionalGlobalStats(CString source, CString name) {
if ((gAdditionalGlobalStats.stats[i].source == source) && (gAdditionalGlobalStats.stats[i].name == name)) { if ((gAdditionalGlobalStats.stats[i].source == source) && (gAdditionalGlobalStats.stats[i].name == name)) {
ClearTitleAdditionalGlobalStats(source, name); ClearTitleAdditionalGlobalStats(source, name);
gAdditionalGlobalStats.stats[i].titleFlag = 1; gAdditionalGlobalStats.stats[i].titleFlag = 1;
strcpy(gTitleSource, source);
strcpy(gTitleName, name);
foundit = 1; foundit = 1;
break; break;
} }
@ -135,6 +136,8 @@ void AddToTitleAdditionalGlobalStats(CString source, CString name) {
if ((gStats[i].source == source) && (gStats[i].stats[j].name == name)) { if ((gStats[i].source == source) && (gStats[i].stats[j].name == name)) {
ClearTitleAdditionalGlobalStats(source, name); ClearTitleAdditionalGlobalStats(source, name);
gStats[i].stats[j].titleFlag = 1; gStats[i].stats[j].titleFlag = 1;
strcpy(gTitleSource, source);
strcpy(gTitleName, name);
foundit = 1; foundit = 1;
break; break;
} }
@ -255,6 +258,8 @@ BEGIN_MESSAGE_MAP(CIcecast2winDlg, CResizableDialog)
ON_COMMAND(ID_BLANK_RESTORE, OnBlankRestore) ON_COMMAND(ID_BLANK_RESTORE, OnBlankRestore)
ON_MESSAGE(WM_TRAY_NOTIFY, OnTrayNotify) ON_MESSAGE(WM_TRAY_NOTIFY, OnTrayNotify)
ON_WM_DESTROY() ON_WM_DESTROY()
ON_COMMAND(ID_FILE_EDITCONFIGURATION, OnFileEditconfiguration)
ON_COMMAND(ID_ABOUT_HELP, OnAboutHelp)
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
END_MESSAGE_MAP() END_MESSAGE_MAP()
@ -287,7 +292,6 @@ BOOL CIcecast2winDlg::OnInitDialog()
g_mainDialog = this; g_mainDialog = this;
// statsTab.SetDialogBkColor(BGCOLOR,TEXTCOLOR);
// Set the icon for this dialog. The framework does this automatically // Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog // when the application's main window is not a dialog
@ -295,7 +299,6 @@ BOOL CIcecast2winDlg::OnInitDialog()
SetIcon(m_hIcon, FALSE); // Set small icon SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here // TODO: Add extra initialization here
config_read(); config_read();
statsTab.m_colSource0Width = m_colSource0Width; statsTab.m_colSource0Width = m_colSource0Width;
@ -305,18 +308,13 @@ BOOL CIcecast2winDlg::OnInitDialog()
statusTab.m_colStats1Width = m_colGStats1Width; statusTab.m_colStats1Width = m_colGStats1Width;
statusTab.m_colStats2Width = m_colGStats2Width; statusTab.m_colStats2Width = m_colGStats2Width;
configTab.Create(IDD_CONFIGDIALOG, this);
statsTab.Create(IDD_STATSDIALOG, this); statsTab.Create(IDD_STATSDIALOG, this);
statusTab.Create(IDD_SSTATUS, this); statusTab.Create(IDD_SSTATUS, this);
int nPageID = 0; int nPageID = 0;
m_MainTab.AddSSLPage (_T("Server Status"), nPageID, (CTabPageSSL *)&statusTab); m_MainTab.AddSSLPage (_T("Server Status"), nPageID, (CTabPageSSL *)&statusTab);
nPageID++; nPageID++;
m_MainTab.AddSSLPage (_T("Configuration"), nPageID, (CTabPageSSL *)&configTab); m_MainTab.AddSSLPage (_T("Source Level Stats"), nPageID, (CTabPageSSL *)&statsTab);
nPageID++;
m_MainTab.AddSSLPage (_T("Stats"), nPageID, (CTabPageSSL *)&statsTab);
nPageID++; nPageID++;
@ -324,7 +322,6 @@ BOOL CIcecast2winDlg::OnInitDialog()
runningBitmap.LoadBitmap(IDB_BITMAP6); runningBitmap.LoadBitmap(IDB_BITMAP6);
stoppedBitmap.LoadBitmap(IDB_BITMAP5); stoppedBitmap.LoadBitmap(IDB_BITMAP5);
//m_SS.SetFont(&labelFont, TRUE);
UpdateData(FALSE); UpdateData(FALSE);
@ -335,7 +332,7 @@ BOOL CIcecast2winDlg::OnInitDialog()
EnableSaveRestore("icecast2win", "positions"); EnableSaveRestore("icecast2win", "positions");
m_pTray = NULL;
if (m_Autostart) { if (m_Autostart) {
OnStart(); OnStart();
@ -397,76 +394,6 @@ void CIcecast2winDlg::OnSelchangeMaintab(NMHDR* pNMHDR, LRESULT* pResult)
{ {
// TODO: Add your control notification handler code here // TODO: Add your control notification handler code here
/*
if (m_MainTab.GetCurSel() == 0) {
EnableControl(IDC_NUMBER_CLIENTS);
EnableControl(IDC_SERVERSTATUS);
EnableControl(IDC_SOURCES_CONNECTED);
m_ConfigEditCtrl.ShowWindow(SW_HIDE);
m_StatsEditCtrl.ShowWindow(SW_HIDE);
}
if (m_MainTab.GetCurSel() == 99) {
DisableControl(IDC_NUMBER_CLIENTS);
DisableControl(IDC_SERVERSTATUS);
DisableControl(IDC_SOURCES_CONNECTED);
m_ConfigEditCtrl.ShowWindow(SW_HIDE);
m_StatsEditCtrl.ShowWindow(SW_HIDE);
}
if (m_MainTab.GetCurSel() == 99) {
DisableControl(IDC_NUMBER_CLIENTS);
DisableControl(IDC_SERVERSTATUS);
DisableControl(IDC_SOURCES_CONNECTED);
m_ConfigEditCtrl.ShowWindow(SW_HIDE);
m_StatsEditCtrl.ShowWindow(SW_HIDE);
}
if (m_MainTab.GetCurSel() == 1) {
DisableControl(IDC_NUMBER_CLIENTS);
DisableControl(IDC_SERVERSTATUS);
DisableControl(IDC_SOURCES_CONNECTED);
m_ConfigEditCtrl.ShowWindow(SW_SHOW);
m_StatsEditCtrl.ShowWindow(SW_HIDE);
LoadConfig();
ParseConfig();
}
if (m_MainTab.GetCurSel() == 2) {
DisableControl(IDC_NUMBER_CLIENTS);
DisableControl(IDC_SERVERSTATUS);
DisableControl(IDC_SOURCES_CONNECTED);
m_ConfigEditCtrl.ShowWindow(SW_HIDE);
m_StatsEditCtrl.ShowWindow(SW_SHOW);
if (global.running == ICE_RUNNING) {
CString statData;
for (int i=0;i<numMainStats;i++) {
if (!strcmp(gStats[i].source, "")) {
statData += "\r\nBase Server Data\r\n-------------------------\r\n";
for (int j=0;j<gStats[i].numStats;j++) {
statData += gStats[i].stats[j].name;
statData += " = ";
statData += gStats[i].stats[j].value;
statData += "\r\n";
}
}
else {
statData += "\r\nData For Source ";
statData += gStats[i].source;
statData += "\r\n-------------------------\r\n";
for (int j=0;j<gStats[i].numStats;j++) {
statData += gStats[i].stats[j].name;
statData += " = ";
statData += gStats[i].stats[j].value;
statData += "\r\n";
}
}
}
m_StatsEdit = statData;
UpdateData(FALSE);
}
else {
MessageBox("Server not running, cannot get stats", "Message", MB_OK);
}
}
*/
*pResult = 0; *pResult = 0;
} }
@ -479,59 +406,11 @@ void CIcecast2winDlg::LoadConfig()
configTab.m_Config = ""; configTab.m_Config = "";
filep = fopen(myApp->m_configFile, "r"); filep = fopen(myApp->m_configFile, "r");
if (filep) { if (filep) {
while (!feof(filep)) { fclose(filep);
memset(buffer, '\000', sizeof(buffer));
fgets(buffer, sizeof(buffer), filep);
if (strlen(buffer) > 0) {
char *p1 = strstr(buffer, "\r\n");
if (p1) {
*p1 = '\000';
} }
else { else {
buffer[strlen(buffer)-1] = '\000'; MessageBox("Unable to load config file (" + CString(myApp->m_configFile) + ") unable to start", NULL, MB_OK);
} }
configTab.m_Config = configTab.m_Config + buffer;
configTab.m_Config += "\r\n";
}
}
}
else {
configTab.m_Config = " \
<icecast>\r\n \
<location>Here and There</location>\r\n\
<admin>nobody@me.org</admin>\r\n\
<limits>\r\n\
<clients>100</clients>\r\n\
<sources>2</sources>\r\n\
<threadpool>5</threadpool>\r\n\
<client-timeout>30</client-timeout>\r\n\
<header-timeout>15</header-timeout>\r\n\
<source-timeout>10</source-timeout>\r\n\
</limits>\r\n\
<source-password>changeme</source-password>\r\n\
<directory>\r\n\
<touch-freq>5</touch-freq>\r\n\
<server>\r\n\
<host>yp.icecast.org</host>\r\n\
<touch-freq>15</touch-freq>\r\n\
</server>\r\n\
</directory>\r\n\
<bind-address>0.0.0.0</bind-address>\r\n\
<port>8000</port>\r\n\
<paths>\r\n\
<basedir>./</basedir>\r\n\
<logdir>./</logdir>\r\n\
<webroot>./webroot</webroot>\r\n\
</paths>\r\n\
<logging>\r\n\
<accesslog>access.log</accesslog>\r\n\
<errorlog>error.log</errorlog>\r\n\
</logging>\r\n\
</icecast>\r\n\
";
}
gConfigurationSave = configTab.m_Config;
configTab.UpdateData(FALSE);
} }
@ -539,32 +418,10 @@ void CIcecast2winDlg::LoadConfig()
void CIcecast2winDlg::OnFileExit() void CIcecast2winDlg::OnFileExit()
{ {
// TODO: Add your command handler code here // TODO: Add your command handler code here
DestroyWindow(); DestroyWindow();
} }
void CIcecast2winDlg::ParseConfig()
{
char access[2046] = "";
char error[2046] = "";
char logdir[2046] = "";
memset(access, '\000', sizeof(access));
memset(error, '\000', sizeof(error));
memset(logdir, '\000', sizeof(logdir));
getTag(m_ConfigEdit.GetBuffer(0), "logdir", logdir);
getTag(m_ConfigEdit.GetBuffer(0), "accesslog", access);
getTag(m_ConfigEdit.GetBuffer(0), "errorlog", error);
m_AccessLog = logdir;
m_AccessLog += access;
m_ErrorLog = logdir;
m_ErrorLog += error;
}
void CIcecast2winDlg::getTag(char *pbuf, char *ptag, char *dest) void CIcecast2winDlg::getTag(char *pbuf, char *ptag, char *dest)
{ {
@ -611,14 +468,10 @@ void CollectStats(stats_event_t *event)
tempElement.name = ""; tempElement.name = "";
tempElement.value = ""; tempElement.value = "";
// memset(&tempElement, '\000', sizeof(tempElement));
if (event->name != NULL) { if (event->name != NULL) {
//strcpy(tempElement.name, event->name);
tempElement.name = event->name; tempElement.name = event->name;
} }
if (event->value != NULL) { if (event->value != NULL) {
//strcpy(tempElement.value, event->value);
tempElement.value = event->value; tempElement.value = event->value;
} }
if (event->source != NULL) { if (event->source != NULL) {
@ -639,7 +492,6 @@ void CollectStats(stats_event_t *event)
} }
} }
if (!foundit2) { if (!foundit2) {
// memcpy(&gStats[i].stats[gStats[i].numStats], &tempElement, sizeof(tempElement));
gStats[i].stats[j].name = tempElement.name; gStats[i].stats[j].name = tempElement.name;
gStats[i].stats[j].value = tempElement.value; gStats[i].stats[j].value = tempElement.value;
gStats[i].numStats++; gStats[i].numStats++;
@ -649,7 +501,6 @@ void CollectStats(stats_event_t *event)
} }
if (!foundit) { if (!foundit) {
// strcpy(gStats[numMainStats].source, tempSource);
if (strlen(tempSource) == 0) { if (strlen(tempSource) == 0) {
strcpy(tempSource, "Global Stat"); strcpy(tempSource, "Global Stat");
} }
@ -658,7 +509,6 @@ void CollectStats(stats_event_t *event)
gStats[numMainStats].stats[0].value = tempElement.value; gStats[numMainStats].stats[0].value = tempElement.value;
gStats[numMainStats].populated = 1; gStats[numMainStats].populated = 1;
// memcpy(&gStats[numMainStats].stats[0], &tempElement, sizeof(tempElement));
gStats[numMainStats].numStats++; gStats[numMainStats].numStats++;
numMainStats++; numMainStats++;
} }
@ -690,7 +540,6 @@ void StartStats(void *dummy)
} }
while (global.running == ICE_RUNNING) { while (global.running == ICE_RUNNING) {
if (global.running == ICE_RUNNING) { if (global.running == ICE_RUNNING) {
// memset(&gStats, '\000', sizeof(gStats));
for (int j=0;j<MAXSOURCES;j++) { for (int j=0;j<MAXSOURCES;j++) {
gStats[j].numStats = 0; gStats[j].numStats = 0;
} }
@ -731,7 +580,6 @@ void CIcecast2winDlg::OnTimer(UINT nIDEvent)
m_StartButton.SetWindowText("Stop Server"); m_StartButton.SetWindowText("Stop Server");
m_StartButton.SetState(0); m_StartButton.SetState(0);
} }
//UpdateData(FALSE);
time_t currentTime; time_t currentTime;
time(&currentTime); time(&currentTime);
time_t runningTime = currentTime - serverStart; time_t runningTime = currentTime - serverStart;
@ -751,12 +599,9 @@ void CIcecast2winDlg::OnTimer(UINT nIDEvent)
m_ServerStatusBitmap.SetBitmap(HBITMAP(stoppedBitmap)); m_ServerStatusBitmap.SetBitmap(HBITMAP(stoppedBitmap));
m_StartButton.SetWindowText("Start Server"); m_StartButton.SetWindowText("Start Server");
m_StartButton.SetState(0); m_StartButton.SetState(0);
configTab.m_ConfigCtrl.SetReadOnly(FALSE);
UpdateData(FALSE); UpdateData(FALSE);
statusTab.m_RunningFor = "Not running"; statusTab.m_RunningFor = "Not running";
statusTab.UpdateData(FALSE); statusTab.UpdateData(FALSE);
//UpdateData(FALSE);
} }
} }
@ -765,8 +610,6 @@ void CIcecast2winDlg::OnTimer(UINT nIDEvent)
char g_configFile[1024] = ""; char g_configFile[1024] = "";
char g_progName[255] = "icecast2"; char g_progName[255] = "icecast2";
//int __argc = 2;
//char* __argv[2];
void StartServer(void *configfile) void StartServer(void *configfile)
{ {
@ -779,8 +622,10 @@ void StartServer(void *configfile)
argv[1] = "-c"; argv[1] = "-c";
argv[2] = g_configFile; argv[2] = g_configFile;
time(&(g_mainDialog->serverStart)); time(&(g_mainDialog->serverStart));
main(argc, (char **)argv); int ret = main(argc, (char **)argv);
// g_mainDialog->StopServer(); if (ret) {
MessageBox(NULL, "Unable to start server", NULL, MB_OK);
}
global.running = ICE_HALTING; global.running = ICE_HALTING;
_endthread(); _endthread();
@ -801,12 +646,8 @@ void CIcecast2winDlg::OnFileStartserver()
else { else {
m_ConfigEditCtrl.SetReadOnly(TRUE); m_ConfigEditCtrl.SetReadOnly(TRUE);
LoadConfig(); LoadConfig();
ParseConfig();
SetTimer(0, 500, NULL); SetTimer(0, 500, NULL);
_beginthread(StartServer, 0, (void *)(LPCSTR)myApp->m_configFile); _beginthread(StartServer, 0, (void *)(LPCSTR)myApp->m_configFile);
// _beginthread(StartTailAccessLog, 0, (void *)0);
// _beginthread(StartTailErrorLog, 0, (void *)0);
// EDZ
_beginthread(StartStats, 0, (void *)CollectStats); _beginthread(StartStats, 0, (void *)CollectStats);
} }
} }
@ -822,7 +663,6 @@ bool infocus = false;
void CIcecast2winDlg::StopServer() void CIcecast2winDlg::StopServer()
{ {
KillTimer(0); KillTimer(0);
configTab.m_ConfigCtrl.SetReadOnly(FALSE);
global.running = ICE_HALTING; global.running = ICE_HALTING;
m_StartButton.SetWindowText("Start Server"); m_StartButton.SetWindowText("Start Server");
m_StartButton.SetState(0); m_StartButton.SetState(0);
@ -844,11 +684,8 @@ void CIcecast2winDlg::OnStart()
StopServer(); StopServer();
} }
else { else {
configTab.m_ConfigCtrl.SetReadOnly(TRUE);
ParseConfig();
SetTimer(0, 500, NULL); SetTimer(0, 500, NULL);
_beginthread(StartServer, 0, (void *)(LPCSTR)myApp->m_configFile); _beginthread(StartServer, 0, (void *)(LPCSTR)myApp->m_configFile);
// EDZ
_beginthread(StartStats, 0, (void *)CollectStats); _beginthread(StartStats, 0, (void *)CollectStats);
} }
@ -957,6 +794,7 @@ void CIcecast2winDlg::UpdateStatsLists()
if (!inthere2) { if (!inthere2) {
LVITEM lvi; LVITEM lvi;
lvi.mask = LVIF_TEXT; lvi.mask = LVIF_TEXT;
lvi.iItem = statusTab.m_GlobalStatList.GetItemCount(); lvi.iItem = statusTab.m_GlobalStatList.GetItemCount();
lvi.iSubItem = 0; lvi.iSubItem = 0;
@ -968,15 +806,20 @@ void CIcecast2winDlg::UpdateStatsLists()
lvi.iSubItem = 2; lvi.iSubItem = 2;
lvi.pszText = (LPTSTR)(LPCTSTR)gAdditionalGlobalStats.stats[l].value; lvi.pszText = (LPTSTR)(LPCTSTR)gAdditionalGlobalStats.stats[l].value;
statusTab.m_GlobalStatList.SetItem(&lvi); statusTab.m_GlobalStatList.SetItem(&lvi);
} if ((!strcmp(gTitleSource, gAdditionalGlobalStats.stats[l].source)) &&
if ((!strcmp(gAdditionalGlobalStats.stats[l].source, gTitleSource)) && (!strcmp(gTitleName, gAdditionalGlobalStats.stats[l].name))) {
(!strcmp(gAdditionalGlobalStats.stats[l].name, gTitleName))) {
gAdditionalGlobalStats.stats[l].titleFlag = 1; gAdditionalGlobalStats.stats[l].titleFlag = 1;
} }
}
if (gAdditionalGlobalStats.stats[l].titleFlag) { if (gAdditionalGlobalStats.stats[l].titleFlag) {
CString windowTitle = gAdditionalGlobalStats.stats[l].source + " - " + gAdditionalGlobalStats.stats[l].name + " - " + gAdditionalGlobalStats.stats[l].value; CString windowTitle = gAdditionalGlobalStats.stats[l].source + " - " + gAdditionalGlobalStats.stats[l].name + " - " + gAdditionalGlobalStats.stats[l].value;
SetWindowText(windowTitle); SetWindowText(windowTitle);
if (m_pTray) {
m_pTray->SetTIP((LPSTR)(LPCSTR)windowTitle);
}
} }
} }
} }
@ -1006,6 +849,11 @@ void CIcecast2winDlg::UpdateStatsLists()
lvi.iSubItem = 2; lvi.iSubItem = 2;
lvi.pszText = (LPTSTR)(LPCTSTR)gStats[i].stats[k].value; lvi.pszText = (LPTSTR)(LPCTSTR)gStats[i].stats[k].value;
statusTab.m_GlobalStatList.SetItem(&lvi); statusTab.m_GlobalStatList.SetItem(&lvi);
if ((!strcmp(gTitleSource, gStats[i].source)) &&
(!strcmp(gTitleName, gStats[i].stats[k].name))) {
gStats[i].stats[k].titleFlag = 1;
}
} }
else { else {
LVITEM lvi; LVITEM lvi;
@ -1016,13 +864,13 @@ void CIcecast2winDlg::UpdateStatsLists()
lvi.pszText = (LPTSTR)(LPCTSTR)gStats[i].stats[k].value; lvi.pszText = (LPTSTR)(LPCTSTR)gStats[i].stats[k].value;
statusTab.m_GlobalStatList.SetItem(&lvi); statusTab.m_GlobalStatList.SetItem(&lvi);
} }
if ((!strcmp(gStats[i].source, gTitleSource)) &&
(!strcmp(gStats[i].stats[k].name, gTitleName))) {
gStats[i].stats[k].titleFlag = 1;
}
if (gStats[i].stats[k].titleFlag) { if (gStats[i].stats[k].titleFlag) {
CString windowTitle = gStats[i].source + " - " + gStats[i].stats[k].name + " - " + gStats[i].stats[k].value; CString windowTitle = gStats[i].source + " - " + gStats[i].stats[k].name + " - " + gStats[i].stats[k].value;
SetWindowText(windowTitle); SetWindowText(windowTitle);
if (m_pTray) {
m_pTray->SetTIP((LPSTR)(LPCSTR)windowTitle);
}
} }
} }
} }
@ -1079,7 +927,6 @@ void CIcecast2winDlg::config_write()
memset(buf, '\000', sizeof(buf)); memset(buf, '\000', sizeof(buf));
sprintf(buf2, "AdditionalStatsName%d", i); sprintf(buf2, "AdditionalStatsName%d", i);
WritePrivateProfileString(gAppName, buf2, gAdditionalGlobalStats.stats[i].name, gConfigFile); WritePrivateProfileString(gAppName, buf2, gAdditionalGlobalStats.stats[i].name, gConfigFile);
gAdditionalGlobalStats.stats[i].name = buf;
if (gAdditionalGlobalStats.stats[i].titleFlag) { if (gAdditionalGlobalStats.stats[i].titleFlag) {
sprintf(buf2, "%s|%s", gAdditionalGlobalStats.stats[i].source, gAdditionalGlobalStats.stats[i].name); sprintf(buf2, "%s|%s", gAdditionalGlobalStats.stats[i].source, gAdditionalGlobalStats.stats[i].name);
@ -1132,7 +979,6 @@ void CIcecast2winDlg::config_read()
} }
GetPrivateProfileString(gAppName, "TitleName", "", buf, sizeof(buf), gConfigFile); GetPrivateProfileString(gAppName, "TitleName", "", buf, sizeof(buf), gConfigFile);
/*
if (strlen(buf) > 0) { if (strlen(buf) > 0) {
char *p1 = strchr(buf, '|'); char *p1 = strchr(buf, '|');
if (p1) { if (p1) {
@ -1151,7 +997,6 @@ void CIcecast2winDlg::config_read()
strcpy(gTitleName, tmpName); strcpy(gTitleName, tmpName);
} }
} }
*/
} }
@ -1174,7 +1019,6 @@ void CIcecast2winDlg::OnSize(UINT nType, int cx, int cy)
GetClientRect (&rect); GetClientRect (&rect);
m_MainTab.ResizeDialog(0, rect.Width()-border1, rect.Height()-border2); m_MainTab.ResizeDialog(0, rect.Width()-border1, rect.Height()-border2);
m_MainTab.ResizeDialog(1, rect.Width()-border1, rect.Height()-border2); m_MainTab.ResizeDialog(1, rect.Width()-border1, rect.Height()-border2);
m_MainTab.ResizeDialog(2, rect.Width()-border1, rect.Height()-border2);
} }
} }
@ -1226,7 +1070,9 @@ void CIcecast2winDlg::OnHidesystray()
void CIcecast2winDlg::OnHide() void CIcecast2winDlg::OnHide()
{ {
// TODO: Add your control notification handler code here // TODO: Add your control notification handler code here
if (m_pTray == NULL) {
m_pTray = new CTrayNot (this,WM_TRAY_NOTIFY, NULL,theApp.m_pIconList); m_pTray = new CTrayNot (this,WM_TRAY_NOTIFY, NULL,theApp.m_pIconList);
}
m_pTray->SetState(0); m_pTray->SetState(0);
m_bHidden = TRUE; m_bHidden = TRUE;
@ -1252,3 +1098,52 @@ void CIcecast2winDlg::OnDestroy()
// TODO: Add your message handler code here // TODO: Add your message handler code here
} }
void CIcecast2winDlg::OnFileEditconfiguration()
{
// TODO: Add your command handler code here
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
int ok = 1;
if (global.running == ICE_RUNNING) {
MessageBox("I'm sorry, but you cannot edit the configuration file while the server is running", NULL, MB_OK);
}
else {
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
"notepad icecast.xml", // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
ok = 0;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
}
void CIcecast2winDlg::OnAboutHelp()
{
// TODO: Add your command handler code here
ShellExecute(NULL, "open", "doc\\icecast2.chm", NULL, NULL, SW_SHOWNORMAL);
}

View File

@ -111,6 +111,8 @@ protected:
afx_msg void OnBlankRestore(); afx_msg void OnBlankRestore();
afx_msg LONG OnTrayNotify ( WPARAM wParam, LPARAM lParam ); afx_msg LONG OnTrayNotify ( WPARAM wParam, LPARAM lParam );
afx_msg void OnDestroy(); afx_msg void OnDestroy();
afx_msg void OnFileEditconfiguration();
afx_msg void OnAboutHelp();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };

View File

@ -13,7 +13,7 @@ AllowNoIcons=yes
LicenseFile=..\COPYING LicenseFile=..\COPYING
InfoAfterFile=..\README InfoAfterFile=..\README
OutputDir=. OutputDir=.
OutputBaseFilename=Icecast2_win32_09222002_setup OutputBaseFilename=Icecast2_win32_08282002_setup
WizardImageFile=icecast2logo2.bmp WizardImageFile=icecast2logo2.bmp
; uncomment the following line if you want your installation to run on NT 3.51 too. ; uncomment the following line if you want your installation to run on NT 3.51 too.
; MinVersion=4,3.51 ; MinVersion=4,3.51
@ -23,6 +23,7 @@ Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "A
[Files] [Files]
Source: "Release\Icecast2.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite Source: "Release\Icecast2.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite
Source: "..\doc\icecast2.chm"; DestDir: "{app}\doc"; CopyMode: alwaysoverwrite
Source: "..\web\status.xsl"; DestDir: "{app}\web"; CopyMode: alwaysoverwrite Source: "..\web\status.xsl"; DestDir: "{app}\web"; CopyMode: alwaysoverwrite
Source: "..\web\status2.xsl"; DestDir: "{app}\web"; CopyMode: alwaysoverwrite Source: "..\web\status2.xsl"; DestDir: "{app}\web"; CopyMode: alwaysoverwrite
Source: "..\..\pthreads\pthreadVSE.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite Source: "..\..\pthreads\pthreadVSE.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite

View File

@ -27,6 +27,7 @@
#define IDC_CURSOR2 156 #define IDC_CURSOR2 156
#define IDB_BITMAP7 159 #define IDB_BITMAP7 159
#define IDR_TRAY 160 #define IDR_TRAY 160
#define IDR_MENU4 161
#define IDC_MAINTAB 1000 #define IDC_MAINTAB 1000
#define IDC_ERROR_EDIT 1003 #define IDC_ERROR_EDIT 1003
#define IDC_ACCESS_EDIT 1004 #define IDC_ACCESS_EDIT 1004
@ -59,13 +60,16 @@
#define ID__DELETEFROMGLOBALSTATS 32777 #define ID__DELETEFROMGLOBALSTATS 32777
#define ID__MAKETHISSTATTHEWINDOWTITLE 32779 #define ID__MAKETHISSTATTHEWINDOWTITLE 32779
#define ID_BLANK_RESTORE 32780 #define ID_BLANK_RESTORE 32780
#define ID_ABOUT_HELP 32781
#define ID_FILE_EDITCONFIGURATION 32782
#define ID_ABOUT_CREDITS 32784
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 161 #define _APS_NEXT_RESOURCE_VALUE 162
#define _APS_NEXT_COMMAND_VALUE 32781 #define _APS_NEXT_COMMAND_VALUE 32785
#define _APS_NEXT_CONTROL_VALUE 1037 #define _APS_NEXT_CONTROL_VALUE 1037
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif