added status icon and status text to history
This commit is contained in:
parent
8c0e961dc0
commit
b41d7418dd
@ -9,7 +9,7 @@ Originally written by [ArsenArsen](https://github.com/ArsenArsen) and here enhan
|
||||
|
||||
## Screenshot
|
||||
Made with KShare itself, of course :)
|
||||
![](http://i.imgur.com/ffWvCun.png)
|
||||
![](https://i.imgur.com/oJrCNkq.png)
|
||||
|
||||
## Usage
|
||||
See the [wiki](https://github.com/ArsenArsen/KShare/wiki).
|
||||
|
@ -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>
|
||||
|
@ -19,5 +19,7 @@
|
||||
<file>icons/circle.png</file>
|
||||
<file>icons/highlighter.png</file>
|
||||
<file>icons/infinity.png</file>
|
||||
<file>icons/checked.png</file>
|
||||
<file>icons/error.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
src/icons/checked.png
Normal file
BIN
src/icons/checked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 842 B |
BIN
src/icons/error.png
Normal file
BIN
src/icons/error.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 680 B |
@ -146,17 +146,32 @@ void ioutils::postData(QUrl target,
|
||||
|
||||
QString ioutils::methodString(QNetworkAccessManager::Operation operation) {
|
||||
switch (operation) {
|
||||
case QNetworkAccessManager::GetOperation:
|
||||
return "GET";
|
||||
case QNetworkAccessManager::PostOperation:
|
||||
return "POST";
|
||||
case QNetworkAccessManager::PutOperation:
|
||||
return "PUT";
|
||||
case QNetworkAccessManager::DeleteOperation:
|
||||
return "DELETE";
|
||||
case QNetworkAccessManager::HeadOperation:
|
||||
return "HEAD";
|
||||
default:
|
||||
return "Unknown";
|
||||
case QNetworkAccessManager::GetOperation:
|
||||
return "GET";
|
||||
case QNetworkAccessManager::PostOperation:
|
||||
return "POST";
|
||||
case QNetworkAccessManager::PutOperation:
|
||||
return "PUT";
|
||||
case QNetworkAccessManager::DeleteOperation:
|
||||
return "DELETE";
|
||||
case QNetworkAccessManager::HeadOperation:
|
||||
return "HEAD";
|
||||
default:
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ namespace ioutils {
|
||||
QString filename,
|
||||
std::function<void(QByteArray, QNetworkReply *)> callback);
|
||||
QString methodString(QNetworkAccessManager::Operation operation);
|
||||
QString httpString(int responseCode);
|
||||
} // namespace ioutils
|
||||
|
||||
#endif // IOUTILS_HPP
|
||||
|
@ -17,9 +17,11 @@
|
||||
#include <QBuffer>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QIcon>
|
||||
#include <QStandardPaths>
|
||||
#include <QDesktopServices>
|
||||
#include <logs/requestlogging.hpp>
|
||||
#include "io/ioutils.hpp"
|
||||
#include <monospacetextdialog.hpp>
|
||||
|
||||
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<LoggedRequest> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,15 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>760</width>
|
||||
<height>363</height>
|
||||
<width>819</width>
|
||||
<height>388</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">KShare</string>
|
||||
</property>
|
||||
@ -39,6 +44,9 @@
|
||||
<property name="text">
|
||||
<string>Copy Clipboard</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
@ -46,6 +54,9 @@
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@ -53,6 +64,9 @@
|
||||
<property name="text">
|
||||
<string>Area</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
@ -60,6 +74,9 @@
|
||||
<property name="text">
|
||||
<string>Open color picker</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
@ -67,6 +84,15 @@
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@ -74,6 +100,9 @@
|
||||
<property name="text">
|
||||
<string>Fullscreen</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
@ -81,6 +110,9 @@
|
||||
<property name="text">
|
||||
<string>Open Screenshot Folder</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -97,6 +129,9 @@
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<property name="indentation">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -160,8 +195,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>760</width>
|
||||
<height>23</height>
|
||||
<width>819</width>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
Loading…
Reference in New Issue
Block a user