-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
89 lines (79 loc) · 2.19 KB
/
mainwindow.h
File metadata and controls
89 lines (79 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/////////////////////////////////////////////////////////////////////////////
// Name: mainwindow.h
// Purpose: The main window (header)
// Author: Jan Buchholz
// Created: 2025-11-23
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QMainWindow>
#include <QToolBar>
#include <QSplitter>
#include <QCloseEvent>
#include <QFontComboBox>
#include <QTextBrowser>
#include <QTextEdit>
#include <QTimer>
#include "dialogs.h"
#include "scrollsynchronizer.h"
#include "synchelper.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
void closeEvent(QCloseEvent *e);
private:
Ui::MainWindow *ui;
QToolBar *m_mainToolBar;
QStatusBar *m_statusBar;
QTextBrowser *m_mdViewer;
QTextEdit *m_mdEditor;
QSplitter *m_mainSplitter;
QFontComboBox *m_fontComboBox;
QComboBox *m_fontSizeBox;
ScrollSynchronizer *mc_synchronizer;
QString m_lastFolder;
QString m_fileName;
QTimer *m_timer;
Dialogs *mc_dialogs;
SyncHelper *mc_synchelper;
bool m_sync;
bool m_dirty;
const QStringList fontSizeList = {"8", "9", "10", "11", "12", "13", "14", "16", "18"};
void createMdViewer();
void createMdEditor();
void createToolBar();
void createSplitter();
void createStatusBar();
void populateMainMenu();
void setConnections();
void savePreferences();
void loadPreferences();
void fileNew();
bool fileOpen();
bool fileSave(bool saveAs = false);
void setSync(bool enabled);
private slots:
void onNewFile();
void onOpenFile();
void onSaveFile();
void onSaveFileAs();
void onAppInfo();
void onAppQuit();
void onEditCopy();
void onEditCut();
void onEditPaste();
void onEditSelectAll();
void onEditUndo();
void onEditRedo();
void onEditFormat();
void onOptionsSync(bool);
void onCurrentFontChanged(const QFont);
void onCurrentTextChanged(const QString);
void onTextChanged();
};