📄 downloadpage.cpp
字号:
/*
* Copyright (C) 2001-2003 Jacek Sieka, j_s@telia.com
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
#include "../client/DCPlusPlus.h"
#include "Resource.h"
#include "DownloadPage.h"
#include "WinUtil.h"
#include "../client/SettingsManager.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
PropPage::Item DownloadPage::items[] = {
{ IDC_TEMP_DOWNLOAD_DIRECTORY, SettingsManager::TEMP_DOWNLOAD_DIRECTORY, PropPage::T_STR },
{ IDC_DOWNLOADDIR, SettingsManager::DOWNLOAD_DIRECTORY, PropPage::T_STR },
{ IDC_DOWNLOADS, SettingsManager::DOWNLOAD_SLOTS, PropPage::T_INT },
{ IDC_MAXSPEED, SettingsManager::MAX_DOWNLOAD_SPEED, PropPage::T_INT },
{ IDC_PROXY, SettingsManager::HTTP_PROXY, PropPage::T_STR },
{ IDC_PUBLIC_HUBS, SettingsManager::HUBLIST_SERVERS, PropPage::T_STR },
{ 0, 0, PropPage::T_END }
};
LRESULT DownloadPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
PropPage::read((HWND)*this, items);
CUpDownCtrl spin;
spin.Attach(GetDlgItem(IDC_SLOTSSPIN));
spin.SetRange32(0, 100);
spin.Detach();
spin.Attach(GetDlgItem(IDC_SPEEDSPIN));
spin.SetRange32(0, 10000);
// Do specialized reading here
return TRUE;
}
void DownloadPage::write()
{
PropPage::write((HWND)*this, items);
const string& s = SETTING(DOWNLOAD_DIRECTORY);
if(s.length() > 0 && s[s.length() - 1] != '\\') {
SettingsManager::getInstance()->set(SettingsManager::DOWNLOAD_DIRECTORY, s + '\\');
}
const string& t = SETTING(TEMP_DOWNLOAD_DIRECTORY);
if(t.length() > 0 && t[t.length() - 1] != '\\') {
SettingsManager::getInstance()->set(SettingsManager::TEMP_DOWNLOAD_DIRECTORY, t + '\\');
}
}
LRESULT DownloadPage::onClickedBrowseDir(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
string dir = SETTING(DOWNLOAD_DIRECTORY);
if(WinUtil::browseDirectory(dir))
{
// Adjust path string
if(dir.size() > 0 && dir[dir.size() - 1] != '\\')
dir += '\\';
SetDlgItemText(IDC_DOWNLOADDIR, dir.c_str());
}
return 0;
}
LRESULT DownloadPage::onClickedBrowseTempDir(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
string dir = SETTING(TEMP_DOWNLOAD_DIRECTORY);
if(WinUtil::browseDirectory(dir))
{
// Adjust path string
if(dir.size() > 0 && dir[dir.size() - 1] != '\\')
dir += '\\';
SetDlgItemText(IDC_TEMP_DOWNLOAD_DIRECTORY, dir.c_str());
}
return 0;
}
/**
* @file
* $Id: DownloadPage.cpp,v 1.7 2003/04/15 10:14:00 arnetheduck Exp $
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -