*/
void MediaList::populateTree()
{
- if (m_populating)
- return;
- m_populating = true;
- QTreeWidgetItem *pooltreeitem;
+ if (m_populated)
+ writeExpandedSettings();
+ m_populated = true;
if (!m_console->preventInUseConnect())
return;
+ Freeze frz(*mp_treeWidget); /* disable updating*/
+
QStringList headerlist = (QStringList()
<< tr("Volume Name") << tr("Id") << tr("Status") << tr("Enabled") << tr("Bytes") << tr("Files")
<< tr("Jobs") << tr("Retention") << tr("Media Type") << tr("Slot") << tr("Use Duration")
<< tr("RecyclePool") << tr("Last Written"));
m_checkcurwidget = false;
- if (m_populated)
- writeExpandedSettings();
mp_treeWidget->clear();
m_checkcurwidget = true;
mp_treeWidget->setColumnCount(headerlist.count());
settings.beginGroup("MediaListTreeExpanded");
QString query;
+ QTreeWidgetItem *pooltreeitem;
foreach (QString pool_listItem, m_console->pool_list) {
pooltreeitem = new QTreeWidgetItem(m_topItem);
pooltreeitem->setText(0, pool_listItem);
for(int cnter=0; cnter<headerlist.count(); cnter++) {
mp_treeWidget->resizeColumnToContents(cnter);
}
- m_populating = false;
}
/*
if (!m_populated) {
populateTree();
createContextMenu();
- m_populated=true;
}
}
populateTree();
/* Create the context menu for the medialist tree */
createContextMenu();
- m_populated=true;
}
}
*/
void MediaList::writeExpandedSettings()
{
- QSettings settings(m_console->m_dir->name(), "bat");
- settings.beginGroup("MediaListTreeExpanded");
- int childcount = m_topItem->childCount();
- for (int cnt=0; cnt<childcount; cnt++) {
- QTreeWidgetItem *poolitem = m_topItem->child(cnt);
- settings.setValue(poolitem->text(0), poolitem->isExpanded());
+ if (m_topItem) {
+ QSettings settings(m_console->m_dir->name(), "bat");
+ settings.beginGroup("MediaListTreeExpanded");
+ int childcount = m_topItem->childCount();
+ for (int cnt=0; cnt<childcount; cnt++) {
+ QTreeWidgetItem *poolitem = m_topItem->child(cnt);
+ settings.setValue(poolitem->text(0), poolitem->isExpanded());
+ }
+ settings.endGroup();
}
- settings.endGroup();
}