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 #endif
FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb) : selectedDirectoryId(1), listener(NULL), fslistener(NULL), hasValidCurrentEFS(false), filterPanel(NULL), coarsePanel(cp), toolBar(tb) { 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 // construct and initialize thumbnail browsers
fileBrowser = new FileBrowser(); fileBrowser = new FileBrowser();
@@ -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 if (!inTabMode) progressBar->hide (); // just needed once
/* Glib::ListHandle<Gtk::Widget*> list = buttonBar2->get_children ();
Glib::ListHandle<Gtk::Widget*>::iterator i = list.begin (); fileBrowser->enableTabMode(inTabMode);
for (; i!=list.end() && *i!=progressBar; i++);
if (i==list.end()) { redrawAll();
buttonBar2->pack_start (*progressBar, Gtk::PACK_SHRINK, 4); }
buttonBar2->reorder_child (*progressBar, 2);
} void FileCatalog::_refreshProgressBar () {
*/ // In tab mode, no progress bar at all
progressBar->show (); // Also mention that this progress bar only measures the FIRST pass (quick thumbnails)
if (previewsToLoad>0) // 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->set_fraction ((double)previewsLoaded / previewsToLoad);
else progressBar->show ();
} else {
progressBar->set_fraction (1.0); progressBar->set_fraction (1.0);
progressBar->hide ();
}
}
} }
int refreshpb (void* data) { int refreshpb (void* data) {
@@ -365,8 +373,8 @@ void FileCatalog::_previewsFinished () {
redrawAll (); redrawAll ();
previewsToLoad = 0; previewsToLoad = 0;
previewsLoaded = 0; previewsLoaded = 0;
// removeIfThere (buttonBar2, progressBar);
progressBar->hide (); progressBar->hide ();
if (filterPanel) { if (filterPanel) {
filterPanel->set_sensitive (true); filterPanel->set_sensitive (true);
if ( !hasValidCurrentEFS ){ if ( !hasValidCurrentEFS ){

View File

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

View File

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