ControlWidget::ControlWidget(const char* name, char channel, int unit, EControlWidgetStyle style, Qt::Orientation orientation, int maximum, X10Widget* parent) :
    QGraphicsWidget(parent),
    m_parent(parent),
    m_unit(channel, unit, -1),
    m_name(name),
    m_style(style),
    m_orientation(orientation),
    m_maximum(maximum),
    m_configSwitchOffPeriodMn(1),
    m_configPreferredLighting(maximum),
    m_layout(0),
    m_slider(0),
    m_pushButtonOnOff(0),
    m_pushButtonDim(0),
    m_pushButtonBright(0),
    m_serviceUnit(0),
    m_timerSwitchOff(),
    m_timerSuspendUpdate(),
    m_lastValueUpdateRecv(-1)
{
    redraw();

    m_timerSwitchOff.setSingleShot(true);
    connect(&m_timerSwitchOff, SIGNAL(timeout()), this, SLOT(on_timerSwitchOff()));

    m_timerSuspendUpdate.setSingleShot(true);
    connect(&m_timerSuspendUpdate, SIGNAL(timeout()), this, SLOT(on_timerEndSuspendUpdate()));

    ConnectSource();
}
void ControlWidget::setUnit(Channel channel, Unit unit)
{
    if (channel != m_unit.channel || unit != m_unit.unit)
    {
        DisconnectSource();
        m_unit.channel  = channel;
        m_unit.unit     = unit;
        ConnectSource();
    }
}
//dedek
BOOL CDataSourcesManager::GetPluginOutput(public_source_id_t source, LPCTSTR ap_name, MSXML2::IXMLDOMDocument ** xml_dom)
{
	CString ap_name_CS = (CString) ap_name;
	int src_index = FindSourceByPublicID(source);
	if (! isSourceConnected(src_index)) 
	{
		if (! ConnectSource(src_index)) return FALSE;
	}


	COutputBuffer * OB = SourcesTab[src_index]->Buffer;

	// vystup neni v bufferu - nacte se ze zasuvky, ulozi se do bufferu a vrati se
	if(!OB->isAPBuffered(ap_name_CS))		// vystup jeste neni v bufferu
	{
		CallPerformProc(src_index, ap_name);				
	}
	
	OB->getBuffer(ap_name_CS, xml_dom);

	return (* xml_dom != NULL) && ((* xml_dom)->documentElement != NULL);
}