File: fileviewer.h

package info (click to toggle)
codequery 0.18.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,312 kB
  • ctags: 2,215
  • sloc: cpp: 18,496; xml: 16,576; perl: 244; makefile: 11
file content (153 lines) | stat: -rw-r--r-- 3,928 bytes parent folder | download
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
149
150
151
152
153

/*
 * CodeQuery
 * Copyright (C) 2013-2016 ruben2020 https://github.com/ruben2020/
 * 
 * This program 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 2 of the License, or
 * (at your option) any later version.
 * 
 * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

#ifndef FILEVIEWER_H_CQ
#define FILEVIEWER_H_CQ

#ifdef USE_QT5
#include <QtWidgets>
#else
#include <QtGui>
#endif

#include "sqlquery.h"
Q_DECLARE_METATYPE(sqlqueryresultlist*)


class mainwindow;
class QsciScintilla;
class QsciLexer;


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;
QLabel *m_labelFilePath;
QsciScintilla *m_textEditSource;
QListWidget *m_listWidgetFunc;
QComboBox *m_comboBoxFuncListSort;
QString m_externalEditorPath;
QFont m_textEditSourceFont;
QsciLexer* m_lexer;
int m_fontsize;
QString m_theme;

fileviewer(mainwindow* pmw);
~fileviewer();
void init(void);
void updateTextEdit(void);
void updateFilePathLabel(void);
void handleFileCannotBeOpenedCase(void);

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(QString annotstr);
void recvFuncList(sqlqueryresultlist* reslist);
void funcItemSelected(QListWidgetItem * curitem, QListWidgetItem * previtem);
void FuncListSort_indexChanged(const int& idx);

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;
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(const char* langstr, int lang);

};


#endif