From: Drew Fisher Date: Thu, 7 Oct 2010 00:43:55 +0000 (-0700) Subject: Alignment tweaks; return to connection prompt if disconnected. X-Git-Url: https://git.zarvox.org/shortlog/month?a=commitdiff_plain;h=c5692a9617ac37a711518a37799cd775463d762a;p=shareboard.git Alignment tweaks; return to connection prompt if disconnected. --- diff --git a/connectionmanager.cpp b/connectionmanager.cpp index 3ad8525..515a46c 100644 --- a/connectionmanager.cpp +++ b/connectionmanager.cpp @@ -8,6 +8,7 @@ ConnectionManager::ConnectionManager(QObject* parent) : QObject(parent) { 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())); } @@ -47,3 +48,8 @@ void ConnectionManager::onConnect() { (*textStream) << "0 0 0 2 " << username << endl; qDebug() << "sent JoinAction"; } + +void ConnectionManager::onDisconnect() { + qDebug() << "Disconnected"; + emit disconnected(); +} diff --git a/connectionmanager.h b/connectionmanager.h index d9bc4e5..9b1e37b 100644 --- a/connectionmanager.h +++ b/connectionmanager.h @@ -18,6 +18,7 @@ class ConnectionManager : public QObject{ //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); @@ -29,6 +30,7 @@ class ConnectionManager : public QObject{ private slots: void haveData(); void onConnect(); + void onDisconnect(); }; #endif // __CONNECTIONMANAGER_H__ diff --git a/connectwidget.cpp b/connectwidget.cpp index 9933701..738af87 100644 --- a/connectwidget.cpp +++ b/connectwidget.cpp @@ -13,9 +13,9 @@ ConnectWidget::ConnectWidget(QWidget* parent) : QWidget(parent) { 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); diff --git a/shareboardcanvas.cpp b/shareboardcanvas.cpp index 2db1b0a..06696f2 100644 --- a/shareboardcanvas.cpp +++ b/shareboardcanvas.cpp @@ -20,7 +20,7 @@ ShareboardCanvas::~ShareboardCanvas() { 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