-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogcatReader.h
57 lines (48 loc) · 1.32 KB
/
LogcatReader.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
#ifndef LOGCATREADER_H
#define LOGCATREADER_H
#include <gtkmm.h>
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <thread>
#include <atomic>
#include <cstdio>
#include <queue>
#include <mutex>
class LogcatReader : public Gtk::Window {
public:
LogcatReader();
virtual ~LogcatReader();
private:
// Widgets
Gtk::Box vbox;
Gtk::ComboBoxText logTypes;
Gtk::Button startButton, exitButton, searchButton;
Gtk::Entry searchEntry;
Gtk::TextView logView;
Gtk::ScrolledWindow scrolledWindow;
Gtk::Frame logFrame;
Gtk::Box buttonBox, searchBox;
// File stream for log
FILE* logFile;
std::thread logThread;
std::atomic<bool> running;
Glib::Dispatcher dispatcher;
Glib::RefPtr<Gtk::TextBuffer> logBuffer;
Glib::RefPtr<Gtk::TextTag> timeTag, errorTag, warningTag, infoTag, typeTag, searchTag;
// Log queue and mutex for thread-safe access
std::queue<std::string> logQueue;
std::mutex logMutex;
// Signal handlers
void onStartClicked();
void onExitClicked();
void onLogTypeChanged();
void onSearchClicked();
// Other methods
void readLogFile();
void onDispatcher();
// Helper function to get log type filter
std::string getLogType(const std::string& selectedOption);
};
#endif // LOGCATREADER_H