chore: connection list icon

This commit is contained in:
arm64v8a
2023-01-12 13:14:54 +09:00
parent 6a344bc3d5
commit 51e00eeaaf
9 changed files with 34 additions and 19 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z" /></svg>

After

Width:  |  Height:  |  Size: 309 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0 0,0 4,12H1L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3" /></svg>

After

Width:  |  Height:  |  Size: 308 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,3L5,7H8V14H10V7H13M16,17V10H14V17H11L15,21L19,17H16Z" /></svg>

After

Width:  |  Height:  |  Size: 134 B

View File

@@ -8,6 +8,9 @@
<file alias="icon/b-system-software-update.svg">icon/system-software-update.svg</file> <file alias="icon/b-system-software-update.svg">icon/system-software-update.svg</file>
<file>icon/material/lock-open-outline.svg</file> <file>icon/material/lock-open-outline.svg</file>
<file>icon/material/lock-outline.svg</file> <file>icon/material/lock-outline.svg</file>
<file>icon/material/cancel.svg</file>
<file>icon/material/history.svg</file>
<file>icon/material/swap-vertical.svg</file>
</qresource> </qresource>
<qresource prefix="/neko"> <qresource prefix="/neko">
<file alias="nekobox.png">public/nekobox.png</file> <file alias="nekobox.png">public/nekobox.png</file>

View File

@@ -1177,11 +1177,11 @@ Split by line.</source>
</message> </message>
<message> <message>
<source>End</source> <source>End</source>
<translation>پایان</translation> <translation type="vanished">پایان</translation>
</message> </message>
<message> <message>
<source>Active</source> <source>Active</source>
<translation>فعال</translation> <translation type="vanished">فعال</translation>
</message> </message>
<message> <message>
<source>Start: %1 <source>Start: %1

View File

@@ -1009,11 +1009,11 @@
</message> </message>
<message> <message>
<source>End</source> <source>End</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Active</source> <source>Active</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Start: %1 <source>Start: %1

View File

@@ -4,7 +4,7 @@
#include <QPainter> #include <QPainter>
QIcon Icon::GetTrayIcon(Icon::TrayIconStatus status) { QPixmap Icon::GetTrayIcon(Icon::TrayIconStatus status) {
QPixmap pixmap; QPixmap pixmap;
// software embedded icon // software embedded icon
@@ -47,7 +47,7 @@ QIcon Icon::GetTrayIcon(Icon::TrayIconStatus status) {
return pixmap; return pixmap;
} }
QIcon Icon::GetMaterialIcon(const QString &name) { QPixmap Icon::GetMaterialIcon(const QString &name) {
QPixmap pixmap(":/icon/material/" + name + ".svg"); QPixmap pixmap(":/icon/material/" + name + ".svg");
return pixmap; return pixmap;
} }

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include <QIcon> #include <QPixmap>
namespace Icon { namespace Icon {
@@ -11,8 +11,8 @@ namespace Icon {
VPN, VPN,
}; };
QIcon GetTrayIcon(TrayIconStatus status); QPixmap GetTrayIcon(TrayIconStatus status);
QIcon GetMaterialIcon(const QString &name); QPixmap GetMaterialIcon(const QString &name);
} // namespace Icon } // namespace Icon

View File

@@ -1438,27 +1438,36 @@ void MainWindow::refresh_connection_list(const QJsonArray &arr) {
row++; row++;
ui->tableWidget_conn->insertRow(row); ui->tableWidget_conn->insertRow(row);
auto f0 = std::make_unique<QTableWidgetItem>();
f0->setData(114514, item["ID"].toInt());
// C0: Status // C0: Status
auto *f = new QTableWidgetItem(""); auto c0 = new QLabel;
f->setData(114514, item["ID"].toInt());
auto start_t = item["Start"].toInt(); auto start_t = item["Start"].toInt();
auto end_t = item["End"].toInt(); auto end_t = item["End"].toInt();
if (end_t > 0) { // icon
f->setText(tr("End")); auto outboundTag = item["Tag"].toString();
if (outboundTag == "block") {
c0->setPixmap(Icon::GetMaterialIcon("cancel"));
} else { } else {
f->setText(tr("Active")); if (end_t > 0) {
c0->setPixmap(Icon::GetMaterialIcon("history"));
} else {
c0->setPixmap(Icon::GetMaterialIcon("swap-vertical"));
}
} }
f->setToolTip(tr("Start: %1\nEnd: %2").arg(DisplayTime(start_t), end_t > 0 ? DisplayTime(end_t) : "")); c0->setAlignment(Qt::AlignCenter);
ui->tableWidget_conn->setItem(row, 0, f); c0->setToolTip(tr("Start: %1\nEnd: %2").arg(DisplayTime(start_t), end_t > 0 ? DisplayTime(end_t) : ""));
ui->tableWidget_conn->setCellWidget(row, 0, c0);
// C1: Outbound // C1: Outbound
f = f->clone(); auto f = f0->clone();
f->setToolTip(""); f->setToolTip("");
f->setText(item["Tag"].toString()); f->setText(outboundTag);
ui->tableWidget_conn->setItem(row, 1, f); ui->tableWidget_conn->setItem(row, 1, f);
// C2: Destination // C2: Destination
f = f->clone(); f = f0->clone();
QString target1 = item["Dest"].toString(); QString target1 = item["Dest"].toString();
QString target2 = item["RDest"].toString(); QString target2 = item["RDest"].toString();
if (target2.isEmpty() || target1 == target2) { if (target2.isEmpty() || target1 == target2) {