From: Janne Änäkkälä Date: Wed, 26 May 2010 10:55:54 +0000 (+0300) Subject: Users dialog files added. X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=commitdiff_plain;h=286126ca275acfe9c4cb76053a82833f27b9ad13 Users dialog files added. --- diff --git a/Client/speedfreak.pro b/Client/speedfreak.pro index 30b66c7..0c954a7 100644 --- a/Client/speedfreak.pro +++ b/Client/speedfreak.pro @@ -40,7 +40,8 @@ SOURCES += main.cpp \ helpsettingsdialog.cpp \ custombutton.cpp \ profiledialog.cpp \ - filereader.cpp + filereader.cpp \ + usersdialog.cpp HEADERS += mainwindow.h \ creditsdialog.h \ routedialog.h \ @@ -71,7 +72,8 @@ HEADERS += mainwindow.h \ helpsettingsdialog.h \ custombutton.h \ profiledialog.h \ - filereader.h + filereader.h \ + usersdialog.h FORMS += mainwindow.ui \ creditsdialog.ui \ routedialog.ui \ @@ -89,7 +91,8 @@ FORMS += mainwindow.ui \ helpaccelerationdialog.ui \ helproutingdialog.ui \ helpsettingsdialog.ui \ - profiledialog.ui + profiledialog.ui \ + usersdialog.ui RESOURCES += graphics.qrc contains(QT_CONFIG, hildon):CONFIG += hildon CONFIG += link_pkgconfig diff --git a/Client/usersdialog.cpp b/Client/usersdialog.cpp new file mode 100644 index 0000000..2d7186c --- /dev/null +++ b/Client/usersdialog.cpp @@ -0,0 +1,88 @@ +#include "usersdialog.h" +#include "ui_usersdialog.h" +#include +#include + +UsersDialog::UsersDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::UsersDialog) +{ + ui->setupUi(this); + //usersList = new QStringList(); + //ui->listWidgetUsers->addItems(usersList); + //emit getUsers(); +} + +UsersDialog::~UsersDialog() +{ + delete ui; +} + +void UsersDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +/** + *This slot function will execute when user clicks listWidget item. + *Emits signal for getting user info from server. + *@param QListWidgetItem* item includes users name which need to send server. + */ +void UsersDialog::on_listWidgetUsers_itemClicked(QListWidgetItem* item) +{ + QString name; + name = item->text(); + + emit getUserInfo(item->text()); +} + +/** + *Sets users to listWidget. + */ +void UsersDialog::appendUserToList(QString usrname) +{ + //usersList->append(usrname); + ui->listWidgetUsers->addItem(usrname); +} + +/** + *Sets data to user's information labels. + */ +void UsersDialog::setUserInfo(QStringList *usersInfo) +{ + QStringList splitted; + //QString temp; + QString allInfo; + //QString manufacter; + //QString description; + allInfo = usersInfo->at(1); + splitted = allInfo.split(";"); + ui->labelUsersDetails->setText(usersInfo->at(0) + ":"); + + //temp = splitted.at(0); + //manufacter = temp.remove("![CDATA[", Qt::CaseSensitive); + + //temp = splitted.at(3); + //description = temp.remove("]]>", Qt::CaseSensitive); + + if (splitted.count() == 4) + { + ui->labelManufacter->setText(splitted.at(0)); + ui->labelType->setText(splitted.at(1)); + ui->labelModel->setText(splitted.at(2)); + ui->plainTextEditDescription->setPlainText(splitted.at(3)); + } + + else + { + ui->plainTextEditDescription->setPlainText(splitted.at(0)); + } + //ui->labelDescriptionHeader->setText("Description: " + usersInfo->at(4)); +} diff --git a/Client/usersdialog.h b/Client/usersdialog.h new file mode 100644 index 0000000..91e3a82 --- /dev/null +++ b/Client/usersdialog.h @@ -0,0 +1,33 @@ +#ifndef USERSDIALOG_H +#define USERSDIALOG_H + +#include +#include + +namespace Ui { + class UsersDialog; +} + +class UsersDialog : public QDialog { + Q_OBJECT +public: + UsersDialog(QWidget *parent = 0); + ~UsersDialog(); + void appendUserToList(QString usrname); + void setUserInfo(QStringList *usersInfo); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::UsersDialog *ui; + //QStringList *usersList; + +signals: + void getUserInfo(QString name); + +private slots: + void on_listWidgetUsers_itemClicked(QListWidgetItem* item); +}; + +#endif // USERSDIALOG_H diff --git a/Client/usersdialog.ui b/Client/usersdialog.ui new file mode 100644 index 0000000..64b7bf8 --- /dev/null +++ b/Client/usersdialog.ui @@ -0,0 +1,183 @@ + + + UsersDialog + + + true + + + + 0 + 0 + 800 + 380 + + + + Users online + + + + + 40 + 70 + 256 + 291 + + + + + + + 80 + 20 + 62 + 31 + + + + + Bitstream Charter + true + + + + Users: + + + + + + 430 + 10 + 281 + 51 + + + + + Bitstream Charter + true + + + + User's information: + + + + + + 350 + 60 + 161 + 111 + + + + + + + Manufacturer: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Type: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Model: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + 530 + 60 + 241 + 111 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + 450 + 220 + 331 + 151 + + + + false + + + + + + Qt::NoTextInteraction + + + + + + 380 + 180 + 131 + 32 + + + + Description: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + +