diff --git a/panels/viewer.cpp b/panels/viewer.cpp
index 667780ea3..e17bca6de 100644
--- a/panels/viewer.cpp
+++ b/panels/viewer.cpp
@@ -65,7 +65,6 @@ Viewer::Viewer(QWidget *parent) :
connect(&recording_flasher, SIGNAL(timeout()), this, SLOT(recording_flasher_update()));
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), viewer_widget, SLOT(set_waveform_scroll(int)));
- connect(ui->zoomComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(zoom_update(int)));
update_playhead_timecode(0);
update_end_timecode();
@@ -560,18 +559,6 @@ void Viewer::recording_flasher_update() {
}
}
-void Viewer::zoom_update(int i) {
- if (i == 0) {
- ui->glViewerPane->fit = true;
- } else {
- ui->glViewerPane->fit = false;
- QString pc = ui->zoomComboBox->itemText(i);
- pc = pc.left(pc.length() - 1);
- ui->glViewerPane->zoom = pc.toDouble()*0.01;
- }
- ui->glViewerPane->adjust();
-}
-
void Viewer::clean_created_seq() {
viewer_widget->waveform = false;
diff --git a/panels/viewer.h b/panels/viewer.h
index 449f884e2..c5c43778b 100644
--- a/panels/viewer.h
+++ b/panels/viewer.h
@@ -82,8 +82,7 @@ private slots:
void on_pushButton_3_clicked();
void update_playhead();
void timer_update();
- void recording_flasher_update();
- void zoom_update(int i);
+ void recording_flasher_update();
private:
void clean_created_seq();
void set_sequence(bool main, Sequence* s);
diff --git a/panels/viewer.ui b/panels/viewer.ui
index acb55f077..f3713654c 100644
--- a/panels/viewer.ui
+++ b/panels/viewer.ui
@@ -70,99 +70,6 @@
- -
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 260
- 20
-
-
-
-
- -
-
-
-
-
- Fit
-
-
- -
-
- 10%
-
-
- -
-
- 25%
-
-
- -
-
- 50%
-
-
- -
-
- 75%
-
-
- -
-
- 100%
-
-
- -
-
- 150%
-
-
- -
-
- 200%
-
-
- -
-
- 400%
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 259
- 20
-
-
-
-
-
-
-
-
diff --git a/ui/viewercontainer.cpp b/ui/viewercontainer.cpp
index be24c84bf..5c109b077 100644
--- a/ui/viewercontainer.cpp
+++ b/ui/viewercontainer.cpp
@@ -75,6 +75,8 @@ void ViewerContainer::adjust() {
child->move(widget_x, widget_y);
child->resize(widget_width, widget_height);
+
+ zoom = double(widget_width) / double(viewer->seq->width);
} else {
int zoomed_width = double(viewer->seq->width)*zoom;
int zoomed_height = double(viewer->seq->height)*zoom;
diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp
index 0c80622cd..6ec782f98 100644
--- a/ui/viewerwidget.cpp
+++ b/ui/viewerwidget.cpp
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
extern "C" {
#include
@@ -91,6 +92,22 @@ void ViewerWidget::show_context_menu() {
QAction* show_fullscreen_action = menu.addAction("Show Fullscreen");
connect(show_fullscreen_action, SIGNAL(triggered()), this, SLOT(show_fullscreen()));
+ QMenu zoom_menu("Zoom");
+ QAction* fit_zoom = zoom_menu.addAction("Fit");
+ connect(fit_zoom, SIGNAL(triggered(bool)), this, SLOT(set_fit_zoom()));
+ zoom_menu.addAction("10%")->setData(0.1);
+ zoom_menu.addAction("25%")->setData(0.25);
+ zoom_menu.addAction("50%")->setData(0.5);
+ zoom_menu.addAction("75%")->setData(0.75);
+ zoom_menu.addAction("100%")->setData(1.0);
+ zoom_menu.addAction("150%")->setData(1.5);
+ zoom_menu.addAction("200%")->setData(2.0);
+ zoom_menu.addAction("400%")->setData(4.0);
+ QAction* custom_zoom = zoom_menu.addAction("Custom");
+ connect(custom_zoom, SIGNAL(triggered(bool)), this, SLOT(set_custom_zoom()));
+ connect(&zoom_menu, SIGNAL(triggered(QAction*)), this, SLOT(set_menu_zoom(QAction*)));
+ menu.addMenu(&zoom_menu);
+
menu.exec(QCursor::pos());
}
@@ -130,6 +147,30 @@ void ViewerWidget::show_fullscreen() {
showFullScreen();
}
+void ViewerWidget::set_fit_zoom() {
+ container->fit = true;
+ container->adjust();
+}
+
+void ViewerWidget::set_custom_zoom() {
+ bool ok;
+ double d = QInputDialog::getDouble(this, "Viewer Zoom", "Set Custom Zoom Value:", container->zoom*100, 0, 2147483647, 2, &ok);
+ if (ok) {
+ container->fit = false;
+ container->zoom = d*0.01;
+ container->adjust();
+ }
+}
+
+void ViewerWidget::set_menu_zoom(QAction* action) {
+ const QVariant& data = action->data();
+ if (!data.isNull()) {
+ container->fit = false;
+ container->zoom = data.toDouble();
+ container->adjust();
+ }
+}
+
void ViewerWidget::retry() {
update();
}
diff --git a/ui/viewerwidget.h b/ui/viewerwidget.h
index 8d9899151..fa51aa383 100644
--- a/ui/viewerwidget.h
+++ b/ui/viewerwidget.h
@@ -70,6 +70,10 @@ private slots:
void show_context_menu();
void save_frame();
void show_fullscreen();
+
+ void set_fit_zoom();
+ void set_custom_zoom();
+ void set_menu_zoom(QAction *action);
};
#endif // VIEWERWIDGET_H