mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 10:50:23 +08:00
[add] Added more VMess share options, fixed #162
This commit is contained in:
parent
a5aaff1cb6
commit
151890b7cc
@ -1 +1 @@
|
|||||||
1939
|
1954
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#define QV2RAY_CONFIG_DIR (Qv2ray::Utils::GetConfigDirPath())
|
#define QV2RAY_CONFIG_DIR (Qv2ray::Utils::GetConfigDirPath())
|
||||||
#define QV2RAY_CONFIG_FILE (QV2RAY_CONFIG_DIR + "Qv2ray.conf")
|
#define QV2RAY_CONFIG_FILE (QV2RAY_CONFIG_DIR + "Qv2ray.conf")
|
||||||
#define QV2RAY_SUBSCRIPTION_DIR (QV2RAY_CONFIG_DIR + "subscriptions/")
|
#define QV2RAY_SUBSCRIPTION_DIR (QV2RAY_CONFIG_DIR + "subscriptions/")
|
||||||
#define QV2RAY_QRCODE_DIR (QV2RAY_CONFIG_DIR + "qr_images/")
|
|
||||||
|
|
||||||
// Get GFWList and PAC file path.
|
// Get GFWList and PAC file path.
|
||||||
#define QV2RAY_RULES_DIR (QV2RAY_CONFIG_DIR + "rules/")
|
#define QV2RAY_RULES_DIR (QV2RAY_CONFIG_DIR + "rules/")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "w_ExportConfig.hpp"
|
#include "w_ExportConfig.hpp"
|
||||||
#include "QvUtils.hpp"
|
#include "QvUtils.hpp"
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
// Private initialiser
|
// Private initialiser
|
||||||
ConfigExporter::ConfigExporter(QWidget *parent) :
|
ConfigExporter::ConfigExporter(QWidget *parent) :
|
||||||
@ -58,14 +59,20 @@ void ConfigExporter::on_closeBtn_clicked()
|
|||||||
void ConfigExporter::on_saveBtn_clicked()
|
void ConfigExporter::on_saveBtn_clicked()
|
||||||
{
|
{
|
||||||
// Save
|
// Save
|
||||||
if (!QDir(QV2RAY_QRCODE_DIR).exists()) {
|
auto filePath = QFileDialog().getSaveFileName(this, tr("Save Image"), "", "Images (*.png)");
|
||||||
QDir().mkpath(QV2RAY_QRCODE_DIR);
|
auto result = image.save(filePath);
|
||||||
|
QDesktopServices::openUrl(QUrl::fromUserInput(filePath));
|
||||||
|
LOG(MODULE_FILE, "Saving an image to: " + filePath.toStdString() + " result: " + (result ? "OK" : "Failed"))
|
||||||
}
|
}
|
||||||
|
|
||||||
auto filePath = QV2RAY_QRCODE_DIR + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss-z.png");
|
void ConfigExporter::on_copyImageBtn_clicked()
|
||||||
auto result = image.save(filePath);
|
{
|
||||||
QDesktopServices::openUrl(QUrl(QV2RAY_QRCODE_DIR));
|
QGuiApplication::clipboard()->setImage(image);
|
||||||
LOG(MODULE_FILE, "Saving an image to: " + filePath.toStdString() + " result: " + (result ? "OK" : "Failed"))
|
QvMessageBox(this, tr("Share Connection"), tr("Image has been copied to the clipboard."));
|
||||||
// If succeed, we disable future save.
|
}
|
||||||
saveBtn->setEnabled(result);
|
|
||||||
|
void ConfigExporter::on_copyVMessBtn_clicked()
|
||||||
|
{
|
||||||
|
QGuiApplication::clipboard()->setText(message);
|
||||||
|
QvMessageBox(this, tr("Share Connection"), tr("VMess string has been copied to the clipboard."));
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,10 @@ class ConfigExporter : public QDialog, private Ui::ExportConfigWindow
|
|||||||
|
|
||||||
void on_saveBtn_clicked();
|
void on_saveBtn_clicked();
|
||||||
|
|
||||||
|
void on_copyImageBtn_clicked();
|
||||||
|
|
||||||
|
void on_copyVMessBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ConfigExporter(QWidget *parent);
|
explicit ConfigExporter(QWidget *parent);
|
||||||
QZXing qzxing;
|
QZXing qzxing;
|
||||||
|
@ -6,16 +6,19 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>532</width>
|
<width>661</width>
|
||||||
<height>666</height>
|
<height>347</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Export Config</string>
|
<string>Export Config</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="10,0,3,0">
|
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0" columnstretch="1,1">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="imageLabel">
|
<widget class="QLabel" name="imageLabel">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::Box</enum>
|
<enum>QFrame::Box</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -31,12 +34,21 @@
|
|||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Share Options</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Text Message</string>
|
<string>VMess Connection String</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -48,6 +60,34 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saveBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save Image</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copyImageBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy Image</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copyVMessBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy VMess</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
@ -62,13 +102,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="saveBtn">
|
|
||||||
<property name="text">
|
|
||||||
<string>Save</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="closeBtn">
|
<widget class="QPushButton" name="closeBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -80,6 +113,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>messageTxt</tabstop>
|
||||||
|
<tabstop>saveBtn</tabstop>
|
||||||
|
<tabstop>copyImageBtn</tabstop>
|
||||||
|
<tabstop>copyVMessBtn</tabstop>
|
||||||
|
<tabstop>closeBtn</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../resources.qrc"/>
|
<include location="../../resources.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user