From b41d7418dd307d56fd0ee6958e553bf8e30cf982 Mon Sep 17 00:00:00 2001 From: Gurkengewuerz Date: Wed, 8 May 2019 22:00:10 +0200 Subject: [PATCH] added status icon and status text to history --- README.md | 4 ++-- src/aboutbox.ui | 1 + src/icon.qrc | 2 ++ src/icons/checked.png | Bin 0 -> 842 bytes src/icons/error.png | Bin 0 -> 680 bytes src/io/ioutils.cpp | 39 ++++++++++++++++++++++++++------------ src/io/ioutils.hpp | 1 + src/mainwindow.cpp | 17 +++++++++++++++-- src/mainwindow.ui | 43 ++++++++++++++++++++++++++++++++++++++---- 9 files changed, 87 insertions(+), 20 deletions(-) create mode 100644 src/icons/checked.png create mode 100644 src/icons/error.png diff --git a/README.md b/README.md index 364098e..7875156 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Originally written by [ArsenArsen](https://github.com/ArsenArsen) and here enhan | dev | [![CircleCI](https://circleci.com/gh/Gurkengewuerz/KShare/tree/dev.svg?style=svg)](https://circleci.com/gh/Gurkengewuerz/KShare/tree/dev) | [![Build status](https://ci.appveyor.com/api/projects/status/ujxmg1dk7f5p8ijh/branch/dev?svg=true)](https://ci.appveyor.com/project/Gurkengewuerz/kshare/branch/dev) | ## Screenshot -Made with KShare itself, of course :) -![](http://i.imgur.com/ffWvCun.png) +Made with KShare itself, of course :) +![](https://i.imgur.com/oJrCNkq.png) ## Usage See the [wiki](https://github.com/ArsenArsen/KShare/wiki). diff --git a/src/aboutbox.ui b/src/aboutbox.ui index 31e5918..c350b7e 100644 --- a/src/aboutbox.ui +++ b/src/aboutbox.ui @@ -33,6 +33,7 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">This software uses and possibly bundles Qt, OpenSSL, FFMpeg, and QHotkey, whose licenses are respectively:</span></p> <p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Icons made by <a href="https://www.flaticon.com/authors/maxim-basinski"><span style=" text-decoration: underline; color:#0000ff;">Maxim Basinski</span></a> from <a href="https://www.flaticon.com/"><span style=" text-decoration: underline; color:#0000ff;">www.flaticon.com</span></a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/"><span style=" text-decoration: underline; color:#0000ff;">CC 3.0 BY</span></a></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Mono'; font-size:10pt;">------------------------------ </span><a href="http://code.qt.io/cgit/qt/qt5.git/tree/LICENSE.LGPLv3"><span style=" font-family:'Noto Mono'; font-size:10pt; text-decoration: underline; color:#007af4;">Qt</span></a><span style=" font-family:'Noto Mono'; font-size:10pt;">:</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Mono'; font-size:10pt;">GNU LESSER GENERAL PUBLIC LICENSE</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;"><br /></span></p> diff --git a/src/icon.qrc b/src/icon.qrc index 62e7d4e..71966a8 100644 --- a/src/icon.qrc +++ b/src/icon.qrc @@ -19,5 +19,7 @@ icons/circle.png icons/highlighter.png icons/infinity.png + icons/checked.png + icons/error.png diff --git a/src/icons/checked.png b/src/icons/checked.png new file mode 100644 index 0000000000000000000000000000000000000000..44e0f80b14c8a49f9c12a97d0553da4702f066eb GIT binary patch literal 842 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!n2Vh}LpV4%Za?&Y0OWEOctjR6 zFfa*&FypMtk6eI)k|nMYCBgY=CFO}lsSM@i<$9TU*~Q6;1*v-ZMd`EO*+>BuEeh}n zasB`Qf9R^vv@^b0`$LnDg=X)GOWPj_WM=@`N24+iN97!e$T|?7eIPRHNM!cGsO-bh znFk}X4@YDlip)F&B%^?gtb-AmK=M#j7Kj9*h^&KAS%<;wgHRHzAQGe)A`VmoRSeOB zLV}dRQ08;}e4uMhOM?7@8JM|vgoH&Tq~(oGOf7A^eEgD9GBOKFy80F`*|2Tjfz#*C zU$}Vn`iZfkh@@BjL*2Q@hjn?LSR?XJD1v~wqOfm7X-C6R$)p^+(>LO(YI2|VX5%=%1}_bXI&*v(?N- zRO4sw_kY3J2ZKAiqW6DgJm`2b_^9-rIOeA2S6Iw=Hs)P z$MsI?bwI&|Pg6cNs#v_J^lA-wCc{(Vb>#RF3mfSVBBk?+?`Fz})I2U1?s~D{k>>QJ zCij45>iDi&(>yDmxiZS$YQ@josOh59_BOZO7Zr=lylwU3M{MR~vFlb>KL38CrT@Nk z#Z&&LvG)?L%sFVdQ&MBb@0O)v<0RR91 literal 0 HcmV?d00001 diff --git a/src/icons/error.png b/src/icons/error.png new file mode 100644 index 0000000000000000000000000000000000000000..ebc396780c867fbba90266515fb7adc5411cae72 GIT binary patch literal 680 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!n2Vh}LpV4%Za?&Y0OWEOctjR6 zFfa*&FypMtk6eI)k|nMYCBgY=CFO}lsSM@i<$9TU*~Q6;1*v-ZMd`EO*+>Bur3Lte zxc&!%P=;r|#;-!P--N2Y57K-WsP-vP<9(3&$3XS>!RjA^G(P|tAX4K)pytP5jSoRU zS&fgunje5D2*d@6fMhj3!nkm82;yiletT1s0}po-7gG}l6I0T^|LW(P ztDXcUlxN8q`=;sN&EwWN@b$5Z_N#4cyLCEi#lt=<+VhwrR<3f{tGhdEf(~r9dC&92 zuj0AVyM>#V+K0usmc~qdpMU2_?*29QCMFKW5tru6nH+koGC$5MdC8$jtMI4?R^=X< zttH#)qmqjF+S}J2OfC`s-F7Xb?We)n`Ts5zPu|7*sa#4%;f1;8zx1uaXPXQ;#Wgnl zx|6E$;`l=**GUh5|GlsJ*C1v=-1^_4^5-`FlhzB!pTo%TwCSI)UV!`*h6lFOzpO84 z{1s-&?_jcJkB^bf3-zi8Mm_xuPh#R21w6ECbR;sizIP&j| zE9WC)1HP#G#)e!?js3rI#eTD|&sY7wca^to-_eWak+01B?`OP callback); QString methodString(QNetworkAccessManager::Operation operation); + QString httpString(int responseCode); } // namespace ioutils #endif // IOUTILS_HPP diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d6aa709..a4fa896 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -17,9 +17,11 @@ #include #include #include +#include #include #include #include +#include "io/ioutils.hpp" #include MainWindow *MainWindow::instance; @@ -108,8 +110,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi connect(ui->areaButton, &QPushButton::clicked, this, [] { screenshotter::areaDelayed(); }); connect(ui->aboutButton, &QPushButton::clicked, this, &MainWindow::on_actionAbout_triggered); connect(ui->screenshotFolderButton, &QPushButton::clicked, this, &MainWindow::openScreenshotFolder); + connect(ui->clipboardButton, &QPushButton::clicked, this, &MainWindow::openScreenshotFolder); connect(ui->colorPickerButton, &QPushButton::clicked, this, [] { ColorPickerScene::showPicker(); }); + ui->aboutButton->setFocus(); + tray->setContextMenu(menu); addHotkey("fullscreen", [] { screenshotter::fullscreen(); }); @@ -127,8 +132,16 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi QList requests = requestlogging::getRequests(); for (LoggedRequest req : requests) { - ui->treeWidget->addTopLevelItem( - new QTreeWidgetItem({ QString::number(req.getResponseCode()), req.getFilename(), req.getUrl(), req.getTime() + " UTC" })); + QString httpStatus = ioutils::httpString(req.getResponseCode()); + QTreeWidgetItem* tw = new QTreeWidgetItem({ QString::number(req.getResponseCode()) + " " + httpStatus, req.getFilename(), req.getUrl(), req.getTime() + " UTC" }); + + if(req.getResponseCode() >= 200 && req.getResponseCode() < 300) { + tw->setIcon(0, *(new QIcon(":/icons/checked.png"))); + } else { + tw->setIcon(0, *(new QIcon(":/icons/error.png"))); + } + + ui->treeWidget->addTopLevelItem(tw); } } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 16aa810..73985cb 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -6,10 +6,15 @@ 0 0 - 760 - 363 + 819 + 388 + + + 12 + + KShare @@ -39,6 +44,9 @@ Copy Clipboard + + true + @@ -46,6 +54,9 @@ Settings + + true + @@ -53,6 +64,9 @@ Area + + true + @@ -60,6 +74,9 @@ Open color picker + + true + @@ -67,6 +84,15 @@ About + + false + + + false + + + true + @@ -74,6 +100,9 @@ Fullscreen + + true + @@ -81,6 +110,9 @@ Open Screenshot Folder + + true + @@ -97,6 +129,9 @@ + + 0 + true @@ -160,8 +195,8 @@ 0 0 - 760 - 23 + 819 + 29