Users dialog files added.
authorJanne Änäkkälä <janne_anakkala@hotmail.com>
Wed, 26 May 2010 10:55:54 +0000 (13:55 +0300)
committerJanne Änäkkälä <janne_anakkala@hotmail.com>
Wed, 26 May 2010 10:55:54 +0000 (13:55 +0300)
Client/speedfreak.pro
Client/usersdialog.cpp [new file with mode: 0644]
Client/usersdialog.h [new file with mode: 0644]
Client/usersdialog.ui [new file with mode: 0644]

index 30b66c7..0c954a7 100644 (file)
@@ -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 (file)
index 0000000..2d7186c
--- /dev/null
@@ -0,0 +1,88 @@
+#include "usersdialog.h"
+#include "ui_usersdialog.h"
+#include <QPushButton>
+#include <QDebug>
+
+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 (file)
index 0000000..91e3a82
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef USERSDIALOG_H
+#define USERSDIALOG_H
+
+#include <QDialog>
+#include <QListWidgetItem>
+
+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 (file)
index 0000000..64b7bf8
--- /dev/null
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>UsersDialog</class>
+ <widget class="QDialog" name="UsersDialog">
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>380</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Users online</string>
+  </property>
+  <widget class="QListWidget" name="listWidgetUsers">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>70</y>
+     <width>256</width>
+     <height>291</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="labelUsers">
+   <property name="geometry">
+    <rect>
+     <x>80</x>
+     <y>20</y>
+     <width>62</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="font">
+    <font>
+     <family>Bitstream Charter</family>
+     <underline>true</underline>
+    </font>
+   </property>
+   <property name="text">
+    <string>Users:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="labelUsersDetails">
+   <property name="geometry">
+    <rect>
+     <x>430</x>
+     <y>10</y>
+     <width>281</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="font">
+    <font>
+     <family>Bitstream Charter</family>
+     <underline>true</underline>
+    </font>
+   </property>
+   <property name="text">
+    <string>User's information:</string>
+   </property>
+  </widget>
+  <widget class="QWidget" name="verticalLayoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>350</x>
+     <y>60</y>
+     <width>161</width>
+     <height>111</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayoutHeaders">
+    <item>
+     <widget class="QLabel" name="labelManufacterHeader">
+      <property name="text">
+       <string>Manufacturer:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLabel" name="labelTypeHeader">
+      <property name="text">
+       <string>Type:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLabel" name="labelModelHeader">
+      <property name="text">
+       <string>Model:</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QWidget" name="verticalLayoutWidget_2">
+   <property name="geometry">
+    <rect>
+     <x>530</x>
+     <y>60</y>
+     <width>241</width>
+     <height>111</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayoutInformation">
+    <item>
+     <widget class="QLabel" name="labelManufacter">
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLabel" name="labelType">
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLabel" name="labelModel">
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QPlainTextEdit" name="plainTextEditDescription">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>220</y>
+     <width>331</width>
+     <height>151</height>
+    </rect>
+   </property>
+   <property name="autoFillBackground">
+    <bool>false</bool>
+   </property>
+   <property name="styleSheet">
+    <string notr="true"/>
+   </property>
+   <property name="textInteractionFlags">
+    <set>Qt::NoTextInteraction</set>
+   </property>
+  </widget>
+  <widget class="QLabel" name="labelDescriptionHeader">
+   <property name="geometry">
+    <rect>
+     <x>380</x>
+     <y>180</y>
+     <width>131</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Description:</string>
+   </property>
+   <property name="alignment">
+    <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>