added status icon and status text to history

This commit is contained in:
Niklas 2019-05-08 22:00:10 +02:00
parent 8c0e961dc0
commit b41d7418dd
9 changed files with 87 additions and 20 deletions

View File

@ -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) | | 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 ## Screenshot
Made with KShare itself, of course :) Made with KShare itself, of course :)
![](http://i.imgur.com/ffWvCun.png) ![](https://i.imgur.com/oJrCNkq.png)
## Usage ## Usage
See the [wiki](https://github.com/ArsenArsen/KShare/wiki). See the [wiki](https://github.com/ArsenArsen/KShare/wiki).

View File

@ -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;"> </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=" 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="-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;">------------------------------ </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-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> <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>

View File

@ -19,5 +19,7 @@
<file>icons/circle.png</file> <file>icons/circle.png</file>
<file>icons/highlighter.png</file> <file>icons/highlighter.png</file>
<file>icons/infinity.png</file> <file>icons/infinity.png</file>
<file>icons/checked.png</file>
<file>icons/error.png</file>
</qresource> </qresource>
</RCC> </RCC>

BIN
src/icons/checked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

BIN
src/icons/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

View File

@ -146,17 +146,32 @@ void ioutils::postData(QUrl target,
QString ioutils::methodString(QNetworkAccessManager::Operation operation) { QString ioutils::methodString(QNetworkAccessManager::Operation operation) {
switch (operation) { switch (operation) {
case QNetworkAccessManager::GetOperation: case QNetworkAccessManager::GetOperation:
return "GET"; return "GET";
case QNetworkAccessManager::PostOperation: case QNetworkAccessManager::PostOperation:
return "POST"; return "POST";
case QNetworkAccessManager::PutOperation: case QNetworkAccessManager::PutOperation:
return "PUT"; return "PUT";
case QNetworkAccessManager::DeleteOperation: case QNetworkAccessManager::DeleteOperation:
return "DELETE"; return "DELETE";
case QNetworkAccessManager::HeadOperation: case QNetworkAccessManager::HeadOperation:
return "HEAD"; return "HEAD";
default: default:
return "Unknown"; return "Unknown";
}
}
QString ioutils::httpString(int responseCode) {
switch (responseCode) {
case 200:
return "OK";
case 201:
return "CREATED";
case 500:
return "Internal Server Error";
case 503:
return "Service Unavailable";
default:
return "Unknown";
} }
} }

View File

@ -31,6 +31,7 @@ namespace ioutils {
QString filename, QString filename,
std::function<void(QByteArray, QNetworkReply *)> callback); std::function<void(QByteArray, QNetworkReply *)> callback);
QString methodString(QNetworkAccessManager::Operation operation); QString methodString(QNetworkAccessManager::Operation operation);
QString httpString(int responseCode);
} // namespace ioutils } // namespace ioutils
#endif // IOUTILS_HPP #endif // IOUTILS_HPP

View File

@ -17,9 +17,11 @@
#include <QBuffer> #include <QBuffer>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QIcon>
#include <QStandardPaths> #include <QStandardPaths>
#include <QDesktopServices> #include <QDesktopServices>
#include <logs/requestlogging.hpp> #include <logs/requestlogging.hpp>
#include "io/ioutils.hpp"
#include <monospacetextdialog.hpp> #include <monospacetextdialog.hpp>
MainWindow *MainWindow::instance; 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->areaButton, &QPushButton::clicked, this, [] { screenshotter::areaDelayed(); });
connect(ui->aboutButton, &QPushButton::clicked, this, &MainWindow::on_actionAbout_triggered); connect(ui->aboutButton, &QPushButton::clicked, this, &MainWindow::on_actionAbout_triggered);
connect(ui->screenshotFolderButton, &QPushButton::clicked, this, &MainWindow::openScreenshotFolder); connect(ui->screenshotFolderButton, &QPushButton::clicked, this, &MainWindow::openScreenshotFolder);
connect(ui->clipboardButton, &QPushButton::clicked, this, &MainWindow::openScreenshotFolder);
connect(ui->colorPickerButton, &QPushButton::clicked, this, [] { ColorPickerScene::showPicker(); }); connect(ui->colorPickerButton, &QPushButton::clicked, this, [] { ColorPickerScene::showPicker(); });
ui->aboutButton->setFocus();
tray->setContextMenu(menu); tray->setContextMenu(menu);
addHotkey("fullscreen", [] { screenshotter::fullscreen(); }); addHotkey("fullscreen", [] { screenshotter::fullscreen(); });
@ -127,8 +132,16 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
QList<LoggedRequest> requests = requestlogging::getRequests(); QList<LoggedRequest> requests = requestlogging::getRequests();
for (LoggedRequest req : requests) { for (LoggedRequest req : requests) {
ui->treeWidget->addTopLevelItem( QString httpStatus = ioutils::httpString(req.getResponseCode());
new QTreeWidgetItem({ QString::number(req.getResponseCode()), req.getFilename(), req.getUrl(), req.getTime() + " UTC" })); 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);
} }
} }

View File

@ -6,10 +6,15 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>760</width> <width>819</width>
<height>363</height> <height>388</height>
</rect> </rect>
</property> </property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string notr="true">KShare</string> <string notr="true">KShare</string>
</property> </property>
@ -39,6 +44,9 @@
<property name="text"> <property name="text">
<string>Copy Clipboard</string> <string>Copy Clipboard</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
@ -46,6 +54,9 @@
<property name="text"> <property name="text">
<string>Settings</string> <string>Settings</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
@ -53,6 +64,9 @@
<property name="text"> <property name="text">
<string>Area</string> <string>Area</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
@ -60,6 +74,9 @@
<property name="text"> <property name="text">
<string>Open color picker</string> <string>Open color picker</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="7" column="0">
@ -67,6 +84,15 @@
<property name="text"> <property name="text">
<string>About</string> <string>About</string>
</property> </property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
@ -74,6 +100,9 @@
<property name="text"> <property name="text">
<string>Fullscreen</string> <string>Fullscreen</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="0">
@ -81,6 +110,9 @@
<property name="text"> <property name="text">
<string>Open Screenshot Folder</string> <string>Open Screenshot Folder</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -97,6 +129,9 @@
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTreeWidget" name="treeWidget"> <widget class="QTreeWidget" name="treeWidget">
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated"> <property name="rootIsDecorated">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -160,8 +195,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>760</width> <width>819</width>
<height>23</height> <height>29</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">