aboutsummaryrefslogtreecommitdiff
path: root/mainwindow.cc
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2020-10-12 02:27:14 +0200
committerJavier <dev.git@javispedro.com>2020-10-12 02:27:14 +0200
commit55b5c88cf93d06629ba70eb7cddeb50a365b170a (patch)
tree49073a56b531898d27822812ba859bd26892f634 /mainwindow.cc
parenta22f3f54d9426c29220815f95dec574a11c43f69 (diff)
downloadscribiu-55b5c88cf93d06629ba70eb7cddeb50a365b170a.tar.gz
scribiu-55b5c88cf93d06629ba70eb7cddeb50a365b170a.zip
minor UI refactor; allow reading ".archive" directories
Archives cannot be created from the UI yet. Just copy a .pen directory to an .archive directory for now.
Diffstat (limited to 'mainwindow.cc')
-rw-r--r--mainwindow.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/mainwindow.cc b/mainwindow.cc
index 5c27145..bba19cc 100644
--- a/mainwindow.cc
+++ b/mainwindow.cc
@@ -42,11 +42,9 @@ MainWindow::MainWindow(QWidget *parent) :
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()->setSectionResizeMode(0, QHeaderView::Stretch);
ui->paperReplayView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed);
- ui->paperReplayView->setVisible(false);
Phonon::createPath(_media, _mediaOutput);
_media->setTickInterval(500);
ui->replaySlider->setMediaObject(_media);
@@ -85,9 +83,8 @@ void MainWindow::closeNotebook()
_curPenName.clear();
_curNotebookName.clear();
_replay->close();
+ ui->pane2Stack->setCurrentWidget(ui->notebookView);
ui->notebookView->setNotebook(QString());
- ui->notebookView->setVisible(false);
- ui->paperReplayView->setVisible(false);
}
void MainWindow::openNotebook(const QString &pen, const QString &notebook)
@@ -105,7 +102,7 @@ void MainWindow::openNotebook(const QString &pen, const QString &notebook)
_replay->open(replayDir, 0);
_replayModel->refresh();
- ui->paperReplayView->setVisible(true);
+ ui->pane2Stack->setCurrentWidget(ui->paperReplayView);
} else {
QString nbDir = _notebooks->notebookDirectory(_curPenName, _curNotebookName);
@@ -113,7 +110,7 @@ void MainWindow::openNotebook(const QString &pen, const QString &notebook)
ui->notebookView->setPaperReplay(_notebooks->paperReplayDirectory(_curPenName));
ui->notebookView->setNotebook(nbDir);
- ui->notebookView->setVisible(true);
+ ui->pane2Stack->setCurrentWidget(ui->notebookView);
}
}
@@ -173,8 +170,8 @@ void MainWindow::handleNotebookSelected(const QModelIndex &index)
// 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(nb, Qt::DisplayRole).toString());
+ openNotebook(_notebooks->data(parent, NotebookModel::FileNameRole).toString(),
+ _notebooks->data(nb, NotebookModel::FileNameRole).toString());
}
void MainWindow::handleNotebookRowsInserted(const QModelIndex &index, int start, int end)