-
Notifications
You must be signed in to change notification settings - Fork 0
/
nw_help.cpp
75 lines (62 loc) · 1.65 KB
/
nw_help.cpp
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
/****************************************************************************
**
** NightWatch Video Navigator
** 2020 (c) Vladi Belperchinov-Shabanski
** https://github.com/cade-vs/nightwatch
**
****************************************************************************/
#include <QKeyEvent>
#include <QResource>
#include "nw_help.h"
NWHelpBrowser::NWHelpBrowser()
: QTextBrowser()
{
};
void NWHelpBrowser::keyPressEvent ( QKeyEvent * e )
{
if( e->modifiers() & Qt::ALT )
{
switch( e->key() )
{
default: QTextBrowser::keyPressEvent( e ); break;
}
}
else
{
switch( e->key() )
{
case Qt::Key_Escape:
case Qt::Key_Return:
case Qt::Key_F4 : close(); break;
default:
if( e->text() == "" )
QTextBrowser::keyPressEvent( e );
else
switch( e->text().toLatin1().at( 0 ) )
{
default: QTextBrowser::keyPressEvent( e ); break;
}
}
}
};
NWHelpBrowser *help_browser;
void display_help( NWMainWindow* main_window )
{
if( help_browser == NULL )
help_browser = new NWHelpBrowser;
help_browser->setHtml( QString( QVariant( (const char*)(QResource( ":/nw_help.html" ).data()) ).toString() ) );
help_browser->setObjectName( "NWHelpWindow" );
help_browser->setWindowTitle( "NightWatch/4 Help" );
if( main_window )
{
help_browser->resize( main_window->size() );
help_browser->move( main_window->pos() );
}
else
{
help_browser->resize( 800, 600 );
help_browser->move( 100, 100 );
}
help_browser->show();
};