ReactOS 0.4.15-dev-8100-g1887773
QMyMainWindow Class Reference

#include <qtewin.h>

Inheritance diagram for QMyMainWindow:
Collaboration diagram for QMyMainWindow:

Public Slots

void dataReceived ()
 
void soundSend ()
 
void MemuClicked (int)
 
void dataReceived ()
 
void soundSend ()
 

Public Member Functions

 QMyMainWindow ()
 
 ~QMyMainWindow ()
 
void paintEvent (QPaintEvent *)
 
void mouseMoveEvent (QMouseEvent *)
 
void mousePressEvent (QMouseEvent *)
 
void mouseReleaseEvent (QMouseEvent *)
 
void wheelEvent (QWheelEvent *)
 
void closeEvent (QCloseEvent *)
 
void timerEvent (QTimerEvent *)
 
 QMyMainWindow ()
 
 ~QMyMainWindow ()
 
void paintEvent (QPaintEvent *)
 
void mouseMoveEvent (QMouseEvent *)
 
void mousePressEvent (QMouseEvent *)
 
void mouseReleaseEvent (QMouseEvent *)
 
void wheelEvent (QWheelEvent *)
 
void keyPressEvent (QKeyEvent *)
 
void keyReleaseEvent (QKeyEvent *)
 
void closeEvent (QCloseEvent *)
 
bool event (QEvent *)
 

Public Attributes

QPopupMenu * PopupMenu
 
int timer_id
 
int mx
 
int my
 

Detailed Description

Definition at line 84 of file qtewin.h.

Constructor & Destructor Documentation

◆ QMyMainWindow() [1/2]

QMyMainWindow::QMyMainWindow ( )

Definition at line 824 of file qtewin.cpp.

824 : QWidget(g_SV->viewport())
825{
826 PopupMenu = new QPopupMenu(this);
827 PopupMenu->insertItem("Right click", 1, 0);
828 PopupMenu->insertItem("Toggle fullscreen", 2, 1);
829 PopupMenu->insertItem("Reset keyboard", 3, 2);
830 PopupMenu->insertItem("Double click", 4, 3);
831 connect(PopupMenu, SIGNAL(activated(int)), this, SLOT(MemuClicked(int)));
832}
QPopupMenu * PopupMenu
Definition: qtewin.h:102
void MemuClicked(int)
Definition: qtewin.cpp:887
static UINT activated
Definition: msctf.c:70
static QMyScrollView * g_SV
Definition: qtewin.cpp:117

◆ ~QMyMainWindow() [1/2]

QMyMainWindow::~QMyMainWindow ( )

Definition at line 835 of file qtewin.cpp.

836{
837 delete PopupMenu;
838}

◆ QMyMainWindow() [2/2]

QMyMainWindow::QMyMainWindow ( )

◆ ~QMyMainWindow() [2/2]

QMyMainWindow::~QMyMainWindow ( )

Member Function Documentation

◆ closeEvent() [1/2]

void QMyMainWindow::closeEvent ( QCloseEvent *  e)

Definition at line 1205 of file qtewin.cpp.

1206{
1207 e->accept();
1208}
#define e
Definition: ke_i.h:82

◆ closeEvent() [2/2]

void QMyMainWindow::closeEvent ( QCloseEvent *  )

◆ dataReceived [1/2]

void QMyMainWindow::dataReceived ( )
slot

Definition at line 1211 of file qtewin.cpp.

1212{
1214 g_SV->close();
1215#ifdef WITH_RDPSND
1216 if (g_dsp_busy)
1217 {
1218 if (g_SoundNotifier == 0)
1219 {
1220 g_SoundNotifier = new QSocketNotifier(g_dsp_fd, QSocketNotifier::Write,
1221 g_MW);
1222 g_MW->connect(g_SoundNotifier, SIGNAL(activated(int)), g_MW,
1223 SLOT(soundSend()));
1224 }
1225 else
1226 {
1227 if (!g_SoundNotifier->isEnabled())
1228 g_SoundNotifier->setEnabled(true);
1229 }
1230 }
1231#endif
1232}
RD_BOOL rdp_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
Definition: rdp.c:1695
void soundSend()
Definition: qtewin.cpp:1235
static QMyMainWindow * g_MW
Definition: qtewin.cpp:116
static uint32 g_ext_disc_reason
Definition: uimain.c:72
static int g_deactivated
Definition: uimain.c:71

◆ dataReceived [2/2]

void QMyMainWindow::dataReceived ( )
slot

◆ event()

bool QMyMainWindow::event ( QEvent *  e)

Definition at line 472 of file qtwin.cpp.

473{
474 return QWidget::event(e);
475}

◆ keyPressEvent()

void QMyMainWindow::keyPressEvent ( QKeyEvent *  e)

Definition at line 428 of file qtwin.cpp.

429{
430 if (!g_UpAndRunning)
431 return;
432 int ScanCode = GetScanCode(e);
433 if (ScanCode != 0)
434 {
436 e->accept();
437 }
438}
UINT ScanCode
Definition: VirtualKey.c:24
#define RDP_KEYPRESS
Definition: constants.h:251
@ RDP_INPUT_SCANCODE
Definition: constants.h:234
void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
Definition: rdp.c:551
void GetScanCode(QKeyEvent *e, int *ScanCode, int *code)
Definition: qtewin.cpp:518
static int g_UpAndRunning
Definition: qtwin.cpp:70

◆ keyReleaseEvent()

void QMyMainWindow::keyReleaseEvent ( QKeyEvent *  e)

Definition at line 441 of file qtwin.cpp.

442{
443 if (!g_UpAndRunning)
444 {
445 return;
446 }
447 int ScanCode = GetScanCode(e);
448 if (ScanCode != 0)
449 {
451 e->accept();
452 }
453}
#define RDP_KEYRELEASE
Definition: constants.h:252

◆ MemuClicked

void QMyMainWindow::MemuClicked ( int  MenuID)
slot

Definition at line 887 of file qtewin.cpp.

888{
889 QWidget * Desktop;
890 int dw;
891 int dh;
892
893 if (MenuID == 1) // right click
894 {
896 rd(c2sx(mx)), rd(c2sy(my)));
898 rd(c2sx(mx)), rd(c2sy(my)));
899 }
900 else if (MenuID == 2) // toggle full screen
901 {
902 g_fullscreen = ~g_fullscreen;
903 if (g_fullscreen)
904 {
905 Desktop = g_App->desktop();
906 dw = Desktop->width();
907 dh = Desktop->height();
908 if (dw == g_client_width && dh == g_client_height)
909 g_MW->resize(g_client_width - 4, g_client_height - 4);
910 g_SV->showFullScreen();
911 }
912 else
913 {
914 g_SV->showNormal();
915 g_SV->showMaximized();
917 }
918 }
919 else if (MenuID == 3) // reset keyboard
920 {
921 rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, 0x2a, 0); // shift
922 rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, 0x1d, 0); // control
924 }
925 else if (MenuID == 4) // double click
926 {
928 rd(c2sx(mx)), rd(c2sy(my)));
930 rd(c2sx(mx)), rd(c2sy(my)));
932 rd(c2sx(mx)), rd(c2sy(my)));
934 rd(c2sx(mx)), rd(c2sy(my)));
935 }
936}
#define MOUSE_FLAG_DOWN
Definition: constants.h:260
#define MOUSE_FLAG_BUTTON1
Definition: constants.h:255
#define MOUSE_FLAG_BUTTON2
Definition: constants.h:256
@ RDP_INPUT_MOUSE
Definition: constants.h:235
static int g_fullscreen
Definition: win32.c:51
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
int c2sx(int cx)
Definition: qtewin.cpp:847
static QApplication * g_App
Definition: qtewin.cpp:114
static int g_client_width
Definition: qtewin.cpp:97
int c2sy(int cy)
Definition: qtewin.cpp:856
static int g_client_height
Definition: qtewin.cpp:98
int rd
Definition: scanf.h:134

Referenced by QMyMainWindow().

◆ mouseMoveEvent() [1/2]

void QMyMainWindow::mouseMoveEvent ( QMouseEvent *  e)

Definition at line 939 of file qtewin.cpp.

940{
941 int x, y;
942
943 x = e->x();
944 y = e->y();
945 if (timer_id)
946 {
947 x = x - mx;
948 y = y - my;
949 if (x < -10 || x > 10 || y < -10 || y > 10)
950 {
951 killTimer(timer_id);
952 timer_id = 0;
953 }
954 }
956 c2sy(e->y()));
957}
#define MOUSE_FLAG_MOVE
Definition: constants.h:254
int timer_id
Definition: qtewin.h:103
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ mouseMoveEvent() [2/2]

void QMyMainWindow::mouseMoveEvent ( QMouseEvent *  )

◆ mousePressEvent() [1/2]

void QMyMainWindow::mousePressEvent ( QMouseEvent *  e)

Definition at line 960 of file qtewin.cpp.

961{
962 timer_id = startTimer(1000);
963 mx = e->x();
964 my = e->y();
965 if (e->button() == LeftButton)
967 c2sx(e->x()), c2sy(e->y()));
968 else if (e->button() == RightButton)
970 c2sx(e->x()), c2sy(e->y()));
971 else if (e->button() == MidButton)
973 c2sx(e->x()), c2sy(e->y()));
974}
#define MOUSE_FLAG_BUTTON3
Definition: constants.h:257
static void startTimer(void)
Definition: xmllint.c:460

◆ mousePressEvent() [2/2]

void QMyMainWindow::mousePressEvent ( QMouseEvent *  )

◆ mouseReleaseEvent() [1/2]

void QMyMainWindow::mouseReleaseEvent ( QMouseEvent *  e)

Definition at line 977 of file qtewin.cpp.

978{
979 killTimer(timer_id);
980 timer_id = 0;
981 if (e->button() == LeftButton)
983 c2sy(e->y()));
984 else if (e->button() == RightButton)
986 c2sy(e->y()));
987 else if (e->button() == MidButton)
989 c2sy(e->y()));
990}

◆ mouseReleaseEvent() [2/2]

void QMyMainWindow::mouseReleaseEvent ( QMouseEvent *  )

◆ paintEvent() [1/2]

void QMyMainWindow::paintEvent ( QPaintEvent *  pe)

Definition at line 1123 of file qtewin.cpp.

1124{
1125 QImage * Image;
1126 QPainter * Painter;
1127 QRect Rect;
1128 int i, j, w, h, l, t, pixel, r, g, b;
1129 uint8 * data;
1130 double sx, sy;
1131
1132 Image = 0;
1133 data = 0;
1134 if (!testWFlags(WRepaintNoErase))
1135 setWFlags(WRepaintNoErase);
1136 if (g_CM != NULL || g_server_bpp > 8)
1137 {
1138 sx = (double)g_client_width / (double)g_width;
1139 sy = (double)g_client_height / (double)g_height;
1140 Rect = pe->rect();
1141 l = rd(Rect.left() / sx);
1142 t = rd(Rect.top() / sy);
1143 w = rd(Rect.width() / sx);
1144 h = rd(Rect.height() / sy);
1145 if (w > 0 && h > 0)
1146 {
1147 if (g_server_bpp == 8 && g_CM->NumColors > 0)
1148 {
1149 w = (w + 3) & ~3;
1150 data = (uint8*)xmalloc(w * h);
1151 for (i = 0; i < h; i++)
1152 for (j = 0; j < w; j++)
1153 data[i * w + j] = GETPIXEL8(g_BS, l + j, t + i, g_width);
1154 Image = new QImage(data, w, h, 8,(QRgb*)g_CM->RGBColors,
1155 g_CM->NumColors, QImage::IgnoreEndian);
1156 }
1157 else if (g_server_bpp == 16)
1158 {
1159 w = (w + 3) & ~3;
1160 data = (uint8*)xmalloc(w * h * 4);
1161 for (i = 0; i < h; i++)
1162 for (j = 0; j < w; j++)
1163 {
1164 pixel = GETPIXEL16(g_BS, l + j, t + i, g_width);
1165 r = ((pixel >> 8) & 0xf8) | ((pixel >> 13) & 0x7);
1166 g = ((pixel >> 3) & 0xfc) | ((pixel >> 9) & 0x3);
1167 b = ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x7);
1168 pixel = ((r << 16) | (g << 8) | b);
1169 SETPIXEL32(data, j, i, w, pixel);
1170 }
1171 Image = new QImage(data, w, h, 32, NULL,
1172 0, QImage::IgnoreEndian);
1173 }
1174 else if (g_server_bpp == 24)
1175 {
1176 w = (w + 3) & ~3;
1177 data = (uint8*)xmalloc(w * h * 4);
1178 for (i = 0; i < h; i++)
1179 for (j = 0; j < w; j++)
1180 {
1181 pixel = GETPIXEL32(g_BS, l + j, t + i, g_width);
1182 r = (pixel >> 0) & 0xff;
1183 g = (pixel >> 8) & 0xff;
1184 b = (pixel >> 16) & 0xff;
1185 pixel = ((r << 16) | (g << 8) | b);
1186 SETPIXEL32(data, j, i, w, pixel);
1187 }
1188 Image = new QImage(data, w, h, 32, NULL,
1189 0, QImage::IgnoreEndian);
1190 }
1191 if (Image != 0)
1192 {
1193 Painter = new QPainter(this);
1194 Painter->scale(sx, sy);
1195 Painter->drawImage(l, t, *Image, 0, 0, w, h);
1196 delete Painter;
1197 delete Image;
1198 }
1199 xfree(data);
1200 }
1201 }
1202}
void xfree(void *mem)
Definition: uimain.c:758
void * xmalloc(int size)
Definition: uimain.c:747
int g_width
Definition: uimain.c:42
int g_height
Definition: uimain.c:43
unsigned char uint8
Definition: types.h:28
r l[0]
Definition: byte_order.h:168
#define NULL
Definition: types.h:112
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define b
Definition: ke_i.h:79
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
int g_server_bpp
Definition: nanoxwin.c:42
static struct QColorMap * g_CM
Definition: qtewin.cpp:118
#define GETPIXEL16(d, x, y, w)
Definition: qtewin.cpp:136
#define GETPIXEL32(d, x, y, w)
Definition: qtewin.cpp:137
#define GETPIXEL8(d, x, y, w)
Definition: qtewin.cpp:135
#define SETPIXEL32(d, x, y, w, v)
Definition: qtewin.cpp:140
static uint8 * g_BS
Definition: qtewin.cpp:119

◆ paintEvent() [2/2]

void QMyMainWindow::paintEvent ( QPaintEvent *  )

◆ soundSend [1/2]

void QMyMainWindow::soundSend ( )
slot

Definition at line 1235 of file qtewin.cpp.

1236{
1237#ifdef WITH_RDPSND
1238 g_SoundNotifier->setEnabled(false);
1239 wave_out_play();
1240 if (g_dsp_busy)
1241 {
1242 g_SoundNotifier->setEnabled(true);
1243 }
1244#endif
1245}
void wave_out_play(void)
Definition: rdpsnd_libao.c:174

Referenced by dataReceived().

◆ soundSend [2/2]

void QMyMainWindow::soundSend ( )
slot

◆ timerEvent()

void QMyMainWindow::timerEvent ( QTimerEvent *  e)

Definition at line 865 of file qtewin.cpp.

866{
867 QWidget::timerEvent(e);
868 if (e->timerId() == timer_id)
869 {
870 // send mouse up
872 rd(c2sx(mx)), rd(c2sy(my)));
873 // if in fullscreen, take it out or the menu won't work
874 if (g_fullscreen)
875 {
876 g_fullscreen = 0;
877 g_SV->showNormal();
878 g_SV->showMaximized();
879 }
880 else
881 PopupMenu->popup(mapToGlobal(QPoint(mx, my)));
882 }
883 killTimer(timer_id);
884}

◆ wheelEvent() [1/2]

void QMyMainWindow::wheelEvent ( QWheelEvent *  e)

Definition at line 993 of file qtewin.cpp.

994{
995 if (e->delta() > 0)
997 c2sy(e->y()));
998 else if (e->delta() < 0)
1000 c2sy(e->y()));
1001}
#define MOUSE_FLAG_BUTTON5
Definition: constants.h:259
#define MOUSE_FLAG_BUTTON4
Definition: constants.h:258

◆ wheelEvent() [2/2]

void QMyMainWindow::wheelEvent ( QWheelEvent *  )

Member Data Documentation

◆ mx

int QMyMainWindow::mx

Definition at line 104 of file qtewin.h.

Referenced by MemuClicked(), mouseMoveEvent(), mousePressEvent(), and timerEvent().

◆ my

int QMyMainWindow::my

Definition at line 105 of file qtewin.h.

Referenced by MemuClicked(), mouseMoveEvent(), mousePressEvent(), and timerEvent().

◆ PopupMenu

QPopupMenu* QMyMainWindow::PopupMenu

Definition at line 102 of file qtewin.h.

Referenced by QMyMainWindow(), timerEvent(), and ~QMyMainWindow().

◆ timer_id

int QMyMainWindow::timer_id

Definition at line 103 of file qtewin.h.

Referenced by mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and timerEvent().


The documentation for this class was generated from the following files: