📄 emuledlg.cpp
字号:
break;
case TBN_NULL:
m_wndTaskbarNotifier.Show(Text, MsgType);
ShowIt = true;
break;
}
if (theApp.glob_prefs->GetUseSoundInNotifier() && !ForceSoundOFF && ShowIt == true)
PlaySound(theApp.glob_prefs->GetNotifierWavSoundPath(), NULL, SND_FILENAME | SND_NOSTOP | SND_NOWAIT | SND_ASYNC);
}
void CemuleDlg::LoadNotifier(CString configuration) {
notifierenabled = m_wndTaskbarNotifier.LoadConfiguration(configuration);
}
LRESULT CemuleDlg::OnTaskbarNotifierClicked(WPARAM wParam,LPARAM lParam)
{
int msgType = TBN_NULL;
msgType = m_wndTaskbarNotifier.GetMessageType();
switch(msgType)
{
case TBN_CHAT:
RestoreWindow();
SetActiveDialog(&chatwnd);
break;
case TBN_DLOAD:
RestoreWindow();
SetActiveDialog(&transferwnd);
// {TODO: aprire la cartella incoming?}
break;
case TBN_IMPORTANTEVENT:
RestoreWindow();
SetActiveDialog(&serverwnd);
break;
case TBN_LOG:
RestoreWindow();
SetActiveDialog(&serverwnd);
break;
case TBN_NEWVERSION:{
CString theUrl;
theUrl.Format("http://vcheck.emule-project.net/en/version_check.php?version=%i&language=%i",CURRENT_VERSION_CHECK,theApp.glob_prefs->GetLanguageID());
ShellExecute(NULL, NULL, theUrl, NULL, theApp.glob_prefs->GetAppDir(), SW_SHOWDEFAULT);
break;
}
}
return 0;
}
//END - enkeyDEV(kei-kun) -TaskbarNotifier-
void CemuleDlg::Localize(){
toolbar.Localize();
ShowConnectionState();
}
// quick-speed changer --
void CemuleDlg::QuickSpeedOther(UINT nID)
{
switch (nID) {
case MP_QS_PA: theApp.glob_prefs->SetMaxUpload((uint16)(1));
theApp.glob_prefs->SetMaxDownload((uint16)(1));
break ;
case MP_QS_UA:
theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()));
theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()));
break ;
}
}
void CemuleDlg::QuickSpeedUpload(UINT nID)
{
switch (nID) {
case MP_QS_U10: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.1)); break ;
case MP_QS_U20: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.2)); break ;
case MP_QS_U30: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.3)); break ;
case MP_QS_U40: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.4)); break ;
case MP_QS_U50: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.5)); break ;
case MP_QS_U60: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.6)); break ;
case MP_QS_U70: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.7)); break ;
case MP_QS_U80: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.8)); break ;
case MP_QS_U90: theApp.glob_prefs->SetMaxUpload((uint16)(theApp.glob_prefs->GetMaxGraphUploadRate()*0.9)); break ;
case MP_QS_U100: theApp.glob_prefs->SetMaxUpload(theApp.glob_prefs->GetMaxGraphUploadRate()); break ;
case MP_QS_UPC: theApp.glob_prefs->SetMaxUpload(UNLIMITED); break ;
case MP_QS_UP10: theApp.glob_prefs->SetMaxUpload(GetRecMaxUpload()); break ;
}
}
void CemuleDlg::QuickSpeedDownload(UINT nID)
{
switch (nID) {
case MP_QS_D10: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.1)); break ;
case MP_QS_D20: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.2)); break ;
case MP_QS_D30: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.3)); break ;
case MP_QS_D40: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.4)); break ;
case MP_QS_D50: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.5)); break ;
case MP_QS_D60: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.6)); break ;
case MP_QS_D70: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.7)); break ;
case MP_QS_D80: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.8)); break ;
case MP_QS_D90: theApp.glob_prefs->SetMaxDownload((uint16)(theApp.glob_prefs->GetMaxGraphDownloadRate()*0.9)); break ;
case MP_QS_D100: theApp.glob_prefs->SetMaxDownload(theApp.glob_prefs->GetMaxGraphDownloadRate()); break ;
case MP_QS_DC: theApp.glob_prefs->SetMaxDownload(UNLIMITED); break ;
}
}
// quick-speed changer -- based on xrmb
int CemuleDlg::GetRecMaxUpload() {
if (theApp.glob_prefs->GetMaxGraphUploadRate()<7) return 0;
if (theApp.glob_prefs->GetMaxGraphUploadRate()<15) return theApp.glob_prefs->GetMaxGraphUploadRate()-3;
return (theApp.glob_prefs->GetMaxGraphUploadRate()-4);
}
BOOL CemuleDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch(wParam)
{
case IDC_TOOLBARBUTTON + 0:
DisConnect();
break;
case IDC_TOOLBARBUTTON + 1:
case MP_HM_SRVR:
SetActiveDialog(&serverwnd);
break;
case IDC_TOOLBARBUTTON + 2:
case MP_HM_TRANSFER:
SetActiveDialog(&transferwnd);
break;
case IDC_TOOLBARBUTTON + 3:
case MP_HM_SEARCH:
SetActiveDialog(&searchwnd);
break;
case IDC_TOOLBARBUTTON + 4:
case MP_HM_FILES:
SetActiveDialog(&sharedfileswnd);
break;
case IDC_TOOLBARBUTTON + 5:
case MP_HM_MSGS:
SetActiveDialog(&chatwnd);
break;
case IDC_TOOLBARBUTTON + 6:
case MP_HM_IRC:
SetActiveDialog(&ircwnd);
break;
case IDC_TOOLBARBUTTON + 7:
case MP_HM_STATS:
SetActiveDialog(&statisticswnd);
break;
case IDC_TOOLBARBUTTON + 8:
case MP_HM_PREFS:
toolbar.PressButton(IDC_TOOLBARBUTTON+8,TRUE);
preferenceswnd.DoModal();
toolbar.PressButton(IDC_TOOLBARBUTTON+8,FALSE);
break;
case MP_HM_CON:
OnBnClickedButton2();
break;
case MP_HM_OPENINC:
ShellExecute(NULL, "open", theApp.glob_prefs->GetIncomingDir(),NULL, NULL, SW_SHOW);
break;
case MP_HM_EXIT:
OnClose();
break;
case MP_HM_LINK1: // MOD: dont remove!
ShellExecute(NULL, NULL, "http://www.emule-project.net", NULL, theApp.glob_prefs->GetAppDir(), SW_SHOWDEFAULT);
break;
case MP_HM_LINK2:
ShellExecute(NULL, NULL, "http://www.emule-project.net/faq/", NULL, theApp.glob_prefs->GetAppDir(), SW_SHOWDEFAULT);
break;
case MP_HM_LINK3: {
CString theUrl;
theUrl.Format("http://vcheck.emule-project.net/en/version_check.php?version=%i&language=%i",CURRENT_VERSION_CHECK,theApp.glob_prefs->GetLanguageID());
ShellExecute(NULL, NULL, theUrl, NULL, theApp.glob_prefs->GetAppDir(), SW_SHOWDEFAULT);
}
break;
default: break;
}
if (wParam>=MP_WEBURL && wParam<=MP_WEBURL+99) {
RunURL(NULL, theApp.webservices.GetAt(wParam-MP_WEBURL) );
}
return CTrayDialog::OnCommand(wParam, lParam);
}
void CemuleDlg::DisConnect()
{
if(!theApp.serverconnect->IsConnected())
{
if(!theApp.serverconnect->IsConnecting())
StartConnection();
else
{
theApp.serverconnect->StopConnectionTry();
ShowConnectionState(false);
}
}
else
CloseConnection();
}
BOOL CemuleDlg::OnQueryEndSession()
{
if (!CTrayDialog::OnQueryEndSession())
return FALSE;
if ( m_app_state == APP_STATE_DONE )
{
return TRUE;
}
else if ( m_app_state == APP_STATE_RUNNING )
{
m_app_state = APP_STATE_SHUTINGDOWN;
OnClose();
return TRUE;
}
return FALSE;
}
// Barry - To find out if app is running or shutting/shut down
bool CemuleDlg::IsRunning()
{
return (m_app_state == APP_STATE_RUNNING);
}
// modders: dont remove or change the original versioncheck! (additionals are ok)
int CemuleDlg::IsNewVersionAvailable(){
CString current;
current.Format("%i",CURRENT_VERSION_CHECK);
// this first block does the actual work
CInternetSession session;
CInternetFile* file = NULL;
try
{
// try to connect to the URL
file = (CInternetFile*) session.OpenURL("http://www.emule-project.net/currentversion");
}
catch (CInternetException* m_pException)
{
// set file to NULL if there's an error
file = NULL;
m_pException->Delete();
return -1;
}
if (file)
{
CString data;
int comp=-1;
if (file->ReadString(data) != NULL)
comp=data.Compare(current);
file->Close();
delete file;
return comp;
}
else
{
return -1;
}
return -1;
}
void CemuleDlg::OnBnClickedHotmenu()
{
int counter;
POINT point;
::GetCursorPos(&point);
CTitleMenu menu;
menu.CreatePopupMenu();
menu.AddMenuTitle(GetResString(IDS_HOTMENU));
CMenu m_Links;
m_Links.CreateMenu();
m_Links.AppendMenu(MF_STRING,MP_HM_LINK1, "eMule Homepage");
m_Links.AppendMenu(MF_STRING,MP_HM_LINK2, "eMule FAQ");
m_Links.AppendMenu(MF_STRING,MP_HM_LINK3, "eMule Versionscheck");
CMenu m_Web;
m_Web.CreateMenu();
UpdateURLMenu(m_Web,counter);
UINT flag2;
flag2=(counter==0) ? MF_GRAYED:MF_STRING;
if (theApp.serverconnect->IsConnected()) menu.AppendMenu(MF_STRING,MP_HM_CON,GetResString(IDS_MAIN_BTN_DISCONNECT));
else
if (theApp.serverconnect->IsConnecting()) menu.AppendMenu(MF_STRING,MP_HM_CON,GetResString(IDS_MAIN_BTN_CANCEL));
else menu.AppendMenu(MF_STRING,MP_HM_CON,GetResString(IDS_MAIN_BTN_CONNECT));
menu.AppendMenu(MF_STRING,MP_HM_SRVR, GetResString(IDS_EM_SERVER) );
menu.AppendMenu(MF_STRING,MP_HM_TRANSFER, GetResString(IDS_EM_TRANS));
menu.AppendMenu(MF_STRING,MP_HM_SEARCH, GetResString(IDS_EM_SEARCH));
menu.AppendMenu(MF_STRING,MP_HM_FILES, GetResString(IDS_EM_FILES));
menu.AppendMenu(MF_STRING,MP_HM_MSGS, GetResString(IDS_EM_MESSAGES));
menu.AppendMenu(MF_STRING,MP_HM_IRC, GetResString(IDS_IRC));
menu.AppendMenu(MF_STRING,MP_HM_STATS, GetResString(IDS_EM_STATISTIC));
menu.AppendMenu(MF_STRING,MP_HM_PREFS, GetResString(IDS_EM_PREFS));
menu.AppendMenu(MF_SEPARATOR);
menu.AppendMenu(MF_STRING,MP_HM_OPENINC, GetResString(IDS_OPENINC));
menu.AppendMenu(MF_SEPARATOR);
menu.AppendMenu(MF_STRING|MF_POPUP,(UINT_PTR)m_Links.m_hMenu, "Links" );
menu.AppendMenu(flag2|MF_POPUP,(UINT_PTR)m_Web.m_hMenu, GetResString(IDS_WEBSERVICES) );
menu.AppendMenu(MF_SEPARATOR);
menu.AppendMenu(MF_STRING,MP_HM_EXIT, GetResString(IDS_EXIT));
menu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x, point.y, this);
m_Web.DestroyMenu();
m_Links.DestroyMenu();
menu.DestroyMenu();
}
void CemuleDlg::RunFirstStartWizard(){
InputBox namebox;
namebox.SetLabels(GetResString(IDS_QL_USERNAME),GetResString(IDS_ENTERUSERNAME),"http://www.emule-project.net");
namebox.DoModal();
CString name=namebox.GetInput();
if (name.GetLength()>1) theApp.glob_prefs->SetUserNick(name);
int answer = AfxMessageBox(GetResString(IDS_FIRSTAUTODOWN),MB_YESNO|MB_DEFBUTTON1);
if( answer == IDYES )
theApp.glob_prefs->SetNewAutoDown(true);
else
theApp.glob_prefs->SetNewAutoDown(false);
answer = AfxMessageBox(GetResString(IDS_FIRSTAUTOUP),MB_YESNO|MB_DEFBUTTON1);
if( answer == IDYES )
theApp.glob_prefs->SetNewAutoUp(true);
else
theApp.glob_prefs->SetNewAutoUp(false);
answer = AfxMessageBox(GetResString(IDS_FIRSTFULLCHUNK),MB_YESNO|MB_DEFBUTTON1);
if( answer == IDYES )
theApp.glob_prefs->SetTransferFullChunks(true);
else
theApp.glob_prefs->SetTransferFullChunks(false);
answer = AfxMessageBox(GetResString(IDS_FIRSTSAFECON),MB_YESNO|MB_DEFBUTTON2);
if( answer == IDYES )
theApp.glob_prefs->SetSafeServerConnectEnabled(true);
else
theApp.glob_prefs->SetSafeServerConnectEnabled(false);
answer = AfxMessageBox(GetResString(IDS_FIRSTAUTOCON),MB_YESNO|MB_DEFBUTTON2);
if( answer == IDYES )
theApp.glob_prefs->SetAutoConnect(true);
else
theApp.glob_prefs->SetAutoConnect(false);
// answer = AfxMessageBox("Do you want eMule to start minimized?\r\r(Default No)",MB_YESNO|MB_DEFBUTTON2);
// if( answer == IDYES )
// theApp.glob_prefs->SetStartMinimized(true);
// else
// theApp.glob_prefs->SetStartMinimized(false);
// start connection wizard
Wizard conWizard;
conWizard.SetPrefs(theApp.glob_prefs );
conWizard.DoModal();
AfxMessageBox(GetResString(IDS_FIRSTCOMPLETE));
}
LRESULT CemuleDlg::OnWebServerConnect(WPARAM wParam, LPARAM lParam)
{
theApp.serverconnect->ConnectToServer((CServer*)wParam);
return 0;
}
LRESULT CemuleDlg::OnWebServerRemove(WPARAM wParam, LPARAM lParam)
{
theApp.emuledlg->serverwnd.serverlistctrl.RemoveServer((CServer*)wParam); // sivka's bugfix
return 0;
}
LRESULT CemuleDlg::OnWebSharedFilesReload(WPARAM wParam, LPARAM lParam)
{
theApp.sharedfiles->Reload(true);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -