Пример #1
0
Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    QHBoxLayout *mainLayout = new QHBoxLayout();
    _mapView = new QMMapView(QMMapView::RoadMap,
                             QMCoordinate(55.8495931,4.3640841),
                             15);//15 = niveau du zoom
    _controls = new QWidget();

    _addr = new QTextEdit();
    _button = new QPushButton();

    buildControls();
    mainLayout->addWidget(_mapView, 1);
    mainLayout->addWidget(_controls, 1);
    mainLayout->addWidget(_addr, 1);
    mainLayout->addWidget(_button, 1);

    setLayout(mainLayout);


    resize(1200, 600);
    connect(_mapView, SIGNAL(mapLoaded()), this, SLOT(onMapLoaded()));
    connect(_mapView, SIGNAL(regionChanged(QMCoordinateRegion)),
            this, SLOT(onRegionChanged(QMCoordinateRegion)));
    connect(_mapView, SIGNAL(mapBecameIdle()), this, SLOT(onMapBecameIdle()));
    connect(_button, SIGNAL(clicked()),this,SLOT(newPos()));
}
BOOL wlfPanel_AdvSettings::postBuild()
{
	setVisible(true);
	if (LLUICtrl* ctrl = findChild<LLUICtrl>("expand"))
		ctrl->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onClickExpandBtn, this));

	if (mExpanded)
	{
		// Windlight
		getChild<LLCheckBoxCtrl>("use_estate_wl")->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onUseRegionSettings, this, _2));

		auto mPostProcessPresetCombo = getChild<LLComboBox>("PostProcessPresetsCombo");
		mPostProcessPresetCombo->setCommitCallback(boost::bind(&LLPostProcess::setSelectedEffect, LLPostProcess::getInstance(), boost::bind(&LLSD::asStringRef, _2)));

		mWaterPresetCombo = getChild<LLComboBox>("WLWaterPresetsCombo");
		mWaterPresetCombo->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeWWPresetName, this, _2));

		mSkyPresetCombo = getChild<LLComboBox>("WLSkyPresetsCombo");
		mSkyPresetCombo->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeWLPresetName, this, _2));

		// mDayCyclePresetCombo = getChild<LLComboBox>("DCPresetsCombo");
		// mDayCyclePresetCombo->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeDCPresetName, this, _2));

		void populatePostProcessList(LLComboBox* comboBox);
		mConnections.push_front(new boost::signals2::scoped_connection(LLPostProcess::instance().setSelectedEffectChangeCallback(boost::bind(populatePostProcessList, mPostProcessPresetCombo))));
		mConnections.push_front(new boost::signals2::scoped_connection(LLEnvManagerNew::instance().setPreferencesChangeCallback(boost::bind(&wlfPanel_AdvSettings::refreshLists, this))));
		mConnections.push_front(new boost::signals2::scoped_connection(LLWaterParamManager::getInstance()->setPresetListChangeCallback(boost::bind(&wlfPanel_AdvSettings::populateWaterPresetsList, this))));
		mConnections.push_front(new boost::signals2::scoped_connection(LLWLParamManager::getInstance()->setPresetListChangeCallback(boost::bind(&wlfPanel_AdvSettings::populateSkyPresetsList, this))));
		// LLDayCycleManager::instance().setModifyCallback(boost::bind(&wlfPanel_AdvSettings::populateDayCyclePresetsList, this));

		populatePostProcessList(mPostProcessPresetCombo);
		populateWaterPresetsList();
		populateSkyPresetsList();
		//populateDayCyclePresetsList();

		// next/prev buttons
		getChild<LLUICtrl>("PPnext")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mPostProcessPresetCombo, true));
		getChild<LLUICtrl>("PPprev")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mPostProcessPresetCombo, false));
		getChild<LLUICtrl>("WWnext")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mWaterPresetCombo, true));
		getChild<LLUICtrl>("WWprev")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mWaterPresetCombo, false));
		getChild<LLUICtrl>("WLnext")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mSkyPresetCombo, true));
		getChild<LLUICtrl>("WLprev")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mSkyPresetCombo, false));

		getChild<LLUICtrl>("PostProcessButton")->setCommitCallback(boost::bind(LLFloaterPostProcess::toggleInstance, LLSD()));
		getChild<LLUICtrl>("EnvAdvancedSkyButton")->setCommitCallback(boost::bind(LLFloaterWindLight::show));
		getChild<LLUICtrl>("EnvAdvancedWaterButton")->setCommitCallback(boost::bind(LLFloaterWater::show));

		mTimeSlider = getChild<LLSliderCtrl>("EnvTimeSlider");
		mTimeSlider->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeDayTime, this, _2));
		updateTimeSlider();
		updateRlvVisibility();

		// Camera Presets
		const U32 preset(gSavedSettings.getU32("CameraPreset"));
		if (preset == CAMERA_PRESET_REAR_VIEW)
			getChildView("Rear")->setValue(true);
		else if (preset == CAMERA_PRESET_FRONT_VIEW)
			getChildView("Front")->setValue(true);
		else if (preset == CAMERA_PRESET_GROUP_VIEW)
			getChildView("Group")->setValue(true);

		// Hover height
		mHoverHeight = getChild<LLSliderCtrl>("HoverHeightSlider");
		mHoverHeight->setMinValue(MIN_HOVER_Z);
		mHoverHeight->setMaxValue(MAX_HOVER_Z);
		mHoverHeight->setSliderMouseUpCallback(boost::bind(onHoverSliderFinalCommit, _2));
		mHoverHeight->setSliderEditorCommitCallback(boost::bind(onHoverSliderFinalCommit, _2));
		mHoverHeight->setCommitCallback(boost::bind(onHoverSliderMoved, _2));

		// Initialize slider from pref setting.
		syncFromPreferenceSetting(mHoverHeight);
		// Update slider on future pref changes.
		if (LLControlVariable* control = gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ"))
		{
			control->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, mHoverHeight));
		}
		else
		{
			LL_WARNS() << "Control not found for AvatarHoverOffsetZ" << LL_ENDL;
		}

		updateEditHoverEnabled();

		if (!mRegionChangedSlot.connected())
		{
			mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&wlfPanel_AdvSettings::onRegionChanged, this));
		}
		// Set up based on initial region.
		onRegionChanged();
	}
	else
	{
		mHoverHeight = nullptr;
	}
	return TRUE;
}