~ubuntu-branches/ubuntu/jaunty/avidemux/jaunty

« back to all changes in this revision

Viewing changes to avidemux/ADM_userInterfaces/ADM_QT4/ADM_dialog/T_flyDialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-02-17 23:41:46 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20090217234146-eakx254awuch4wgw
Tags: 1:2.4.4-0.0ubuntu1
* Merge from debian multimedia, Ubuntu remaining changes:
  - debian/control:
    + Build-Depends on newer libx264-dev.
    + Don't Build-Depends on ccache and libamrnb-dev.
    + Build-Depends on libpulse-dev.
    + Fixed small typo in avidemux description.
  - Don't use ccache.
  - Drop patch to fix build with newer x264, it has been merged by upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
#include "config.h"
16
16
 
17
 
#include <QtGui/QGraphicsView>
18
 
#include <QtGui/QSlider>
 
17
#include <QtGui>
19
18
 
20
19
#include "default.h"
21
20
#include "ADM_assert.h"
23
22
#include "DIA_flyDialog.h"
24
23
#include "DIA_flyDialogQt4.h"
25
24
 
 
25
extern float UI_calcZoomToFitScreen(QWidget* window, QWidget* canvas, uint32_t imageWidth, uint32_t imageHeight);
 
26
extern uint8_t UI_getPhysicalScreenSize(void* window, uint32_t *w, uint32_t *h);
 
27
 
 
28
class FlyDialogEventFilter : public QObject
 
29
{
 
30
        Q_OBJECT
 
31
 
 
32
        ADM_flyDialog *flyDialog;
 
33
        bool recomputed;
 
34
 
 
35
public:
 
36
        FlyDialogEventFilter(ADM_flyDialog *flyDialog)
 
37
        {
 
38
                recomputed = false;
 
39
                this->flyDialog = flyDialog;
 
40
        };
 
41
 
 
42
protected:
 
43
        bool eventFilter(QObject *obj, QEvent *event)
 
44
        {
 
45
                if (event->type() == QEvent::Show && !recomputed)
 
46
                {
 
47
                        recomputed = true;
 
48
                        QWidget* parent = (QWidget*)obj;
 
49
                        uint32_t screenWidth, screenHeight;
 
50
 
 
51
                        UI_getPhysicalScreenSize(parent, &screenWidth, &screenHeight);
 
52
                        flyDialog->recomputeSize();
 
53
                        QCoreApplication::processEvents();
 
54
                        parent->move((((int)screenWidth) - parent->frameSize().width()) / 2, (((int)screenHeight) - parent->frameSize().height()) / 2);
 
55
                }
 
56
                
 
57
                return QObject::eventFilter(obj, event);
 
58
        };
 
59
};
 
60
 
26
61
void ADM_flyDialog::postInit(uint8_t reInit)
27
62
{
28
63
        QWidget *graphicsView = ((ADM_QCanvas*)_canvas)->parentWidget();
29
64
        QSlider  *slider=(QSlider *)_slider;
30
 
        
31
 
        graphicsView->setMinimumSize(_w, _h);
32
 
        graphicsView->resize(_w, _h);
33
 
        uint32_t nbFrames=_in->getInfo()->nb_frames; 
34
 
        slider->setMaximum(nbFrames);
35
 
}
36
 
 
37
 
float ADM_flyDialog::calcZoomFactor(void) {return 1;}
 
65
 
 
66
        if (!reInit)
 
67
        {
 
68
                FlyDialogEventFilter *eventFilter = new FlyDialogEventFilter(this);
 
69
 
 
70
                if (slider)
 
71
                        slider->setMaximum(_in->getInfo()->nb_frames);
 
72
 
 
73
                graphicsView->parentWidget()->installEventFilter(eventFilter);
 
74
        }
 
75
 
 
76
        ((ADM_QCanvas*)_canvas)->changeSize(_zoomW, _zoomH);
 
77
        graphicsView->setMinimumSize(_zoomW, _zoomH);
 
78
        graphicsView->resize(_zoomW, _zoomH);
 
79
}
 
80
 
 
81
float ADM_flyDialog::calcZoomFactor(void)
 
82
{
 
83
        return UI_calcZoomToFitScreen(((ADM_QCanvas*)_canvas)->parentWidget()->parentWidget(), ((ADM_QCanvas*)_canvas)->parentWidget(), _w, _h);
 
84
}
38
85
 
39
86
uint8_t  ADM_flyDialog::display(void)
40
87
{