sock = new QTcpSocket();
textStream = new QTextStream(sock);
QObject::connect(sock, SIGNAL(connected()), this, SLOT(onConnect()));
+ QObject::connect(sock, SIGNAL(disconnected()), this, SLOT(onDisconnect()));
QObject::connect(sock, SIGNAL(readyRead()), this, SLOT(haveData()));
}
(*textStream) << "0 0 0 2 " << username << endl;
qDebug() << "sent JoinAction";
}
+
+void ConnectionManager::onDisconnect() {
+ qDebug() << "Disconnected";
+ emit disconnected();
+}
//void readData();
//void actionRecieved(Action* act); // act is freed by recipient of signal
void connected();
+ void disconnected();
public slots:
void joinServer(QString _username, QString host);
void sendAction(Action* action);
private slots:
void haveData();
void onConnect();
+ void onDisconnect();
};
#endif // __CONNECTIONMANAGER_H__
userEdit = new QLineEdit("guest", this);
hostEdit = new QLineEdit("kraken.zarvox.org", this);
userLabel = new QLabel("Pick a username:", this);
- userLabel->setAlignment(Qt::AlignRight);
+ userLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
hostLabel = new QLabel("Server to connect to:", this);
- hostLabel->setAlignment(Qt::AlignRight);
+ hostLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
goButton = new QPushButton("Connect!");
grid->addWidget(userLabel, 0,0);
void ShareboardCanvas::mouseMoveEvent(QMouseEvent* event) {
// Send mouse move event to network thread
- // If the button is down
+ // If the button is down
if(mouseDown)
dragPath.append(event->posF());
// Trigger a repaint