rdesktop/uiports/qtewin.cpp

1 line
66 KiB
C++
Raw Normal View History

/* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. User interface services - QT Emb System Copyright (C) Jay Sorg 2004-2005 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#define SHARP #ifdef SHARP #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif #include <qcursor.h> #include <qmainwindow.h> #include <qwidget.h> #include <qpainter.h> #include <qimage.h> #include <qsocketnotifier.h> #include <qscrollview.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qcombobox.h> #include <qlabel.h> #include <qfile.h> #include <qcheckbox.h> #include <qpopupmenu.h> #include <stdlib.h> #include <stdarg.h> // va_list va_start va_end #include <unistd.h> // gethostname #include <pwd.h> // getpwuid #include "../rdesktop.h" #include "qtewin.h" #define QT_OPTI /* types */ struct QColorMap { uint32 RGBColors[256]; uint32 NumColors; }; struct bitmap { int w; int h; uint8 * data; }; extern int g_tcp_port_rdp; extern int g_dsp_fd; #ifdef WITH_RDPSND BOOL g_rdpsnd = True; extern int g_dsp_busy; #endif int g_encryption = 1; int g_bitmap_cache = 1; int g_bitmap_cache_persist_enable = 0; int g_bitmap_cache_precache = 1; int g_use_rdp5 = 1; int g_desktop_save = 1; int g_bitmap_compression = 1; int g_rdp5_performanceflags = 0; int g_console_session = 0; int g_keylayout = 0x409; /* Defaults to US keyboard layout */ int g_width = 640; int g_height = 480; int g_server_bpp = 8; char g_hostname[16] = ""; char g_username[100] = ""; static int g_client_width = 640; static int g_client_height = 480; static uint32 g_flags = RDP_LOGON_NORMAL; static char g_server[64] = ""; static char g_domain[16] = ""; static char g_password[16] = ""; static char g_shell[128] = ""; static char g_directory[32] = ""; static int g_fullscreen = 0; static int g_global_sock = 0; static int g_deactivated = 0; static uint32 g_ext_disc_reason = 0; static QSocketNotifier * g_SocketNotifier = 0; static QSocketNotifier * g_SoundNotifier = 0; #ifdef SHARP static QPEApplication * g_App = 0; #else static QApplication * g_App = 0; #endif static QMyMainWindow * g_MW = 0; static QMyScrollView * g_SV = 0; static struct QColorMap * g_CM = 0; static uint8 * g_BS = 0; /* the screen data */ static int g_clipx = 0; static int g_clipy = 0; static int g_clipcx = 0; static int g_clipcy = 0; #define BPP ((g_server_bpp + 7) / 8) #define GETPIXEL8(d, x, y, w) (*(((uint8*)d) + ((y) * (w) + (x)))) #define GETPIXEL16(d, x, y, w) (*(((uint16*)d) + ((y) * (w) + (x)))) #define GETPIXEL32(d, x, y, w) (*(((uint32*)d) + ((y) * (w) + (x)))) #define SETPIXEL8(d, x, y, w, v) *(((uint8*)d) + ((y) * (w) + (x))) = v #define SETPIXEL16(d, x, y, w, v) *(((uint16*)d) + ((y) * (w) + (x))) = v #define SETPIXEL32(d, x, y, w, v) *(((uint32*)d) + ((y) * (w) + (x))) = v /******************************************************************************/ void CleanString(QString * Item) { int i; i = Item->length() - 1; while (i >= 0) { if (Item->at(i) == 10 || Item->at(i) == 13) Item->remove(i, 1); i--; } } /******************************************************************************/ QMyDialog::QMyDialog(QWidget * parent) : QDialog(parent, "Settings", true) { int i, j; char * home; char Text[256]; QString Line; QString ItemName; QString ItemValue; // resize dialog resize(230, 270); // main list box ListBox = new QListBox(this); ListBox-