1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

filetransferwidget: added open (browse?) button, fixed layout

This commit is contained in:
krepa098 2014-12-10 10:35:56 +01:00
parent 0f2a339a98
commit 5ae506fe3b
11 changed files with 161 additions and 41 deletions

29
res.qrc
View File

@ -42,8 +42,8 @@
<file>ui/callButton/callButtonYellowPressed.png</file>
<file>ui/chatArea/chatArea.css</file>
<file>ui/chatArea/innerStyle.css</file>
<file>ui/chatArea/spinner.png</file>
<file>ui/chatArea/info.png</file>
<file>ui/chatArea/spinner.png</file>
<file>ui/chatArea/info.png</file>
<file>ui/chatArea/scrollBarDownArrow.png</file>
<file>ui/chatArea/scrollBarDownArrowHover.png</file>
<file>ui/chatArea/scrollBarDownArrowPressed.png</file>
@ -94,18 +94,18 @@
<file>translations/fr.qm</file>
<file>translations/ru.qm</file>
<file>ui/fileTransferWidget/fileTransferWidget.css</file>
<file>ui/fileTransferInstance/red.css</file>
<file>ui/fileTransferInstance/green.css</file>
<file>ui/fileTransferInstance/grey.css</file>
<file>ui/fileTransferInstance/yellow.css</file>
<file>ui/fileTransferInstance/background_red.png</file>
<file>ui/fileTransferInstance/background_yellow.png</file>
<file>ui/fileTransferInstance/background_green.png</file>
<file>ui/fileTransferInstance/background_grey.png</file>
<file>ui/fileTransferInstance/pause_2x.png</file>
<file>ui/fileTransferInstance/no_2x.png</file>
<file>ui/fileTransferInstance/yes_2x.png</file>
<file>ui/fileTransferInstance/arrow_white_2x.png</file>
<file>ui/fileTransferInstance/red.css</file>
<file>ui/fileTransferInstance/green.css</file>
<file>ui/fileTransferInstance/grey.css</file>
<file>ui/fileTransferInstance/yellow.css</file>
<file>ui/fileTransferInstance/background_red.png</file>
<file>ui/fileTransferInstance/background_yellow.png</file>
<file>ui/fileTransferInstance/background_green.png</file>
<file>ui/fileTransferInstance/background_grey.png</file>
<file>ui/fileTransferInstance/pause_2x.png</file>
<file>ui/fileTransferInstance/no_2x.png</file>
<file>ui/fileTransferInstance/yes_2x.png</file>
<file>ui/fileTransferInstance/arrow_white_2x.png</file>
<file>ui/statusButton/dot_away.png</file>
<file>ui/statusButton/dot_busy.png</file>
<file>ui/statusButton/dot_idle.png</file>
@ -229,5 +229,6 @@
<file>smileys/cylgom/yawn.png</file>
<file>translations/bg.qm</file>
<file>translations/sv.qm</file>
<file>ui/fileTransferInstance/browse_path.png</file>
</qresource>
</RCC>

View File

@ -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

View File

@ -25,6 +25,7 @@
#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
#include <QDesktopServices>
#include <QDebug>
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)

View File

@ -14,6 +14,21 @@
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="mainHorizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame_3">
<property name="sizePolicy">
@ -36,10 +51,10 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>6</number>
</property>
<item>
<widget class="QLabel" name="previewLabel">
@ -61,17 +76,23 @@
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0,0">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="filenameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -102,7 +123,7 @@
<item>
<widget class="QLabel" name="fileSizeLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -118,7 +139,7 @@
<item>
<widget class="QLabel" name="progressLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -134,7 +155,7 @@
<item>
<widget class="QLabel" name="etaLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>

View File

@ -39,7 +39,7 @@ Text::Text(const QString& txt, QFont font, bool enableElide)
ensureIntegrity();
freeResources();
//setCacheMode(QGraphicsItem::DeviceCoordinateCache);
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
}
Text::~Text()

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="26"
height="25"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="browse.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#000000"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="11.2"
inkscape:cx="20.11967"
inkscape:cy="30.550679"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1025"
inkscape:window-x="-2"
inkscape:window-y="-3"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-2079.7244)">
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
d="M 0.46660712,2089.1244 C 0.20855731,2089.1244 0,2089.2976 0,2089.5144 l 0,14.818 c 0,0.2168 0.20855731,0.392 0.46660712,0.392 l 25.06678488,0 c 0.258051,0 0.466608,-0.1752 0.466608,-0.392 l 0,-14.818 c 0,-0.2168 -0.208557,-0.39 -0.466608,-0.39 l -4.733392,0 0,11.0175 c 0,0.2167 -0.208557,0.392 -0.466607,0.392 l -14.6667858,0 c -0.2580499,0 -0.4666071,-0.1753 -0.4666071,-0.392 l 0,-11.0175 -4.73339298,0 z"
id="rect2985"
inkscape:connector-curvature="0"
inkscape:export-filename="/home/paul/browse_path.png"
inkscape:export-xdpi="6.6857142"
inkscape:export-ydpi="6.6857142" />
<path
sodipodi:type="arc"
style="fill:#ffffff;fill-opacity:1;stroke:none"
id="path2990"
sodipodi:cx="170"
sodipodi:cy="902.36218"
sodipodi:rx="80"
sodipodi:ry="80"
d="m 250,902.36218 c 0,44.18278 -35.81722,80 -80,80 -44.18278,0 -80,-35.81722 -80,-80 0,-44.18278 35.81722,-80 80,-80 44.18278,0 80,35.81722 80,80 z"
transform="matrix(0.05372449,0,0,0.05372449,4.1321428,2046.216)"
inkscape:export-filename="/home/paul/browse_path.png"
inkscape:export-xdpi="6.6857142"
inkscape:export-ydpi="6.6857142" />
<path
style="fill:#ffffff;stroke:none"
d="m 11.790581,2089.198 0,-5.1357 -3.5854032,0 4.8926642,-4.3922 4.652807,4.3922 -3.262118,0 0.05176,5.1357 z"
id="path2994"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc"
inkscape:export-filename="/home/paul/browse_path.png"
inkscape:export-xdpi="6.6857142"
inkscape:export-ydpi="6.6857142" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

View File

@ -1,9 +1,9 @@
QFrame {
border-image: url(:/ui/fileTransferInstance/background_green.png);
border-left:25;padding-top:-30;
border-top:28;
border-right:25; padding-right:-28;
border-bottom:28;padding-bottom:-30;
border-left:25; padding-left:-25;
border-top:28; padding-top:-28;
border-right:25; padding-right:-25;
border-bottom:28; padding-bottom:-28;
}
QLabel {

View File

@ -1,9 +1,9 @@
QFrame {
border-image: url(:/ui/fileTransferInstance/background_grey.png);
border-left:25;padding-top:-30;
border-top:28;
border-right:25; padding-right:-28;
border-bottom:28;padding-bottom:-30;
border-left:25; padding-left:-25;
border-top:28; padding-top:-28;
border-right:25; padding-right:-25;
border-bottom:28; padding-bottom:-28;
}
QLabel {

View File

@ -1,9 +1,9 @@
QFrame {
border-image: url(:/ui/fileTransferInstance/background_red.png);
border-left:25;padding-top:-30;
border-top:28;
border-right:25; padding-right:-28;
border-bottom:28;padding-bottom:-30;
border-left:25; padding-left:-25;
border-top:28; padding-top:-28;
border-right:25; padding-right:-25;
border-bottom:28; padding-bottom:-28;
}
QLabel {

View File

@ -1,9 +1,9 @@
QFrame {
border-image: url(:/ui/fileTransferInstance/background_yellow.png);
border-left:25;padding-top:-30;
border-top:28;
border-right:25; padding-right:-28;
border-bottom:28;padding-bottom:-30;
border-left:25; padding-left:-25;
border-top:28; padding-top:-28;
border-right:25; padding-right:-25;
border-bottom:28; padding-bottom:-28;
}
QLabel {