Add statusbar widgets to flip between subpages

This commit is contained in:
G.K.MacGregor
2020-12-13 15:46:23 +00:00
parent 81b3534a09
commit 329d1cd9f4
3 changed files with 34 additions and 9 deletions

View File

@@ -24,8 +24,6 @@ At the moment QTeletextMaker is in pre-alpha status so many features are not fin
Spacing attributes are only accessible through an "Insert" menu. A toolbar to insert spacing attributes may be added in the future.
There is no visible widget for switching between subpages, use the `PageUp` and `PageDown` keys for this.
Keymapping between ASCII and Teletext character sets is not yet implemented e.g. in English pressing the hash key will type a pound sign instead, and in other languages the square and curly brackets keys need to be pressed to obtain the accented characters.
The following X/26 enhancement triplets are not rendered by the editor, although the list is fully aware of them.

View File

@@ -29,6 +29,7 @@
#include <QSettings>
#include <QStatusBar>
#include <QToolBar>
#include <QToolButton>
#include <iostream>
#include "mainwindow.h"
@@ -589,10 +590,32 @@ void MainWindow::zoomReset()
void MainWindow::createStatusBar()
{
m_cursorStatus = new QLabel("Subpage 1/1 row 1 column 1");
statusBar()->insertWidget(0, m_cursorStatus);
m_levelSelect = new QLabel("Level");
statusBar()->addPermanentWidget(m_levelSelect);
QLabel *subPageLabel = new QLabel("Subpage");
statusBar()->insertWidget(0, subPageLabel);
m_previousSubPageButton = new QToolButton;
m_previousSubPageButton->setMinimumSize(subPageLabel->height(), subPageLabel->height());
m_previousSubPageButton->setMaximumSize(subPageLabel->height(), subPageLabel->height());
m_previousSubPageButton->setAutoRaise(true);
m_previousSubPageButton->setArrowType(Qt::LeftArrow);
statusBar()->insertWidget(1, m_previousSubPageButton);
connect(m_previousSubPageButton, &QToolButton::clicked, m_textWidget->document(), &TeletextDocument::selectSubPagePrevious);
m_subPageLabel = new QLabel("1/1");
statusBar()->insertWidget(2, m_subPageLabel);
m_nextSubPageButton = new QToolButton;
m_nextSubPageButton->setMinimumSize(subPageLabel->height(), subPageLabel->height());
m_nextSubPageButton->setMaximumSize(subPageLabel->height(), subPageLabel->height());
m_nextSubPageButton->setAutoRaise(true);
m_nextSubPageButton->setArrowType(Qt::RightArrow);
statusBar()->insertWidget(3, m_nextSubPageButton);
connect(m_nextSubPageButton, &QToolButton::clicked, m_textWidget->document(), &TeletextDocument::selectSubPageNext);
m_cursorPositionLabel = new QLabel("Row 1 Column 1");
statusBar()->insertWidget(4, m_cursorPositionLabel);
statusBar()->addPermanentWidget(new QLabel("Level"));
QRadioButton *level1 = new QRadioButton("1");
QRadioButton *level15 = new QRadioButton("1.5");
@@ -838,12 +861,14 @@ MainWindow *MainWindow::findMainWindow(const QString &fileName) const
void MainWindow::updateCursorPosition()
{
m_cursorStatus->setText(QString("Subpage %1/%2 row %3 column %4").arg(m_textWidget->document()->currentSubPageIndex()+1).arg(m_textWidget->document()->numberOfSubPages()).arg(m_textWidget->document()->cursorRow()).arg(m_textWidget->document()->cursorColumn()));
m_cursorPositionLabel->setText(QString("Row %1 Column %2").arg(m_textWidget->document()->cursorRow()).arg(m_textWidget->document()->cursorColumn()));
}
void MainWindow::updatePageWidgets()
{
updateCursorPosition();
m_subPageLabel->setText(QString("%1/%2").arg(m_textWidget->document()->currentSubPageIndex()+1).arg(m_textWidget->document()->numberOfSubPages()));
m_previousSubPageButton->setEnabled(!(m_textWidget->document()->currentSubPageIndex() == 0));
m_nextSubPageButton->setEnabled(!(m_textWidget->document()->currentSubPageIndex() == (m_textWidget->document()->numberOfSubPages()) - 1));
m_pageOptionsDockWidget->updateWidgets();
m_pageEnhancementsDockWidget->updateWidgets();
m_x26DockWidget->loadX26List();

View File

@@ -27,6 +27,7 @@
#include <QGraphicsView>
#include <QMainWindow>
#include <QLabel>
#include <QToolButton>
#include "mainwidget.h"
#include "pageenhancementsdockwidget.h"
@@ -110,7 +111,8 @@ private:
QAction *m_borderActs[3];
QAction *m_aspectRatioActs[4];
QLabel *m_cursorStatus, *m_levelSelect;
QLabel *m_subPageLabel, *m_cursorPositionLabel;
QToolButton *m_previousSubPageButton, *m_nextSubPageButton;
QString m_curFile;
bool m_isUntitled;