23
22
#include "DIA_flyDialog.h"
24
23
#include "DIA_flyDialogQt4.h"
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);
28
class FlyDialogEventFilter : public QObject
32
ADM_flyDialog *flyDialog;
36
FlyDialogEventFilter(ADM_flyDialog *flyDialog)
39
this->flyDialog = flyDialog;
43
bool eventFilter(QObject *obj, QEvent *event)
45
if (event->type() == QEvent::Show && !recomputed)
48
QWidget* parent = (QWidget*)obj;
49
uint32_t screenWidth, screenHeight;
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);
57
return QObject::eventFilter(obj, event);
26
61
void ADM_flyDialog::postInit(uint8_t reInit)
28
63
QWidget *graphicsView = ((ADM_QCanvas*)_canvas)->parentWidget();
29
64
QSlider *slider=(QSlider *)_slider;
31
graphicsView->setMinimumSize(_w, _h);
32
graphicsView->resize(_w, _h);
33
uint32_t nbFrames=_in->getInfo()->nb_frames;
34
slider->setMaximum(nbFrames);
37
float ADM_flyDialog::calcZoomFactor(void) {return 1;}
68
FlyDialogEventFilter *eventFilter = new FlyDialogEventFilter(this);
71
slider->setMaximum(_in->getInfo()->nb_frames);
73
graphicsView->parentWidget()->installEventFilter(eventFilter);
76
((ADM_QCanvas*)_canvas)->changeSize(_zoomW, _zoomH);
77
graphicsView->setMinimumSize(_zoomW, _zoomH);
78
graphicsView->resize(_zoomW, _zoomH);
81
float ADM_flyDialog::calcZoomFactor(void)
83
return UI_calcZoomToFitScreen(((ADM_QCanvas*)_canvas)->parentWidget()->parentWidget(), ((ADM_QCanvas*)_canvas)->parentWidget(), _w, _h);
39
86
uint8_t ADM_flyDialog::display(void)