mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
Refs #41:
- Changed: Qt5 has a different method to connect signals and slots together based on C++x11 Migrated the first bunch of occurences to the new method. - Fixed: CDebug singleton was not created yet in BlackD. Crashed the application.
This commit is contained in:
@@ -6,8 +6,10 @@ using namespace BlackMisc;
|
|||||||
|
|
||||||
Client::Client(QObject *parent) : QObject(parent), comclient(IContext::getInstance())
|
Client::Client(QObject *parent) : QObject(parent), comclient(IContext::getInstance())
|
||||||
{
|
{
|
||||||
connect(&comclient, SIGNAL(doError(QAbstractSocket::SocketError,QString)), this, SLOT(onError(QAbstractSocket::SocketError,QString)));
|
connect(&comclient, &BlackMisc::CComClient::doError,
|
||||||
connect(&comclient, SIGNAL(doConnected()), this, SLOT(onClientConnected()));
|
this, &Client::onError);
|
||||||
|
connect(&comclient, &BlackMisc::CComClient::doConnected,
|
||||||
|
this, &Client::onClientConnected);
|
||||||
|
|
||||||
QString address = "127.0.0.1";
|
QString address = "127.0.0.1";
|
||||||
comclient.connectTo(address, 6809);
|
comclient.connectTo(address, 6809);
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ Server::Server(QObject *parent) : QObject(parent), server(IContext::getInstance(
|
|||||||
|
|
||||||
server.Host(local, 6809);
|
server.Host(local, 6809);
|
||||||
|
|
||||||
connect(&server, SIGNAL(doMessageReceived(QString &, QByteArray&)), this, SLOT(onData(QString &, QByteArray&)));
|
connect(&server, static_cast<void (BlackMisc::CComServer::*)(QString &, QByteArray &)>(&BlackMisc::CComServer::doMessageReceived),
|
||||||
|
this, &Server::onData);
|
||||||
|
|
||||||
CMessageSystem myMessageSystem;
|
CMessageSystem myMessageSystem;
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ BlackBox::BlackBox(QWidget *parent) :
|
|||||||
m_dlg_chat = new CDialogChat();
|
m_dlg_chat = new CDialogChat();
|
||||||
m_dlg_chat->hide();
|
m_dlg_chat->hide();
|
||||||
|
|
||||||
connect(ui->bt_Connect, SIGNAL(clicked()), this, SLOT(onConnect()));
|
connect(ui->bt_Connect, &QPushButton::clicked,
|
||||||
connect(ui->bt_Chat, SIGNAL(clicked()), this, SLOT(onButtonChat()));
|
this, &BlackBox::onConnect);
|
||||||
|
connect(ui->bt_Chat, &QPushButton::clicked,
|
||||||
|
this, &BlackBox::onButtonChat);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackBox::~BlackBox()
|
BlackBox::~BlackBox()
|
||||||
|
|||||||
@@ -18,9 +18,12 @@ CDialogConnect::CDialogConnect(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
connect(&comclient, SIGNAL(doError(QAbstractSocket::SocketError,QString)), this, SLOT(onError(QAbstractSocket::SocketError,QString)));
|
connect(&comclient, &BlackMisc::CComClient::doError,
|
||||||
connect(&comclient, SIGNAL(doConnected()), this, SLOT(onClientConnected()));
|
this, &CDialogConnect::onError);
|
||||||
connect(ui->bt_FSDConnect, SIGNAL(clicked()), this, SLOT(onFSDConnect()));
|
connect(&comclient, &BlackMisc::CComClient::doConnected,
|
||||||
|
this, &CDialogConnect::onClientConnected);
|
||||||
|
connect(ui->bt_FSDConnect, &QPushButton::clicked,
|
||||||
|
this, &CDialogConnect::onFSDConnect);
|
||||||
|
|
||||||
QString address = "127.0.0.1";
|
QString address = "127.0.0.1";
|
||||||
comclient.connectTo(address, 42000);
|
comclient.connectTo(address, 42000);
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ BlackD::BlackD(QWidget *parent) :
|
|||||||
createActions();
|
createActions();
|
||||||
createTrayIcon();
|
createTrayIcon();
|
||||||
|
|
||||||
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
connect(trayIcon, &QSystemTrayIcon::activated,
|
||||||
this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
|
this, &BlackD::iconActivated);
|
||||||
|
|
||||||
setWindowTitle(tr("BlackD"));
|
setWindowTitle(tr("BlackD"));
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
//! file, You can obtain one at http://mozilla.org/MPL/2.0/
|
//! file, You can obtain one at http://mozilla.org/MPL/2.0/
|
||||||
|
|
||||||
#include "blackmisc/context.h"
|
#include "blackmisc/context.h"
|
||||||
|
#include "blackmisc/debug.h"
|
||||||
|
|
||||||
#include "blackd.h"
|
#include "blackd.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -17,6 +18,8 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
BlackMisc::CApplicationContext myBlackApp;
|
BlackMisc::CApplicationContext myBlackApp;
|
||||||
|
|
||||||
|
BlackMisc::IContext::getInstance().setSingleton(new BlackMisc::CDebug());
|
||||||
|
|
||||||
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
|
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||||
QMessageBox::critical(0, QObject::tr("Systray"),
|
QMessageBox::critical(0, QObject::tr("Systray"),
|
||||||
QObject::tr("I couldn't detect any system tray "
|
QObject::tr("I couldn't detect any system tray "
|
||||||
|
|||||||
Reference in New Issue
Block a user