author | zecke <zecke> | 2005-02-14 16:06:11 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-14 16:06:11 (UTC) |
commit | 277adb0af903b8bc2760c20891b664b763b667d9 (patch) (unidiff) | |
tree | 9d6b33b8ed71f9f280981630ad45f3f8ba33eafb | |
parent | 866b55b819809a7bc448ea8b9cf2597051518007 (diff) | |
download | opie-277adb0af903b8bc2760c20891b664b763b667d9.zip opie-277adb0af903b8bc2760c20891b664b763b667d9.tar.gz opie-277adb0af903b8bc2760c20891b664b763b667d9.tar.bz2 |
Remove stupid #ifdef
-rw-r--r-- | noncore/net/opierdesktop/qtwin.cpp | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/noncore/net/opierdesktop/qtwin.cpp b/noncore/net/opierdesktop/qtwin.cpp index d2a5ef1..e350bf6 100644 --- a/noncore/net/opierdesktop/qtwin.cpp +++ b/noncore/net/opierdesktop/qtwin.cpp | |||
@@ -1,192 +1,184 @@ | |||
1 | /* | 1 | /* |
2 | rdesktop: A Remote Desktop Protocol client. | 2 | rdesktop: A Remote Desktop Protocol client. |
3 | User interface services - X Window System | 3 | User interface services - X Window System |
4 | Copyright (C) Matthew Chapman 1999-2002 | 4 | Copyright (C) Matthew Chapman 1999-2002 |
5 | qt.cpp by Jay Sorg | 5 | qt.cpp by Jay Sorg |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "rdesktop.h" | 22 | #include "rdesktop.h" |
23 | #ifdef SHARP | ||
24 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
25 | #else | ||
26 | #include <qapplication.h> | ||
27 | #endif | ||
28 | #include <qmainwindow.h> | 24 | #include <qmainwindow.h> |
29 | #include <qwidget.h> | 25 | #include <qwidget.h> |
30 | #include <qpainter.h> | 26 | #include <qpainter.h> |
31 | #include <qimage.h> | 27 | #include <qimage.h> |
32 | #include <qsocketnotifier.h> | 28 | #include <qsocketnotifier.h> |
33 | #include <qscrollview.h> | 29 | #include <qscrollview.h> |
34 | #include <qmessagebox.h> | 30 | #include <qmessagebox.h> |
35 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
36 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
37 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
38 | #include <qlabel.h> | 34 | #include <qlabel.h> |
39 | #include <qfile.h> | 35 | #include <qfile.h> |
40 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
41 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
42 | #include "qtwin.h" | 38 | #include "qtwin.h" |
43 | #include <stdlib.h> | 39 | #include <stdlib.h> |
44 | 40 | ||
45 | uint32 flags; | 41 | uint32 flags; |
46 | char server[64] = ""; | 42 | char server[64] = ""; |
47 | char domain[16] = ""; | 43 | char domain[16] = ""; |
48 | char password[16] = ""; | 44 | char password[16] = ""; |
49 | char shell[128] = ""; | 45 | char shell[128] = ""; |
50 | char directory[32] = ""; | 46 | char directory[32] = ""; |
51 | 47 | ||
52 | extern int g_width; | 48 | extern int g_width; |
53 | extern int g_height; | 49 | extern int g_height; |
54 | extern int server_bpp; | 50 | extern int server_bpp; |
55 | extern BOOL fullscreen; | 51 | extern BOOL fullscreen; |
56 | extern char username[]; | 52 | extern char username[]; |
57 | int global_sock; | 53 | int global_sock; |
58 | 54 | ||
59 | QSocketNotifier* SocketNotifier; | 55 | QSocketNotifier* SocketNotifier; |
60 | #ifdef SHARP | ||
61 | QPEApplication* App; | 56 | QPEApplication* App; |
62 | #else | ||
63 | QApplication* App; | ||
64 | #endif | ||
65 | QMyMainWindow* MW; | 57 | QMyMainWindow* MW; |
66 | QMyScrollView* SV; | 58 | QMyScrollView* SV; |
67 | struct QColorMap | 59 | struct QColorMap |
68 | { | 60 | { |
69 | uint32 RGBColors[256]; | 61 | uint32 RGBColors[256]; |
70 | int NumColors; | 62 | int NumColors; |
71 | }; | 63 | }; |
72 | QColorMap* CM; | 64 | QColorMap* CM; |
73 | uint8* BS; | 65 | uint8* BS; |
74 | int clipx; | 66 | int clipx; |
75 | int clipy; | 67 | int clipy; |
76 | int clipcx; | 68 | int clipcx; |
77 | int clipcy; | 69 | int clipcy; |
78 | 70 | ||
79 | struct bitmap | 71 | struct bitmap |
80 | { | 72 | { |
81 | int w; | 73 | int w; |
82 | int h; | 74 | int h; |
83 | uint8* data; | 75 | uint8* data; |
84 | }; | 76 | }; |
85 | 77 | ||
86 | BOOL owncolmap = False; | 78 | BOOL owncolmap = False; |
87 | 79 | ||
88 | //***************************************************************************** | 80 | //***************************************************************************** |
89 | void CleanString(QString* Item) | 81 | void CleanString(QString* Item) |
90 | { | 82 | { |
91 | int i; | 83 | int i; |
92 | 84 | ||
93 | i = Item->length() - 1; | 85 | i = Item->length() - 1; |
94 | while (i >= 0) | 86 | while (i >= 0) |
95 | { | 87 | { |
96 | if (Item->at(i) == 10 || Item->at(i) == 13) | 88 | if (Item->at(i) == 10 || Item->at(i) == 13) |
97 | Item->remove(i, 1); | 89 | Item->remove(i, 1); |
98 | i--; | 90 | i--; |
99 | } | 91 | } |
100 | } | 92 | } |
101 | 93 | ||
102 | //***************************************************************************** | 94 | //***************************************************************************** |
103 | QMyDialog::QMyDialog(QWidget* parent) : QDialog(parent, "Settings", true) | 95 | QMyDialog::QMyDialog(QWidget* parent) : QDialog(parent, "Settings", true) |
104 | { | 96 | { |
105 | int i, j; | 97 | int i, j; |
106 | char* home; | 98 | char* home; |
107 | char Text[256]; | 99 | char Text[256]; |
108 | QString Line; | 100 | QString Line; |
109 | QString ItemName; | 101 | QString ItemName; |
110 | QString ItemValue; | 102 | QString ItemValue; |
111 | 103 | ||
112 | // resize dialog | 104 | // resize dialog |
113 | resize(230, 270); | 105 | resize(230, 270); |
114 | // main list box | 106 | // main list box |
115 | ListBox = new QListBox(this); | 107 | ListBox = new QListBox(this); |
116 | ListBox->move(10, 10); | 108 | ListBox->move(10, 10); |
117 | ListBox->resize(200, 100); | 109 | ListBox->resize(200, 100); |
118 | connect(ListBox, SIGNAL(selectionChanged()), this, SLOT(ListBoxChanged())); | 110 | connect(ListBox, SIGNAL(selectionChanged()), this, SLOT(ListBoxChanged())); |
119 | connect(ListBox, SIGNAL(selected(int)), this, SLOT(ListBoxSelected(int))); | 111 | connect(ListBox, SIGNAL(selected(int)), this, SLOT(ListBoxSelected(int))); |
120 | // server | 112 | // server |
121 | Label1 = new QLabel(this); | 113 | Label1 = new QLabel(this); |
122 | Label1->setText("Server Desc"); | 114 | Label1->setText("Server Desc"); |
123 | Label1->move(10, 120); | 115 | Label1->move(10, 120); |
124 | Label1->resize(100, 20); | 116 | Label1->resize(100, 20); |
125 | ServerNameEdit = new QLineEdit(this); | 117 | ServerNameEdit = new QLineEdit(this); |
126 | ServerNameEdit->move(75, 120); | 118 | ServerNameEdit->move(75, 120); |
127 | ServerNameEdit->resize(100, 20); | 119 | ServerNameEdit->resize(100, 20); |
128 | // username | 120 | // username |
129 | Label2 = new QLabel(this); | 121 | Label2 = new QLabel(this); |
130 | Label2->setText("User Name"); | 122 | Label2->setText("User Name"); |
131 | Label2->move(10, 150); | 123 | Label2->move(10, 150); |
132 | Label2->resize(100, 20); | 124 | Label2->resize(100, 20); |
133 | UserNameEdit = new QLineEdit(this); | 125 | UserNameEdit = new QLineEdit(this); |
134 | UserNameEdit->move(75, 150); | 126 | UserNameEdit->move(75, 150); |
135 | UserNameEdit->resize(100, 20); | 127 | UserNameEdit->resize(100, 20); |
136 | // ip | 128 | // ip |
137 | Label3 = new QLabel(this); | 129 | Label3 = new QLabel(this); |
138 | Label3->setText("Server IP"); | 130 | Label3->setText("Server IP"); |
139 | Label3->move(10, 180); | 131 | Label3->move(10, 180); |
140 | Label3->resize(100, 20); | 132 | Label3->resize(100, 20); |
141 | IPEdit = new QLineEdit(this); | 133 | IPEdit = new QLineEdit(this); |
142 | IPEdit->move(75, 180); | 134 | IPEdit->move(75, 180); |
143 | IPEdit->resize(100, 20); | 135 | IPEdit->resize(100, 20); |
144 | // width and height | 136 | // width and height |
145 | WidthHeightBox = new QComboBox(this); | 137 | WidthHeightBox = new QComboBox(this); |
146 | WidthHeightBox->move(10, 210); | 138 | WidthHeightBox->move(10, 210); |
147 | WidthHeightBox->resize(100, 20); | 139 | WidthHeightBox->resize(100, 20); |
148 | WidthHeightBox->insertItem("240x320"); | 140 | WidthHeightBox->insertItem("240x320"); |
149 | WidthHeightBox->insertItem("640x480"); | 141 | WidthHeightBox->insertItem("640x480"); |
150 | WidthHeightBox->insertItem("800x600"); | 142 | WidthHeightBox->insertItem("800x600"); |
151 | connect(WidthHeightBox, SIGNAL(activated(int)), this, SLOT(ComboChanged(int))); | 143 | connect(WidthHeightBox, SIGNAL(activated(int)), this, SLOT(ComboChanged(int))); |
152 | WidthHeightBox->setCurrentItem(1); | 144 | WidthHeightBox->setCurrentItem(1); |
153 | WidthEdit = new QLineEdit(this); | 145 | WidthEdit = new QLineEdit(this); |
154 | WidthEdit->move(110, 210); | 146 | WidthEdit->move(110, 210); |
155 | WidthEdit->resize(30, 20); | 147 | WidthEdit->resize(30, 20); |
156 | WidthEdit->setText("800"); | 148 | WidthEdit->setText("800"); |
157 | HeightEdit = new QLineEdit(this); | 149 | HeightEdit = new QLineEdit(this); |
158 | HeightEdit->move(140, 210); | 150 | HeightEdit->move(140, 210); |
159 | HeightEdit->resize(30, 20); | 151 | HeightEdit->resize(30, 20); |
160 | HeightEdit->setText("600"); | 152 | HeightEdit->setText("600"); |
161 | // add to list button | 153 | // add to list button |
162 | AddButton = new QPushButton(this); | 154 | AddButton = new QPushButton(this); |
163 | AddButton->move(180, 120); | 155 | AddButton->move(180, 120); |
164 | AddButton->resize(50, 20); | 156 | AddButton->resize(50, 20); |
165 | AddButton->setText("Add"); | 157 | AddButton->setText("Add"); |
166 | connect(AddButton, SIGNAL(clicked()), this, SLOT(AddClicked())); | 158 | connect(AddButton, SIGNAL(clicked()), this, SLOT(AddClicked())); |
167 | // change list item button | 159 | // change list item button |
168 | EditButton = new QPushButton(this); | 160 | EditButton = new QPushButton(this); |
169 | EditButton->move(180, 140); | 161 | EditButton->move(180, 140); |
170 | EditButton->resize(50, 20); | 162 | EditButton->resize(50, 20); |
171 | EditButton->setText("Edit"); | 163 | EditButton->setText("Edit"); |
172 | connect(EditButton, SIGNAL(clicked()), this, SLOT(EditClicked())); | 164 | connect(EditButton, SIGNAL(clicked()), this, SLOT(EditClicked())); |
173 | // save to file button | 165 | // save to file button |
174 | SaveButton = new QPushButton(this); | 166 | SaveButton = new QPushButton(this); |
175 | SaveButton->move(180, 160); | 167 | SaveButton->move(180, 160); |
176 | SaveButton->resize(50, 20); | 168 | SaveButton->resize(50, 20); |
177 | SaveButton->setText("Save"); | 169 | SaveButton->setText("Save"); |
178 | connect(SaveButton, SIGNAL(clicked()), this, SLOT(SaveClicked())); | 170 | connect(SaveButton, SIGNAL(clicked()), this, SLOT(SaveClicked())); |
179 | // remove an item button | 171 | // remove an item button |
180 | RemoveButton = new QPushButton(this); | 172 | RemoveButton = new QPushButton(this); |
181 | RemoveButton->move(180, 180); | 173 | RemoveButton->move(180, 180); |
182 | RemoveButton->resize(50, 20); | 174 | RemoveButton->resize(50, 20); |
183 | RemoveButton->setText("Remove"); | 175 | RemoveButton->setText("Remove"); |
184 | connect(RemoveButton, SIGNAL(clicked()), this, SLOT(RemoveClicked())); | 176 | connect(RemoveButton, SIGNAL(clicked()), this, SLOT(RemoveClicked())); |
185 | // full screen check box | 177 | // full screen check box |
186 | FullScreenCheckBox = new QCheckBox(this, "Full Screen"); | 178 | FullScreenCheckBox = new QCheckBox(this, "Full Screen"); |
187 | FullScreenCheckBox->setText("Full Screen"); | 179 | FullScreenCheckBox->setText("Full Screen"); |
188 | FullScreenCheckBox->move(10, 230); | 180 | FullScreenCheckBox->move(10, 230); |
189 | // ok button | 181 | // ok button |
190 | OKButton = new QPushButton(this); | 182 | OKButton = new QPushButton(this); |
191 | OKButton->setText("OK"); | 183 | OKButton->setText("OK"); |
192 | OKButton->move(100, 240); | 184 | OKButton->move(100, 240); |
@@ -902,261 +894,257 @@ uint8 rop(int rop, uint8 src, uint8 dst) | |||
902 | case 0x1: return NOT (src | dst); | 894 | case 0x1: return NOT (src | dst); |
903 | case 0x2: return NOT (src) & dst; | 895 | case 0x2: return NOT (src) & dst; |
904 | case 0x3: return NOT (src); | 896 | case 0x3: return NOT (src); |
905 | case 0x4: return src & NOT (dst); | 897 | case 0x4: return src & NOT (dst); |
906 | case 0x5: return NOT (dst); | 898 | case 0x5: return NOT (dst); |
907 | case 0x6: return src ^ dst; | 899 | case 0x6: return src ^ dst; |
908 | case 0x7: return NOT (src & dst); | 900 | case 0x7: return NOT (src & dst); |
909 | case 0x8: return src & dst; | 901 | case 0x8: return src & dst; |
910 | case 0x9: return NOT (src) ^ dst; | 902 | case 0x9: return NOT (src) ^ dst; |
911 | case 0xa: return dst; | 903 | case 0xa: return dst; |
912 | case 0xb: return NOT (src) | dst; | 904 | case 0xb: return NOT (src) | dst; |
913 | case 0xc: return src; | 905 | case 0xc: return src; |
914 | case 0xd: return src | NOT (dst); | 906 | case 0xd: return src | NOT (dst); |
915 | case 0xe: return src | dst; | 907 | case 0xe: return src | dst; |
916 | case 0xf: return NOT (0); | 908 | case 0xf: return NOT (0); |
917 | } | 909 | } |
918 | return dst; | 910 | return dst; |
919 | } | 911 | } |
920 | 912 | ||
921 | //***************************************************************************** | 913 | //***************************************************************************** |
922 | uint8 get_pixel(int x, int y) | 914 | uint8 get_pixel(int x, int y) |
923 | { | 915 | { |
924 | if (x >= 0 && x < g_width && y >= 0 && y < g_height) | 916 | if (x >= 0 && x < g_width && y >= 0 && y < g_height) |
925 | return BS[y * g_width + x]; | 917 | return BS[y * g_width + x]; |
926 | else | 918 | else |
927 | return 0; | 919 | return 0; |
928 | } | 920 | } |
929 | 921 | ||
930 | //***************************************************************************** | 922 | //***************************************************************************** |
931 | void set_pixel(int x, int y, uint8 pixel, int op = 0xc) | 923 | void set_pixel(int x, int y, uint8 pixel, int op = 0xc) |
932 | { | 924 | { |
933 | if (x >= clipx && x < (clipx + clipcx) && y >= clipy && y < (clipy + clipcy)) | 925 | if (x >= clipx && x < (clipx + clipcx) && y >= clipy && y < (clipy + clipcy)) |
934 | if (x >= 0 && x < g_width && y >= 0 && y < g_height) | 926 | if (x >= 0 && x < g_width && y >= 0 && y < g_height) |
935 | if (op == 0xc) | 927 | if (op == 0xc) |
936 | BS[y * g_width + x] = pixel; | 928 | BS[y * g_width + x] = pixel; |
937 | else | 929 | else |
938 | BS[y * g_width + x] = rop(op, pixel, BS[y * g_width + x]); | 930 | BS[y * g_width + x] = rop(op, pixel, BS[y * g_width + x]); |
939 | } | 931 | } |
940 | 932 | ||
941 | //****************************************************************************** | 933 | //****************************************************************************** |
942 | // adjust coordinates for cliping rect | 934 | // adjust coordinates for cliping rect |
943 | bool WarpCoords(int* x, int* y, int* cx, int* cy, int* srcx, int* srcy) | 935 | bool WarpCoords(int* x, int* y, int* cx, int* cy, int* srcx, int* srcy) |
944 | { | 936 | { |
945 | int dx, dy; | 937 | int dx, dy; |
946 | QRect InRect(*x, *y, *cx, *cy); | 938 | QRect InRect(*x, *y, *cx, *cy); |
947 | QRect OutRect; | 939 | QRect OutRect; |
948 | QRect CRect(clipx, clipy, clipcx, clipcy); | 940 | QRect CRect(clipx, clipy, clipcx, clipcy); |
949 | OutRect = InRect.intersect(CRect); | 941 | OutRect = InRect.intersect(CRect); |
950 | if (OutRect.isEmpty()) | 942 | if (OutRect.isEmpty()) |
951 | return false; | 943 | return false; |
952 | dx = OutRect.x() - InRect.x(); | 944 | dx = OutRect.x() - InRect.x(); |
953 | dy = OutRect.y() - InRect.y(); | 945 | dy = OutRect.y() - InRect.y(); |
954 | *x = OutRect.x(); | 946 | *x = OutRect.x(); |
955 | *y = OutRect.y(); | 947 | *y = OutRect.y(); |
956 | *cx = OutRect.width(); | 948 | *cx = OutRect.width(); |
957 | *cy = OutRect.height(); | 949 | *cy = OutRect.height(); |
958 | if (srcx != NULL) | 950 | if (srcx != NULL) |
959 | *srcx = *srcx + dx; | 951 | *srcx = *srcx + dx; |
960 | if (srcy != NULL) | 952 | if (srcy != NULL) |
961 | *srcy = *srcy + dy; | 953 | *srcy = *srcy + dy; |
962 | return true; | 954 | return true; |
963 | } | 955 | } |
964 | 956 | ||
965 | //***************************************************************************** | 957 | //***************************************************************************** |
966 | void QMyMainWindow::paintEvent(QPaintEvent* pe) | 958 | void QMyMainWindow::paintEvent(QPaintEvent* pe) |
967 | { | 959 | { |
968 | QImage* Image; | 960 | QImage* Image; |
969 | QPainter* Painter; | 961 | QPainter* Painter; |
970 | QRect Rect; | 962 | QRect Rect; |
971 | int i, j, w, h, l, t; | 963 | int i, j, w, h, l, t; |
972 | uint8* data; | 964 | uint8* data; |
973 | 965 | ||
974 | if (!testWFlags(WRepaintNoErase)) | 966 | if (!testWFlags(WRepaintNoErase)) |
975 | setWFlags(WRepaintNoErase); | 967 | setWFlags(WRepaintNoErase); |
976 | if (CM != NULL) | 968 | if (CM != NULL) |
977 | { | 969 | { |
978 | Rect = pe->rect(); | 970 | Rect = pe->rect(); |
979 | l = Rect.left(); | 971 | l = Rect.left(); |
980 | t = Rect.top(); | 972 | t = Rect.top(); |
981 | w = Rect.width(); | 973 | w = Rect.width(); |
982 | h = Rect.height(); | 974 | h = Rect.height(); |
983 | if (w > 0 && h > 0 && CM->NumColors > 0) | 975 | if (w > 0 && h > 0 && CM->NumColors > 0) |
984 | { | 976 | { |
985 | data = (uint8*)xmalloc(w * h); | 977 | data = (uint8*)xmalloc(w * h); |
986 | for (i = 0; i < h; i++) | 978 | for (i = 0; i < h; i++) |
987 | for (j = 0; j < w; j++) | 979 | for (j = 0; j < w; j++) |
988 | data[i * w + j] = get_pixel(l + j, t + i); | 980 | data[i * w + j] = get_pixel(l + j, t + i); |
989 | Image = new QImage(data, w, h, 8,(QRgb*)CM->RGBColors, CM->NumColors, QImage::IgnoreEndian); | 981 | Image = new QImage(data, w, h, 8,(QRgb*)CM->RGBColors, CM->NumColors, QImage::IgnoreEndian); |
990 | Painter = new QPainter(this); | 982 | Painter = new QPainter(this); |
991 | Painter->drawImage(l, t, *Image, 0, 0, w, h); | 983 | Painter->drawImage(l, t, *Image, 0, 0, w, h); |
992 | xfree(data); | 984 | xfree(data); |
993 | delete Painter; | 985 | delete Painter; |
994 | delete Image; | 986 | delete Image; |
995 | } | 987 | } |
996 | } | 988 | } |
997 | } | 989 | } |
998 | 990 | ||
999 | //***************************************************************************** | 991 | //***************************************************************************** |
1000 | void QMyMainWindow::closeEvent(QCloseEvent* e) | 992 | void QMyMainWindow::closeEvent(QCloseEvent* e) |
1001 | { | 993 | { |
1002 | e->accept(); | 994 | e->accept(); |
1003 | } | 995 | } |
1004 | 996 | ||
1005 | //***************************************************************************** | 997 | //***************************************************************************** |
1006 | void QMyMainWindow::dataReceived() | 998 | void QMyMainWindow::dataReceived() |
1007 | { | 999 | { |
1008 | if (rdp_main_loop()) | 1000 | if (rdp_main_loop()) |
1009 | return; | 1001 | return; |
1010 | else | 1002 | else |
1011 | SV->close(); | 1003 | SV->close(); |
1012 | } | 1004 | } |
1013 | 1005 | ||
1014 | //***************************************************************************** | 1006 | //***************************************************************************** |
1015 | void redraw(int x, int y, int cx, int cy) | 1007 | void redraw(int x, int y, int cx, int cy) |
1016 | { | 1008 | { |
1017 | if (WarpCoords(&x, &y, &cx, &cy, NULL, NULL)) | 1009 | if (WarpCoords(&x, &y, &cx, &cy, NULL, NULL)) |
1018 | { | 1010 | { |
1019 | MW->update(x, y, cx, cy); | 1011 | MW->update(x, y, cx, cy); |
1020 | } | 1012 | } |
1021 | } | 1013 | } |
1022 | 1014 | ||
1023 | /* | 1015 | /* |
1024 | BOOL ui_init(void) | 1016 | BOOL ui_init(void) |
1025 | { | 1017 | { |
1026 | QWidget* d; | 1018 | QWidget* d; |
1027 | 1019 | ||
1028 | CM = NULL; | 1020 | CM = NULL; |
1029 | BS = NULL; | 1021 | BS = NULL; |
1030 | #ifdef SHARP | ||
1031 | App = new QPEApplication(g_argc, g_argv); | 1022 | App = new QPEApplication(g_argc, g_argv); |
1032 | #else | ||
1033 | App = new QApplication(g_argc, g_argv, QApplication::GuiServer); | ||
1034 | #endif | ||
1035 | if (fullscreen) | 1023 | if (fullscreen) |
1036 | { | 1024 | { |
1037 | d = QApplication::desktop(); | 1025 | d = QApplication::desktop(); |
1038 | width = d->width(); // returns screen width | 1026 | width = d->width(); // returns screen width |
1039 | height = d->height(); // returns screen height | 1027 | height = d->height(); // returns screen height |
1040 | } | 1028 | } |
1041 | return True; | 1029 | return True; |
1042 | } | 1030 | } |
1043 | */ | 1031 | */ |
1044 | 1032 | ||
1045 | /* | 1033 | /* |
1046 | void ui_deinit(void) | 1034 | void ui_deinit(void) |
1047 | { | 1035 | { |
1048 | delete App; | 1036 | delete App; |
1049 | } | 1037 | } |
1050 | */ | 1038 | */ |
1051 | 1039 | ||
1052 | /* | 1040 | /* |
1053 | BOOL ui_create_window(void) | 1041 | BOOL ui_create_window(void) |
1054 | { | 1042 | { |
1055 | MW = new QMyMainWindow(); | 1043 | MW = new QMyMainWindow(); |
1056 | MW->resize(width, height); | 1044 | MW->resize(width, height); |
1057 | SV = new QMyScrollView(); | 1045 | SV = new QMyScrollView(); |
1058 | SV->resize(width + 4, height + 4); | 1046 | SV->resize(width + 4, height + 4); |
1059 | App->setMainWidget(SV); | 1047 | App->setMainWidget(SV); |
1060 | SV->addChild(MW); | 1048 | SV->addChild(MW); |
1061 | MW->setMouseTracking(true); | 1049 | MW->setMouseTracking(true); |
1062 | SocketNotifier = new QSocketNotifier(global_sock, QSocketNotifier::Read, MW); | 1050 | SocketNotifier = new QSocketNotifier(global_sock, QSocketNotifier::Read, MW); |
1063 | MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived())); | 1051 | MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived())); |
1064 | if (fullscreen) | 1052 | if (fullscreen) |
1065 | SV->showFullScreen(); | 1053 | SV->showFullScreen(); |
1066 | else | 1054 | else |
1067 | SV->showMaximized(); | 1055 | SV->showMaximized(); |
1068 | BS = (uint8*)xmalloc(width * height); | 1056 | BS = (uint8*)xmalloc(width * height); |
1069 | memset(BS, 0, width * height); | 1057 | memset(BS, 0, width * height); |
1070 | clipx = 0; | 1058 | clipx = 0; |
1071 | clipy = 0; | 1059 | clipy = 0; |
1072 | clipcx = width; | 1060 | clipcx = width; |
1073 | clipcy = height; | 1061 | clipcy = height; |
1074 | CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); | 1062 | CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); |
1075 | memset(CM, 0, sizeof(struct QColorMap)); | 1063 | memset(CM, 0, sizeof(struct QColorMap)); |
1076 | SV->timer_id = SV->startTimer(1000); | 1064 | SV->timer_id = SV->startTimer(1000); |
1077 | return True; | 1065 | return True; |
1078 | } | 1066 | } |
1079 | */ | 1067 | */ |
1080 | 1068 | ||
1081 | /* | 1069 | /* |
1082 | void ui_destroy_window(void) | 1070 | void ui_destroy_window(void) |
1083 | { | 1071 | { |
1084 | delete MW; | 1072 | delete MW; |
1085 | delete SV; | 1073 | delete SV; |
1086 | xfree(BS); | 1074 | xfree(BS); |
1087 | xfree(CM); | 1075 | xfree(CM); |
1088 | } | 1076 | } |
1089 | */ | 1077 | */ |
1090 | 1078 | ||
1091 | //***************************************************************************** | 1079 | //***************************************************************************** |
1092 | /* Returns 0 after user quit, 1 otherwise */ | 1080 | /* Returns 0 after user quit, 1 otherwise */ |
1093 | int ui_select(int rdp_socket) | 1081 | int ui_select(int rdp_socket) |
1094 | { | 1082 | { |
1095 | global_sock = rdp_socket; | 1083 | global_sock = rdp_socket; |
1096 | return 1; | 1084 | return 1; |
1097 | } | 1085 | } |
1098 | 1086 | ||
1099 | //***************************************************************************** | 1087 | //***************************************************************************** |
1100 | void ui_move_pointer(int /*x*/, int /*y*/) | 1088 | void ui_move_pointer(int /*x*/, int /*y*/) |
1101 | { | 1089 | { |
1102 | } | 1090 | } |
1103 | 1091 | ||
1104 | //***************************************************************************** | 1092 | //***************************************************************************** |
1105 | HBITMAP ui_create_bitmap(int width, int height, uint8 * data) | 1093 | HBITMAP ui_create_bitmap(int width, int height, uint8 * data) |
1106 | { | 1094 | { |
1107 | struct bitmap* the_bitmap; | 1095 | struct bitmap* the_bitmap; |
1108 | uint8* bitmap_data; | 1096 | uint8* bitmap_data; |
1109 | int i, j; | 1097 | int i, j; |
1110 | 1098 | ||
1111 | // printf("width %d height %d times %d\n", width, height, width * height); | 1099 | // printf("width %d height %d times %d\n", width, height, width * height); |
1112 | bitmap_data = (uint8*)xmalloc(width * height); | 1100 | bitmap_data = (uint8*)xmalloc(width * height); |
1113 | the_bitmap = (struct bitmap*)xmalloc(sizeof(struct bitmap)); | 1101 | the_bitmap = (struct bitmap*)xmalloc(sizeof(struct bitmap)); |
1114 | the_bitmap->w = width; | 1102 | the_bitmap->w = width; |
1115 | the_bitmap->h = height; | 1103 | the_bitmap->h = height; |
1116 | the_bitmap->data = bitmap_data; | 1104 | the_bitmap->data = bitmap_data; |
1117 | for (i = 0; i < height; i++) | 1105 | for (i = 0; i < height; i++) |
1118 | for (j = 0; j < width; j++) | 1106 | for (j = 0; j < width; j++) |
1119 | bitmap_data[i * width + j] = data[i * width + j]; | 1107 | bitmap_data[i * width + j] = data[i * width + j]; |
1120 | return the_bitmap; | 1108 | return the_bitmap; |
1121 | } | 1109 | } |
1122 | 1110 | ||
1123 | //***************************************************************************** | 1111 | //***************************************************************************** |
1124 | void ui_paint_bitmap(int x, int y, int cx, int cy, int width, | 1112 | void ui_paint_bitmap(int x, int y, int cx, int cy, int width, |
1125 | int height, uint8 * data) | 1113 | int height, uint8 * data) |
1126 | { | 1114 | { |
1127 | int i, j; | 1115 | int i, j; |
1128 | 1116 | ||
1129 | for (i = 0; i < cy; i++) | 1117 | for (i = 0; i < cy; i++) |
1130 | for (j = 0; j < cx; j++) | 1118 | for (j = 0; j < cx; j++) |
1131 | if (i < height) | 1119 | if (i < height) |
1132 | if (j < width) | 1120 | if (j < width) |
1133 | set_pixel(x + j, y + i, data[i * width + j]); | 1121 | set_pixel(x + j, y + i, data[i * width + j]); |
1134 | redraw(x, y, cx, cy); | 1122 | redraw(x, y, cx, cy); |
1135 | } | 1123 | } |
1136 | 1124 | ||
1137 | //***************************************************************************** | 1125 | //***************************************************************************** |
1138 | void ui_destroy_bitmap(HBITMAP bmp) | 1126 | void ui_destroy_bitmap(HBITMAP bmp) |
1139 | { | 1127 | { |
1140 | struct bitmap* the_bitmap; | 1128 | struct bitmap* the_bitmap; |
1141 | 1129 | ||
1142 | the_bitmap = (struct bitmap*)bmp; | 1130 | the_bitmap = (struct bitmap*)bmp; |
1143 | if (the_bitmap != NULL) | 1131 | if (the_bitmap != NULL) |
1144 | { | 1132 | { |
1145 | if (the_bitmap->data != NULL) | 1133 | if (the_bitmap->data != NULL) |
1146 | xfree(the_bitmap->data); | 1134 | xfree(the_bitmap->data); |
1147 | xfree(the_bitmap); | 1135 | xfree(the_bitmap); |
1148 | } | 1136 | } |
1149 | } | 1137 | } |
1150 | 1138 | ||
1151 | //***************************************************************************** | 1139 | //***************************************************************************** |
1152 | bool is_pixel_on(uint8* data, int x, int y, int width, int bpp) | 1140 | bool is_pixel_on(uint8* data, int x, int y, int width, int bpp) |
1153 | { | 1141 | { |
1154 | int start, shift; | 1142 | int start, shift; |
1155 | 1143 | ||
1156 | if (bpp == 1) | 1144 | if (bpp == 1) |
1157 | { | 1145 | { |
1158 | width = (width + 7) / 8; | 1146 | width = (width + 7) / 8; |
1159 | start = (y * width) + x / 8; | 1147 | start = (y * width) + x / 8; |
1160 | shift = x % 8; | 1148 | shift = x % 8; |
1161 | return (data[start] & (0x80 >> shift)) != 0; | 1149 | return (data[start] & (0x80 >> shift)) != 0; |
1162 | } | 1150 | } |
@@ -1491,235 +1479,231 @@ void draw_glyph (int x, int y, HGLYPH glyph, int fgcolour) | |||
1491 | xyoffset = ttext[++idx];\ | 1479 | xyoffset = ttext[++idx];\ |
1492 | if ((xyoffset & 0x80))\ | 1480 | if ((xyoffset & 0x80))\ |
1493 | {\ | 1481 | {\ |
1494 | if (flags & TEXT2_VERTICAL) \ | 1482 | if (flags & TEXT2_VERTICAL) \ |
1495 | y += ttext[idx+1] | (ttext[idx+2] << 8);\ | 1483 | y += ttext[idx+1] | (ttext[idx+2] << 8);\ |
1496 | else\ | 1484 | else\ |
1497 | x += ttext[idx+1] | (ttext[idx+2] << 8);\ | 1485 | x += ttext[idx+1] | (ttext[idx+2] << 8);\ |
1498 | idx += 2;\ | 1486 | idx += 2;\ |
1499 | }\ | 1487 | }\ |
1500 | else\ | 1488 | else\ |
1501 | {\ | 1489 | {\ |
1502 | if (flags & TEXT2_VERTICAL) \ | 1490 | if (flags & TEXT2_VERTICAL) \ |
1503 | y += xyoffset;\ | 1491 | y += xyoffset;\ |
1504 | else\ | 1492 | else\ |
1505 | x += xyoffset;\ | 1493 | x += xyoffset;\ |
1506 | }\ | 1494 | }\ |
1507 | }\ | 1495 | }\ |
1508 | if (glyph != NULL)\ | 1496 | if (glyph != NULL)\ |
1509 | {\ | 1497 | {\ |
1510 | draw_glyph (x + glyph->offset, y + glyph->baseline, glyph->pixmap, fgcolour);\ | 1498 | draw_glyph (x + glyph->offset, y + glyph->baseline, glyph->pixmap, fgcolour);\ |
1511 | if (flags & TEXT2_IMPLICIT_X)\ | 1499 | if (flags & TEXT2_IMPLICIT_X)\ |
1512 | x += glyph->width;\ | 1500 | x += glyph->width;\ |
1513 | }\ | 1501 | }\ |
1514 | } | 1502 | } |
1515 | 1503 | ||
1516 | //***************************************************************************** | 1504 | //***************************************************************************** |
1517 | void ui_draw_text(uint8 font, uint8 flags, int mixmode, | 1505 | void ui_draw_text(uint8 font, uint8 flags, int mixmode, |
1518 | int x, int y, int clipx, int clipy, | 1506 | int x, int y, int clipx, int clipy, |
1519 | int clipcx, int clipcy, int boxx, | 1507 | int clipcx, int clipcy, int boxx, |
1520 | int boxy, int boxcx, int boxcy, int bgcolour, | 1508 | int boxy, int boxcx, int boxcy, int bgcolour, |
1521 | int fgcolour, uint8 * text, uint8 length) | 1509 | int fgcolour, uint8 * text, uint8 length) |
1522 | { | 1510 | { |
1523 | FONTGLYPH *glyph; | 1511 | FONTGLYPH *glyph; |
1524 | int i, j, xyoffset; | 1512 | int i, j, xyoffset; |
1525 | DATABLOB *entry; | 1513 | DATABLOB *entry; |
1526 | 1514 | ||
1527 | if (boxcx > 1) | 1515 | if (boxcx > 1) |
1528 | fill_rect(boxx, boxy, boxcx, boxcy, bgcolour); | 1516 | fill_rect(boxx, boxy, boxcx, boxcy, bgcolour); |
1529 | else if (mixmode == MIX_OPAQUE) | 1517 | else if (mixmode == MIX_OPAQUE) |
1530 | fill_rect(clipx, clipy, clipcx, clipcy, bgcolour); | 1518 | fill_rect(clipx, clipy, clipcx, clipcy, bgcolour); |
1531 | 1519 | ||
1532 | /* Paint text, character by character */ | 1520 | /* Paint text, character by character */ |
1533 | for (i = 0; i < length;) | 1521 | for (i = 0; i < length;) |
1534 | { | 1522 | { |
1535 | switch (text[i]) | 1523 | switch (text[i]) |
1536 | { | 1524 | { |
1537 | case 0xff: | 1525 | case 0xff: |
1538 | if (i + 2 < length) | 1526 | if (i + 2 < length) |
1539 | cache_put_text(text[i + 1], text, text[i + 2]); | 1527 | cache_put_text(text[i + 1], text, text[i + 2]); |
1540 | else | 1528 | else |
1541 | { | 1529 | { |
1542 | error("this shouldn't be happening\n"); | 1530 | error("this shouldn't be happening\n"); |
1543 | exit(1); | 1531 | exit(1); |
1544 | } | 1532 | } |
1545 | /* this will move pointer from start to first character after FF command */ | 1533 | /* this will move pointer from start to first character after FF command */ |
1546 | length -= i + 3; | 1534 | length -= i + 3; |
1547 | text = &(text[i + 3]); | 1535 | text = &(text[i + 3]); |
1548 | i = 0; | 1536 | i = 0; |
1549 | break; | 1537 | break; |
1550 | 1538 | ||
1551 | case 0xfe: | 1539 | case 0xfe: |
1552 | entry = cache_get_text(text[i + 1]); | 1540 | entry = cache_get_text(text[i + 1]); |
1553 | if (entry != NULL) | 1541 | if (entry != NULL) |
1554 | { | 1542 | { |
1555 | if ((((uint8 *) (entry->data))[1] == 0) && (!(flags & TEXT2_IMPLICIT_X))) | 1543 | if ((((uint8 *) (entry->data))[1] == 0) && (!(flags & TEXT2_IMPLICIT_X))) |
1556 | { | 1544 | { |
1557 | if (flags & TEXT2_VERTICAL) | 1545 | if (flags & TEXT2_VERTICAL) |
1558 | y += text[i + 2]; | 1546 | y += text[i + 2]; |
1559 | else | 1547 | else |
1560 | x += text[i + 2]; | 1548 | x += text[i + 2]; |
1561 | } | 1549 | } |
1562 | for (j = 0; j < entry->size; j++) | 1550 | for (j = 0; j < entry->size; j++) |
1563 | DO_GLYPH(((uint8 *) (entry->data)), j); | 1551 | DO_GLYPH(((uint8 *) (entry->data)), j); |
1564 | } | 1552 | } |
1565 | if (i + 2 < length) | 1553 | if (i + 2 < length) |
1566 | i += 3; | 1554 | i += 3; |
1567 | else | 1555 | else |
1568 | i += 2; | 1556 | i += 2; |
1569 | length -= i; | 1557 | length -= i; |
1570 | /* this will move pointer from start to first character after FE command */ | 1558 | /* this will move pointer from start to first character after FE command */ |
1571 | text = &(text[i]); | 1559 | text = &(text[i]); |
1572 | i = 0; | 1560 | i = 0; |
1573 | break; | 1561 | break; |
1574 | 1562 | ||
1575 | default: | 1563 | default: |
1576 | DO_GLYPH(text, i); | 1564 | DO_GLYPH(text, i); |
1577 | i++; | 1565 | i++; |
1578 | break; | 1566 | break; |
1579 | } | 1567 | } |
1580 | } | 1568 | } |
1581 | if (boxcx > 1) | 1569 | if (boxcx > 1) |
1582 | redraw(boxx, boxy, boxcx, boxcy); | 1570 | redraw(boxx, boxy, boxcx, boxcy); |
1583 | else | 1571 | else |
1584 | redraw(clipx, clipy, clipcx, clipcy); | 1572 | redraw(clipx, clipy, clipcx, clipcy); |
1585 | } | 1573 | } |
1586 | 1574 | ||
1587 | //***************************************************************************** | 1575 | //***************************************************************************** |
1588 | void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) | 1576 | void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) |
1589 | { | 1577 | { |
1590 | uint8* data; | 1578 | uint8* data; |
1591 | int i, j; | 1579 | int i, j; |
1592 | 1580 | ||
1593 | data = (uint8*)xmalloc(cx * cy); | 1581 | data = (uint8*)xmalloc(cx * cy); |
1594 | for (i = 0; i < cy; i++) | 1582 | for (i = 0; i < cy; i++) |
1595 | for (j = 0; j < cx; j++) | 1583 | for (j = 0; j < cx; j++) |
1596 | data[i * cx + j] = get_pixel(x + j, y + i); | 1584 | data[i * cx + j] = get_pixel(x + j, y + i); |
1597 | cache_put_desktop(offset, cx, cy, cx, 1, data); | 1585 | cache_put_desktop(offset, cx, cy, cx, 1, data); |
1598 | xfree(data); | 1586 | xfree(data); |
1599 | } | 1587 | } |
1600 | 1588 | ||
1601 | //***************************************************************************** | 1589 | //***************************************************************************** |
1602 | void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) | 1590 | void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) |
1603 | { | 1591 | { |
1604 | uint8* data; | 1592 | uint8* data; |
1605 | int i, j; | 1593 | int i, j; |
1606 | 1594 | ||
1607 | data = cache_get_desktop(offset, cx, cy, 1); | 1595 | data = cache_get_desktop(offset, cx, cy, 1); |
1608 | for (i = 0; i < cy; i++) | 1596 | for (i = 0; i < cy; i++) |
1609 | for (j = 0; j < cx; j++) | 1597 | for (j = 0; j < cx; j++) |
1610 | set_pixel(x + j, y + i, data[i * cx + j]); | 1598 | set_pixel(x + j, y + i, data[i * cx + j]); |
1611 | redraw(x, y, cx, cy); | 1599 | redraw(x, y, cx, cy); |
1612 | } | 1600 | } |
1613 | 1601 | ||
1614 | //***************************************************************************** | 1602 | //***************************************************************************** |
1615 | int main(int argc, char** argv) | 1603 | int main(int argc, char** argv) |
1616 | { | 1604 | { |
1617 | CM = NULL; | 1605 | CM = NULL; |
1618 | BS = NULL; | 1606 | BS = NULL; |
1619 | #ifdef SHARP | ||
1620 | App = new QPEApplication(argc, argv); | 1607 | App = new QPEApplication(argc, argv); |
1621 | #else | ||
1622 | App = new QApplication(argc, argv, QApplication::GuiServer); | ||
1623 | #endif | ||
1624 | SV = new QMyScrollView(); | 1608 | SV = new QMyScrollView(); |
1625 | App->setMainWidget(SV); | 1609 | App->setMainWidget(SV); |
1626 | SV->showMaximized(); | 1610 | SV->showMaximized(); |
1627 | SV->timer_id = SV->startTimer(1000); | 1611 | SV->timer_id = SV->startTimer(1000); |
1628 | App->exec(); | 1612 | App->exec(); |
1629 | delete SV; | 1613 | delete SV; |
1630 | delete App; | 1614 | delete App; |
1631 | if (CM != NULL) | 1615 | if (CM != NULL) |
1632 | xfree(CM); | 1616 | xfree(CM); |
1633 | if (BS !=NULL) | 1617 | if (BS !=NULL) |
1634 | xfree(BS); | 1618 | xfree(BS); |
1635 | return 0; | 1619 | return 0; |
1636 | } | 1620 | } |
1637 | 1621 | ||
1638 | /* | 1622 | /* |
1639 | MW = new QMyMainWindow(); | 1623 | MW = new QMyMainWindow(); |
1640 | MW->resize(width, height); | 1624 | MW->resize(width, height); |
1641 | SV->resize(width + 4, height + 4); | 1625 | SV->resize(width + 4, height + 4); |
1642 | App->setMainWidget(SV); | 1626 | App->setMainWidget(SV); |
1643 | SV->addChild(MW); | 1627 | SV->addChild(MW); |
1644 | MW->setMouseTracking(true); | 1628 | MW->setMouseTracking(true); |
1645 | SocketNotifier = new QSocketNotifier(global_sock, QSocketNotifier::Read, MW); | 1629 | SocketNotifier = new QSocketNotifier(global_sock, QSocketNotifier::Read, MW); |
1646 | MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived())); | 1630 | MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived())); |
1647 | if (fullscreen) | 1631 | if (fullscreen) |
1648 | SV->showFullScreen(); | 1632 | SV->showFullScreen(); |
1649 | else | 1633 | else |
1650 | SV->showMaximized(); | 1634 | SV->showMaximized(); |
1651 | BS = (uint8*)xmalloc(width * height); | 1635 | BS = (uint8*)xmalloc(width * height); |
1652 | memset(BS, 0, width * height); | 1636 | memset(BS, 0, width * height); |
1653 | clipx = 0; | 1637 | clipx = 0; |
1654 | clipy = 0; | 1638 | clipy = 0; |
1655 | clipcx = width; | 1639 | clipcx = width; |
1656 | clipcy = height; | 1640 | clipcy = height; |
1657 | CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); | 1641 | CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); |
1658 | memset(CM, 0, sizeof(struct QColorMap)); | 1642 | memset(CM, 0, sizeof(struct QColorMap)); |
1659 | SV->timer_id = SV->startTimer(1000); | 1643 | SV->timer_id = SV->startTimer(1000); |
1660 | return True; | 1644 | return True; |
1661 | 1645 | ||
1662 | 1646 | ||
1663 | 1647 | ||
1664 | 1648 | ||
1665 | 1649 | ||
1666 | int main(int argc, char ** argv) | 1650 | int main(int argc, char ** argv) |
1667 | { | 1651 | { |
1668 | uint32 flags; | 1652 | uint32 flags; |
1669 | int i, total_params; | 1653 | int i, total_params; |
1670 | char server[64] = "192.168.0.164"; | 1654 | char server[64] = "192.168.0.164"; |
1671 | char domain[16] = ""; | 1655 | char domain[16] = ""; |
1672 | char password[16] = ""; | 1656 | char password[16] = ""; |
1673 | char shell[128] = ""; | 1657 | char shell[128] = ""; |
1674 | char directory[32] = ""; | 1658 | char directory[32] = ""; |
1675 | char* p; | 1659 | char* p; |
1676 | QString param, s1, s2, s3; | 1660 | QString param, s1, s2, s3; |
1677 | 1661 | ||
1678 | flags = RDP_LOGON_NORMAL; | 1662 | flags = RDP_LOGON_NORMAL; |
1679 | 1663 | ||
1680 | g_argc = argc; | 1664 | g_argc = argc; |
1681 | g_argv = argv; | 1665 | g_argv = argv; |
1682 | 1666 | ||
1683 | if (!ui_init()) | 1667 | if (!ui_init()) |
1684 | return 1; | 1668 | return 1; |
1685 | 1669 | ||
1686 | total_params = App->argc(); | 1670 | total_params = App->argc(); |
1687 | 1671 | ||
1688 | for (i = 1; (i + 1) < total_params; i = i + 2) | 1672 | for (i = 1; (i + 1) < total_params; i = i + 2) |
1689 | { | 1673 | { |
1690 | s1 = App->argv()[i]; | 1674 | s1 = App->argv()[i]; |
1691 | s2 = App->argv()[i + 1]; | 1675 | s2 = App->argv()[i + 1]; |
1692 | if (s1 == "-g") | 1676 | if (s1 == "-g") |
1693 | { | 1677 | { |
1694 | width = strtol((const char*)s2, &p, 10); | 1678 | width = strtol((const char*)s2, &p, 10); |
1695 | if (*p == 'x') | 1679 | if (*p == 'x') |
1696 | height = strtol(p + 1, NULL, 10); | 1680 | height = strtol(p + 1, NULL, 10); |
1697 | } | 1681 | } |
1698 | else if (s1 = "-u") | 1682 | else if (s1 = "-u") |
1699 | strcpy(username, (const char*)s2); | 1683 | strcpy(username, (const char*)s2); |
1700 | } | 1684 | } |
1701 | if (i < total_params) | 1685 | if (i < total_params) |
1702 | strcpy(server, App->argv()[i]); | 1686 | strcpy(server, App->argv()[i]); |
1703 | 1687 | ||
1704 | // printf("server %s width %d height %d\n", server, width, height); | 1688 | // printf("server %s width %d height %d\n", server, width, height); |
1705 | 1689 | ||
1706 | if (width == 0 || height == 0) | 1690 | if (width == 0 || height == 0) |
1707 | { | 1691 | { |
1708 | ui_deinit(); | 1692 | ui_deinit(); |
1709 | return 1; | 1693 | return 1; |
1710 | } | 1694 | } |
1711 | 1695 | ||
1712 | if (!rdp_connect(server, flags, domain, password, shell, directory)) | 1696 | if (!rdp_connect(server, flags, domain, password, shell, directory)) |
1713 | { | 1697 | { |
1714 | ui_deinit(); | 1698 | ui_deinit(); |
1715 | return 1; | 1699 | return 1; |
1716 | } | 1700 | } |
1717 | if (ui_create_window()) | 1701 | if (ui_create_window()) |
1718 | { | 1702 | { |
1719 | ui_main_loop(); | 1703 | ui_main_loop(); |
1720 | ui_destroy_window(); | 1704 | ui_destroy_window(); |
1721 | } | 1705 | } |
1722 | rdp_disconnect(); | 1706 | rdp_disconnect(); |
1723 | ui_deinit(); | 1707 | ui_deinit(); |
1724 | } | 1708 | } |
1725 | */ | 1709 | */ |