/** \fn GalleryViewHelper::GalleryViewHelper(MythScreenType *) * \brief Constructor * \param parent The screen parent */ GalleryViewHelper::GalleryViewHelper(MythScreenType *parent) { m_parent = parent; m_sgName = gCoreContext->GetSetting("GalleryStorageGroupName"); m_sgDirList = StorageGroup::getGroupDirs(m_sgName, ""); m_dbHelper = new GalleryDatabaseHelper(); m_thumbGenThread = new GalleryThumbGenThread(); m_fileHelper = new GalleryFileHelper(); connect(m_thumbGenThread, SIGNAL(ThumbnailCreated(ImageMetadata *, int)), m_parent, SLOT(UpdateThumbnail(ImageMetadata *, int))); connect(m_thumbGenThread, SIGNAL(UpdateThumbnailProgress(int, int)), m_parent, SLOT(UpdateThumbnailProgress(int, int))); connect(m_thumbGenThread, SIGNAL(finished()), m_parent, SLOT(ResetThumbnailProgress())); // these are the node trees that hold the data and // are used for navigating and finding files m_currentNode = new MythGenericTree("", kBaseDirectory, false); m_allNodesVisible = false; }
/** \fn GalleryView::DirSelectUp() * \brief Goes up one directory level * \return void */ bool GalleryView::DirSelectUp() { // Set the first node (upfolder) active m_galleryViewHelper->m_currentNode->setSelectedChild(m_galleryViewHelper->m_currentNode->getChildAt(0)); // Get the data and with it the kUpFolder directory node int id = m_galleryViewHelper->GetImageMetadataFromSelectedNode()->m_id; m_galleryViewHelper->LoadTreeData(); ResetThumbnailProgress(); UpdateImageList(); // Go through the entire list of image items and find // the directory id that matches the saved directory id for (int i = 0; i < m_imageList->GetCount(); i++) { MythUIButtonListItem *item = m_imageList->GetItemAt(i); if (!item) continue; ImageMetadata *data = GetImageMetadataFromButton(item); if (!data) continue; if (data->m_id == id) { m_imageList->SetItemCurrent(item); break; } } return true; }
/** \fn GalleryView::DirSelectDown() * \brief Goes one directory level down * \return void */ void GalleryView::DirSelectDown() { m_galleryViewHelper->LoadTreeData(); m_galleryViewHelper->m_currentNode->setSelectedChild(m_galleryViewHelper->m_currentNode->getChildAt(0)); ResetThumbnailProgress(); UpdateImageList(); }
/** \fn GalleryView::ShowFile() * \brief Creates the window that will show the images and slideshows * \return The created window or NULL */ GalleryWidget* GalleryView::ShowFile() { GalleryWidget *widget = new GalleryWidget(m_mainStack, "gallerywidget", m_galleryViewHelper); if (widget->Create()) { ResetThumbnailProgress(); m_mainStack->AddScreen(widget); widget->LoadFile(); } else { delete widget; widget = NULL; } return widget; }