Commit 56a0222b authored by Oleg `Kanedias` Chernovskiy's avatar Oleg `Kanedias` Chernovskiy Committed by Albert Astals Cid
Browse files

Prepare for local cursor rework: rename relevant symbols

parent 1f740416
......@@ -41,7 +41,7 @@ RemoteView::RemoteView(QWidget *parent)
#ifndef QTONLY
m_wallet(nullptr),
#endif
m_dotCursorState(CursorOff)
m_localCursorState(CursorOff)
{
resize(0, 0);
}
......@@ -166,14 +166,14 @@ QPixmap RemoteView::takeScreenshot()
return grab();
}
void RemoteView::showDotCursor(DotCursorState state)
void RemoteView::showLocalCursor(LocalCursorState state)
{
m_dotCursorState = state;
m_localCursorState = state;
}
RemoteView::DotCursorState RemoteView::dotCursorState() const
RemoteView::LocalCursorState RemoteView::localCursorState() const
{
return m_dotCursorState;
return m_localCursorState;
}
bool RemoteView::scaling() const
......@@ -249,7 +249,7 @@ void RemoteView::saveWalletPasswordForKey(const QString &key, const QString &pas
}
#endif
QCursor RemoteView::localDotCursor() const
QCursor RemoteView::localDefaultCursor() const
{
QString cursorBitmapPath = QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String("pics/pointcursor.png"));
QBitmap cursorBitmap = QBitmap();
......
......@@ -76,13 +76,13 @@ public:
* is a dot and the remote cursor is the 'real' cursor, usually an arrow.
*/
enum DotCursorState {
CursorOn, ///< Always show local cursor (and the remote one).
enum LocalCursorState {
CursorOn, ///< Always show local cursor based on remote one (or fallback to default).
CursorOff, ///< Never show local cursor, only the remote one.
/// Try to measure the lag and enable the local cursor if the latency is too high.
CursorAuto
};
Q_ENUM(DotCursorState)
Q_ENUM(LocalCursorState)
/**
* State of the connection. The state of the connection is returned
......@@ -145,9 +145,9 @@ public:
* Checks whether the backend supports the concept of local cursors. The
* default implementation returns false.
* @return true if local cursors are supported/known
* @see DotCursorState
* @see showDotCursor()
* @see dotCursorState()
* @see LocalCursorState
* @see showLocalCursor()
* @see localCursorState()
*/
virtual bool supportsLocalCursor() const;
......@@ -156,27 +156,27 @@ public:
* The default implementation does nothing.
* @param state the new state (CursorOn, CursorOff or
* CursorAuto)
* @see dotCursorState()
* @see localCursorState()
* @see supportsLocalCursor()
*/
virtual void showDotCursor(DotCursorState state);
virtual void showLocalCursor(LocalCursorState state);
/**
* Returns the state of the local cursor. The default implementation returns
* always CursorOff.
* @return true if local cursors are supported/known
* @see showDotCursor()
* @see showLocalCursor()
* @see supportsLocalCursor()
*/
virtual DotCursorState dotCursorState() const;
virtual LocalCursorState localCursorState() const;
/**
* Checks whether the backend supports the view only mode. The
* default implementation returns false.
* @return true if view-only mode is supported
* @see DotCursorState
* @see showDotCursor()
* @see dotCursorState()
* @see LocalCursorState
* @see showLocalCursor()
* @see localCursorState()
*/
virtual bool supportsViewOnly() const;
......@@ -397,7 +397,7 @@ protected:
*/
virtual void setStatus(RemoteStatus s);
QCursor localDotCursor() const;
QCursor localDefaultCursor() const;
QString m_host;
int m_port;
......@@ -415,7 +415,7 @@ protected:
KWallet::Wallet *m_wallet;
#endif
DotCursorState m_dotCursorState;
LocalCursorState m_localCursorState;
};
#endif
......@@ -302,7 +302,7 @@ void MainWindow::newConnection(const QUrl &newUrl, bool switchFullscreenWhenConn
// if the user press cancel
if (! prefs->showDialogIfNeeded(this)) return;
view->showDotCursor(prefs->showLocalCursor() ? RemoteView::CursorOn : RemoteView::CursorOff);
view->showLocalCursor(prefs->showLocalCursor() ? RemoteView::CursorOn : RemoteView::CursorOff);
view->setViewOnly(prefs->viewOnly());
if (! switchFullscreenWhenConnected) view->enableScaling(prefs->windowedScale());
......@@ -736,7 +736,7 @@ void MainWindow::showLocalCursor(bool showLocalCursor)
qCDebug(KRDC) << showLocalCursor;
RemoteView* view = currentRemoteView();
view->showDotCursor(showLocalCursor ? RemoteView::CursorOn : RemoteView::CursorOff);
view->showLocalCursor(showLocalCursor ? RemoteView::CursorOn : RemoteView::CursorOff);
view->hostPreferences()->setShowLocalCursor(showLocalCursor);
saveHostPrefs(view);
}
......@@ -852,7 +852,7 @@ void MainWindow::updateActionStatus()
setActionStatus(actionCollection()->action(QStringLiteral("show_local_cursor")),
enabled,
view ? view->supportsLocalCursor() : false,
view ? view->dotCursorState() == RemoteView::CursorOn : false);
view ? view->localCursorState() == RemoteView::CursorOn : false);
setActionStatus(actionCollection()->action(QStringLiteral("scale")),
enabled,
......
......@@ -65,7 +65,7 @@ void VncClientThread::cuttextStatic(rfbClient *cl, const char *text, int textlen
// Dispatch from this static callback context to the member context.
char *VncClientThread::passwdHandlerStatic(rfbClient *cl)
{
VncClientThread *t = (VncClientThread *)rfbClientGetClientData(cl, nullptr);
VncClientThread *t = (VncClientThread *) rfbClientGetClientData(cl, nullptr);
Q_ASSERT(t);
return t->passwdHandler();
......@@ -74,7 +74,7 @@ char *VncClientThread::passwdHandlerStatic(rfbClient *cl)
// Dispatch from this static callback context to the member context.
rfbCredential *VncClientThread::credentialHandlerStatic(rfbClient *cl, int credentialType)
{
VncClientThread *t = (VncClientThread *)rfbClientGetClientData(cl, nullptr);
VncClientThread *t = (VncClientThread *) rfbClientGetClientData(cl, nullptr);
Q_ASSERT(t);
return t->credentialHandler(credentialType);
......@@ -98,7 +98,7 @@ void VncClientThread::setClientColorDepth(rfbClient* cl, VncClientThread::ColorD
case bpp8:
if (m_colorTable.isEmpty()) {
m_colorTable.resize(256);
int r,g,b;
int r, g, b;
for (int i = 0; i < 256; ++i) {
//pick out the red (3 bits), green (3 bits) and blue (2 bits) bits and make them maximum significant in 8bits
//this gives a colortable for 8bit true colors
......@@ -193,10 +193,10 @@ void VncClientThread::updatefb(int x, int y, int w, int h)
img.setColorTable(m_colorTable);
break;
case bpp16:
img = QImage(cl->frameBuffer, width, height, 2*width, QImage::Format_RGB16);
img = QImage(cl->frameBuffer, width, height, 2 * width, QImage::Format_RGB16);
break;
case bpp32:
img = QImage(cl->frameBuffer, width, height, 4*width, QImage::Format_RGB32);
img = QImage(cl->frameBuffer, width, height, 4 * width, QImage::Format_RGB32);
break;
}
......@@ -398,7 +398,7 @@ void VncClientThread::setQuality(RemoteView::Quality quality)
void VncClientThread::setColorDepth(ColorDepth colorDepth)
{
m_colorDepth= colorDepth;
m_colorDepth = colorDepth;
}
RemoteView::Quality VncClientThread::quality() const
......
......@@ -260,7 +260,7 @@ bool VncView::start()
// set local cursor on by default because low quality mostly means slow internet connection
if (quality == RemoteView::Low) {
showDotCursor(RemoteView::CursorOn);
showLocalCursor(RemoteView::CursorOn);
#ifndef QTONLY
// KRDC does always just have one main window, so at(0) is safe
KXMLGUIClient *mainWindow = dynamic_cast<KXMLGUIClient*>(KMainWindow::memberList().at(0));
......@@ -398,7 +398,7 @@ void VncView::outputErrorMessage(const QString &message)
qCritical(KRDC) << message;
if (message == QLatin1String("INTERNAL:APPLE_VNC_COMPATIBILTY")) {
setCursor(localDotCursor());
setCursor(localDefaultCursor());
m_forceLocalCursor = true;
return;
}
......@@ -442,7 +442,7 @@ void VncView::updateImage(int x, int y, int w, int h)
setAttribute(Qt::WA_OpaquePaintEvent);
installEventFilter(this);
setCursor(((m_dotCursorState == CursorOn) || m_forceLocalCursor) ? localDotCursor() : Qt::BlankCursor);
setCursor(((m_localCursorState == CursorOn) || m_forceLocalCursor) ? localDefaultCursor() : Qt::BlankCursor);
setMouseTracking(true); // get mouse events even when there is no mousebutton pressed
setFocusPolicy(Qt::WheelFocus);
......@@ -501,14 +501,14 @@ void VncView::setViewOnly(bool viewOnly)
if (viewOnly)
setCursor(Qt::ArrowCursor);
else
setCursor(m_dotCursorState == CursorOn ? localDotCursor() : Qt::BlankCursor);
setCursor(m_localCursorState == CursorOn ? localDefaultCursor() : Qt::BlankCursor);
}
void VncView::showDotCursor(DotCursorState state)
void VncView::showLocalCursor(LocalCursorState state)
{
RemoteView::showDotCursor(state);
RemoteView::showLocalCursor(state);
setCursor(state == CursorOn ? localDotCursor() : Qt::BlankCursor);
setCursor(state == CursorOn ? localDefaultCursor() : Qt::BlankCursor);
}
void VncView::enableScaling(bool scale)
......
......@@ -68,7 +68,7 @@ public:
#endif
void setViewOnly(bool viewOnly) override;
void showDotCursor(DotCursorState state) override;
void showLocalCursor(LocalCursorState state) override;
void enableScaling(bool scale) override;
void updateConfiguration() override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment