]> git.zarvox.org Git - shareboard.git/commitdiff
Alignment tweaks; return to connection prompt if disconnected.
authorDrew Fisher <drew.m.fisher@gmail.com>
Thu, 7 Oct 2010 00:43:55 +0000 (17:43 -0700)
committerDrew Fisher <drew.m.fisher@gmail.com>
Thu, 7 Oct 2010 00:43:55 +0000 (17:43 -0700)
connectionmanager.cpp
connectionmanager.h
connectwidget.cpp
shareboardcanvas.cpp

index 3ad85252cc675418fa4ed203a4e974c635855cb3..515a46ce8ff321c0de5ad8e79f5fa0fdcc28cf63 100644 (file)
@@ -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();
+}
index d9bc4e5857b966fc2ea66cbf34af6826d065232b..9b1e37bbcbcb60e9af56887266fe6072d9fe4d7f 100644 (file)
@@ -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__
index 993370127017deb6eb2c4b4e7c22494b311d6b85..738af87972b4557538c965c63166fc546dbcf43b 100644 (file)
@@ -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);
index 2db1b0a2a8faa7cdb13e9e8704a000c459d33044..06696f2b5a0626e3899f5b2c9a3e5c3b32fcd179 100644 (file)
@@ -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