]> git.zarvox.org Git - shareboard.git/blob - connectwidget.cpp
Implement image insertion and placement, tool selection, and eraser.
[shareboard.git] / connectwidget.cpp
1 #include "connectwidget.h"
2
3 #include <QGridLayout>
4 #include <QVBoxLayout>
5 #include <QLineEdit>
6 #include <QLabel>
7 #include <QPushButton>
8
9
10 ConnectWidget::ConnectWidget(QWidget* parent) : QWidget(parent) {
11         layout = new QVBoxLayout();
12         grid = new QGridLayout();
13         userEdit = new QLineEdit("guest", this);
14         hostEdit = new QLineEdit("kraken.zarvox.org", this);
15         userLabel = new QLabel("Pick a username:", this);
16         userLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
17         hostLabel = new QLabel("Server to connect to:", this);
18         hostLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
19         goButton = new QPushButton("Connect!");
20
21         grid->addWidget(userLabel, 0,0);
22         grid->addWidget(userEdit, 0,1);
23         grid->addWidget(hostLabel, 1,0);
24         grid->addWidget(hostEdit, 1,1);
25         layout->addStretch();
26         layout->addLayout(grid);
27         layout->addWidget(goButton);
28         layout->addStretch();
29         
30         setLayout(layout);
31         QObject::connect(goButton, SIGNAL(clicked()), this, SLOT(connect()));
32 }
33
34 ConnectWidget::~ConnectWidget() {
35 }
36
37 void ConnectWidget::connect() {
38         QString username = userEdit->text().replace(" ", "_");
39         QString host = hostEdit->text();
40         emit connectToServer(username, host);
41 }
42
43 QString ConnectWidget::user() {
44         return userEdit->text();
45 }
46
47 QString ConnectWidget::host() {
48         return hostEdit->text();
49 }