Enhanced progress bar. Fixes filmstrip auto-height as a side effect. See issue #331

This commit is contained in:
Oliver Duis 2010-11-13 08:36:01 +01:00
parent ae5efade89
commit d0717b8b85
3 changed files with 30 additions and 25 deletions

View File

@ -45,6 +45,7 @@ int _directoryUpdater (void* cat) {
#endif
FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb) : selectedDirectoryId(1), listener(NULL), fslistener(NULL), hasValidCurrentEFS(false), filterPanel(NULL), coarsePanel(cp), toolBar(tb) {
inTabMode=false;
// construct and initialize thumbnail browsers
fileBrowser = new FileBrowser();
@ -219,8 +220,8 @@ void FileCatalog::closeDir () {
}
#endif
// ignore old requests
++selectedDirectoryId;
// ignore old requests
++selectedDirectoryId;
// terminate thumbnail preview loading
previewLoader->removeAllJobs ();
@ -285,22 +286,29 @@ void FileCatalog::dirSelected (const Glib::ustring& dirname, const Glib::ustring
}
}
void FileCatalog::_refreshProgressBar () {
void FileCatalog::enableTabMode(bool enable) {
inTabMode = enable;
// check if progress bar is visible
/* Glib::ListHandle<Gtk::Widget*> list = buttonBar2->get_children ();
Glib::ListHandle<Gtk::Widget*>::iterator i = list.begin ();
for (; i!=list.end() && *i!=progressBar; i++);
if (i==list.end()) {
buttonBar2->pack_start (*progressBar, Gtk::PACK_SHRINK, 4);
buttonBar2->reorder_child (*progressBar, 2);
if (!inTabMode) progressBar->hide (); // just needed once
fileBrowser->enableTabMode(inTabMode);
redrawAll();
}
void FileCatalog::_refreshProgressBar () {
// In tab mode, no progress bar at all
// Also mention that this progress bar only measures the FIRST pass (quick thumbnails)
// The second, usually longer pass is done multithreaded down in the single entries and is NOT measured by this
if (!inTabMode) {
if (previewsToLoad>0) {
progressBar->set_fraction ((double)previewsLoaded / previewsToLoad);
progressBar->show ();
} else {
progressBar->set_fraction (1.0);
progressBar->hide ();
}
}
*/
progressBar->show ();
if (previewsToLoad>0)
progressBar->set_fraction ((double)previewsLoaded / previewsToLoad);
else
progressBar->set_fraction (1.0);
}
int refreshpb (void* data) {
@ -365,8 +373,8 @@ void FileCatalog::_previewsFinished () {
redrawAll ();
previewsToLoad = 0;
previewsLoaded = 0;
// removeIfThere (buttonBar2, progressBar);
progressBar->hide ();
if (filterPanel) {
filterPanel->set_sensitive (true);
if ( !hasValidCurrentEFS ){

View File

@ -62,10 +62,8 @@ class FileCatalog : public Gtk::VBox,
Glib::ustring selectedDirectory;
int selectedDirectoryId;
bool enabled;
// Restore PreviewLoader if the new threadsafe is not that threadsafe ;-)
//PreviewLoader previewLoader;
//PreviewMultiLoader previewLoader;
bool inTabMode; // Tab mode has e.g. different progress bar handling
FileSelectionListener* listener;
FileSelectionChangeListener* fslistener;
ImageAreaToolListener* iatlistener;
@ -145,6 +143,7 @@ class FileCatalog : public Gtk::VBox,
Glib::ustring lastSelectedDir () { return selectedDirectory; }
void setEnabled (bool e); // if not enabled, it does not open image
void enableTabMode(bool enable); // sets progress bar
void redrawAll ();
void refreshAll ();

View File

@ -343,8 +343,7 @@ void RTWindow::MoveFileBrowserToMain()
FileCatalog *fCatalog = fpanel->fileCatalog;
epanel->catalogPane->remove(*fCatalog);
fpanel->ribbonPane->add(*fCatalog);
fCatalog->fileBrowser->enableTabMode(false);
fCatalog->redrawAll();
fCatalog->enableTabMode(false);
}
}
@ -355,8 +354,7 @@ void RTWindow::MoveFileBrowserToEditor()
FileCatalog *fCatalog = fpanel->fileCatalog;
fpanel->ribbonPane->remove(*fCatalog);
epanel->catalogPane->add(*fCatalog);
fCatalog->fileBrowser->enableTabMode(true);
fCatalog->redrawAll();
fCatalog->enableTabMode(true);
fCatalog->refreshHeight();
}
}