Added Online since Label to ProfileWidget

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3198 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-06-24 15:38:38 +00:00
parent 1edca45020
commit 6202a0b201
3 changed files with 89 additions and 44 deletions

View File

@ -34,16 +34,17 @@
/* Define the format used for displaying the date and time */ /* Define the format used for displaying the date and time */
#define DATETIME_FMT "MMM dd hh:mm:ss" #define DATETIME_FMT "MMM dd hh:mm:ss"
/** Default constructor */ /** Default constructor */
ProfileWidget::ProfileWidget(QWidget *parent, Qt::WFlags flags) ProfileWidget::ProfileWidget(QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags) : QWidget(parent, flags)
{ {
/* Invoke Qt Designer generated QObject setup routine */ /* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this); ui.setupUi(this);
connect(ui.editstatuspushButton,SIGNAL(clicked()), this, SLOT(statusmessagedlg()));
//loadDialog(); connect(ui.editstatuspushButton,SIGNAL(clicked()), this, SLOT(statusmessagedlg()));
} }
/** Destructor. */ /** Destructor. */
@ -52,54 +53,53 @@ ProfileWidget::~ProfileWidget()
} }
void ProfileWidget::closeEvent (QCloseEvent * event) void ProfileWidget::closeEvent (QCloseEvent * event)
{ {
QWidget::closeEvent(event); QWidget::closeEvent(event);
} }
void ProfileWidget::showEvent ( QShowEvent * event ) void ProfileWidget::showEvent ( QShowEvent * event )
{ {
RsPeerDetails detail; RsPeerDetails detail;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail)) if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail))
{ {
ui.name->setText(QString::fromStdString(detail.name)); ui.name->setText(QString::fromStdString(detail.name));
ui.country->setText(QString::fromStdString(detail.location)); ui.country->setText(QString::fromStdString(detail.location));
ui.peerid->setText(QString::fromStdString(detail.id)); ui.peerid->setText(QString::fromStdString(detail.id));
// Dont Show a timestamp in RS calculate the day // Dont Show a timestamp in RS calculate the day
QDateTime date = QDateTime::fromTime_t(detail.lastConnect); QDateTime date = QDateTime::fromTime_t(detail.lastConnect);
QString stime = date.toString(Qt::LocalDate); QString stime = date.toString(Qt::LocalDate);
/* set retroshare version */ /* set retroshare version */
std::map<std::string, std::string>::iterator vit; std::map<std::string, std::string>::iterator vit;
std::map<std::string, std::string> versions; std::map<std::string, std::string> versions;
bool retv = rsDisc->getDiscVersions(versions); bool retv = rsDisc->getDiscVersions(versions);
if (retv && versions.end() != (vit = versions.find(detail.id))) if (retv && versions.end() != (vit = versions.find(detail.id)))
{ {
ui.version->setText(QString::fromStdString(vit->second)); ui.version->setText(QString::fromStdString(vit->second));
} }
ui.ipAddressList->clear(); ui.ipAddressList->clear();
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it) for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
ui.ipAddressList->addItem(QString::fromStdString(*it)); ui.ipAddressList->addItem(QString::fromStdString(*it));
/* set local address */ /* set local address */
ui.localAddress->setText(QString::fromStdString(detail.localAddr)); ui.localAddress->setText(QString::fromStdString(detail.localAddr));
ui.localPort -> setText(QString::number(detail.localPort)); ui.localPort -> setText(QString::number(detail.localPort));
/* set the server address */ /* set the server address */
ui.extAddress->setText(QString::fromStdString(detail.extAddr)); ui.extAddress->setText(QString::fromStdString(detail.extAddr));
ui.extPort -> setText(QString::number(detail.extPort)); ui.extPort -> setText(QString::number(detail.extPort));
/* set DynDNS */ /* set DynDNS */
ui.dyndns->setText(QString::fromStdString(detail.dyndns)); ui.dyndns->setText(QString::fromStdString(detail.dyndns));
ui.dyndns->setCursorPosition (0); ui.dyndns->setCursorPosition (0);
std::list<std::string> ids; std::list<std::string> ids;
ids.clear(); ids.clear();
rsPeers->getGPGAcceptedList(ids); rsPeers->getGPGAcceptedList(ids);
int friends = ids.size(); int friends = ids.size();
@ -107,7 +107,9 @@ void ProfileWidget::showEvent ( QShowEvent * event )
out << friends << ""; out << friends << "";
ui.friendsEdit->setText(QString::fromStdString(out.str())); ui.friendsEdit->setText(QString::fromStdString(out.str()));
} ui.onlinesince->setText(QDateTime::currentDateTime().toString(DATETIME_FMT));
}
} }

View File

@ -32,27 +32,25 @@ class ProfileWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
/** Default constructor */ /** Default constructor */
ProfileWidget(QWidget *parent = 0, Qt::WFlags flags = 0); ProfileWidget(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */ /** Default destructor */
~ProfileWidget(); ~ProfileWidget();
protected: protected:
void closeEvent (QCloseEvent * event); void closeEvent (QCloseEvent * event);
private slots: private slots:
void showEvent ( QShowEvent * event ); void showEvent ( QShowEvent * event );
void statusmessagedlg(); void statusmessagedlg();
private: private:
/** Qt Designer generated object */
Ui::ProfileWidget ui;
/** Qt Designer generated object */
Ui::ProfileWidget ui;
}; };

View File

@ -96,7 +96,7 @@ border: 1px solid #CCCCCC;
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>498</width> <width>498</width>
<height>569</height> <height>574</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
@ -264,7 +264,7 @@ background-color: white;
border: 2px solid #CCCCCC;}</string> border: 2px solid #CCCCCC;}</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0" colspan="3"> <item row="0" column="0" colspan="4">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="label_12">
@ -295,7 +295,7 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
@ -306,7 +306,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QLabel" name="friendsEdit"> <widget class="QLabel" name="friendsEdit">
<property name="font"> <property name="font">
<font> <font>
@ -319,7 +319,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="2" column="2" colspan="2">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -332,7 +332,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
@ -343,7 +343,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QLabel" name="version"> <widget class="QLabel" name="version">
<property name="font"> <property name="font">
<font> <font>
@ -356,7 +356,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="3" column="2" colspan="2">
<spacer name="horizontalSpacer_8"> <spacer name="horizontalSpacer_8">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -369,6 +369,43 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#76746c;&quot;&gt;Online since&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="onlinesince">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="2">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -620,7 +657,11 @@ p, li { white-space: pre-wrap; }
<item> <item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Addresses list</string> <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#76746c;&quot;&gt;Addresses list&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -660,6 +701,10 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>