* 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.avatarButton, SIGNAL(clicked()), SLOT(changeAvatarClicked()));
connect( ui.avatarButton, SIGNAL(clicked()), SLOT(getPicture()));
connect( ui.addIMAccountButton, SIGNAL(clicked( bool ) ), this , SLOT( addFriend2() ) );
connect( ui.messengertreeWidget, SIGNAL(itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend2()));
@ -532,3 +532,14 @@ LogoBar & MessengerWindow::getLogoBar() const {
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;
QPixmap picture;
public slots:
@ -75,6 +76,9 @@ private slots:
void addFriend2();
void getPicture();
/** RsServer Friend Calls */
void allowfriend2();
void connectfriend2();

View File

@ -62,10 +62,13 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
styleHtm = appDir + "/style/chat/default.htm";
/* Hide ToolBox frame */
showAvatarFrame(true);
/* Hide Avatar frame */
showAvatarFrame(false);
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.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) ));
@ -469,3 +472,15 @@ void PopupChatDialog::changeStyle()
cursor.movePosition(QTextCursor::End);
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();
QPixmap picture;
public slots:
/** Overloaded QWidget.show */
void show();
@ -82,6 +86,9 @@ private slots:
void checkChat();
void sendChat();
void getAvatar();
private:
@ -104,6 +111,8 @@ private:
QStringList history;
QString wholeChat;
/** Qt Designer generated object */
Ui::PopupChatDialog ui;
};

View File

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