-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathfileviewer.h
148 lines (127 loc) · 3.57 KB
/
fileviewer.h
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* CodeQuery
* Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#ifndef FILEVIEWER_H_CQ
#define FILEVIEWER_H_CQ
#include <QtGlobal>
#include <QtWidgets>
#include "sqlquery.h"
Q_DECLARE_METATYPE(sqlqueryresultlist*)
class mainwindow;
class ScintillaEdit;
class filedata
{
public:
QString filename;
QString linenum;
int fileid;
filedata();
filedata(const QString& fn, const QString& ln, const int& fi);
filedata(const filedata& fd);
bool compare(const filedata& fd);
bool compareFilePathOnly(const filedata& fd);
bool compareFileNameOnly(const filedata& fd);
filedata& operator=(const filedata& fd);
};
enum langtypes
{
enHighlightNone = 0,
enHighlightCPP,
enHighlightPython,
enHighlightJava,
enHighlightRuby,
enHighlightGo,
enHighlightJavascript
};
class fileviewer : public QObject
{
Q_OBJECT
public:
QPushButton *m_pushButtonPrev;
QPushButton *m_pushButtonNext;
QPushButton *m_pushButtonOpenInEditor;
QPushButton *m_pushButtonPaste;
QPushButton *m_pushButtonGoToLine;
QPushButton *m_pushButtonTextShrink;
QPushButton *m_pushButtonTextEnlarge;
QCheckBox *m_checkBoxSymbolOnly;
QLineEdit *m_labelFilePath;
ScintillaEdit *m_textEditSource;
QListWidget *m_listWidgetFunc;
QComboBox *m_comboBoxFuncListSort;
QString m_externalEditorPath;
QFont m_textEditSourceFont;
void *m_lexer;
int m_fontsize;
QString m_theme;
fileviewer(mainwindow* pmw);
~fileviewer();
void init(void);
void updateTextEdit(void);
void updateFilePathLabel(void);
void handleFileCannotBeOpenedCase(void);
QString checkFontFamily(QString fontname);
public slots:
void fileToBeOpened(QString filename, QString linenum, int fileid);
void AbleToCopy(bool copy);
void GoToLine_ButtonClick(bool checked);
void Paste_ButtonClick(bool checked);
void Prev_ButtonClick(bool checked);
void Next_ButtonClick(bool checked);
void OpenInEditor_ButtonClick(bool checked);
void TextShrink_ButtonClick(bool checked);
void TextEnlarge_ButtonClick(bool checked);
void OptionsExtEditor_Triggered(bool checked);
void fileViewSettings_Triggered(bool checked);
void clearList();
void recvDBtimestamp(QDateTime dt);
void fontSelectionTemporary(const QString &fonttxt);
void themeSelectionTemporary(const QString &themetxt);
void tabWidthSelectionTemporary(const QString &width);
void annotate(QStringList annotstrLst);
void recvFuncList(sqlqueryresultlist* reslist);
void funcItemSelected(QListWidgetItem * curitem);
void FuncListSort_indexChanged(const int& idx);
void filePathLabelTextResized();
void repaintWidget();
signals:
void searchCopiedText();
void searchCopiedTextSymbolOnly();
void requestAnnotation(QString searchstr);
void requestFuncList_filename(QString filename);
void requestFuncList_fileid(int fileid);
private:
mainwindow *mw;
QVector<filedata> m_fileDataList;
QVector<filedata>::iterator m_iter;
QDateTime m_DBtimestamp;
bool m_timestampMismatchWarned;
QStringList m_fontlist;
QString m_fonttemp;
QString m_themetemp;
QString m_themelast;
QString m_filepathlabeltextfull;
int m_currentlang;
int m_fontwidthtemp;
int m_markerhandle;
int m_markerhandle2;
long m_currentline;
long m_annotline;
sqlqueryresultlist m_funclist;
void createFontList(void);
void textSizeChange(int n);
void highlightLine(unsigned int num = 0);
void setLexer(int lang = -1);
void replaceLexer(int sclang, int lang);
void clearTextEdit(void);
void braceMatchCheck(void);
void updateFuncList(void);
void setFilePathLabelText(QString text);
};
#endif