comparison view/View.h @ 797:edada332c374 tonioni

Add an experimental cancel button to view progress bars
author Chris Cannam
date Fri, 13 Jun 2014 17:39:01 +0100
parents 9fd1bdf214dd
children 40c6c9344ff6
comparison
equal deleted inserted replaced
795:54efa0a4f728 797:edada332c374
26 26
27 // #define DEBUG_VIEW_WIDGET_PAINT 1 27 // #define DEBUG_VIEW_WIDGET_PAINT 1
28 28
29 class Layer; 29 class Layer;
30 class ViewPropertyContainer; 30 class ViewPropertyContainer;
31
32 class QPushButton;
31 33
32 #include <map> 34 #include <map>
33 #include <set> 35 #include <set>
34 36
35 /** 37 /**
307 virtual void selectionChanged(); 309 virtual void selectionChanged();
308 virtual void toolModeChanged(); 310 virtual void toolModeChanged();
309 virtual void overlayModeChanged(); 311 virtual void overlayModeChanged();
310 virtual void zoomWheelsEnabledChanged(); 312 virtual void zoomWheelsEnabledChanged();
311 313
314 virtual void cancelClicked();
315
312 virtual void progressCheckStalledTimerElapsed(); 316 virtual void progressCheckStalledTimerElapsed();
313 317
314 protected: 318 protected:
315 View(QWidget *, bool showProgress); 319 View(QWidget *, bool showProgress);
316 virtual void paintEvent(QPaintEvent *e); 320 virtual void paintEvent(QPaintEvent *e);
371 375
372 // caches for use in getScrollableBackLayers, getNonScrollableFrontLayers 376 // caches for use in getScrollableBackLayers, getNonScrollableFrontLayers
373 mutable LayerList m_lastScrollableBackLayers; 377 mutable LayerList m_lastScrollableBackLayers;
374 mutable LayerList m_lastNonScrollableBackLayers; 378 mutable LayerList m_lastNonScrollableBackLayers;
375 379
376 class LayerProgressBar : public QProgressBar {
377 public:
378 LayerProgressBar(QWidget *parent);
379 virtual QString text() const { return m_text; }
380 virtual void setText(QString text) { m_text = text; }
381 protected:
382 QString m_text;
383 };
384
385 struct ProgressBarRec { 380 struct ProgressBarRec {
381 QPushButton *cancel;
386 QProgressBar *bar; 382 QProgressBar *bar;
387 int lastCheck; 383 int lastCheck;
388 QTimer *checkTimer; 384 QTimer *checkTimer;
389 }; 385 };
390 typedef std::map<Layer *, ProgressBarRec> ProgressMap; 386 typedef std::map<Layer *, ProgressBarRec> ProgressMap;