mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added Picture Preview Thumbnail patch for Privat Chat from xiaohan and fixed little design improvements
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3344 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
09d5014df5
commit
cfc17398dd
@ -1,4 +1,5 @@
|
|||||||
/****************************************************************
|
/****************************************************************
|
||||||
|
*
|
||||||
* RetroShare is distributed under the following license:
|
* RetroShare is distributed under the following license:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, crypton
|
* Copyright (C) 2006, crypton
|
||||||
@ -96,6 +97,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
|
|||||||
connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
|
connect(ui.attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture()));
|
||||||
connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
||||||
connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||||
connect(ui.emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget()));
|
connect(ui.emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget()));
|
||||||
@ -253,7 +255,7 @@ void PopupChatDialog::chatFriend(std::string id)
|
|||||||
if (id.empty()){
|
if (id.empty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::cerr<<" popup dialog chat friend 1"<<std::endl;
|
||||||
bool oneLocationConnected = false;
|
bool oneLocationConnected = false;
|
||||||
|
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
@ -453,9 +455,9 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() <<
|
|||||||
message.replace(code, "<img src=\"" + i.value() + "\" />");
|
message.replace(code, "<img src=\"" + i.value() + "\" />");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
history /*<< nickColor << color << font << fontSize*/ << timestamp << name << message;
|
history /*<< nickColor << color << font << fontSize*/ << timestamp << name << message;
|
||||||
|
|
||||||
|
|
||||||
QString formatMsg = loadEmptyStyle()/*.replace(nickColor)
|
QString formatMsg = loadEmptyStyle()/*.replace(nickColor)
|
||||||
.replace(color)
|
.replace(color)
|
||||||
.replace(font)
|
.replace(font)
|
||||||
@ -464,6 +466,7 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() <<
|
|||||||
.replace("%name%", name)
|
.replace("%name%", name)
|
||||||
.replace("%message%", message);
|
.replace("%message%", message);
|
||||||
|
|
||||||
|
|
||||||
if ((ui.textBrowser->verticalScrollBar()->maximum() - 30) < ui.textBrowser->verticalScrollBar()->value() ) {
|
if ((ui.textBrowser->verticalScrollBar()->maximum() - 30) < ui.textBrowser->verticalScrollBar()->value() ) {
|
||||||
ui.textBrowser->append(formatMsg + "\n");
|
ui.textBrowser->append(formatMsg + "\n");
|
||||||
} else {
|
} else {
|
||||||
@ -571,7 +574,10 @@ void PopupChatDialog::getFont()
|
|||||||
void PopupChatDialog::setFont()
|
void PopupChatDialog::setFont()
|
||||||
{
|
{
|
||||||
|
|
||||||
mCurrentFont.setBold(ui.textboldButton->isChecked());
|
// mCurrentFont.setBold(ui.textboldButton->isChecked());
|
||||||
|
bool flag;
|
||||||
|
flag=ui.textboldButton->isChecked();
|
||||||
|
mCurrentFont.setBold(flag);
|
||||||
mCurrentFont.setUnderline(ui.textunderlineButton->isChecked());
|
mCurrentFont.setUnderline(ui.textunderlineButton->isChecked());
|
||||||
mCurrentFont.setItalic(ui.textitalicButton->isChecked());
|
mCurrentFont.setItalic(ui.textitalicButton->isChecked());
|
||||||
|
|
||||||
@ -828,7 +834,7 @@ void PopupChatDialog::updatePeerAvatar(const std::string& peer_id)
|
|||||||
#ifdef CHAT_DEBUG
|
#ifdef CHAT_DEBUG
|
||||||
std::cerr << "Got no image" << std::endl ;
|
std::cerr << "Got no image" << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
ui.avatarlabel->setPixmap(QPixmap(":/images/no_avatar_70.png"));
|
ui.avatarlabel->setPixmap(QPixmap(":/images/no_avatar.png"));
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,11 +903,23 @@ void PopupChatDialog::addExtraFile()
|
|||||||
std::string filePath = qfile.toStdString();
|
std::string filePath = qfile.toStdString();
|
||||||
if (filePath != "")
|
if (filePath != "")
|
||||||
{
|
{
|
||||||
PopupChatDialog::addAttachment(filePath);
|
PopupChatDialog::addAttachment(filePath,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::addAttachment(std::string filePath)
|
void PopupChatDialog::addExtraPicture()
|
||||||
|
{
|
||||||
|
// select a picture file
|
||||||
|
QString qfile = QFileDialog::getOpenFileName(this, "Load Picture File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)",0,
|
||||||
|
QFileDialog::DontResolveSymlinks);
|
||||||
|
std::string filePath=qfile.toStdString();
|
||||||
|
if(filePath!="")
|
||||||
|
{
|
||||||
|
PopupChatDialog::addAttachment(filePath,1); //picture
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PopupChatDialog::addAttachment(std::string filePath,int flag)
|
||||||
{
|
{
|
||||||
/* add a AttachFileItem to the attachment section */
|
/* add a AttachFileItem to the attachment section */
|
||||||
std::cerr << "PopupChatDialog::addExtraFile() hashing file.";
|
std::cerr << "PopupChatDialog::addExtraFile() hashing file.";
|
||||||
@ -911,6 +929,9 @@ void PopupChatDialog::addAttachment(std::string filePath)
|
|||||||
AttachFileItem *file = new AttachFileItem(filePath);
|
AttachFileItem *file = new AttachFileItem(filePath);
|
||||||
//file->
|
//file->
|
||||||
|
|
||||||
|
if(flag==1)
|
||||||
|
file->setPicFlag(1);
|
||||||
|
|
||||||
ui.vboxLayout->addWidget(file, 1, 0);
|
ui.vboxLayout->addWidget(file, 1, 0);
|
||||||
|
|
||||||
//when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message
|
//when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message
|
||||||
@ -921,6 +942,8 @@ void PopupChatDialog::addAttachment(std::string filePath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PopupChatDialog::fileHashingFinished(AttachFileItem* file)
|
void PopupChatDialog::fileHashingFinished(AttachFileItem* file)
|
||||||
{
|
{
|
||||||
std::cerr << "PopupChatDialog::fileHashingFinished() started.";
|
std::cerr << "PopupChatDialog::fileHashingFinished() started.";
|
||||||
@ -946,12 +969,22 @@ void PopupChatDialog::fileHashingFinished(AttachFileItem* file)
|
|||||||
rsiface->unlockData(); /* Unlock Interface */
|
rsiface->unlockData(); /* Unlock Interface */
|
||||||
}
|
}
|
||||||
|
|
||||||
QString message = RetroShareLink(QString::fromStdString(file->FileName()),file->FileSize(),QString::fromStdString(file->FileHash())).toHtml();
|
QString message;
|
||||||
|
|
||||||
|
if(file->getPicFlag()==1){
|
||||||
|
message+="<img src=\"file:///";
|
||||||
|
message+=file->FilePath().c_str();
|
||||||
|
message+="\" width=\"100\" height=\"100\">";
|
||||||
|
message+="<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
message+= RetroShareLink(QString::fromStdString(file->FileName()),file->FileSize(),QString::fromStdString(file->FileHash())).toHtml();
|
||||||
|
|
||||||
#ifdef CHAT_DEBUG
|
#ifdef CHAT_DEBUG
|
||||||
std::cerr << "PopupChatDialog::anchorClicked message : " << message.toStdString() << std::endl;
|
std::cerr << "PopupChatDialog::anchorClicked message : " << message.toStdString() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ci.msg = message.toStdWString();
|
ci.msg = message.toStdWString();
|
||||||
ci.chatflags = RS_CHAT_PRIVATE;
|
ci.chatflags = RS_CHAT_PRIVATE;
|
||||||
|
|
||||||
@ -1026,7 +1059,7 @@ void PopupChatDialog::dropEvent(QDropEvent *event)
|
|||||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||||
mb.exec();
|
mb.exec();
|
||||||
} else {
|
} else {
|
||||||
PopupChatDialog::addAttachment(localpath);
|
PopupChatDialog::addAttachment(localpath,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,7 @@ protected:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addExtraFile();
|
void addExtraFile();
|
||||||
|
void addExtraPicture();
|
||||||
void showAvatarFrame(bool show);
|
void showAvatarFrame(bool show);
|
||||||
|
|
||||||
void setColor();
|
void setColor();
|
||||||
@ -110,7 +111,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void colorChanged(const QColor &c);
|
void colorChanged(const QColor &c);
|
||||||
void addAttachment(std::string);
|
void addAttachment(std::string,int flag);
|
||||||
|
|
||||||
QAction *actionTextBold;
|
QAction *actionTextBold;
|
||||||
QAction *actionTextUnderline;
|
QAction *actionTextUnderline;
|
||||||
|
@ -47,6 +47,13 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="html">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="openExternalLinks">
|
<property name="openExternalLinks">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -337,7 +344,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
|
<normaloff>../../../../../../../Dokumente und Einstellungen/Linux/.designer/backup</normaloff>../../../../../../../Dokumente und Einstellungen/Linux/.designer/backup</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -366,7 +373,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
|
<normaloff>../../../../../../../Dokumente und Einstellungen/Linux/.designer/backup</normaloff>../../../../../../../Dokumente und Einstellungen/Linux/.designer/backup</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -395,7 +402,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
|
<normaloff>../../../../../../../Dokumente und Einstellungen/Linux/.designer/backup</normaloff>../../../../../../../Dokumente und Einstellungen/Linux/.designer/backup</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -424,7 +431,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</normaloff>C:/Dokumente und Einstellungen/Linux/.designer/backup</iconset>
|
<normaloff>../../../../../../../Dokumente und Einstellungen/Linux/.designer/backup</normaloff>../../../../../../../Dokumente und Einstellungen/Linux/.designer/backup</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -453,7 +460,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="8">
|
<item row="0" column="10">
|
||||||
<widget class="QPushButton" name="pushtoolsButton">
|
<widget class="QPushButton" name="pushtoolsButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -500,6 +507,70 @@ border: 1px solid #CCCCCC;
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="8">
|
||||||
|
<widget class="QToolButton" name="attachPictureButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>28</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>28</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Attach a Picture</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="9">
|
||||||
|
<widget class="QToolButton" name="addFileButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>28</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Add a File for your Friend</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../images.qrc">
|
||||||
|
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -524,26 +595,6 @@ border: 1px solid #CCCCCC;
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addFileButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Add a File for your Friend</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../images.qrc">
|
|
||||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -567,7 +618,7 @@ border: 1px solid #CCCCCC;
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<layout class="QVBoxLayout"/>
|
<layout class="QVBoxLayout" name="vboxLayout"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -613,7 +664,7 @@ border: 1px solid #CCCCCC;
|
|||||||
<action name="actionAvatar">
|
<action name="actionAvatar">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset resource="../images.qrc">
|
||||||
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
<normaloff>:/images/no_avatar_70.png</normaloff>:/images/no_avatar_70.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Avatar</string>
|
<string>Avatar</string>
|
||||||
|
@ -72,6 +72,7 @@ AttachFileItem::AttachFileItem(std::string hash, std::string name, uint64_t size
|
|||||||
|
|
||||||
mMode = flags & AFI_MASK_STATE;
|
mMode = flags & AFI_MASK_STATE;
|
||||||
mType = flags & AFI_MASK_TYPE;
|
mType = flags & AFI_MASK_TYPE;
|
||||||
|
mPicFlag=0;
|
||||||
|
|
||||||
if (mMode == AFI_STATE_EXTRA)
|
if (mMode == AFI_STATE_EXTRA)
|
||||||
{
|
{
|
||||||
@ -99,6 +100,7 @@ AttachFileItem::AttachFileItem(std::string path)
|
|||||||
|
|
||||||
mMode = AFI_STATE_EXTRA;
|
mMode = AFI_STATE_EXTRA;
|
||||||
mType = AFI_TYPE_ATTACH;
|
mType = AFI_TYPE_ATTACH;
|
||||||
|
mPicFlag=0;
|
||||||
|
|
||||||
/* ask for Files to hash/prepare it for us */
|
/* ask for Files to hash/prepare it for us */
|
||||||
if ((!rsFiles) || (!rsFiles->ExtraFileHash(path, AFI_DEFAULT_PERIOD, 0)))
|
if ((!rsFiles) || (!rsFiles->ExtraFileHash(path, AFI_DEFAULT_PERIOD, 0)))
|
||||||
|
@ -55,6 +55,8 @@ public:
|
|||||||
std::string FileName() { return mFileName; }
|
std::string FileName() { return mFileName; }
|
||||||
uint64_t FileSize() { return mFileSize; }
|
uint64_t FileSize() { return mFileSize; }
|
||||||
std::string FilePath() { return mPath; }
|
std::string FilePath() { return mPath; }
|
||||||
|
int getPicFlag() { return mPicFlag;}
|
||||||
|
void setPicFlag(int flag) { mPicFlag=flag;}
|
||||||
|
|
||||||
void updateItemStatic();
|
void updateItemStatic();
|
||||||
|
|
||||||
@ -81,6 +83,7 @@ private:
|
|||||||
uint64_t mFileSize;
|
uint64_t mFileSize;
|
||||||
std::string mSrcId;
|
std::string mSrcId;
|
||||||
|
|
||||||
|
uint32_t mPicFlag;
|
||||||
uint32_t mMode;
|
uint32_t mMode;
|
||||||
uint32_t mType;
|
uint32_t mType;
|
||||||
uint64_t mDivisor;
|
uint64_t mDivisor;
|
||||||
|
Loading…
Reference in New Issue
Block a user