2 |
andreas |
1 |
/*
|
21 |
andreas |
2 |
* Copyright (C) 2020, 2021 by Andreas Theofilu <andreas@theosys.at>
|
2 |
andreas |
3 |
*
|
|
|
4 |
* This program is free software; you can redistribute it and/or modify
|
|
|
5 |
* it under the terms of the GNU General Public License as published by
|
|
|
6 |
* the Free Software Foundation; either version 3 of the License, or
|
|
|
7 |
* (at your option) any later version.
|
|
|
8 |
*
|
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
* GNU General Public License for more details.
|
|
|
13 |
*
|
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
|
15 |
* along with this program; if not, write to the Free Software Foundation,
|
|
|
16 |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
17 |
*/
|
|
|
18 |
#ifndef __TQTMAIN_H__
|
|
|
19 |
#define __TQTMAIN_H__
|
|
|
20 |
|
|
|
21 |
#include <QMainWindow>
|
14 |
andreas |
22 |
#include <QMetaType>
|
2 |
andreas |
23 |
|
3 |
andreas |
24 |
#include "tpagemanager.h"
|
5 |
andreas |
25 |
#include "tobject.h"
|
2 |
andreas |
26 |
#include "terror.h"
|
|
|
27 |
|
21 |
andreas |
28 |
extern bool prg_stopped;
|
|
|
29 |
|
2 |
andreas |
30 |
QT_BEGIN_NAMESPACE
|
|
|
31 |
class QAction;
|
|
|
32 |
class QMenu;
|
|
|
33 |
class QSessionManager;
|
5 |
andreas |
34 |
class QLabel;
|
|
|
35 |
class QWidget;
|
14 |
andreas |
36 |
class QByteArray;
|
10 |
andreas |
37 |
class QMouseEvent;
|
15 |
andreas |
38 |
class QMoveEvent;
|
|
|
39 |
class QEvent;
|
2 |
andreas |
40 |
QT_END_NAMESPACE
|
|
|
41 |
|
14 |
andreas |
42 |
Q_DECLARE_METATYPE(size_t)
|
|
|
43 |
|
3 |
andreas |
44 |
int qtmain(int argc, char **argv, TPageManager *pmanager);
|
2 |
andreas |
45 |
|
5 |
andreas |
46 |
class MainWindow : public QMainWindow, TObject
|
2 |
andreas |
47 |
{
|
14 |
andreas |
48 |
Q_OBJECT
|
2 |
andreas |
49 |
|
5 |
andreas |
50 |
public:
|
|
|
51 |
MainWindow();
|
2 |
andreas |
52 |
|
14 |
andreas |
53 |
signals:
|
|
|
54 |
void sigDisplayButton(ulong handle, ulong parent, QByteArray buffer, int width, int height, int pixline, int left, int top);
|
|
|
55 |
void sigSetPage(ulong handle, int width, int height);
|
|
|
56 |
void sigSetSubPage(ulong handle, int left, int top, int width, int height);
|
|
|
57 |
void sigSetBackground(ulong handle, QByteArray image, size_t rowBytes, ulong color);
|
|
|
58 |
void sigSetText(ulong handle, const std::string& text, const std::string& font, const std::string& family, int size, int x, int y, ulong color, ulong effectColor, FONT_STYLE style, Button::TEXT_ORIENTATION ori, Button::TEXT_EFFECT effect, bool ww);
|
|
|
59 |
void sigDropPage(ulong handle);
|
|
|
60 |
void sigDropSubPage(ulong handle);
|
21 |
andreas |
61 |
void sigPlayVideo(ulong handle, ulong parent, int left, int top, int width, int height, const std::string& url, const std::string& user, const std::string& pw);
|
14 |
andreas |
62 |
|
5 |
andreas |
63 |
protected:
|
|
|
64 |
void closeEvent(QCloseEvent *event) override;
|
10 |
andreas |
65 |
void mousePressEvent(QMouseEvent* event) override;
|
|
|
66 |
void mouseReleaseEvent(QMouseEvent* event) override;
|
15 |
andreas |
67 |
bool eventFilter(QObject *obj, QEvent *ev) override;
|
2 |
andreas |
68 |
|
5 |
andreas |
69 |
private slots:
|
|
|
70 |
void settings();
|
|
|
71 |
void about();
|
2 |
andreas |
72 |
#ifndef QT_NO_SESSIONMANAGER
|
5 |
andreas |
73 |
void commitData(QSessionManager &);
|
2 |
andreas |
74 |
#endif
|
14 |
andreas |
75 |
void displayButton(ulong handle, ulong parent, QByteArray buffer, int width, int height, int pixline, int left, int top);
|
5 |
andreas |
76 |
void setPage(ulong handle, int width, int height);
|
|
|
77 |
void setSubPage(ulong hanlde, int left, int top, int width, int height);
|
14 |
andreas |
78 |
void setBackground(ulong handle, QByteArray image, size_t rowBytes, ulong color);
|
7 |
andreas |
79 |
void setText(ulong handle, const std::string& text, const std::string& font, const std::string& family, int size, int x, int y, ulong color, ulong effectColor, FONT_STYLE style, Button::TEXT_ORIENTATION ori, Button::TEXT_EFFECT effect, bool ww);
|
11 |
andreas |
80 |
void dropPage(ulong handle);
|
|
|
81 |
void dropSubPage(ulong handle);
|
21 |
andreas |
82 |
void playVideo(ulong handle, ulong parent, int left, int top, int width, int height, const std::string& url, const std::string& user, const std::string& pw);
|
13 |
andreas |
83 |
|
14 |
andreas |
84 |
private:
|
|
|
85 |
void createActions();
|
|
|
86 |
void writeSettings();
|
|
|
87 |
|
|
|
88 |
void _displayButton(ulong handle, ulong parent, unsigned char* buffer, int width, int height, int pixline, int left, int top);
|
|
|
89 |
void _setPage(ulong handle, int width, int height);
|
|
|
90 |
void _setSubPage(ulong handle, int left, int top, int width, int height);
|
|
|
91 |
void _setBackground(ulong handle, unsigned char *image, size_t size, size_t rowBytes, ulong color);
|
|
|
92 |
void _setText(ulong handle, const std::string& text, const std::string& font, const std::string& family, int size, int x, int y, ulong color, ulong effectColor, FONT_STYLE style, Button::TEXT_ORIENTATION ori, Button::TEXT_EFFECT effect, bool ww);
|
|
|
93 |
void _dropPage(ulong handle);
|
|
|
94 |
void _dropSubPage(ulong handle);
|
21 |
andreas |
95 |
void _playVideo(ulong handle, ulong parent, int left, int top, int width, int height, const std::string& url, const std::string& user, const std::string& pw);
|
14 |
andreas |
96 |
|
5 |
andreas |
97 |
bool settingsChanged{false};
|
13 |
andreas |
98 |
QWidget *mBackground{nullptr}; // The background of the visible page
|
21 |
andreas |
99 |
std::string mVideoURL; // If the button is a video, this is the URL where it plays from.
|
2 |
andreas |
100 |
};
|
|
|
101 |
|
|
|
102 |
#endif
|