The regexp was not correct.
[kdenetwork.git] / krdc / krdc.h
blob5bf9a4bda8961c63e1c7d23ebb0436204b0edb5a
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 <kprogress.h>
22 #include <qscrollview.h>
23 #include <qlayout.h>
24 #include <qsize.h>
25 #include <qrect.h>
26 #include <qtimer.h>
27 #include <qdesktopwidget.h>
29 #include "vnc/kvncview.h"
30 #include "rdp/krdpview.h"
31 #include "kfullscreenpanel.h"
32 #include "vidmode.h"
33 #include "smartptr.h"
34 #include "keycapturedialog.h"
36 class QPixmap;
37 class KToolBar;
38 class QPopupMenu;
39 class QDockArea;
41 enum WindowMode {
42 WINDOW_MODE_AUTO,
43 WINDOW_MODE_NORMAL,
44 WINDOW_MODE_FULLSCREEN
47 // known protocols
48 enum Protocol {
49 PROTOCOL_AUTO,
50 PROTOCOL_VNC,
51 PROTOCOL_RDP
54 // Overloaded QScrollView, to let mouse move events through to remote widget
55 class QScrollView2 : public QScrollView {
56 public:
57 QScrollView2(QWidget *w, const char *name);
58 protected:
59 virtual void mouseMoveEvent(QMouseEvent *e);
63 class KRDC : public QWidget
65 Q_OBJECT
66 private:
67 SmartPtr<KProgressDialog> m_progressDialog; // dialog, displayed while connecting
68 QVBoxLayout *m_layout; // the layout for autosizing the scrollview
69 QScrollView *m_scrollView; // scrollview that contains the remote widget
70 KProgress *m_progress; // progress bar for the dialog
71 KRemoteView *m_view; // the remote widget (e.g. KVncView)
73 SmartPtr<KeyCaptureDialog> m_keyCaptureDialog; // dialog for key capturing
74 KFullscreenPanel *m_fsToolbar; // toolbar for fullscreen (0 in normal mode)
75 QWidget *m_fsToolbarWidget; // qt designer widget for fs toolbar
76 // (invalid in normal mode)
77 QPixmap m_pinup, m_pindown; // fs toolbar imaged for autohide button
78 KToolBar *m_toolbar; // toolbar in normal mode (0 in fs mode)
79 QDockArea *m_dockArea; // dock area for toolbar in normal mode (0 in fs mode)
80 QPopupMenu *m_popup; // advanced options popup (0 in fs mode)
81 QDesktopWidget m_desktopWidget;
83 static const int TOOLBAR_AUTOHIDE_TIMEOUT;
84 bool m_ftAutoHide; // if true auto hide in fs is activated
85 QTimer m_autoHideTimer; // timer for autohide
87 QTimer m_bumpScrollTimer; // timer for bump scrolling (in fs, when res too large)
89 bool m_showProgress; // can disable showing the progress dialog temporary
90 QString m_host; // host string as given from user
91 Protocol m_protocol; // the used protocol
92 Quality m_quality; // current quality setting
93 QString m_encodings; // string containing the encodings, space separated,
94 // used for config before connection
95 QString m_password; // if not null, contains the password to use
96 QString m_resolution;// contains an alternative resolution
97 QString m_keymap; // keymap on the terminal server
99 WindowMode m_isFullscreen; // fs/normal state
100 Resolution m_oldResolution; // conatins encoded res before fs
101 bool m_fullscreenMinimized; // true if window is currently minimized from fs
102 QSize m_fullscreenResolution; // xvidmode size (valid only in fs)
103 bool m_windowScaling; // used in startup and fullscreen to determine
104 // whether scaling should be enabled in norm mode.
105 // The current state is m_view->scaled().
106 bool m_localCursor; // show local cursor no matter what
107 QSize m_initialWindowSize; // initial window size (windowed mode only),
108 // invalid after first use
109 static QString m_lastHost; // remembers last value of host input
111 bool parseHost(QString &s, Protocol &prot, QString &serverHost, int &serverPort,
112 QString &userName, QString &password);
114 void repositionView(bool fullscreen);
116 void showProgressDialog();
117 void hideProgressDialog();
119 static const int TOOLBAR_FPS_1000;
120 static const int TOOLBAR_SPEED_DOWN;
121 static const int TOOLBAR_SPEED_UP;
122 void fsToolbarScheduleHidden();
123 QPopupMenu *createPopupMenu(QWidget *parent) const;
125 protected:
126 virtual void mouseMoveEvent(QMouseEvent *e);
127 virtual bool event(QEvent *e);
128 virtual bool eventFilter(QObject *watched, QEvent *e);
129 virtual QSize sizeHint();
131 public:
132 KRDC(WindowMode wm = WINDOW_MODE_AUTO,
133 const QString &host = QString::null,
134 Quality q = QUALITY_UNKNOWN,
135 const QString &encodings = QString::null,
136 const QString &password = QString::null,
137 bool scale = false,
138 bool localCursor = false,
139 QSize initialWindowSize = QSize());
140 ~KRDC();
142 bool start();
144 static void setLastHost(const QString &host);
146 private slots:
147 void changeProgress(RemoteViewStatus s);
148 void showingPasswordDialog(bool b);
149 void showProgressTimeout();
151 void setSize(int w, int h);
152 void iconify();
153 void toolbarChanged();
154 void bumpScroll();
156 void toggleFsToolbarAutoHide();
157 void setFsToolbarAutoHide(bool on);
158 void showFullscreenToolbar();
159 void hideFullscreenToolbarDelayed();
160 void hideFullscreenToolbarNow();
162 public slots:
163 void quit();
164 void enableFullscreen(bool full = false);
165 void switchToNormal(bool scaling = false);
166 void switchToFullscreen(bool scaling = false);
167 void viewOnlyToggled();
168 void showLocalCursorToggled();
170 signals:
171 void disconnected();
172 void disconnectedError();
175 #endif