Commit 15e436e9 authored by Philipp Erhardt's avatar Philipp Erhardt
Browse files

Add progress bar to presenter view

parent d92ee420
......@@ -116,8 +116,10 @@ Canvas::Canvas(Viewer *v, QWidget *parent) :
setup_keys(beamer);
if (cur_layout == presenter_layout) {
beamer->show();
viewer->show_progress(true);
} else {
beamer->hide();
viewer->show_progress(false);
}
}
......@@ -309,6 +311,7 @@ void Canvas::set_presentation_layout() {
cur_layout = presentation_layout;
update();
viewer->get_beamer()->hide();
viewer->show_progress(false);
viewer->activateWindow();
}
......@@ -318,6 +321,7 @@ void Canvas::set_grid_layout() {
cur_layout = grid_layout;
update();
viewer->get_beamer()->hide();
viewer->show_progress(false);
viewer->activateWindow();
}
......@@ -336,6 +340,7 @@ void Canvas::set_presenter_layout() {
// }
viewer->get_beamer()->get_layout()->scroll_page(cur_layout->get_page(), false);
viewer->get_beamer()->show();
viewer->show_progress(true);
}
void Canvas::toggle_overlay() {
......
......@@ -124,7 +124,14 @@ Viewer::Viewer(const QString &file, QWidget *parent) :
update_info_widget();
presenter_progress.setMinimum(1);
presenter_progress.setMaximum(res->get_page_count());
presenter_progress.setValue(canvas->get_layout()->get_page() + 1);
// presenter_progress.setFormat("%v/%m");
presenter_progress.setTextVisible(true);
layout->addWidget(splitter);
layout->addWidget(&presenter_progress);
layout->addWidget(search_bar);
setLayout(layout);
......@@ -143,6 +150,7 @@ Viewer::Viewer(const QString &file, QWidget *parent) :
// enable transparency, but only in the right places
setAttribute(Qt::WA_TranslucentBackground);
presenter_progress.setAutoFillBackground(true);
search_bar->setAutoFillBackground(true);
info_widget.setAutoFillBackground(true);
toc->setAutoFillBackground(true);
......@@ -178,6 +186,8 @@ void Viewer::reload(bool clamp) {
res->load(res->get_file(), info_password.text().toLatin1());
presenter_progress.setMaximum(res->get_page_count());
search_bar->reset_search(); // TODO restart search if loading the same document?
search_bar->load(res->get_file(), info_password.text().toLatin1());
......@@ -491,11 +501,16 @@ void Viewer::layout_updated(int new_page, bool page_changed) {
beamer->get_layout()->scroll_page(new_page, false);
}
// TODO unfold toc tree to show current entry?
presenter_progress.setValue(new_page + 1);
}
canvas->update();
beamer->update();
}
void Viewer::show_progress(bool show) {
presenter_progress.setVisible(show);
}
void Viewer::signal_slot() {
sig_notifier->setEnabled(false);
char tmp;
......
......@@ -7,6 +7,7 @@
#include <QSocketNotifier>
#include <QLabel>
#include <QLineEdit>
#include <QProgressBar>
class ResourceManager;
......@@ -32,6 +33,7 @@ public:
BeamerWindow *get_beamer() const;
void layout_updated(int new_page, bool page_changed);
void show_progress(bool show);
public slots:
void signal_slot(); // reloads on SIGUSR1
......@@ -87,6 +89,7 @@ private:
Splitter *splitter;
Toc *toc;
Canvas *canvas;
QProgressBar presenter_progress;
SearchBar *search_bar;
QVBoxLayout *layout;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment