fixed able again hide/show the Messages Filelist, used now signal/slots in ui.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2307 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-02-14 00:38:03 +00:00
parent 7a10cd6c95
commit 23b2a9cce0
2 changed files with 32 additions and 51 deletions

View File

@ -168,6 +168,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
//sertting default filter by column as subject
proxyModel->setFilterKeyColumn(ui.filterColumnComboBox->currentIndex());
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -426,64 +427,21 @@ void MessagesDialog::forwardmessage()
void MessagesDialog::togglefileview()
{
/* if msg header visible -> hide by changing splitter
/* if msg header visible -> change icon and tooltip
* three widgets...
*/
QList<int> sizeList = ui.msgSplitter->sizes();
QList<int>::iterator it;
int listSize = 0;
int msgSize = 0;
int recommendSize = 0;
int i = 0;
for(it = sizeList.begin(); it != sizeList.end(); it++, i++)
if (ui.expandFilesButton->isChecked())
{
if (i == 0)
{
listSize = (*it);
}
else if (i == 1)
{
msgSize = (*it);
}
else if (i == 2)
{
recommendSize = (*it);
}
}
int totalSize = listSize + msgSize + recommendSize;
bool toShrink = true;
if (recommendSize < (int) totalSize / 10)
{
toShrink = false;
}
QList<int> newSizeList;
if (toShrink)
{
newSizeList.push_back(listSize + recommendSize / 3);
newSizeList.push_back(msgSize + recommendSize * 2 / 3);
newSizeList.push_back(0);
ui.expandFilesButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
ui.expandFilesButton->setToolTip("Expand");
ui.expandFilesButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
ui.expandFilesButton->setToolTip("Hide");
}
else
{
/* no change */
int nlistSize = (totalSize * 2 / 3) * listSize / (listSize + msgSize);
int nMsgSize = (totalSize * 2 / 3) - listSize;
newSizeList.push_back(nlistSize);
newSizeList.push_back(nMsgSize);
newSizeList.push_back(totalSize * 1 / 3);
ui.expandFilesButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
ui.expandFilesButton->setToolTip("Hide");
}
ui.expandFilesButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
ui.expandFilesButton->setToolTip("Expand");
}
ui.msgSplitter->setSizes(newSizeList);
}

View File

@ -1332,6 +1332,12 @@ p, li { white-space: pre-wrap; }
<iconset resource="images.qrc">
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
@ -1464,5 +1470,22 @@ p, li { white-space: pre-wrap; }
<resources>
<include location="images.qrc"/>
</resources>
<connections/>
<connections>
<connection>
<sender>expandFilesButton</sender>
<signal>clicked(bool)</signal>
<receiver>msgList</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>150</x>
<y>321</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>397</y>
</hint>
</hints>
</connection>
</connections>
</ui>