-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser.h
81 lines (65 loc) · 2.08 KB
/
browser.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
// Copyright (c) 2021-2023, K9spud LLC.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef BROWSER_H
#define BROWSER_H
#include <QObject>
#include <QVector>
#include <QSocketNotifier>
class BrowserWindow;
class QSqlQuery;
class Browser : public QObject
{
Q_OBJECT
public:
explicit Browser(QObject *parent = nullptr);
~Browser();
struct WindowHash
{
int windowId;
QString title;
};
QVector<WindowHash> inactiveWindows();
enum WindowStatus
{
Inactive = 0,
Active = 1,
Maximized =1<<2
};
void restoreWindows();
void loadWindows(QSqlQuery& windowQuery, QSqlQuery& tabQuery);
void loadWindow(int windowId);
QVector<BrowserWindow*> windows;
BrowserWindow* createWindow(int windowId = -1);
void closeAll();
int createWindowId();
void saveWindow(BrowserWindow* window, bool active = true);
void discardWindow(int windowId);
// Unix signal handlers
static void unixSIGHUP(int unused);
static void unixSIGTERM(int unused);
public slots:
// Qt signal handlers
void handleSIGHUP(void);
void handleSIGTERM(void);
void saveAllWindows();
signals:
private:
QSocketNotifier* sighupNotifier;
QSocketNotifier* sigtermNotifier;
bool discardWindow(int windowId, QSqlQuery& query);
void saveWindow(BrowserWindow* window, bool active, QSqlQuery& qwindow, QSqlQuery& query);
};
#endif // BROWSER_H