Update versions of AIM dlls this allows AIM to send us whole directory.
[kdenetwork.git] / krdc / krdc.h
blobdd21b5371cb3010ef5db52fcc90a357332618050
1 /***************************************************************************
2 krdc.h - main window
3 -------------------
4 begin : Tue May 13 23:10:42 CET 2002
5 copyright : (C) 2002-2003 by Tim Jansen
6 email : tim@tjansen.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef KRDC_H
19 #define KRDC_H
21 #include <kprogressdialog.h>
22 #include <QSize>
23 #include <QRect>
24 #include <QTimer>
25 #include <QDesktopWidget>
26 #include <QPixmap>
27 #include <QEvent>
28 #include <QVBoxLayout>
29 #include <QMainWindow>
30 #include <QMouseEvent>
31 #include <QScrollArea>
33 #include "vnc/kvncview.h"
34 #include "rdp/krdpview.h"
35 #include "kfullscreenpanel.h"
36 #include "vidmode.h"
37 #include "smartptr.h"
38 #include "keycapturedialog.h"
40 class KActionCollection;
41 class KActionMenu;
42 class KToolBar;
45 enum WindowMode {
46 WINDOW_MODE_AUTO,
47 WINDOW_MODE_NORMAL,
48 WINDOW_MODE_FULLSCREEN
51 // known protocols
52 enum Protocol {
53 PROTOCOL_AUTO,
54 PROTOCOL_VNC,
55 PROTOCOL_RDP
58 // Overloaded QScrollArea, to let mouse move events through to remote widget
59 class RemoteScrollArea : public QScrollArea {
60 public:
61 RemoteScrollArea(QWidget *parent);
62 protected:
63 virtual void mouseMoveEvent(QMouseEvent *e);
67 class KRDC : public QMainWindow
69 Q_OBJECT
70 private:
71 SmartPtr<KProgressDialog> m_progressDialog; // dialog, displayed while connecting
72 QVBoxLayout *m_layout; // the layout for autosizing the scrollview
73 RemoteScrollArea *m_scrollView; // scrollview that contains the remote widget
74 KRemoteView *m_view; // the remote widget (e.g. KVncView)
76 SmartPtr<KeyCaptureDialog> m_keyCaptureDialog; // dialog for key capturing
77 KFullscreenPanel *m_fsToolbar; // toolbar for fullscreen (0 in normal mode)
78 QWidget *m_fsToolbarWidget; // qt designer widget for fs toolbar
79 // (invalid in normal mode)
80 QPixmap m_pinup, m_pindown; // fs toolbar imaged for autohide button
81 QToolBar *m_toolbar; // toolbar in normal mode (0 in fs mode)
82 KActionMenu *m_popup; // advanced options popup (0 in fs mode)
83 QDesktopWidget m_desktopWidget;
85 static const int TOOLBAR_AUTOHIDE_TIMEOUT;
86 bool m_ftAutoHide; // if true auto hide in fs is activated
87 QTimer m_autoHideTimer; // timer for autohide
89 QTimer m_bumpScrollTimer; // timer for bump scrolling (in fs, when res too large)
91 bool m_showProgress; // can disable showing the progress dialog temporary
92 QString m_host; // host string as given from user
93 Protocol m_protocol; // the used protocol
94 Quality m_quality; // current quality setting
95 QString m_encodings; // string containing the encodings, space separated,
96 // used for config before connection
97 QString m_password; // if not null, contains the password to use
98 QString m_resolution;// contains an alternative resolution
99 QString m_keymap; // keymap on the terminal server
101 WindowMode m_isFullscreen; // fs/normal state
102 Resolution m_oldResolution; // conatins encoded res before fs
103 bool m_fullscreenMinimized; // true if window is currently minimized from fs
104 QSize m_fullscreenResolution; // xvidmode size (valid only in fs)
105 bool m_windowScaling; // used in startup and fullscreen to determine
106 // whether scaling should be enabled in norm mode.
107 // The current state is m_view->scaled().
108 bool m_localCursor; // show local cursor no matter what
109 QSize m_initialWindowSize; // initial window size (windowed mode only),
110 // invalid after first use
111 static QString m_lastHost; // remembers last value of host input
112 KActionCollection* m_actionCollection; // used to hold all our KActions for toolbars and menus
113 QString m_caption; // window caption - normally a command line argument
115 bool parseHost(QString &s, Protocol &prot, QString &serverHost, int &serverPort,
116 QString &userName, QString &password);
118 void repositionView(bool fullscreen);
120 void showProgressDialog();
121 void hideProgressDialog();
123 static const int TOOLBAR_FPS_1000;
124 static const int TOOLBAR_SPEED_DOWN;
125 static const int TOOLBAR_SPEED_UP;
126 void fsToolbarScheduleHidden();
127 KActionMenu *createActionMenu(QWidget *parent) const;
129 protected:
130 virtual void mouseMoveEvent(QMouseEvent *e);
131 virtual bool event(QEvent *e);
132 virtual bool eventFilter(QObject *watched, QEvent *e);
133 virtual QSize sizeHint() const;
135 public:
136 KRDC(WindowMode wm = WINDOW_MODE_AUTO,
137 const QString &host = QString::null,
138 Quality q = QUALITY_UNKNOWN,
139 const QString &encodings = QString::null,
140 const QString &password = QString::null,
141 bool scale = false,
142 bool localCursor = false,
143 QSize initialWindowSize = QSize(),
144 const QString &caption = QString::null );
145 ~KRDC();
147 bool start();
149 static void setLastHost(const QString &host);
151 private slots:
152 void changeProgress(RemoteViewStatus s);
153 void showingPasswordDialog(bool b);
154 void showProgressTimeout();
156 void setSize(int w, int h);
157 void iconify();
158 void toolbarChanged();
159 void bumpScroll();
161 void toggleFsToolbarAutoHide();
162 void setFsToolbarAutoHide(bool on);
163 void showFullscreenToolbar();
164 void hideFullscreenToolbarDelayed();
165 void hideFullscreenToolbarNow();
167 public slots:
168 void quit();
169 void enableFullscreen(bool full = false);
170 void switchToNormal(bool scaling = false);
171 void switchToFullscreen(bool scaling = false);
172 void viewOnlyToggled();
173 void showLocalCursorToggled();
175 signals:
176 void disconnected();
177 void disconnectedError();
180 #endif