ImageView::ImageView(const ThumbList &itemList, int *pos, int slideShow, int sortorder) : m_screenSize(640,480), m_wmult(1.0f), m_hmult(1.0f), m_pos(*pos), m_savedPos(pos), m_movieState(0), m_zoom(1.0f), // Info variables m_info_show(false), m_info_show_short(false), // Common slideshow variables m_slideshow_running(false), m_slideshow_sequencing(slideShow), m_slideshow_frame_delay(2), m_slideshow_frame_delay_state(m_slideshow_frame_delay * 1000), m_slideshow_timer(NULL), // Common effect state variables m_effect_running(false), m_effect_current_frame(0), m_effect_method(QString::null), m_effect_random(false), m_loaderRunnable(NULL), m_listener(this), m_loaderThread(NULL), m_slideshow_sequence(ComposeSlideshowSequence(slideShow)), m_finishedLoading(false) { int xbase, ybase, screenwidth, screenheight; GetMythUI()->GetScreenSettings(xbase, screenwidth, m_wmult, ybase, screenheight, m_hmult); m_screenSize = QSize(screenwidth, screenheight); // -------------------------------------------------------------------- bool recurse = gCoreContext->GetNumSetting("GalleryRecursiveSlideshow", 0); ThumbItem *origItem = NULL; if (m_pos < itemList.size()) origItem = itemList.at(m_pos); ThumbList fileList, dirList; LoadAlbumRunnable::filterDirectories(itemList, fileList, dirList); AddItems(fileList); if (recurse) { // Load pictures from all directories on a different thread. m_loaderRunnable = new LoadAlbumRunnable(this, dirList, sortorder, m_slideshow_sequencing); m_loaderThread = new MThread("LoadAlbum", m_loaderRunnable); QObject::connect(m_loaderThread->qthread(), SIGNAL(finished()), &m_listener, SLOT(FinishLoading())); m_loaderThread->start(); // Wait for at least one image to be loaded. { QMutexLocker guard(&m_itemListLock); while (m_itemList.empty() && !m_finishedLoading) { m_imagesLoaded.wait(&m_itemListLock); } } } // -------------------------------------------------------------------- // since we remove dirs item position might have changed if (origItem) m_pos = m_itemList.indexOf(origItem); m_pos = (!origItem || (m_pos == -1)) ? 0 : m_pos; m_slideshow_sequence->set(m_pos); // -------------------------------------------------------------------- m_slideshow_frame_delay = gCoreContext->GetNumSetting("SlideshowDelay", 0); m_slideshow_frame_delay = (!m_slideshow_frame_delay) ? 2 : m_slideshow_frame_delay; m_slideshow_frame_delay_state = m_slideshow_frame_delay * 1000; // -------------------------------------------------------------------- if (slideShow == 2) { m_slideshow_mode = QT_TR_NOOP("Random Slideshow"); } else if (slideShow == 3) { m_slideshow_mode = QT_TR_NOOP("Seasonal Slideshow"); } else { m_slideshow_mode = QT_TR_NOOP("Slideshow"); } }
void PrefsLoader::LoadData(URL_ID url_id) { if(m_parse_blocked) return; if (!m_descriptor) m_descriptor = m_serverURL->GetDescriptor(g_main_message_handler, TRUE); if (!m_descriptor) return; m_parse_blocked = TRUE; BOOL more(TRUE); unsigned long buf_len = 0; while (more && ((buf_len = m_descriptor->RetrieveData(more)) > 0)) { const uni_char *data_buf = reinterpret_cast<const uni_char *>(m_descriptor->GetBuffer()); ParseResponse(data_buf, UNICODE_DOWNSIZE(buf_len), more?TRUE:FALSE); m_descriptor->ConsumeData(buf_len); } m_parse_blocked = FALSE; if (m_serverURL->Status(TRUE) == URL_LOADED) { if(m_parseno == 0) { if (m_clean_all_update) { // If the clean_all attribute is used on the preferences element // then any existing hostname override can be affected by this update. // Since the m_hostnames string we pass to ->IsEnd() might end up in // a "Do you want to install updated overrides for these hosts?"-type // of dialog with APPROVE/DENY buttons, it's important that we signal // the scope of the update correctly. m_hostnames.Set("*"); } // if endchecker is present, it is responsible for stopping or continuing the parser. if(m_checker && m_checker->IsEnd(m_hostnames.CStr())) ; else { // Parse one more time to retrieve the preference values m_parseno++; delete m_descriptor; m_descriptor = m_serverURL->GetDescriptor(g_main_message_handler, TRUE); if (!m_descriptor) return; delete m_prl_parser; m_prl_parser = NULL; more = TRUE; buf_len = 0; while (more && ((buf_len = m_descriptor->RetrieveData(more)) > 0)) { const uni_char *data_buf = reinterpret_cast<const uni_char *>(m_descriptor->GetBuffer()); ParseResponse(data_buf, UNICODE_DOWNSIZE(buf_len), more?TRUE:FALSE); m_descriptor->ConsumeData(buf_len); } } } FinishLoading(url_id); } }