//---------------------------------------------------------------------------------------
tNdp2kTableDataSources::tNdp2kTableDataSources(
        tQMutex& apiThreadLock,
        tDigitalDataSourceSettings& sourceSettings,
        const char* pName,
        tTableID tableID,
        tTableFormat format,
        const tDataType* pTypes,
        unsigned numTypes )
    : tNDP2kTableSettings(
          apiThreadLock,
          *tGlobal<tISettingsWriterFactory>::Instance(),
          QString("DataSources.") + pName,
          tableID,
          format )
    , m_pSourceSettings( &sourceSettings )
    , m_DefaultFormat( format )
    , m_DefaultFormatRows( numTypes )
    , m_pDefaultFormatTypes( pTypes )
    , m_ExtendedDelay( false )
    , m_ShareChanges( false )
    , m_UpdateGlobalSettings( false )
    , m_SelectionInProgress( false )
    , m_Lock( "tNdp2kTableDataSources" )
{
    Assert( m_DefaultFormatRows <= m_cMaxRows );

    // initialise source selection table
    int version = LoadSettings( Settings() );
    if (version >= 0)
    {
        m_UpdateGlobalSettings = true;
    }
    else
    {
        LoadFromGlobalSettings();
        version = TABLE_VERSION_UNKNOWN;
        SaveSettings();
    }

    m_UpdateTimer.setSingleShot( true );
    Connect( &m_UpdateTimer, SIGNAL(timeout()), this, SLOT(OnUpdateTimeout()) );

    Connect( this, SIGNAL(RowChanged(int)), this, SLOT(OnMyRowChanged(int)), Qt::QueuedConnection );
    Connect( this, SIGNAL(TableChanged()),  this, SLOT(OnMyTableChanged()),  Qt::QueuedConnection );

    Register( ValidVersion( version ), TableShare_Watcher, 0 );
}
QtPropertyEditor::QtPropertyEditor(QWidget *parent /* = 0 */)
	: QTreeView(parent)
	, updateTimeout(0)
	, doUpdateOnPaintEvent(false)
{
	curModel = new QtPropertyModel();
	setModel(curModel);

	curItemDelegate = new QtPropertyItemDelegate();
	setItemDelegate(curItemDelegate);

	QObject::connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(OnItemClicked(const QModelIndex &)));
	QObject::connect(this, SIGNAL(expanded(const QModelIndex &)), curItemDelegate, SLOT(expand(const QModelIndex &)));
	QObject::connect(this, SIGNAL(collapsed(const QModelIndex &)), curItemDelegate, SLOT(collapse(const QModelIndex &)));
	QObject::connect(curModel, SIGNAL(ItemEdited(const QString &, QtPropertyData *)), this, SLOT(OnItemEdited(const QString &, QtPropertyData *)));
	QObject::connect(&updateTimer, SIGNAL(timeout()), this, SLOT(OnUpdateTimeout()));
}
void QtPropertyEditor::Update()
{
	OnUpdateTimeout();
}