* QComboBox -> KComboBox
[kdenetwork.git] / krdc / mainwindow.h
blob73402ba9ab9bc65a24ebd76b6d01b5816a5d8531
1 /****************************************************************************
2 **
3 ** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
4 **
5 ** This file is part of KDE.
6 **
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
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; see the file COPYING. If not, write to
19 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ** Boston, MA 02110-1301, USA.
22 ****************************************************************************/
24 #ifndef MAINWINDOW_H
25 #define MAINWINDOW_H
27 #include "remoteview.h"
29 #include <KXmlGuiWindow>
31 class KToggleAction;
32 class KTabWidget;
33 class KUrlNavigator;
35 class BookmarkManager;
36 class FloatingToolBar;
37 class RemoteView;
38 class SystemTrayIcon;
39 class ZeroconfPage;
41 class QScrollArea;
42 class QModelIndex;
44 class MainWindow : public KXmlGuiWindow
46 Q_OBJECT
47 public:
48 MainWindow(QWidget *parent = 0);
49 ~MainWindow();
51 QList<RemoteView *> remoteViewList() const;
52 int currentRemoteView() const;
53 KActionCollection *mainWindowActionCollection() { return actionCollection(); };
55 public slots:
56 void newConnection(const KUrl &newUrl = KUrl(), bool switchFullscreenWhenConnected = false);
58 protected:
59 virtual void closeEvent(QCloseEvent *event);
61 private slots:
62 void restoreOpenSessions();
63 void quit();
64 void preferences();
65 void configureNotifications();
66 void configureKeys();
67 void configureToolbars();
68 void showMenubar();
69 void resizeTabWidget(int w, int h);
70 void statusChanged(RemoteView::RemoteStatus status);
71 void showRemoteViewToolbar();
72 void takeScreenshot();
73 void switchFullscreen();
74 void disconnect();
75 void closeTab(QWidget *widget);
76 void viewOnly(bool viewOnly);
77 void showLocalCursor(bool showLocalCursor);
78 void grabAllKeys(bool grabAllKeys);
79 void scale(bool scale);
80 void updateActionStatus();
81 void updateConfiguration();
82 void tabChanged(int index);
83 void createStartPage();
84 void newVncConnection();
85 void newNxConnection();
86 void newRdpConnection();
87 void createZeroconfPage();
88 void closeZeroconfPage();
89 void openFromDockWidget(const QModelIndex &index);
91 private:
92 void setupActions();
93 QScrollArea *createScrollArea(QWidget *parent, RemoteView *remoteView);
95 QWidget *m_fullscreenWindow;
96 QByteArray m_mainWindowGeometry;
98 KToggleAction *m_menubarAction;
99 KTabWidget *m_tabWidget;
100 KUrlNavigator *m_addressNavigator;
102 FloatingToolBar *m_toolBar;
104 BookmarkManager *m_bookmarkManager;
106 QList<RemoteView *> m_remoteViewList;
108 int m_topBottomBorder; // tabwidget borders
109 int m_leftRightBorder;
111 int m_currentRemoteView;
112 bool m_showStartPage;
113 bool m_switchFullscreenWhenConnected;
115 SystemTrayIcon *m_systemTrayIcon;
116 ZeroconfPage *m_zeroconfPage;
119 #include <QApplication>
120 #include <QDesktopWidget>
121 #include <QMouseEvent>
123 class MinimizePixel : public QWidget
125 Q_OBJECT
126 public:
127 MinimizePixel(QWidget *parent)
128 : QWidget(parent) {
129 setFixedSize(1, 1);
130 move(QApplication::desktop()->screenGeometry().width() - 1, 0);
133 signals:
134 void rightClicked();
136 protected:
137 void mousePressEvent(QMouseEvent *event) {
138 if (event->button() == Qt::RightButton)
139 emit rightClicked();
143 #include <QScrollArea>
145 class RemoteViewScrollArea : public QScrollArea
147 Q_OBJECT
148 public:
149 RemoteViewScrollArea(QWidget *parent)
150 : QScrollArea(parent) {
153 signals:
154 void resized(int w, int h);
156 protected:
157 void resizeEvent(QResizeEvent *event) {
158 QScrollArea::resizeEvent(event);
159 emit resized(width() - 2*frameWidth(), height() - 2*frameWidth());
163 #endif