Exemple #1
0
LRESULT QueuePage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	PropPage::translate(texts);
	PropPage::read(items);
	PropPage::readCheckBoxList(optionItems, GetDlgItem(IDC_OTHER_QUEUE_OPTIONS));

	CUpDownCtrl spin;
	spin.Attach(GetDlgItem(IDC_SEG_NUMBER_SPIN));
	spin.SetRange32(1, 200);  //[!]PPA
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SEARCH_SPIN));
	spin.SetRange32(2, 60);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_BEGIN_SPIN));
	spin.SetRange32(2, 100000);
	spin.Detach();

	ctrlMultiSource.Attach(GetDlgItem(IDC_MULTISOURCE_COMBO));
	ctrlMultiSource.AddString(CTSTRING(DISABLED));
	ctrlMultiSource.AddString(CTSTRING(AUTOMATIC));
	ctrlMultiSource.SetCurSel(SETTING(MULTI_CHUNK));
    
	::EnableWindow(GetDlgItem(IDC_DONTBEGIN), FALSE); //[+]PPA
	::EnableWindow(GetDlgItem(IDC_BEGIN_EDIT), FALSE); //[+]PPA
	
	// Do specialized reading here
	return TRUE;
}
Exemple #2
0
LRESULT QueuePage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	PropPage::translate((HWND)(*this), texts);
	PropPage::read(*this, items, 0, 0);
	PropPage::read(*this, items, optionItems, GetDlgItem(IDC_OTHER_QUEUE_OPTIONS));
	
	ctrlList.Attach(GetDlgItem(IDC_OTHER_QUEUE_OPTIONS)); // [+] IRainman
	
	CUpDownCtrl spin;
	spin.Attach(GetDlgItem(IDC_SEG_NUMBER_SPIN));
	spin.SetRange32(1, 200);  //[!]PPA
	spin.Detach();
	
	spin.Attach(GetDlgItem(IDC_AUTO_SEARCH_SPIN));
	spin.SetRange32(1, 60);
	spin.Detach();
	
	spin.Attach(GetDlgItem(IDC_BEGIN_SPIN));
	spin.SetRange32(2, 100000);
	spin.Detach();
	
	// Do specialized reading here
	
	// Add Combo: Download Action - if file exist
	m_downlaskClick.Attach(GetDlgItem(IDC_DOWNLOAD_ASK_COMBO));
	m_downlaskClick.AddString(CTSTRING(ON_DOWNLOAD_ASK));
	m_downlaskClick.AddString(CTSTRING(ON_DOWNLOAD_REPLACE));
	m_downlaskClick.AddString(CTSTRING(ON_DOWNLOAD_AUTORENAME));
	m_downlaskClick.AddString(CTSTRING(ON_DOWNLOAD_SKIP));
	m_downlaskClick.SetCurSel(0);         // Set default, if parameter not set in Settings
	
	switch (SETTING(ON_DOWNLOAD_SETTING))
	{
		case SettingsManager::ON_DOWNLOAD_ASK:
			//      CheckDlgButton(IDC_ON_DOWNLOAD_ASK, BST_CHECKED);
			m_downlaskClick.SetCurSel(0); // Add Combo
			break;
		case SettingsManager::ON_DOWNLOAD_REPLACE:
			//      CheckDlgButton(IDC_ON_DOWNLOAD_REPLACE, BST_CHECKED);
			m_downlaskClick.SetCurSel(1); // Add
			break;
		case SettingsManager::ON_DOWNLOAD_RENAME:
			//      CheckDlgButton(IDC_ON_DOWNLOAD_AUTORENAME, BST_CHECKED);
			m_downlaskClick.SetCurSel(2); // Add
			break;
		case SettingsManager::ON_DOWNLOAD_SKIP:
			//      CheckDlgButton(IDC_ON_DOWNLOAD_SKIP, BST_CHECKED);
			m_downlaskClick.SetCurSel(3); // Add
			break;
		default:                        // Add Combo
			m_downlaskClick.SetCurSel(0);
			break;
	}
	m_downlaskClick.Detach();             // Add Combo
	fixControls();
	return TRUE;
}
LRESULT DownloadPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	PropPage::translate((HWND)(*this), texts);
	PropPage::read((HWND)*this, items);
	
	CUpDownCtrl spin;
	spin.Attach(GetDlgItem(IDC_FILESPIN));
	spin.SetRange32(0, 100);
	spin.Detach();
	spin.Attach(GetDlgItem(IDC_SLOTSSPIN));
	spin.SetRange32(0, 100);
	spin.Detach();
	spin.Attach(GetDlgItem(IDC_SPEEDSPIN));
	spin.SetRange32(0, 10000);
	spin.Detach();
	spin.Attach(GetDlgItem(IDC_EXTRASLOTSSPIN));
	spin.SetRange32(0, 100);
	spin.Detach();
	// Do specialized reading here
	return TRUE;
}
Exemple #4
0
LRESULT QueuePage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	PropPage::translate((HWND)(*this), texts);
	PropPage::read((HWND)*this, items, 0, 0);
	PropPage::read((HWND)*this, items, optionItems, GetDlgItem(IDC_OTHER_QUEUE_OPTIONS));

	CUpDownCtrl spin;
	spin.Attach(GetDlgItem(IDC_SEG_NUMBER_SPIN));
	spin.SetRange32(2, 10);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_SEARCH_SPIN));
	spin.SetRange32(5, 60);
	spin.Detach();

	spin.Attach(GetDlgItem(IDC_BEGIN_SPIN));
	spin.SetRange32(2, 100000);
	spin.Detach();

	// Do specialized reading here
	return TRUE;
}
LRESULT FileListDetectorPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
	PropPage::translate((HWND)(*this), texts);
	PropPage::read((HWND)*this, items);

	CUpDownCtrl spin;
	spin.Attach(GetDlgItem(IDC_SDL_SPEED_SPIN));
	spin.SetRange32(1, 10*1024); //max 10 kB/s
	spin.Detach(); 
	spin.Attach(GetDlgItem(IDC_SDL_TIME_SPIN));
	spin.SetRange32(15, 3600); //an hour would be fine ;]
	spin.Detach();
	spin.Attach(GetDlgItem(IDC_MINIMUM_FILELIST_SIZE_SPIN));
	spin.SetRange32(0, 1024*1024*1024);
	spin.Detach();
	spin.Attach(GetDlgItem(IDC_MAXIMUM_FILELIST_SIZE_SPIN));
	spin.SetRange32(0, 1024*1024*1024);
	spin.Detach();
	spin.Attach(GetDlgItem(IDC_PERCENT_FAKE_SHARE_TOLERATED_SPIN));
	spin.SetRange32(0, 100);
	spin.Detach();
	CRect rc;

	ctrlProfiles.Attach(GetDlgItem(IDC_FILELIST_DETECTOR_LIST));
	ctrlProfiles.GetClientRect(rc);

	ctrlProfiles.InsertColumn(0, CTSTRING(CLIENTID),				LVCFMT_LEFT, (rc.Width() / 7)*2, 0);
	ctrlProfiles.InsertColumn(1, CTSTRING(CHEATING_DESCRIPTION),	LVCFMT_LEFT, (rc.Width() / 7)*3, 1);
	ctrlProfiles.InsertColumn(2, CTSTRING(ACTION),					LVCFMT_LEFT, (rc.Width() / 7)*2, 3);
	ctrlProfiles.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);

	/*FileListDetectorProfile::List& lst = ClientProfileManager::getInstance()->getFileListDetectors();
	for(FileListDetectorProfile::List::const_iterator i = lst.begin(); i != lst.end(); ++i) {
		const FileListDetectorProfile& fd = *i;	
		addEntry(fd, ctrlProfiles.GetItemCount());
	}*/
	fixControls();
	return TRUE;
}
LRESULT CFavTabOp::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
	::CheckDlgButton(*this, IDC_CHECK_ON_CONNECT, hub->getCheckOnConnect()	? BST_CHECKED : BST_UNCHECKED);
	::CheckDlgButton(*this, IDC_CHECK_CLIENTS, hub->getCheckClients()		? BST_CHECKED : BST_UNCHECKED);
	::CheckDlgButton(*this, IDC_CHECK_FILELISTS, hub->getCheckFilelists()	? BST_CHECKED : BST_UNCHECKED);
	::CheckDlgButton(*this, IDC_CHECK_MYINFO, hub->getCheckMyInfo()			? BST_CHECKED : BST_UNCHECKED);
	SetDlgItemText(IDC_CHECK_PROTECTED_USER, Text::toT(hub->getProtectedUsers()).c_str());
	SetDlgItemText(IDC_FAV_MIN_USERS_LIMIT, Util::toStringW(hub->getUsersLimit()).c_str());

	CUpDownCtrl spin;
	spin.Attach(GetDlgItem(IDC_FAV_MIN_USERS_LIMIT_SPIN));
	spin.SetRange32(0, 1024*1024);
	spin.Detach();
	return TRUE;
}
LRESULT CCustomTab::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(hub->getSearchInterval()).c_str());
	CUpDownCtrl updown;
	updown.Attach(GetDlgItem(IDC_FAV_SEARCH_INTERVAL_SPIN));
	updown.SetRange32(10, 9999);
	updown.Detach();

	CheckDlgButton(IDC_STEALTH, hub->getStealth()					? BST_CHECKED : BST_UNCHECKED);
	CheckDlgButton(IDC_HIDE_SHARE, hub->getHideShare()				? BST_CHECKED : BST_UNCHECKED);
	CheckDlgButton(IDC_USE_FILTER_FAV, hub->getUseFilter()			? BST_CHECKED : BST_UNCHECKED);
	CheckDlgButton(IDC_USE_HIGHLIGHT_FAV, hub->getUseHL()			? BST_CHECKED : BST_UNCHECKED);
	CheckDlgButton(IDC_CHECK_AUTOSEARCH, hub->getUseAutosearch()	? BST_CHECKED : BST_UNCHECKED);

	SetDlgItemText(IDC_CHAT_EXTRA_INFO, Text::toT(hub->getChatExtraInfo()).c_str());
	return 0;
}
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
	// Translate dialog
	SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
	SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
	SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
	SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
	SetDlgItemText(IDC_FH_NAME, CTSTRING(HUB_NAME));
	SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
	SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
	SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
	SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
	SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
	SetDlgItemText(IDC_FH_CONN, CTSTRING(FAVORITE_HUB_CONNECTION));
	SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
	SetDlgItemText(IDC_FAV_NO_PM, CTSTRING(FAV_NO_PM));
	SetDlgItemText(IDC_SHOW_JOIN, CTSTRING(FAV_SHOW_JOIN));
	SetDlgItemText(IDC_HIDE_SHARE, CTSTRING(HIDE_SHARE));
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
	SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));
	SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
	SetDlgItemText(IDC_CHAT_NOTIFY, CTSTRING(CHAT_NOTIFY));
	SetDlgItemText(IDC_FAILOVER, CTSTRING(ACCEPT_FAILOVERS_FAV));
	SetDlgItemText(IDC_AWAY_MSG_LBL, CTSTRING(CUSTOM_AWAY_MESSAGE));

	SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
	SetDlgItemText(IDC_HUBSETTINGS, CTSTRING(GLOBAL_SETTING_OVERRIDES));
	SetDlgItemText(IDC_SEARCH_INTERVAL_DEFAULT, CTSTRING(USE_DEFAULT));

	SetDlgItemText(IDC_FAV_SHAREPROFILE_CAPTION, CTSTRING(SHARE_PROFILE));
	SetDlgItemText(IDC_EDIT_PROFILES, CTSTRING(EDIT_PROFILES));
	SetDlgItemText(IDC_PROFILES_NOTE, CTSTRING(PROFILES_NOTE));

	// Fill in values
	SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
	SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
	SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServerStr()).c_str());
	SetDlgItemText(IDC_NICK, Text::toT(entry->get(HubSettings::Nick)).c_str());
	SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
	SetDlgItemText(IDC_USERDESC, Text::toT(entry->get(HubSettings::Description)).c_str());
	SetDlgItemText(IDC_EMAIL, Text::toT(entry->get(HubSettings::Email)).c_str());

	SetDlgItemText(IDC_AWAY_MSG, Text::toT(entry->get(HubSettings::AwayMsg)).c_str());

	CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
	CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);

	CheckDlgButton(IDC_SHOW_JOIN, toInt(entry->get(HubSettings::ShowJoins)));
	CheckDlgButton(IDC_SHOW_JOIN_FAV, toInt(entry->get(HubSettings::FavShowJoins)));
	CheckDlgButton(IDC_LOGMAINCHAT, toInt(entry->get(HubSettings::LogMainChat)));
	CheckDlgButton(IDC_CHAT_NOTIFY, toInt(entry->get(HubSettings::ChatNotify)));
	CheckDlgButton(IDC_FAILOVER, toInt(entry->get(HubSettings::AcceptFailovers)));

	CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);

	auto searchInterval = entry->get(HubSettings::SearchInterval);
	CheckDlgButton(IDC_SEARCH_INTERVAL_DEFAULT, searchInterval == HubSettings::getMinInt() ? BST_CHECKED : BST_UNCHECKED);
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(searchInterval).c_str());

	bool isAdcHub = entry->isAdcHub();

	CComboBox combo;
	combo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
	combo.AddString(_T("---"));
	combo.SetCurSel(0);

	const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
	for(const auto& name: favHubGroups | map_keys) {
		int pos = combo.AddString(Text::toT(name).c_str());
		
		if(name == entry->getGroup())
			combo.SetCurSel(pos);
	}

	combo.Detach();

	// TODO: add more encoding into wxWidgets version, this is enough now
	// FIXME: following names are Windows only!
	combo.Attach(GetDlgItem(IDC_ENCODING));
	combo.AddString(_T("System default"));
	combo.AddString(_T("English_United Kingdom.1252"));
	combo.AddString(_T("Czech_Czech Republic.1250"));
	combo.AddString(_T("Russian_Russia.1251"));
	combo.AddString(Text::toT(Text::utf8).c_str());

	ctrlProfile.Attach(GetDlgItem(IDC_FAV_SHAREPROFILE));
	appendProfiles();
	hideShare = entry->getShareProfile() && entry->getShareProfile()->getToken() == SP_HIDDEN;
	CheckDlgButton(IDC_HIDE_SHARE, hideShare ? BST_CHECKED : BST_UNCHECKED);


	if(isAdcHub) {
		combo.SetCurSel(4); // select UTF-8 for ADC hubs
		combo.EnableWindow(false);
		if (hideShare)
			ctrlProfile.EnableWindow(false);
	} else {
		ctrlProfile.EnableWindow(false);
		if(entry->getEncoding().empty()) {
			combo.SetCurSel(0);
		} else {
			combo.SetWindowText(Text::toT(entry->getEncoding()).c_str());
		}
	}

	combo.Detach();

	// connection modes
	auto appendCombo = [](CComboBox& combo, int curMode) {
		combo.InsertString(0, CTSTRING(DEFAULT));
		combo.InsertString(1, CTSTRING(DISABLED));
		combo.InsertString(2, CTSTRING(ACTIVE_MODE));
		combo.InsertString(3, CTSTRING(PASSIVE_MODE));

		if(curMode == HubSettings::getMinInt())
			combo.SetCurSel(0);
		else if(curMode == SettingsManager::INCOMING_DISABLED)
			combo.SetCurSel(1);
		else if(curMode == SettingsManager::INCOMING_ACTIVE)
			combo.SetCurSel(2);
		else if(curMode == SettingsManager::INCOMING_PASSIVE)
			combo.SetCurSel(3);
	};

	modeCombo4.Attach(GetDlgItem(IDC_MODE4));
	modeCombo6.Attach(GetDlgItem(IDC_MODE6));

	appendCombo(modeCombo4, entry->get(HubSettings::Connection));
	appendCombo(modeCombo6, entry->get(HubSettings::Connection6));

	//external ips
	SetDlgItemText(IDC_SERVER4, Text::toT(entry->get(HubSettings::UserIp)).c_str());
	SetDlgItemText(IDC_SERVER6, Text::toT(entry->get(HubSettings::UserIp6)).c_str());

	fixControls();

	CEdit tmp;
	tmp.Attach(GetDlgItem(IDC_HUBNAME));
	tmp.SetFocus();
	tmp.SetSel(0,-1);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_NICK));
	tmp.LimitText(35);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_USERDESC));
	tmp.LimitText(50);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_EMAIL));
	tmp.LimitText(50);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_HUBPASS));
	tmp.SetPasswordChar('*');
	tmp.Detach();
	
	CUpDownCtrl updown;
	updown.Attach(GetDlgItem(IDC_FAV_SEARCH_INTERVAL_SPIN));
	updown.SetRange32(5, 9999);
	updown.Detach();

	CenterWindow(GetParent());
	loaded = true;
	return FALSE;
}
// Initialize dialog
LRESULT ADLSProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
	// Translate the texts
	SetWindowText(CTSTRING(ADLS_PROPERTIES));
	SetDlgItemText(IDC_ADLSP_SEARCH,		CTSTRING(ADLS_SEARCH_STRING));
	SetDlgItemText(IDC_ADLSP_TYPE,			CTSTRING(ADLS_TYPE));
	SetDlgItemText(IDC_ADLSP_SIZE_MIN,		CTSTRING(ADLS_SIZE_MIN));
	SetDlgItemText(IDC_ADLSP_SIZE_MAX,		CTSTRING(ADLS_SIZE_MAX));
	SetDlgItemText(IDC_ADLSP_UNITS,			CTSTRING(ADLS_UNITS));
	SetDlgItemText(IDC_ADLSP_DESTINATION,	CTSTRING(ADLS_DESTINATION));
	SetDlgItemText(IDC_IS_ACTIVE,			CTSTRING(ADLS_ENABLED));
	SetDlgItemText(IDC_AUTOQUEUE,			CTSTRING(ADLS_DOWNLOAD));
	SetDlgItemText(IDC_IS_FORBIDDEN,		CTSTRING(FORBIDDEN));
	SetDlgItemText(IDC_ADLSEARCH_COMMENT,	CTSTRING(COMMENT));

	CUpDownCtrl spin;
	spin.Attach(GetDlgItem(IDC_ADLS_POINTS_SPIN));
	spin.SetRange32(0, 1024*1024);
	spin.Detach();

	cRaw.attach(GetDlgItem(IDC_ADLSEARCH_RAW_ACTION), search->adlsRaw);

	// Initialize combo boxes
	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, 
		(LPARAM)search->SourceTypeToDisplayString(ADLSearch::OnlyFile).c_str());
	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, 
		(LPARAM)search->SourceTypeToDisplayString(ADLSearch::OnlyDirectory).c_str());
	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, 
		(LPARAM)search->SourceTypeToDisplayString(ADLSearch::FullPath).c_str());
	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, 
		(LPARAM)search->SourceTypeToDisplayString(ADLSearch::TTHFile).c_str());

	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, 
		(LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeBytes).c_str());
	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, 
		(LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeKiloBytes).c_str());
	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, 
		(LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeMegaBytes).c_str());
	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, 
		(LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeGigaBytes).c_str());

	// Load search data
	char* buf = new char[32];
	SetDlgItemText(IDC_SEARCH_STRING,		Text::toT(search->searchString).c_str());
	SetDlgItemText(IDC_DEST_DIR,			Text::toT(search->destDir).c_str());
	SetDlgItemText(IDC_MIN_FILE_SIZE,		Text::toT(search->minFileSize > 0 ? _i64toa(search->minFileSize, buf, 10) : "").c_str());
	SetDlgItemText(IDC_MAX_FILE_SIZE,		Text::toT(search->maxFileSize > 0 ? _i64toa(search->maxFileSize, buf, 10) : "").c_str());
	SetDlgItemText(IDC_ADLS_KICK_STRING,	Text::toT(search->kickString).c_str());
	SetDlgItemInt(IDC_ADLS_POINTS,			(search->adlsPoints > 0 ? search->adlsPoints : 0));
	SetDlgItemText(IDC_ADLS_COMMENT,		Text::toT(search->adlsComment).c_str());

	::SendMessage(GetDlgItem(IDC_IS_ACTIVE),			BM_SETCHECK,	search->isActive ? 1 : 0, 0L);
	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE),			CB_SETCURSEL,	search->sourceType, 0L);
	::SendMessage(GetDlgItem(IDC_SIZE_TYPE),			CB_SETCURSEL,	search->typeFileSize, 0L);
	::SendMessage(GetDlgItem(IDC_AUTOQUEUE),			BM_SETCHECK,	search->isAutoQueue ? 1 : 0, 0L);
	::SendMessage(GetDlgItem(IDC_IS_FORBIDDEN),			BM_SETCHECK,	search->isForbidden ? 1 : 0, 0L);
//	::SendMessage(GetDlgItem(IDC_IS_REGEXP),			BM_SETCHECK,	search->isRegExp ? 1 : 0, 0L);
	::SendMessage(GetDlgItem(IDC_OVER_RIDE_POINTS),		BM_SETCHECK,	search->overRidePoints ? 1 : 0, 0L);
	::SendMessage(GetDlgItem(IDC_IS_CASE_SENSITIVE),	BM_SETCHECK,	search->isCaseSensitive ? 1 : 0, 0L);

	if (search->fromFavs)
		::SendMessage(GetDlgItem(IDC_OVERRIDE_FAV),		BM_SETCHECK, 1, 0L);
	else
		::SendMessage(GetDlgItem(IDC_OVERRIDE_CUSTOM),	BM_SETCHECK, 1, 0L);


	delete[] buf;
	setControlState();
	setControlOverride();

	// Center dialog
	CenterWindow(GetParent());

	return FALSE;
}
LRESULT SpeedPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
	PropPage::translate((HWND)(*this), texts);
	bool found=false;

	ctrlDownload.Attach(GetDlgItem(IDC_DL_SPEED));
	for(StringIter i = SettingsManager::connectionSpeeds.begin(); i != SettingsManager::connectionSpeeds.end(); ++i) {
		if (Util::toDouble(SETTING(DOWNLOAD_SPEED)) < Util::toDouble(*i) && !found) {
			ctrlDownload.AddString(Text::toT(SETTING(DOWNLOAD_SPEED)).c_str());
			found=true;
		} else if (SETTING(DOWNLOAD_SPEED) == (*i)) {
			found=true;
		}
		ctrlDownload.AddString(Text::toT(*i).c_str());
	}
	ctrlDownload.SetCurSel(ctrlDownload.FindString(0, Text::toT(SETTING(DOWNLOAD_SPEED)).c_str()));

	found=false;
	ctrlUpload.Attach(GetDlgItem(IDC_CONNECTION));
	for(StringIter i = SettingsManager::connectionSpeeds.begin(); i != SettingsManager::connectionSpeeds.end(); ++i) {
		if (Util::toDouble(SETTING(UPLOAD_SPEED)) < Util::toDouble(*i) && !found) {
			ctrlUpload.AddString(Text::toT(SETTING(UPLOAD_SPEED)).c_str());
			found=true;
		} else if (SETTING(UPLOAD_SPEED) == (*i)) {
			found=true;
		}
		ctrlUpload.AddString(Text::toT(*i).c_str());
	}
	ctrlUpload.SetCurSel(ctrlUpload.FindString(0, Text::toT(SETTING(UPLOAD_SPEED)).c_str()));


	PropPage::read((HWND)*this, items);

	CUpDownCtrl updown;
	updown.Attach(GetDlgItem(IDC_SLOTSPIN));
	updown.SetRange(1, UD_MAXVAL);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_MIN_UPLOAD_SPIN));
	updown.SetRange32(0, UD_MAXVAL);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_EXTRA_SLOTS_SPIN));
	updown.SetRange(3, 100);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_SMALL_FILE_SIZE_SPIN));
	updown.SetRange32(64, 30000);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_EXTRASPIN));
	updown.SetRange(0, 10);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_AUTO_SLOTS_SPIN));
	updown.SetRange(0, 100);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_PARTIAL_SLOTS_SPIN));
	updown.SetRange(0, 10);
	updown.Detach();

	updown.Attach(GetDlgItem(IDC_SLOTSSPIN));
	updown.SetRange32(0, 100);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_SPEEDSPIN));
	updown.SetRange32(0, 10000);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_EXTRASLOTSSPIN));
	updown.SetRange32(0, 100);
	updown.Detach();

	updown.Attach(GetDlgItem(IDC_MCN_SPIN));
	updown.SetRange32(1, 100);
	updown.Detach();
	updown.Attach(GetDlgItem(IDC_MCN_SPIN2));
	updown.SetRange32(1, 100);
	updown.Detach();

	fixControls();

	//update auto detection values
	if (SETTING(DL_AUTODETECT)) {
		SetDlgItemText(IDC_DOWNLOADS, Util::toStringW(AirUtil::getSlots(true)).c_str());
		SetDlgItemText(IDC_MAXSPEED, Util::toStringW(AirUtil::getSpeedLimit(true)).c_str());
	}
	if (SETTING(UL_AUTODETECT)) {
		SetDlgItemText(IDC_SLOTS, Util::toStringW(AirUtil::getSlots(false)).c_str());
		SetDlgItemText(IDC_MIN_UPLOAD_SPEED, Util::toStringW(AirUtil::getSpeedLimit(false)).c_str());
		SetDlgItemText(IDC_AUTO_SLOTS, Util::toStringW(AirUtil::getMaxAutoOpened()).c_str());
	}
	if (SETTING(MCN_AUTODETECT)) {
		SetDlgItemText(IDC_MCNDLSLOTS, Util::toStringW(AirUtil::getSlotsPerUser(true)).c_str());
		SetDlgItemText(IDC_MCNULSLOTS, Util::toStringW(AirUtil::getSlotsPerUser(false)).c_str());
	}

	return TRUE;
}
Exemple #11
0
LRESULT FavHubOptionsPage::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{

	SetDlgItemText(IDC_SHOW_JOIN, CTSTRING(FAV_SHOW_JOIN));
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL_SEC));
	SetDlgItemText(IDC_SEARCH_INTERVAL_DEFAULT, CTSTRING(USE_DEFAULT));
	SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
	SetDlgItemText(IDC_CHAT_NOTIFY, CTSTRING(CHAT_NOTIFY));
	SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
	SetDlgItemText(IDC_HUBSETTINGS, CTSTRING(GLOBAL_SETTING_OVERRIDES));

	SetDlgItemText(IDC_AWAY_MSG_LBL, CTSTRING(CUSTOM_AWAY_MESSAGE));
	SetDlgItemText(IDC_FH_CONN, CTSTRING(CONNECTION));


	SetDlgItemText(IDC_AWAY_MSG, Text::toT(entry->get(HubSettings::AwayMsg)).c_str());
	
	CheckDlgButton(IDC_SHOW_JOIN, toInt(entry->get(HubSettings::ShowJoins)));
	CheckDlgButton(IDC_SHOW_JOIN_FAV, toInt(entry->get(HubSettings::FavShowJoins)));
	CheckDlgButton(IDC_LOGMAINCHAT, toInt(entry->get(HubSettings::LogMainChat)));
	CheckDlgButton(IDC_CHAT_NOTIFY, toInt(entry->get(HubSettings::ChatNotify)));

	auto searchInterval = entry->get(HubSettings::SearchInterval);
	CheckDlgButton(IDC_SEARCH_INTERVAL_DEFAULT, searchInterval == HUB_SETTING_DEFAULT_INT ? BST_CHECKED : BST_UNCHECKED);
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(searchInterval).c_str());
	
	// connection modes
	auto appendCombo = [](CComboBox& combo, int curMode) {
	combo.InsertString(0, CTSTRING(DEFAULT));
	combo.InsertString(1, CTSTRING(DISABLED));
	combo.InsertString(2, CTSTRING(ACTIVE_MODE));
	combo.InsertString(3, CTSTRING(PASSIVE_MODE));

	if (curMode == HUB_SETTING_DEFAULT_INT)
	combo.SetCurSel(0);
	else if (curMode == SettingsManager::INCOMING_DISABLED)
	combo.SetCurSel(1);
	else if (curMode == SettingsManager::INCOMING_ACTIVE)
	combo.SetCurSel(2);
	else if (curMode == SettingsManager::INCOMING_PASSIVE)
	combo.SetCurSel(3);
	};

	modeCombo4.Attach(GetDlgItem(IDC_MODE4));
	modeCombo6.Attach(GetDlgItem(IDC_MODE6));

	appendCombo(modeCombo4, entry->get(HubSettings::Connection));
	appendCombo(modeCombo6, entry->get(HubSettings::Connection6));

	//external ips
	SetDlgItemText(IDC_SERVER4, Text::toT(entry->get(HubSettings::UserIp)).c_str());
	SetDlgItemText(IDC_SERVER6, Text::toT(entry->get(HubSettings::UserIp6)).c_str());
	
	fixControls();

	CUpDownCtrl updown;
	updown.Attach(GetDlgItem(IDC_FAV_SEARCH_INTERVAL_SPIN));
	updown.SetRange32(5, 9999);
	updown.Detach();
	
	return FALSE;
}
Exemple #12
0
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
	// Translate dialog
	SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
	SetDlgItemText(IDOK, CTSTRING(OK));
	SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
	SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
	SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
	SetDlgItemText(IDC_FH_NAME, CTSTRING(HUB_NAME));
	SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
	SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
	SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
	SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
	SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
	SetDlgItemText(IDC_DEFAULT, CTSTRING(DEFAULT));
	SetDlgItemText(IDC_ACTIVE, CTSTRING(SETTINGS_DIRECT));
	SetDlgItemText(IDC_PASSIVE, CTSTRING(SETTINGS_FIREWALL_PASSIVE));
	SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
	SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));

	// Fill in values
	SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
	SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
	SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServer()).c_str());
	SetDlgItemText(IDC_HUBNICK, Text::toT(entry->getNick(false)).c_str());
	SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
	SetDlgItemText(IDC_HUBUSERDESCR, Text::toT(entry->getUserDescription()).c_str());
	CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
	SetDlgItemText(IDC_RAW_ONE, Text::toT(entry->getRawOne()).c_str());
	SetDlgItemText(IDC_RAW_TWO, Text::toT(entry->getRawTwo()).c_str());
	SetDlgItemText(IDC_RAW_THREE, Text::toT(entry->getRawThree()).c_str());
	SetDlgItemText(IDC_RAW_FOUR, Text::toT(entry->getRawFour()).c_str());
	SetDlgItemText(IDC_RAW_FIVE, Text::toT(entry->getRawFive()).c_str());
	SetDlgItemText(IDC_SERVER, Text::toT(entry->getIP()).c_str());
	SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(entry->getSearchInterval()).c_str());

	CComboBox combo;
	combo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
	combo.AddString(_T("---"));
	combo.SetCurSel(0);

	const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
	for(FavHubGroups::const_iterator i = favHubGroups.begin(); i != favHubGroups.end(); ++i) {
		const string& name = i->first;
		int pos = combo.AddString(Text::toT(name).c_str());
		
		if(name == entry->getGroup())
			combo.SetCurSel(pos);
	}

	combo.Detach();

	// TODO: add more encoding into wxWidgets version, this is enough now
	// FIXME: following names are Windows only!
	combo.Attach(GetDlgItem(IDC_ENCODING));
	combo.AddString(_T("System default"));
	combo.AddString(_T("English_United Kingdom.1252"));
	combo.AddString(_T("Czech_Czech Republic.1250"));
	combo.AddString(_T("Russian_Russia.1251"));
	combo.AddString(Text::toT(Text::utf8).c_str());

	if(strnicmp("adc://", entry->getServer().c_str(), 6) == 0 || strnicmp("adcs://", entry->getServer().c_str(), 7) == 0)
	{
		combo.SetCurSel(4); // select UTF-8 for ADC hubs
		combo.EnableWindow(false);
	}
	else
	{
		if(entry->getEncoding().empty())
			combo.SetCurSel(0);
		else
			combo.SetWindowText(Text::toT(entry->getEncoding()).c_str());
	}

	combo.Detach();

	if(entry->getMode() == 0)
		CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_DEFAULT);
	else if(entry->getMode() == 1)
		CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_ACTIVE);
	else if(entry->getMode() == 2)
		CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_PASSIVE);

	CEdit tmp;
	tmp.Attach(GetDlgItem(IDC_HUBNAME));
	tmp.SetFocus();
	tmp.SetSel(0,-1);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_HUBNICK));
	tmp.LimitText(35);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_HUBUSERDESCR));
	tmp.LimitText(50);
	tmp.Detach();
	tmp.Attach(GetDlgItem(IDC_HUBPASS));
	tmp.SetPasswordChar('*');
	tmp.Detach();
	
	CUpDownCtrl updown;
	updown.Attach(GetDlgItem(IDC_FAV_SEARCH_INTERVAL_SPIN));
	updown.SetRange32(10, 9999);
	updown.Detach();
	
	CenterWindow(GetParent());
	return FALSE;
}