void SyntroZigbeeGateway::refreshDisplay()
{
	QList<ZigbeeStats> list = m_controller->stats();

	int tableRowCount = ui.m_table->rowCount();

    // remove extra rows from radios we lose
    while (tableRowCount > list.count()) {
        tableRowCount--;
        ui.m_table->removeRow(tableRowCount);
    }

	int row = 0;

	// first all the rows we already have created
	for (row = 0; row < tableRowCount && row < list.count(); row++) {
		ZigbeeStats zb = list.at(row);
		populateRow(row, &zb);
	}

	// if we need to add new rows
	if (tableRowCount < list.count()) {
		for (; row < list.count(); row++) {
			ui.m_table->insertRow(row);
			ui.m_table->setRowHeight(row, DEFAULT_ROW_HEIGHT);

			for (int i = 0; i < ui.m_table->columnCount(); i++) {
				QTableWidgetItem *item = new QTableWidgetItem();
				item->setTextAlignment(Qt::AlignLeft | Qt::AlignBottom);
				ui.m_table->setItem(row, i, item);
			}

			ZigbeeStats zb = list.at(row);
			populateRow(row, &zb);
		}
	}
}
Example #2
0
/////////////////////////////////////////////////////////////////////////////
// load maps
/////////////////////////////////////////////////////////////////////////////
void CMapListCtrl::loadMaps()
{
	int i;

	//run through the map list
	for(i = 0; i < MAPS->numMaps(); i++)
	{
		//load it up
		MAPS->loadMap(i);

		//populate table
		populateRow(i);
	}

	//reset selection
	m_nSelection = -1;
}