aboutsummaryrefslogtreecommitdiff
path: root/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'mainwindow.cc')
-rw-r--r--mainwindow.cc36
1 files changed, 11 insertions, 25 deletions
diff --git a/mainwindow.cc b/mainwindow.cc
index 5d513b1..5c27145 100644
--- a/mainwindow.cc
+++ b/mainwindow.cc
@@ -19,8 +19,8 @@
#include <QtCore/QDebug>
#include <QtCore/QTimer>
#include <QtCore/QSettings>
-#include <QtGui/QFileDialog>
-#include <QtGui/QMessageBox>
+#include <QtWidgets/QFileDialog>
+#include <QtWidgets/QMessageBox>
#include <QtSvg/QSvgGenerator>
#include "mainwindow.h"
#include "ui_mainwindow.h"
@@ -37,30 +37,15 @@ MainWindow::MainWindow(QWidget *parent) :
_statusLabel(new QLabel)
{
ui->setupUi(this);
-#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
- // Some tricks for DPI support
- const qreal scale = logicalDpiX() / 96.0;
- if (scale > 1.1) {
- ui->notebookTree->header()->setDefaultSectionSize(ui->notebookTree->header()->defaultSectionSize() * scale);
- ui->notebookTree->setIconSize(QSize(16, 16) * scale);
- ui->prevButton->setMaximumSize(ui->prevButton->maximumSize() * scale);
- ui->nextButton->setMaximumSize(ui->nextButton->maximumSize() * scale);
- ui->exportButton->setMaximumSize(ui->exportButton->maximumSize() * scale);
- ui->playButton->setMaximumSize(ui->playButton->maximumSize() * scale);
- ui->pauseButton->setMaximumSize(ui->pauseButton->maximumSize() * scale);
- ui->playButton->setMaximumSize(ui->prevButton->maximumSize() * scale);
- ui->pageEdit->setMaximumWidth(ui->pageEdit->maximumWidth() * scale);
- }
-#endif
ui->notebookTree->setModel(_notebooks);
- ui->notebookTree->header()->setResizeMode(0, QHeaderView::Stretch);
- ui->notebookTree->header()->setResizeMode(1, QHeaderView::Fixed);
- ui->notebookTree->header()->setResizeMode(2, QHeaderView::Fixed);
+ ui->notebookTree->header()->setSectionResizeMode(0, QHeaderView::Stretch);
+ ui->notebookTree->header()->setSectionResizeMode(1, QHeaderView::Fixed);
+ ui->notebookTree->header()->setSectionResizeMode(2, QHeaderView::Fixed);
ui->notebookTree->expandAll();
ui->notebookView->setVisible(false);
ui->paperReplayView->setModel(_replayModel);
- ui->paperReplayView->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
- ui->paperReplayView->horizontalHeader()->setResizeMode(1, QHeaderView::Fixed);
+ ui->paperReplayView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
+ ui->paperReplayView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed);
ui->paperReplayView->setVisible(false);
Phonon::createPath(_media, _mediaOutput);
_media->setTickInterval(500);
@@ -185,10 +170,11 @@ void MainWindow::handleNotebookSelected(const QModelIndex &index)
return;
}
- QModelIndex child = parent.child(index.row(), 0);
+ // Get column 0, which corresponds to notebook name
+ QModelIndex nb = _notebooks->index(index.row(), 0, parent);
openNotebook(_notebooks->data(parent, Qt::DisplayRole).toString(),
- _notebooks->data(child, Qt::DisplayRole).toString());
+ _notebooks->data(nb, Qt::DisplayRole).toString());
}
void MainWindow::handleNotebookRowsInserted(const QModelIndex &index, int start, int end)
@@ -220,7 +206,7 @@ void MainWindow::handlePaperReplayRequested(const QString &file, qint64 time)
QString filePath = finfo.canonicalFilePath();
if (_media->currentSource().fileName() != filePath) {
- _media->setCurrentSource(filePath);
+ _media->setCurrentSource(QUrl::fromLocalFile(filePath));
}
switch (_media->state()) {