📄 ppgtweaks.cpp
字号:
//this file is part of eMule
//Copyright (C)2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "stdafx.h"
#include "emule.h"
#include "SearchDlg.h"
#include "PPgTweaks.h"
#include "Scheduler.h"
#include "DownloadQueue.h"
#include "Preferences.h"
#include "OtherFunctions.h"
#include "TransferWnd.h"
#include "emuledlg.h"
#include "SharedFilesWnd.h"
#include "ServerWnd.h"
#include "HelpIDs.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#define DFLT_MAXCONPERFIVE 20
#define DFLT_MAXHALFOPEN 9
///////////////////////////////////////////////////////////////////////////////
// CPPgTweaks dialog
IMPLEMENT_DYNAMIC(CPPgTweaks, CPropertyPage)
BEGIN_MESSAGE_MAP(CPPgTweaks, CPropertyPage)
ON_WM_HSCROLL()
ON_WM_DESTROY()
ON_MESSAGE(WM_TREEOPTSCTRL_NOTIFY, OnTreeOptsCtrlNotify)
ON_WM_HELPINFO()
END_MESSAGE_MAP()
CPPgTweaks::CPPgTweaks()
: CPropertyPage(CPPgTweaks::IDD)
, m_ctrlTreeOptions(theApp.m_iDfltImageListColorFlags)
{
m_iFileBufferSize = 0;
m_iQueueSize = 0;
m_iMaxConnPerFive = 0;
m_iMaxHalfOpen = 0;
m_iAutoTakeEd2kLinks = 0;
m_iVerbose = 0;
m_iDebugSourceExchange = 0;
m_iLogBannedClients = 0;
m_iLogRatingDescReceived = 0;
m_iLogSecureIdent = 0;
m_iLogFilteredIPs = 0;
m_iLogFileSaving = 0;
m_iLogA4AF = 0;
m_iLogUlDlEvents = 0;
m_iCreditSystem = 0;
m_iLog2Disk = 0;
m_iDebug2Disk = 0;
m_iCommitFiles = 0;
m_iFilterLANIPs = 0;
m_iExtControls = 0;
m_uServerKeepAliveTimeout = 0;
m_iCheckDiskspace = 0;
m_fMinFreeDiskSpaceMB = 0.0F;
(void)m_sYourHostname;
m_iFirewallStartup = 0;
m_iLogLevel = 0;
m_iDisablePeerCache = 0;
// ZZ:UploadSpeedSense -->
m_iDynUpEnabled = 0;
m_iDynUpMinUpload = 0;
m_iDynUpPingTolerance = 0;
m_iDynUpGoingUpDivider = 0;
m_iDynUpGoingDownDivider = 0;
m_iDynUpNumberOfPings = 0;
// ZZ:DownloadManager
m_iA4AFSaveCpu = 0;
m_bInitializedTreeOpts = false;
m_htiMaxCon5Sec = NULL;
m_htiMaxHalfOpen = NULL;
m_htiAutoTakeEd2kLinks = NULL;
m_htiVerboseGroup = NULL;
m_htiVerbose = NULL;
m_htiDebugSourceExchange = NULL;
m_htiLogBannedClients = NULL;
m_htiLogRatingDescReceived = NULL;
m_htiLogSecureIdent = NULL;
m_htiLogFilteredIPs = NULL;
m_htiLogFileSaving = NULL;
m_htiLogUlDlEvents = NULL;
m_htiCreditSystem = NULL;
m_htiLog2Disk = NULL;
m_htiDebug2Disk = NULL;
m_htiCommit = NULL;
m_htiCommitNever = NULL;
m_htiCommitOnShutdown = NULL;
m_htiCommitAlways = NULL;
m_htiFilterLANIPs = NULL;
m_htiExtControls = NULL;
m_htiServerKeepAliveTimeout = NULL;
m_htiCheckDiskspace = NULL; // SLUGFILLER: checkDiskspace
m_htiMinFreeDiskSpace = NULL;
m_htiYourHostname = NULL; // itsonlyme: hostnameSource
m_htiFirewallStartup = NULL;
m_htiLogLevel = NULL;
m_htiDisablePeerCache = NULL;
m_htiScoreAdjustor = NULL; //VeryCD版
m_htiUploadClients = NULL;
m_htiIP2CountryShowFlag = NULL;
m_htiBrowser = NULL;
// ZZ:UploadSpeedSense -->
m_htiDynUp = NULL;
m_htiDynUpEnabled = NULL;
m_htiDynUpMinUpload = NULL;
m_htiDynUpPingTolerance = NULL;
m_htiDynUpPingToleranceMilliseconds = NULL;
m_htiDynUpPingToleranceGroup = NULL;
m_htiDynUpRadioPingTolerance = NULL;
m_htiDynUpRadioPingToleranceMilliseconds = NULL;
m_htiDynUpGoingUpDivider = NULL;
m_htiDynUpGoingDownDivider = NULL;
m_htiDynUpNumberOfPings = NULL;
// ZZ:DownloadManager
m_htiA4AFSaveCpu = NULL;
m_htiLogA4AF = NULL;
}
CPPgTweaks::~CPPgTweaks()
{
}
void CPPgTweaks::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EXT_OPTS, m_ctrlTreeOptions);
if (!m_bInitializedTreeOpts)
{
int iImgBackup = 8; // default icon
int iImgLog = 8; // default icon
// ZZ:UploadSpeedSense -->
int iImgDynyp = 8; // default icon
// ZZ:UploadSpeedSense <--
int iImgA4AF = 8; // default icon // ZZ:DownloadManager
CImageList* piml = m_ctrlTreeOptions.GetImageList(TVSIL_NORMAL);
if (piml){
iImgBackup = piml->Add(CTempIconLoader(_T("Harddisk")));
iImgLog = piml->Add(CTempIconLoader(_T("Log")));
// ZZ:UploadSpeedSense -->
iImgDynyp = piml->Add(CTempIconLoader(_T("upload")));
// ZZ:UploadSpeedSense <--
iImgA4AF = piml->Add(CTempIconLoader(_T("Download"))); // ZZ:DownloadManager
}
m_htiMaxCon5Sec = m_ctrlTreeOptions.InsertItem(GetResString(IDS_MAXCON5SECLABEL), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, TVI_ROOT);
m_ctrlTreeOptions.AddEditBox(m_htiMaxCon5Sec, RUNTIME_CLASS(CNumTreeOptionsEdit));
m_htiMaxHalfOpen = m_ctrlTreeOptions.InsertItem(GetResString(IDS_MAXHALFOPENCONS), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, TVI_ROOT);
m_ctrlTreeOptions.AddEditBox(m_htiMaxHalfOpen, RUNTIME_CLASS(CNumTreeOptionsEdit));
m_htiAutoTakeEd2kLinks = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_AUTOTAKEED2KLINKS), TVI_ROOT, m_iAutoTakeEd2kLinks);
m_htiFirewallStartup = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_FO_PREF_STARTUP), TVI_ROOT, m_iFirewallStartup);
m_htiCreditSystem = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_USECREDITSYSTEM), TVI_ROOT, m_iCreditSystem);
m_htiFilterLANIPs = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_PW_FILTER), TVI_ROOT, m_iFilterLANIPs);
m_htiExtControls = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SHOWEXTSETTINGS), TVI_ROOT, m_iExtControls);
m_htiA4AFSaveCpu = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_A4AF_SAVE_CPU), TVI_ROOT, m_iA4AFSaveCpu); // ZZ:DownloadManager
m_htiCheckDiskspace = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CHECKDISKSPACE), TVI_ROOT, m_iCheckDiskspace); // SLUGFILLER: checkDiskspace
m_htiMinFreeDiskSpace = m_ctrlTreeOptions.InsertItem(GetResString(IDS_MINFREEDISKSPACE), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiCheckDiskspace);
m_ctrlTreeOptions.AddEditBox(m_htiMinFreeDiskSpace, RUNTIME_CLASS(CNumTreeOptionsEdit));
// itsonlyme: hostnameSource
m_htiYourHostname = m_ctrlTreeOptions.InsertItem(GetResString(IDS_YOURHOSTNAME), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, TVI_ROOT);
m_ctrlTreeOptions.AddEditBox(m_htiYourHostname, RUNTIME_CLASS(CTreeOptionsEdit));
m_htiDisablePeerCache = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DISABLEPEERACHE), TVI_ROOT, m_iDisablePeerCache);
m_htiLog2Disk = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG2DISK), TVI_ROOT, m_iLog2Disk);
if (thePrefs.GetEnableVerboseOptions())
{
m_htiVerboseGroup = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_VERBOSE), iImgLog, TVI_ROOT);
m_htiVerbose = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_ENABLED), m_htiVerboseGroup, m_iVerbose);
m_htiLogLevel = m_ctrlTreeOptions.InsertItem(GetResString(IDS_LOG_LEVEL), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiVerboseGroup);
m_ctrlTreeOptions.AddEditBox(m_htiLogLevel, RUNTIME_CLASS(CNumTreeOptionsEdit));
m_htiDebug2Disk = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG2DISK), m_htiVerboseGroup, m_iDebug2Disk);
m_htiDebugSourceExchange = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DEBUG_SOURCE_EXCHANGE), m_htiVerboseGroup, m_iDebugSourceExchange);
m_htiLogBannedClients = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG_BANNED_CLIENTS), m_htiVerboseGroup, m_iLogBannedClients);
m_htiLogRatingDescReceived = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG_RATING_RECV), m_htiVerboseGroup, m_iLogRatingDescReceived);
m_htiLogSecureIdent = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG_SECURE_IDENT), m_htiVerboseGroup, m_iLogSecureIdent);
m_htiLogFilteredIPs = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG_FILTERED_IPS), m_htiVerboseGroup, m_iLogFilteredIPs);
m_htiLogFileSaving = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG_FILE_SAVING), m_htiVerboseGroup, m_iLogFileSaving);
m_htiLogA4AF = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG_A4AF), m_htiVerboseGroup, m_iLogA4AF); // ZZ:DownloadManager
m_htiLogUlDlEvents = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_LOG_ULDL_EVENTS), m_htiVerboseGroup, m_iLogUlDlEvents);
}
m_htiCommit = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_COMMITFILES), iImgBackup, TVI_ROOT);
m_htiCommitNever = m_ctrlTreeOptions.InsertRadioButton(GetResString(IDS_NEVER), m_htiCommit, m_iCommitFiles == 0);
m_htiCommitOnShutdown = m_ctrlTreeOptions.InsertRadioButton(GetResString(IDS_ONSHUTDOWN), m_htiCommit, m_iCommitFiles == 1);
m_htiCommitAlways = m_ctrlTreeOptions.InsertRadioButton(GetResString(IDS_ALWAYS), m_htiCommit, m_iCommitFiles == 2);
m_htiServerKeepAliveTimeout = m_ctrlTreeOptions.InsertItem(GetResString(IDS_SERVERKEEPALIVETIMEOUT), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, TVI_ROOT);
m_ctrlTreeOptions.AddEditBox(m_htiServerKeepAliveTimeout, RUNTIME_CLASS(CNumTreeOptionsEdit));
m_htiScoreAdjustor = m_ctrlTreeOptions.InsertItem(GetResString(IDS_SCOREADJUSTOR), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, TVI_ROOT);//VeryCD版
m_ctrlTreeOptions.AddEditBox(m_htiScoreAdjustor, RUNTIME_CLASS(CTreeOptionsEdit));
m_htiUploadClients = m_ctrlTreeOptions.InsertItem(GetResString(IDS_UPLOADCLIENTS), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, TVI_ROOT);
m_ctrlTreeOptions.AddEditBox(m_htiUploadClients, RUNTIME_CLASS(CNumTreeOptionsEdit));
m_htiIP2CountryShowFlag = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SHOWFLAG), TVI_ROOT, m_bIP2CountryShowFlag);
m_htiBrowser = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SHOWBROWSER), TVI_ROOT, m_bBrowser);
// ZZ:UploadSpeedSense -->
m_htiDynUp = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_DYNUP), iImgDynyp, TVI_ROOT);
m_htiDynUpEnabled = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DYNUPENABLED), m_htiDynUp, m_iDynUpEnabled);
m_htiDynUpMinUpload = m_ctrlTreeOptions.InsertItem(GetResString(IDS_DYNUP_MINUPLOAD), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiDynUp);
m_ctrlTreeOptions.AddEditBox(m_htiDynUpMinUpload, RUNTIME_CLASS(CNumTreeOptionsEdit));
m_htiDynUpPingTolerance = m_ctrlTreeOptions.InsertItem(GetResString(IDS_DYNUP_PINGTOLERANCE), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiDynUp);
m_ctrlTreeOptions.AddEditBox(m_htiDynUpPingTolerance, RUNTIME_CLASS(CNumTreeOptionsEdit));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -