From 23ed263fd4b5d82c62ce8c6df43a7f2fc8308a12 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Sat, 28 Jun 2014 15:52:17 +0200 Subject: [PATCH] New file transfer widget, round buttons --- ui/acceptFileButton/default.png | Bin 0 -> 447 bytes ui/acceptFileButton/hover.png | Bin 0 -> 448 bytes ui/acceptFileButton/pressed.png | Bin 0 -> 443 bytes ui/acceptFileButton/style.css | 22 +++++++++++++ ui/pauseFileButton/default.png | Bin 0 -> 306 bytes ui/pauseFileButton/hover.png | Bin 0 -> 319 bytes ui/pauseFileButton/pressed.png | Bin 0 -> 298 bytes ui/pauseFileButton/style.css | 22 +++++++++++++ ui/stopFileButton/default.png | Bin 0 -> 509 bytes ui/stopFileButton/hover.png | Bin 0 -> 510 bytes ui/stopFileButton/pressed.png | Bin 0 -> 495 bytes ui/stopFileButton/style.css | 22 +++++++++++++ widget/filetransfertwidget.cpp | 53 +++++++++++++++++++++++--------- widget/filetransfertwidget.h | 2 ++ 14 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 ui/acceptFileButton/default.png create mode 100644 ui/acceptFileButton/hover.png create mode 100644 ui/acceptFileButton/pressed.png create mode 100644 ui/acceptFileButton/style.css create mode 100644 ui/pauseFileButton/default.png create mode 100644 ui/pauseFileButton/hover.png create mode 100644 ui/pauseFileButton/pressed.png create mode 100644 ui/pauseFileButton/style.css create mode 100644 ui/stopFileButton/default.png create mode 100644 ui/stopFileButton/hover.png create mode 100644 ui/stopFileButton/pressed.png create mode 100644 ui/stopFileButton/style.css diff --git a/ui/acceptFileButton/default.png b/ui/acceptFileButton/default.png new file mode 100644 index 0000000000000000000000000000000000000000..59c6bbefc71cfd19598c97e52334ac8c9fec8643 GIT binary patch literal 447 zcmV;w0YLtVP)P000~a1^@s6lq3|;00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY4#WTe4#WYKD-Ig~000McNliru-Ub{E86~N+By<1(0Zd6m zK~zY`?bW?YLQxpU@$WG~(;<|=o2D&6b3=oJLPaJRLH|KZQ_w#nZVmnkEoB%c2@TCb zgJGEXf=NaAdd-)nA{wq<^`5C`KYTdncb?}F$C<++2A2s5B^7DQK<5858KXKf5UZ5u zGEZ~ZVR5qM*+uQEq)SPfy~b=2hs8v?AvF3aRY(S1fJ_plLf!&4&he<))k>RlKC} zS)Ujf*(cu+fXD75T~6u-#%jjyK;^1<@jvRNjryz%Bw;kt2BJnIC$V6>WHRsuN3mf1 pbn4Cc_ZIU!T8UD`2vAdkDbPn({=y=002ovPDHLkV1oF!yfFX( literal 0 HcmV?d00001 diff --git a/ui/acceptFileButton/hover.png b/ui/acceptFileButton/hover.png new file mode 100644 index 0000000000000000000000000000000000000000..af4a66e34dca1cc5eb4ed255bcc790cf73136d78 GIT binary patch literal 448 zcmV;x0YCnUP)P000~a1^@s6lq3|;00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY4#WTe4#WYKD-Ig~000McNliru-Ub{E88F0dz@GpB0ZmCn zK~zY`?bN|a0#Ovk@&9#1Q3xe$bh1Uzwnb1-Mqv^LJxJSH_XMuRZSP@=BFrSAMa#fN zAZkr2C8Ul`jL-w~&`Cw=TG1CV}eIIypzzZ!NT%#ax}eZ={n z!#Koh1E$Dp zr;gTb6ZD3NFCEg*-&meou?(0Z`Ij3If?Xv>z#|jz$N-iB)0yZ!oxGYQ`+P;~vpF^} zG$#WHK=FpjsTs?_NMY1_I@eE^vjqvznFdmr29lmMq5-K%BgctIvf`NF4UQ6#0000P000~a1^@s6lq3|;00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY4#WTe4#WYKD-Ig~000McNliru-Ub{E8UV?fqwoL#0Z2(i zK~zY`?bNYL0$~`(@$Y-+U>FTWkeG!ULC`yrKfm_X_L^>T_>Fo_^i+HdEfWGSTWPtp0#ASK{A<^!% zf9#KW#*u?jj8=n_ha`HlY9FxzqTy|p0;{yzElPEbi>LFyd#>+*TXJ*rdQDM(>@5?I zYseC~DqoVgJtALG?IV6~fY{6~3lob7geh?Mp6f06^ zp6exQO`XZ%DRyS}cxjZG8=bcem?CF|Gy=g!D2C7L$LI9}*al29F+L44g%qj$G1ZSs z&w%BgbRmH0kr1c%N!x%W(uI_KV(>u%82v!hejpjAkp>WV8aYtptR^{lgMCHL9{y@i l>`W1$0vRB#$XTu1_yVkplaXF1$|nE-002ovPDHLkV1jXRxkCT| literal 0 HcmV?d00001 diff --git a/ui/acceptFileButton/style.css b/ui/acceptFileButton/style.css new file mode 100644 index 000000000..2fa8534bc --- /dev/null +++ b/ui/acceptFileButton/style.css @@ -0,0 +1,22 @@ +QPushButton +{ + background-color: transparent; + background-image: url("ui/acceptFileButton/default.png"); + background-repeat: none; + border: none; + width: 24px; + height: 24px; +} +QPushButton:hover +{ + background-image: url("ui/acceptFileButton/hover.png"); +} + +QPushButton:pressed +{ + background-image: url("ui/acceptFileButton/pressed.png"); +} + +QPushButton:focus { + outline: none; +} diff --git a/ui/pauseFileButton/default.png b/ui/pauseFileButton/default.png new file mode 100644 index 0000000000000000000000000000000000000000..4faa47e5270cdb5f96092a67d6d651eec8f3ebca GIT binary patch literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoO!3HF!sEAwuQfx`y?k)`fL2$v|<&%LToCO|{ z#S9F5M?jcysy3fAP>{XE)7O>#9-9oWD2r!)wHi=pzo(01h{y4_Koy4^L|o6Ch+e+c z*JQeZU0?$rPuG%ZrU@%k<$WC-ZZNIew?fj}-Gs4K!8b}_CZ}ihTT%7*#rK6@pZ?UC z%vv!a+~X;;5U=r1himLERhi*8(w0r;?F^Z7iuw8Nk7sB1Jv(!ZyXWegb+_*;c7~_~ z3APpwnboFyt=akR{0H8^5S^xk5 literal 0 HcmV?d00001 diff --git a/ui/pauseFileButton/hover.png b/ui/pauseFileButton/hover.png new file mode 100644 index 0000000000000000000000000000000000000000..e7941eb7556b48eeed36f899be1c5ef07975521d GIT binary patch literal 319 zcmeAS@N?(olHy`uVBq!ia0vp^l0YoO!3HF!sE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.png b/ui/stopFileButton/hover.png new file mode 100644 index 0000000000000000000000000000000000000000..023822a5b61f3d58f27c5e8a52b86ffcd6a4d950 GIT binary patch literal 510 zcmVP000~a1^@s6lq3|;00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY4#WTe4#WYKD-Ig~000McNliru-Ub{DGZP4)7xDlA0gFjQ zK~zY`?bW|a0$~`y@$ZG%oe5qU5!xk)n1cvS4bc*U7K$JQ{Q<4f82uYHHnjCGNJG>j z(G)aV(UMTnVjOhkyMs;^7y5zIHJiO26{qgX=((d`T#m`{@68^&g8bA%$2by+b z#AVW7000@t0Xx7ou;~ZsB^2PmhWdrru?NKajVQoYzY&1dK_KZtAo3s(@9vtEqg0aX zr_~4Dm`)D>D;{p|^EzTaDg!Vz0cQm6#ZdQchGcEt5!4MQ`hz+}F5xtoMd| zLK5XfmGRLq0Po_B)8?@!@TX_R5U-e)>5PRXFofZ2uCJY>)Om_pnMhFOUA!SIff5Lj zpDiLR(>c)CpDlJY1Fn!KlABy`fX+)6mgzJ@M$PtyTs+m00}8jT z#+OUBi)Pd;^@lUp8j{QRJGf_MhzybcgNWY}AKGAq*OV literal 0 HcmV?d00001 diff --git a/ui/stopFileButton/pressed.png b/ui/stopFileButton/pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..bb18f999a65714a1fae145a674f91c98cd25d1a3 GIT binary patch literal 495 zcmVP000~a1^@s6lq3|;00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY4#WTe4#WYKD-Ig~000McNliru-Ub{DH4w-1;m!a60eneB zK~zY`?bW|a0%07-@wZ{-S#bV<5YwbVxj_V{hE_ofC313eX>IQRsI8`;sj5P$PrZk0I#UA0PF?c59p8t0Jjc`tN@ImOeDwI;W>U+0HcZ zPdb#v?+T!fRGQtowd*o>o(g5~?D)urbLfVS>~N!wRLY-49^US(AwQ6fY&gg6_8tI3 zF`&{e%>@?vtZ1T-Zs_A@VF)y#Ehk;(kkg?ovct_#3=oDuvb#tI(+ETVmAZwI$rPz0 zl}fvWCNz@4^h6k#3C%^~-ozM~9I`OsetMargin(0); @@ -38,11 +39,31 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File) progress->setValue(0); progress->setMinimumHeight(11); progress->setFont(prettysmall); + QPalette whitebg; + whitebg.setColor(QPalette::Window, QColor(255,255,255)); + buttonWidget->setPalette(whitebg); + buttonWidget->setAutoFillBackground(true); + buttonWidget->setLayout(buttonLayout); - topright->setIcon(QIcon("img/button icons/no_2x.png")); + QFile f1("ui/stopFileButton/style.css"); + f1.open(QFile::ReadOnly | QFile::Text); + QTextStream stopFileButtonStylesheetStream(&f1); + stopFileButtonStylesheet = stopFileButtonStylesheetStream.readAll(); + + QFile f2("ui/pauseFileButton/style.css"); + f2.open(QFile::ReadOnly | QFile::Text); + QTextStream pauseFileButtonStylesheetStream(&f2); + pauseFileButtonStylesheet = pauseFileButtonStylesheetStream.readAll(); + + QFile f3("ui/acceptFileButton/style.css"); + f3.open(QFile::ReadOnly | QFile::Text); + QTextStream acceptFileButtonStylesheetStream(&f3); + acceptFileButtonStylesheet = acceptFileButtonStylesheetStream.readAll(); + + topright->setStyleSheet(stopFileButtonStylesheet); if (File.direction == ToxFile::SENDING) { - bottomright->setIcon(QIcon("img/button icons/pause_2x.png")); + bottomright->setStyleSheet(pauseFileButtonStylesheet); connect(topright, SIGNAL(clicked()), this, SLOT(cancelTransfer())); connect(bottomright, SIGNAL(clicked()), this, SLOT(pauseResumeSend())); @@ -55,7 +76,7 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File) } else { - bottomright->setIcon(QIcon("img/button icons/yes_2x.png")); + bottomright->setStyleSheet(acceptFileButtonStylesheet); connect(topright, SIGNAL(clicked()), this, SLOT(rejectRecvRequest())); connect(bottomright, SIGNAL(clicked()), this, SLOT(acceptRecvRequest())); } @@ -63,24 +84,29 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File) QPalette toxgreen; toxgreen.setColor(QPalette::Button, QColor(107,194,96)); // Tox Green topright->setIconSize(QSize(10,10)); - topright->setFixedSize(25,25); + topright->setMinimumSize(25,28); topright->setFlat(true); topright->setAutoFillBackground(true); topright->setPalette(toxgreen); bottomright->setIconSize(QSize(10,10)); - bottomright->setFixedSize(25,25); + bottomright->setMinimumSize(25,28); bottomright->setFlat(true); bottomright->setAutoFillBackground(true); bottomright->setPalette(toxgreen); + mainLayout->addStretch(); mainLayout->addWidget(pic); - mainLayout->addLayout(infoLayout); - mainLayout->addLayout(buttonLayout); + mainLayout->addLayout(infoLayout,3); + mainLayout->addStretch(); + mainLayout->addWidget(buttonWidget); + mainLayout->setMargin(0); + mainLayout->setSpacing(0); infoLayout->addWidget(filename); infoLayout->addLayout(textLayout); infoLayout->addWidget(progress); - infoLayout->setMargin(5); + infoLayout->setMargin(4); + infoLayout->setSpacing(4); textLayout->addWidget(size); textLayout->addWidget(speed); @@ -91,7 +117,7 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File) buttonLayout->addWidget(topright); buttonLayout->addSpacing(2); buttonLayout->addWidget(bottomright); - buttonLayout->setMargin(0); + buttonLayout->setContentsMargins(2,0,0,0); buttonLayout->setSpacing(0); } @@ -157,10 +183,9 @@ void FileTransfertWidget::onFileTransferFinished(ToxFile File) progress->hide(); speed->hide(); eta->hide(); - topright->setIcon(QIcon("img/button icons/yes_2x.png")); - buttonLayout->addStretch(); - buttonLayout->setSpacing(0); + topright->hide(); bottomright->hide(); + // TODO: Maybe just replace the whole buttonWidget with a single round CSS that shows the accept icon QPalette toxgreen; toxgreen.setColor(QPalette::Window, QColor(107,194,96)); // Tox Green setPalette(toxgreen); @@ -201,7 +226,7 @@ void FileTransfertWidget::acceptRecvRequest() savePath = path; - bottomright->setIcon(QIcon("img/button icons/pause_2x.png")); + bottomright->setStyleSheet(pauseFileButtonStylesheet); bottomright->disconnect(); connect(bottomright, SIGNAL(clicked()), this, SLOT(pauseResumeRecv())); Widget::getInstance()->getCore()->acceptFileRecvRequest(friendId, fileNum); diff --git a/widget/filetransfertwidget.h b/widget/filetransfertwidget.h index 92cf5240d..a36470d58 100644 --- a/widget/filetransfertwidget.h +++ b/widget/filetransfertwidget.h @@ -40,12 +40,14 @@ private: QProgressBar *progress; QHBoxLayout *mainLayout, *textLayout; QVBoxLayout *infoLayout, *buttonLayout; + QWidget* buttonWidget; QDateTime lastUpdate; long long lastBytesSent; int fileNum; int friendId; QString savePath; ToxFile::FileDirection direction; + QString stopFileButtonStylesheet, pauseFileButtonStylesheet, acceptFileButtonStylesheet; }; #endif // FILETRANSFERTWIDGET_H