mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:41:17 -07:00
Use new connect syntax
And a few warning fixes
This commit is contained in:
@@ -24,7 +24,7 @@ QtFrameBuffer::QtFrameBuffer(WId id, QObject *parent)
|
||||
fbImage = QPixmap::grabWindow(win).toImage();
|
||||
fb = new char[fbImage.byteCount()];
|
||||
t = new QTimer(this);
|
||||
connect(t, SIGNAL(timeout()), SLOT(updateFrameBuffer()));
|
||||
connect(t, &QTimer::timeout, this, &QtFrameBuffer::updateFrameBuffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ void QtFrameBuffer::getServerFormat(rfbPixelFormat &format)
|
||||
void QtFrameBuffer::updateFrameBuffer()
|
||||
{
|
||||
QImage img = QPixmap::grabWindow(win).toImage();
|
||||
#if 0 // This is actually slower than updating the whole desktop...
|
||||
QSize imgSize = img.size();
|
||||
|
||||
|
||||
@@ -74,8 +75,6 @@ void QtFrameBuffer::updateFrameBuffer()
|
||||
// fbImage is the previous version of the image,
|
||||
// img is the current one
|
||||
|
||||
#if 0 // This is actually slower than updating the whole desktop...
|
||||
|
||||
QImage map(imgSize, QImage::Format_Mono);
|
||||
map.fill(0);
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
|
||||
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
|
||||
okButton->setDefault(true);
|
||||
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &ConnectionDialog<UI>::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &ConnectionDialog<UI>::reject);
|
||||
buttonBox->button(QDialogButtonBox::Cancel)->setDefault(true);
|
||||
setModal(true);
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ PendingInvitationsRfbClient::PendingInvitationsRfbClient(rfbClientPtr client, QO
|
||||
d->client->clientGoneHook = clientGoneHookNoop;
|
||||
d->notifier = new QSocketNotifier(client->sock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(true);
|
||||
connect(d->notifier, SIGNAL(activated(int)),
|
||||
this, SLOT(onSocketActivated()));
|
||||
connect(d->notifier, &QSocketNotifier::activated,
|
||||
this, &PendingInvitationsRfbClient::onSocketActivated);
|
||||
}
|
||||
|
||||
PendingInvitationsRfbClient::~PendingInvitationsRfbClient()
|
||||
@@ -83,8 +83,8 @@ void PendingInvitationsRfbClient::processNewClient()
|
||||
dialog->setRemoteHost(host);
|
||||
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
|
||||
|
||||
connect(dialog, SIGNAL(accepted()), SLOT(dialogAccepted()));
|
||||
connect(dialog, SIGNAL(rejected()), SLOT(reject()));
|
||||
connect(dialog, &InvitationsConnectionDialog::accepted, this, &PendingInvitationsRfbClient::dialogAccepted);
|
||||
connect(dialog, &InvitationsConnectionDialog::rejected, this, &PendingInvitationsRfbClient::reject);
|
||||
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ void InvitationsRfbServer::init()
|
||||
instance->m_wallet = Wallet::openWallet(
|
||||
Wallet::NetworkWallet(), 0, Wallet::Asynchronous);
|
||||
if(instance->m_wallet) {
|
||||
connect(instance->m_wallet, SIGNAL(walletOpened(bool)),
|
||||
instance, SLOT(walletOpened(bool)));
|
||||
connect(instance->m_wallet, &KWallet::Wallet::walletOpened,
|
||||
instance, &InvitationsRfbServer::walletOpened);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ InvitationsRfbServer::InvitationsRfbServer()
|
||||
|
||||
InvitationsRfbServer::~InvitationsRfbServer()
|
||||
{
|
||||
stop();
|
||||
stop(true);
|
||||
KConfigGroup krfbConfig(KSharedConfig::openConfig(),"Security");
|
||||
krfbConfig.writeEntry("allowUnattendedAccess",m_allowUnattendedAccess);
|
||||
if(m_wallet && m_wallet->isOpen()) {
|
||||
|
||||
@@ -48,8 +48,8 @@ Q_SIGNALS:
|
||||
|
||||
public Q_SLOTS:
|
||||
bool start();
|
||||
void stop(bool disconnectClients=true);
|
||||
void toggleUnattendedAccess(bool allow=true);
|
||||
void stop(bool disconnectClients);
|
||||
void toggleUnattendedAccess(bool allow);
|
||||
|
||||
protected:
|
||||
InvitationsRfbServer();
|
||||
|
||||
@@ -62,20 +62,20 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
setCentralWidget(mainWidget);
|
||||
|
||||
connect(m_ui.passwordEditButton,SIGNAL(clicked()),
|
||||
this,SLOT(editPassword()));
|
||||
connect(m_ui.enableSharingCheckBox,SIGNAL(toggled(bool)),
|
||||
this, SLOT(toggleDesktopSharing(bool)));
|
||||
connect(m_ui.enableUnattendedCheckBox, SIGNAL(toggled(bool)),
|
||||
InvitationsRfbServer::instance, SLOT(toggleUnattendedAccess(bool)));
|
||||
connect(m_ui.unattendedPasswordButton, SIGNAL(clicked()),
|
||||
this, SLOT(editUnattendedPassword()));
|
||||
connect(m_ui.addressAboutButton, SIGNAL(clicked()),
|
||||
this, SLOT(aboutConnectionAddress()));
|
||||
connect(m_ui.unattendedAboutButton, SIGNAL(clicked()),
|
||||
this, SLOT(aboutUnattendedMode()));
|
||||
connect(InvitationsRfbServer::instance, SIGNAL(passwordChanged(const QString&)),
|
||||
this, SLOT(passwordChanged(const QString&)));
|
||||
connect(m_ui.passwordEditButton, &QToolButton::clicked,
|
||||
this, &MainWindow::editPassword);
|
||||
connect(m_ui.enableSharingCheckBox, &QCheckBox::toggled,
|
||||
this, &MainWindow::toggleDesktopSharing);
|
||||
connect(m_ui.enableUnattendedCheckBox, &QCheckBox::toggled,
|
||||
InvitationsRfbServer::instance, &InvitationsRfbServer::toggleUnattendedAccess);
|
||||
connect(m_ui.unattendedPasswordButton, &QPushButton::clicked,
|
||||
this, &MainWindow::editUnattendedPassword);
|
||||
connect(m_ui.addressAboutButton, &QToolButton::clicked,
|
||||
this, &MainWindow::aboutConnectionAddress);
|
||||
connect(m_ui.unattendedAboutButton, &QToolButton::clicked,
|
||||
this, &MainWindow::aboutUnattendedMode);
|
||||
connect(InvitationsRfbServer::instance, &InvitationsRfbServer::passwordChanged,
|
||||
this, &MainWindow::passwordChanged);
|
||||
|
||||
// Figure out the address
|
||||
int port = KrfbConfig::port();
|
||||
@@ -148,7 +148,7 @@ void MainWindow::toggleDesktopSharing(bool enable)
|
||||
"and restart krfb."));
|
||||
}
|
||||
} else {
|
||||
InvitationsRfbServer::instance->stop();
|
||||
InvitationsRfbServer::instance->stop(true);
|
||||
if(m_passwordEditable) {
|
||||
m_passwordEditable = false;
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
|
||||
@@ -48,7 +48,7 @@ RfbClient::RfbClient(rfbClientPtr client, QObject* parent)
|
||||
|
||||
d->notifier = new QSocketNotifier(client->sock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(false);
|
||||
connect(d->notifier, SIGNAL(activated(int)), this, SLOT(onSocketActivated()));
|
||||
connect(d->notifier, &QSocketNotifier::activated, this, &RfbClient::onSocketActivated);
|
||||
}
|
||||
|
||||
RfbClient::~RfbClient()
|
||||
|
||||
@@ -137,9 +137,9 @@ bool RfbServer::start()
|
||||
|
||||
d->notifier = new QSocketNotifier(d->screen->listenSock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(true);
|
||||
connect(d->notifier, SIGNAL(activated(int)), this, SLOT(onListenSocketActivated()));
|
||||
connect(QApplication::clipboard(), SIGNAL(dataChanged()),
|
||||
this, SLOT(krfbSendServerCutText()));
|
||||
connect(d->notifier, &QSocketNotifier::activated, this, &RfbServer::onListenSocketActivated);
|
||||
connect(QApplication::clipboard(), &QClipboard::dataChanged,
|
||||
this, &RfbServer::krfbSendServerCutText);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -235,8 +235,8 @@ rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
|
||||
RfbServer *server = static_cast<RfbServer*>(cl->screen->screenData);
|
||||
|
||||
PendingRfbClient *pendingClient = server->newClient(cl);
|
||||
connect(pendingClient, SIGNAL(finished(RfbClient*)),
|
||||
server, SLOT(pendingClientFinished(RfbClient*)));
|
||||
connect(pendingClient, &PendingRfbClient::finished,
|
||||
server, &RfbServer::pendingClientFinished);
|
||||
|
||||
return RFB_CLIENT_ON_HOLD;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ void RfbServer::pointerHook(int bm, int x, int y, rfbClientPtr cl)
|
||||
}
|
||||
|
||||
//static
|
||||
void RfbServer::clipboardHook(char *str, int len, rfbClientPtr cl)
|
||||
void RfbServer::clipboardHook(char *str, int len, rfbClientPtr /*cl*/)
|
||||
{
|
||||
QApplication::clipboard()->setText(QString::fromLocal8Bit(str,len));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual bool start();
|
||||
virtual void stop(bool disconnectClients = true);
|
||||
virtual void stop(bool disconnectClients);
|
||||
|
||||
void updateScreen(const QList<QRect> & modifiedTiles);
|
||||
void updateCursorPosition(const QPoint & position);
|
||||
|
||||
@@ -123,8 +123,8 @@ void RfbServerManager::init()
|
||||
d->desktopName = QString("%1@%2 (shared desktop)") //FIXME check if we can use utf8
|
||||
.arg(KUser().loginName(),QHostInfo::localHostName()).toLatin1();
|
||||
|
||||
connect(&d->rfbUpdateTimer, SIGNAL(timeout()), SLOT(updateScreens()));
|
||||
connect(qApp, SIGNAL(aboutToQuit()), SLOT(cleanup()));
|
||||
connect(&d->rfbUpdateTimer, &QTimer::timeout, this, &RfbServerManager::updateScreens);
|
||||
connect(qApp, &QApplication::aboutToQuit, this, &RfbServerManager::cleanup);
|
||||
}
|
||||
|
||||
void RfbServerManager::updateScreens()
|
||||
|
||||
@@ -56,17 +56,17 @@ ClientActions::ClientActions(RfbClient* client, QMenu* menu, QAction* before)
|
||||
m_disconnectAction = new QAction(i18n("Disconnect"), m_menu);
|
||||
m_menu->insertAction(before, m_disconnectAction);
|
||||
|
||||
QObject::connect(m_disconnectAction, SIGNAL(triggered()), client, SLOT(closeConnection()));
|
||||
QObject::connect(m_disconnectAction, &QAction::triggered, client, &RfbClient::closeConnection);
|
||||
|
||||
if (client->controlCanBeEnabled()) {
|
||||
m_enableControlAction = new KToggleAction(i18n("Enable Remote Control"), m_menu);
|
||||
m_enableControlAction->setChecked(client->controlEnabled());
|
||||
m_menu->insertAction(before, m_enableControlAction);
|
||||
|
||||
QObject::connect(m_enableControlAction, SIGNAL(triggered(bool)),
|
||||
client, SLOT(setControlEnabled(bool)));
|
||||
QObject::connect(client, SIGNAL(controlEnabledChanged(bool)),
|
||||
m_enableControlAction, SLOT(setChecked(bool)));
|
||||
QObject::connect(m_enableControlAction, &KToggleAction::triggered,
|
||||
client, &RfbClient::setControlEnabled);
|
||||
QObject::connect(client, &RfbClient::controlEnabledChanged,
|
||||
m_enableControlAction, &KToggleAction::setChecked);
|
||||
} else {
|
||||
m_enableControlAction = NULL;
|
||||
}
|
||||
@@ -101,10 +101,10 @@ TrayIcon::TrayIcon(QWidget *mainWindow)
|
||||
setToolTipTitle(i18n("Desktop Sharing - disconnected"));
|
||||
setCategory(KStatusNotifierItem::ApplicationStatus);
|
||||
|
||||
connect(RfbServerManager::instance(), SIGNAL(clientConnected(RfbClient*)),
|
||||
this, SLOT(onClientConnected(RfbClient*)));
|
||||
connect(RfbServerManager::instance(), SIGNAL(clientDisconnected(RfbClient*)),
|
||||
this, SLOT(onClientDisconnected(RfbClient*)));
|
||||
connect(RfbServerManager::instance(), &RfbServerManager::clientConnected,
|
||||
this, &TrayIcon::onClientConnected);
|
||||
connect(RfbServerManager::instance(), &RfbServerManager::clientDisconnected,
|
||||
this, &TrayIcon::onClientDisconnected);
|
||||
|
||||
m_aboutAction = KStandardAction::aboutApp(this, SLOT(showAbout()), this);
|
||||
contextMenu()->addAction(m_aboutAction);
|
||||
|
||||
Reference in New Issue
Block a user