filter panel
This commit is contained in:
@@ -56,6 +56,34 @@ void cFilterPanel::setPersonList(cPersonList* lpPersonList)
|
||||
m_lpPersonListModel->appendRow(lpItem);
|
||||
}
|
||||
|
||||
m_lpPersonListModel->sort(0);
|
||||
|
||||
m_bLoading = false;
|
||||
}
|
||||
|
||||
void cFilterPanel::updatePersonList()
|
||||
{
|
||||
m_bLoading = true;
|
||||
|
||||
for(cPersonList::iterator i = m_lpPersonList->begin();i != m_lpPersonList->end();i++)
|
||||
{
|
||||
if(m_lpPersonListModel->findItems((*i)->name()).isEmpty())
|
||||
{
|
||||
QStandardItem* lpItem = new QStandardItem((*i)->name());
|
||||
lpItem->setData(QVariant::fromValue(*i), Qt::UserRole+1);
|
||||
lpItem->setCheckable(true);
|
||||
m_lpPersonListModel->appendRow(lpItem);
|
||||
}
|
||||
}
|
||||
|
||||
for(int x = m_lpPersonListModel->rowCount()-1;x >= 0;x--)
|
||||
{
|
||||
if(!m_lpPersonList->find(m_lpPersonListModel->item(x, 0)->text()))
|
||||
m_lpPersonListModel->removeRow(x);
|
||||
}
|
||||
|
||||
m_lpPersonListModel->sort(0);
|
||||
|
||||
m_bLoading = false;
|
||||
}
|
||||
|
||||
@@ -81,6 +109,32 @@ void cFilterPanel::setLocationList(cLocationList* lpLocationList)
|
||||
m_bLoading = false;
|
||||
}
|
||||
|
||||
void cFilterPanel::updateLocationList()
|
||||
{
|
||||
m_bLoading = true;
|
||||
|
||||
for(cLocationList::iterator i = m_lpLocationList->begin();i != m_lpLocationList->end();i++)
|
||||
{
|
||||
if(m_lpLocationListModel->findItems((*i)->name()).isEmpty())
|
||||
{
|
||||
QStandardItem* lpItem = new QStandardItem((*i)->name());
|
||||
lpItem->setData(QVariant::fromValue(*i), Qt::UserRole+1);
|
||||
lpItem->setCheckable(true);
|
||||
m_lpLocationListModel->appendRow(lpItem);
|
||||
}
|
||||
}
|
||||
|
||||
for(int x = m_lpLocationListModel->rowCount()-1;x >= 0;x--)
|
||||
{
|
||||
if(!m_lpLocationList->find(m_lpLocationListModel->item(x, 0)->text()))
|
||||
m_lpLocationListModel->removeRow(x);
|
||||
}
|
||||
|
||||
m_lpLocationListModel->sort(0);
|
||||
|
||||
m_bLoading = false;
|
||||
}
|
||||
|
||||
void cFilterPanel::clearTagList()
|
||||
{
|
||||
m_lpTagListModel->clear();
|
||||
@@ -102,3 +156,29 @@ void cFilterPanel::setTagList(cTagList* lpTagList)
|
||||
|
||||
m_bLoading = false;
|
||||
}
|
||||
|
||||
void cFilterPanel::updateTagList()
|
||||
{
|
||||
m_bLoading = true;
|
||||
|
||||
for(cTagList::iterator i = m_lpTagList->begin();i != m_lpTagList->end();i++)
|
||||
{
|
||||
if(m_lpTagListModel->findItems((*i)->name()).isEmpty())
|
||||
{
|
||||
QStandardItem* lpItem = new QStandardItem((*i)->name());
|
||||
lpItem->setData(QVariant::fromValue(*i), Qt::UserRole+1);
|
||||
lpItem->setCheckable(true);
|
||||
m_lpTagListModel->appendRow(lpItem);
|
||||
}
|
||||
}
|
||||
|
||||
for(int x = m_lpTagListModel->rowCount()-1;x >= 0;x--)
|
||||
{
|
||||
if(!m_lpTagList->find(m_lpTagListModel->item(x, 0)->text()))
|
||||
m_lpTagListModel->removeRow(x);
|
||||
}
|
||||
|
||||
m_lpTagListModel->sort(0);
|
||||
|
||||
m_bLoading = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user