From: Olavi Pulkkinen Date: Tue, 9 Mar 2010 11:35:36 +0000 (+0200) Subject: Implementd user name in window title X-Git-Tag: v0.1~68^2 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=f73389530ce2e0cd73cf6dda7b09a5ba86e60f13;p=speedfreak Implementd user name in window title --- diff --git a/Client/carmainwindow.cpp b/Client/carmainwindow.cpp index ee146ff..5ec9688 100644 --- a/Client/carmainwindow.cpp +++ b/Client/carmainwindow.cpp @@ -47,9 +47,12 @@ CarMainWindow::CarMainWindow(QWidget *parent):QMainWindow(parent), ui(new Ui::Ca timer->setInterval(300); connect(this->timer, SIGNAL(timeout()), this, SLOT(after_timeout())); + connect(myLogin, SIGNAL( userNameChanged()), this, SLOT(updateUserName())); ui->labelMeasureTabResult->hide(); + this->setWindowTitle("Speed bfreak"); + } /** @@ -233,10 +236,7 @@ void CarMainWindow::on_pushButton_clicked() */ void CarMainWindow::on_loginLogoutButton_clicked() { - //LoginWindow myLogin; - myLogin->show(); - //ui->loginLogoutButton->setText("logout"); } /** @@ -589,3 +589,22 @@ void CarMainWindow::on_pushButtonSendResult_clicked() { emit sendresult(); } + +void CarMainWindow::updateUserName() +{ + QString newUserName; + + newUserName = myLogin->getUserName(); + ui->userNameLabel->setText( "User: " + newUserName); + + if (newUserName.length()) + { + ui->setUserPushButton->setText( "Change User"); + this->setWindowTitle("Speed freak - " + newUserName); + } + else + { + ui->setUserPushButton->setText( "Set User"); + this->setWindowTitle("Speed freak"); + } +} diff --git a/Client/carmainwindow.h b/Client/carmainwindow.h index dcf047e..95b95a5 100644 --- a/Client/carmainwindow.h +++ b/Client/carmainwindow.h @@ -83,6 +83,7 @@ private: signals: void speedAchieved(); void sendresult(); +void userNameChanged(); private slots: void on_pushButtonSendResult_clicked(); @@ -108,6 +109,7 @@ private slots: void errorFromServer(QNetworkReply* reply); void after_timeout(); + void updateUserName(); }; #endif // CARMAINWINDOW_H diff --git a/Client/loginwindow.cpp b/Client/loginwindow.cpp index faa535d..330b782 100644 --- a/Client/loginwindow.cpp +++ b/Client/loginwindow.cpp @@ -9,7 +9,6 @@ #include "loginwindow.h" #include "ui_loginwindow.h" -#include LoginWindow::LoginWindow(QWidget *parent) : QDialog(parent), @@ -47,6 +46,8 @@ void LoginWindow::on_loginPushButton_clicked() { this->username = ui->userNameLineEdit->text(); this->password = ui->passwordLineEdit->text(); + + emit userNameChanged(); close(); } diff --git a/Client/loginwindow.h b/Client/loginwindow.h index 1ffb7ff..08fb43a 100644 --- a/Client/loginwindow.h +++ b/Client/loginwindow.h @@ -36,6 +36,8 @@ private: private slots: void on_loginPushButton_clicked(); void on_cancelPushButton_clicked(); +signals: + void userNameChanged(); }; #endif // LOGINWINDOW_H