id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,211
|
DarkmodeDetector.cpp
|
Qv2ray_Qv2ray/src/ui/common/darkmode/DarkmodeDetector.cpp
|
#include "DarkmodeDetector.hpp"
#include "base/Qv2rayBase.hpp"
#include <QApplication>
#include <QStyle>
#ifdef Q_OS_LINUX
#elif defined(Q_OS_WIN32)
#include <QSettings>
#elif defined(Q_OS_MAC)
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#endif
namespace Qv2ray::components::darkmode
{
// Referenced from github.com/keepassxreboot/keepassxc. Licensed under GPL2/3.
// Copyright (C) 2020 KeePassXC Team <team@keepassxc.org>
bool isDarkMode()
{
#if defined(Q_OS_WIN32)
QSettings settings(R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)", QSettings::NativeFormat);
return settings.value("AppsUseLightTheme", 1).toInt() == 0;
#elif defined(Q_OS_MAC)
bool isDark = false;
CFStringRef uiStyleKey = CFSTR("AppleInterfaceStyle");
CFStringRef uiStyle = nullptr;
CFStringRef darkUiStyle = CFSTR("Dark");
if (uiStyle = (CFStringRef) CFPreferencesCopyAppValue(uiStyleKey, kCFPreferencesCurrentApplication); uiStyle)
{
isDark = (kCFCompareEqualTo == CFStringCompare(uiStyle, darkUiStyle, 0));
CFRelease(uiStyle);
}
return isDark;
#endif
if (!qApp || !qApp->style())
{
return false;
}
return qApp->style()->standardPalette().color(QPalette::Window).toHsl().lightness() < 110;
}
} // namespace Qv2ray::components::darkmode
| 1,457
|
C++
|
.cpp
| 39
| 31.846154
| 137
| 0.698582
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,212
|
QvAutoLaunch.cpp
|
Qv2ray_Qv2ray/src/ui/common/autolaunch/QvAutoLaunch.cpp
|
#include "QvAutoLaunch.hpp"
#include "base/Qv2rayBase.hpp"
#include <QCoreApplication>
#include <QDir>
#include <QSettings>
#include <QStandardPaths>
#include <QTextStream>
// macOS headers (possibly OBJ-c)
#if defined(Q_OS_MAC)
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#endif
namespace Qv2ray::components::autolaunch
{
//
// launchatlogin.cpp
// ShadowClash
//
// Created by TheWanderingCoel on 2018/6/12.
// Copyright © 2019 Coel Wu. All rights reserved.
//
QString getUserAutostartDir_private()
{
QString config = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
config += QLatin1String("/autostart/");
return config;
}
bool GetLaunchAtLoginStatus()
{
#ifdef Q_OS_WIN
QString appName = QCoreApplication::applicationName();
QSettings reg("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
return reg.contains(appName);
}
#elif defined Q_OS_MAC
// From
// https://github.com/nextcloud/desktop/blob/master/src/common/utility_mac.cpp
// this is quite some duplicate code with setLaunchOnStartup, at some
// point we should fix this FIXME.
bool returnValue = false;
QString filePath = QDir(QCoreApplication::applicationDirPath() + QLatin1String("/../..")).absolutePath();
CFStringRef folderCFStr = CFStringCreateWithCString(0, filePath.toUtf8().data(), kCFStringEncodingUTF8);
CFURLRef urlRef = CFURLCreateWithFileSystemPath(0, folderCFStr, kCFURLPOSIXPathStyle, true);
LSSharedFileListRef loginItems = LSSharedFileListCreate(0, kLSSharedFileListSessionLoginItems, 0);
if (loginItems)
{
// We need to iterate over the items and check which one is "ours".
UInt32 seedValue;
CFArrayRef itemsArray = LSSharedFileListCopySnapshot(loginItems, &seedValue);
CFStringRef appUrlRefString = CFURLGetString(urlRef); // no need for release
for (int i = 0; i < CFArrayGetCount(itemsArray); i++)
{
LSSharedFileListItemRef item = (LSSharedFileListItemRef) CFArrayGetValueAtIndex(itemsArray, i);
CFURLRef itemUrlRef = NULL;
if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr && itemUrlRef)
{
CFStringRef itemUrlString = CFURLGetString(itemUrlRef);
if (CFStringCompare(itemUrlString, appUrlRefString, 0) == kCFCompareEqualTo)
{
returnValue = true;
}
CFRelease(itemUrlRef);
}
}
CFRelease(itemsArray);
}
CFRelease(loginItems);
CFRelease(folderCFStr);
CFRelease(urlRef);
return returnValue;
}
#elif defined Q_OS_LINUX
QString appName = QCoreApplication::applicationName();
QString desktopFileLocation = getUserAutostartDir_private() + appName + QLatin1String(".desktop");
return QFile::exists(desktopFileLocation);
}
#endif
void SetLaunchAtLoginStatus(bool enable)
{
#ifdef Q_OS_WIN
QString appName = QCoreApplication::applicationName();
QSettings reg("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
if (enable)
{
QString strAppPath = QDir::toNativeSeparators(QCoreApplication::applicationFilePath());
reg.setValue(appName, strAppPath);
}
else
{
reg.remove(appName);
}
}
#elif defined Q_OS_MAC
// From
// https://github.com/nextcloud/desktop/blob/master/src/common/utility_mac.cpp
QString filePath = QDir(QCoreApplication::applicationDirPath() + QLatin1String("/../..")).absolutePath();
CFStringRef folderCFStr = CFStringCreateWithCString(0, filePath.toUtf8().data(), kCFStringEncodingUTF8);
CFURLRef urlRef = CFURLCreateWithFileSystemPath(0, folderCFStr, kCFURLPOSIXPathStyle, true);
LSSharedFileListRef loginItems = LSSharedFileListCreate(0, kLSSharedFileListSessionLoginItems, 0);
if (loginItems && enable)
{
// Insert an item to the list.
LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemLast, 0, 0, urlRef, 0, 0);
if (item)
CFRelease(item);
CFRelease(loginItems);
}
else if (loginItems && !enable)
{
// We need to iterate over the items and check which one is "ours".
UInt32 seedValue;
CFArrayRef itemsArray = LSSharedFileListCopySnapshot(loginItems, &seedValue);
CFStringRef appUrlRefString = CFURLGetString(urlRef);
for (int i = 0; i < CFArrayGetCount(itemsArray); i++)
{
LSSharedFileListItemRef item = (LSSharedFileListItemRef) CFArrayGetValueAtIndex(itemsArray, i);
CFURLRef itemUrlRef = NULL;
if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr && itemUrlRef)
{
CFStringRef itemUrlString = CFURLGetString(itemUrlRef);
if (CFStringCompare(itemUrlString, appUrlRefString, 0) == kCFCompareEqualTo)
{
LSSharedFileListItemRemove(loginItems, item); // remove it!
}
CFRelease(itemUrlRef);
}
}
CFRelease(itemsArray);
CFRelease(loginItems);
}
CFRelease(folderCFStr);
CFRelease(urlRef);
}
#elif defined Q_OS_LINUX
//
// For AppImage packaging.
auto binPath = qEnvironmentVariableIsSet("APPIMAGE") ? qEnvironmentVariable("APPIMAGE") : QCoreApplication::applicationFilePath();
//
// From https://github.com/nextcloud/desktop/blob/master/src/common/utility_unix.cpp
QString appName = QCoreApplication::applicationName();
QString userAutoStartPath = getUserAutostartDir_private();
QString desktopFileLocation = userAutoStartPath + appName + QLatin1String(".desktop");
QStringList appCmdList = QCoreApplication::arguments();
appCmdList.replace(0, binPath);
if (enable)
{
if (!QDir().exists(userAutoStartPath) && !QDir().mkpath(userAutoStartPath))
{
// qCWarning(lcUtility) << "Could not create autostart folder"
// << userAutoStartPath;
return;
}
QFile iniFile(desktopFileLocation);
if (!iniFile.open(QIODevice::WriteOnly))
{
// qCWarning(lcUtility) << "Could not write auto start entry" <<
// desktopFileLocation;
return;
}
QTextStream ts(&iniFile);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ts.setCodec("UTF-8");
#endif
ts << QLatin1String("[Desktop Entry]") << NEWLINE //
<< QLatin1String("Name=") << appName << NEWLINE //
<< QLatin1String("GenericName=") << QLatin1String("V2Ray Frontend") << NEWLINE //
<< QLatin1String("Exec=") << appCmdList.join(" ") << NEWLINE //
<< QLatin1String("Terminal=") << "false" << NEWLINE //
<< QLatin1String("Icon=") << "qv2ray" << NEWLINE //
<< QLatin1String("Categories=") << "Network" << NEWLINE //
<< QLatin1String("Type=") << "Application" << NEWLINE //
<< QLatin1String("StartupNotify=") << "false" << NEWLINE //
<< QLatin1String("X-GNOME-Autostart-enabled=") << "true" << NEWLINE;
ts.flush();
iniFile.close();
}
else
{
QFile::remove(desktopFileLocation);
QFile::remove(desktopFileLocation.replace("qv2ray", "Qv2ray"));
}
}
#endif
} // namespace Qv2ray::components::autolaunch
| 8,365
|
C++
|
.cpp
| 184
| 35.092391
| 138
| 0.603533
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,213
|
Qv2rayQMLApplication.cpp
|
Qv2ray_Qv2ray/src/ui/qml/Qv2rayQMLApplication.cpp
|
#include "Qv2rayQMLApplication.hpp"
#include "components/translations/QvTranslator.hpp"
#include "core/settings/SettingsBackend.hpp"
#include <QDesktopServices>
#include <QMessageBox>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
#ifdef QV2RAY_QMLLIVE_DEBUG
#include <qmllive/livenodeengine.h>
#include <qmllive/qmllive.h>
#include <qmllive/remotereceiver.h>
#endif
Qv2rayQMLApplication::Qv2rayQMLApplication(int &argc, char *argv[]) : Qv2rayPlatformApplication(argc, argv)
{
}
void Qv2rayQMLApplication::MessageBoxWarn(QWidget *parent, const QString &title, const QString &text)
{
QMessageBox::warning(parent, title, text);
}
void Qv2rayQMLApplication::MessageBoxInfo(QWidget *parent, const QString &title, const QString &text)
{
QMessageBox::information(parent, title, text);
}
MessageOpt Qv2rayQMLApplication::MessageBoxAsk(QWidget *parent, const QString &title, const QString &text, const QList<MessageOpt> &list)
{
QFlags<QMessageBox::StandardButton> btns;
for (const auto &b : list)
{
btns.setFlag(MessageBoxButtonMap[b]);
}
return MessageBoxButtonMap.key(QMessageBox::question(parent, title, text, btns));
}
QStringList Qv2rayQMLApplication::checkPrerequisitesInternal()
{
return {};
}
Qv2rayExitReason Qv2rayQMLApplication::runQv2rayInternal()
{
QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine;
const QUrl url("qrc:/forms/MainWindow.qml");
const auto connectLambda = [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
};
connect(&engine, &QQmlApplicationEngine::objectCreated, this, connectLambda, Qt::QueuedConnection);
engine.rootContext()->setContextProperty("qv2ray", &uiProperty);
engine.addImportPath(QStringLiteral("qrc:/forms/"));
engine.load(url);
#ifdef QV2RAY_QMLLIVE_DEBUG
LiveNodeEngine node;
// Let QmlLive know your runtime
node.setQmlEngine(&engine);
// Allow it to display QML components with non-QQuickWindow root object
QQuickView fallbackView(&engine, 0);
node.setFallbackView(&fallbackView);
// Tell it where file updates should be stored relative to
node.setWorkspace(applicationDirPath() + "/forms", LiveNodeEngine::AllowUpdates | LiveNodeEngine::UpdatesAsOverlay);
// Listen to IPC call from remote QmlLive Bench
RemoteReceiver receiver;
receiver.registerNode(&node);
receiver.listen(10234);
QQuickWindow *window = qobject_cast<QQuickWindow *>(engine.rootObjects().first());
// Advanced use: let it know the initially loaded QML component (do this
// only after registering to receiver!)
QList<QQmlError> warnings;
node.usePreloadedDocument(applicationDirPath() + "/forms/MainWindow.qml", window, warnings);
#endif
return (Qv2rayExitReason) exec();
}
void Qv2rayQMLApplication::terminateUIInternal()
{
}
void Qv2rayQMLApplication::OpenURL(const QString &url)
{
QDesktopServices::openUrl(url);
}
#ifndef QV2RAY_NO_SINGLEAPPLICATON
void Qv2rayQMLApplication::onMessageReceived(quint32, QByteArray)
{
}
#endif
| 3,124
|
C++
|
.cpp
| 83
| 34.349398
| 137
| 0.76745
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,214
|
Qv2rayCliApplication.cpp
|
Qv2ray_Qv2ray/src/ui/cli/Qv2rayCliApplication.cpp
|
#include "Qv2rayCliApplication.hpp"
Qv2rayCliApplication::Qv2rayCliApplication(int &argc, char *argv[]) : Qv2rayPlatformApplication(argc, argv)
{
}
QStringList Qv2rayCliApplication::checkPrerequisitesInternal()
{
return {};
}
Qv2rayExitReason Qv2rayCliApplication::runQv2rayInternal()
{
return (Qv2rayExitReason) exec();
}
void Qv2rayCliApplication::terminateUIInternal()
{
}
#ifndef QV2RAY_NO_SINGLEAPPLICATON
void Qv2rayCliApplication::onMessageReceived(quint32 clientID, QByteArray msg)
{
}
#endif
| 513
|
C++
|
.cpp
| 20
| 24.05
| 107
| 0.832311
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,215
|
QvVPNService.cpp
|
Qv2ray_Qv2ray/src/platforms/android/QvVPNService.cpp
|
#include "QvVPNService.hpp"
#include <QtAndroid>
QvVPNService::QvVPNService(int &argc, char *argv[]) : QAndroidService(argc, argv)
{
}
QAndroidBinder *QvVPNService::onBind(const QAndroidIntent &intent)
{
return nullptr;
}
| 229
|
C++
|
.cpp
| 9
| 23.666667
| 81
| 0.78341
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,216
|
Qv2rayBaseApplication.cpp
|
Qv2ray_Qv2ray/src/base/Qv2rayBaseApplication.cpp
|
#include "Qv2rayBaseApplication.hpp"
#include "components/translations/QvTranslator.hpp"
#include "core/settings/SettingsBackend.hpp"
#include "utils/QvHelpers.hpp"
#define QV_MODULE_NAME "BaseApplication"
inline QString makeAbs(const QString &p)
{
return QDir(p).absolutePath();
}
Qv2rayApplicationInterface::Qv2rayApplicationInterface()
{
ConfigObject = new Qv2rayConfigObject;
QvCoreApplication = this;
LOG("Qv2ray", QV2RAY_VERSION_STRING, "on", QSysInfo::prettyProductName(), QSysInfo::currentCpuArchitecture());
DEBUG("Qv2ray Start Time: ", QTime::currentTime().msecsSinceStartOfDay());
DEBUG("QV2RAY_BUILD_INFO", QV2RAY_BUILD_INFO);
DEBUG("QV2RAY_BUILD_EXTRA_INFO", QV2RAY_BUILD_EXTRA_INFO);
DEBUG("QV2RAY_BUILD_NUMBER", QSTRN(QV2RAY_VERSION_BUILD));
QStringList licenseList;
licenseList << "This program comes with ABSOLUTELY NO WARRANTY.";
licenseList << "This is free software, and you are welcome to redistribute it";
licenseList << "under certain conditions.";
licenseList << "Copyright (c) 2019-2021 Qv2ray Development Group.";
licenseList << "Third-party libraries that have been used in this program can be found in the About page.";
LOG(licenseList.join(NEWLINE));
}
Qv2rayApplicationInterface::~Qv2rayApplicationInterface()
{
delete ConfigObject;
QvCoreApplication = nullptr;
}
QStringList Qv2rayApplicationInterface::GetAssetsPaths(const QString &dirName) const
{
// Configuration Path
QStringList list;
if (qEnvironmentVariableIsSet("QV2RAY_RESOURCES_PATH"))
list << makeAbs(qEnvironmentVariable("QV2RAY_RESOURCES_PATH") + "/" + dirName);
// Default behavior on Windows
list << makeAbs(QCoreApplication::applicationDirPath() + "/" + dirName);
list << makeAbs(QV2RAY_CONFIG_DIR + dirName);
list << ":/" + dirName;
list << QStandardPaths::locateAll(QStandardPaths::AppDataLocation, dirName, QStandardPaths::LocateDirectory);
list << QStandardPaths::locateAll(QStandardPaths::AppConfigLocation, dirName, QStandardPaths::LocateDirectory);
#ifdef Q_OS_UNIX
if (qEnvironmentVariableIsSet("APPIMAGE"))
list << makeAbs(QCoreApplication::applicationDirPath() + "/../share/qv2ray/" + dirName);
if (qEnvironmentVariableIsSet("SNAP"))
list << makeAbs(qEnvironmentVariable("SNAP") + "/usr/share/qv2ray/" + dirName);
if (qEnvironmentVariableIsSet("XDG_DATA_DIRS"))
list << makeAbs(qEnvironmentVariable("XDG_DATA_DIRS") + "/" + dirName);
list << makeAbs("/usr/local/share/qv2ray/" + dirName);
list << makeAbs("/usr/local/lib/qv2ray/" + dirName);
list << makeAbs("/usr/share/qv2ray/" + dirName);
list << makeAbs("/usr/lib/qv2ray/" + dirName);
list << makeAbs("/lib/qv2ray/" + dirName);
#endif
#ifdef Q_OS_MAC
// macOS platform directories.
list << QDir(QCoreApplication::applicationDirPath() + "/../Resources/" + dirName).absolutePath();
#endif
list.removeDuplicates();
return list;
}
| 2,985
|
C++
|
.cpp
| 63
| 43.238095
| 115
| 0.730055
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,218
|
Common.hpp
|
Qv2ray_Qv2ray/test/Common.hpp
|
#include "base/Qv2rayBaseApplication.hpp"
using namespace Qv2ray;
int fakeArgc = 0;
char *fakeArgv[]{};
class QvTestApplication
: public QCoreApplication
, public Qv2rayApplicationInterface
{
public:
explicit QvTestApplication() : QCoreApplication(fakeArgc, fakeArgv), Qv2rayApplicationInterface(){};
virtual void MessageBoxWarn(QWidget *, const QString &, const QString &) override{};
virtual void MessageBoxInfo(QWidget *, const QString &, const QString &) override{};
virtual MessageOpt MessageBoxAsk(QWidget *, const QString &, const QString &, const QList<MessageOpt> &) override
{
return {};
};
virtual void OpenURL(const QString &) override{};
};
| 701
|
C++
|
.h
| 18
| 35.333333
| 117
| 0.740469
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,219
|
version.hpp
|
Qv2ray_Qv2ray/3rdparty/libsemver/version.hpp
|
/*
* Copyright (c) 2016-2017 Enrico M. Crisostomo
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file
* @brief Header of the semver::version class.
*
* This header defines the semver::version class, the central type of the C++
* API of `libsemver` library.
*
* @copyright Copyright (c) 2016 Enrico M. Crisostomo
* @license GNU General Public License v. 3.0
* @author Enrico M. Crisostomo
* @version 1.0.0
*/
#ifndef SEMVER_UTILS_VERSION_H
#define SEMVER_UTILS_VERSION_H
#include <vector>
#include <string>
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
/**
* @brief Main namespace of `libsemver`.
*/
namespace semver
{
/**
* @brief Class that represents a prerelease identifier.
*
* This class represents a prerelease identifier complying with _Semantic
* Versioning_ 2.0.0 (http://semver.org/).
*/
class prerelease_component
{
private:
/**
* @brief Indicates whether the component is a number.
*/
bool is_number;
/**
* @brief The component representation as a string.
*/
std::string identifier;
/**
* @brief The component numeric value.
*
* This field is meaningful only if the current component is a number.
*/
unsigned long value_as_number;
public:
prerelease_component(std::string s);
bool operator<(const prerelease_component& rh) const;
bool operator>(const prerelease_component& rh) const;
bool operator==(const prerelease_component& v) const;
};
/**
* @brief Class that represents a version number.
*
* This class represents a version number complying with _Semantic Versioning_
* 2.0.0 (http://semver.org/). As a supported extension this class allows
* version numbers to contain any number of components greater than 2.
*
* Instances of this class are designed to be immutable.
*/
class version
{
private:
std::vector<unsigned int> versions;
std::string prerelease;
std::vector<prerelease_component> prerelease_comp;
std::string metadata;
void parse_prerelease();
public:
/**
* @brief Constructs a semver::version instance from a std::string.
*
* The version number @p v must comply with _Semantic Versioning 2.0.0_. As
* a supported extension this class allows version numbers to contain any
* number of components greater than 2.
*
* @param v The version number to parse.
* @return A semver::version instance.
* @throws std::invalid_argument if @p v is not a valid version number.
*/
static version from_string(std::string v);
/**
* @brief Constructs a semver::version instance with the specified
* parameters. The parameters must comply with _Semantic Versioning 2.0.0_.
*
* @param versions The version components. As a supported extension this
* class allows versions numbers to contain any number of components greater
* than 2.
* @param prerelease An optional prerelease string.
* @param metadata An optional metadata string.
* @return A semver::version instance.
* @throws std::invalid_argument if the parameters do not comply with
* _Semantic Versioning 2.0.0_.
*/
version(std::vector<unsigned int> versions,
std::string prerelease = "",
std::string metadata = "");
/**
* @brief Converts a version to its string representation.
*
* @return The string representation of this instance.
*/
std::string str() const;
/**
* @brief Gets the version components.
*
* @return The version components.
*/
std::vector<unsigned int> get_version() const;
/**
* @brief Gets the specified version component.
*
* @return The specified version component, or 0 if the specified @p index
* does not exist.
*/
unsigned int get_version(unsigned int index) const;
/**
* @brief Gets the prerelease string.
*
* @return The prerelease string.
*/
std::string get_prerelease() const;
/**
* @brief Gets the metadata string.
*
* @return The metadata string.
*/
std::string get_metadata() const;
/**
* @brief Bumps the major version component.
*
* This method uses ::bump();
*
* @return A semver::version object containing the bumped version.
*/
version bump_major() const;
/**
* @brief Bumps the minor version component.
*
* This method uses ::bump();
*
* @return A semver::version object representing the bumped version.
*/
version bump_minor() const;
/**
* @brief Bumps the patch version component.
*
* This method uses ::bump();
*
* @return A semver::version object representing the bumped version.
*/
version bump_patch() const;
/**
* @brief Bumps the specified version component.
*
* The component @p index is bumped and all components whose index is grater
* than @p index are set to 0. If @p index is greater than the current size
* `s` of the version number, then `index + 1 - s` components are added and
* set to 0.
*
* @return A semver::version object representing the bumped version.
*/
version bump(unsigned int index) const;
/**
* @brief Strips the prerelease component.
*
* @return A semver::version object representing the modified version.
*/
version strip_prerelease() const;
/**
* @brief Strips the metadata component.
*
* @return A semver::version object representing the modified version.
*/
version strip_metadata() const;
/**
* @brief Checks whether the instance is a release version.
*
* @return `true` if the instance represents a release version, `false`
* otherwise.
*/
bool is_release() const;
/**
* @brief Checks two instances for equality.
*
* Two instances are equal if and only if all its components are equal.
*
* @param v The instance to be compared with.
* @return `true` if @p rh is equal to this instance, `false` otherwise.
*/
bool operator==(const version& rh) const;
/**
* @brief Compares two instances.
*
* An instance is less than another if its version number is less than the
* other's. Components are compared one by one, starting from the first.
* If the two components are equal, then the following component is
* considered. If the first component is less than the second, then `true`
* is returned, otherwise `false` is returned.
*
* @param v The instance to be compared with.
* @return `true` if this instance is less than @p rh, `false` otherwise.
*/
bool operator<(const version& rh) const;
/**
* @brief Compares two instances.
*
* An instance is greater than another if its version number is less than
* the other's. Components are compared one by one, starting from the
* first. If the two components are equal, then the following component is
* considered. If the first component is greater than the second, then
* `true` is returned, otherwise `false` is returned.
*
* @param v The instance to be compared with.
* @return `true` if this instance is greater than @p rh, `false` otherwise.
*/
bool operator>(const version& rh) const;
};
}
#endif // SEMVER_UTILS_VERSION_H
#pragma clang diagnostic pop
| 8,121
|
C++
|
.h
| 237
| 29.316456
| 80
| 0.673836
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
4,220
|
CoreUtils.hpp
|
Qv2ray_Qv2ray/src/core/CoreUtils.hpp
|
#pragma once
#include "base/models/CoreObjectModels.hpp"
#include "base/models/QvConfigIdentifier.hpp"
#include "base/models/QvSafeType.hpp"
#define CurrentStatAPIType (GlobalConfig.uiConfig.graphConfig.useOutboundStats ? API_OUTBOUND_PROXY : API_INBOUND)
namespace Qv2ray::core
{
const inline GroupId DefaultGroupId{ "000000000000" };
using namespace Qv2ray::base;
using namespace Qv2ray::base::safetype;
using namespace Qv2ray::base::objects;
inline const QString getTag(const INBOUND &in)
{
return in["tag"].toString();
}
inline const QString getTag(const OUTBOUND &in)
{
return in["tag"].toString();
}
inline const QString getTag(const RuleObject &in)
{
return in.QV2RAY_RULE_TAG;
}
//
int64_t GetConnectionLatency(const ConnectionId &id);
uint64_t GetConnectionTotalData(const ConnectionId &id);
const std::tuple<quint64, quint64> GetConnectionUsageAmount(const ConnectionId &id);
//
bool GetOutboundInfo(const OUTBOUND &out, QString *host, int *port, QString *protocol);
inline ProtocolSettingsInfoObject GetOutboundInfo(const OUTBOUND &out)
{
ProtocolSettingsInfoObject o;
GetOutboundInfo(out, &o.address, &o.port, &o.protocol);
return o;
}
const ProtocolSettingsInfoObject GetConnectionInfo(const ConnectionId &id, bool *status = nullptr);
const ProtocolSettingsInfoObject GetConnectionInfo(const CONFIGROOT &out, bool *status = nullptr);
//
bool IsComplexConfig(const CONFIGROOT &root);
bool IsComplexConfig(const ConnectionId &id);
//
const QString GetConnectionProtocolString(const ConnectionId &id);
//
const QString GetDisplayName(const ConnectionId &id, int limit = -1);
const QString GetDisplayName(const GroupId &id, int limit = -1);
//
// const GroupId GetConnectionGroupId(const ConnectionId &id);
//
bool GetInboundInfo(const INBOUND &in, QString *listen, int *port, QString *protocol);
inline ProtocolSettingsInfoObject GetInboundInfo(const INBOUND &in)
{
ProtocolSettingsInfoObject o;
GetInboundInfo(in, &o.address, &o.port, &o.protocol);
return o;
}
const QMap<QString, ProtocolSettingsInfoObject> GetInboundInfo(const CONFIGROOT &root);
const QMap<QString, ProtocolSettingsInfoObject> GetInboundInfo(const ConnectionId &id);
} // namespace Qv2ray::core
using namespace Qv2ray::core;
| 2,448
|
C++
|
.h
| 59
| 36.389831
| 114
| 0.735627
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,221
|
ConnectionIO.hpp
|
Qv2ray_Qv2ray/src/core/connection/ConnectionIO.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
namespace Qv2ray::core::connection::connectionIO
{
CONFIGROOT ConvertConfigFromFile(const QString &sourceFilePath, bool importComplex);
} // namespace Qv2ray::core::connection::connectionIO
using namespace Qv2ray::core::connection;
using namespace Qv2ray::core::connection::connectionIO;
| 337
|
C++
|
.h
| 8
| 40.5
| 88
| 0.823171
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,222
|
Generation.hpp
|
Qv2ray_Qv2ray/src/core/connection/Generation.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
static const inline QStringList V2RayLogLevel = { "none", "debug", "info", "warning", "error" };
namespace Qv2ray::core::connection::generation
{
namespace routing
{
enum RuleType
{
RULE_DOMAIN,
RULE_IP
};
ROUTERULE GenerateSingleRouteRule(RuleType t, const QString &str, const QString &outboundTag, const QString &type = "field");
ROUTERULE GenerateSingleRouteRule(RuleType t, const QStringList &list, const QString &outboundTag, const QString &type = "field");
QJsonObject GenerateDNS(const QvConfig_DNS &dnsServer);
ROUTING GenerateRoutes(bool enableProxy, bool bypassCN, bool bypassLAN, const QString &outboundTag, const QvConfig_Route &routeConfig);
} // namespace routing
namespace misc
{
QJsonObject GenerateAPIEntry(const QString &tag, bool withHandler = true, bool withLogger = true, bool withStats = true);
} // namespace misc
namespace inbounds
{
INBOUNDSETTING GenerateDokodemoIN(const QString &address, int port, const QString &network, int timeout = 0, bool followRedirect = false);
INBOUNDSETTING GenerateHTTPIN(bool auth, const QList<AccountObject> &accounts, int timeout = 300, bool allowTransparent = true);
INBOUNDSETTING GenerateSocksIN(const QString &auth, const QList<AccountObject> &_accounts, bool udp = false, const QString &ip = "127.0.0.1");
INBOUNDS GenerateDefaultInbounds();
QJsonObject GenerateSniffingObject(bool enabled, QList<QString> destOverride, bool metadataOnly = false);
INBOUND GenerateInboundEntry(const QString &tag, //
const QString &protocol, //
const QString &listen, //
int port, //
const INBOUNDSETTING &settings, //
const QJsonObject &sniffing = {}, //
const QJsonObject &allocate = {});
} // namespace inbounds
namespace outbounds
{
OUTBOUNDSETTING GenerateFreedomOUT(const QString &domainStrategy, const QString &redirect);
OUTBOUNDSETTING GenerateBlackHoleOUT(bool useHTTP);
OUTBOUNDSETTING GenerateShadowSocksOUT(const QList<ShadowSocksServerObject> &servers);
OUTBOUNDSETTING GenerateShadowSocksServerOUT(const QString &address, int port, const QString &method, const QString &password);
OUTBOUNDSETTING GenerateHTTPSOCKSOut(const QString &address, int port, bool useAuth, const QString &username, const QString &password);
OUTBOUND GenerateOutboundEntry(const QString &tag, //
const QString &protocol, //
const OUTBOUNDSETTING &settings, //
const QJsonObject &streamSettings, //
const QJsonObject &mux = {}, //
const QString &sendThrough = "0.0.0.0");
} // namespace outbounds
namespace filters
{
// mark all outbound
void OutboundMarkSettingFilter(CONFIGROOT &root, const int mark);
void RemoveEmptyMuxFilter(CONFIGROOT &root);
void DNSInterceptFilter(CONFIGROOT &root, const bool have_tproxy, const bool have_tproxy_v6, const bool have_socks);
void BypassBTFilter(CONFIGROOT &root);
void mKCPSeedFilter(CONFIGROOT &root);
void FillupTagsFilter(CONFIGROOT &root, const QString &subKey);
} // namespace filters
} // namespace Qv2ray::core::connection::generation
using namespace Qv2ray::core;
using namespace Qv2ray::core::connection;
using namespace Qv2ray::core::connection::generation;
using namespace Qv2ray::core::connection::generation::filters;
using namespace Qv2ray::core::connection::generation::inbounds;
using namespace Qv2ray::core::connection::generation::outbounds;
using namespace Qv2ray::core::connection::generation::routing;
using namespace Qv2ray::core::connection::generation::misc;
| 4,221
|
C++
|
.h
| 69
| 49.666667
| 150
| 0.650579
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,223
|
Serialization.hpp
|
Qv2ray_Qv2ray/src/core/connection/Serialization.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "utils/QvHelpers.hpp"
namespace Qv2ray::core::connection::serialization
{
const inline QString QV2RAY_SERIALIZATION_COMPLEX_CONFIG_PLACEHOLDER = "(N/A)";
/**
* pattern for the nodes in ssd links.
* %1: airport name
* %2: node name
* %3: rate
*/
const inline QString QV2RAY_SSD_DEFAULT_NAME_PATTERN = "%1 - %2 (rate %3)";
QList<std::pair<QString, CONFIGROOT>> ConvertConfigFromString(const QString &link, QString *aliasPrefix, QString *errMessage,
QString *newGroupName = nullptr);
const QString ConvertConfigToString(const ConnectionGroupPair &id, bool isSip002 = true);
const QString ConvertConfigToString(const QString &alias, const QString &groupName, const CONFIGROOT &server, bool isSip002 = true);
namespace vmess
{
CONFIGROOT Deserialize(const QString &vmess, QString *alias, QString *errMessage);
const QString Serialize(const StreamSettingsObject &transfer, const VMessServerObject &server, const QString &alias);
} // namespace vmess
namespace vmess_new
{
CONFIGROOT Deserialize(const QString &vmess, QString *alias, QString *errMessage);
const QString Serialize(const StreamSettingsObject &transfer, const VMessServerObject &server, const QString &alias);
} // namespace vmess_new
namespace vless
{
CONFIGROOT Deserialize(const QString &vless, QString *alias, QString *errMessage);
} // namespace vless
namespace ss
{
CONFIGROOT Deserialize(const QString &ss, QString *alias, QString *errMessage);
const QString Serialize(const ShadowSocksServerObject &server, const QString &alias, bool isSip002);
} // namespace ss
namespace ssd
{
QList<std::pair<QString, CONFIGROOT>> Deserialize(const QString &uri, QString *groupName, QStringList *logList);
} // namespace ssd
} // namespace Qv2ray::core::connection::serialization
using namespace Qv2ray::core;
using namespace Qv2ray::core::connection;
using namespace Qv2ray::core::connection::serialization;
| 2,160
|
C++
|
.h
| 44
| 42.477273
| 136
| 0.711575
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,224
|
RouteHandler.hpp
|
Qv2ray_Qv2ray/src/core/handler/RouteHandler.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
namespace Qv2ray::core::handler
{
class RouteHandler : public QObject
{
Q_OBJECT
public:
explicit RouteHandler(QObject *parent = nullptr);
~RouteHandler();
void SaveRoutes() const;
//
std::tuple<bool, QvConfig_DNS, QvConfig_FakeDNS> GetDNSSettings(const GroupRoutingId &id) const
{
return { configs[id].overrideDNS, configs[id].dnsConfig, configs[id].fakeDNSConfig };
}
std::pair<bool, QvConfig_Route> GetAdvancedRoutingSettings(const GroupRoutingId &id) const
{
return { configs[id].overrideRoute, configs[id].routeConfig };
}
//
bool SetDNSSettings(const GroupRoutingId &id, bool overrideGlobal, const QvConfig_DNS &dns, const QvConfig_FakeDNS &fakeDNS);
bool SetAdvancedRouteSettings(const GroupRoutingId &id, bool overrideGlobal, const QvConfig_Route &dns);
//
OUTBOUNDS ExpandExternalConnection(const OUTBOUNDS &outbounds) const;
//
// Final Config Generation
CONFIGROOT GenerateFinalConfig(const ConnectionGroupPair &pair, bool hasAPI = true) const;
CONFIGROOT GenerateFinalConfig(CONFIGROOT root, const GroupRoutingId &routingId, bool hasAPI = true) const;
//
bool ExpandChainedOutbounds(CONFIGROOT &) const;
private:
QHash<GroupRoutingId, GroupRoutingConfig> configs;
};
inline ::Qv2ray::core::handler::RouteHandler *RouteManager = nullptr;
} // namespace Qv2ray::core::handler
| 1,569
|
C++
|
.h
| 36
| 35.944444
| 133
| 0.688235
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,225
|
KernelInstanceHandler.hpp
|
Qv2ray_Qv2ray/src/core/handler/KernelInstanceHandler.hpp
|
#pragma once
#include "components/plugins/QvPluginHost.hpp"
#include "core/CoreUtils.hpp"
#include "core/kernel/V2RayKernelInteractions.hpp"
#include <QObject>
#include <optional>
namespace Qv2ray::core::handler
{
class KernelInstanceHandler : public QObject
{
Q_OBJECT
public:
explicit KernelInstanceHandler(QObject *parent = nullptr);
~KernelInstanceHandler();
std::optional<QString> StartConnection(const ConnectionGroupPair &id, CONFIGROOT root);
void StopConnection();
const ConnectionGroupPair CurrentConnection() const
{
return currentId;
}
size_t ActivePluginKernelsCount() const
{
return activeKernels.size();
}
const QMap<QString, ProtocolSettingsInfoObject> GetCurrentConnectionInboundInfo() const
{
return inboundInfo;
}
const QStringList GetActiveKernelProtocols() const
{
QStringList list;
for (const auto &[protocol, kernel] : activeKernels)
{
list << protocol;
}
return list;
}
signals:
void OnConnected(const ConnectionGroupPair &id);
void OnDisconnected(const ConnectionGroupPair &id);
void OnCrashed(const ConnectionGroupPair &id, const QString &errMessage);
void OnStatsDataAvailable(const ConnectionGroupPair &id, const QMap<StatisticsType, QvStatsSpeed> &data);
void OnKernelLogAvailable(const ConnectionGroupPair &id, const QString &log);
private slots:
void OnKernelCrashed_p(const QString &msg);
void OnPluginKernelLog_p(const QString &log);
void OnV2RayKernelLog_p(const QString &log);
void OnV2RayStatsDataRcvd_p(const QMap<StatisticsType, QvStatsSpeed> &data);
void OnPluginStatsDataRcvd_p(const long uploadSpeed, const long downloadSpeed);
private:
void emitLogMessage(const QString &);
static std::optional<QString> CheckPort(const QMap<QString, ProtocolSettingsInfoObject> &info, int plugins);
private:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int pluginLogPrefixPadding = 0;
#else
qsizetype pluginLogPrefixPadding = 0;
#endif
QMap<QString, int> GetInboundPorts() const
{
QMap<QString, int> result;
for (const auto &[tag, info] : inboundInfo.toStdMap())
{
result[tag] = info.port;
}
return result;
}
QMap<QString, QString> GetInboundHosts() const
{
QMap<QString, QString> result;
for (const auto &[tag, info] : inboundInfo.toStdMap())
{
result[tag] = info.address;
}
return result;
}
QMap<QString, QString> kernelMap;
// Since QMap does not support std::unique_ptr, we use std::map<>
std::list<std::pair<QString, std::unique_ptr<PluginKernel>>> activeKernels;
QMap<QString, ProtocolSettingsInfoObject> inboundInfo;
V2RayKernelInstance *vCoreInstance = nullptr;
ConnectionGroupPair currentId = {};
};
inline const KernelInstanceHandler *KernelInstance;
} // namespace Qv2ray::core::handler
| 3,284
|
C++
|
.h
| 85
| 29.847059
| 116
| 0.650266
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,226
|
ConfigHandler.hpp
|
Qv2ray_Qv2ray/src/core/handler/ConfigHandler.hpp
|
#pragma once
#include "components/latency/LatencyTest.hpp"
#include "core/CoreUtils.hpp"
#include "core/connection/ConnectionIO.hpp"
#include "core/handler/KernelInstanceHandler.hpp"
namespace Qv2ray::common::network
{
class NetworkRequestHelper;
}
#define CheckValidId(id, returnValue) \
if (!IsValidId(id)) \
return returnValue;
namespace Qv2ray::core::handler
{
class QvConfigHandler : public QObject
{
Q_OBJECT
public:
explicit QvConfigHandler(QObject *parent = nullptr);
~QvConfigHandler();
public slots:
inline const QList<ConnectionId> GetConnections() const
{
return connections.keys();
}
inline const QList<ConnectionId> GetConnections(const GroupId &groupId) const
{
CheckValidId(groupId, {});
return groups[groupId].connections;
}
inline QList<GroupId> AllGroups() const
{
auto k = groups.keys();
std::sort(k.begin(), k.end(), [&](const GroupId &idA, const GroupId &idB) {
const auto result = groups[idA].displayName < groups[idB].displayName;
return result;
});
return k;
}
inline bool IsValidId(const ConnectionId &id) const
{
return connections.contains(id);
}
inline bool IsValidId(const GroupId &id) const
{
return groups.contains(id);
}
inline bool IsValidId(const ConnectionGroupPair &id) const
{
return IsValidId(id.connectionId) && IsValidId(id.groupId);
}
inline const ConnectionObject GetConnectionMetaObject(const ConnectionId &id) const
{
CheckValidId(id, {});
return connections[id];
}
inline GroupObject GetGroupMetaObject(const GroupId &id) const
{
CheckValidId(id, {});
return groups[id];
}
bool IsConnected(const ConnectionGroupPair &id) const
{
return kernelHandler->CurrentConnection() == id;
}
inline void IgnoreSubscriptionUpdate(const GroupId &group)
{
CheckValidId(group, nothing);
if (groups[group].isSubscription)
groups[group].lastUpdatedDate = system_clock::to_time_t(system_clock::now());
}
void SaveConnectionConfig();
const QList<GroupId> Subscriptions() const;
const QList<GroupId> GetConnectionContainedIn(const ConnectionId &connId) const;
//
// Connectivity Operationss
bool StartConnection(const ConnectionGroupPair &identifier);
void StopConnection();
void RestartConnection();
//
// Connection Operations.
void ClearGroupUsage(const GroupId &id);
void ClearConnectionUsage(const ConnectionGroupPair &id);
//
const ConnectionGroupPair CreateConnection(const CONFIGROOT &root, const QString &displayName, const GroupId &groupId = DefaultGroupId,
bool skipSaveConfig = false);
bool UpdateConnection(const ConnectionId &id, const CONFIGROOT &root, bool skipRestart = false);
const std::optional<QString> RenameConnection(const ConnectionId &id, const QString &newName);
//
// Connection - Group binding
bool RemoveConnectionFromGroup(const ConnectionId &id, const GroupId &gid);
bool MoveConnectionFromToGroup(const ConnectionId &id, const GroupId &sourceGid, const GroupId &targetGid);
bool LinkConnectionWithGroup(const ConnectionId &id, const GroupId &newGroupId);
//
// Get Conncetion Property
const CONFIGROOT GetConnectionRoot(const ConnectionId &id) const;
//
// Misc Connection Operations
void StartLatencyTest();
void StartLatencyTest(const GroupId &id);
void StartLatencyTest(const ConnectionId &id, Qv2rayLatencyTestingMethod method = GlobalConfig.networkConfig.latencyTestingMethod);
//
// Group Operations
const GroupId CreateGroup(const QString &displayName, bool isSubscription);
const std::optional<QString> DeleteGroup(const GroupId &id);
const std::optional<QString> RenameGroup(const GroupId &id, const QString &newName);
const GroupRoutingId GetGroupRoutingId(const GroupId &id);
// const optional<QString> DuplicateGroup(const GroupId &id);
//
// Subscriptions
void UpdateSubscriptionAsync(const GroupId &id);
bool UpdateSubscription(const GroupId &id);
bool SetSubscriptionData(const GroupId &id, std::optional<bool> isSubscription = std::nullopt,
const std::optional<QString> &address = std::nullopt, std::optional<float> updateInterval = std::nullopt);
bool SetSubscriptionType(const GroupId &id, const QString &type);
bool SetSubscriptionIncludeKeywords(const GroupId &id, const QStringList &Keywords);
bool SetSubscriptionExcludeKeywords(const GroupId &id, const QStringList &Keywords);
bool SetSubscriptionIncludeRelation(const GroupId &id, SubscriptionFilterRelation relation);
bool SetSubscriptionExcludeRelation(const GroupId &id, SubscriptionFilterRelation relation);
// bool UpdateSubscriptionASync(const GroupId &id, bool useSystemProxy);
// const std::tuple<QString, int64_t, float> GetSubscriptionData(const GroupId &id) const;
signals:
void OnKernelLogAvailable(const ConnectionGroupPair &id, const QString &log);
void OnStatsAvailable(const ConnectionGroupPair &id, const QMap<StatisticsType, QvStatsSpeedData> &data);
//
void OnConnectionCreated(const ConnectionGroupPair &Id, const QString &displayName);
void OnConnectionModified(const ConnectionId &id);
void OnConnectionRenamed(const ConnectionId &Id, const QString &originalName, const QString &newName);
//
void OnConnectionLinkedWithGroup(const ConnectionGroupPair &newPair);
void OnConnectionRemovedFromGroup(const ConnectionGroupPair &pairId);
//
void OnLatencyTestStarted(const ConnectionId &id);
void OnLatencyTestFinished(const ConnectionId &id, const int average);
//
void OnGroupCreated(const GroupId &id, const QString &displayName);
void OnGroupRenamed(const GroupId &id, const QString &oldName, const QString &newName);
void OnGroupDeleted(const GroupId &id, const QList<ConnectionId> &connections);
//
void OnSubscriptionAsyncUpdateFinished(const GroupId &id);
void OnConnected(const ConnectionGroupPair &id);
void OnDisconnected(const ConnectionGroupPair &id);
void OnKernelCrashed(const ConnectionGroupPair &id, const QString &errMessage);
//
private slots:
void p_OnKernelCrashed(const ConnectionGroupPair &id, const QString &errMessage);
void p_OnLatencyDataArrived(const ConnectionId &id, const LatencyTestResult &data);
void p_OnStatsDataArrived(const ConnectionGroupPair &id, const QMap<StatisticsType, QvStatsSpeed> &data);
protected:
void timerEvent(QTimerEvent *event) override;
private:
bool p_CHUpdateSubscription(const GroupId &id, const QByteArray &data);
private:
int saveTimerId;
int pingAllTimerId;
int pingConnectionTimerId;
QHash<GroupId, GroupObject> groups;
QHash<ConnectionId, ConnectionObject> connections;
QHash<ConnectionId, CONFIGROOT> connectionRootCache;
private:
LatencyTestHost *pingHelper;
KernelInstanceHandler *kernelHandler;
};
inline ::Qv2ray::core::handler::QvConfigHandler *ConnectionManager = nullptr;
} // namespace Qv2ray::core::handler
using namespace Qv2ray::core::handler;
| 8,163
|
C++
|
.h
| 166
| 39.981928
| 150
| 0.66295
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,227
|
SettingsBackend.hpp
|
Qv2ray_Qv2ray/src/core/settings/SettingsBackend.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
namespace Qv2ray::core::config
{
void SaveGlobalSettings();
bool LocateConfiguration();
void SetConfigDirPath(const QString &path);
bool CheckSettingsPathAvailability(const QString &_path, bool checkExistingConfig);
} // namespace Qv2ray::core::config
namespace Qv2ray
{
// Extra header for QvConfigUpgrade.cpp
QJsonObject UpgradeSettingsVersion(int fromVersion, int toVersion, const QJsonObject &root);
} // namespace Qv2ray
using namespace Qv2ray::core;
using namespace Qv2ray::core::config;
| 565
|
C++
|
.h
| 16
| 32.625
| 96
| 0.791209
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,228
|
V2RayKernelInteractions.hpp
|
Qv2ray_Qv2ray/src/core/kernel/V2RayKernelInteractions.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "core/kernel/QvKernelABIChecker.hpp"
class QProcess;
namespace Qv2ray::core::kernel
{
class APIWorker;
class V2RayKernelInstance : public QObject
{
Q_OBJECT
public:
explicit V2RayKernelInstance(QObject *parent = nullptr);
~V2RayKernelInstance() override;
//
std::optional<QString> StartConnection(const CONFIGROOT &root);
void StopConnection();
bool IsKernelRunning() const
{
return kernelStarted;
}
//
static std::optional<QString> ValidateConfig(const QString &path);
static std::pair<bool, std::optional<QString>> ValidateKernel(const QString &vCorePath, const QString &vAssetsPath);
#if QV2RAY_FEATURE(kernel_check_permission)
static std::pair<bool, std::optional<QString>> CheckAndSetCoreExecutableState(const QString &vCorePath);
#endif
signals:
void OnProcessErrored(const QString &errMessage);
void OnProcessOutputReadyRead(const QString &output);
void OnNewStatsDataArrived(const QMap<StatisticsType, QvStatsSpeed> &data);
private:
APIWorker *apiWorker;
QProcess *vProcess;
bool apiEnabled;
bool kernelStarted = false;
};
} // namespace Qv2ray::core::kernel
using namespace Qv2ray::core::kernel;
| 1,369
|
C++
|
.h
| 38
| 29.473684
| 124
| 0.698341
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,229
|
APIBackend.hpp
|
Qv2ray_Qv2ray/src/core/kernel/APIBackend.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "v2ray_api.grpc.pb.h"
#include <grpc++/grpc++.h>
// Check 10 times before telling user that API has failed.
constexpr auto QV2RAY_API_CALL_FAILEDCHECK_THRESHOLD = 30;
namespace Qv2ray::core::kernel
{
struct APIConfigObject
{
QString protocol;
StatisticsType type;
};
typedef std::map<QString, APIConfigObject> QvAPITagProtocolConfig;
typedef std::map<StatisticsType, QStringList> QvAPIDataTypeConfig;
class APIWorker : public QObject
{
Q_OBJECT
public:
APIWorker();
~APIWorker();
void StartAPI(const QMap<bool, QMap<QString, QString>> &tagProtocolPair);
void StopAPI();
signals:
void onAPIDataReady(const QMap<StatisticsType, QvStatsSpeed> &data);
void OnAPIErrored(const QString &err);
private slots:
void process();
private:
qint64 CallStatsAPIByName(const QString &name);
QvAPITagProtocolConfig tagProtocolConfig;
QThread *workThread;
//
bool started = false;
bool running = false;
std::shared_ptr<::grpc::Channel> grpc_channel;
std::unique_ptr<::v2ray::core::app::stats::command::StatsService::Stub> stats_service_stub;
};
} // namespace Qv2ray::core::kernel
using namespace Qv2ray::core::kernel;
| 1,364
|
C++
|
.h
| 40
| 27.85
| 99
| 0.681126
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,230
|
QvKernelABIChecker.hpp
|
Qv2ray_Qv2ray/src/core/kernel/QvKernelABIChecker.hpp
|
#pragma once
#include "base/Qv2rayFeatures.hpp"
#if QV2RAY_FEATURE(kernel_check_abi)
#include <QDataStream>
#include <QFile>
#include <QString>
#include <QtGlobal>
#include <optional>
namespace Qv2ray::core::kernel
{
namespace abi
{
enum QvKernelABIType
{
ABI_WIN32,
ABI_MACH_O,
ABI_ELF_X86,
ABI_ELF_X86_64,
ABI_ELF_AARCH64,
ABI_ELF_ARM,
ABI_ELF_OTHER,
ABI_TRUSTED,
};
enum QvKernelABICompatibility
{
ABI_NOPE,
ABI_MAYBE,
ABI_PERFECT,
};
inline constexpr auto COMPILED_ABI_TYPE =
#if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_X86_64)
QvKernelABIType::ABI_ELF_X86_64;
#elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_X86_32)
QvKernelABIType::ABI_ELF_X86;
#elif defined(Q_OS_MACOS)
QvKernelABIType::ABI_MACH_O;
#elif defined(Q_OS_WINDOWS)
QvKernelABIType::ABI_WIN32;
#elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM_64)
QvKernelABIType::ABI_ELF_AARCH64;
#elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM_V7)
QvKernelABIType::ABI_ELF_ARM;
#else
QvKernelABIType::ABI_TRUSTED;
#define QV2RAY_TRUSTED_ABI
#endif
std::pair<std::optional<QvKernelABIType>, std::optional<QString>> deduceKernelABI(const QString &pathCoreExecutable);
QvKernelABICompatibility checkCompatibility(QvKernelABIType hostType, QvKernelABIType targetType);
QString abiToString(QvKernelABIType abi);
} // namespace abi
} // namespace Qv2ray::core::kernel
#endif
| 1,651
|
C++
|
.h
| 52
| 24.673077
| 125
| 0.649277
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,231
|
QvProxyConfigurator.hpp
|
Qv2ray_Qv2ray/src/components/proxy/QvProxyConfigurator.hpp
|
#pragma once
#include <QHostAddress>
#include <QObject>
#include <QString>
//
namespace Qv2ray::components::proxy
{
void ClearSystemProxy();
void SetSystemProxy(const QString &address, int http_port, int socks_port);
} // namespace Qv2ray::components::proxy
using namespace Qv2ray::components;
using namespace Qv2ray::components::proxy;
| 346
|
C++
|
.h
| 12
| 27.083333
| 79
| 0.786787
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,232
|
LatencyTest.hpp
|
Qv2ray_Qv2ray/src/components/latency/LatencyTest.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
namespace uvw
{
class Loop;
}
struct sockaddr_storage;
namespace Qv2ray::components::latency
{
class LatencyTestThread;
struct LatencyTestResult
{
QString errorMessage;
int totalCount;
int failedCount;
long worst = LATENCY_TEST_VALUE_ERROR;
long best = LATENCY_TEST_VALUE_ERROR;
long avg = LATENCY_TEST_VALUE_ERROR;
Qv2rayLatencyTestingMethod method;
};
struct LatencyTestRequest
{
ConnectionId id;
QString host;
int port;
int totalCount;
Qv2rayLatencyTestingMethod method;
};
class LatencyTestHost : public QObject
{
Q_OBJECT
public:
explicit LatencyTestHost(const int defaultCount = 3, QObject *parent = nullptr);
void TestLatency(const ConnectionId &connectionId, Qv2rayLatencyTestingMethod);
void TestLatency(const QList<ConnectionId> &connectionIds, Qv2rayLatencyTestingMethod);
void StopAllLatencyTest();
~LatencyTestHost() override;
signals:
void OnLatencyTestCompleted(ConnectionId id, LatencyTestResult data);
private:
int totalTestCount;
// we're not introduce multi latency test thread for now,
// cause it's easy to use a scheduler like round-robin scheme
// and libuv event loop is fast.
LatencyTestThread *latencyThread;
};
} // namespace Qv2ray::components::latency
using namespace Qv2ray::components::latency;
Q_DECLARE_METATYPE(LatencyTestResult)
| 1,567
|
C++
|
.h
| 49
| 25.693878
| 95
| 0.699273
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| true
| false
| true
| false
|
4,233
|
TCPing.hpp
|
Qv2ray_Qv2ray/src/components/latency/TCPing.hpp
|
#pragma once
#include "DNSBase.hpp"
#include "LatencyTest.hpp"
#include "base/Qv2rayBase.hpp"
#include <type_traits>
namespace Qv2ray::components::latency::tcping
{
class TCPing : public DNSBase<TCPing>
{
public:
using DNSBase<TCPing>::DNSBase;
void start();
~TCPing() override;
protected:
private:
void ping() override;
void notifyTestHost();
};
} // namespace Qv2ray::components::latency::tcping
| 470
|
C++
|
.h
| 19
| 19.947368
| 50
| 0.665924
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,234
|
DNSBase.hpp
|
Qv2ray_Qv2ray/src/components/latency/DNSBase.hpp
|
#pragma once
#include "LatencyTest.hpp"
#include "coroutine.hpp"
#include "uvw.hpp"
namespace Qv2ray::components::latency
{
template<typename T>
class DNSBase
: public coroutine
, public std::enable_shared_from_this<T>
{
public:
DNSBase(const std::shared_ptr<uvw::Loop> &loopin, LatencyTestRequest &req, LatencyTestHost *testHost)
: req(std::move(req)), testHost(testHost), loop(loopin)
{
}
virtual ~DNSBase();
protected:
int isAddr()
{
auto host = req.host.toStdString();
if (uv_ip4_addr(host.data(), req.port, reinterpret_cast<sockaddr_in *>(&storage)) == 0)
{
return AF_INET;
}
if (uv_ip6_addr(host.data(), req.port, reinterpret_cast<sockaddr_in6 *>(&storage)) == 0)
{
return AF_INET6;
}
return -1;
}
template<typename E, typename H>
void async_DNS_lookup(E &&e, H &&h)
{
co_enter(*this)
{
if (getAddrHandle)
{
getAddrHandle->once<uvw::ErrorEvent>(coro(async_DNS_lookup));
getAddrHandle->once<uvw::AddrInfoEvent>(coro(async_DNS_lookup));
co_yield return getAddrHandle->addrInfo(req.host.toStdString(), digitBuffer);
co_yield if constexpr (std::is_same_v<uvw::AddrInfoEvent, std::remove_reference_t<E>>)
{
if (getAddrInfoRes(e) != 0)
{
data.errorMessage = QObject::tr("DNS not resolved");
data.avg = LATENCY_TEST_VALUE_ERROR;
testHost->OnLatencyTestCompleted(req.id, data);
h.clear();
return;
}
}
else
{
if constexpr (std::is_same_v<uvw::ErrorEvent, std::remove_reference_t<E>>)
{
data.errorMessage = QObject::tr("DNS not resolved");
data.avg = LATENCY_TEST_VALUE_ERROR;
testHost->OnLatencyTestCompleted(req.id, data);
h.clear();
return;
}
}
}
}
ping();
if (getAddrHandle)
getAddrHandle->clear();
}
int getAddrInfoRes(uvw::AddrInfoEvent &e)
{
struct addrinfo *rp = nullptr;
for (rp = e.data.get(); rp != nullptr; rp = rp->ai_next)
if (rp->ai_family == AF_INET)
{
if (rp->ai_family == AF_INET)
{
af = AF_INET;
memcpy(&storage, rp->ai_addr, sizeof(struct sockaddr_in));
}
else if (rp->ai_family == AF_INET6)
{
af = AF_INET6;
memcpy(&storage, rp->ai_addr, sizeof(struct sockaddr_in6));
}
break;
}
if (rp == nullptr)
{
// fallback: if we can't find prefered AF, then we choose alternative.
for (rp = e.data.get(); rp != nullptr; rp = rp->ai_next)
{
if (rp->ai_family == AF_INET)
{
af = AF_INET;
memcpy(&storage, rp->ai_addr, sizeof(struct sockaddr_in));
}
else if (rp->ai_family == AF_INET6)
{
af = AF_INET6;
memcpy(&storage, rp->ai_addr, sizeof(struct sockaddr_in6));
}
break;
}
}
if (rp)
return 0;
return -1;
}
virtual void ping() = 0;
protected:
int af = AF_INET;
int successCount = 0;
LatencyTestRequest req;
LatencyTestResult data;
LatencyTestHost *testHost;
struct sockaddr_storage storage;
char digitBuffer[20] = { 0 };
std::shared_ptr<uvw::Loop> loop;
std::shared_ptr<uvw::GetAddrInfoReq> getAddrHandle;
};
template<typename T>
DNSBase<T>::~DNSBase()
{
}
} // namespace Qv2ray::components::latency
| 4,618
|
C++
|
.h
| 126
| 21.253968
| 109
| 0.438057
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,235
|
coroutine.hpp
|
Qv2ray_Qv2ray/src/components/latency/coroutine.hpp
|
#pragma once
namespace detail
{
struct coroutine_ref;
} // namespace detail
struct coroutine
{
coroutine() : line_(0)
{
}
bool await_ready() const
{
return line_ == -1;
}
private:
friend struct detail::coroutine_ref;
int line_;
};
namespace detail
{
struct coroutine_ref
{
coroutine_ref(coroutine &c) : line_(c.line_), modified_(false)
{
}
~coroutine_ref()
{
if (!modified_)
line_ = -1;
}
operator int() const
{
return line_;
}
int &operator=(int v)
{
modified_ = true;
return line_ = v;
}
private:
void operator=(coroutine_ref const &);
int &line_;
bool modified_;
};
} // namespace detail
#define co_enter(c) \
switch (::detail::coroutine_ref _coro_value = c) \
case -1: \
if (_coro_value) \
{ \
goto terminate_coroutine; \
terminate_coroutine: \
_coro_value = -1; \
goto bail_out_of_coroutine; \
bail_out_of_coroutine: \
break; \
} \
else \
case 0:
#define __co_yield_impl(n) \
for (_coro_value = (n);;) \
if (_coro_value == 0) \
{ \
case (n):; break; \
} \
else \
switch (_coro_value ? 0 : 1) \
for (;;) \
case -1: \
if (_coro_value) \
goto terminate_coroutine; \
else \
for (;;) \
case 1: \
if (_coro_value) \
goto bail_out_of_coroutine; \
else \
case 0:
#define co_yield __co_yield_impl(__LINE__)
#define coro(f) \
[this, ptr = (std::enable_shared_from_this<T>::shared_from_this())](auto &&e, auto &&h) { \
f(std::forward<decltype(e)>(e), std::forward<decltype(h)>(h)); \
}
| 6,086
|
C++
|
.h
| 83
| 63.795181
| 150
| 0.145385
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,236
|
LatencyTestThread.hpp
|
Qv2ray_Qv2ray/src/components/latency/LatencyTestThread.hpp
|
#pragma once
#include "LatencyTest.hpp"
#include <QThread>
#include <curl/curl.h>
#include <mutex>
#include <unordered_set>
namespace uvw
{
class Loop;
class TimerHandle;
} // namespace uvw
namespace Qv2ray::components::latency
{
class LatencyTestThread : public QThread
{
Q_OBJECT
public:
explicit LatencyTestThread(QObject *parent = nullptr);
void stopLatencyTest()
{
isStop = true;
}
void pushRequest(const QList<ConnectionId> &ids, int totalTestCount, Qv2rayLatencyTestingMethod method);
void pushRequest(const ConnectionId &id, int totalTestCount, Qv2rayLatencyTestingMethod method);
protected:
void run() override;
private:
struct CURLGlobal
{
CURLGlobal()
{
curl_global_init(CURL_GLOBAL_ALL);
}
~CURLGlobal()
{
curl_global_cleanup();
}
};
std::shared_ptr<uvw::Loop> loop;
CURLGlobal curlGlobal;
bool isStop = false;
std::shared_ptr<uvw::TimerHandle> stopTimer;
std::vector<LatencyTestRequest> requests;
std::mutex m;
// static LatencyTestResult TestLatency_p(const ConnectionId &id, const int count);
};
} // namespace Qv2ray::components::latency
| 1,358
|
C++
|
.h
| 47
| 21.425532
| 112
| 0.623755
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,237
|
RealPing.hpp
|
Qv2ray_Qv2ray/src/components/latency/RealPing.hpp
|
#pragma once
#include "LatencyTest.hpp"
#include <curl/curl.h>
#include <memory>
#include <unordered_map>
#include <utility>
namespace uvw
{
class Loop;
class TimerHandle;
} // namespace uvw
namespace Qv2ray::components::latency::realping
{
class RealPing : public std::enable_shared_from_this<RealPing>
{
public:
RealPing(std::shared_ptr<uvw::Loop> loopin, LatencyTestRequest &req, LatencyTestHost *testHost);
~RealPing();
void start();
void notifyTestHost();
void recordHanleTime(CURL *);
long getHandleTime(CURL *);
std::string getProxyAddress();
private:
int successCount = 0;
LatencyTestRequest req;
LatencyTestResult data;
LatencyTestHost *testHost;
std::shared_ptr<uvw::Loop> loop;
std::shared_ptr<uvw::TimerHandle> timeout;
std::unordered_map<CURL *, std::chrono::system_clock::time_point> reqStartTime;
};
} // namespace Qv2ray::components::latency::realping
| 1,014
|
C++
|
.h
| 33
| 25.30303
| 104
| 0.6762
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,238
|
ICMPPing.hpp
|
Qv2ray_Qv2ray/src/components/latency/unix/ICMPPing.hpp
|
#pragma once
#include <QtGlobal>
#ifdef Q_OS_UNIX
#include "../DNSBase.hpp"
#include "uvw.hpp"
#include <QString>
namespace Qv2ray::components::latency::icmping
{
class ICMPPing : public DNSBase<ICMPPing>
{
public:
using DNSBase<ICMPPing>::DNSBase;
~ICMPPing() override;
void start(int ttl = 30);
private:
void ping() override;
bool notifyTestHost();
private:
void deinit();
// number incremented with every echo request packet send
unsigned short seq = 1;
// socket
int socketId = -1;
std::shared_ptr<uvw::TimerHandle> timeoutTimer;
std::shared_ptr<uvw::PollHandle> pollHandle;
std::vector<timeval> startTimevals;
};
} // namespace Qv2ray::components::latency::icmping
#endif
| 815
|
C++
|
.h
| 29
| 22.344828
| 65
| 0.647059
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| true
| false
| true
| false
|
4,239
|
ICMPPing.hpp
|
Qv2ray_Qv2ray/src/components/latency/win/ICMPPing.hpp
|
#pragma once
#include <QtGlobal>
#ifdef Q_OS_WIN
#include "../DNSBase.hpp"
#include <memory>
namespace Qv2ray::components::latency::icmping
{
class ICMPPing : public DNSBase<ICMPPing>
{
public:
using DNSBase<ICMPPing>::DNSBase;
~ICMPPing();
public:
static const uint64_t DEFAULT_TIMEOUT = 10000U;
void start();
bool notifyTestHost(LatencyTestHost *testHost, const ConnectionId &id);
private:
void ping() override;
private:
void pingImpl();
private:
uint64_t timeout = DEFAULT_TIMEOUT;
std::shared_ptr<uvw::TimerHandle> waitHandleTimer;
};
} // namespace Qv2ray::components::latency::icmping
#endif
| 720
|
C++
|
.h
| 26
| 22
| 79
| 0.663265
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| true
| false
| true
| false
|
4,240
|
QvPluginHost.hpp
|
Qv2ray_Qv2ray/src/components/plugins/QvPluginHost.hpp
|
#pragma once
#include "src/plugin-interface/QvPluginInterface.hpp"
#include <QHash>
#include <QMap>
#include <QObject>
#include <memory>
class QPluginLoader;
using namespace Qv2rayPlugin;
namespace Qv2ray::components::plugins
{
struct QvPluginInfo
{
public:
bool isLoaded = false;
QString libraryPath;
QvPluginMetadata metadata;
QPluginLoader *pluginLoader;
Qv2rayInterface *pluginInterface;
bool hasComponent(PluginComponentType t)
{
return metadata.Components.contains(t);
}
};
class QvPluginHost : public QObject
{
Q_OBJECT
public:
explicit QvPluginHost(QObject *parent = nullptr);
~QvPluginHost();
bool GetPluginEnabled(const QString &internalName) const;
void SetPluginEnabled(const QString &internalName, bool isEnabled);
void SavePluginSettings() const;
QvPluginInfo *GetPlugin(const QString &internalName)
{
return plugins.contains(internalName) ? &plugins[internalName] : nullptr;
}
const inline QStringList AllPlugins() const
{
return plugins.keys();
}
const inline QStringList UsablePlugins() const
{
QStringList result;
for (const auto &pluginName : plugins.keys())
if (shouldUsePlugin(pluginName))
result << pluginName;
return result;
}
const QList<std::tuple<QString, QString, QJsonObject>> TryDeserializeShareLink(const QString &sharelink, //
QString *aliasPrefix, //
QString *errMessage, //
QString *newGroupName, //
bool &status) const;
const QString SerializeOutbound(const QString &protocol, //
const QJsonObject &out, //
const QJsonObject &streamSettings, //
const QString &name, //
const QString &group, //
bool *ok) const;
const OutboundInfoObject GetOutboundInfo(const QString &protocol, const QJsonObject &o, bool &status) const;
void SetOutboundInfo(const QString &protocol, const OutboundInfoObject &info, QJsonObject &o) const;
//
void SendEvent(const Events::ConnectionStats::EventObject &object);
void SendEvent(const Events::Connectivity::EventObject &object);
void SendEvent(const Events::ConnectionEntry::EventObject &object);
void SendEvent(const Events::SystemProxy::EventObject &object);
//
private slots:
void QvPluginLog(const QString &log);
void QvPluginMessageBox(const QString &title, const QString &message);
private:
bool shouldUsePlugin(const QString &internalName) const
{
return GetPluginEnabled(internalName) && plugins[internalName].isLoaded;
}
void initializePluginHost();
int refreshPluginList();
bool initializePlugin(const QString &internalName);
void clearPlugins();
// Internal name, plugin info
QHash<QString, QvPluginInfo> plugins;
};
const QStringList GetPluginComponentsString(const QList<PluginGuiComponentType> &types);
const QStringList GetPluginComponentsString(const QList<PluginComponentType> &types);
inline ::Qv2ray::components::plugins::QvPluginHost *PluginHost = nullptr;
} // namespace Qv2ray::components::plugins
using namespace Qv2ray::components::plugins;
| 3,978
|
C++
|
.h
| 87
| 32.183908
| 116
| 0.582474
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,241
|
RouteSchemeIO.hpp
|
Qv2ray_Qv2ray/src/components/route/RouteSchemeIO.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
namespace Qv2ray::components::route
{
const inline QvConfig_Route emptyScheme;
const inline QvConfig_Route noAdsScheme({ {}, { "geosite:category-ads-all" }, {} }, { {}, {}, {} }, "AsIs");
/**
* @brief The Qv2rayRouteScheme struct
* @author DuckSoft <realducksoft@gmail.com>
*/
struct Qv2rayRouteScheme : QvConfig_Route
{
/**
* @brief the name of the scheme.
* @example "Untitled Scheme"
*/
QString name;
/**
* @brief the author of the scheme.
* @example "DuckSoft <realducksoft@gmail.com>"
*/
QString author;
/**
* @brief details of this scheme.
* @example "A scheme to bypass China mainland, while allowing bilibili to go through proxy."
*/
QString description;
// M: all these fields are mandatory
JSONSTRUCT_REGISTER(Qv2rayRouteScheme, F(name, author, description), B(QvConfig_Route));
};
} // namespace Qv2ray::components::route
using namespace Qv2ray::components::route;
| 1,107
|
C++
|
.h
| 32
| 27.75
| 112
| 0.620336
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,242
|
UpdateChecker.hpp
|
Qv2ray_Qv2ray/src/components/update/UpdateChecker.hpp
|
#pragma once
#include <QObject>
namespace Qv2ray::common::network
{
class NetworkRequestHelper;
}
namespace Qv2ray::components
{
struct QvUpdateInfo
{
int channel;
QString tag;
QString title;
QString releaseNotes;
QString downloadLink;
};
class QvUpdateChecker : public QObject
{
Q_OBJECT
public:
explicit QvUpdateChecker(QObject *parent = nullptr);
void CheckUpdate();
~QvUpdateChecker();
signals:
void OnCheckUpdateCompleted(bool hasUpdate, const QvUpdateInfo &updateInfo);
private:
Qv2ray::common::network::NetworkRequestHelper *requestHelper;
void static VersionUpdate(const QByteArray &data);
};
} // namespace Qv2ray::components
using namespace Qv2ray::components;
| 818
|
C++
|
.h
| 31
| 20.645161
| 84
| 0.68798
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,243
|
QvTranslator.hpp
|
Qv2ray_Qv2ray/src/components/translations/QvTranslator.hpp
|
#pragma once
#include <QString>
#include <QTranslator>
#include <memory>
#include <optional>
namespace Qv2ray::common
{
class QvTranslator
{
public:
explicit QvTranslator();
public:
/**
* @brief get the available languages.
* @return (if available) languages (zh_CN, en_US, ...)
*/
const inline QStringList GetAvailableLanguages() const
{
return languages;
}
/**
* @brief reload the translation from file
* @param code eg: en_US, zh_CN, ...
*/
bool InstallTranslation(const QString &);
private:
void refreshTranslations();
QStringList languages;
QStringList searchPaths;
std::unique_ptr<QTranslator> pTranslator;
};
inline std::unique_ptr<common::QvTranslator> Qv2rayTranslator;
} // namespace Qv2ray::common
using namespace Qv2ray::common;
| 933
|
C++
|
.h
| 34
| 20.794118
| 66
| 0.622346
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,244
|
QvGeositeReader.hpp
|
Qv2ray_Qv2ray/src/components/geosite/QvGeositeReader.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
namespace Qv2ray::components::geosite
{
QStringList ReadGeoSiteFromFile(const QString &filepath);
} // namespace Qv2ray::components::geosite
using namespace Qv2ray::components;
using namespace Qv2ray::components::geosite;
| 272
|
C++
|
.h
| 8
| 32.25
| 61
| 0.820611
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| true
| false
| true
| false
|
4,245
|
QvNTPClient.hpp
|
Qv2ray_Qv2ray/src/components/ntp/QvNTPClient.hpp
|
/* This file from part of QNtp, a library that implements NTP protocol.
*
* Copyright (C) 2011 Alexander Fokin <apfokin@gmail.com>
*
* QNtp is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* QNtp is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with QNtp. If not, see <http://www.gnu.org/licenses/>. */
#pragma once
#include "base/Qv2rayFeatures.hpp"
#if QV2RAY_FEATURE(util_has_ntp)
#include <QDateTime>
#include <QHostAddress>
#include <QObject>
#include <QUdpSocket>
#include <QtEndian>
#include <QtGlobal>
namespace Qv2ray::components::ntp
{
const qint64 january_1_1900 = -2208988800000ll;
enum NtpLeapIndicator
{
NoWarning = 0, /**< No warning. */
LastMinute61Warning = 1, /**< Last minute has 61 seconds. */
LastMinute59Warning = 2, /**< Last minute has 59 seconds. */
UnsynchronizedWarning = 3, /**< Alarm condition (clock not synchronized). */
};
enum NtpMode
{
ReservedMode = 0, /**< Reserved. */
SymmetricActiveMode = 1, /**< Symmetric active. */
SymmetricPassiveMode = 2, /**< Symmetric passive. */
ClientMode = 3, /**< Client. */
ServerMode = 4, /**< Server. */
BroadcastMode = 5, /**< Broadcast. */
ControlMode = 6, /**< NTP control message. */
PrivateMode = 7, /**< Reserved for private use. */
};
enum NtpStratum
{
UnspecifiedStratum = 0, /**< Unspecified or unavailable. */
PrimaryStratum = 1, /**< Primary reference (e.g. radio-clock). */
SecondaryStratumFirst = 2, /**< Secondary reference (via NTP or SNTP). */
SecondaryStratumLast = 15,
UnsynchronizedStratum = 16, /**< Unsynchronized. */
/* 17-255 are reserved. */
};
struct NtpPacketFlags
{
unsigned char mode : 3;
unsigned char versionNumber : 3;
unsigned char leapIndicator : 2;
};
#pragma pack(push, 1)
struct NtpTimestamp
{
quint32 seconds;
quint32 fraction;
static inline NtpTimestamp fromDateTime(const QDateTime &dateTime);
static inline QDateTime toDateTime(const NtpTimestamp &ntpTime);
};
struct NtpPacket
{
NtpPacketFlags flags;
quint8 stratum;
qint8 poll;
qint8 precision;
qint32 rootDelay;
qint32 rootDispersion;
qint8 referenceID[4];
NtpTimestamp referenceTimestamp;
NtpTimestamp originateTimestamp;
NtpTimestamp receiveTimestamp;
NtpTimestamp transmitTimestamp;
};
struct NtpAuthenticationInfo
{
quint32 keyId;
quint8 messageDigest[16];
};
struct NtpFullPacket
{
NtpPacket basic;
NtpAuthenticationInfo auth;
};
#pragma pack(pop)
class NtpReplyPrivate : public QSharedData
{
public:
NtpFullPacket packet;
QDateTime destinationTime;
};
class NtpReply
{
public:
NtpReply();
NtpReply(const NtpReply &other);
~NtpReply();
NtpReply &operator=(const NtpReply &other);
NtpLeapIndicator leapIndicator() const;
quint8 versionNumber() const;
NtpMode mode() const;
quint8 stratum() const;
qreal pollInterval() const;
qreal precision() const;
QDateTime referenceTime() const;
QDateTime originTime() const;
QDateTime receiveTime() const;
QDateTime transmitTime() const;
QDateTime destinationTime() const;
qint64 roundTripDelay() const;
qint64 localClockOffset() const;
bool isNull() const;
protected:
friend class NtpClient;
NtpReply(NtpReplyPrivate *dd);
private:
QSharedDataPointer<NtpReplyPrivate> d;
};
class NtpClient : public QObject
{
Q_OBJECT
public:
NtpClient(QObject *parent = NULL);
NtpClient(const QHostAddress &bindAddress, quint16 bindPort, QObject *parent = NULL);
virtual ~NtpClient();
bool sendRequest(const QHostAddress &address, quint16 port);
Q_SIGNALS:
void replyReceived(const QHostAddress &address, quint16 port, const NtpReply &reply);
private Q_SLOTS:
void readPendingDatagrams();
private:
void init(const QHostAddress &bindAddress, quint16 bindPort);
QUdpSocket *mSocket;
};
} // namespace Qv2ray::components::ntp
#endif
| 4,988
|
C++
|
.h
| 145
| 27.703448
| 93
| 0.643154
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,246
|
QvPortDetector.hpp
|
Qv2ray_Qv2ray/src/components/port/QvPortDetector.hpp
|
#pragma once
#include <QString>
namespace Qv2ray::components::port
{
bool CheckTCPPortStatus(const QString &addr, int port);
inline bool CheckTCPPortStatus(std::pair<QString, int> config)
{
return CheckTCPPortStatus(config.first, config.second);
}
} // namespace Qv2ray::components::port
| 312
|
C++
|
.h
| 10
| 27.8
| 66
| 0.745033
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,247
|
BuiltinProtocolPlugin.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/BuiltinProtocolPlugin.hpp
|
#pragma once
#include "QvPluginInterface.hpp"
#include <QObject>
#include <QtPlugin>
using namespace Qv2rayPlugin;
class InternalProtocolSupportPlugin
: public QObject
, public Qv2rayInterface
{
Q_INTERFACES(Qv2rayPlugin::Qv2rayInterface)
Q_PLUGIN_METADATA(IID Qv2rayInterface_IID)
Q_OBJECT
public:
//
// Basic metainfo of this plugin
const QvPluginMetadata GetMetadata() const override
{
return { "Builtin Protocol Support", //
"Qv2ray Core Workgroup", //
"qvplugin_builtin_protocol", //
"VMess, VLESS, SOCKS, HTTP, Shadowsocks, DNS, Dokodemo-door editor support", //
QV2RAY_VERSION_STRING, //
"Qv2ray/Qv2ray", //
{
COMPONENT_OUTBOUND_HANDLER, //
COMPONENT_GUI //
},
UPDATE_NONE };
}
bool InitializePlugin(const QString &, const QJsonObject &) override;
//
signals:
void PluginLog(const QString &) const override;
void PluginErrorMessageBox(const QString &, const QString &) const override;
};
DECLARE_PLUGIN_INSTANCE(InternalProtocolSupportPlugin);
| 1,480
|
C++
|
.h
| 36
| 33.111111
| 96
| 0.511127
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,248
|
OutboundHandler.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/core/OutboundHandler.hpp
|
#pragma once
#include "CommonTypes.hpp"
#include "QvPluginProcessor.hpp"
class BuiltinSerializer : public Qv2rayPlugin::PluginOutboundHandler
{
public:
explicit BuiltinSerializer() : Qv2rayPlugin::PluginOutboundHandler(){};
const QString SerializeOutbound(const QString &protocol, const QString &name, const QString &group, const QJsonObject &obj,
const QJsonObject &stream) const override;
const QPair<QString, QJsonObject> DeserializeOutbound(const QString &link, QString *alias, QString *errorMessage) const override;
const Qv2rayPlugin::OutboundInfoObject GetOutboundInfo(const QString &protocol, const QJsonObject &outbound) const override;
const void SetOutboundInfo(const QString &protocol, const Qv2rayPlugin::OutboundInfoObject &info, QJsonObject &outbound) const override;
const QList<QString> SupportedLinkPrefixes() const override;
const QList<QString> SupportedProtocols() const override
{
return { "http", "socks", "shadowsocks", "vmess", "vless" };
}
};
| 1,052
|
C++
|
.h
| 18
| 52.833333
| 140
| 0.757986
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,249
|
Interface.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/Interface.hpp
|
#include "PluginSettingsWidget.hpp"
#include "QvGUIPluginInterface.hpp"
//
#include "inbound/dokodemo-door.hpp"
#include "inbound/httpin.hpp"
#include "inbound/socksin.hpp"
//
#include "outbound/blackhole.hpp"
#include "outbound/dns.hpp"
#include "outbound/freedom.hpp"
#include "outbound/httpout.hpp"
#include "outbound/loopback.hpp"
#include "outbound/shadowsocks.hpp"
#include "outbound/socksout.hpp"
#include "outbound/vless.hpp"
#include "outbound/vmess.hpp"
using namespace Qv2rayPlugin;
class ProtocolGUIInterface : public PluginGUIInterface
{
public:
explicit ProtocolGUIInterface(){};
~ProtocolGUIInterface(){};
QList<PluginGuiComponentType> GetComponents() const override
{
return {
GUI_COMPONENT_INBOUND_EDITOR, //
GUI_COMPONENT_OUTBOUND_EDITOR //
};
}
std::unique_ptr<QvPluginSettingsWidget> createSettingsWidgets() const override
{
return std::make_unique<SimplePluginSettingsWidget>();
}
QList<typed_plugin_editor> createInboundEditors() const override
{
return {
MakeEditorInfoPair<HTTPInboundEditor>("http", "HTTP"),
MakeEditorInfoPair<SocksInboundEditor>("socks", "SOCKS"),
MakeEditorInfoPair<DokodemoDoorInboundEditor>("dokodemo-door", "Dokodemo-Door"),
};
}
QList<typed_plugin_editor> createOutboundEditors() const override
{
return {
MakeEditorInfoPair<VmessOutboundEditor>("vmess", "VMess"), //
MakeEditorInfoPair<VlessOutboundEditor>("vless", "VLESS"), //
MakeEditorInfoPair<ShadowsocksOutboundEditor>("shadowsocks", "Shadowsocks"), //
MakeEditorInfoPair<HttpOutboundEditor>("http", "HTTP"), //
MakeEditorInfoPair<SocksOutboundEditor>("socks", "SOCKS"), //
MakeEditorInfoPair<FreedomOutboundEditor>("freedom", "Freedom"), //
MakeEditorInfoPair<BlackholeOutboundEditor>("blackhole", "Blackhole"), //
MakeEditorInfoPair<DnsOutboundEditor>("dns", "DNS"), //
MakeEditorInfoPair<LoopbackSettingsEditor>("loopback", "Loopback"), //
};
}
std::unique_ptr<QvPluginMainWindowWidget> createMainWindowWidget() const override
{
return nullptr;
}
QIcon Icon() const override
{
return QIcon(":/assets/qv2ray.png");
}
};
| 2,477
|
C++
|
.h
| 64
| 32.640625
| 92
| 0.656574
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,251
|
httpout.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/httpout.hpp
|
#pragma once
#include "CommonTypes.hpp"
#include "QvGUIPluginInterface.hpp"
#include "ui_httpout.h"
class HttpOutboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::httpOutEditor
{
Q_OBJECT
public:
explicit HttpOutboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &server, int port) override
{
http.address = server;
http.port = port;
}
QPair<QString, int> GetHostAddress() const override
{
return { http.address, http.port };
}
void SetContent(const QJsonObject &source) override
{
auto servers = source["servers"].toArray();
if (servers.isEmpty())
return;
const auto content = servers.first().toObject();
http.loadJson(content);
PLUGIN_EDITOR_LOADING_SCOPE({
if (http.users.isEmpty())
http.users.push_back({});
http_UserNameTxt->setText(http.users.first().user);
http_PasswordTxt->setText(http.users.first().pass);
})
}
const QJsonObject GetContent() const override
{
auto result = http.toJson();
if (http.users.isEmpty() || (http.users.first().user.isEmpty() && http.users.first().pass.isEmpty()))
result.remove("users");
return QJsonObject{ { "servers", QJsonArray{ result } } };
}
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_http_PasswordTxt_textEdited(const QString &arg1);
void on_http_UserNameTxt_textEdited(const QString &arg1);
private:
HttpServerObject http;
};
| 1,607
|
C++
|
.h
| 49
| 26.285714
| 109
| 0.651163
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,252
|
blackhole.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/blackhole.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
#include "ui_blackhole.h"
class BlackholeOutboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::blackholeOutEditor
{
Q_OBJECT
public:
explicit BlackholeOutboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &, int) override{};
QPair<QString, int> GetHostAddress() const override
{
return {};
};
void SetContent(const QJsonObject &content) override;
const QJsonObject GetContent() const override
{
return content;
};
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_responseTypeCB_currentTextChanged(const QString &arg1);
};
| 714
|
C++
|
.h
| 25
| 24.2
| 67
| 0.733529
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,253
|
dns.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/dns.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
#include "ui_dns.h"
class DnsOutboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::dnsOutEditor
{
Q_OBJECT
public:
explicit DnsOutboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &, int) override{};
QPair<QString, int> GetHostAddress() const override
{
return {};
};
void SetContent(const QJsonObject &_content) override
{
this->content = _content;
PLUGIN_EDITOR_LOADING_SCOPE({
if (content.contains("network"))
{
tcpCB->setChecked(content["network"] == "tcp");
udpCB->setChecked(content["network"] == "udp");
}
else
{
originalCB->setChecked(true);
}
if (content.contains("address"))
addressTxt->setText(content["address"].toString());
if (content.contains("port"))
portSB->setValue(content["port"].toInt());
})
};
const QJsonObject GetContent() const override
{
return content;
};
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_tcpCB_clicked();
void on_udpCB_clicked();
void on_originalCB_clicked();
void on_addressTxt_textEdited(const QString &arg1);
void on_portSB_valueChanged(int arg1);
};
| 1,416
|
C++
|
.h
| 47
| 22.553191
| 67
| 0.607195
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,254
|
freedom.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/freedom.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
#include "ui_freedom.h"
class FreedomOutboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::freedomOutEditor
{
Q_OBJECT
public:
explicit FreedomOutboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &, int) override{};
QPair<QString, int> GetHostAddress() const override
{
return {};
};
void SetContent(const QJsonObject &content) override
{
this->content = content;
PLUGIN_EDITOR_LOADING_SCOPE({
DSCB->setCurrentText(content["domainStrategy"].toString());
redirectTxt->setText(content["redirect"].toString());
})
};
const QJsonObject GetContent() const override
{
return content;
};
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_DSCB_currentTextChanged(const QString &arg1);
void on_redirectTxt_textEdited(const QString &arg1);
};
| 986
|
C++
|
.h
| 33
| 24.484848
| 71
| 0.693446
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,255
|
loopback.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/loopback.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
#include "ui_loopback.h"
class LoopbackSettingsEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::loopback
{
Q_OBJECT
public:
explicit LoopbackSettingsEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &, int){};
QPair<QString, int> GetHostAddress() const
{
return {};
};
void SetContent(const QJsonObject &content)
{
loopbackSettings = content;
inboundTagTxt->setText(content["inboundTag"].toString());
}
const QJsonObject GetContent() const
{
return loopbackSettings;
}
protected:
void changeEvent(QEvent *e);
private slots:
void on_inboundTagTxt_textEdited(const QString &arg1);
private:
QJsonObject loopbackSettings;
};
| 815
|
C++
|
.h
| 31
| 21.548387
| 65
| 0.708763
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,256
|
vmess.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/vmess.hpp
|
#pragma once
#include "CommonTypes.hpp"
#include "QvGUIPluginInterface.hpp"
#include "ui_vmess.h"
class VmessOutboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::vmessOutEditor
{
Q_OBJECT
public:
explicit VmessOutboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &addr, int port) override
{
vmess.address = addr;
vmess.port = port;
}
QPair<QString, int> GetHostAddress() const override
{
return { vmess.address, vmess.port };
}
void SetContent(const QJsonObject &content) override;
const QJsonObject GetContent() const override
{
auto result = content;
QJsonArray vnext;
vnext.append(vmess.toJson());
result.insert("vnext", vnext);
return result;
}
private:
VMessServerObject vmess;
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_idLineEdit_textEdited(const QString &arg1);
void on_securityCombo_currentTextChanged(const QString &arg1);
void on_alterLineEdit_valueChanged(int arg1);
};
| 1,106
|
C++
|
.h
| 38
| 23.973684
| 66
| 0.705382
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,258
|
socksout.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/socksout.hpp
|
#pragma once
#include "CommonTypes.hpp"
#include "QvGUIPluginInterface.hpp"
#include "ui_socksout.h"
class SocksOutboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::socksOutEditor
{
Q_OBJECT
public:
explicit SocksOutboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &server, int port) override
{
socks.address = server;
socks.port = port;
}
QPair<QString, int> GetHostAddress() const override
{
return { socks.address, socks.port };
}
void SetContent(const QJsonObject &source) override
{
auto servers = source["servers"].toArray();
if (servers.isEmpty())
return;
const auto content = servers.first().toObject();
socks.loadJson(content);
PLUGIN_EDITOR_LOADING_SCOPE({
if (socks.users.isEmpty())
socks.users.push_back({});
socks_UserNameTxt->setText(socks.users.first().user);
socks_PasswordTxt->setText(socks.users.first().pass);
})
}
const QJsonObject GetContent() const override
{
auto result = socks.toJson();
if (socks.users.isEmpty() || (socks.users.first().user.isEmpty() && socks.users.first().pass.isEmpty()))
result.remove("users");
return QJsonObject{ { "servers", QJsonArray{ result } } };
}
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_socks_UserNameTxt_textEdited(const QString &arg1);
void on_socks_PasswordTxt_textEdited(const QString &arg1);
private:
SocksServerObject socks;
};
| 1,630
|
C++
|
.h
| 49
| 26.755102
| 112
| 0.65627
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,259
|
shadowsocks.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/shadowsocks.hpp
|
#pragma once
#include "CommonTypes.hpp"
#include "QvGUIPluginInterface.hpp"
#include "ui_shadowsocks.h"
class ShadowsocksOutboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::shadowsocksOutEditor
{
Q_OBJECT
public:
explicit ShadowsocksOutboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &addr, int port) override
{
shadowsocks.address = addr;
shadowsocks.port = port;
};
QPair<QString, int> GetHostAddress() const override
{
return { shadowsocks.address, shadowsocks.port };
};
void SetContent(const QJsonObject &content) override
{
PLUGIN_EDITOR_LOADING_SCOPE({
if (content["servers"].toArray().isEmpty())
content["servers"] = QJsonArray{ QJsonObject{} };
// ShadowSocks Configs
shadowsocks = ShadowSocksServerObject::fromJson(content["servers"].toArray().first().toObject());
ss_passwordTxt->setText(shadowsocks.password);
ss_encryptionMethod->setCurrentText(shadowsocks.method);
})
}
const QJsonObject GetContent() const override
{
auto result = content;
QJsonArray servers;
servers.append(shadowsocks.toJson());
result.insert("servers", servers);
return result;
}
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_ss_encryptionMethod_currentTextChanged(const QString &arg1);
void on_ss_passwordTxt_textEdited(const QString &arg1);
private:
ShadowSocksServerObject shadowsocks;
};
| 1,596
|
C++
|
.h
| 47
| 27.595745
| 109
| 0.689163
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,260
|
vless.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/outbound/vless.hpp
|
#pragma once
#include "CommonTypes.hpp"
#include "QvGUIPluginInterface.hpp"
#include "ui_vless.h"
class VlessOutboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::vlessOutEditor
{
Q_OBJECT
public:
explicit VlessOutboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &addr, int port) override
{
vless.address = addr;
vless.port = port;
}
QPair<QString, int> GetHostAddress() const override
{
return { vless.address, vless.port };
}
void SetContent(const QJsonObject &content) override
{
this->content = content;
PLUGIN_EDITOR_LOADING_SCOPE({
if (content["vnext"].toArray().isEmpty())
content["vnext"] = QJsonArray{ QJsonObject{} };
vless = VLESSServerObject::fromJson(content["vnext"].toArray().first().toObject());
if (vless.users.isEmpty())
vless.users.push_back({});
const auto &user = vless.users.front();
vLessIDTxt->setText(user.id);
vLessSecurityCombo->setCurrentText(user.encryption);
flowCombo->setCurrentText(user.flow);
})
}
const QJsonObject GetContent() const override
{
auto result = content;
QJsonArray vnext;
vnext.append(vless.toJson());
result.insert("vnext", vnext);
return result;
}
protected:
void changeEvent(QEvent *e) override;
private:
VLESSServerObject vless;
private slots:
void on_flowCombo_currentTextChanged(const QString &arg1);
void on_vLessIDTxt_textEdited(const QString &arg1);
void on_vLessSecurityCombo_currentTextChanged(const QString &arg1);
};
| 1,722
|
C++
|
.h
| 52
| 26.25
| 95
| 0.658037
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,261
|
dokodemo-door.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/inbound/dokodemo-door.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
#include "ui_dokodemo-door.h"
class DokodemoDoorInboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::dokodemodoorInEditor
{
Q_OBJECT
public:
explicit DokodemoDoorInboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &, int) override{};
QPair<QString, int> GetHostAddress() const override
{
return {};
}
void SetContent(const QJsonObject &content) override;
const QJsonObject GetContent() const override;
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_dokoFollowRedirectCB_stateChanged(int arg1);
void on_dokoIPAddrTxt_textEdited(const QString &arg1);
void on_dokoPortSB_valueChanged(int arg1);
void on_dokoTCPCB_stateChanged(int arg1);
void on_dokoUDPCB_stateChanged(int arg1);
void on_dokoTimeoutSB_valueChanged(int arg1);
};
| 925
|
C++
|
.h
| 27
| 29.962963
| 66
| 0.756453
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,263
|
httpin.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/inbound/httpin.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
#include "ui_httpin.h"
#include <QJsonArray>
class HTTPInboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::httpInEditor
{
Q_OBJECT
public:
explicit HTTPInboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &, int) override{};
QPair<QString, int> GetHostAddress() const override
{
return {};
};
void SetContent(const QJsonObject &content) override;
const QJsonObject GetContent() const override
{
auto newObject = content;
// Remove useless, misleading 'accounts' array.
if (newObject["accounts"].toArray().count() == 0)
{
newObject.remove("accounts");
}
return newObject;
}
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_httpTimeoutSpinBox_valueChanged(int arg1);
void on_httpTransparentCB_stateChanged(int arg1);
void on_httpRemoveUserBtn_clicked();
void on_httpAddUserBtn_clicked();
};
| 1,052
|
C++
|
.h
| 35
| 24.657143
| 58
| 0.694527
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,264
|
socksin.hpp
|
Qv2ray_Qv2ray/src/plugins/protocols/ui/inbound/socksin.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
#include "ui_socksin.h"
#include <QJsonArray>
class SocksInboundEditor
: public Qv2rayPlugin::QvPluginEditor
, private Ui::socksInEditor
{
Q_OBJECT
public:
explicit SocksInboundEditor(QWidget *parent = nullptr);
void SetHostAddress(const QString &, int) override{};
QPair<QString, int> GetHostAddress() const override
{
return {};
};
void SetContent(const QJsonObject &content) override;
const QJsonObject GetContent() const override
{
return content;
};
private slots:
void on_socksUDPCB_stateChanged(int arg1);
void on_socksUDPIPAddrTxt_textEdited(const QString &arg1);
void on_socksRemoveUserBtn_clicked();
void on_socksAddUserBtn_clicked();
void on_socksAuthCombo_currentIndexChanged(int arg1);
protected:
void changeEvent(QEvent *e) override;
};
| 907
|
C++
|
.h
| 30
| 25.666667
| 62
| 0.736111
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,265
|
BuiltinUtils.hpp
|
Qv2ray_Qv2ray/src/plugins/utils/BuiltinUtils.hpp
|
#pragma once
#include "QvPluginInterface.hpp"
#include <QObject>
#include <QtPlugin>
using namespace Qv2rayPlugin;
class InternalUtilsPlugin
: public QObject
, public Qv2rayInterface
{
Q_INTERFACES(Qv2rayPlugin::Qv2rayInterface)
Q_PLUGIN_METADATA(IID Qv2rayInterface_IID)
Q_OBJECT
public:
const QvPluginMetadata GetMetadata() const override
{
return { "Builtin Ultilities", //
"Qv2ray Core Workgroup", //
"builtin_utils", //
"Some useful ultilities for Qv2ray", //
QV2RAY_VERSION_STRING, //
"Qv2ray/Qv2ray", //
{ COMPONENT_EVENT_HANDLER, COMPONENT_GUI },
UPDATE_NONE };
}
bool InitializePlugin(const QString &, const QJsonObject &) override;
signals:
void PluginLog(const QString &) const override;
void PluginErrorMessageBox(const QString &, const QString &) const override;
};
| 1,041
|
C++
|
.h
| 29
| 28.655172
| 80
| 0.59841
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,266
|
GUIInterface.hpp
|
Qv2ray_Qv2ray/src/plugins/utils/core/GUIInterface.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
class GUIInterface : public Qv2rayPlugin::PluginGUIInterface
{
public:
GUIInterface();
QIcon Icon() const override
{
return QIcon(":/assets/qv2ray.png");
}
QList<Qv2rayPlugin::PluginGuiComponentType> GetComponents() const override
{
return { Qv2rayPlugin::GUI_COMPONENT_MAINWINDOW_WIDGET };
}
private:
QList<typed_plugin_editor> createInboundEditors() const override;
QList<typed_plugin_editor> createOutboundEditors() const override;
std::unique_ptr<Qv2rayPlugin::QvPluginSettingsWidget> createSettingsWidgets() const override;
std::unique_ptr<Qv2rayPlugin::QvPluginMainWindowWidget> createMainWindowWidget() const override;
};
| 745
|
C++
|
.h
| 20
| 32.9
| 100
| 0.763158
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,267
|
EventHandler.hpp
|
Qv2ray_Qv2ray/src/plugins/utils/core/EventHandler.hpp
|
#pragma once
#include "QvPluginInterface.hpp"
#include <QtCore/qglobal.h>
class EventHandler : public Qv2rayPlugin::PluginEventHandler
{
public:
EventHandler();
QvPlugin_EventHandler_Decl(ConnectionStats);
QvPlugin_EventHandler_Decl(SystemProxy);
QvPlugin_EventHandler_Decl(Connectivity);
QvPlugin_EventHandler_Decl(ConnectionEntry);
};
| 363
|
C++
|
.h
| 12
| 27.083333
| 60
| 0.801153
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,268
|
MainWindowWidget.hpp
|
Qv2ray_Qv2ray/src/plugins/utils/core/MainWindowWidget.hpp
|
#pragma once
#include "QvGUIPluginInterface.hpp"
#include "ui_MainWindowWidget.h"
class MainWindowWidget
: public Qv2rayPlugin::QvPluginMainWindowWidget
, private Ui::MainWindowWidget
{
Q_OBJECT
public:
explicit MainWindowWidget(QWidget *parent = nullptr);
const QList<QMenu *> GetMenus() override
{
return {};
}
protected:
void changeEvent(QEvent *e) override;
};
| 413
|
C++
|
.h
| 17
| 20.470588
| 57
| 0.732143
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,269
|
CommonTypes.hpp
|
Qv2ray_Qv2ray/src/plugins/common/CommonTypes.hpp
|
#pragma once
#include "QJsonStruct.hpp"
// GUI TOOLS
#define RED(obj) \
{ \
auto _temp = obj->palette(); \
_temp.setColor(QPalette::Text, Qt::red); \
obj->setPalette(_temp); \
}
#define BLACK(obj) obj->setPalette(QWidget::palette());
struct HTTPSOCKSUserObject
{
QString user;
QString pass;
int level = 0;
JSONSTRUCT_COMPARE(HTTPSOCKSUserObject, user, pass, level)
JSONSTRUCT_REGISTER(HTTPSOCKSUserObject, F(user, pass, level))
};
//
// Socks, OutBound
struct SocksServerObject
{
QString address = "0.0.0.0";
int port = 0;
QList<HTTPSOCKSUserObject> users;
JSONSTRUCT_COMPARE(SocksServerObject, address, port, users)
JSONSTRUCT_REGISTER(SocksServerObject, F(address, port, users))
};
//
// Http, OutBound
struct HttpServerObject
{
QString address = "0.0.0.0";
int port = 0;
QList<HTTPSOCKSUserObject> users;
JSONSTRUCT_COMPARE(HttpServerObject, address, port, users)
JSONSTRUCT_REGISTER(HttpServerObject, F(address, port, users))
};
//
// ShadowSocks Server
struct ShadowSocksServerObject
{
QString address = "0.0.0.0";
QString method = "aes-256-gcm";
QString password;
int port = 0;
JSONSTRUCT_COMPARE(ShadowSocksServerObject, address, method, password)
JSONSTRUCT_REGISTER(ShadowSocksServerObject, A(method), F(address, port, password))
};
//
// VLESS Server
struct VLESSServerObject
{
struct UserObject
{
QString id;
QString encryption = "none";
QString flow;
JSONSTRUCT_COMPARE(UserObject, id, encryption, flow)
JSONSTRUCT_REGISTER(UserObject, A(encryption), F(id, flow))
};
QString address;
int port = 0;
QList<UserObject> users;
JSONSTRUCT_COMPARE(VLESSServerObject, address, port, users)
JSONSTRUCT_REGISTER(VLESSServerObject, F(address, port, users))
};
//
// VMess Server
constexpr auto VMESS_USER_ALTERID_DEFAULT = 0;
struct VMessServerObject
{
struct UserObject
{
QString id;
int alterId = VMESS_USER_ALTERID_DEFAULT;
QString security = "auto";
int level = 0;
JSONSTRUCT_COMPARE(UserObject, id, alterId, security, level)
JSONSTRUCT_REGISTER(UserObject, F(id, alterId, security, level))
};
QString address;
int port = 0;
QList<UserObject> users;
JSONSTRUCT_COMPARE(VMessServerObject, address, port, users)
JSONSTRUCT_REGISTER(VMessServerObject, F(address, port, users))
};
| 3,064
|
C++
|
.h
| 87
| 31.034483
| 150
| 0.558288
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,270
|
BuiltinSubscriptionAdapter.hpp
|
Qv2ray_Qv2ray/src/plugins/subscription-adapters/BuiltinSubscriptionAdapter.hpp
|
#pragma once
#include "QvPluginInterface.hpp"
#include <QObject>
#include <QtPlugin>
using namespace Qv2rayPlugin;
class InternalSubscriptionSupportPlugin
: public QObject
, public Qv2rayInterface
{
Q_INTERFACES(Qv2rayPlugin::Qv2rayInterface)
Q_PLUGIN_METADATA(IID Qv2rayInterface_IID)
Q_OBJECT
public:
//
// Basic metainfo of this plugin
const QvPluginMetadata GetMetadata() const override
{
return { "Builtin Subscription Support", //
"Qv2ray Core Workgroup", //
"builtin_subscription_support", //
"Basic subscription support for Qv2ray", //
QV2RAY_VERSION_STRING, //
"Qv2ray/Qv2ray", //
{ COMPONENT_SUBSCRIPTION_ADAPTER },
UPDATE_NONE };
}
bool InitializePlugin(const QString &, const QJsonObject &) override;
//
signals:
void PluginLog(const QString &) const override;
void PluginErrorMessageBox(const QString &, const QString &) const override;
};
| 1,121
|
C++
|
.h
| 32
| 28.03125
| 80
| 0.611624
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,271
|
SubscriptionAdapter.hpp
|
Qv2ray_Qv2ray/src/plugins/subscription-adapters/core/SubscriptionAdapter.hpp
|
#pragma once
#include "CommonTypes.hpp"
#include "QvPluginProcessor.hpp"
#include <QRegularExpression>
using namespace Qv2rayPlugin;
const inline QStringList SplitLines(const QString &_string)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return _string.split(QRegularExpression("[\r\n]"), Qt::SplitBehaviorFlags::SkipEmptyParts);
#else
return _string.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
#endif
}
class SimpleBase64Decoder : public Qv2rayPlugin::SubscriptionDecoder
{
public:
explicit SimpleBase64Decoder() : SubscriptionDecoder(){};
SubscriptionDecodeResult DecodeData(const QByteArray &data) const override;
};
class SIP008Decoder : public Qv2rayPlugin::SubscriptionDecoder
{
public:
explicit SIP008Decoder() : SubscriptionDecoder(){};
SubscriptionDecodeResult DecodeData(const QByteArray &data) const override;
};
class BuiltinSubscriptionAdapterInterface : public SubscriptionInterface
{
public:
explicit BuiltinSubscriptionAdapterInterface() : SubscriptionInterface()
{
simple_base64 = std::make_shared<SimpleBase64Decoder>();
sip008 = std::make_shared<SIP008Decoder>();
}
QList<Qv2rayPlugin::ProtocolInfoObject> SupportedSubscriptionTypes() const override
{
// "simple_base64" = magic value in Qv2ray main application
return {
ProtocolInfoObject{ "sip008", "SIP008" }, //
ProtocolInfoObject{ "simple_base64", "Basic Base64" } //
};
}
std::shared_ptr<Qv2rayPlugin::SubscriptionDecoder> GetSubscriptionDecoder(const QString &type) const override
{
if (type == "simple_base64")
return simple_base64;
if (type == "sip008")
return sip008;
return nullptr;
}
std::shared_ptr<SubscriptionDecoder> simple_base64;
std::shared_ptr<SubscriptionDecoder> sip008;
};
| 1,892
|
C++
|
.h
| 52
| 31.634615
| 113
| 0.725287
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,273
|
HTTPRequestHelper.hpp
|
Qv2ray_Qv2ray/src/utils/HTTPRequestHelper.hpp
|
#pragma once
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QObject>
#include <functional>
namespace Qv2ray::common::network
{
class NetworkRequestHelper : QObject
{
Q_OBJECT
explicit NetworkRequestHelper(QObject *parent) : QObject(parent){};
~NetworkRequestHelper(){};
public:
static void AsyncHttpGet(const QString &url, std::function<void(const QByteArray &)> funcPtr);
static QByteArray HttpGet(const QUrl &url);
private:
static void setAccessManagerAttributes(QNetworkRequest &request, QNetworkAccessManager &accessManager);
static void setHeader(QNetworkRequest &request, const QByteArray &key, const QByteArray &value);
};
} // namespace Qv2ray::common::network
using namespace Qv2ray::common::network;
| 843
|
C++
|
.h
| 22
| 33.454545
| 111
| 0.742647
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,274
|
Qv2rayPlatformApplication.hpp
|
Qv2ray_Qv2ray/src/ui/Qv2rayPlatformApplication.hpp
|
#pragma once
#include "base/Qv2rayBaseApplication.hpp"
#include "components/translations/QvTranslator.hpp"
#include "core/handler/ConfigHandler.hpp"
#include "core/handler/RouteHandler.hpp"
#include "core/settings/SettingsBackend.hpp"
#include "utils/QvHelpers.hpp"
#ifndef QV2RAY_NO_SINGLEAPPLICATON
#ifdef Q_OS_ANDROID
// No SingleApplication on Android platform
#define QV2RAY_NO_SINGLEAPPLICATON
#elif QV2RAY_WORKAROUND_MACOS_MEMLOCK
// No SingleApplication on macOS locking error
#define QV2RAY_NO_SINGLEAPPLICATON
#endif
#endif
#ifdef Q_OS_WIN
#include <windows.h>
#endif
#ifdef QV2RAY_GUI
#include <QApplication>
#include <QMessageBox>
const static inline QMap<MessageOpt, QMessageBox::StandardButton> MessageBoxButtonMap //
= { { No, QMessageBox::No },
{ OK, QMessageBox::Ok },
{ Yes, QMessageBox::Yes },
{ Cancel, QMessageBox::Cancel },
{ Ignore, QMessageBox::Ignore } };
#else
#include <QCoreApplication>
#endif
#ifndef QV2RAY_NO_SINGLEAPPLICATON
#include <SingleApplication>
#define QVBASEAPPLICATION SingleApplication
#define QVBASEAPPLICATION_CTORARGS argc, argv, true, User | ExcludeAppPath | ExcludeAppVersion
#else
#define QVBASEAPPLICATION QAPPLICATION_CLASS
#define QVBASEAPPLICATION_CTORARGS argc, argv
#endif
class Qv2rayPlatformApplication
: public QVBASEAPPLICATION
, public Qv2rayApplicationInterface
{
Q_OBJECT
public:
Qv2rayPlatformApplication(int &argc, char *argv[]) : QVBASEAPPLICATION(QVBASEAPPLICATION_CTORARGS), Qv2rayApplicationInterface(){};
virtual ~Qv2rayPlatformApplication(){};
virtual Qv2rayExitReason GetExitReason() const final
{
return _exitReason;
}
virtual QStringList CheckPrerequisites() final;
virtual bool Initialize() final;
virtual Qv2rayExitReason RunQv2ray() final;
protected:
virtual QStringList checkPrerequisitesInternal() = 0;
virtual Qv2rayExitReason runQv2rayInternal() = 0;
virtual void terminateUIInternal() = 0;
virtual void SetExitReason(Qv2rayExitReason r) final
{
_exitReason = r;
}
#ifndef QV2RAY_NO_SINGLEAPPLICATON
virtual void onMessageReceived(quint32 clientId, QByteArray msg) = 0;
#endif
private:
void quitInternal();
Qv2rayExitReason _exitReason;
bool parseCommandLine(QString *errorMessage, bool *canContinue);
};
| 2,338
|
C++
|
.h
| 70
| 30.228571
| 135
| 0.780337
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,275
|
Qv2rayWidgetApplication.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/Qv2rayWidgetApplication.hpp
|
#pragma once
#include "ui/Qv2rayPlatformApplication.hpp"
#include <QSystemTrayIcon>
class MainWindow;
namespace Qv2ray
{
class Qv2rayWidgetApplication : public Qv2rayPlatformApplication
{
Q_OBJECT
public:
explicit Qv2rayWidgetApplication(int &argc, char *argv[]);
QJsonObject UIStates;
public:
void MessageBoxWarn(QWidget *parent, const QString &title, const QString &text) override;
void MessageBoxInfo(QWidget *parent, const QString &title, const QString &text) override;
MessageOpt MessageBoxAsk(QWidget *parent, const QString &title, const QString &text, const QList<MessageOpt> &buttons) override;
void ShowTrayMessage(const QString &m, int msecs = 10000);
void OpenURL(const QString &url) override;
inline QSystemTrayIcon **GetTrayIcon()
{
return &hTray;
}
private:
QStringList checkPrerequisitesInternal() override;
Qv2rayExitReason runQv2rayInternal() override;
bool isInitialized;
void terminateUIInternal() override;
#ifndef QV2RAY_NO_SINGLEAPPLICATON
void onMessageReceived(quint32 clientID, QByteArray msg) override;
#endif
QSystemTrayIcon *hTray;
MainWindow *mainWindow;
};
} // namespace Qv2ray
#ifdef Qv2rayApplication
#undef Qv2rayApplication
#endif
#define Qv2rayApplication Qv2rayWidgetApplication
#define QvWidgetApplication static_cast<Qv2rayWidgetApplication *>(qApp)
#define qvAppTrayIcon (*(QvWidgetApplication->GetTrayIcon()))
using namespace Qv2ray;
| 1,571
|
C++
|
.h
| 41
| 32.536585
| 136
| 0.740789
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,276
|
ConnectionModelHelper.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/models/ConnectionModelHelper.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include <QStandardItem>
#include <QStandardItemModel>
#include <QTreeView>
namespace Qv2ray::ui::widgets::models
{
enum ConnectionInfoRole
{
// 10 -> Magic value.
ROLE_DISPLAYNAME = Qt::UserRole + 10,
ROLE_LATENCY,
ROLE_IMPORTTIME,
ROLE_LAST_CONNECTED_TIME,
ROLE_DATA_USAGE
};
class ConnectionListHelper : public QObject
{
Q_OBJECT
public:
ConnectionListHelper(QTreeView *parentView, QObject *parent = nullptr);
~ConnectionListHelper();
void Sort(ConnectionInfoRole, Qt::SortOrder);
void Filter(const QString &);
inline QModelIndex GetConnectionPairIndex(const ConnectionGroupPair &id) const
{
return model->indexFromItem(pairs[id]);
}
inline QModelIndex GetGroupIndex(const GroupId &id) const
{
return model->indexFromItem(groups[id]);
}
private:
QStandardItem *addConnectionItem(const ConnectionGroupPair &id);
QStandardItem *addGroupItem(const GroupId &groupId);
void OnGroupCreated(const GroupId &id, const QString &displayName);
void OnGroupDeleted(const GroupId &id, const QList<ConnectionId> &connections);
void OnConnectionCreated(const ConnectionGroupPair &Id, const QString &displayName);
void OnConnectionDeleted(const ConnectionGroupPair &Id);
void OnConnectionLinkedWithGroup(const ConnectionGroupPair &id);
private:
QTreeView *parentView;
QStandardItemModel *model;
//
QHash<GroupId, QStandardItem *> groups;
QHash<ConnectionGroupPair, QStandardItem *> pairs;
QHash<ConnectionId, QList<QStandardItem *>> connections;
};
} // namespace Qv2ray::ui::widgets::models
using namespace Qv2ray::ui::widgets::models;
| 1,882
|
C++
|
.h
| 50
| 30.34
| 92
| 0.687877
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,277
|
StreamSettingsWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/StreamSettingsWidget.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui_StreamSettingsWidget.h"
#include <QWidget>
class StreamSettingsWidget
: public QWidget
, private Ui::StreamSettingsWidget
{
Q_OBJECT
public:
explicit StreamSettingsWidget(QWidget *parent = nullptr);
void SetStreamObject(const StreamSettingsObject &sso);
StreamSettingsObject GetStreamSettings() const;
private slots:
void on_transportCombo_currentIndexChanged(int arg1);
// Domain Socket
void on_dsPathTxt_textEdited(const QString &arg1);
// HTTP
void on_httpHostTxt_textChanged();
void on_httpPathTxt_textEdited(const QString &arg1);
void on_httpMethodCB_currentTextChanged(const QString &arg1);
void on_httpHeadersEditBtn_clicked();
void on_httpHeadersDefBtn_clicked();
// KCP
void on_kcpCongestionCB_stateChanged(int arg1);
void on_kcpDownCapacitySB_valueChanged(int arg1);
void on_kcpHeaderType_currentIndexChanged(int arg1);
void on_kcpMTU_valueChanged(int arg1);
void on_kcpReadBufferSB_valueChanged(int arg1);
void on_kcpSeedTxt_textEdited(const QString &arg1);
void on_kcpTTI_valueChanged(int arg1);
void on_kcpUploadCapacSB_valueChanged(int arg1);
void on_kcpWriteBufferSB_valueChanged(int arg1);
// QUIC
void on_quicHeaderTypeCB_currentIndexChanged(int arg1);
void on_quicKeyTxt_textEdited(const QString &arg1);
void on_quicSecurityCB_currentIndexChanged(int arg1);
// TLS/XTLS
void on_allowInsecureCB_stateChanged(int arg1);
void on_alpnTxt_textEdited(const QString &arg1);
void on_enableSessionResumptionCB_stateChanged(int arg1);
void on_securityTypeCB_currentIndexChanged(int arg1);
void on_serverNameTxt_textEdited(const QString &arg1);
void on_disableSystemRoot_stateChanged(int arg1);
void on_openCertEditorBtn_clicked();
// TCP
void on_tcpFastOpenCB_stateChanged(int arg1);
void on_tcpHeaderTypeCB_currentIndexChanged(int arg1);
void on_tcpRequestDefBtn_clicked();
void on_tcpRequestEditBtn_clicked();
void on_tcpRespDefBtn_clicked();
void on_tcpResponseEditBtn_clicked();
// SOCKOPT
void on_tProxyCB_currentIndexChanged(int arg1);
void on_soMarkSpinBox_valueChanged(int arg1);
void on_tcpKeepAliveIntervalSpinBox_valueChanged(int arg1);
// WebSocket
void on_wsHeadersTxt_textChanged();
void on_wsPathTxt_textEdited(const QString &arg1);
void on_wsEarlyDataSB_valueChanged(int arg1);
void on_wsBrowserForwardCB_stateChanged(int arg1);
void on_wsEarlyDataHeaderNameCB_currentIndexChanged(int arg1);
// gRPC
void on_grpcServiceNameTxt_textEdited(const QString &arg1);
void on_grpcModeCB_currentIndexChanged(int arg1);
//
void on_pinnedPeerCertificateChainSha256Btn_clicked();
private:
QvMessageBusSlotDecl;
StreamSettingsObject stream;
};
| 2,915
|
C++
|
.h
| 72
| 35.805556
| 66
| 0.768034
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,278
|
DnsSettingsWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/DnsSettingsWidget.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui_DnsSettingsWidget.h"
namespace Qv2ray::ui::widgets
{
class AutoCompleteTextEdit;
}
class DnsSettingsWidget
: public QWidget
, private Ui::DnsSettingsWidget
{
Q_OBJECT
public:
explicit DnsSettingsWidget(QWidget *parent = nullptr);
void SetDNSObject(const DNSObject &dns, const FakeDNSObject &fakeDNS);
std::pair<DNSObject, FakeDNSObject> GetDNSObject();
bool CheckIsValidDNS() const;
private slots:
void on_dnsClientIPTxt_textEdited(const QString &arg1);
void on_dnsTagTxt_textEdited(const QString &arg1);
void on_addServerBtn_clicked();
void on_removeServerBtn_clicked();
void on_serversListbox_currentRowChanged(int currentRow);
void on_moveServerUpBtn_clicked();
void on_moveServerDownBtn_clicked();
void on_serverAddressTxt_textEdited(const QString &arg1);
void on_serverPortSB_valueChanged(int arg1);
void on_addStaticHostBtn_clicked();
void on_removeStaticHostBtn_clicked();
void on_detailsSettingsGB_toggled(bool arg1);
void on_staticResolvedDomainsTable_cellChanged(int row, int column);
void on_fakeDNSIPPool_currentTextChanged(const QString &arg1);
void on_fakeDNSIPPoolSize_valueChanged(int arg1);
void on_dnsDisableCacheCB_stateChanged(int arg1);
void on_dnsDisableFallbackCB_stateChanged(int arg1);
void on_dnsQueryStrategyCB_currentTextChanged(const QString &arg1);
private:
void updateColorScheme();
void ShowCurrentDnsServerDetails();
void ProcessDnsPortEnabledState();
QvMessageBusSlotDecl;
DNSObject dns;
FakeDNSObject fakeDNS;
// int currentServerIndex;
//
Qv2ray::ui::widgets::AutoCompleteTextEdit *domainListTxt;
Qv2ray::ui::widgets::AutoCompleteTextEdit *ipListTxt;
};
| 1,846
|
C++
|
.h
| 49
| 33.387755
| 74
| 0.771557
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,279
|
InboundSettingsWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/InboundSettingsWidget.hpp
|
#pragma once
#include "ui/common/QvMessageBus.hpp"
#include "ui_InboundSettingsWidget.h"
class InboundSettingsWidget
: public QWidget
, private Ui::InboundSettingsWidget
{
Q_OBJECT
QvMessageBusSlotDecl;
public:
explicit InboundSettingsWidget(QWidget *parent = nullptr);
protected:
void changeEvent(QEvent *e);
};
| 345
|
C++
|
.h
| 14
| 21.357143
| 62
| 0.7737
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,280
|
QvAutoCompleteTextEdit.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/QvAutoCompleteTextEdit.hpp
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QAbstractItemModel>
#include <QPlainTextEdit>
QT_BEGIN_NAMESPACE
class QCompleter;
QT_END_NAMESPACE
namespace Qv2ray::ui::widgets
{
class AutoCompleteTextEdit : public QPlainTextEdit
{
Q_OBJECT
public:
AutoCompleteTextEdit(const QString &prefix, const QStringList &sourceStrings, QWidget *parent = nullptr);
~AutoCompleteTextEdit();
protected:
void keyPressEvent(QKeyEvent *e) override;
void focusInEvent(QFocusEvent *e) override;
private slots:
void insertCompletion(const QString &completion);
private:
QString lineUnderCursor() const;
QString wordUnderCursor() const;
QString prefix;
QCompleter *c = nullptr;
};
} // namespace Qv2ray::ui::widgets
using namespace Qv2ray::ui::widgets;
| 3,287
|
C++
|
.h
| 76
| 40.631579
| 113
| 0.717541
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,281
|
ConnectionInfoWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/ConnectionInfoWidget.hpp
|
#pragma once
#include "core/handler/ConfigHandler.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui_ConnectionInfoWidget.h"
#include <QWidget>
class ConnectionInfoWidget
: public QWidget
, private Ui::ConnectionInfoWidget
{
Q_OBJECT
public:
explicit ConnectionInfoWidget(QWidget *parent = nullptr);
void ShowDetails(const ConnectionGroupPair &_identifier);
~ConnectionInfoWidget();
signals:
void OnEditRequested(const ConnectionId &id);
void OnJsonEditRequested(const ConnectionId &id);
protected:
bool eventFilter(QObject *object, QEvent *event) override;
private slots:
void on_connectBtn_clicked();
void on_editBtn_clicked();
void on_editJsonBtn_clicked();
void on_deleteBtn_clicked();
void OnGroupRenamed(const GroupId &id, const QString &oldName, const QString &newName);
void OnConnected(const ConnectionGroupPair &id);
void OnDisConnected(const ConnectionGroupPair &id);
void OnConnectionModified(const ConnectionId &id);
void OnConnectionModified_Pair(const ConnectionGroupPair &id);
void on_latencyBtn_clicked();
private:
void updateColorScheme();
QvMessageBusSlotDecl;
ConnectionId connectionId = NullConnectionId;
GroupId groupId = NullGroupId;
//
bool isRealPixmapShown;
QPixmap qrPixmap;
QPixmap qrPixmapBlured;
};
| 1,361
|
C++
|
.h
| 40
| 29.85
| 91
| 0.765244
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,282
|
ConnectionItemWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/ConnectionItemWidget.hpp
|
#pragma once
#include "base/models/QvConfigIdentifier.hpp"
#include "ui_ConnectionItemWidget.h"
#include <QWidget>
class ConnectionItemWidget
: public QWidget
, private Ui::ConnectionWidget
{
Q_OBJECT
public:
explicit ConnectionItemWidget(const ConnectionGroupPair &id, QWidget *parent = nullptr);
explicit ConnectionItemWidget(const GroupId &groupId, QWidget *parent = nullptr);
//
void BeginConnection();
~ConnectionItemWidget();
//
void BeginRename();
void CancelRename();
bool NameMatched(const QString &arg) const;
inline const ConnectionGroupPair Identifier() const
{
return { this->connectionId, this->groupId };
}
inline bool IsRenaming() const
{
return stackedWidget->currentIndex() == 1;
}
inline bool IsConnection() const
{
return connectionId != NullConnectionId;
}
signals:
void RequestWidgetFocus(const ConnectionItemWidget *me);
private slots:
void OnConnected(const ConnectionGroupPair &id);
void OnDisConnected(const ConnectionGroupPair &id);
void OnConnectionStatsArrived(const ConnectionGroupPair &id, const QMap<StatisticsType, QvStatsSpeedData> &data);
void OnLatencyTestStart(const ConnectionId &id);
void OnConnectionModified(const ConnectionId &id);
void OnLatencyTestFinished(const ConnectionId &id, const int average);
void RecalculateConnectionsCount();
void OnConnectionItemRenamed(const ConnectionId &id, const QString &, const QString &newName);
void OnGroupItemRenamed(const GroupId &id, const QString &, const QString &newName);
void on_doRenameBtn_clicked();
private:
explicit ConnectionItemWidget(QWidget *parent = nullptr);
QString originalItemName;
ConnectionId connectionId;
GroupId groupId;
};
| 1,812
|
C++
|
.h
| 50
| 31.64
| 117
| 0.749716
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,283
|
RouteSettingsMatrix.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/RouteSettingsMatrix.hpp
|
#pragma once
#include "QvAutoCompleteTextEdit.hpp"
#include "base/Qv2rayBase.hpp"
#include "ui_RouteSettingsMatrix.h"
#include <QMenu>
#include <QWidget>
#include <optional>
class RouteSettingsMatrixWidget
: public QWidget
, private Ui::RouteSettingsMatrix
{
Q_OBJECT
public:
RouteSettingsMatrixWidget(const QString &assetsDirPath, QWidget *parent = nullptr);
void SetRouteConfig(const QvConfig_Route &conf);
QvConfig_Route GetRouteConfig() const;
~RouteSettingsMatrixWidget();
private:
std::optional<QString> openFileDialog();
std::optional<QString> saveFileDialog();
QList<QAction *> getBuiltInSchemes();
QAction *schemeToAction(const QString &name, const QvConfig_Route &scheme);
private:
QMenu *builtInSchemesMenu;
private slots:
void on_importSchemeBtn_clicked();
void on_exportSchemeBtn_clicked();
private:
const QString &assetsDirPath;
private:
Qv2ray::ui::widgets::AutoCompleteTextEdit *directDomainTxt;
Qv2ray::ui::widgets::AutoCompleteTextEdit *proxyDomainTxt;
Qv2ray::ui::widgets::AutoCompleteTextEdit *blockDomainTxt;
//
Qv2ray::ui::widgets::AutoCompleteTextEdit *directIPTxt;
Qv2ray::ui::widgets::AutoCompleteTextEdit *blockIPTxt;
Qv2ray::ui::widgets::AutoCompleteTextEdit *proxyIPTxt;
};
| 1,310
|
C++
|
.h
| 38
| 30.631579
| 87
| 0.766614
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,284
|
ConnectionSettingsWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/ConnectionSettingsWidget.hpp
|
#pragma once
#include "ui_ConnectionSettingsWidget.h"
class ConnectionSettingsWidget
: public QWidget
, private Ui::ConnectionSettingsWidget
{
Q_OBJECT
public:
explicit ConnectionSettingsWidget(QWidget *parent = nullptr);
protected:
void changeEvent(QEvent *e);
};
| 293
|
C++
|
.h
| 12
| 21.083333
| 65
| 0.776173
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,285
|
RoutingEditorWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/complex/RoutingEditorWidget.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui/widgets/node/NodeBase.hpp"
#include "ui_RoutingEditorWidget.h"
#include <nodes/FlowScene>
#include <nodes/FlowView>
class NodeDispatcher;
class RoutingEditorWidget
: public QWidget
, private Ui::RoutingEditorWidget
{
Q_OBJECT
public:
explicit RoutingEditorWidget(std::shared_ptr<NodeDispatcher> dispatcher, QWidget *parent = nullptr);
auto getScene()
{
return scene;
}
protected:
void changeEvent(QEvent *e);
private slots:
void OnDispatcherInboundCreated(std::shared_ptr<INBOUND>, QtNodes::Node &);
void OnDispatcherOutboundCreated(std::shared_ptr<complex::OutboundObjectMeta>, QtNodes::Node &);
void OnDispatcherRuleCreated(std::shared_ptr<RuleObject>, QtNodes::Node &);
void on_addRouteBtn_clicked();
void on_delBtn_clicked();
private:
void updateColorScheme();
QvMessageBusSlotDecl;
private:
QtNodes::FlowScene *scene;
QtNodes::FlowView *view;
std::shared_ptr<NodeDispatcher> dispatcher;
};
| 1,089
|
C++
|
.h
| 35
| 27.285714
| 104
| 0.750239
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,286
|
ChainEditorWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/widgets/complex/ChainEditorWidget.hpp
|
#pragma once
#include "ui/common/QvMessageBus.hpp"
#include "ui/widgets/node/NodeBase.hpp"
#include "ui_ChainEditorWidget.h"
#include <nodes/FlowScene>
#include <nodes/FlowView>
#include <tuple>
class NodeDispatcher;
class ChainEditorWidget
: public QWidget
, private Ui::ChainEditorWidget
{
Q_OBJECT
public:
explicit ChainEditorWidget(std::shared_ptr<NodeDispatcher> dispatcher, QWidget *parent = nullptr);
~ChainEditorWidget()
{
connectionSignalBlocked = true;
}
auto getScene()
{
return scene;
}
protected:
void changeEvent(QEvent *e);
private slots:
void on_chainComboBox_currentIndexChanged(int arg1);
//
void OnDispatcherChainedOutboundCreated(std::shared_ptr<OutboundObjectMeta>, QtNodes::Node &);
void OnDispatcherChainedOutboundDeleted(const OutboundObjectMeta &);
void OnDispatcherChainCreated(std::shared_ptr<OutboundObjectMeta>);
void OnDispatcherChainDeleted(const OutboundObjectMeta &);
//
void OnDispatcherObjectTagChanged(ComplexTagNodeMode, const QString originalTag, const QString newTag);
//
void OnSceneConnectionCreated(const QtNodes::Connection &);
void OnSceneConnectionRemoved(const QtNodes::Connection &);
private:
void BeginEditChain(const QString &chain);
void updateColorScheme(){};
void ShowChainLinkedList();
std::tuple<bool, QString, QStringList> VerifyChainLinkedList(const QUuid &ignoredConnectionId);
void TrySaveChainOutboudData(const QUuid &ignoredConnectionId = QUuid());
QvMessageBusSlotDecl;
private:
bool connectionSignalBlocked = false;
QtNodes::FlowScene *scene;
QtNodes::FlowView *view;
std::shared_ptr<NodeDispatcher> dispatcher;
//
QMap<QString, QUuid> outboundNodes;
std::shared_ptr<OutboundObjectMeta> currentChain;
QMap<QString, std::shared_ptr<OutboundObjectMeta>> chains;
};
| 1,904
|
C++
|
.h
| 54
| 30.944444
| 107
| 0.760456
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,287
|
NodeDispatcher.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/node/NodeDispatcher.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "base/models/QvComplexConfigModels.hpp"
#include <nodes/FlowScene>
class NodeDispatcher
: public QObject
, public std::enable_shared_from_this<NodeDispatcher>
{
Q_OBJECT
using FullConfig = std::tuple<QMap<QString, INBOUND>, QMap<QString, RuleObject>, QMap<QString, OutboundObjectMeta>>;
public:
explicit NodeDispatcher(QObject *parent = nullptr);
~NodeDispatcher();
void InitializeScenes(QtNodes::FlowScene *rule, QtNodes::FlowScene *chain)
{
ruleScene = rule;
chainScene = chain;
connect(ruleScene, &QtNodes::FlowScene::nodeDeleted, this, &NodeDispatcher::OnNodeDeleted);
}
public:
FullConfig GetData() const;
void LoadFullConfig(const CONFIGROOT &);
[[nodiscard]] QString CreateInbound(INBOUND);
[[nodiscard]] QString CreateOutbound(OutboundObjectMeta);
[[nodiscard]] QString CreateRule(RuleObject);
bool IsNodeConstructing() const
{
return isOperationLocked;
}
void LockOperation()
{
isOperationLocked = true;
}
public:
const inline QStringList GetInboundTags() const
{
return inbounds.keys();
}
const inline QStringList GetOutboundTags() const
{
return outbounds.keys();
}
const inline QStringList GetRuleTags() const
{
return rules.keys();
}
const inline QStringList GetRealOutboundTags() const
{
QStringList l;
for (const auto &[k, v] : outbounds.toStdMap())
if (v->metaType != METAOUTBOUND_BALANCER)
l << k;
return l;
}
inline int InboundsCount() const
{
return inbounds.count();
}
inline int RulesCount() const
{
return rules.count();
}
inline int OutboundsCount() const
{
return outbounds.count();
}
public:
void OnNodeDeleted(const QtNodes::Node &node);
template<ComplexTagNodeMode t>
inline bool RenameTag(const QString originalTag, const QString newTag)
{
#define PROCESS(type) \
bool hasExisting = type##s.contains(newTag); \
if (hasExisting) \
return false; \
type##s[newTag] = type##s.take(originalTag); \
type##Nodes[newTag] = type##Nodes.take(originalTag);
if constexpr (t == NODE_INBOUND)
{
if (newTag.isEmpty())
return false;
PROCESS(inbound);
}
else if constexpr (t == NODE_OUTBOUND)
{
if (newTag.isEmpty())
return false;
PROCESS(outbound)
}
else if constexpr (t == NODE_RULE)
{
PROCESS(rule)
}
else
{
Q_UNREACHABLE();
}
emit OnObjectTagChanged(t, originalTag, newTag);
return true;
#undef PROCESS
}
signals:
void OnFullConfigLoadCompleted();
void RequestEditChain(const QString &id);
void OnInboundCreated(std::shared_ptr<INBOUND>, QtNodes::Node &);
//
void OnOutboundCreated(std::shared_ptr<OutboundObjectMeta>, QtNodes::Node &);
void OnOutboundDeleted(const OutboundObjectMeta &);
//
void OnRuleCreated(std::shared_ptr<RuleObject>, QtNodes::Node &);
void OnRuleDeleted(const RuleObject &);
//
void OnChainedCreated(std::shared_ptr<OutboundObjectMeta>);
void OnChainedDeleted(const OutboundObjectMeta &);
void OnChainedOutboundCreated(std::shared_ptr<OutboundObjectMeta>, QtNodes::Node &);
void OnChainedOutboundDeleted(const OutboundObjectMeta &);
//
void OnObjectTagChanged(ComplexTagNodeMode, const QString originalTag, const QString newTag);
signals:
void OnInboundOutboundNodeHovered(const QString &tag, const ProtocolSettingsInfoObject &);
private:
QString defaultOutbound;
QMap<QString, QUuid> inboundNodes;
QMap<QString, QUuid> outboundNodes;
QMap<QString, QUuid> ruleNodes;
//
QtNodes::FlowScene *ruleScene;
QtNodes::FlowScene *chainScene;
//
bool isOperationLocked;
QMap<QString, std::shared_ptr<INBOUND>> inbounds;
QMap<QString, std::shared_ptr<RuleObject>> rules;
QMap<QString, std::shared_ptr<OutboundObjectMeta>> outbounds;
};
| 4,803
|
C++
|
.h
| 134
| 29.58209
| 150
| 0.584156
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,288
|
NodeBase.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/node/NodeBase.hpp
|
#pragma once
#include "NodeDispatcher.hpp"
#include "ui/widgets/common/WidgetUIBase.hpp"
#include "utils/QvHelpers.hpp"
#include <QLabel>
#include <memory>
#include <nodes/Connection>
#include <nodes/Node>
#include <nodes/NodeDataModel>
constexpr auto GRAPH_NODE_LABEL_FONTSIZE_INCREMENT = 3;
using QtNodes::NodeData;
using QtNodes::NodeDataModel;
using QtNodes::NodeDataType;
using QtNodes::NodeValidationState;
using QtNodes::PortIndex;
using QtNodes::PortType;
namespace Qv2ray::ui::nodemodels
{
const auto NODE_TYPE_OUTBOUND = std::make_shared<NodeDataType>("outbound", QObject::tr("Out"));
const auto NODE_TYPE_INBOUND = std::make_shared<NodeDataType>("inbound", QObject::tr("In"));
const auto NODE_TYPE_RULE = std::make_shared<NodeDataType>("rule", QObject::tr("Rule"));
const auto NODE_TYPE_CHAINED_OUTBOUND = std::make_shared<NodeDataType>("chain_outbound", QObject::tr("Chain"));
class QvNodeWidget : public QWidget
{
Q_OBJECT
public:
explicit QvNodeWidget(std::shared_ptr<NodeDispatcher> _dispatcher, QWidget *parent) : QWidget(parent), dispatcher(_dispatcher){};
template<typename T>
void setValue(std::shared_ptr<T>);
signals:
void OnSizeUpdated();
protected:
std::shared_ptr<NodeDispatcher> dispatcher;
};
#define DECL_NODE_DATA_TYPE(name, TYPE, INNER_TYPE) \
class name : public NodeData \
{ \
public: \
explicit name(std::shared_ptr<INNER_TYPE> data) : data(data){}; \
std::shared_ptr<NodeDataType> type() const override \
{ \
return TYPE; \
} \
std::shared_ptr<INNER_TYPE> GetData() \
{ \
return std::shared_ptr<INNER_TYPE>(data); \
} \
\
private: \
std::shared_ptr<INNER_TYPE> data; \
}
DECL_NODE_DATA_TYPE(InboundNodeData, NODE_TYPE_INBOUND, INBOUND);
DECL_NODE_DATA_TYPE(OutboundNodeData, NODE_TYPE_OUTBOUND, OutboundObjectMeta);
DECL_NODE_DATA_TYPE(RuleNodeData, NODE_TYPE_RULE, RuleObject);
DECL_NODE_DATA_TYPE(ChainOutboundData, NODE_TYPE_CHAINED_OUTBOUND, OutboundObjectMeta);
template<typename NODEMODEL_T>
NODEMODEL_T *convert_nodemodel(QtNodes::Node *node)
{
return static_cast<NODEMODEL_T *>(node->nodeDataModel());
}
template<typename NODEDATA_T>
NODEDATA_T *convert_nodedata(QtNodes::Node *node)
{
return static_cast<NODEDATA_T *>(node->nodeDataModel()->outData(0).get());
}
//
//***********************************************************************************************************************************
//
#define DECL_NODE_DATA_MODEL(NAME, CONTENT_TYPE) \
class NAME : public NodeDataModel \
{ \
Q_OBJECT \
public: \
typedef CONTENT_TYPE node_data_t; \
explicit NAME(std::shared_ptr<NodeDispatcher>, std::shared_ptr<node_data_t>); \
~NAME(){}; \
\
inline QString caption() const override \
{ \
return {}; \
} \
inline bool captionVisible() const override \
{ \
return false; \
} \
inline QString name() const override \
{ \
return #NAME; \
} \
ConnectionPolicy portOutConnectionPolicy(PortIndex) const override; \
ConnectionPolicy portInConnectionPolicy(PortIndex) const override; \
unsigned int nPorts(PortType portType) const override; \
std::shared_ptr<NodeDataType> dataType(PortType portType, PortIndex portIndex) const override; \
\
public: \
void onNodeHoverEnter() override; \
void onNodeHoverLeave() override; \
virtual void setInData(std::shared_ptr<NodeData> nodeData, PortIndex port) override; \
virtual void setInData(std::vector<std::shared_ptr<NodeData>> nodeData, PortIndex port) override; \
virtual std::shared_ptr<NodeData> outData(PortIndex port) override; \
inline QWidget *embeddedWidget() override \
{ \
return widget; \
} \
inline std::unique_ptr<NodeDataModel> clone() const override \
{ \
return {}; \
} \
\
void inputConnectionCreated(const QtNodes::Connection &) override; \
void inputConnectionDeleted(const QtNodes::Connection &) override; \
void outputConnectionCreated(const QtNodes::Connection &) override; \
void outputConnectionDeleted(const QtNodes::Connection &) override; \
const std::shared_ptr<const node_data_t> getData() const \
{ \
return dataptr; \
} \
\
private: \
std::shared_ptr<node_data_t> dataptr; \
QvNodeWidget *widget; \
std::shared_ptr<NodeDispatcher> dispatcher; \
}
DECL_NODE_DATA_MODEL(InboundNodeModel, INBOUND);
DECL_NODE_DATA_MODEL(OutboundNodeModel, OutboundObjectMeta);
DECL_NODE_DATA_MODEL(RuleNodeModel, RuleObject);
DECL_NODE_DATA_MODEL(ChainOutboundNodeModel, OutboundObjectMeta);
} // namespace Qv2ray::ui::nodemodels
using namespace Qv2ray::ui::nodemodels;
| 13,044
|
C++
|
.h
| 129
| 88.775194
| 150
| 0.24719
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,289
|
RuleWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/node/widgets/RuleWidget.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "ui/widgets/node/NodeBase.hpp"
#include "ui_RuleWidget.h"
class QvNodeRuleWidget
: public QvNodeWidget
, private Ui::RuleWidget
{
Q_OBJECT
public:
explicit QvNodeRuleWidget(std::shared_ptr<NodeDispatcher> _dispatcher, QWidget *parent = nullptr);
void setValue(std::shared_ptr<RuleObject>);
inline void SetDetailsVisibilityState(bool state)
{
settingsFrame->setVisible(state);
adjustSize();
}
private slots:
void on_toolButton_clicked();
void on_routeProtocolHTTPCB_stateChanged(int arg1);
void on_routeProtocolTLSCB_stateChanged(int arg1);
void on_routeProtocolBTCB_stateChanged(int arg1);
void on_hostList_textChanged();
void on_ipList_textChanged();
void on_routePortTxt_textEdited(const QString &arg1);
void on_netUDPRB_clicked();
void on_netTCPRB_clicked();
void on_sourceIPList_textChanged();
void on_ruleEnableCB_stateChanged(int arg1);
void on_ruleTagLineEdit_textEdited(const QString &arg1);
// void on_enableBalancerCB_stateChanged(int arg1);
protected:
void changeEvent(QEvent *e) override;
std::shared_ptr<RuleObject> ruleptr;
bool isLoading;
inline void SetNetworkProperty()
{
QStringList list;
if (netUDPRB->isChecked())
list << "udp";
if (netTCPRB->isChecked())
list << "tcp";
ruleptr->network = list.join(",");
}
inline void SetProtocolProperty()
{
QStringList protocols;
if (routeProtocolTLSCB->isChecked())
protocols.push_back("tls");
if (routeProtocolHTTPCB->isChecked())
protocols.push_back("http");
if (routeProtocolBTCB->isChecked())
protocols.push_back("bittorrent");
ruleptr->protocol = protocols;
}
};
| 1,861
|
C++
|
.h
| 56
| 27.196429
| 102
| 0.684474
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,290
|
BalancerWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/node/widgets/BalancerWidget.hpp
|
#pragma once
#include "ui/widgets/node/NodeBase.hpp"
#include "ui_BalancerWidget.h"
class BalancerWidget
: public QvNodeWidget
, private Ui::BalancerWidget
{
Q_OBJECT
public:
explicit BalancerWidget(std::shared_ptr<NodeDispatcher> _dispatcher, QWidget *parent = nullptr);
void setValue(std::shared_ptr<OutboundObjectMeta> data);
private slots:
void on_balancerAddBtn_clicked();
void on_balancerDelBtn_clicked();
void on_balancerTagTxt_textEdited(const QString &arg1);
void on_showHideBtn_clicked();
void on_strategyCB_currentIndexChanged(const QString &arg1);
private:
void OutboundCreated(std::shared_ptr<OutboundObjectMeta>, QtNodes::Node &);
void OutboundDeleted(const OutboundObjectMeta &);
void OnTagChanged(ComplexTagNodeMode _t1, const QString _t2, const QString _t3);
signals:
void OnSizeUpdated();
protected:
void changeEvent(QEvent *e);
std::shared_ptr<OutboundObjectMeta> outboundData;
};
| 980
|
C++
|
.h
| 27
| 32.333333
| 100
| 0.75924
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,291
|
InboundOutboundWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/node/widgets/InboundOutboundWidget.hpp
|
#pragma once
#include "ui/widgets/node/NodeBase.hpp"
#include "ui_InboundOutboundWidget.h"
class InboundOutboundWidget
: public QvNodeWidget
, private Ui::InboundOutboundWidget
{
Q_OBJECT
public:
explicit InboundOutboundWidget(ComplexTagNodeMode mode, std::shared_ptr<NodeDispatcher> _dispatcher, QWidget *parent = nullptr);
void setValue(std::shared_ptr<INBOUND>);
void setValue(std::shared_ptr<OutboundObjectMeta> data);
protected:
void changeEvent(QEvent *e) override;
private slots:
void on_editBtn_clicked();
void on_editJsonBtn_clicked();
void on_tagTxt_textEdited(const QString &arg1);
private:
ComplexTagNodeMode workingMode;
std::shared_ptr<INBOUND> inboundObject;
std::shared_ptr<OutboundObjectMeta> outboundObject;
bool isExternalOutbound = false;
private:
const QString editExternalMsg = tr("You are trying to edit an external connection config, is this what you want?");
const QString editExternalComplexMsg = tr("You have selected an complex config as outbound.") + NEWLINE +
tr("continuing editing this configuration will make you LOSS ALL INBOUND AND ROUTING settings.") +
NEWLINE + tr("Is this what you want?");
};
| 1,299
|
C++
|
.h
| 29
| 38.034483
| 141
| 0.712589
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,292
|
ChainWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/node/widgets/ChainWidget.hpp
|
#pragma once
#include "ui/widgets/node/NodeBase.hpp"
#include "ui_ChainWidget.h"
class ChainWidget
: public QvNodeWidget
, private Ui::ChainWidget
{
Q_OBJECT
public:
explicit ChainWidget(std::shared_ptr<NodeDispatcher> _dispatcher, QWidget *parent = nullptr);
void setValue(std::shared_ptr<OutboundObjectMeta> data);
signals:
void OnSizeUpdated();
void OnEditChainRequested(const QString &id);
protected:
void changeEvent(QEvent *e);
QStringList targetList;
private slots:
void on_displayNameTxt_textEdited(const QString &arg1);
void on_editChainBtn_clicked();
private:
std::shared_ptr<OutboundObjectMeta> dataptr;
};
| 683
|
C++
|
.h
| 23
| 25.869565
| 97
| 0.751914
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,293
|
ChainOutboundWidget.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/node/widgets/ChainOutboundWidget.hpp
|
#pragma once
#include "ui/widgets/node/NodeBase.hpp"
#include "ui_ChainOutboundWidget.h"
class ChainOutboundWidget
: public QvNodeWidget
, private Ui::ChainOutboundWidget
{
Q_OBJECT
public:
explicit ChainOutboundWidget(std::shared_ptr<NodeDispatcher> _dispatcher, QWidget *parent = nullptr);
void setValue(std::shared_ptr<OutboundObjectMeta>);
protected:
void changeEvent(QEvent *e);
private slots:
void on_chainPortSB_valueChanged(int arg1);
private:
std::shared_ptr<OutboundObjectMeta> chain;
};
| 543
|
C++
|
.h
| 18
| 26.666667
| 105
| 0.767308
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,295
|
WidgetUIBase.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/common/WidgetUIBase.hpp
|
#pragma once
#include "ui/common/QvMessageBus.hpp"
#include "ui/widgets/Qv2rayWidgetApplication.hpp"
#include <QDialog>
#include <QGraphicsEffect>
#include <QGraphicsPixmapItem>
#include <QGraphicsScene>
#include <QJsonObject>
#include <QPainter>
#include <QShowEvent>
#include <QTextCursor>
#include <QTextDocument>
// GUI TOOLS
inline void RED(QWidget *obj)
{
auto _temp = obj->palette();
_temp.setColor(QPalette::Text, Qt::red);
obj->setPalette(_temp);
}
inline void BLACK(QWidget *obj)
{
obj->setPalette(qApp->palette());
}
#define QV2RAY_COLORSCHEME_ROOT_X(isDark) (QString(":/assets/icons/") + ((isDark) ? "ui_dark/" : "ui_light/"))
#define QV2RAY_TRASY_ICON_STYLE_X(isGlyph) (QString("") + ((isGlyph) ? "glyph-" : ""))
#define QV2RAY_COLORSCHEME_FILE(file) (QV2RAY_COLORSCHEME_ROOT_X(GlobalConfig.uiConfig.useDarkTheme) + file + ".svg")
#define Q_TRAYICON(name) \
(QPixmap(QV2RAY_COLORSCHEME_ROOT_X(GlobalConfig.uiConfig.useDarkTrayIcon) + \
(QV2RAY_TRASY_ICON_STYLE_X(GlobalConfig.uiConfig.useGlyphTrayIcon)) + name + ".png"))
class QvStateObject
{
using options_save_func_t = std::function<QJsonValue()>;
using options_restore_func_t = std::function<void(QJsonValue)>;
using options_storage_type = std::map<QString, std::pair<options_save_func_t, options_restore_func_t>>;
public:
explicit QvStateObject(const QString &name) : windowName(name){};
protected:
void addStateOptions(QString name, std::pair<options_save_func_t, options_restore_func_t> funcs)
{
state_options_list[name] = funcs;
}
private:
const QString windowName;
options_storage_type state_options_list;
#if QV2RAY_FEATURE(ui_has_store_state)
public:
void SaveState()
{
QvWidgetApplication->UIStates[windowName] = saveStateImpl();
}
void RestoreState()
{
restoreStateImpl(QvWidgetApplication->UIStates[windowName].toObject());
}
private:
QJsonObject saveStateImpl()
{
QJsonObject o;
for (const auto &[name, pair] : state_options_list)
o[name] = pair.first();
return o;
}
void restoreStateImpl(const QJsonObject &o)
{
for (const auto &[name, pair] : state_options_list)
if (o.contains(name))
pair.second(o[name]);
}
#endif
};
class QvDialog
: public QDialog
, public QvStateObject
{
Q_OBJECT
public:
explicit QvDialog(const QString &name, QWidget *parent) : QDialog(parent), QvStateObject(name)
{
#if QV2RAY_FEATURE(ui_has_store_state)
connect(this, &QvDialog::finished, [this] { SaveState(); });
#endif
}
virtual ~QvDialog(){};
virtual void processCommands(QString command, QStringList commands, QMap<QString, QString> args) = 0;
protected:
virtual QvMessageBusSlotDecl = 0;
virtual void updateColorScheme() = 0;
void showEvent(QShowEvent *event) override
{
QWidget::showEvent(event);
#if QV2RAY_FEATURE(ui_has_store_state)
RestoreState();
#endif
}
};
namespace Qv2ray::ui
{
inline QPixmap ApplyEffectToImage(QPixmap src, QGraphicsEffect *effect, int extent = 0)
{
if (src.isNull() || !effect)
return src;
QGraphicsScene scene;
QGraphicsPixmapItem item;
item.setPixmap(src);
item.setGraphicsEffect(effect);
scene.addItem(&item);
QImage res(src.size() + QSize(extent * 2, extent * 2), QImage::Format_ARGB32);
res.fill(Qt::transparent);
QPainter ptr(&res);
scene.render(&ptr, QRectF(), QRectF(-extent, -extent, src.width() + extent * 2, src.height() + extent * 2));
// Clean up
item.setGraphicsEffect(nullptr);
return QPixmap::fromImage(res);
}
inline QPixmap BlurImage(const QPixmap &pixmap, const double rad)
{
auto pBlur = new QGraphicsBlurEffect();
pBlur->setBlurRadius(rad);
return ApplyEffectToImage(pixmap, pBlur, 0);
}
inline QPixmap ColorizeImage(const QPixmap &pixmap, const QColor &color, const qreal factor)
{
auto pColor = new QGraphicsColorizeEffect();
pColor->setColor(color);
pColor->setStrength(factor);
return ApplyEffectToImage(pixmap, pColor, 0);
}
inline void FastAppendTextDocument(const QString &message, QTextDocument *doc)
{
QTextCursor cursor(doc);
cursor.movePosition(QTextCursor::End);
cursor.beginEditBlock();
cursor.insertBlock();
cursor.insertText(message);
cursor.endEditBlock();
}
} // namespace Qv2ray::ui
using namespace Qv2ray::ui;
| 4,824
|
C++
|
.h
| 138
| 29.673913
| 150
| 0.651093
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,296
|
w_RoutesEditor.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/editors/w_RoutesEditor.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "base/models/QvComplexConfigModels.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui/widgets/common/WidgetUIBase.hpp"
#include "ui_w_RoutesEditor.h"
#include "utils/QvHelpers.hpp"
enum ROUTE_EDIT_MODE
{
RENAME_INBOUND,
RENAME_OUTBOUND,
RENAME_RULE,
};
class NodeDispatcher;
class ChainEditorWidget;
class RoutingEditorWidget;
class DnsSettingsWidget;
namespace QtNodes
{
class Node;
class FlowView;
class FlowScene;
} // namespace QtNodes
class RouteEditor
: public QvDialog
, private Ui::RouteEditor
{
Q_OBJECT
public:
explicit RouteEditor(QJsonObject connection, QWidget *parent = nullptr);
~RouteEditor();
CONFIGROOT OpenEditor();
void processCommands(QString, QStringList, QMap<QString, QString>) override{};
private:
void updateColorScheme() override;
QvMessageBusSlotDecl override;
private slots:
void on_addBalancerBtn_clicked();
void on_addChainBtn_clicked();
void on_addDefaultBtn_clicked();
void on_addInboundBtn_clicked();
void on_addOutboundBtn_clicked();
void on_debugPainterCB_clicked(bool checked);
void on_defaultOutboundCombo_currentTextChanged(const QString &arg1);
void on_domainStrategyCombo_currentIndexChanged(int arg1);
void on_importExistingBtn_clicked();
void on_importGroupBtn_currentIndexChanged(int index);
void on_insertBlackBtn_clicked();
void on_insertDirectBtn_clicked();
void on_linkExistingBtn_clicked();
void on_importOutboundBtn_clicked();
private slots:
void OnDispatcherEditChainRequested(const QString &);
void OnDispatcherOutboundDeleted(const complex::OutboundObjectMeta &);
void OnDispatcherOutboundCreated(std::shared_ptr<complex::OutboundObjectMeta>, QtNodes::Node &);
void OnDispatcherRuleCreated(std::shared_ptr<RuleObject>, QtNodes::Node &);
void OnDispatcherRuleDeleted(const RuleObject &);
void OnDispatcherInboundOutboundHovered(const QString &, const ProtocolSettingsInfoObject &);
void OnDispatcherObjectTagChanged(ComplexTagNodeMode, const QString, const QString);
private:
QString defaultOutboundTag;
std::shared_ptr<NodeDispatcher> nodeDispatcher;
ChainEditorWidget *chainWidget;
RoutingEditorWidget *ruleWidget;
DnsSettingsWidget *dnsWidget;
//
bool isLoading = false;
QString domainStrategy;
//
CONFIGROOT root;
CONFIGROOT original;
};
| 2,460
|
C++
|
.h
| 72
| 30.277778
| 100
| 0.77418
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,297
|
w_JsonEditor.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/editors/w_JsonEditor.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui/widgets/common/QJsonModel.hpp"
#include "ui_w_JsonEditor.h"
#include <QDialog>
class JsonEditor
: public QDialog
, private Ui::JsonEditor
{
Q_OBJECT
public:
explicit JsonEditor(QJsonObject rootObject, QWidget *parent = nullptr);
~JsonEditor();
QJsonObject OpenEditor();
private:
QvMessageBusSlotDecl;
private slots:
void on_jsonEditor_textChanged();
void on_formatJsonBtn_clicked();
void on_removeCommentsBtn_clicked();
private:
QJsonModel model;
QJsonObject original;
QJsonObject final;
};
| 655
|
C++
|
.h
| 26
| 21.538462
| 75
| 0.746774
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| false
|
4,298
|
w_InboundEditor.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/editors/w_InboundEditor.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "components/plugins/QvPluginHost.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui_w_InboundEditor.h"
#include <QDialog>
class StreamSettingsWidget;
class InboundEditor
: public QDialog
, private Ui::InboundEditor
{
Q_OBJECT
public:
explicit InboundEditor(INBOUND root, QWidget *parent = nullptr);
~InboundEditor();
INBOUND OpenEditor();
private:
QvMessageBusSlotDecl;
private slots:
void on_inboundProtocolCombo_currentIndexChanged(int index);
void on_inboundTagTxt_textEdited(const QString &arg1);
void on_strategyCombo_currentIndexChanged(int arg1);
void on_refreshNumberBox_valueChanged(int arg1);
void on_concurrencyNumberBox_valueChanged(int arg1);
void on_inboundHostTxt_textEdited(const QString &arg1);
void on_inboundPortTxt_textEdited(const QString &arg1);
void on_sniffingGroupBox_clicked(bool checked);
void on_sniffHTTPCB_stateChanged(int arg1);
void on_sniffTLSCB_stateChanged(int arg1);
void on_stackedWidget_currentChanged(int arg1);
void on_sniffMetaDataOnlyCB_clicked(bool checked);
void on_sniffFakeDNSOtherCB_stateChanged(int arg1);
void on_sniffFakeDNSCB_stateChanged(int arg1);
private:
StreamSettingsWidget *streamSettingsWidget;
INBOUND getResult();
void loadUI();
INBOUND original;
INBOUND current;
//
bool isLoading;
QJsonObject sniffingSettings;
QJsonObject allocateSettings;
QString inboundProtocol;
QMap<QString, QvPluginEditor *> pluginWidgets;
};
| 1,594
|
C++
|
.h
| 46
| 30.23913
| 68
| 0.772757
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,299
|
w_ChainSha256Editor.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/editors/w_ChainSha256Editor.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui_w_ChainSha256Editor.h"
#include <QDialog>
class ChainSha256Editor
: public QDialog
, private Ui::ChainSha256Editor
{
Q_OBJECT
private:
QList<QString> chain;
private:
static QList<QString> convertFromString(const QString &&str);
static std::optional<QString> validateError(const QList<QString> &newChain);
public:
explicit ChainSha256Editor(QWidget *parent = nullptr, const QList<QString>& chain = QList<QString>());
explicit operator QList<QString>()
{
return this->chain;
};
private slots:
void on_buttonBox_helpRequested();
private:
void accept() override;
private:
QvMessageBusSlotDecl;
};
| 769
|
C++
|
.h
| 28
| 23.571429
| 106
| 0.733607
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,300
|
w_OutboundEditor.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/editors/w_OutboundEditor.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "components/plugins/QvPluginHost.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui/widgets/widgets/StreamSettingsWidget.hpp"
#include "ui_w_OutboundEditor.h"
#include <QDialog>
#include <QtCore>
class OutboundEditor
: public QDialog
, private Ui::OutboundEditor
{
Q_OBJECT
public:
explicit OutboundEditor(const OUTBOUND &outboundEntry, QWidget *parent = nullptr);
~OutboundEditor();
OUTBOUND OpenEditor();
QString GetFriendlyName();
private:
explicit OutboundEditor(QWidget *parent = nullptr);
QvMessageBusSlotDecl;
private slots:
void on_buttonBox_accepted();
void on_ipLineEdit_textEdited(const QString &arg1);
void on_muxConcurrencyTxt_valueChanged(int arg1);
void on_muxEnabledCB_stateChanged(int arg1);
void on_outBoundTypeCombo_currentIndexChanged(int index);
void on_portLineEdit_textEdited(const QString &arg1);
void on_tagTxt_textEdited(const QString &arg1);
void on_useFPCB_stateChanged(int arg1);
private:
QString tag;
void reloadGUI();
bool useForwardProxy;
OUTBOUND generateConnectionJson();
OUTBOUND originalConfig;
OUTBOUND resultConfig;
QJsonObject muxConfig;
QString serverAddress;
int serverPort;
//
// Connection Configs
QString outboundType;
//
StreamSettingsWidget *streamSettingsWidget;
//
QMap<QString, QvPluginEditor *> pluginWidgets;
};
| 1,466
|
C++
|
.h
| 48
| 26.520833
| 86
| 0.755839
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,301
|
StyleManager.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/styles/StyleManager.hpp
|
#pragma once
#include <QMap>
#include <QObject>
#include <QStringList>
namespace Qv2ray::ui::styles
{
struct QvStyle
{
enum StyleType
{
QVSTYLE_FACTORY,
QVSTYLE_QSS
} Type;
QString Name;
QString qssPath;
};
class QvStyleManager : QObject
{
public:
QvStyleManager(QObject *parent = nullptr);
inline QStringList AllStyles() const
{
return styles.keys();
}
bool ApplyStyle(const QString &);
private:
void ReloadStyles();
QMap<QString, QvStyle> styles;
};
inline QvStyleManager *StyleManager = nullptr;
} // namespace Qv2ray::ui::styles
using namespace Qv2ray::ui::styles;
| 747
|
C++
|
.h
| 32
| 16.78125
| 50
| 0.607898
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,302
|
w_MainWindow.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/windows/w_MainWindow.hpp
|
#pragma once
#include "ui/common/LogHighlighter.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui/common/speedchart/speedwidget.hpp"
#include "ui/widgets/common/WidgetUIBase.hpp"
#include "ui/widgets/models/ConnectionModelHelper.hpp"
#include "ui/widgets/widgets/ConnectionInfoWidget.hpp"
#include "ui/widgets/widgets/ConnectionItemWidget.hpp"
#include "ui_w_MainWindow.h"
#include <QHostAddress>
#include <QMainWindow>
#include <QMenu>
namespace Qv2rayPlugin
{
class QvPluginMainWindowWidget;
}
class MainWindow
: public QMainWindow
, QvStateObject
, Ui::MainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
void ProcessCommand(QString command, QStringList commands, QMap<QString, QString> args);
signals:
void StartConnection() const;
void StopConnection() const;
void RestartConnection() const;
private:
QvMessageBusSlotDecl;
private slots:
void on_activatedTray(QSystemTrayIcon::ActivationReason reason);
void on_preferencesBtn_clicked();
void on_setBypassCNBtn_clicked();
void on_clearBypassCNBtn_clicked();
void on_clearlogButton_clicked();
void on_connectionTreeView_customContextMenuRequested(const QPoint &pos);
void on_importConfigButton_clicked();
void on_subsButton_clicked();
//
void on_connectionFilterTxt_textEdited(const QString &arg1);
void on_locateBtn_clicked();
//
void on_chartVisibilityBtn_clicked();
void on_logVisibilityBtn_clicked();
void on_clearChartBtn_clicked();
void on_masterLogBrowser_textChanged();
//
void on_pluginsBtn_clicked();
void on_collapseGroupsBtn_clicked();
void on_newConnectionBtn_clicked();
void on_newComplexConnectionBtn_clicked();
//
void on_connectionTreeView_doubleClicked(const QModelIndex &index);
void on_connectionTreeView_clicked(const QModelIndex &index);
private:
// Do not declare as slots, we connect them manually.
void Action_Exit();
void Action_Start();
void Action_SetAutoConnection();
void Action_Edit();
void Action_EditJson();
void Action_EditComplex();
void Action_UpdateSubscription();
void Action_TestLatency();
void Action_TestRealLatency();
void Action_RenameConnection();
void Action_DeleteConnections();
void Action_DuplicateConnection();
void Action_ResetStats();
void Action_CopyGraphAsImage();
void Action_CopyRecentLogs();
private:
void MWToggleVisibilitySetText();
void MWToggleVisibility();
void OnEditRequested(const ConnectionId &id);
void OnEditJsonRequested(const ConnectionId &id);
void OnConnected(const ConnectionGroupPair &id);
void OnDisconnected(const ConnectionGroupPair &id);
//
void OnStatsAvailable(const ConnectionGroupPair &id, const QMap<StatisticsType, QvStatsSpeedData> &data);
void OnVCoreLogAvailable(const ConnectionGroupPair &id, const QString &log);
//
void SortConnectionList(ConnectionInfoRole byCol, bool asending);
//
void ReloadRecentConnectionList();
void OnRecentConnectionsMenuReadyToShow();
//
void OnLogScrollbarValueChanged(int value);
//
void UpdateActionTranslations();
void OnPluginButtonClicked();
protected:
void timerEvent(QTimerEvent *event) override;
void keyPressEvent(QKeyEvent *e) override;
void keyReleaseEvent(QKeyEvent *e) override;
void closeEvent(QCloseEvent *) override;
void changeEvent(QEvent *e) override;
private:
// Charts
SpeedWidget *speedChartWidget;
SyntaxHighlighter *vCoreLogHighlighter;
ConnectionInfoWidget *infoWidget;
//
// Declare Actions
#define DECL_ACTION(parent, name) QAction *name = new QAction(parent)
QMenu *tray_RootMenu = new QMenu(this);
QMenu *tray_BypassCNMenu = new QMenu(this);
QMenu *tray_SystemProxyMenu = new QMenu(this);
QMenu *tray_RecentConnectionsMenu = new QMenu(this);
QMenu *sortMenu = new QMenu(this);
QMenu *logRCM_Menu = new QMenu(this);
QMenu *connectionListRCM_Menu = new QMenu(this);
QMenu *graphWidgetMenu = new QMenu(this);
// Do not set parent=tray_RecentConnectionsMenu
// Calling clear() will cause this QAction being deleted.
DECL_ACTION(this, tray_ClearRecentConnectionsAction);
DECL_ACTION(tray_RootMenu, tray_action_ToggleVisibility);
DECL_ACTION(tray_RootMenu, tray_action_Preferences);
DECL_ACTION(tray_RootMenu, tray_action_Quit);
DECL_ACTION(tray_RootMenu, tray_action_Start);
DECL_ACTION(tray_RootMenu, tray_action_Restart);
DECL_ACTION(tray_RootMenu, tray_action_Stop);
DECL_ACTION(tray_RootMenu, tray_action_SetBypassCN);
DECL_ACTION(tray_RootMenu, tray_action_ClearBypassCN);
DECL_ACTION(tray_RootMenu, tray_action_SetSystemProxy);
DECL_ACTION(tray_RootMenu, tray_action_ClearSystemProxy);
DECL_ACTION(connectionListRCM_Menu, action_RCM_Start);
DECL_ACTION(connectionListRCM_Menu, action_RCM_SetAutoConnection);
DECL_ACTION(connectionListRCM_Menu, action_RCM_UpdateSubscription);
DECL_ACTION(connectionListRCM_Menu, action_RCM_Edit);
DECL_ACTION(connectionListRCM_Menu, action_RCM_EditJson);
DECL_ACTION(connectionListRCM_Menu, action_RCM_EditComplex);
DECL_ACTION(connectionListRCM_Menu, action_RCM_RenameConnection);
DECL_ACTION(connectionListRCM_Menu, action_RCM_DuplicateConnection);
DECL_ACTION(connectionListRCM_Menu, action_RCM_TestLatency);
DECL_ACTION(connectionListRCM_Menu, action_RCM_RealLatencyTest);
DECL_ACTION(connectionListRCM_Menu, action_RCM_ResetStats);
DECL_ACTION(connectionListRCM_Menu, action_RCM_DeleteConnection);
DECL_ACTION(sortMenu, sortAction_SortByName_Asc);
DECL_ACTION(sortMenu, sortAction_SortByName_Dsc);
DECL_ACTION(sortMenu, sortAction_SortByPing_Asc);
DECL_ACTION(sortMenu, sortAction_SortByPing_Dsc);
DECL_ACTION(sortMenu, sortAction_SortByData_Asc);
DECL_ACTION(sortMenu, sortAction_SortByData_Dsc);
DECL_ACTION(graphWidgetMenu, action_RCM_CopyGraph);
DECL_ACTION(logRCM_Menu, action_RCM_SwitchCoreLog);
DECL_ACTION(logRCM_Menu, action_RCM_SwitchQv2rayLog);
DECL_ACTION(logRCM_Menu, action_RCM_CopyRecentLogs);
DECL_ACTION(logRCM_Menu, action_RCM_CopySelected);
#undef DECL_ACTION
QTextDocument *vCoreLogDocument = new QTextDocument(this);
QTextDocument *qvLogDocument = new QTextDocument(this);
//
int qvLogTimerId = -1;
bool qvLogAutoScoll = true;
//
ConnectionGroupPair lastConnected;
void MWSetSystemProxy();
void MWClearSystemProxy();
void MWShowWindow();
void MWHideWindow();
void CheckSubscriptionsUpdate();
bool StartAutoConnectionEntry();
//
void updateColorScheme();
//
QList<Qv2rayPlugin::QvPluginMainWindowWidget *> pluginWidgets;
//
Qv2ray::ui::widgets::models::ConnectionListHelper *modelHelper;
};
| 6,912
|
C++
|
.h
| 173
| 35.445087
| 109
| 0.757283
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,303
|
w_PluginManager.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/windows/w_PluginManager.hpp
|
#pragma once
#include "plugin-interface/QvGUIPluginInterface.hpp"
#include "ui/widgets/common/WidgetUIBase.hpp"
#include "ui_w_PluginManager.h"
#include <memory>
namespace Qv2ray::components::plugins
{
struct QvPluginInfo;
}
class PluginManageWindow
: public QvDialog
, private Ui::w_PluginManager
{
Q_OBJECT
public:
explicit PluginManageWindow(QWidget *parent = nullptr);
~PluginManageWindow();
void processCommands(QString command, QStringList commands, QMap<QString, QString>) override
{
if (commands.isEmpty())
return;
if (command == "open")
{
const auto c = commands.takeFirst();
if (c == "plugindir")
on_openPluginFolder_clicked();
if (c == "metadata")
tabWidget->setCurrentIndex(0);
if (c == "settings")
tabWidget->setCurrentIndex(1);
}
}
QvMessageBusSlotDecl override;
private slots:
void on_pluginListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
void on_pluginListWidget_itemClicked(QListWidgetItem *item);
void on_pluginListWidget_itemChanged(QListWidgetItem *item);
void on_pluginEditSettingsJsonBtn_clicked();
void on_pluginListWidget_itemSelectionChanged();
void on_openPluginFolder_clicked();
void on_toolButton_clicked();
private:
void updateColorScheme() override{};
std::shared_ptr<Qv2rayPlugin::QvPluginSettingsWidget> currentSettingsWidget;
Qv2ray::components::plugins::QvPluginInfo *currentPluginInfo;
bool isLoading = true;
};
| 1,621
|
C++
|
.h
| 47
| 28.425532
| 101
| 0.701788
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,304
|
w_GroupManager.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/windows/w_GroupManager.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui/widgets/common/WidgetUIBase.hpp"
#include "ui_w_GroupManager.h"
#include <QMenu>
class DnsSettingsWidget;
class RouteSettingsMatrixWidget;
class GroupManager
: public QvDialog
, private Ui::w_GroupManager
{
Q_OBJECT
public:
explicit GroupManager(QWidget *parent = nullptr);
~GroupManager();
void processCommands(QString command, QStringList commands, QMap<QString, QString>) override
{
const static QMap<QString, int> indexMap{ { "connection", 0 }, //
{ "subscription", 1 }, //
{ "dns", 2 }, //
{ "route", 3 } };
if (commands.isEmpty())
return;
if (command == "open")
{
const auto c = commands.takeFirst();
tabWidget->setCurrentIndex(indexMap[c]);
}
}
private:
QvMessageBusSlotDecl override;
private slots:
void on_addGroupButton_clicked();
void on_updateButton_clicked();
void on_removeGroupButton_clicked();
void on_buttonBox_accepted();
void on_groupList_itemSelectionChanged();
void on_IncludeRelation_currentTextChanged(const QString &arg1);
void on_ExcludeRelation_currentTextChanged(const QString &arg1);
void on_IncludeKeywords_textChanged();
void on_ExcludeKeywords_textChanged();
void on_groupList_itemClicked(QListWidgetItem *item);
void on_groupList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
void on_subAddrTxt_textEdited(const QString &arg1);
void on_updateIntervalSB_valueChanged(double arg1);
void on_connectionsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
void on_groupIsSubscriptionGroup_clicked(bool checked);
void on_groupNameTxt_textEdited(const QString &arg1);
void onRCMDeleteConnectionTriggered();
void onRCMExportConnectionTriggered();
void on_deleteSelectedConnBtn_clicked();
void on_exportSelectedConnBtn_clicked();
void on_connectionsTable_customContextMenuRequested(const QPoint &pos);
void on_subscriptionTypeCB_currentIndexChanged(int arg1);
private:
void updateColorScheme() override;
void reloadConnectionsList(const GroupId &group);
void onRCMActionTriggered_Move();
void onRCMActionTriggered_Copy();
void onRCMActionTriggered_Link();
void reloadGroupRCMActions();
//
void exportConnectionFilter(CONFIGROOT &root);
//
DnsSettingsWidget *dnsSettingsWidget;
RouteSettingsMatrixWidget *routeSettingsWidget;
//
QMenu *connectionListRCMenu = new QMenu(this);
QAction *exportConnectionAction = new QAction(tr("Export Connection(s)"), connectionListRCMenu);
QAction *deleteConnectionAction = new QAction(tr("Delete Connection(s)"), connectionListRCMenu);
QMenu *connectionListRCMenu_CopyToMenu = new QMenu(tr("Copy to..."));
QMenu *connectionListRCMenu_MoveToMenu = new QMenu(tr("Move to..."));
QMenu *connectionListRCMenu_LinkToMenu = new QMenu(tr("Link to..."));
bool isUpdateInProgress = false;
GroupId currentGroupId = NullGroupId;
ConnectionId currentConnectionId = NullConnectionId;
};
| 3,337
|
C++
|
.h
| 78
| 36.025641
| 100
| 0.706642
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,305
|
w_PreferencesWindow.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/windows/w_PreferencesWindow.hpp
|
#pragma once
#include "base/Qv2rayBase.hpp"
#include "ui/common/QvMessageBus.hpp"
#include "ui/widgets/common/WidgetUIBase.hpp"
#include "ui_w_PreferencesWindow.h"
class RouteSettingsMatrixWidget;
class DnsSettingsWidget;
class PreferencesWindow
: public QvDialog
, private Ui::PreferencesWindow
{
Q_OBJECT
public:
explicit PreferencesWindow(QWidget *parent = nullptr);
~PreferencesWindow();
void processCommands(QString command, QStringList commands, QMap<QString, QString>) override
{
const static QMap<QString, int> indexMap{
{ "general", 0 }, //
{ "kernel", 1 }, //
{ "inbound", 2 }, //
{ "connection", 3 }, //
{ "dns", 4 }, //
{ "route", 5 }, //
{ "about", 6 } //
};
if (commands.isEmpty())
return;
if (command == "open")
{
const auto c = commands.takeFirst();
tabWidget->setCurrentIndex(indexMap[c]);
}
}
private:
void updateColorScheme() override{};
QvMessageBusSlotDecl override;
private slots:
void on_buttonBox_accepted();
void on_httpAuthCB_stateChanged(int arg1);
void on_socksAuthCB_stateChanged(int arg1);
void on_languageComboBox_currentTextChanged(const QString &arg1);
void on_logLevelComboBox_currentIndexChanged(int index);
void on_vCoreAssetsPathTxt_textEdited(const QString &arg1);
void on_listenIPTxt_textEdited(const QString &arg1);
void on_socksPortLE_valueChanged(int arg1);
void on_httpPortLE_valueChanged(int arg1);
void on_httpAuthUsernameTxt_textEdited(const QString &arg1);
void on_httpAuthPasswordTxt_textEdited(const QString &arg1);
void on_socksAuthUsernameTxt_textEdited(const QString &arg1);
void on_socksAuthPasswordTxt_textEdited(const QString &arg1);
void on_latencyRealPingTestURLTxt_textEdited(const QString &arg1);
void on_proxyDefaultCb_stateChanged(int arg1);
void on_selectVAssetBtn_clicked();
void on_aboutQt_clicked();
void on_cancelIgnoreVersionBtn_clicked();
void on_bypassCNCb_stateChanged(int arg1);
void on_bypassBTCb_stateChanged(int arg1);
void on_statsPortBox_valueChanged(int arg1);
void on_socksUDPCB_stateChanged(int arg1);
void on_socksUDPIP_textEdited(const QString &arg1);
void on_selectVCoreBtn_clicked();
void on_vCorePathTxt_textEdited(const QString &arg1);
void on_themeCombo_currentTextChanged(const QString &arg1);
void on_darkThemeCB_stateChanged(int arg1);
void on_darkTrayCB_stateChanged(int arg1);
void on_glyphTrayCB_stateChanged(int arg1);
void on_setSysProxyCB_stateChanged(int arg1);
void on_autoStartSubsCombo_currentIndexChanged(int arg1);
void on_autoStartConnCombo_currentIndexChanged(int arg1);
void on_fpTypeCombo_currentIndexChanged(int arg1);
void on_fpAddressTx_textEdited(const QString &arg1);
void on_fpUseAuthCB_stateChanged(int arg1);
void on_fpUsernameTx_textEdited(const QString &arg1);
void on_fpPasswordTx_textEdited(const QString &arg1);
void on_fpPortSB_valueChanged(int arg1);
void on_checkVCoreSettings_clicked();
void on_httpGroupBox_clicked(bool checked);
void on_socksGroupBox_clicked(bool checked);
void on_fpGroupBox_clicked(bool checked);
void on_maxLogLinesSB_valueChanged(int arg1);
void on_enableAPI_stateChanged(int arg1);
void on_startWithLoginCB_stateChanged(int arg1);
void on_updateChannelCombo_currentIndexChanged(int index);
void on_pluginKernelV2RayIntegrationCB_stateChanged(int arg1);
void on_pluginKernelPortAllocateCB_valueChanged(int arg1);
void on_qvProxyAddressTxt_textEdited(const QString &arg1);
void on_qvProxyTypeCombo_currentTextChanged(const QString &arg1);
void on_qvProxyPortCB_valueChanged(int arg1);
void on_setTestlatencyCB_stateChanged(int arg1);
void on_setTestlatencyOnConnectedCB_stateChanged(int arg1);
void on_quietModeCB_stateChanged(int arg1);
void on_tproxyGroupBox_toggled(bool arg1);
void on_tProxyPort_valueChanged(int arg1);
void on_tproxyEnableTCP_toggled(bool checked);
void on_tproxyEnableUDP_toggled(bool checked);
void on_tproxyMode_currentTextChanged(const QString &arg1);
void on_tproxyListenAddr_textEdited(const QString &arg1);
void on_tproxyListenV6Addr_textEdited(const QString &arg1);
void on_jumpListCountSB_valueChanged(int arg1);
void on_outboundMark_valueChanged(int arg1);
void on_dnsIntercept_toggled(bool checked);
void on_qvProxyCustomProxy_clicked();
void on_qvProxySystemProxy_clicked();
void on_qvProxyNoProxy_clicked();
void on_dnsFreedomCb_stateChanged(int arg1);
void on_httpSniffingCB_stateChanged(int arg1);
void on_httpOverrideHTTPCB_stateChanged(int arg1);
void on_httpOverrideTLSCB_stateChanged(int arg1);
void on_socksSniffingCB_stateChanged(int arg1);
void on_socksOverrideHTTPCB_stateChanged(int arg1);
void on_socksOverrideTLSCB_stateChanged(int arg1);
void on_tproxySniffingCB_stateChanged(int arg1);
void on_tproxyOverrideHTTPCB_stateChanged(int arg1);
void on_tproxyOverrideTLSCB_stateChanged(int arg1);
void on_pushButton_clicked();
void on_noAutoConnectRB_clicked();
void on_lastConnectedRB_clicked();
void on_fixedAutoConnectRB_clicked();
void on_latencyTCPingRB_clicked();
void on_latencyICMPingRB_clicked();
void on_qvNetworkUATxt_editTextChanged(const QString &arg1);
void on_V2RayOutboundStatsCB_stateChanged(int arg1);
void on_hasDirectStatisticsCB_stateChanged(int arg1);
void on_useOldShareLinkFormatCB_stateChanged(int arg1);
void on_bypassPrivateCb_clicked(bool checked);
void on_disableSystemRootCB_stateChanged(int arg1);
void on_openConfigDirCB_clicked();
void on_startMinimizedCB_stateChanged(int arg1);
void on_exitByCloseEventCB_stateChanged(int arg1);
void on_httpSniffingMetadataOnly_stateChanged(int arg1);
void on_socksSniffingMetadataOnly_stateChanged(int arg1);
void on_tproxySniffingMetadataOnlyCB_stateChanged(int arg1);
void on_socksOverrideFakeDNSCB_stateChanged(int arg1);
void on_socksOverrideFakeDNSOthersCB_stateChanged(int arg1);
void on_httpOverrideFakeDNSCB_stateChanged(int arg1);
void on_httpOverrideFakeDNSOthersCB_stateChanged(int arg1);
void on_tproxyOverrideFakeDNSCB_stateChanged(int arg1);
void on_tproxyOverrideFakeDNSOthersCB_stateChanged(int arg1);
void on_browserForwarderAddressTxt_textEdited(const QString &arg1);
void on_browserForwarderPortSB_valueChanged(int arg1);
private:
DnsSettingsWidget *dnsSettingsWidget;
RouteSettingsMatrixWidget *routeSettingsWidget;
void SetAutoStartButtonsState(bool isAutoStart);
//
bool NeedRestart = false;
bool finishedLoading = false;
Qv2rayConfigObject CurrentConfig;
private:
std::optional<QString> checkTProxySettings() const;
};
| 6,999
|
C++
|
.h
| 152
| 40.631579
| 96
| 0.752998
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,306
|
w_ImportConfig.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/windows/w_ImportConfig.hpp
|
#pragma once
#include "ui/widgets/common/WidgetUIBase.hpp"
#include "ui_w_ImportConfig.h"
class ImportConfigWindow
: public QvDialog
, private Ui::ImportConfigWindow
{
Q_OBJECT
public:
explicit ImportConfigWindow(QWidget *parent = nullptr);
~ImportConfigWindow();
int PerformImportConnection();
QMultiMap<QString, CONFIGROOT> SelectConnection(bool outboundsOnly);
void processCommands(QString command, QStringList commands, QMap<QString, QString> args) override
{
#if QV2RAY_FEATURE(ui_has_import_qrcode)
const static QMap<QString, int> indexMap{ { "link", 0 }, { "qr", 1 }, { "advanced", 2 } };
#else
const static QMap<QString, int> indexMap{ { "link", 0 }, { "advanced", 1 } };
#endif
nameTxt->setText(args["name"]);
if (commands.isEmpty())
return;
if (command == "open")
{
const auto c = commands.takeFirst();
tabWidget->setCurrentIndex(indexMap[c]);
}
}
private:
QvMessageBusSlotDecl override;
private slots:
#if QV2RAY_FEATURE(ui_has_import_qrcode)
void on_qrFromScreenBtn_clicked();
void on_selectImageBtn_clicked();
void on_hideQv2rayCB_stateChanged(int arg1);
#endif
void on_errorsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
void on_beginImportBtn_clicked();
void on_cancelImportBtn_clicked();
void on_routeEditBtn_clicked();
void on_jsonEditBtn_clicked();
void on_selectFileBtn_clicked();
private:
void updateColorScheme() override;
QMap<QString, QString> linkErrors;
//
// Use hash here since the order is not important.
QHash<GroupId, QMultiMap<QString, CONFIGROOT>> connectionsToExistingGroup;
QMap<QString, QMultiMap<QString, CONFIGROOT>> connectionsToNewGroup;
};
| 1,822
|
C++
|
.h
| 51
| 30.607843
| 101
| 0.704249
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,307
|
w_ScreenShot_Core.hpp
|
Qv2ray_Qv2ray/src/ui/widgets/windows/w_ScreenShot_Core.hpp
|
#pragma once
#include "ui_w_ScreenShot_Core.h"
#include <QDialog>
#include <QImage>
#include <QKeyEvent>
#include <QLabel>
#include <QMouseEvent>
#include <QPalette>
#include <QPushButton>
#include <QRubberBand>
#include <QScreen>
class ScreenShotWindow
: public QDialog
, private Ui::ScreenShot
{
Q_OBJECT
public:
ScreenShotWindow();
~ScreenShotWindow();
QImage DoScreenShot();
//
void mouseMoveEvent(QMouseEvent *e) override;
void mousePressEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
private slots:
void on_startBtn_clicked();
private:
double scale;
QRubberBand rubber;
// Desktop Image
QPixmap desktopImage;
QImage windowBg;
QImage resultImage;
//
QPoint origin;
QPoint end;
int imgW, imgH, imgX, imgY;
void pSize();
};
| 908
|
C++
|
.h
| 40
| 19.1
| 52
| 0.721578
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,309
|
QRCodeHelper.hpp
|
Qv2ray_Qv2ray/src/ui/common/QRCodeHelper.hpp
|
#pragma once
class QImage;
class QSize;
class QString;
namespace Qv2ray::ui
{
QString DecodeQRCode(const QImage &img);
QImage EncodeQRCode(const QString content, int size);
} // namespace Qv2ray::ui
using namespace Qv2ray::ui;
| 237
|
C++
|
.h
| 10
| 21.7
| 57
| 0.782222
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,310
|
QvMessageBus.hpp
|
Qv2ray_Qv2ray/src/ui/common/QvMessageBus.hpp
|
#pragma once
#include <QObject>
#define QvMessageBusConnect(CLASSNAME) connect(&UIMessageBus, &QvMessageBusObject::QvSendMessage, this, &CLASSNAME::on_QvMessageReceived)
#define QvMessageBusSlotSig const QvMBMessage &msg
#define QvMessageBusSlotIdentifier on_QvMessageReceived
#define QvMessageBusSlotDecl void QvMessageBusSlotIdentifier(QvMessageBusSlotSig)
#define QvMessageBusSlotImpl(CLASSNAME) void CLASSNAME::QvMessageBusSlotIdentifier(QvMessageBusSlotSig)
#define MBShowDefaultImpl \
case SHOW_WINDOWS: \
this->setWindowOpacity(1); \
break;
#define MBHideDefaultImpl \
case HIDE_WINDOWS: \
this->setWindowOpacity(0); \
break;
#define MBRetranslateDefaultImpl \
case RETRANSLATE: \
this->retranslateUi(this); \
break;
#define MBUpdateColorSchemeDefaultImpl \
case UPDATE_COLORSCHEME: this->updateColorScheme(); break;
namespace Qv2ray::ui::messaging
{
Q_NAMESPACE
enum QvMBMessage
{
/// Show all windows.
SHOW_WINDOWS,
/// Hide all windows.
HIDE_WINDOWS,
/// Retranslate User Interface.
RETRANSLATE,
/// Change Color Scheme
UPDATE_COLORSCHEME
};
Q_ENUM_NS(QvMBMessage)
//
class QvMessageBusObject : public QObject
{
Q_OBJECT
public:
explicit QvMessageBusObject(){};
void EmitGlobalSignal(const QvMBMessage &msg)
{
emit QvSendMessage(msg);
}
signals:
void QvSendMessage(const QvMBMessage &msg);
// private slots:
// void on_QvMessageReceived(QvMessage msg);
};
inline QvMessageBusObject UIMessageBus = QvMessageBusObject();
} // namespace Qv2ray::ui::messaging
using namespace Qv2ray::ui::messaging;
| 2,967
|
C++
|
.h
| 54
| 49.018519
| 150
| 0.416121
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,311
|
speedwidget.hpp
|
Qv2ray_Qv2ray/src/ui/common/speedchart/speedwidget.hpp
|
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015 Anton Lashkov <lenton_91@mail.ru>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#pragma once
#include <QGraphicsView>
#include <QMap>
#include <QPen>
class SpeedWidget : public QGraphicsView
{
Q_OBJECT
public:
enum GraphType
{
INBOUND_UP,
INBOUND_DOWN,
OUTBOUND_PROXY_UP,
OUTBOUND_PROXY_DOWN,
OUTBOUND_DIRECT_UP,
OUTBOUND_DIRECT_DOWN,
OUTBOUND_BLOCK_UP,
OUTBOUND_BLOCK_DOWN,
NB_GRAPHS,
};
struct PointData
{
qint64 x;
quint64 y[NB_GRAPHS];
PointData()
{
for (auto i = 0; i < NB_GRAPHS; i++)
y[i] = 0;
}
};
explicit SpeedWidget(QWidget *parent = nullptr);
void UpdateSpeedPlotSettings();
void AddPointData(QMap<SpeedWidget::GraphType, long> data);
void Clear();
void replot();
protected:
void paintEvent(QPaintEvent *event) override;
private:
struct GraphProperties
{
GraphProperties(){};
GraphProperties(const QString &name, const QPen &pen) : name(name), pen(pen){};
QString name;
QPen pen;
};
quint64 maxYValue();
QList<PointData> dataCollection;
QMap<GraphType, GraphProperties> m_properties;
};
| 2,614
|
C++
|
.h
| 76
| 29.618421
| 87
| 0.695772
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,312
|
QvAutoLaunch.hpp
|
Qv2ray_Qv2ray/src/ui/common/autolaunch/QvAutoLaunch.hpp
|
#pragma once
namespace Qv2ray::components::autolaunch
{
bool GetLaunchAtLoginStatus();
void SetLaunchAtLoginStatus(bool enable);
} // namespace Qv2ray::components::autolaunch
using namespace Qv2ray::components;
using namespace Qv2ray::components::autolaunch;
| 269
|
C++
|
.h
| 8
| 31.375
| 47
| 0.818533
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| true
| false
| true
| false
|
4,313
|
Qv2rayQMLProperty.hpp
|
Qv2ray_Qv2ray/src/ui/qml/Qv2rayQMLProperty.hpp
|
#pragma once
#include "core/handler/ConfigHandler.hpp"
#include "utils/QvHelpers.hpp"
#include <QObject>
#include <QVariant>
#define Q_PROPERTY_DECL(type, name, val) \
public: \
typedef type __prop_##name##_type; \
\
type &name() \
{ \
return __##name; \
} \
void set_##name(const type &_in_val) \
{ \
setProperty(#name, QVariant::fromValue(_in_val)); \
} \
\
private: \
type __##name = val
#define PROPERTY_CHANGED_SIGNAL_NAME(name) on_##name##_changed
#define PROPERTY_CHANGED_SIGNAL(name) \
void __property__internal__##name##_chk(const __prop_##name##_type d); \
void PROPERTY_CHANGED_SIGNAL_NAME(name)();
#define PROPERTY_ARGS(type, name) type name MEMBER __##name
#define PROPERTY_NOTIFY(type, name) PROPERTY_ARGS(type, name) NOTIFY PROPERTY_CHANGED_SIGNAL_NAME(name)
class Qv2rayQMLProperty : public QObject
{
Q_OBJECT
Q_PROPERTY_DECL(ConnectionGroupPair, currentConnection, {});
Q_PROPERTY_DECL(QString, assetsPrefix, "qrc:/assets/icons/ui_dark");
Q_PROPERTY(PROPERTY_ARGS(ConnectionGroupPair, currentConnection))
Q_PROPERTY(PROPERTY_ARGS(QString, assetsPrefix))
public:
explicit Qv2rayQMLProperty(QObject *parent = nullptr);
public slots:
void onButtonClicked(const QString &text)
{
QvMessageBoxWarn(nullptr, "Hi!", text);
}
};
| 3,358
|
C++
|
.h
| 41
| 70.804878
| 150
| 0.273194
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,314
|
Qv2rayQMLApplication.hpp
|
Qv2ray_Qv2ray/src/ui/qml/Qv2rayQMLApplication.hpp
|
#include "Qv2rayQMLProperty.hpp"
#include "base/Qv2rayBaseApplication.hpp"
#include "ui/Qv2rayPlatformApplication.hpp"
#include <QQuickView>
namespace Qv2ray
{
class Qv2rayQMLApplication : public Qv2rayPlatformApplication
{
Q_OBJECT
public:
explicit Qv2rayQMLApplication(int &argc, char *argv[]);
void MessageBoxWarn(QWidget *parent, const QString &title, const QString &text) override;
void MessageBoxInfo(QWidget *parent, const QString &title, const QString &text) override;
MessageOpt MessageBoxAsk(QWidget *parent, const QString &title, const QString &text, const QList<MessageOpt> &buttons) override;
QStringList checkPrerequisitesInternal() override;
Qv2rayExitReason runQv2rayInternal() override;
void terminateUIInternal() override;
void OpenURL(const QString &url) override;
private slots:
#ifndef QV2RAY_NO_SINGLEAPPLICATON
void onMessageReceived(quint32, QByteArray) override;
#endif
private:
QQuickView qmlViewer;
Qv2rayQMLProperty uiProperty;
};
#ifdef Qv2rayApplication
#undef Qv2rayApplication
#endif
#define Qv2rayApplication Qv2rayQMLApplication
#define QvQmlApplication static_cast<Qv2rayQMLApplication *>(qApp)
} // namespace Qv2ray
| 1,284
|
C++
|
.h
| 32
| 35
| 136
| 0.763242
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,315
|
Qv2rayCliApplication.hpp
|
Qv2ray_Qv2ray/src/ui/cli/Qv2rayCliApplication.hpp
|
#include "base/Qv2rayBaseApplication.hpp"
#include "src/ui/Qv2rayPlatformApplication.hpp"
namespace Qv2ray
{
class Qv2rayCliApplication : public Qv2rayPlatformApplication
{
Q_OBJECT
public:
explicit Qv2rayCliApplication(int &argc, char *argv[]);
QStringList checkPrerequisitesInternal() override;
Qv2rayExitReason runQv2rayInternal() override;
public:
void MessageBoxWarn(QWidget *, const QString &, const QString &) override
{
}
void MessageBoxInfo(QWidget *, const QString &, const QString &) override
{
}
MessageOpt MessageBoxAsk(QWidget *, const QString &, const QString &, const QList<MessageOpt> &) override
{
return OK;
}
void OpenURL(const QString &) override
{
}
private:
void terminateUIInternal() override;
#ifndef QV2RAY_NO_SINGLEAPPLICATON
void onMessageReceived(quint32 clientID, QByteArray msg) override;
#endif
};
#ifdef Qv2rayApplication
#undef Qv2rayApplication
#endif
#define Qv2rayApplication Qv2rayCliApplication
#define QvCliApplication static_cast<Qv2rayCliApplication *>(qApp)
} // namespace Qv2ray
| 1,215
|
C++
|
.h
| 37
| 26.648649
| 113
| 0.701365
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,316
|
QvVPNService.hpp
|
Qv2ray_Qv2ray/src/platforms/android/QvVPNService.hpp
|
#pragma once
#include <QAndroidIntent>
#include <QAndroidService>
class QvVPNService : QAndroidService
{
public:
QvVPNService(int &argc, char *argv[]);
QAndroidBinder *onBind(const QAndroidIntent &intent);
};
| 221
|
C++
|
.h
| 9
| 22.222222
| 57
| 0.77619
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
4,317
|
Qv2rayFeatures.hpp
|
Qv2ray_Qv2ray/src/base/Qv2rayFeatures.hpp
|
#pragma once
// Qv2ray build features.
// clang-format off
// Kernel Options
#define QVFEATURE_kernel_check_abi -1
#define QVFEATURE_kernel_check_permission 1
#define QVFEATURE_kernel_check_output 1
#define QVFEATURE_kernel_check_filename 1
#define QVFEATURE_kernel_set_permission -1
// UI Options
#define QVFEATURE_ui_has_import_qrcode -1
#define QVFEATURE_ui_has_store_state -1
// Utilities
#define QVFEATURE_util_has_ntp 1
// clang-format on
#define QV2RAY_FEATURE(feat) ((1 / QVFEATURE_##feat) == 1)
| 592
|
C++
|
.h
| 16
| 35.625
| 58
| 0.675439
|
Qv2ray/Qv2ray
| 16,635
| 3,255
| 47
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.