From 89eee25d7b5ca016359e45402413822b74bf2c42 Mon Sep 17 00:00:00 2001 From: Christian Pulvermacher Date: Sat, 21 Jan 2012 00:21:38 +0100 Subject: [PATCH] run astyle (k&r style, indent with 4 spaces) --- src/connectdialog.cpp | 10 ++--- src/connectdialog.h | 23 +++++------ src/fullscreenexitbutton.h | 4 +- src/keymenu.h | 32 +++++++-------- src/main.cpp | 19 ++++----- src/mainwindow.cpp | 92 ++++++++++++++++++++++---------------------- src/mainwindow.h | 67 ++++++++++++++++---------------- src/preferences.h | 21 +++++----- src/remoteview.cpp | 30 +++++++-------- src/remoteview.h | 18 ++++----- src/scrollarea.h | 73 +++++++++++++++++------------------ src/vncclientthread.cpp | 42 ++++++++++---------- src/vncclientthread.h | 18 ++++----- src/vncview.cpp | 67 ++++++++++++++++---------------- src/vncview.h | 8 ++-- 15 files changed, 265 insertions(+), 259 deletions(-) diff --git a/src/connectdialog.cpp b/src/connectdialog.cpp index d9548e1..f1e590f 100644 --- a/src/connectdialog.cpp +++ b/src/connectdialog.cpp @@ -95,7 +95,7 @@ void ConnectDialog::hostnameUpdated(QString newtext) if(!normal_entry) { if(newtext != LISTEN_FOR_INCOMING_CONNECTIONS_STRING) { hosts.setCurrentIndex(-1); - } else { + } else { return; } } @@ -136,10 +136,10 @@ void ConnectDialog::accept() //ask user if listen_port is correct bool ok; listen_port = QInputDialog::getInt(this, - tr("Listen for Incoming Connections"), - tr("Listen on Port:"), - listen_port, 1, 65535, //value, min, max - 1, &ok); + tr("Listen for Incoming Connections"), + tr("Listen on Port:"), + listen_port, 1, 65535, //value, min, max + 1, &ok); if(ok) { settings.setValue("listen_port", listen_port); diff --git a/src/connectdialog.h b/src/connectdialog.h index ee19286..b5b35fc 100644 --- a/src/connectdialog.h +++ b/src/connectdialog.h @@ -24,21 +24,22 @@ class QMaemo5ListPickSelector; -class ConnectDialog : public QDialog { - Q_OBJECT +class ConnectDialog : public QDialog +{ + Q_OBJECT public: - ConnectDialog(QWidget *parent); + ConnectDialog(QWidget *parent); public slots: - virtual void accept(); + virtual void accept(); signals: - void connectToHost(QString url, int quality, int listen_port, bool view_only); + void connectToHost(QString url, int quality, int listen_port, bool view_only); private slots: - void hostnameUpdated(QString newtext); + void hostnameUpdated(QString newtext); private: - QStringList hostnames_sorted; - QPushButton done; - QComboBox hosts; - QComboBox quality_combobox; - QCheckBox viewonly; + QStringList hostnames_sorted; + QPushButton done; + QComboBox hosts; + QComboBox quality_combobox; + QCheckBox viewonly; }; #endif diff --git a/src/fullscreenexitbutton.h b/src/fullscreenexitbutton.h index 5d7311c..69b3352 100644 --- a/src/fullscreenexitbutton.h +++ b/src/fullscreenexitbutton.h @@ -60,7 +60,7 @@ private: }; FullScreenExitButton::FullScreenExitButton(QWidget *parent) - : QToolButton(parent) + : QToolButton(parent) { Q_ASSERT(parent); @@ -105,7 +105,7 @@ bool FullScreenExitButton::eventFilter(QObject *obj, QEvent *ev) case QEvent::MouseButtonRelease: case QEvent::MouseMove: case QEvent::HoverMove: - //fall through to show button + //fall through to show button case QEvent::WindowStateChange: setVisible(isFullScreen); if (isFullScreen) diff --git a/src/keymenu.h b/src/keymenu.h index 1e22ae3..82d7c6d 100644 --- a/src/keymenu.h +++ b/src/keymenu.h @@ -23,28 +23,30 @@ #include -class KeyMenu : public QDialog { - Q_OBJECT +class KeyMenu : public QDialog +{ + Q_OBJECT public: - KeyMenu(QWidget *parent); - QKeySequence getKeySequence() { return keysequence; } + KeyMenu(QWidget *parent); + QKeySequence getKeySequence() { return keysequence; } public slots: - virtual void accept(); - virtual int exec() { keysequence = QKeySequence(); return QDialog::exec(); } + virtual void accept(); + virtual int exec() { keysequence = QKeySequence(); return QDialog::exec(); } private: - QKeySequence keysequence; + QKeySequence keysequence; }; -class ActionTab : public QScrollArea { - Q_OBJECT +class ActionTab : public QScrollArea +{ + Q_OBJECT public: - ActionTab(KeyMenu *parent); - void addAction(QAction *action); //adds action and connects it to keymenu->accept() - void addAction(QString text, QKeySequence keysequence); + ActionTab(KeyMenu *parent); + void addAction(QAction *action); //adds action and connects it to keymenu->accept() + void addAction(QString text, QKeySequence keysequence); private: - QWidget widget; - QHBoxLayout layout; - KeyMenu *keymenu; + QWidget widget; + QHBoxLayout layout; + KeyMenu *keymenu; }; #endif diff --git a/src/main.cpp b/src/main.cpp index 9963c6c..427fd4f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,18 +27,19 @@ const QString APPNAME("Presence VNC"); -void printHelp() { +void printHelp() +{ std::cout << "Usage: " << qPrintable(QCoreApplication::arguments().at(0)) << " [options] [URL [quality]]\n" - << "\nOptions:\n" - << " --help\t\t\t Print this text and exit.\n" - << " --listen [port]\t Listen for incoming connections on given port, or 5500 if omitted. Cannot be used with an URL.\n" - << " --viewonly\t\t Don't send mouse/keyboard input to remote desktop. This is only useful if you also supply a URL, or --listen.\n" + << "\nOptions:\n" + << " --help\t\t\t Print this text and exit.\n" + << " --listen [port]\t Listen for incoming connections on given port, or 5500 if omitted. Cannot be used with an URL.\n" + << " --viewonly\t\t Don't send mouse/keyboard input to remote desktop. This is only useful if you also supply a URL, or --listen.\n" - << "\nURLs:\n" - << " vnc://:password@server:display\n\n" - << " Password and display can be omitted, e.g. vnc://server is a valid URL.\n" - << " Optionally, you can define the quality as a second argument (1-3, where 1 is the best). Default is 2.\n"; + << "\nURLs:\n" + << " vnc://:password@server:display\n\n" + << " Password and display can be omitted, e.g. vnc://server is a valid URL.\n" + << " Optionally, you can define the quality as a second argument (1-3, where 1 is the best). Default is 2.\n"; } int main(int argc, char *argv[]) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 24aab66..c1a9b1c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -124,7 +124,7 @@ MainWindow::MainWindow(QString url, int quality, int listen_port, bool view_only this, SLOT(updateScreenSpaceDelayed())); #ifdef Q_WS_MAEMO_5 QDBusConnection::systemBus().connect("", MCE_SIGNAL_PATH, MCE_SIGNAL_IF, MCE_DISPLAY_SIG, - this, SLOT(displayStateChanged(QString))); + this, SLOT(displayStateChanged(QString))); #endif setCentralWidget(scroll_area); @@ -154,11 +154,12 @@ void MainWindow::grabZoomKeys(bool grab) return; } XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, - 32, PropModeReplace, reinterpret_cast(&val), 1); + 32, PropModeReplace, reinterpret_cast(&val), 1); #endif } -void MainWindow::closeEvent(QCloseEvent*) { +void MainWindow::closeEvent(QCloseEvent*) +{ grabZoomKeys(false); QSettings settings; @@ -171,9 +172,10 @@ void MainWindow::closeEvent(QCloseEvent*) { disconnectFromHost(); } -void MainWindow::about() { +void MainWindow::about() +{ QMessageBox::about(this, tr("About Presence VNC"), - tr("

Presence VNC 0.8

\ + tr("

Presence VNC 0.8

\

A touchscreen friendly VNC client

\

http://presencevnc.garage.maemo.org/

\

©2010 Christian Pulvermacher <pulvermacher@gmx.de>
\ @@ -230,52 +232,52 @@ void MainWindow::statusChanged(RemoteView::RemoteStatus status) static RemoteView::RemoteStatus old_status = RemoteView::Disconnected; switch(status) { - case RemoteView::Connecting: + case RemoteView::Connecting: #ifdef Q_WS_MAEMO_5 - setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true); + setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true); #endif - break; - case RemoteView::Connected: + break; + case RemoteView::Connected: #ifdef Q_WS_MAEMO_5 - setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); + setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); #endif - toolbar->setEnabled(true); + toolbar->setEnabled(true); - //disable key input buttons in view only mode - input_toolbuttons->setEnabled(!vnc_view->viewOnly()); + //disable key input buttons in view only mode + input_toolbuttons->setEnabled(!vnc_view->viewOnly()); - vnc_view->setZoomLevel(zoom_slider->value()); - vnc_view->useFastTransformations(false); - vnc_view->repaint(); - break; - case RemoteView::Disconnecting: - if(old_status == RemoteView::Disconnected) //Disconnecting also occurs while connecting, so check last state - break; - - if(disconnect_action->isEnabled()) //don't show when manually disconnecting - scroll_area->showMessage(tr("Connection lost")); - - //clean up - scroll_area->setWidget(0); - vnc_view = 0; - setWindowTitle("Presence VNC"); - disconnect_action->setEnabled(false); - toolbar->setEnabled(false); - - //exit fullscreen mode - if(windowState() & Qt::WindowFullScreen) - setWindowState(windowState() ^ Qt::WindowFullScreen); + vnc_view->setZoomLevel(zoom_slider->value()); + vnc_view->useFastTransformations(false); + vnc_view->repaint(); + break; + case RemoteView::Disconnecting: + if(old_status == RemoteView::Disconnected) //Disconnecting also occurs while connecting, so check last state break; - case RemoteView::Disconnected: + + if(disconnect_action->isEnabled()) //don't show when manually disconnecting + scroll_area->showMessage(tr("Connection lost")); + + //clean up + scroll_area->setWidget(0); + vnc_view = 0; + setWindowTitle("Presence VNC"); + disconnect_action->setEnabled(false); + toolbar->setEnabled(false); + + //exit fullscreen mode + if(windowState() & Qt::WindowFullScreen) + setWindowState(windowState() ^ Qt::WindowFullScreen); + break; + case RemoteView::Disconnected: #ifdef Q_WS_MAEMO_5 - setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); + setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); #endif - if(old_status == RemoteView::Disconnecting) { - scroll_area->setWidget(0); //remove widget - } - break; - default: //avoid compiler warnings - break; + if(old_status == RemoteView::Disconnecting) { + scroll_area->setWidget(0); //remove widget + } + break; + default: //avoid compiler warnings + break; } old_status = status; @@ -307,7 +309,7 @@ void MainWindow::toggleFullscreen() menuBar()->setVisible(in_fullscreen); #endif - setWindowState(windowState() ^ Qt::WindowFullScreen); + setWindowState(windowState() ^ Qt::WindowFullScreen); updateScreenSpaceDelayed(); } @@ -388,8 +390,8 @@ void MainWindow::setZoomLevel(int level) center = center * (double(new_factor)/old_factor); scroll_area->ensureVisible(center.x(), center.y(), - vnc_view->visibleRegion().boundingRect().width()/2, - vnc_view->visibleRegion().boundingRect().height()/2); + vnc_view->visibleRegion().boundingRect().width()/2, + vnc_view->visibleRegion().boundingRect().height()/2); vnc_view->useFastTransformations(zoom_slider->isSliderDown()); vnc_view->update(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 441062b..f487bf9 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -27,44 +27,45 @@ class KeyMenu; class ScrollArea; class VncView; -class MainWindow : public QMainWindow { - Q_OBJECT +class MainWindow : public QMainWindow +{ + Q_OBJECT public: - MainWindow(QString url, int quality, int listen_port, bool view_only); + MainWindow(QString url, int quality, int listen_port, bool view_only); public slots: - void about(); - void showConnectDialog(); - void connectToHost(QString url, int quality, int listen_port, bool view_only); - void disconnectFromHost(); - void updateScreenSpace(); - void updateScreenSpaceDelayed(); - void sendTab(); - void sendEsc(); - void sendPgUp(); - void sendPgDn(); - void sendReturn(); - void setZoomLevel(int level); - void showInputPanel(); - void showKeyMenu(); - void showPreferences(); - void statusChanged(RemoteView::RemoteStatus status); - void toggleFullscreen(); - void zoomSliderReleased(); + void about(); + void showConnectDialog(); + void connectToHost(QString url, int quality, int listen_port, bool view_only); + void disconnectFromHost(); + void updateScreenSpace(); + void updateScreenSpaceDelayed(); + void sendTab(); + void sendEsc(); + void sendPgUp(); + void sendPgDn(); + void sendReturn(); + void setZoomLevel(int level); + void showInputPanel(); + void showKeyMenu(); + void showPreferences(); + void statusChanged(RemoteView::RemoteStatus status); + void toggleFullscreen(); + void zoomSliderReleased(); void displayStateChanged(QString state); protected: - void closeEvent(QCloseEvent*); - void resizeEvent(QResizeEvent *event); + void closeEvent(QCloseEvent*); + void resizeEvent(QResizeEvent *event); private: - void grabZoomKeys(bool grab); - void reloadSettings(); + void grabZoomKeys(bool grab); + void reloadSettings(); - VncView *vnc_view; - ScrollArea *scroll_area; - QToolBar *toolbar; - QSlider *zoom_slider; - QAction *scaling, *show_toolbar, *disconnect_action; - QActionGroup *input_toolbuttons; - KeyMenu *key_menu; - bool zoom_to_cursor; + VncView *vnc_view; + ScrollArea *scroll_area; + QToolBar *toolbar; + QSlider *zoom_slider; + QAction *scaling, *show_toolbar, *disconnect_action; + QActionGroup *input_toolbuttons; + KeyMenu *key_menu; + bool zoom_to_cursor; }; #endif diff --git a/src/preferences.h b/src/preferences.h index 7f95375..8ae9d1f 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -26,20 +26,21 @@ class QMaemo5ListPickSelector; void migrateConfiguration(); //checks for old configuration and migrates them if necessary -class Preferences : public QDialog { - Q_OBJECT +class Preferences : public QDialog +{ + Q_OBJECT public: - Preferences(QWidget *parent); + Preferences(QWidget *parent); private slots: - void save(); + void save(); private: - QSettings settings; + QSettings settings; #ifdef Q_WS_MAEMO_5 - QMaemo5ListPickSelector *rotation_selector; - QMaemo5ListPickSelector *leftzoom_selector; - QMaemo5ListPickSelector *rightzoom_selector; - QCheckBox *disable_tapping; + QMaemo5ListPickSelector *rotation_selector; + QMaemo5ListPickSelector *leftzoom_selector; + QMaemo5ListPickSelector *rightzoom_selector; + QCheckBox *disable_tapping; #endif - QCheckBox *always_show_local_cursor, *zoom_to_cursor; + QCheckBox *always_show_local_cursor, *zoom_to_cursor; }; #endif diff --git a/src/remoteview.cpp b/src/remoteview.cpp index 8bbcd67..611d9e1 100644 --- a/src/remoteview.cpp +++ b/src/remoteview.cpp @@ -25,25 +25,25 @@ #include "remoteview.h" #ifndef QTONLY - #include - #include +#include +#include #endif #include RemoteView::RemoteView(QWidget *parent) - : QWidget(parent), - m_status(Disconnected), - m_host(QString()), - m_port(0), - m_viewOnly(false), - m_grabAllKeys(false), - m_scale(true), - m_keyboardIsGrabbed(false), + : QWidget(parent), + m_status(Disconnected), + m_host(QString()), + m_port(0), + m_viewOnly(false), + m_grabAllKeys(false), + m_scale(true), + m_keyboardIsGrabbed(false), #ifndef QTONLY - m_wallet(0), + m_wallet(0), #endif - m_dotCursorState(CursorOff) + m_dotCursorState(CursorOff) { } @@ -209,7 +209,7 @@ QString RemoteView::readWalletPassword(bool fromUserNameOnly) kDebug(5010) << "Wallet OK"; m_wallet->setFolder(KRDCFOLDER); QString password; - + QString key; if (fromUserNameOnly) key = m_url.userName(); @@ -244,8 +244,8 @@ void RemoteView::saveWalletPassword(const QString &password, bool fromUserNameOn QCursor RemoteView::localDotCursor() const { - //we take care of this in paintEvent() - return QCursor(Qt::BlankCursor); + //we take care of this in paintEvent() + return QCursor(Qt::BlankCursor); } void RemoteView::focusInEvent(QFocusEvent *event) diff --git a/src/remoteview.h b/src/remoteview.h index b3d734f..4cbed3b 100644 --- a/src/remoteview.h +++ b/src/remoteview.h @@ -26,12 +26,12 @@ #define REMOTEVIEW_H #ifdef QTONLY - #include - #define KUrl QUrl - #define KDE_EXPORT +#include +#define KUrl QUrl +#define KDE_EXPORT #else - #include - #include +#include +#include #endif #include @@ -237,20 +237,20 @@ public: * @see statusChanged() */ virtual bool start() = 0; - + /** * Called when the configuration is changed. * The default implementation does nothing. */ virtual void updateConfiguration(); - + #ifndef QTONLY /** * Returns the current host preferences of this view. */ virtual HostPreferences* hostPreferences() = 0; #endif - + /** * Returns the current status of the connection. * @return the status of the connection @@ -340,7 +340,7 @@ signals: * Emitted when the view has a specific error. */ void errorMessage(const QString &title, const QString &message); - + /** * Emitted when the status of the view changed. * @param s the new status diff --git a/src/scrollarea.h b/src/scrollarea.h index 19a18a1..956555b 100644 --- a/src/scrollarea.h +++ b/src/scrollarea.h @@ -24,49 +24,46 @@ #include //fixes tearing during scrolling and can display messages -class ScrollArea : public QScrollArea { +class ScrollArea : public QScrollArea +{ public: - ScrollArea(QWidget *parent): - QScrollArea(parent) - { - message.setParent(this); - message.setVisible(false); - message.setAlignment(Qt::AlignCenter); - message.setWordWrap(true); + ScrollArea(QWidget *parent): + QScrollArea(parent) { + message.setParent(this); + message.setVisible(false); + message.setAlignment(Qt::AlignCenter); + message.setWordWrap(true); - QPalette pal = message.palette(); - QColor backgroundColor = pal.color(backgroundRole()); - backgroundColor.setAlpha(128); - pal.setColor(backgroundRole(), backgroundColor); - message.setPalette(pal); - message.setAutoFillBackground(true); + QPalette pal = message.palette(); + QColor backgroundColor = pal.color(backgroundRole()); + backgroundColor.setAlpha(128); + pal.setColor(backgroundRole(), backgroundColor); + message.setPalette(pal); + message.setAutoFillBackground(true); - timer.setSingleShot(true); - timer.setInterval(2500); - connect(&timer, SIGNAL(timeout()), - &message, SLOT(hide())); - } + timer.setSingleShot(true); + timer.setInterval(2500); + connect(&timer, SIGNAL(timeout()), + &message, SLOT(hide())); + } - void showMessage(const QString &s) - { - message.setText(s); - message.show(); - timer.start(); - } + void showMessage(const QString &s) { + message.setText(s); + message.show(); + timer.start(); + } protected: - virtual void resizeEvent(QResizeEvent* ev) - { - QScrollArea::resizeEvent(ev); - message.setFixedWidth(width()); - } - virtual void scrollContentsBy(int dx, int dy) - { - QScrollArea::scrollContentsBy(dx, dy); - if(widget()) - widget()->update(); //update whole widget - } + virtual void resizeEvent(QResizeEvent* ev) { + QScrollArea::resizeEvent(ev); + message.setFixedWidth(width()); + } + virtual void scrollContentsBy(int dx, int dy) { + QScrollArea::scrollContentsBy(dx, dy); + if(widget()) + widget()->update(); //update whole widget + } private: - QLabel message; - QTimer timer; + QLabel message; + QTimer timer; }; #endif diff --git a/src/vncclientthread.cpp b/src/vncclientthread.cpp index 23d91c5..78f0971 100644 --- a/src/vncclientthread.cpp +++ b/src/vncclientthread.cpp @@ -49,25 +49,25 @@ rfbBool VncClientThread::newclient(rfbClient *cl) cl->format.blueMax = 0xff; switch (t->quality()) { - case RemoteView::High: - cl->appData.useBGR233 = 0; - cl->appData.encodingsString = "copyrect hextile raw"; - cl->appData.compressLevel = 0; - cl->appData.qualityLevel = 9; - break; - case RemoteView::Medium: - cl->appData.useBGR233 = 0; - cl->appData.encodingsString = "tight zrle ultra copyrect hextile zlib corre rre raw"; - cl->appData.compressLevel = 5; - cl->appData.qualityLevel = 7; - break; - case RemoteView::Low: - case RemoteView::Unknown: - default: - cl->appData.useBGR233 = 1; - cl->appData.encodingsString = "tight zrle ultra copyrect hextile zlib corre rre raw"; - cl->appData.compressLevel = 9; - cl->appData.qualityLevel = 1; + case RemoteView::High: + cl->appData.useBGR233 = 0; + cl->appData.encodingsString = "copyrect hextile raw"; + cl->appData.compressLevel = 0; + cl->appData.qualityLevel = 9; + break; + case RemoteView::Medium: + cl->appData.useBGR233 = 0; + cl->appData.encodingsString = "tight zrle ultra copyrect hextile zlib corre rre raw"; + cl->appData.compressLevel = 5; + cl->appData.qualityLevel = 7; + break; + case RemoteView::Low: + case RemoteView::Unknown: + default: + cl->appData.useBGR233 = 1; + cl->appData.encodingsString = "tight zrle ultra copyrect hextile zlib corre rre raw"; + cl->appData.compressLevel = 9; + cl->appData.qualityLevel = 1; } SetFormatAndEncodings(cl); @@ -162,9 +162,9 @@ void VncClientThread::outputHandler(const char *format, ...) outputErrorMessageString = "INTERNAL:APPLE_VNC_COMPATIBILTY"; } - VncClientThread::VncClientThread(QObject *parent) +VncClientThread::VncClientThread(QObject *parent) : QThread(parent) - , frameBuffer(0) + , frameBuffer(0) { QMutexLocker locker(&mutex); m_stopped = false; diff --git a/src/vncclientthread.h b/src/vncclientthread.h index bab6b2a..e3fc4c2 100644 --- a/src/vncclientthread.h +++ b/src/vncclientthread.h @@ -25,13 +25,13 @@ #define VNCCLIENTTHREAD_H #ifdef QTONLY - #include - #define kDebug(n) qDebug() - #define kBacktrace() "" - #define i18n tr +#include +#define kDebug(n) qDebug() +#define kBacktrace() "" +#define i18n tr #else - #include - #include +#include +#include #endif #include "remoteview.h" @@ -57,7 +57,7 @@ class KeyClientEvent : public ClientEvent { public: KeyClientEvent(int key, int pressed) - : m_key(key), m_pressed(pressed) {} + : m_key(key), m_pressed(pressed) {} void fire(rfbClient*); @@ -70,7 +70,7 @@ class PointerClientEvent : public ClientEvent { public: PointerClientEvent(int x, int y, int buttonMask) - : m_x(x), m_y(y), m_buttonMask(buttonMask) {} + : m_x(x), m_y(y), m_buttonMask(buttonMask) {} void fire(rfbClient*); @@ -84,7 +84,7 @@ class ClientCutEvent : public ClientEvent { public: ClientCutEvent(const QString &text) - : text(text) {} + : text(text) {} void fire(rfbClient*); diff --git a/src/vncview.cpp b/src/vncview.cpp index 24119a2..481bc02 100644 --- a/src/vncview.cpp +++ b/src/vncview.cpp @@ -45,21 +45,21 @@ const int DOUBLE_TAP_UP_TIME = 500; VncView::VncView(QWidget *parent, const KUrl &url, RemoteView::Quality quality, int listen_port) - : RemoteView(parent), - m_initDone(false), - m_buttonMask(0), - cursor_x(0), - cursor_y(0), - m_quitFlag(false), - m_firstPasswordTry(true), - m_dontSendClipboard(false), - m_horizontalFactor(1.0), - m_verticalFactor(1.0), - m_forceLocalCursor(false), - quality(quality), - listen_port(listen_port), - transformation_mode(Qt::FastTransformation), - display_off(false) + : RemoteView(parent), + m_initDone(false), + m_buttonMask(0), + cursor_x(0), + cursor_y(0), + m_quitFlag(false), + m_firstPasswordTry(true), + m_dontSendClipboard(false), + m_horizontalFactor(1.0), + m_verticalFactor(1.0), + m_forceLocalCursor(false), + quality(quality), + listen_port(listen_port), + transformation_mode(Qt::FastTransformation), + display_off(false) { m_url = url; m_host = url.host(); @@ -104,7 +104,7 @@ bool VncView::eventFilter(QObject *obj, QEvent *event) event->ignore(); return true; - } + } } return RemoteView::eventFilter(obj, event); @@ -136,7 +136,7 @@ void VncView::startQuitting() m_quitFlag = true; - vncThread.stop(); + vncThread.stop(); const bool quitSuccess = vncThread.wait(700); if(!quitSuccess) { @@ -159,7 +159,7 @@ bool VncView::start() { vncThread.setHost(m_host); vncThread.setPort(m_port); - vncThread.setListenPort(listen_port); //if port is != 0, thread will listen for connections + vncThread.setListenPort(listen_port); //if port is != 0, thread will listen for connections vncThread.setQuality(quality); // set local cursor on by default because low quality mostly means slow internet connection @@ -266,7 +266,7 @@ void VncView::updateImage(int x, int y, int w, int h) return; } - //kDebug(5011) << "got update" << width() << height(); + //kDebug(5011) << "got update" << width() << height(); m_x = x; m_y = y; @@ -297,15 +297,15 @@ void VncView::updateImage(int x, int y, int w, int h) setFocusPolicy(Qt::WheelFocus); setStatus(Connected); emit connected(); - + resize(width(), height()); - + m_initDone = true; } - static QSize old_frame_size = QSize(); + static QSize old_frame_size = QSize(); if ((y == 0 && x == 0) && (m_frame.size() != old_frame_size)) { - old_frame_size = m_frame.size(); + old_frame_size = m_frame.size(); kDebug(5011) << "Updating framebuffer size"; setZoomLevel(); useFastTransformations(false); @@ -323,11 +323,11 @@ void VncView::setViewOnly(bool viewOnly) m_dontSendClipboard = viewOnly; if (viewOnly) { - showDotCursor(CursorOff); + showDotCursor(CursorOff); setCursor(Qt::ArrowCursor); } else { setCursor(m_dotCursorState == CursorOn ? localDotCursor() : Qt::BlankCursor); - } + } } void VncView::showDotCursor(DotCursorState state) @@ -396,14 +396,14 @@ void VncView::paintEvent(QPaintEvent *event) const int sw = qRound(update_rect.width()/m_horizontalFactor); const int sh = qRound(update_rect.height()/m_verticalFactor); - painter.drawImage(update_rect, - m_frame.copy(sx, sy, sw, sh) - .scaled(update_rect.size(), Qt::IgnoreAspectRatio, transformation_mode)); + painter.drawImage(update_rect, + m_frame.copy(sx, sy, sw, sh) + .scaled(update_rect.size(), Qt::IgnoreAspectRatio, transformation_mode)); } else { //kDebug(5011) << "Full repaint" << width() << height() << m_frame.width() << m_frame.height(); painter.drawImage(rect(), - m_frame.scaled(size(), Qt::IgnoreAspectRatio, transformation_mode)); + m_frame.scaled(size(), Qt::IgnoreAspectRatio, transformation_mode)); } //draw local cursor ourselves, normal mouse pointer doesn't deal with scrolling @@ -544,7 +544,8 @@ void VncView::mouseEventHandler(QMouseEvent *e) //and refresh new one repaint(cursor_x*m_horizontalFactor - CURSOR_SIZE/2, cursor_y*m_verticalFactor - CURSOR_SIZE/2, CURSOR_SIZE, CURSOR_SIZE); - old_cursor_x = cursor_x; old_cursor_y = cursor_y; + old_cursor_x = cursor_x; + old_cursor_y = cursor_y; } } @@ -585,9 +586,9 @@ void VncView::keyEventHandler(QKeyEvent *e) //don't send ISO_Level3_Shift (would break things like Win+0-9) //also enable IM so symbol key works if(k == 0xfe03) { - setAttribute(Qt::WA_InputMethodEnabled, pressed); - e->ignore(); - return; + setAttribute(Qt::WA_InputMethodEnabled, pressed); + e->ignore(); + return; } #endif diff --git a/src/vncview.h b/src/vncview.h index e87e84e..d763b99 100644 --- a/src/vncview.h +++ b/src/vncview.h @@ -27,7 +27,7 @@ #include "remoteview.h" #include "vncclientthread.h" -class KConfigGroup{}; +class KConfigGroup {}; #include @@ -52,14 +52,14 @@ public: bool start(); bool supportsScaling() const; bool supportsLocalCursor() const; - + void setQuality(int q); void setViewOnly(bool viewOnly); void showDotCursor(DotCursorState state); void useFastTransformations(bool enabled); QPoint cursorPosition() { return QPoint(cursor_x, cursor_y); } void setDisplayOff(bool off) { display_off = off; } - + public slots: void setZoomLevel(int level = -1); //'level' doesn't correspond to actual magnification, though mapping is done here void sendKey(Qt::Key key); @@ -98,7 +98,7 @@ private: void keyEventHandler(QKeyEvent *e); void unpressModifiers(); void wheelEventHandler(QWheelEvent *event); - + private slots: void mouseEventHandler(QMouseEvent *event = 0); -- 1.7.9.5