Skip to content

Commit

Permalink
improve ui
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Aug 8, 2022
1 parent efdac7f commit 22b042b
Show file tree
Hide file tree
Showing 30 changed files with 984 additions and 42 deletions.
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ set(PROJECT_SOURCES
3rdparty/qrcodegen.cpp
3rdparty/QtExtKeySequenceEdit.cpp

qv2ray/ui/LogHighlighter.cpp
qv2ray/ui/QvAutoCompleteTextEdit.cpp
qv2ray/utils/HTTPRequestHelper.cpp
qv2ray/components/proxy/QvProxyConfigurator.cpp
qv2ray/ui/widgets/common/QJsonModel.cpp

qv2ray/ui/widgets/editors/w_JsonEditor.cpp
qv2ray/ui/widgets/editors/w_JsonEditor.hpp
qv2ray/ui/widgets/editors/w_JsonEditor.ui
qv2ray/v2/ui/LogHighlighter.cpp
qv2ray/v2/ui/QvAutoCompleteTextEdit.cpp
qv2ray/v2/utils/HTTPRequestHelper.cpp
qv2ray/v2/components/proxy/QvProxyConfigurator.cpp
qv2ray/v2/ui/widgets/common/QJsonModel.cpp
qv2ray/v2/ui/widgets/editors/w_JsonEditor.cpp
qv2ray/v2/ui/widgets/editors/w_JsonEditor.hpp
qv2ray/v2/ui/widgets/editors/w_JsonEditor.ui

qv2ray/v3/components/GeositeReader/GeositeReader.cpp
qv2ray/v3/components/GeositeReader/picoproto.cpp

rpc/gRPC.cpp

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "qv2ray/wrapper.hpp"
#include "qv2ray/ui/widgets/common/QJsonModel.hpp"
#include "qv2ray/v2/ui/widgets/common/QJsonModel.hpp"
#include "ui_w_JsonEditor.h"


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions qv2ray/v3/components/GeositeReader/GeositeReader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "GeositeReader.hpp"

#include "qv2ray/wrapper.hpp"
#include "picoproto.hpp"

#include <QFile>
#include <QMap>

namespace Qv2ray::components::GeositeReader {
QMap<QString, QStringList> GeositeEntries;

QStringList ReadGeoSiteFromFile(const QString &filepath, bool allowCache) {
if (GeositeEntries.contains(filepath) && allowCache)
return GeositeEntries.value(filepath);

QStringList list;
qInfo() << "Reading geosites from:" << filepath;
QFile f(filepath);
bool opened = f.open(QFile::OpenModeFlag::ReadOnly);

if (!opened) {
qInfo() << "File cannot be opened:" << filepath;
return list;
}

const auto content = f.readAll();
f.close();
{
picoproto::Message root;
root.ParseFromBytes((unsigned char *) content.data(), content.size());

list.reserve(root.GetMessageArray(1).size());
for (const auto &geosite: root.GetMessageArray(1))
list << QString::fromStdString(geosite->GetString(1));
}

qInfo() << "Loaded" << list.count() << "geosite entries from data file.";
list.sort();
GeositeEntries[filepath] = list;
return list;
}
} // namespace Qv2ray::components::geosite
7 changes: 7 additions & 0 deletions qv2ray/v3/components/GeositeReader/GeositeReader.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <QString>

namespace Qv2ray::components::GeositeReader {
QStringList ReadGeoSiteFromFile(const QString &filepath, bool allowCache = true);
} // namespace Qv2ray::components::GeositeReader
Loading

0 comments on commit 22b042b

Please sign in to comment.