Files
QTeletextMaker/mainwindow.h

138 lines
3.5 KiB
C
Raw Normal View History

2020-09-06 16:47:38 +01:00
/*
2021-12-31 21:40:36 +00:00
* Copyright (C) 2020-2022 Gavin MacGregor
2020-09-06 16:47:38 +01:00
*
* This file is part of QTeletextMaker.
*
* QTeletextMaker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QTeletextMaker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QTeletextMaker. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QCheckBox>
#include <QComboBox>
#include <QGraphicsProxyWidget>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QMainWindow>
#include <QLabel>
#include <QPushButton>
#include <QToolButton>
2020-09-06 16:47:38 +01:00
#include "mainwidget.h"
#include "pagecomposelinksdockwidget.h"
#include "pageenhancementsdockwidget.h"
2020-09-06 16:47:38 +01:00
#include "pageoptionsdockwidget.h"
#include "palettedockwidget.h"
#include "x26dockwidget.h"
class QAction;
class QMenu;
class TeletextWidget;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
explicit MainWindow(const QString &fileName);
void tile(const QMainWindow *previous);
protected:
void closeEvent(QCloseEvent *event) override;
private slots:
void newFile();
void open();
bool save();
bool saveAs();
void exportT42();
void exportZXNet();
void exportEditTF();
void exportPNG();
2021-09-06 22:07:14 +01:00
void exportM29();
2020-09-06 16:47:38 +01:00
void updateRecentFileActions();
void openRecentFile();
void about();
void updatePageWidgets();
void updateCursorPosition();
2020-10-27 15:17:54 +00:00
void insertRow(bool);
void deleteRow();
2020-09-06 16:47:38 +01:00
void insertSubPage(bool, bool);
2020-12-15 21:57:42 +00:00
void deleteSubPage();
2020-09-06 16:47:38 +01:00
void setSceneDimensions();
void setBorder(int);
void setAspectRatio(int);
2021-06-07 21:58:14 +01:00
void setSmoothTransform(bool);
2020-09-06 16:47:38 +01:00
void zoomIn();
void zoomOut();
void zoomReset();
void toggleInsertMode();
2020-09-06 16:47:38 +01:00
private:
enum { m_MaxRecentFiles = 10 };
2021-06-03 22:26:54 +01:00
const float aspectRatioHorizontalScaling[4] = { 0.6, 0.6, 0.8, 0.5 };
2020-09-06 16:47:38 +01:00
void init();
void createActions();
void createStatusBar();
void readSettings();
void writeSettings();
bool maybeSave();
void openFile(const QString &fileName);
void loadFile(const QString &fileName);
static bool hasRecentFiles();
void prependToRecentFiles(const QString &fileName);
void setRecentFilesVisible(bool visible);
bool saveFile(const QString &fileName);
void setCurrentFile(const QString &fileName);
static QString strippedName(const QString &fullFileName);
MainWindow *findMainWindow(const QString &fileName) const;
TeletextWidget *m_textWidget;
LevelOneScene *m_textScene;
2020-09-06 16:47:38 +01:00
QGraphicsView *m_textView;
int m_viewBorder, m_viewAspectRatio, m_viewZoom;
2021-06-07 21:58:14 +01:00
bool m_viewSmoothTransform;
PageOptionsDockWidget *m_pageOptionsDockWidget;
PageEnhancementsDockWidget *m_pageEnhancementsDockWidget;
X26DockWidget *m_x26DockWidget;
PaletteDockWidget *m_paletteDockWidget;
PageComposeLinksDockWidget *m_pageComposeLinksDockWidget;
2020-09-06 16:47:38 +01:00
QAction *m_recentFileActs[m_MaxRecentFiles];
QAction *m_recentFileSeparator;
QAction *m_recentFileSubMenuAct;
2020-12-15 21:57:42 +00:00
QAction *m_deleteSubPageAction;
2020-09-06 16:47:38 +01:00
QAction *m_borderActs[3];
QAction *m_aspectRatioActs[4];
2021-06-07 21:58:14 +01:00
QAction *m_smoothTransformAction;
2020-09-06 16:47:38 +01:00
QLabel *m_subPageLabel, *m_cursorPositionLabel;
QToolButton *m_previousSubPageButton, *m_nextSubPageButton;
QPushButton *m_insertModePushButton;
2020-12-20 19:38:23 +00:00
QRadioButton *m_levelRadioButton[4];
2020-09-06 16:47:38 +01:00
QString m_curFile;
bool m_isUntitled;
};
#endif