/* Create Tree Widget Item */
item = createPage("Console", topItem);
- m_console->SetPassedValues(stackedWidget, item, m_pages++ );
+ m_console->SetPassedValues(stackedWidget, item, m_pages );
/* Append to pageslist */
- m_pageslist.append(m_console);
+ m_pageshash.insert(m_pages, m_console);
/* Set Color of treeWidgetItem for the console
* It will be set to gree in the console class if the connection is made.
* All should be
* 1. create tree widget item
* 2. create object passing pointer to tree widget item (modified constructors to pass QTreeWidget pointers)
- * 3. append to stacklist
- * And it can even be done in one line.
+ * 3. append to stackhash
*/
/* brestore */
- m_pageslist.append(new bRestore(stackedWidget,
- createPage("brestore", topItem), m_pages++ ));
+ m_pages++;
+ item=createPage("brestore", topItem);
+ bRestore* brestore=new bRestore(stackedWidget, item, m_pages);
+ m_pageshash.insert(m_pages, brestore);
/* lastly for now, the medialist */
- m_pageslist.append(new MediaList(stackedWidget, m_console,
- createPage("Storage Tree", topItem ), m_pages++));
+ m_pages++;
+ item=createPage("Storage Tree", topItem );
+ MediaList* medialist=new MediaList(stackedWidget, m_console, item, m_pages);
+ m_pageshash.insert(m_pages, medialist);
/* Iterate through and add to the stack */
- for (QList<Pages*>::iterator pagesItem = m_pageslist.begin();
- pagesItem != m_pageslist.end(); ++pagesItem ) {
- (*pagesItem)->dockPage();
- }
+ foreach (Pages* pagesItem, m_pageshash)
+ pagesItem->dockPage();
treeWidget->expandItem(topItem);
stackedWidget->setCurrentIndex(0);
{
/* Use tree item's Qt::UserRole to get treeindex */
int treeindex = item->data(column, Qt::UserRole).toInt();
- int stackindex=stackedWidget->indexOf(m_pageslist[treeindex]);
+ int stackindex=stackedWidget->indexOf(m_pageshash.value(treeindex));
if( stackindex >= 0 ){
stackedWidget->setCurrentIndex(stackindex);
}
/* run the virtual function in case this class overrides it */
- m_pageslist[treeindex]->PgSeltreeWidgetClicked();
+ m_pageshash.value(treeindex)->PgSeltreeWidgetClicked();
}
/*
int treeindex = item->data(column, Qt::UserRole).toInt();
/* Use tree item's Qt::UserRole to get treeindex */
- if (m_pageslist[treeindex]->isDocked()) {
- m_pagespophold = m_pageslist[treeindex];
+ if (m_pageshash.value(treeindex)->isDocked()) {
+ m_pagespophold = m_pageshash.value(treeindex);
/* Create a popup menu before floating window */
QMenu *popup = new QMenu( treeWidget );
popup->exec(QCursor::pos());
} else {
/* Just pull it back in without prompting */
- m_pageslist[treeindex]->togglePageDocking();
+ m_pageshash.value(treeindex)->togglePageDocking();
}
/* Here is the virtual function so that different classes can do different things */
- m_pageslist[treeindex]->PgSeltreeWidgetDoubleClicked();
+ m_pageshash.value(treeindex)->PgSeltreeWidgetDoubleClicked();
}
void MainWin::labelDialogClicked()
void MainWin::undockWindowButton()
{
int curindex = stackedWidget->currentIndex();
- QList<Pages *>::iterator pagesItem = m_pageslist.begin();
- while ((pagesItem != m_pageslist.end())){
- if (curindex == stackedWidget->indexOf(*pagesItem)) {
- (*pagesItem)->togglePageDocking();
+ foreach (Pages* pagesItem, m_pageshash){
+ if (curindex == stackedWidget->indexOf(pagesItem)) {
+ pagesItem->togglePageDocking();
break;
}
- ++pagesItem;
}
}