fixed icons in FriendSelectionWidget and MsgComposer. Also added disable/enable for From field depending on which type of recipient is used.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8087 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-03-27 22:16:12 +00:00
parent 9fc94b87ae
commit 5e50423915
4 changed files with 97 additions and 78 deletions

View File

@ -528,7 +528,9 @@ void FriendSelectionWidget::secured_fillList()
if (!rsIdentity->getIdDetails(RsGxsId(*gxsIt), detail))
continue; /* BAD */
QPixmap identicon = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(*gxsIt))) ;
QList<QIcon> icons ;
GxsIdDetails::getIcons(detail,icons,GxsIdDetails::ICON_TYPE_AVATAR) ;
QIcon identicon = icons.front() ;
// make a widget per friend
gxsItem = new RSTreeWidgetItem(mCompareRole, IDTYPE_GXS);
@ -538,7 +540,7 @@ void FriendSelectionWidget::secured_fillList()
//gxsItem->setTextColor(COLUMN_NAME, textColorOnline());
gxsItem->setFlags(Qt::ItemIsUserCheckable | gxsItem->flags());
gxsItem->setIcon(COLUMN_NAME, QIcon(identicon));
gxsItem->setIcon(COLUMN_NAME, identicon);
gxsItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.mId.toStdString()));
gxsItem->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);

View File

@ -135,14 +135,14 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
m_completer = NULL;
ui.distantFrame->hide();
ui.respond_to_CB->setEnabled(false) ;
ui.fromLabel->setEnabled(false) ;
Settings->loadWidgetInformation(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
ui.hashBox->hide();
ui.signMessage_CB->setChecked(true) ;
ui.signMessage_CB->setEnabled(false) ;
// connect up the buttons.
connect( ui.actionSend, SIGNAL( triggered (bool)), this, SLOT( sendMessage( ) ) );
@ -217,8 +217,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
/* initialize friends list */
ui.friendSelectionWidget->setHeaderText(tr("Send To:"));
ui.friendSelectionWidget->setModus(FriendSelectionWidget::MODUS_MULTI);
ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_GROUP
| FriendSelectionWidget::SHOW_SSL
ui.friendSelectionWidget->setShowType(//FriendSelectionWidget::SHOW_GROUP // removed this because it's too confusing.
FriendSelectionWidget::SHOW_SSL
| FriendSelectionWidget::SHOW_GXS);
ui.friendSelectionWidget->start();
@ -295,17 +295,19 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
ui.recipientWidget->setColumnCount(COLUMN_RECIPIENT_COUNT);
QHeaderView *header = ui.recipientWidget->horizontalHeader();
header->resizeSection(COLUMN_RECIPIENT_TYPE, 70);
header->resizeSection(COLUMN_RECIPIENT_TYPE, 120);
header->resizeSection(COLUMN_RECIPIENT_ICON, 22);
QHeaderView_setSectionResizeMode(header, COLUMN_RECIPIENT_TYPE, QHeaderView::Fixed);
QHeaderView_setSectionResizeMode(header, COLUMN_RECIPIENT_ICON, QHeaderView::Fixed);
QHeaderView_setSectionResizeMode(header, COLUMN_RECIPIENT_NAME, QHeaderView::Interactive);
QHeaderView_setSectionResizeMode(header, COLUMN_RECIPIENT_NAME, QHeaderView::Fixed);
header->setStretchLastSection(true);
/* Set own item delegate */
QItemDelegate *delegate = new MessageItemDelegate(this);
ui.recipientWidget->setItemDelegateForColumn(COLUMN_RECIPIENT_ICON, delegate);
connect(ui.recipientWidget,SIGNAL(cellChanged(int,int)),this,SLOT(updateCells(int,int))) ;
addEmptyRecipient();
// load settings
@ -344,6 +346,36 @@ MessageComposer::~MessageComposer()
delete(m_compareRole);
}
void MessageComposer::updateCells(int,int)
{
int rowCount = ui.recipientWidget->rowCount();
int row;
bool has_gxs = false ;
for (row = 0; row < rowCount; ++row)
{
enumType type;
destinationType dtype ;
std::string id;
if (getRecipientFromRow(row, type,dtype, id) && !id.empty() )
if(dtype == PEER_TYPE_GXS)
has_gxs = true ;
}
if(has_gxs)
{
ui.respond_to_CB->setEnabled(true) ;
ui.distantFrame->show();
ui.fromLabel->setEnabled(true);
}
else
{
ui.respond_to_CB->setEnabled(false) ;
ui.distantFrame->hide() ;
ui.fromLabel->setEnabled(false);
}
}
void MessageComposer::processSettings(bool bLoad)
{
Settings->beginGroup(QString("MessageComposer"));
@ -740,6 +772,8 @@ void MessageComposer::peerStatusChanged(const QString& peer_id, int status)
}
}
}
}
void MessageComposer::setFileList(const std::list<DirDetails>& dir_info)
@ -1364,8 +1398,6 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
QMessageBox::warning(this, tr("RetroShare"), tr("Please insert at least one recipient."), QMessageBox::Ok);
return false; // Don't send with no recipient
}
if(ui.signMessage_CB->isChecked())
mi.msgflags |= RS_MSG_SIGNED ;
if(mi.rsgxsid_srcId.isNull() && !(mi.rsgxsid_msgto.empty() && mi.rsgxsid_msgcc.empty() && mi.rsgxsid_msgbcc.empty()))
{
@ -1519,13 +1551,14 @@ void MessageComposer::setRecipientToRow(int row, enumType type, destinationType
std::cerr << "Can't get peer details from " << gid << std::endl;
return ;
}
QPixmap identicon = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(gid))) ;
QList<QIcon> icons ;
GxsIdDetails::getIcons(detail,icons,GxsIdDetails::ICON_TYPE_AVATAR) ;
name = tr("%2 <%2@%1>").arg(QString::fromStdString(gid.toStdString())).arg(QString::fromUtf8(detail.mNickname.c_str())) ;
icon = QIcon(identicon);
ui.distantFrame->show();
if(!icons.empty())
icon = icons.front() ;
}
break ;

View File

@ -99,6 +99,7 @@ private slots:
void toggleContacts();
void buildCompleter();
void updatecontactsviewicons();
void updateCells(int,int) ;
void filterComboBoxChanged(int);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>814</width>
<height>696</height>
<width>925</width>
<height>747</height>
</rect>
</property>
<property name="windowTitle">
@ -220,6 +220,47 @@
<property name="horizontalSpacing">
<number>1</number>
</property>
<item row="0" column="8">
<widget class="QToolButton" name="italicbtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>167</width>
<height>167</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Italic</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/textitalic.png</normaloff>:/images/textedit/textitalic.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="12">
<widget class="QToolButton" name="imagebtn">
<property name="minimumSize">
@ -445,47 +486,6 @@
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QToolButton" name="italicbtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>167</width>
<height>167</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Italic</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/textitalic.png</normaloff>:/images/textedit/textitalic.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QToolButton" name="colorbtn">
<property name="minimumSize">
@ -577,7 +577,7 @@
</property>
</widget>
</item>
<item row="0" column="16">
<item row="0" column="15">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -651,23 +651,6 @@
</property>
</widget>
</item>
<item row="0" column="14">
<widget class="QPushButton" name="signMessage_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Cryptographically sign message to distant peers. This is prevents intermediate peers to spoof your identity.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/stock_signature_ok.png</normaloff>:/images/stock_signature_ok.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -1046,8 +1029,8 @@ border-image: url(:/images/closepressed.png)
<rect>
<x>0</x>
<y>0</y>
<width>814</width>
<height>21</height>
<width>925</width>
<height>25</height>
</rect>
</property>
</widget>