From 23b2a9cce08c024afa4b8a7b4e832a0de7be87d8 Mon Sep 17 00:00:00 2001 From: defnax Date: Sun, 14 Feb 2010 00:38:03 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/MessagesDialog.cpp | 58 ++++------------------- retroshare-gui/src/gui/MessagesDialog.ui | 25 +++++++++- 2 files changed, 32 insertions(+), 51 deletions(-) diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index 617588430..221e29cdb 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -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 sizeList = ui.msgSplitter->sizes(); - QList::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 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); } diff --git a/retroshare-gui/src/gui/MessagesDialog.ui b/retroshare-gui/src/gui/MessagesDialog.ui index 6dd591dd2..90e70c4c7 100644 --- a/retroshare-gui/src/gui/MessagesDialog.ui +++ b/retroshare-gui/src/gui/MessagesDialog.ui @@ -1332,6 +1332,12 @@ p, li { white-space: pre-wrap; } :/images/edit_remove24.png:/images/edit_remove24.png + + true + + + true + @@ -1464,5 +1470,22 @@ p, li { white-space: pre-wrap; } - + + + expandFilesButton + clicked(bool) + msgList + setVisible(bool) + + + 150 + 321 + + + 399 + 397 + + + +