This method creates the control for the first time. It should only be called on creation
| 37 | // This method creates the control for the first time. It should only be called |
| 38 | // on creation |
| 39 | void LibraryMenuControl::init(QSharedPointer<Library>& library) |
| 40 | { |
| 41 | destroy(); |
| 42 | |
| 43 | if (!winOS->GetLibraryManager()) |
| 44 | return; |
| 45 | |
| 46 | getStyle().setFloating(true); |
| 47 | |
| 48 | _dropDownMenu = new DropDownMenu(); |
| 49 | |
| 50 | LibraryMenuItem* toSelect = NULL; |
| 51 | const QList< QSharedPointer<Library> >& libraries = winOS->GetLibraryManager()->getLibraries(); |
| 52 | QListIterator< QSharedPointer<Library> > iter(libraries); |
| 53 | while (iter.hasNext()) |
| 54 | { |
| 55 | QSharedPointer<Library> lib = iter.next(); |
| 56 | LibraryMenuItem* item = new LibraryMenuItem(lib); |
| 57 | if (lib->getHashKey().startsWith(QT_NT("usr_")) && library != lib) |
| 58 | item->setDeleteable(true); |
| 59 | _dropDownMenu->addItem(item); |
| 60 | if (lib->getHashKey() == library->getHashKey()) |
| 61 | toSelect = item; |
| 62 | } |
| 63 | |
| 64 | BrowseFolderMenuItem* browseFolder = new BrowseFolderMenuItem(QString("More places...")); |
| 65 | _dropDownMenu->addItem(browseFolder); |
| 66 | |
| 67 | if (toSelect) |
| 68 | _dropDownMenu->select(toSelect); |
| 69 | |
| 70 | this->addItem(_dropDownMenu); |
| 71 | scnManager->registerOverlay(this); |
| 72 | fadeOut(_unHoveredAlpha); |
| 73 | } |
| 74 | |
| 75 | // This method is called just before a render |
| 76 | void LibraryMenuControl::update() |
nothing calls this directly
no test coverage detected