summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opierdesktop/qtwin.cpp16
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,128 +1,120 @@
/*
rdesktop: A Remote Desktop Protocol client.
User interface services - X Window System
Copyright (C) Matthew Chapman 1999-2002
qt.cpp by Jay Sorg
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.
*/
#include "rdesktop.h"
-#ifdef SHARP
#include <qpe/qpeapplication.h>
-#else
-#include <qapplication.h>
-#endif
#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 "qtwin.h"
#include <stdlib.h>
uint32 flags;
char server[64] = "";
char domain[16] = "";
char password[16] = "";
char shell[128] = "";
char directory[32] = "";
extern int g_width;
extern int g_height;
extern int server_bpp;
extern BOOL fullscreen;
extern char username[];
int global_sock;
QSocketNotifier* SocketNotifier;
-#ifdef SHARP
QPEApplication* App;
-#else
-QApplication* App;
-#endif
QMyMainWindow* MW;
QMyScrollView* SV;
struct QColorMap
{
uint32 RGBColors[256];
int NumColors;
};
QColorMap* CM;
uint8* BS;
int clipx;
int clipy;
int clipcx;
int clipcy;
struct bitmap
{
int w;
int h;
uint8* data;
};
BOOL owncolmap = False;
//*****************************************************************************
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->move(10, 10);
ListBox->resize(200, 100);
connect(ListBox, SIGNAL(selectionChanged()), this, SLOT(ListBoxChanged()));
connect(ListBox, SIGNAL(selected(int)), this, SLOT(ListBoxSelected(int)));
// server
Label1 = new QLabel(this);
Label1->setText("Server Desc");
Label1->move(10, 120);
Label1->resize(100, 20);
ServerNameEdit = new QLineEdit(this);
ServerNameEdit->move(75, 120);
ServerNameEdit->resize(100, 20);
// username
@@ -966,133 +958,129 @@ bool WarpCoords(int* x, int* y, int* cx, int* cy, int* srcx, int* srcy)
void QMyMainWindow::paintEvent(QPaintEvent* pe)
{
QImage* Image;
QPainter* Painter;
QRect Rect;
int i, j, w, h, l, t;
uint8* data;
if (!testWFlags(WRepaintNoErase))
setWFlags(WRepaintNoErase);
if (CM != NULL)
{
Rect = pe->rect();
l = Rect.left();
t = Rect.top();
w = Rect.width();
h = Rect.height();
if (w > 0 && h > 0 && CM->NumColors > 0)
{
data = (uint8*)xmalloc(w * h);
for (i = 0; i < h; i++)
for (j = 0; j < w; j++)
data[i * w + j] = get_pixel(l + j, t + i);
Image = new QImage(data, w, h, 8,(QRgb*)CM->RGBColors, CM->NumColors, QImage::IgnoreEndian);
Painter = new QPainter(this);
Painter->drawImage(l, t, *Image, 0, 0, w, h);
xfree(data);
delete Painter;
delete Image;
}
}
}
//*****************************************************************************
void QMyMainWindow::closeEvent(QCloseEvent* e)
{
e->accept();
}
//*****************************************************************************
void QMyMainWindow::dataReceived()
{
if (rdp_main_loop())
return;
else
SV->close();
}
//*****************************************************************************
void redraw(int x, int y, int cx, int cy)
{
if (WarpCoords(&x, &y, &cx, &cy, NULL, NULL))
{
MW->update(x, y, cx, cy);
}
}
/*
BOOL ui_init(void)
{
QWidget* d;
CM = NULL;
BS = NULL;
-#ifdef SHARP
App = new QPEApplication(g_argc, g_argv);
-#else
- App = new QApplication(g_argc, g_argv, QApplication::GuiServer);
-#endif
if (fullscreen)
{
d = QApplication::desktop();
width = d->width(); // returns screen width
height = d->height(); // returns screen height
}
return True;
}
*/
/*
void ui_deinit(void)
{
delete App;
}
*/
/*
BOOL ui_create_window(void)
{
MW = new QMyMainWindow();
MW->resize(width, height);
SV = new QMyScrollView();
SV->resize(width + 4, height + 4);
App->setMainWidget(SV);
SV->addChild(MW);
MW->setMouseTracking(true);
SocketNotifier = new QSocketNotifier(global_sock, QSocketNotifier::Read, MW);
MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived()));
if (fullscreen)
SV->showFullScreen();
else
SV->showMaximized();
BS = (uint8*)xmalloc(width * height);
memset(BS, 0, width * height);
clipx = 0;
clipy = 0;
clipcx = width;
clipcy = height;
CM = (QColorMap*)xmalloc(sizeof(struct QColorMap));
memset(CM, 0, sizeof(struct QColorMap));
SV->timer_id = SV->startTimer(1000);
return True;
}
*/
/*
void ui_destroy_window(void)
{
delete MW;
delete SV;
xfree(BS);
xfree(CM);
}
*/
//*****************************************************************************
/* Returns 0 after user quit, 1 otherwise */
int ui_select(int rdp_socket)
{
global_sock = rdp_socket;
return 1;
}
@@ -1555,133 +1543,129 @@ void ui_draw_text(uint8 font, uint8 flags, int mixmode,
if ((((uint8 *) (entry->data))[1] == 0) && (!(flags & TEXT2_IMPLICIT_X)))
{
if (flags & TEXT2_VERTICAL)
y += text[i + 2];
else
x += text[i + 2];
}
for (j = 0; j < entry->size; j++)
DO_GLYPH(((uint8 *) (entry->data)), j);
}
if (i + 2 < length)
i += 3;
else
i += 2;
length -= i;
/* this will move pointer from start to first character after FE command */
text = &(text[i]);
i = 0;
break;
default:
DO_GLYPH(text, i);
i++;
break;
}
}
if (boxcx > 1)
redraw(boxx, boxy, boxcx, boxcy);
else
redraw(clipx, clipy, clipcx, clipcy);
}
//*****************************************************************************
void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)
{
uint8* data;
int i, j;
data = (uint8*)xmalloc(cx * cy);
for (i = 0; i < cy; i++)
for (j = 0; j < cx; j++)
data[i * cx + j] = get_pixel(x + j, y + i);
cache_put_desktop(offset, cx, cy, cx, 1, data);
xfree(data);
}
//*****************************************************************************
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
{
uint8* data;
int i, j;
data = cache_get_desktop(offset, cx, cy, 1);
for (i = 0; i < cy; i++)
for (j = 0; j < cx; j++)
set_pixel(x + j, y + i, data[i * cx + j]);
redraw(x, y, cx, cy);
}
//*****************************************************************************
int main(int argc, char** argv)
{
CM = NULL;
BS = NULL;
-#ifdef SHARP
App = new QPEApplication(argc, argv);
-#else
- App = new QApplication(argc, argv, QApplication::GuiServer);
-#endif
SV = new QMyScrollView();
App->setMainWidget(SV);
SV->showMaximized();
SV->timer_id = SV->startTimer(1000);
App->exec();
delete SV;
delete App;
if (CM != NULL)
xfree(CM);
if (BS !=NULL)
xfree(BS);
return 0;
}
/*
MW = new QMyMainWindow();
MW->resize(width, height);
SV->resize(width + 4, height + 4);
App->setMainWidget(SV);
SV->addChild(MW);
MW->setMouseTracking(true);
SocketNotifier = new QSocketNotifier(global_sock, QSocketNotifier::Read, MW);
MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived()));
if (fullscreen)
SV->showFullScreen();
else
SV->showMaximized();
BS = (uint8*)xmalloc(width * height);
memset(BS, 0, width * height);
clipx = 0;
clipy = 0;
clipcx = width;
clipcy = height;
CM = (QColorMap*)xmalloc(sizeof(struct QColorMap));
memset(CM, 0, sizeof(struct QColorMap));
SV->timer_id = SV->startTimer(1000);
return True;
int main(int argc, char ** argv)
{
uint32 flags;
int i, total_params;
char server[64] = "192.168.0.164";
char domain[16] = "";
char password[16] = "";
char shell[128] = "";
char directory[32] = "";
char* p;
QString param, s1, s2, s3;
flags = RDP_LOGON_NORMAL;
g_argc = argc;
g_argv = argv;
if (!ui_init())
return 1;
total_params = App->argc();