Tatsh NFO Viewer 0.2.0
A simple NFO viewer.
Loading...
Searching...
No Matches
nfoviewer.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <QMainWindow>
5#include <QSettings>
6#include <QString>
7
8class QAction;
9class QCloseEvent;
10class QTextEdit;
11class QToolBar;
12
14class MainWindow : public QMainWindow {
16
17public:
18 MainWindow();
19
24 void openInitialFile(const QString &fileName);
25
26protected:
27 void closeEvent(QCloseEvent *event) override;
28
29private:
31 void createActions();
33 void createToolBar();
35 void readSettings();
37 void openFile();
42 void loadFile(const QString &fileName);
44 void applyLineSpacing();
52 int contentWindowWidth(qreal textWidthPixels) const;
58 void fitWidthToContents();
60 void applyDefaultWidth();
62 void applyViewSettings();
64 void applyWrapMode();
69 void onWrapToggled(bool enabled);
71 void openSettings();
76 int baseFontSize() const;
81 void changeTextSize(int deltaPixels);
83 void increaseTextSize();
85 void decreaseTextSize();
87 void resetTextSize();
92 void setCurrentFile(const QString &fileName);
94 void about();
99 void warn(const QString &message);
100
101 QTextEdit *text_;
102 QString currentFile_;
104 QString embeddedFontFamily_;
109 int fontSizeOffset_ = 0;
115 bool contentFittable_ = false;
120 bool wrapEnabled_ = false;
125 bool autoFitEnabled_ = true;
126 QToolBar *toolBar_;
127 QAction *openAct_;
128 QAction *copyAct_;
129 QAction *increaseTextSizeAct_;
130 QAction *decreaseTextSizeAct_;
131 QAction *resetTextSizeAct_;
132 QAction *wrapAct_;
133 QAction *settingsAct_;
134 QAction *aboutAct_;
135 QSettings settings_;
136};
void openInitialFile(const QString &fileName)
Load the given file on startup, or prompt for one when the path is empty.
Definition nfoviewer.cpp:173
QMainWindow(QWidget *parent, Qt::WindowFlags flags)
virtual bool event(QEvent *event) override
Q_OBJECTQ_OBJECT