* added basic set avatar picture for MessengerWindow and Privat Chat

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@907 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-01-04 02:28:30 +00:00
parent 50b18911c5
commit d2e64551c2
5 changed files with 408 additions and 369 deletions

View File

@ -81,7 +81,7 @@ MessengerWindow::MessengerWindow(QWidget * parent)
connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) ); connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.avatarButton, SIGNAL(clicked()), SLOT(changeAvatarClicked())); connect( ui.avatarButton, SIGNAL(clicked()), SLOT(getPicture()));
connect( ui.addIMAccountButton, SIGNAL(clicked( bool ) ), this , SLOT( addFriend2() ) ); connect( ui.addIMAccountButton, SIGNAL(clicked( bool ) ), this , SLOT( addFriend2() ) );
connect( ui.messengertreeWidget, SIGNAL(itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend2())); connect( ui.messengertreeWidget, SIGNAL(itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend2()));
@ -532,3 +532,14 @@ LogoBar & MessengerWindow::getLogoBar() const {
return *_rsLogoBarmessenger; return *_rsLogoBarmessenger;
} }
void MessengerWindow::getPicture()
{
QString fileName = QFileDialog::getOpenFileName(this, "Load File",
QDir::homePath(),
"Pictures (*.png *.xpm *.jpg)");
if(!fileName.isEmpty())
{
picture = QPixmap(fileName).scaled(72,72, Qt::KeepAspectRatio);
ui.avatarButton->setIcon(picture);
}
}

View File

@ -45,6 +45,7 @@ public:
NetworkDialog *networkDialog2; NetworkDialog *networkDialog2;
QPixmap picture;
public slots: public slots:
@ -75,6 +76,9 @@ private slots:
void addFriend2(); void addFriend2();
void getPicture();
/** RsServer Friend Calls */ /** RsServer Friend Calls */
void allowfriend2(); void allowfriend2();
void connectfriend2(); void connectfriend2();

View File

@ -62,10 +62,13 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
styleHtm = appDir + "/style/chat/default.htm"; styleHtm = appDir + "/style/chat/default.htm";
/* Hide ToolBox frame */ /* Hide Avatar frame */
showAvatarFrame(true); showAvatarFrame(false);
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
connect(ui.actionAvatar, SIGNAL(triggered()),this, SLOT(getAvatar()));
connect(ui.chattextEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) )); connect(ui.chattextEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) ));
connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) )); connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) ));
@ -469,3 +472,15 @@ void PopupChatDialog::changeStyle()
cursor.movePosition(QTextCursor::End); cursor.movePosition(QTextCursor::End);
ui.textBrowser->setTextCursor(cursor); ui.textBrowser->setTextCursor(cursor);
} }
void PopupChatDialog::getAvatar()
{
QString fileName = QFileDialog::getOpenFileName(this, "Load File",
QDir::homePath(),
"Pictures (*.png *.xpm *.jpg)");
if(!fileName.isEmpty())
{
picture = QPixmap(fileName).scaled(82,82, Qt::KeepAspectRatio);
ui.myavatarlabel->setPixmap(picture);
}
}

View File

@ -56,6 +56,10 @@ public:
QString loadEmptyStyle(); QString loadEmptyStyle();
QPixmap picture;
public slots: public slots:
/** Overloaded QWidget.show */ /** Overloaded QWidget.show */
void show(); void show();
@ -82,6 +86,9 @@ private slots:
void checkChat(); void checkChat();
void sendChat(); void sendChat();
void getAvatar();
private: private:
@ -104,6 +111,8 @@ private:
QStringList history; QStringList history;
QString wholeChat; QString wholeChat;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::PopupChatDialog ui; Ui::PopupChatDialog ui;
}; };

View File

@ -6,29 +6,24 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>484</width> <width>484</width>
<height>401</height> <height>437</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralwidget" > <widget class="QWidget" name="centralwidget" >
<property name="geometry" > <layout class="QGridLayout" >
<rect>
<x>0</x>
<y>12</y>
<width>484</width>
<height>368</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<property name="rightMargin" > <property name="rightMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="bottomMargin" > <property name="bottomMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="horizontalSpacing" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0" > <item row="0" column="0" >
@ -78,18 +73,18 @@
<widget class="QLabel" name="avatarlabel" > <widget class="QLabel" name="avatarlabel" >
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
<width>70</width> <width>116</width>
<height>70</height> <height>116</height>
</size> </size>
</property> </property>
<property name="maximumSize" > <property name="maximumSize" >
<size> <size>
<width>70</width> <width>116</width>
<height>70</height> <height>116</height>
</size> </size>
</property> </property>
<property name="styleSheet" > <property name="styleSheet" >
<string notr="true" >QLabel{ <string>QLabel{
border-image: url(:/images/mystatus_bg.png); border-image: url(:/images/mystatus_bg.png);
}</string> }</string>
@ -107,7 +102,7 @@ border-image: url(:/images/mystatus_bg.png);
<property name="orientation" > <property name="orientation" >
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" >
<size> <size>
<width>61</width> <width>61</width>
<height>141</height> <height>141</height>
@ -119,18 +114,18 @@ border-image: url(:/images/mystatus_bg.png);
<widget class="QLabel" name="myavatarlabel" > <widget class="QLabel" name="myavatarlabel" >
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
<width>70</width> <width>116</width>
<height>70</height> <height>116</height>
</size> </size>
</property> </property>
<property name="maximumSize" > <property name="maximumSize" >
<size> <size>
<width>70</width> <width>116</width>
<height>70</height> <height>116</height>
</size> </size>
</property> </property>
<property name="styleSheet" > <property name="styleSheet" >
<string notr="true" >QLabel{ <string>QLabel{
border-image: url(:/images/mystatus_bg.png); border-image: url(:/images/mystatus_bg.png);
}</string> }</string>
@ -151,10 +146,10 @@ border-image: url(:/images/mystatus_bg.png);
<property name="sizeType" > <property name="sizeType" >
<enum>QSizePolicy::Fixed</enum> <enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" >
<size> <size>
<width>61</width> <width>61</width>
<height>41</height> <height>30</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -197,7 +192,7 @@ border-image: url(:/images/mystatus_bg.png);
<property name="orientation" > <property name="orientation" >
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" >
<size> <size>
<width>14</width> <width>14</width>
<height>321</height> <height>321</height>
@ -209,13 +204,19 @@ border-image: url(:/images/mystatus_bg.png);
</item> </item>
<item row="1" column="0" > <item row="1" column="0" >
<widget class="QFrame" name="Chatbuttonframe" > <widget class="QFrame" name="Chatbuttonframe" >
<property name="minimumSize" >
<size>
<width>16</width>
<height>46</height>
</size>
</property>
<property name="frameShape" > <property name="frameShape" >
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="frameShadow" > <property name="frameShadow" >
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout" > <layout class="QGridLayout" >
<property name="topMargin" > <property name="topMargin" >
<number>9</number> <number>9</number>
</property> </property>
@ -227,7 +228,7 @@ border-image: url(:/images/mystatus_bg.png);
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" >
<size> <size>
<width>190</width> <width>190</width>
<height>25</height> <height>25</height>
@ -318,8 +319,7 @@ p, li { white-space: pre-wrap; }
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset> <iconset>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
<normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
</property> </property>
<property name="checkable" > <property name="checkable" >
<bool>false</bool> <bool>false</bool>
@ -347,8 +347,7 @@ p, li { white-space: pre-wrap; }
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset> <iconset>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
<normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
</property> </property>
<property name="checkable" > <property name="checkable" >
<bool>false</bool> <bool>false</bool>
@ -376,8 +375,7 @@ p, li { white-space: pre-wrap; }
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset> <iconset>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
<normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
</property> </property>
<property name="checkable" > <property name="checkable" >
<bool>false</bool> <bool>false</bool>
@ -405,8 +403,7 @@ p, li { white-space: pre-wrap; }
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset> <iconset>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
<normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
</property> </property>
<property name="checkable" > <property name="checkable" >
<bool>false</bool> <bool>false</bool>
@ -467,7 +464,7 @@ p, li { white-space: pre-wrap; }
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" >
<size> <size>
<width>351</width> <width>351</width>
<height>20</height> <height>20</height>
@ -486,34 +483,24 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QStatusBar" name="statusbar" > <widget class="QStatusBar" name="statusbar" />
<property name="geometry" >
<rect>
<x>0</x>
<y>380</y>
<width>484</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="toolBar" > <widget class="QToolBar" name="toolBar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>484</width>
<height>12</height>
</rect>
</property>
<property name="windowTitle" > <property name="windowTitle" >
<string>toolBar</string> <string>toolBar</string>
</property> </property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<attribute name="toolBarArea" > <attribute name="toolBarArea" >
<enum>TopToolBarArea</enum> <enum>TopToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak" > <attribute name="toolBarBreak" >
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="actionAvatar" />
</widget> </widget>
<action name="actionBold" > <action name="actionBold" >
<property name="text" > <property name="text" >
@ -535,7 +522,20 @@ p, li { white-space: pre-wrap; }
<string>Strike</string> <string>Strike</string>
</property> </property>
</action> </action>
<action name="actionAvatar" >
<property name="icon" >
<iconset resource="../images.qrc" >:/images/add_image24.png</iconset>
</property>
<property name="text" >
<string>Avatar</string>
</property>
<property name="toolTip" >
<string>Set your Avatar Picture</string>
</property>
</action>
</widget> </widget>
<resources/> <resources>
<include location="../images.qrc" />
</resources>
<connections/> <connections/>
</ui> </ui>