author | zecke <zecke> | 2005-02-14 16:08:36 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-14 16:08:36 (UTC) |
commit | 0e6780c400fbae2ccd8895e40480adb4273906ae (patch) (unidiff) | |
tree | 1cc48cfef9c0542272da51071ebda0e27b9e3cfc | |
parent | 277adb0af903b8bc2760c20891b664b763b667d9 (diff) | |
download | opie-0e6780c400fbae2ccd8895e40480adb4273906ae.zip opie-0e6780c400fbae2ccd8895e40480adb4273906ae.tar.gz opie-0e6780c400fbae2ccd8895e40480adb4273906ae.tar.bz2 |
Set a Caption
File a Bug and propose a better name
-rw-r--r-- | noncore/net/opierdesktop/qtwin.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/net/opierdesktop/qtwin.cpp b/noncore/net/opierdesktop/qtwin.cpp index e350bf6..181d275 100644 --- a/noncore/net/opierdesktop/qtwin.cpp +++ b/noncore/net/opierdesktop/qtwin.cpp | |||
@@ -1,224 +1,225 @@ | |||
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 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qmainwindow.h> | 24 | #include <qmainwindow.h> |
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qimage.h> | 27 | #include <qimage.h> |
28 | #include <qsocketnotifier.h> | 28 | #include <qsocketnotifier.h> |
29 | #include <qscrollview.h> | 29 | #include <qscrollview.h> |
30 | #include <qmessagebox.h> | 30 | #include <qmessagebox.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include "qtwin.h" | 38 | #include "qtwin.h" |
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | 40 | ||
41 | uint32 flags; | 41 | uint32 flags; |
42 | char server[64] = ""; | 42 | char server[64] = ""; |
43 | char domain[16] = ""; | 43 | char domain[16] = ""; |
44 | char password[16] = ""; | 44 | char password[16] = ""; |
45 | char shell[128] = ""; | 45 | char shell[128] = ""; |
46 | char directory[32] = ""; | 46 | char directory[32] = ""; |
47 | 47 | ||
48 | extern int g_width; | 48 | extern int g_width; |
49 | extern int g_height; | 49 | extern int g_height; |
50 | extern int server_bpp; | 50 | extern int server_bpp; |
51 | extern BOOL fullscreen; | 51 | extern BOOL fullscreen; |
52 | extern char username[]; | 52 | extern char username[]; |
53 | int global_sock; | 53 | int global_sock; |
54 | 54 | ||
55 | QSocketNotifier* SocketNotifier; | 55 | QSocketNotifier* SocketNotifier; |
56 | QPEApplication* App; | 56 | QPEApplication* App; |
57 | QMyMainWindow* MW; | 57 | QMyMainWindow* MW; |
58 | QMyScrollView* SV; | 58 | QMyScrollView* SV; |
59 | struct QColorMap | 59 | struct QColorMap |
60 | { | 60 | { |
61 | uint32 RGBColors[256]; | 61 | uint32 RGBColors[256]; |
62 | int NumColors; | 62 | int NumColors; |
63 | }; | 63 | }; |
64 | QColorMap* CM; | 64 | QColorMap* CM; |
65 | uint8* BS; | 65 | uint8* BS; |
66 | int clipx; | 66 | int clipx; |
67 | int clipy; | 67 | int clipy; |
68 | int clipcx; | 68 | int clipcx; |
69 | int clipcy; | 69 | int clipcy; |
70 | 70 | ||
71 | struct bitmap | 71 | struct bitmap |
72 | { | 72 | { |
73 | int w; | 73 | int w; |
74 | int h; | 74 | int h; |
75 | uint8* data; | 75 | uint8* data; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | BOOL owncolmap = False; | 78 | BOOL owncolmap = False; |
79 | 79 | ||
80 | //***************************************************************************** | 80 | //***************************************************************************** |
81 | void CleanString(QString* Item) | 81 | void CleanString(QString* Item) |
82 | { | 82 | { |
83 | int i; | 83 | int i; |
84 | 84 | ||
85 | i = Item->length() - 1; | 85 | i = Item->length() - 1; |
86 | while (i >= 0) | 86 | while (i >= 0) |
87 | { | 87 | { |
88 | if (Item->at(i) == 10 || Item->at(i) == 13) | 88 | if (Item->at(i) == 10 || Item->at(i) == 13) |
89 | Item->remove(i, 1); | 89 | Item->remove(i, 1); |
90 | i--; | 90 | i--; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | //***************************************************************************** | 94 | //***************************************************************************** |
95 | QMyDialog::QMyDialog(QWidget* parent) : QDialog(parent, "Settings", true) | 95 | QMyDialog::QMyDialog(QWidget* parent) : QDialog(parent, "Settings", true) |
96 | { | 96 | { |
97 | setCaption( tr( "Configuration" ) ); | ||
97 | int i, j; | 98 | int i, j; |
98 | char* home; | 99 | char* home; |
99 | char Text[256]; | 100 | char Text[256]; |
100 | QString Line; | 101 | QString Line; |
101 | QString ItemName; | 102 | QString ItemName; |
102 | QString ItemValue; | 103 | QString ItemValue; |
103 | 104 | ||
104 | // resize dialog | 105 | // resize dialog |
105 | resize(230, 270); | 106 | resize(230, 270); |
106 | // main list box | 107 | // main list box |
107 | ListBox = new QListBox(this); | 108 | ListBox = new QListBox(this); |
108 | ListBox->move(10, 10); | 109 | ListBox->move(10, 10); |
109 | ListBox->resize(200, 100); | 110 | ListBox->resize(200, 100); |
110 | connect(ListBox, SIGNAL(selectionChanged()), this, SLOT(ListBoxChanged())); | 111 | connect(ListBox, SIGNAL(selectionChanged()), this, SLOT(ListBoxChanged())); |
111 | connect(ListBox, SIGNAL(selected(int)), this, SLOT(ListBoxSelected(int))); | 112 | connect(ListBox, SIGNAL(selected(int)), this, SLOT(ListBoxSelected(int))); |
112 | // server | 113 | // server |
113 | Label1 = new QLabel(this); | 114 | Label1 = new QLabel(this); |
114 | Label1->setText("Server Desc"); | 115 | Label1->setText("Server Desc"); |
115 | Label1->move(10, 120); | 116 | Label1->move(10, 120); |
116 | Label1->resize(100, 20); | 117 | Label1->resize(100, 20); |
117 | ServerNameEdit = new QLineEdit(this); | 118 | ServerNameEdit = new QLineEdit(this); |
118 | ServerNameEdit->move(75, 120); | 119 | ServerNameEdit->move(75, 120); |
119 | ServerNameEdit->resize(100, 20); | 120 | ServerNameEdit->resize(100, 20); |
120 | // username | 121 | // username |
121 | Label2 = new QLabel(this); | 122 | Label2 = new QLabel(this); |
122 | Label2->setText("User Name"); | 123 | Label2->setText("User Name"); |
123 | Label2->move(10, 150); | 124 | Label2->move(10, 150); |
124 | Label2->resize(100, 20); | 125 | Label2->resize(100, 20); |
125 | UserNameEdit = new QLineEdit(this); | 126 | UserNameEdit = new QLineEdit(this); |
126 | UserNameEdit->move(75, 150); | 127 | UserNameEdit->move(75, 150); |
127 | UserNameEdit->resize(100, 20); | 128 | UserNameEdit->resize(100, 20); |
128 | // ip | 129 | // ip |
129 | Label3 = new QLabel(this); | 130 | Label3 = new QLabel(this); |
130 | Label3->setText("Server IP"); | 131 | Label3->setText("Server IP"); |
131 | Label3->move(10, 180); | 132 | Label3->move(10, 180); |
132 | Label3->resize(100, 20); | 133 | Label3->resize(100, 20); |
133 | IPEdit = new QLineEdit(this); | 134 | IPEdit = new QLineEdit(this); |
134 | IPEdit->move(75, 180); | 135 | IPEdit->move(75, 180); |
135 | IPEdit->resize(100, 20); | 136 | IPEdit->resize(100, 20); |
136 | // width and height | 137 | // width and height |
137 | WidthHeightBox = new QComboBox(this); | 138 | WidthHeightBox = new QComboBox(this); |
138 | WidthHeightBox->move(10, 210); | 139 | WidthHeightBox->move(10, 210); |
139 | WidthHeightBox->resize(100, 20); | 140 | WidthHeightBox->resize(100, 20); |
140 | WidthHeightBox->insertItem("240x320"); | 141 | WidthHeightBox->insertItem("240x320"); |
141 | WidthHeightBox->insertItem("640x480"); | 142 | WidthHeightBox->insertItem("640x480"); |
142 | WidthHeightBox->insertItem("800x600"); | 143 | WidthHeightBox->insertItem("800x600"); |
143 | connect(WidthHeightBox, SIGNAL(activated(int)), this, SLOT(ComboChanged(int))); | 144 | connect(WidthHeightBox, SIGNAL(activated(int)), this, SLOT(ComboChanged(int))); |
144 | WidthHeightBox->setCurrentItem(1); | 145 | WidthHeightBox->setCurrentItem(1); |
145 | WidthEdit = new QLineEdit(this); | 146 | WidthEdit = new QLineEdit(this); |
146 | WidthEdit->move(110, 210); | 147 | WidthEdit->move(110, 210); |
147 | WidthEdit->resize(30, 20); | 148 | WidthEdit->resize(30, 20); |
148 | WidthEdit->setText("800"); | 149 | WidthEdit->setText("800"); |
149 | HeightEdit = new QLineEdit(this); | 150 | HeightEdit = new QLineEdit(this); |
150 | HeightEdit->move(140, 210); | 151 | HeightEdit->move(140, 210); |
151 | HeightEdit->resize(30, 20); | 152 | HeightEdit->resize(30, 20); |
152 | HeightEdit->setText("600"); | 153 | HeightEdit->setText("600"); |
153 | // add to list button | 154 | // add to list button |
154 | AddButton = new QPushButton(this); | 155 | AddButton = new QPushButton(this); |
155 | AddButton->move(180, 120); | 156 | AddButton->move(180, 120); |
156 | AddButton->resize(50, 20); | 157 | AddButton->resize(50, 20); |
157 | AddButton->setText("Add"); | 158 | AddButton->setText("Add"); |
158 | connect(AddButton, SIGNAL(clicked()), this, SLOT(AddClicked())); | 159 | connect(AddButton, SIGNAL(clicked()), this, SLOT(AddClicked())); |
159 | // change list item button | 160 | // change list item button |
160 | EditButton = new QPushButton(this); | 161 | EditButton = new QPushButton(this); |
161 | EditButton->move(180, 140); | 162 | EditButton->move(180, 140); |
162 | EditButton->resize(50, 20); | 163 | EditButton->resize(50, 20); |
163 | EditButton->setText("Edit"); | 164 | EditButton->setText("Edit"); |
164 | connect(EditButton, SIGNAL(clicked()), this, SLOT(EditClicked())); | 165 | connect(EditButton, SIGNAL(clicked()), this, SLOT(EditClicked())); |
165 | // save to file button | 166 | // save to file button |
166 | SaveButton = new QPushButton(this); | 167 | SaveButton = new QPushButton(this); |
167 | SaveButton->move(180, 160); | 168 | SaveButton->move(180, 160); |
168 | SaveButton->resize(50, 20); | 169 | SaveButton->resize(50, 20); |
169 | SaveButton->setText("Save"); | 170 | SaveButton->setText("Save"); |
170 | connect(SaveButton, SIGNAL(clicked()), this, SLOT(SaveClicked())); | 171 | connect(SaveButton, SIGNAL(clicked()), this, SLOT(SaveClicked())); |
171 | // remove an item button | 172 | // remove an item button |
172 | RemoveButton = new QPushButton(this); | 173 | RemoveButton = new QPushButton(this); |
173 | RemoveButton->move(180, 180); | 174 | RemoveButton->move(180, 180); |
174 | RemoveButton->resize(50, 20); | 175 | RemoveButton->resize(50, 20); |
175 | RemoveButton->setText("Remove"); | 176 | RemoveButton->setText("Remove"); |
176 | connect(RemoveButton, SIGNAL(clicked()), this, SLOT(RemoveClicked())); | 177 | connect(RemoveButton, SIGNAL(clicked()), this, SLOT(RemoveClicked())); |
177 | // full screen check box | 178 | // full screen check box |
178 | FullScreenCheckBox = new QCheckBox(this, "Full Screen"); | 179 | FullScreenCheckBox = new QCheckBox(this, "Full Screen"); |
179 | FullScreenCheckBox->setText("Full Screen"); | 180 | FullScreenCheckBox->setText("Full Screen"); |
180 | FullScreenCheckBox->move(10, 230); | 181 | FullScreenCheckBox->move(10, 230); |
181 | // ok button | 182 | // ok button |
182 | OKButton = new QPushButton(this); | 183 | OKButton = new QPushButton(this); |
183 | OKButton->setText("OK"); | 184 | OKButton->setText("OK"); |
184 | OKButton->move(100, 240); | 185 | OKButton->move(100, 240); |
185 | OKButton->resize(50, 20); | 186 | OKButton->resize(50, 20); |
186 | connect(OKButton, SIGNAL(clicked()), this, SLOT(OKClicked())); | 187 | connect(OKButton, SIGNAL(clicked()), this, SLOT(OKClicked())); |
187 | // cancel button | 188 | // cancel button |
188 | CancelButton = new QPushButton(this); | 189 | CancelButton = new QPushButton(this); |
189 | CancelButton->setText("Cancel"); | 190 | CancelButton->setText("Cancel"); |
190 | CancelButton->move(160, 240); | 191 | CancelButton->move(160, 240); |
191 | CancelButton->resize(50, 20); | 192 | CancelButton->resize(50, 20); |
192 | connect(CancelButton, SIGNAL(clicked()), this, SLOT(CancelClicked())); | 193 | connect(CancelButton, SIGNAL(clicked()), this, SLOT(CancelClicked())); |
193 | 194 | ||
194 | for (i = 0; i < 10; i++) | 195 | for (i = 0; i < 10; i++) |
195 | { | 196 | { |
196 | ConnectionList[i] = new QMyConnectionItem; | 197 | ConnectionList[i] = new QMyConnectionItem; |
197 | ConnectionList[i]->ServerName = ""; | 198 | ConnectionList[i]->ServerName = ""; |
198 | ConnectionList[i]->UserName = ""; | 199 | ConnectionList[i]->UserName = ""; |
199 | ConnectionList[i]->ServerIP = ""; | 200 | ConnectionList[i]->ServerIP = ""; |
200 | ConnectionList[i]->Width = 0; | 201 | ConnectionList[i]->Width = 0; |
201 | ConnectionList[i]->Height = 0; | 202 | ConnectionList[i]->Height = 0; |
202 | ConnectionList[i]->FullScreen = 0; | 203 | ConnectionList[i]->FullScreen = 0; |
203 | } | 204 | } |
204 | home = getenv("HOME"); | 205 | home = getenv("HOME"); |
205 | if (home != NULL) | 206 | if (home != NULL) |
206 | { | 207 | { |
207 | sprintf(Text, "%s/rdesktop.ini", home); | 208 | sprintf(Text, "%s/rdesktop.ini", home); |
208 | QFile* File = new QFile(Text); | 209 | QFile* File = new QFile(Text); |
209 | if (File->open(IO_ReadOnly)) | 210 | if (File->open(IO_ReadOnly)) |
210 | { | 211 | { |
211 | i = -1; | 212 | i = -1; |
212 | while (!File->atEnd()) | 213 | while (!File->atEnd()) |
213 | { | 214 | { |
214 | File->readLine(Line, 255); | 215 | File->readLine(Line, 255); |
215 | j = Line.find("="); | 216 | j = Line.find("="); |
216 | if (j > 0) | 217 | if (j > 0) |
217 | { | 218 | { |
218 | ItemName = Line.mid(0, j); | 219 | ItemName = Line.mid(0, j); |
219 | CleanString(&ItemName); | 220 | CleanString(&ItemName); |
220 | ItemValue = Line.mid(j + 1); | 221 | ItemValue = Line.mid(j + 1); |
221 | CleanString(&ItemValue); | 222 | CleanString(&ItemValue); |
222 | if (ItemName == "Server") | 223 | if (ItemName == "Server") |
223 | { | 224 | { |
224 | i++; | 225 | i++; |
@@ -1483,227 +1484,228 @@ void draw_glyph (int x, int y, HGLYPH glyph, int fgcolour) | |||
1483 | y += ttext[idx+1] | (ttext[idx+2] << 8);\ | 1484 | y += ttext[idx+1] | (ttext[idx+2] << 8);\ |
1484 | else\ | 1485 | else\ |
1485 | x += ttext[idx+1] | (ttext[idx+2] << 8);\ | 1486 | x += ttext[idx+1] | (ttext[idx+2] << 8);\ |
1486 | idx += 2;\ | 1487 | idx += 2;\ |
1487 | }\ | 1488 | }\ |
1488 | else\ | 1489 | else\ |
1489 | {\ | 1490 | {\ |
1490 | if (flags & TEXT2_VERTICAL) \ | 1491 | if (flags & TEXT2_VERTICAL) \ |
1491 | y += xyoffset;\ | 1492 | y += xyoffset;\ |
1492 | else\ | 1493 | else\ |
1493 | x += xyoffset;\ | 1494 | x += xyoffset;\ |
1494 | }\ | 1495 | }\ |
1495 | }\ | 1496 | }\ |
1496 | if (glyph != NULL)\ | 1497 | if (glyph != NULL)\ |
1497 | {\ | 1498 | {\ |
1498 | draw_glyph (x + glyph->offset, y + glyph->baseline, glyph->pixmap, fgcolour);\ | 1499 | draw_glyph (x + glyph->offset, y + glyph->baseline, glyph->pixmap, fgcolour);\ |
1499 | if (flags & TEXT2_IMPLICIT_X)\ | 1500 | if (flags & TEXT2_IMPLICIT_X)\ |
1500 | x += glyph->width;\ | 1501 | x += glyph->width;\ |
1501 | }\ | 1502 | }\ |
1502 | } | 1503 | } |
1503 | 1504 | ||
1504 | //***************************************************************************** | 1505 | //***************************************************************************** |
1505 | void ui_draw_text(uint8 font, uint8 flags, int mixmode, | 1506 | void ui_draw_text(uint8 font, uint8 flags, int mixmode, |
1506 | int x, int y, int clipx, int clipy, | 1507 | int x, int y, int clipx, int clipy, |
1507 | int clipcx, int clipcy, int boxx, | 1508 | int clipcx, int clipcy, int boxx, |
1508 | int boxy, int boxcx, int boxcy, int bgcolour, | 1509 | int boxy, int boxcx, int boxcy, int bgcolour, |
1509 | int fgcolour, uint8 * text, uint8 length) | 1510 | int fgcolour, uint8 * text, uint8 length) |
1510 | { | 1511 | { |
1511 | FONTGLYPH *glyph; | 1512 | FONTGLYPH *glyph; |
1512 | int i, j, xyoffset; | 1513 | int i, j, xyoffset; |
1513 | DATABLOB *entry; | 1514 | DATABLOB *entry; |
1514 | 1515 | ||
1515 | if (boxcx > 1) | 1516 | if (boxcx > 1) |
1516 | fill_rect(boxx, boxy, boxcx, boxcy, bgcolour); | 1517 | fill_rect(boxx, boxy, boxcx, boxcy, bgcolour); |
1517 | else if (mixmode == MIX_OPAQUE) | 1518 | else if (mixmode == MIX_OPAQUE) |
1518 | fill_rect(clipx, clipy, clipcx, clipcy, bgcolour); | 1519 | fill_rect(clipx, clipy, clipcx, clipcy, bgcolour); |
1519 | 1520 | ||
1520 | /* Paint text, character by character */ | 1521 | /* Paint text, character by character */ |
1521 | for (i = 0; i < length;) | 1522 | for (i = 0; i < length;) |
1522 | { | 1523 | { |
1523 | switch (text[i]) | 1524 | switch (text[i]) |
1524 | { | 1525 | { |
1525 | case 0xff: | 1526 | case 0xff: |
1526 | if (i + 2 < length) | 1527 | if (i + 2 < length) |
1527 | cache_put_text(text[i + 1], text, text[i + 2]); | 1528 | cache_put_text(text[i + 1], text, text[i + 2]); |
1528 | else | 1529 | else |
1529 | { | 1530 | { |
1530 | error("this shouldn't be happening\n"); | 1531 | error("this shouldn't be happening\n"); |
1531 | exit(1); | 1532 | exit(1); |
1532 | } | 1533 | } |
1533 | /* this will move pointer from start to first character after FF command */ | 1534 | /* this will move pointer from start to first character after FF command */ |
1534 | length -= i + 3; | 1535 | length -= i + 3; |
1535 | text = &(text[i + 3]); | 1536 | text = &(text[i + 3]); |
1536 | i = 0; | 1537 | i = 0; |
1537 | break; | 1538 | break; |
1538 | 1539 | ||
1539 | case 0xfe: | 1540 | case 0xfe: |
1540 | entry = cache_get_text(text[i + 1]); | 1541 | entry = cache_get_text(text[i + 1]); |
1541 | if (entry != NULL) | 1542 | if (entry != NULL) |
1542 | { | 1543 | { |
1543 | if ((((uint8 *) (entry->data))[1] == 0) && (!(flags & TEXT2_IMPLICIT_X))) | 1544 | if ((((uint8 *) (entry->data))[1] == 0) && (!(flags & TEXT2_IMPLICIT_X))) |
1544 | { | 1545 | { |
1545 | if (flags & TEXT2_VERTICAL) | 1546 | if (flags & TEXT2_VERTICAL) |
1546 | y += text[i + 2]; | 1547 | y += text[i + 2]; |
1547 | else | 1548 | else |
1548 | x += text[i + 2]; | 1549 | x += text[i + 2]; |
1549 | } | 1550 | } |
1550 | for (j = 0; j < entry->size; j++) | 1551 | for (j = 0; j < entry->size; j++) |
1551 | DO_GLYPH(((uint8 *) (entry->data)), j); | 1552 | DO_GLYPH(((uint8 *) (entry->data)), j); |
1552 | } | 1553 | } |
1553 | if (i + 2 < length) | 1554 | if (i + 2 < length) |
1554 | i += 3; | 1555 | i += 3; |
1555 | else | 1556 | else |
1556 | i += 2; | 1557 | i += 2; |
1557 | length -= i; | 1558 | length -= i; |
1558 | /* this will move pointer from start to first character after FE command */ | 1559 | /* this will move pointer from start to first character after FE command */ |
1559 | text = &(text[i]); | 1560 | text = &(text[i]); |
1560 | i = 0; | 1561 | i = 0; |
1561 | break; | 1562 | break; |
1562 | 1563 | ||
1563 | default: | 1564 | default: |
1564 | DO_GLYPH(text, i); | 1565 | DO_GLYPH(text, i); |
1565 | i++; | 1566 | i++; |
1566 | break; | 1567 | break; |
1567 | } | 1568 | } |
1568 | } | 1569 | } |
1569 | if (boxcx > 1) | 1570 | if (boxcx > 1) |
1570 | redraw(boxx, boxy, boxcx, boxcy); | 1571 | redraw(boxx, boxy, boxcx, boxcy); |
1571 | else | 1572 | else |
1572 | redraw(clipx, clipy, clipcx, clipcy); | 1573 | redraw(clipx, clipy, clipcx, clipcy); |
1573 | } | 1574 | } |
1574 | 1575 | ||
1575 | //***************************************************************************** | 1576 | //***************************************************************************** |
1576 | void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) | 1577 | void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) |
1577 | { | 1578 | { |
1578 | uint8* data; | 1579 | uint8* data; |
1579 | int i, j; | 1580 | int i, j; |
1580 | 1581 | ||
1581 | data = (uint8*)xmalloc(cx * cy); | 1582 | data = (uint8*)xmalloc(cx * cy); |
1582 | for (i = 0; i < cy; i++) | 1583 | for (i = 0; i < cy; i++) |
1583 | for (j = 0; j < cx; j++) | 1584 | for (j = 0; j < cx; j++) |
1584 | data[i * cx + j] = get_pixel(x + j, y + i); | 1585 | data[i * cx + j] = get_pixel(x + j, y + i); |
1585 | cache_put_desktop(offset, cx, cy, cx, 1, data); | 1586 | cache_put_desktop(offset, cx, cy, cx, 1, data); |
1586 | xfree(data); | 1587 | xfree(data); |
1587 | } | 1588 | } |
1588 | 1589 | ||
1589 | //***************************************************************************** | 1590 | //***************************************************************************** |
1590 | void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) | 1591 | void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) |
1591 | { | 1592 | { |
1592 | uint8* data; | 1593 | uint8* data; |
1593 | int i, j; | 1594 | int i, j; |
1594 | 1595 | ||
1595 | data = cache_get_desktop(offset, cx, cy, 1); | 1596 | data = cache_get_desktop(offset, cx, cy, 1); |
1596 | for (i = 0; i < cy; i++) | 1597 | for (i = 0; i < cy; i++) |
1597 | for (j = 0; j < cx; j++) | 1598 | for (j = 0; j < cx; j++) |
1598 | set_pixel(x + j, y + i, data[i * cx + j]); | 1599 | set_pixel(x + j, y + i, data[i * cx + j]); |
1599 | redraw(x, y, cx, cy); | 1600 | redraw(x, y, cx, cy); |
1600 | } | 1601 | } |
1601 | 1602 | ||
1602 | //***************************************************************************** | 1603 | //***************************************************************************** |
1603 | int main(int argc, char** argv) | 1604 | int main(int argc, char** argv) |
1604 | { | 1605 | { |
1605 | CM = NULL; | 1606 | CM = NULL; |
1606 | BS = NULL; | 1607 | BS = NULL; |
1607 | App = new QPEApplication(argc, argv); | 1608 | App = new QPEApplication(argc, argv); |
1608 | SV = new QMyScrollView(); | 1609 | SV = new QMyScrollView(); |
1609 | App->setMainWidget(SV); | 1610 | App->setMainWidget(SV); |
1610 | SV->showMaximized(); | 1611 | SV->showMaximized(); |
1612 | SV->setCaption( QMyScrollView::tr("Remote Desktop Client (RDP)") ); | ||
1611 | SV->timer_id = SV->startTimer(1000); | 1613 | SV->timer_id = SV->startTimer(1000); |
1612 | App->exec(); | 1614 | App->exec(); |
1613 | delete SV; | 1615 | delete SV; |
1614 | delete App; | 1616 | delete App; |
1615 | if (CM != NULL) | 1617 | if (CM != NULL) |
1616 | xfree(CM); | 1618 | xfree(CM); |
1617 | if (BS !=NULL) | 1619 | if (BS !=NULL) |
1618 | xfree(BS); | 1620 | xfree(BS); |
1619 | return 0; | 1621 | return 0; |
1620 | } | 1622 | } |
1621 | 1623 | ||
1622 | /* | 1624 | /* |
1623 | MW = new QMyMainWindow(); | 1625 | MW = new QMyMainWindow(); |
1624 | MW->resize(width, height); | 1626 | MW->resize(width, height); |
1625 | SV->resize(width + 4, height + 4); | 1627 | SV->resize(width + 4, height + 4); |
1626 | App->setMainWidget(SV); | 1628 | App->setMainWidget(SV); |
1627 | SV->addChild(MW); | 1629 | SV->addChild(MW); |
1628 | MW->setMouseTracking(true); | 1630 | MW->setMouseTracking(true); |
1629 | SocketNotifier = new QSocketNotifier(global_sock, QSocketNotifier::Read, MW); | 1631 | SocketNotifier = new QSocketNotifier(global_sock, QSocketNotifier::Read, MW); |
1630 | MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived())); | 1632 | MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived())); |
1631 | if (fullscreen) | 1633 | if (fullscreen) |
1632 | SV->showFullScreen(); | 1634 | SV->showFullScreen(); |
1633 | else | 1635 | else |
1634 | SV->showMaximized(); | 1636 | SV->showMaximized(); |
1635 | BS = (uint8*)xmalloc(width * height); | 1637 | BS = (uint8*)xmalloc(width * height); |
1636 | memset(BS, 0, width * height); | 1638 | memset(BS, 0, width * height); |
1637 | clipx = 0; | 1639 | clipx = 0; |
1638 | clipy = 0; | 1640 | clipy = 0; |
1639 | clipcx = width; | 1641 | clipcx = width; |
1640 | clipcy = height; | 1642 | clipcy = height; |
1641 | CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); | 1643 | CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); |
1642 | memset(CM, 0, sizeof(struct QColorMap)); | 1644 | memset(CM, 0, sizeof(struct QColorMap)); |
1643 | SV->timer_id = SV->startTimer(1000); | 1645 | SV->timer_id = SV->startTimer(1000); |
1644 | return True; | 1646 | return True; |
1645 | 1647 | ||
1646 | 1648 | ||
1647 | 1649 | ||
1648 | 1650 | ||
1649 | 1651 | ||
1650 | int main(int argc, char ** argv) | 1652 | int main(int argc, char ** argv) |
1651 | { | 1653 | { |
1652 | uint32 flags; | 1654 | uint32 flags; |
1653 | int i, total_params; | 1655 | int i, total_params; |
1654 | char server[64] = "192.168.0.164"; | 1656 | char server[64] = "192.168.0.164"; |
1655 | char domain[16] = ""; | 1657 | char domain[16] = ""; |
1656 | char password[16] = ""; | 1658 | char password[16] = ""; |
1657 | char shell[128] = ""; | 1659 | char shell[128] = ""; |
1658 | char directory[32] = ""; | 1660 | char directory[32] = ""; |
1659 | char* p; | 1661 | char* p; |
1660 | QString param, s1, s2, s3; | 1662 | QString param, s1, s2, s3; |
1661 | 1663 | ||
1662 | flags = RDP_LOGON_NORMAL; | 1664 | flags = RDP_LOGON_NORMAL; |
1663 | 1665 | ||
1664 | g_argc = argc; | 1666 | g_argc = argc; |
1665 | g_argv = argv; | 1667 | g_argv = argv; |
1666 | 1668 | ||
1667 | if (!ui_init()) | 1669 | if (!ui_init()) |
1668 | return 1; | 1670 | return 1; |
1669 | 1671 | ||
1670 | total_params = App->argc(); | 1672 | total_params = App->argc(); |
1671 | 1673 | ||
1672 | for (i = 1; (i + 1) < total_params; i = i + 2) | 1674 | for (i = 1; (i + 1) < total_params; i = i + 2) |
1673 | { | 1675 | { |
1674 | s1 = App->argv()[i]; | 1676 | s1 = App->argv()[i]; |
1675 | s2 = App->argv()[i + 1]; | 1677 | s2 = App->argv()[i + 1]; |
1676 | if (s1 == "-g") | 1678 | if (s1 == "-g") |
1677 | { | 1679 | { |
1678 | width = strtol((const char*)s2, &p, 10); | 1680 | width = strtol((const char*)s2, &p, 10); |
1679 | if (*p == 'x') | 1681 | if (*p == 'x') |
1680 | height = strtol(p + 1, NULL, 10); | 1682 | height = strtol(p + 1, NULL, 10); |
1681 | } | 1683 | } |
1682 | else if (s1 = "-u") | 1684 | else if (s1 = "-u") |
1683 | strcpy(username, (const char*)s2); | 1685 | strcpy(username, (const char*)s2); |
1684 | } | 1686 | } |
1685 | if (i < total_params) | 1687 | if (i < total_params) |
1686 | strcpy(server, App->argv()[i]); | 1688 | strcpy(server, App->argv()[i]); |
1687 | 1689 | ||
1688 | // printf("server %s width %d height %d\n", server, width, height); | 1690 | // printf("server %s width %d height %d\n", server, width, height); |
1689 | 1691 | ||
1690 | if (width == 0 || height == 0) | 1692 | if (width == 0 || height == 0) |
1691 | { | 1693 | { |
1692 | ui_deinit(); | 1694 | ui_deinit(); |
1693 | return 1; | 1695 | return 1; |
1694 | } | 1696 | } |
1695 | 1697 | ||
1696 | if (!rdp_connect(server, flags, domain, password, shell, directory)) | 1698 | if (!rdp_connect(server, flags, domain, password, shell, directory)) |
1697 | { | 1699 | { |
1698 | ui_deinit(); | 1700 | ui_deinit(); |
1699 | return 1; | 1701 | return 1; |
1700 | } | 1702 | } |
1701 | if (ui_create_window()) | 1703 | if (ui_create_window()) |
1702 | { | 1704 | { |
1703 | ui_main_loop(); | 1705 | ui_main_loop(); |
1704 | ui_destroy_window(); | 1706 | ui_destroy_window(); |
1705 | } | 1707 | } |
1706 | rdp_disconnect(); | 1708 | rdp_disconnect(); |
1707 | ui_deinit(); | 1709 | ui_deinit(); |
1708 | } | 1710 | } |
1709 | */ | 1711 | */ |