From 5ae506fe3bfcad367744d2f4766e15a1a9969682 Mon Sep 17 00:00:00 2001 From: krepa098 Date: Wed, 10 Dec 2014 10:35:56 +0100 Subject: [PATCH] filetransferwidget: added open (browse?) button, fixed layout --- res.qrc | 29 +++---- src/chatlog/chatline.cpp | 2 +- src/chatlog/content/filetransferwidget.cpp | 16 +++- src/chatlog/content/filetransferwidget.ui | 35 +++++++-- src/chatlog/content/text.cpp | 2 +- ui/fileTransferInstance/browse.svg | 86 +++++++++++++++++++++ ui/fileTransferInstance/browse_path.png | Bin 0 -> 462 bytes ui/fileTransferInstance/green.css | 8 +- ui/fileTransferInstance/grey.css | 8 +- ui/fileTransferInstance/red.css | 8 +- ui/fileTransferInstance/yellow.css | 8 +- 11 files changed, 161 insertions(+), 41 deletions(-) create mode 100644 ui/fileTransferInstance/browse.svg create mode 100644 ui/fileTransferInstance/browse_path.png diff --git a/res.qrc b/res.qrc index 6c35d1e48..569965528 100644 --- a/res.qrc +++ b/res.qrc @@ -42,8 +42,8 @@ ui/callButton/callButtonYellowPressed.png ui/chatArea/chatArea.css ui/chatArea/innerStyle.css - ui/chatArea/spinner.png - ui/chatArea/info.png + ui/chatArea/spinner.png + ui/chatArea/info.png ui/chatArea/scrollBarDownArrow.png ui/chatArea/scrollBarDownArrowHover.png ui/chatArea/scrollBarDownArrowPressed.png @@ -94,18 +94,18 @@ translations/fr.qm translations/ru.qm ui/fileTransferWidget/fileTransferWidget.css - ui/fileTransferInstance/red.css - ui/fileTransferInstance/green.css - ui/fileTransferInstance/grey.css - ui/fileTransferInstance/yellow.css - ui/fileTransferInstance/background_red.png - ui/fileTransferInstance/background_yellow.png - ui/fileTransferInstance/background_green.png - ui/fileTransferInstance/background_grey.png - ui/fileTransferInstance/pause_2x.png - ui/fileTransferInstance/no_2x.png - ui/fileTransferInstance/yes_2x.png - ui/fileTransferInstance/arrow_white_2x.png + ui/fileTransferInstance/red.css + ui/fileTransferInstance/green.css + ui/fileTransferInstance/grey.css + ui/fileTransferInstance/yellow.css + ui/fileTransferInstance/background_red.png + ui/fileTransferInstance/background_yellow.png + ui/fileTransferInstance/background_green.png + ui/fileTransferInstance/background_grey.png + ui/fileTransferInstance/pause_2x.png + ui/fileTransferInstance/no_2x.png + ui/fileTransferInstance/yes_2x.png + ui/fileTransferInstance/arrow_white_2x.png ui/statusButton/dot_away.png ui/statusButton/dot_busy.png ui/statusButton/dot_idle.png @@ -229,5 +229,6 @@ smileys/cylgom/yawn.png translations/bg.qm translations/sv.qm + ui/fileTransferInstance/browse_path.png diff --git a/src/chatlog/chatline.cpp b/src/chatlog/chatline.cpp index 7298e65e5..ac404f3bc 100644 --- a/src/chatlog/chatline.cpp +++ b/src/chatlog/chatline.cpp @@ -198,7 +198,7 @@ void ChatLine::layout(qreal w, QPointF scenePos) // vertical alignment may depend on width, so we do it in a second pass qreal yOffset = 0.0; - if(content[i]->firstLineVOffset() > 0.0) + //if(content[i]->firstLineVOffset() > 0.0) yOffset = maxVOffset - content[i]->firstLineVOffset(); // reposition diff --git a/src/chatlog/content/filetransferwidget.cpp b/src/chatlog/content/filetransferwidget.cpp index f9578b8c8..a2ff659f0 100644 --- a/src/chatlog/content/filetransferwidget.cpp +++ b/src/chatlog/content/filetransferwidget.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include FileTransferWidget::FileTransferWidget(QWidget *parent, ToxFile file) @@ -60,7 +61,7 @@ FileTransferWidget::FileTransferWidget(QWidget *parent, ToxFile file) if(fileInfo.direction == ToxFile::SENDING) showPreview(fileInfo.filePath); - setFixedHeight(85); + setFixedHeight(69); } FileTransferWidget::~FileTransferWidget() @@ -164,6 +165,10 @@ void FileTransferWidget::onFileTransferFinished(ToxFile file) setupButtons(); hideWidgets(); + ui->bottomButton->show(); + ui->bottomButton->setIcon(QIcon(":/ui/fileTransferInstance/browse_path.png")); + ui->bottomButton->setObjectName("browse"); + // preview if(fileInfo.direction == ToxFile::RECEIVING) showPreview(fileInfo.filePath); @@ -184,7 +189,9 @@ QString FileTransferWidget::getHumanReadableSize(qint64 size) void FileTransferWidget::hideWidgets() { - ui->buttonWidget->hide(); + ui->topButton->hide(); + ui->bottomButton->hide(); + //ui->buttonWidget->hide(); ui->progressBar->hide(); ui->progressLabel->hide(); ui->etaLabel->hide(); @@ -263,6 +270,11 @@ void FileTransferWidget::handleButton(QPushButton *btn) Core::getInstance()->acceptFileRecvRequest(fileInfo.friendId, fileInfo.fileNum, path); } } + + if(btn->objectName() == "browse") + { + QDesktopServices::openUrl("file://" + fileInfo.filePath); + } } void FileTransferWidget::showPreview(const QString &filename) diff --git a/src/chatlog/content/filetransferwidget.ui b/src/chatlog/content/filetransferwidget.ui index aaad82199..b3d75d77f 100644 --- a/src/chatlog/content/filetransferwidget.ui +++ b/src/chatlog/content/filetransferwidget.ui @@ -14,6 +14,21 @@ Form + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + @@ -36,10 +51,10 @@ - 0 + 6 - 0 + 6 @@ -61,17 +76,23 @@ - + + + 6 + 6 + + 6 + 6 - + 0 0 @@ -102,7 +123,7 @@ - + 0 0 @@ -118,7 +139,7 @@ - + 0 0 @@ -134,7 +155,7 @@ - + 0 0 diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index c3510a346..d8e73ac06 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -39,7 +39,7 @@ Text::Text(const QString& txt, QFont font, bool enableElide) ensureIntegrity(); freeResources(); - //setCacheMode(QGraphicsItem::DeviceCoordinateCache); + setCacheMode(QGraphicsItem::DeviceCoordinateCache); } Text::~Text() diff --git a/ui/fileTransferInstance/browse.svg b/ui/fileTransferInstance/browse.svg new file mode 100644 index 000000000..e545118aa --- /dev/null +++ b/ui/fileTransferInstance/browse.svg @@ -0,0 +1,86 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/ui/fileTransferInstance/browse_path.png b/ui/fileTransferInstance/browse_path.png new file mode 100644 index 0000000000000000000000000000000000000000..5fe4251a61cced23c94f46cc7f40e85a5be13585 GIT binary patch literal 462 zcmV;<0WtoGP)X1^@s6FWx?200004b3#c}2nYxW zd^!M!40?wSrUy- zq9W0`0val%WPLR{63IqMVmp;k$fGc_^3NP|#!SSoI`e+~p7YK*IZ#vTZ*^PkuG^an z=u$WQuO0PA+mPPExKjseUt5r$>R}1wO@GvZDxb&zO#)-Z=LoP;toMPvVtpAA=bsrQ z1)X{~$!eY6t_Iv%y-h%szr8I`t==AW85rz{uSdjfN&OA*b~Z<4hUyTo*b)9m;>u1W zOhO$|r&Cv2ohUQR9$%dS{sPy)DR8fDsr|VIl@qDs>SLmIx6O&xfZjxIzL@qy<$``S z%x8nltZNK9smLF<1zG~061km-IBNwI5m&$*aP=