aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/logview/LogViewWindow.h
blob: dfe267426ee0d4ab9b74eb6326112ac9ff13bf18 (about) (plain) (blame)
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
#ifndef _LOGVIEWWINDOW_H_
#define _LOGVIEWWINDOW_H_
//=============================================================================
//
//   File : LogViewWindow.h
//   Creation date : Tue Apr 23 2002 18:05:59 by Juanjo Alvarez
//
//   This file is part of the KVIrc IRC client distribution
//   Copyright (C) 2002 Juanjo Alvarez
//   Copyright (C) 2002-2010 Szymon Stefanek (pragma at kvirc dot net)
//   Copyright (C) 2011 Elvio Basello (hellvis69 at gmail dot com)
//   Copyright (C) 2014 OmegaPhil (OmegaPhil at startmail dot com)
//
//   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, write to the Free Software Foundation,
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#include "LogFile.h"

#include "kvi_settings.h"
#include "KviWindow.h"
#include "KviModuleExtension.h"
#include "KviTalVBox.h"
#include "KviPointerList.h"

#include <QTreeWidget>

class KviLogViewWidget;
class LogListViewItem;
class LogListViewItemFolder;
class QProgressBar;
class QStringList;
class QLineEdit;
class QDateEdit;
class QTabWidget;
class QCheckBox;

class LogViewListView : public QTreeWidget
{
	Q_OBJECT
public:
	LogViewListView(QWidget *);
	~LogViewListView(){};

protected:
	void mousePressEvent(QMouseEvent * pEvent);
signals:
	void rightButtonPressed(QTreeWidgetItem *, QPoint);
};

class LogViewWindow : public KviWindow
{
	Q_OBJECT
public:
	LogViewWindow();
	~LogViewWindow();

protected:
	KviPointerList<LogFile> m_logList;

	LogViewListView * m_pListView;

	// Type filter
	QCheckBox * m_pShowChannelsCheck;
	QCheckBox * m_pShowQueryesCheck;
	QCheckBox * m_pShowConsolesCheck;
	QCheckBox * m_pShowOtherCheck;
	QCheckBox * m_pShowDccChatCheck;

	// Content filter
	QLineEdit * m_pFileNameMask;
	QLineEdit * m_pContentsMask;

	// Date/time mask
	QCheckBox * m_pEnableFromFilter;
	QCheckBox * m_pEnableToFilter;
	QDateEdit * m_pFromDateEdit;
	QDateEdit * m_pToDateEdit;

	QTabWidget * m_pTabWidget;
	KviTalVBox * m_pIndexTab;
	KviTalVBox * m_pLeftLayout;
	QWidget * m_pSearchTab;
	QPushButton * m_pFilterButton;
	QPushButton * m_pCancelButton;
	KviTalHBox * m_pBottomLayout;
	QProgressBar * m_pProgressBar;
	LogListViewItem * m_pLastCategory = nullptr;
	LogListViewItemFolder * m_pLastGroupItem = nullptr;
	QString m_szLastGroup;
	bool m_bAborted = false;
	QTimer * m_pTimer;
	QMenu * m_pExportLogPopup;

public:
	/**
	* \brief Exports the log and creates the file in the selected format
	* \param pLog The log file associated with the item selected in the popup
	* \param iId The id of the item in the popup
	* \param pszFile The buffer to store the exported log name
	* \return void
	*/
	void createLog(LogFile * pLog, int iId, QString * pszFile = nullptr);

protected:
	void exportLog(int iId);
	void recurseDirectory(const QString & szDir);
	void setupItemList();

	virtual QPixmap * myIconPtr();
	virtual void resizeEvent(QResizeEvent * pEvent);
	virtual void keyPressEvent(QKeyEvent * pEvent);
	virtual void fillCaptionBuffers();
	virtual void die();
	virtual QSize sizeHint() const;
protected slots:
	void rightButtonClicked(QTreeWidgetItem *, const QPoint &);
	void itemSelected(QTreeWidgetItem * pItem, QTreeWidgetItem *);
	void deleteCurrent();
	void applyFilter();
	void abortFilter();
	void cacheFileList();
	void filterNext();
	void exportLog(QAction * pAction);
};

#endif //_LOGVIEWWINDOW_H_