示例#1
0
void ResolutionDialog::applyClicked()
{
	if( m_newResolution.first != m_widget->get_width() || m_newResolution.second != m_widget->get_height() )
	{
		applyResolution( m_widget, m_newResolution.first, m_newResolution.second );
	}
}
void printpulses(void)
{
	//print it in a 'array' format
	//skip initial 'off' duration
	Serial.println("int IRsignal[] = {");
	for (uint8_t i = 0; i < currentpulse-1; i++)
	{
		Serial.print("\t"); // tab
		Serial.print(applyResolution(pulses[i][1]), DEC);
		Serial.print(", ");
		Serial.print(applyResolution(pulses[i+1][0]), DEC);
		Serial.print(",\r\n");
	}
	Serial.print("\t"); // tab
	Serial.print(applyResolution(pulses[currentpulse-1][1]), DEC);
	Serial.print(", 0};\r\n\r\n");

	Serial.print("\r\n");
}
void matchCode()
{
	Serial.println("matchCode");
	Serial.print("freeRam:");
	Serial.println(freeRam());
	int status[MAX_SIGNAL];
	for (int i = 0; i < MAX_SIGNAL; i++)
		status[i] = 0;

	for (uint8_t i = 0; i < currentpulse; i++)
	{
		int received_on = applyResolution(pulses[i][1]);
		int received_off;
		if (i < currentpulse - 1)
			received_off = applyResolution(pulses[i+1][0]);
		else
			received_off = 0;
		
		for (int j = 0; j < MAX_SIGNAL; j++)
		{
			int pos = status[j];
			int recorded_on = IRsignals[j][pos*2];
			int recorded_off = IRsignals[j][pos*2+1];
			//tracef("comparing aon:%d bon:%d aoff:%d boff:%d\r\n", received_on, recorded_on, received_off, recorded_off);
			if (received_on == recorded_on && received_off == recorded_off)
			{
				if (recorded_off == 0)
				{
					tracef("MATCH: %s\r\n", names[j]);
					if (j != TEMP_UP && j != TEMP_DOWN)
					{
						goToAndPressButton(j);
						delay(300);
						releaseButton();
						holdStartTime = -1;
					}
					else
					{
						if (holdStartTime == -1)
						{
							goToAndPressButton(j);
							holdStartTime = millis();
						}
						else
						{
							releaseButton();
							holdStartTime = -1;
						}							
					}
					return;
				}
				status[j]++;
				//tracef("i:%d j:%d status:%d\r\n", i, j, status[j]);
			}
			else
			{
				status[j] = 0;
			}
		}
	}
	Serial.println("no match");
}
示例#4
0
void ResolutionDialog::resetClicked()
{
	m_resolutions.get_entry()->set_text( resolutionToString(m_oldResolution.first, m_oldResolution.second) );
	applyResolution( m_widget, m_oldResolution.first, m_oldResolution.second );
}
void LLFloaterPreference::apply()
{
	LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
	if (sSkin != gSavedSettings.getString("SkinCurrent"))
	{
		LLNotificationsUtil::add("ChangeSkin");
		refreshSkin(this);
	}
	// Call apply() on all panels that derive from LLPanelPreference
	for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
		 iter != tabcontainer->getChildList()->end(); ++iter)
	{
		LLView* view = *iter;
		LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
		if (panel)
			panel->apply();
	}
	// hardware menu apply
	LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
	if (hardware_settings)
	{
		hardware_settings->apply();
	}
	
	LLFloaterVoiceDeviceSettings* voice_device_settings = LLFloaterReg::findTypedInstance<LLFloaterVoiceDeviceSettings>("pref_voicedevicesettings");
	if(voice_device_settings)
	{
		voice_device_settings->apply();
	}
	
	gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor

	LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_fov");
	fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
	fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
	
	std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
	childSetText("cache_location", cache_location);		
	
	LLViewerMedia::setCookiesEnabled(childGetValue("cookies_enabled"));
	
	if(hasChild("web_proxy_enabled") &&hasChild("web_proxy_editor") && hasChild("web_proxy_port"))
	{
		bool proxy_enable = childGetValue("web_proxy_enabled");
		std::string proxy_address = childGetValue("web_proxy_editor");
		int proxy_port = childGetValue("web_proxy_port");
		LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port);
	}
	
//	LLWString busy_response = utf8str_to_wstring(getChild<LLUICtrl>("busy_response")->getValue().asString());
//	LLWStringUtil::replaceTabsWithSpaces(busy_response, 4);

	gSavedSettings.setBOOL("PlainTextChatHistory", childGetValue("plain_text_chat_history").asBoolean());
	
	if(mGotPersonalInfo)
	{ 
//		gSavedSettings.setString("BusyModeResponse2", std::string(wstring_to_utf8str(busy_response)));
		bool new_im_via_email = childGetValue("send_im_to_email").asBoolean();
		bool new_hide_online = childGetValue("online_visibility").asBoolean();		
	
		if((new_im_via_email != mOriginalIMViaEmail)
			||(new_hide_online != mOriginalHideOnlineStatus))
		{
			// This hack is because we are representing several different 	 
			// possible strings with a single checkbox. Since most users 	 
			// can only select between 2 values, we represent it as a 	 
			// checkbox. This breaks down a little bit for liaisons, but 	 
			// works out in the end. 	 
			if(new_hide_online != mOriginalHideOnlineStatus) 	 
			{ 	 
				if(new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN;
				else mDirectoryVisibility = VISIBILITY_DEFAULT;
			 //Update showonline value, otherwise multiple applys won't work
				mOriginalHideOnlineStatus = new_hide_online;
			} 	 
			gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility);
		}
	}

	applyResolution();
}