From aae4208470cf9c79420ae803d37a61aff986d156 Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 10 Jul 2009 23:48:20 +0000 Subject: [PATCH] enabled format file size's git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1352 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/MessagesDialog.cpp | 11 +++++---- retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp | 23 ++++++++++++++----- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index fba9c6c3e..aa90af976 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -24,6 +24,7 @@ #include "msgs/ChanMsgDialog.h" #include "gui/toaster/MessageToaster.h" #include "util/printpreview.h" +#include "util/misc.h" #include "rsiface/rsiface.h" #include "rsiface/rspeers.h" @@ -101,7 +102,7 @@ MessagesDialog::MessagesDialog(QWidget *parent) /* Set header resize modes and initial section sizes */ QHeaderView * msglheader = ui.msgList->header () ; - msglheader->setResizeMode (0, QHeaderView::Interactive); + msglheader->setResizeMode (0, QHeaderView::Interactive); msglheader->setResizeMode (1, QHeaderView::Interactive); msglheader->setResizeMode (2, QHeaderView::Interactive); msglheader->setResizeMode (3, QHeaderView::Interactive); @@ -112,11 +113,11 @@ MessagesDialog::MessagesDialog(QWidget *parent) msglheader->resizeSection ( 3, 200 ); ui.newmessageButton->setIcon(QIcon(QString(":/images/folder-draft24-pressed.png"))); - ui.replymessageButton->setIcon(QIcon(QString(":/images/replymail-pressed.png"))); + ui.replymessageButton->setIcon(QIcon(QString(":/images/replymail-pressed.png"))); ui.replyallmessageButton->setIcon(QIcon(QString(":/images/replymailall24-hover.png"))); ui.forwardmessageButton->setIcon(QIcon(QString(":/images/mailforward24-hover.png"))); - ui.removemessageButton->setIcon(QIcon(QString(":/images/deletemail-pressed.png"))); - ui.printbutton->setIcon(QIcon(QString(":/images/print24.png"))); + ui.removemessageButton->setIcon(QIcon(QString(":/images/deletemail-pressed.png"))); + ui.printbutton->setIcon(QIcon(QString(":/images/print24.png"))); ui.forwardmessageButton->setToolTip(tr("Forward selected Message")); ui.replyallmessageButton->setToolTip(tr("Replay to All")); @@ -716,7 +717,7 @@ void MessagesDialog::insertMsgTxtAndFiles() item -> setText(0, QString::fromStdString(it->fname)); //std::cerr << "Msg FileItem(" << it->fname.length() << ") :" << it->fname << std::endl; - item -> setText(1, QString::number(it->size)); /* (1) Size */ + item -> setText(1, misc::friendlyUnit(it->size)); /* (1) Size */ item -> setText(2, QString::number(0)); /* (2) Rank */ // what is this ??? item -> setText(3, QString::fromStdString(it->hash)); diff --git a/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp b/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp index aff3e90c3..91071bb5c 100644 --- a/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp +++ b/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp @@ -27,6 +27,7 @@ #include "rsiface/rsmsgs.h" #include +#include "util/misc.h" #include @@ -60,8 +61,7 @@ ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); - - + setupFileActions(); setupEditActions(); setupViewActions(); @@ -200,9 +200,20 @@ ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags) alignmentmenu->addAction(actionAlignJustify); ui.textalignmentbtn->setMenu(alignmentmenu); - QPixmap pxm(24,24); - pxm.fill(Qt::black); - ui.colorbtn->setIcon(pxm); + QPixmap pxm(24,24); + pxm.fill(Qt::black); + ui.colorbtn->setIcon(pxm); + + /* Set header resize modes and initial section sizes */ + ui.msgFileList->setColumnCount(5); + + QHeaderView * _smheader = ui.msgFileList->header () ; + + _smheader->resizeSection ( 0, 200 ); + _smheader->resizeSection ( 1, 60 ); + _smheader->resizeSection ( 2, 60 ); + _smheader->resizeSection ( 3, 220 ); + _smheader->resizeSection ( 4, 10 ); /* Hide platform specific features */ #ifdef Q_WS_WIN @@ -456,7 +467,7 @@ void ChanMsgDialog::insertFileList(const std::list& files_info) QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); item->setText(0, QString::fromStdString(it->name)); /* (0) Filename */ - item->setText(1, QString::number(it->count)); /* (1) Size */ + item->setText(1, misc::friendlyUnit(it->count)); /* (1) Size */ item->setText(2, QString::number(it->rank)); item->setText(3, QString::fromStdString(it->hash)); item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);