diff --git a/Qv2ray.pro b/Qv2ray.pro index 6a6d1512..f140b28c 100644 --- a/Qv2ray.pro +++ b/Qv2ray.pro @@ -4,9 +4,7 @@ # #------------------------------------------------- -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +QT += core gui widgets TARGET = Qv2ray TEMPLATE = app diff --git a/src/main.cpp b/src/main.cpp index a111eb2e..8f8d8437 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) } // Show MainWindow - Ui_Impl::MainWindow w; + Ui::MainWindow w; w.show(); return _qApp.exec(); } diff --git a/src/w_ConnectionEditWindow.cpp b/src/w_ConnectionEditWindow.cpp index 00e56435..18c236f5 100644 --- a/src/w_ConnectionEditWindow.cpp +++ b/src/w_ConnectionEditWindow.cpp @@ -5,33 +5,30 @@ #include #include -namespace Qv2ray +namespace Ui { - namespace Ui_Impl + ConnectionEditWindow::ConnectionEditWindow(QWidget *parent) + : QDialog(parent) + , ui(new Ui_WConnectionEdit) { - ConnectionEditWindow::ConnectionEditWindow(QWidget *parent) - : QDialog(parent) - , ui(new Ui_ConnectionEditWindow) - { - ui->setupUi(this); - ui->portLineEdit->setValidator(new QIntValidator()); - ui->alterLineEdit->setValidator(new QIntValidator()); - } - - ConnectionEditWindow::~ConnectionEditWindow() - { - delete ui; - } - - //void ConnectionEditWindow::getConfigFromDialog(Ui::ConnectionEditWindow *ui) - //{ - //this->host = ui->ipLineEdit->text(); - //this->port = ui->portLineEdit->text(); - //this->alias = ui->aliasLineEdit->text(); - //this->uuid = ui->idLineEdit->text(); - //this->alterid = ui->alterLineEdit->text(); - //this->security = ui->securityCombo->currentText(); - //this->isCustom = 0; - //} + ui->setupUi(this); + ui->portLineEdit->setValidator(new QIntValidator()); + ui->alterLineEdit->setValidator(new QIntValidator()); } + + ConnectionEditWindow::~ConnectionEditWindow() + { + delete ui; + } + + //void ConnectionEditWindow::getConfigFromDialog(Ui::ConnectionEditWindow *ui) + //{ + //this->host = ui->ipLineEdit->text(); + //this->port = ui->portLineEdit->text(); + //this->alias = ui->aliasLineEdit->text(); + //this->uuid = ui->idLineEdit->text(); + //this->alterid = ui->alterLineEdit->text(); + //this->security = ui->securityCombo->currentText(); + //this->isCustom = 0; + //} } diff --git a/src/w_ConnectionEditWindow.h b/src/w_ConnectionEditWindow.h index 89562a9f..1c50565b 100644 --- a/src/w_ConnectionEditWindow.h +++ b/src/w_ConnectionEditWindow.h @@ -4,21 +4,18 @@ #include #include "ui_w_ConnectionEditWindow.h" -namespace Qv2ray +namespace Ui { - namespace Ui_Impl + class ConnectionEditWindow : public QDialog { - class ConnectionEditWindow : public QDialog - { - Q_OBJECT + Q_OBJECT - public: - explicit ConnectionEditWindow(QWidget *parent = nullptr); - ~ConnectionEditWindow(); + public: + explicit ConnectionEditWindow(QWidget *parent = nullptr); + ~ConnectionEditWindow(); - private: - Ui_ConnectionEditWindow *ui; - }; - } + private: + Ui_WConnectionEdit *ui; + }; } #endif // CONFEDIT_H diff --git a/src/w_ConnectionEditWindow.ui b/src/w_ConnectionEditWindow.ui index 0bbb1213..3a988eee 100644 --- a/src/w_ConnectionEditWindow.ui +++ b/src/w_ConnectionEditWindow.ui @@ -1,7 +1,7 @@ - ConnectionEditWindow - + WConnectionEdit + 0 @@ -864,7 +864,7 @@ buttonBox accepted() - ConnectionEditWindow + WConnectionEdit accept() @@ -880,7 +880,7 @@ buttonBox rejected() - ConnectionEditWindow + WConnectionEdit reject() diff --git a/src/w_ImportConfig.cpp b/src/w_ImportConfig.cpp index 39b7310f..0183da7b 100644 --- a/src/w_ImportConfig.cpp +++ b/src/w_ImportConfig.cpp @@ -16,122 +16,120 @@ #include "w_ImportConfig.h" using namespace Qv2ray; -namespace Qv2ray + +namespace Ui { - namespace Ui_Impl + ImportConfig::ImportConfig(QWidget *parent) + : QDialog(parent) + , ui(new Ui_WImportConfig) { - ImportConfig::ImportConfig(QWidget *parent) - : QDialog(parent) - , ui(new Ui_ImportConfig) - { - ui->setupUi(this); - connect(this, SIGNAL(updateConfTable()), parentWidget(), SLOT(updateConfTable())); - } + ui->setupUi(this); + connect(this, SIGNAL(updateConfTable()), parentWidget(), SLOT(updateConfTable())); + } - ImportConfig::~ImportConfig() - { - delete ui; - } + ImportConfig::~ImportConfig() + { + delete ui; + } - void ImportConfig::on_pushButton_clicked() - { - QString dir = QFileDialog::getOpenFileName(this, tr("OpenConfigFile"), "~/"); - ui->fileLineTxt->setText(dir); - } + void ImportConfig::on_pushButton_clicked() + { + QString dir = QFileDialog::getOpenFileName(this, tr("OpenConfigFile"), "~/"); + ui->fileLineTxt->setText(dir); + } - void ImportConfig::savefromFile(QString path, QString alias) - { - Q_UNUSED(path) - Q_UNUSED(alias) - //Hv2Config newConfig; - //newConfig.alias = alias; - //QFile configFile(path); - //if(!configFile.open(QIODevice::ReadOnly)) { - // showWarnMessageBox(this, tr("ImportConfig"), tr("CannotOpenFile")); - // qDebug() << "ImportConfig::CannotOpenFile"; - // return; - //} - //QByteArray allData = configFile.readAll(); - //configFile.close(); - //QJsonDocument v2conf(QJsonDocument::fromJson(allData)); - //QJsonObject rootobj = v2conf.object(); - //QJsonObject outbound; - //if(rootobj.contains("outbounds")) { - // outbound = rootobj.value("outbounds").toArray().first().toObject(); - //} else { - // outbound = rootobj.value("outbound").toObject(); - //} - //QJsonObject vnext = switchJsonArrayObject(outbound.value("settings").toObject(), "vnext"); - //QJsonObject user = switchJsonArrayObject(vnext, "users"); - //newConfig.host = vnext.value("address").toString(); - //newConfig.port = QString::number(vnext.value("port").toInt()); - //newConfig.alterid = QString::number(user.value("alterId").toInt()); - //newConfig.uuid = user.value("id").toString(); - //newConfig.security = user.value("security").toString(); - //if (newConfig.security.isNull()) { - // newConfig.security = "auto"; - //} - //newConfig.isCustom = 1; - //int id = newConfig.save(); - //if(id < 0) - //{ - // showWarnMessageBox(this, tr("ImportConfig"), tr("SaveFailed")); - // qDebug() << "ImportConfig::SaveFailed"; - // return; - //} - //emit updateConfTable(); - //QString newFile = "conf/" + QString::number(id) + ".conf"; - //if(!QFile::copy(path, newFile)) { - // showWarnMessageBox(this, tr("ImportConfig"), tr("CannotCopyCustomConfig")); - // qDebug() << "ImportConfig::CannotCopyCustomConfig"; - //} - } + void ImportConfig::savefromFile(QString path, QString alias) + { + Q_UNUSED(path) + Q_UNUSED(alias) + //Hv2Config newConfig; + //newConfig.alias = alias; + //QFile configFile(path); + //if(!configFile.open(QIODevice::ReadOnly)) { + // showWarnMessageBox(this, tr("ImportConfig"), tr("CannotOpenFile")); + // qDebug() << "ImportConfig::CannotOpenFile"; + // return; + //} + //QByteArray allData = configFile.readAll(); + //configFile.close(); + //QJsonDocument v2conf(QJsonDocument::fromJson(allData)); + //QJsonObject rootobj = v2conf.object(); + //QJsonObject outbound; + //if(rootobj.contains("outbounds")) { + // outbound = rootobj.value("outbounds").toArray().first().toObject(); + //} else { + // outbound = rootobj.value("outbound").toObject(); + //} + //QJsonObject vnext = switchJsonArrayObject(outbound.value("settings").toObject(), "vnext"); + //QJsonObject user = switchJsonArrayObject(vnext, "users"); + //newConfig.host = vnext.value("address").toString(); + //newConfig.port = QString::number(vnext.value("port").toInt()); + //newConfig.alterid = QString::number(user.value("alterId").toInt()); + //newConfig.uuid = user.value("id").toString(); + //newConfig.security = user.value("security").toString(); + //if (newConfig.security.isNull()) { + // newConfig.security = "auto"; + //} + //newConfig.isCustom = 1; + //int id = newConfig.save(); + //if(id < 0) + //{ + // showWarnMessageBox(this, tr("ImportConfig"), tr("SaveFailed")); + // qDebug() << "ImportConfig::SaveFailed"; + // return; + //} + //emit updateConfTable(); + //QString newFile = "conf/" + QString::number(id) + ".conf"; + //if(!QFile::copy(path, newFile)) { + // showWarnMessageBox(this, tr("ImportConfig"), tr("CannotCopyCustomConfig")); + // qDebug() << "ImportConfig::CannotCopyCustomConfig"; + //} + } - void ImportConfig::on_buttonBox_accepted() - { - QString alias = ui->nameTxt->text(); + void ImportConfig::on_buttonBox_accepted() + { + QString alias = ui->nameTxt->text(); - if (ui->importSourceCombo->currentIndex() == 0) { // From File... - QString path = ui->fileLineTxt->text(); - bool isValid = v2Instance::checkConfigFile(path); + if (ui->importSourceCombo->currentIndex() == 0) { // From File... + QString path = ui->fileLineTxt->text(); + bool isValid = v2Instance::checkConfigFile(path); - if (isValid) { - savefromFile(path, alias); - } - } else { - QString vmess = ui->vmessConnectionStringTxt->toPlainText(); - Py_Initialize(); - assert(Py_IsInitialized()); - QString param = "--inbound socks:1080 " + vmess + " -o config.json.tmp"; - PyRun_SimpleString("import sys"); - PyRun_SimpleString("sys.path.append('./utils')"); - PyObject *pModule = PyImport_ImportModule("vmess2json"); - PyObject *pFunc = PyObject_GetAttrString(pModule, "main"); - PyObject *arg = PyTuple_New(1); - PyObject *arg1 = Py_BuildValue("s", param.toStdString().c_str()); - PyTuple_SetItem(arg, 0, arg1); - PyObject_CallObject(pFunc, arg); - Py_Finalize(); - - if (QFile::exists(QCoreApplication::applicationDirPath() + "/config.json.tmp")) { - ImportConfig *im = new ImportConfig(this->parentWidget()); - - if (v2Instance::checkConfigFile(QCoreApplication::applicationDirPath() + "/config.json.tmp")) { - im->savefromFile("config.json.tmp", alias); - } - - QFile::remove("config.json.tmp"); - } else { - Utils::showWarnMessageBox(this, tr("ImportConfig"), tr("CannotGenerateConfig")); - qDebug() << "ImportConfig::CannotGenerateConfig"; - } + if (isValid) { + savefromFile(path, alias); } + } else { + QString vmess = ui->vmessConnectionStringTxt->toPlainText(); + Py_Initialize(); + assert(Py_IsInitialized()); + QString param = "--inbound socks:1080 " + vmess + " -o config.json.tmp"; + PyRun_SimpleString("import sys"); + PyRun_SimpleString("sys.path.append('./utils')"); + PyObject *pModule = PyImport_ImportModule("vmess2json"); + PyObject *pFunc = PyObject_GetAttrString(pModule, "main"); + PyObject *arg = PyTuple_New(1); + PyObject *arg1 = Py_BuildValue("s", param.toStdString().c_str()); + PyTuple_SetItem(arg, 0, arg1); + PyObject_CallObject(pFunc, arg); + Py_Finalize(); - if (ui->useCurrentSettingRidBtn->isChecked()) { - // TODO: Use Current Settings... + if (QFile::exists(QCoreApplication::applicationDirPath() + "/config.json.tmp")) { + ImportConfig *im = new ImportConfig(this->parentWidget()); + + if (v2Instance::checkConfigFile(QCoreApplication::applicationDirPath() + "/config.json.tmp")) { + im->savefromFile("config.json.tmp", alias); + } + + QFile::remove("config.json.tmp"); } else { - // TODO: Override Inbound.... + Utils::showWarnMessageBox(this, tr("ImportConfig"), tr("CannotGenerateConfig")); + qDebug() << "ImportConfig::CannotGenerateConfig"; } } + + if (ui->useCurrentSettingRidBtn->isChecked()) { + // TODO: Use Current Settings... + } else { + // TODO: Override Inbound.... + } } } diff --git a/src/w_ImportConfig.h b/src/w_ImportConfig.h index b1b1b0dc..bf065104 100644 --- a/src/w_ImportConfig.h +++ b/src/w_ImportConfig.h @@ -4,29 +4,26 @@ #include #include "ui_w_ImportConfig.h" -namespace Qv2ray +namespace Ui { - namespace Ui_Impl + class ImportConfig : public QDialog { - class ImportConfig : public QDialog - { - Q_OBJECT + Q_OBJECT - public: - explicit ImportConfig(QWidget *parent = nullptr); - void savefromFile(QString path, QString alias); - ~ImportConfig(); + public: + explicit ImportConfig(QWidget *parent = nullptr); + void savefromFile(QString path, QString alias); + ~ImportConfig(); - private slots: - void on_pushButton_clicked(); - void on_buttonBox_accepted(); - signals: - void updateConfTable(); + private slots: + void on_pushButton_clicked(); + void on_buttonBox_accepted(); + signals: + void updateConfTable(); - private: - Ui_ImportConfig *ui; - }; - } + private: + Ui_WImportConfig *ui; + }; } #endif // IMPORTCONF_H diff --git a/src/w_ImportConfig.ui b/src/w_ImportConfig.ui index dc5f219f..b25d14a7 100644 --- a/src/w_ImportConfig.ui +++ b/src/w_ImportConfig.ui @@ -1,7 +1,7 @@ - ImportConfig - + WImportConfig + 0 @@ -162,7 +162,7 @@ buttonBox accepted() - ImportConfig + WImportConfig accept() @@ -178,7 +178,7 @@ buttonBox rejected() - ImportConfig + WImportConfig reject() diff --git a/src/w_MainWindow.cpp b/src/w_MainWindow.cpp index 5736df59..b50ae500 100644 --- a/src/w_MainWindow.cpp +++ b/src/w_MainWindow.cpp @@ -15,268 +15,265 @@ #include "w_MainWindow.h" #include "w_PrefrencesWindow.h" -namespace Qv2ray +namespace Ui { - namespace Ui_Impl + void MainWindow::CreateTrayIcon() { - void MainWindow::CreateTrayIcon() - { - hTray = new QSystemTrayIcon(); - hTray->setToolTip(tr("Qv2ray")); - hTray->setIcon(this->windowIcon()); - connect(hTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(on_activatedTray(QSystemTrayIcon::ActivationReason))); - QAction *actionShow = new QAction(this); - QAction *actionQuit = new QAction(this); - QAction *actionStart = new QAction(this); - QAction *actionRestart = new QAction(this); - QAction *actionStop = new QAction(this); - actionShow->setText(tr("#Hide")); - actionQuit->setText(tr("#Quit")); - actionStart->setText(tr("#Start")); - actionStop->setText(tr("#Stop")); - actionRestart->setText(tr("#Restart")); - actionStart->setEnabled(true); - actionStop->setEnabled(false); - actionRestart->setEnabled(false); - trayMenu->addAction(actionShow); - trayMenu->addSeparator(); - trayMenu->addAction(actionStart); - trayMenu->addAction(actionStop); - trayMenu->addAction(actionRestart); - trayMenu->addSeparator(); - trayMenu->addAction(actionQuit); - connect(actionShow, SIGNAL(triggered()), this, SLOT(toggleMainWindowVisibility())); - connect(actionStart, SIGNAL(triggered()), this, SLOT(on_startButton_clicked())); - connect(actionStop, SIGNAL(triggered()), this, SLOT(on_stopButton_clicked())); - connect(actionRestart, SIGNAL(triggered()), this, SLOT(on_restartButton_clicked())); - connect(actionQuit, SIGNAL(triggered()), this, SLOT(quit())); - hTray->setContextMenu(trayMenu); - hTray->show(); + hTray = new QSystemTrayIcon(); + hTray->setToolTip(tr("Qv2ray")); + hTray->setIcon(this->windowIcon()); + connect(hTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(on_activatedTray(QSystemTrayIcon::ActivationReason))); + QAction *actionShow = new QAction(this); + QAction *actionQuit = new QAction(this); + QAction *actionStart = new QAction(this); + QAction *actionRestart = new QAction(this); + QAction *actionStop = new QAction(this); + actionShow->setText(tr("#Hide")); + actionQuit->setText(tr("#Quit")); + actionStart->setText(tr("#Start")); + actionStop->setText(tr("#Stop")); + actionRestart->setText(tr("#Restart")); + actionStart->setEnabled(true); + actionStop->setEnabled(false); + actionRestart->setEnabled(false); + trayMenu->addAction(actionShow); + trayMenu->addSeparator(); + trayMenu->addAction(actionStart); + trayMenu->addAction(actionStop); + trayMenu->addAction(actionRestart); + trayMenu->addSeparator(); + trayMenu->addAction(actionQuit); + connect(actionShow, SIGNAL(triggered()), this, SLOT(toggleMainWindowVisibility())); + connect(actionStart, SIGNAL(triggered()), this, SLOT(on_startButton_clicked())); + connect(actionStop, SIGNAL(triggered()), this, SLOT(on_stopButton_clicked())); + connect(actionRestart, SIGNAL(triggered()), this, SLOT(on_restartButton_clicked())); + connect(actionQuit, SIGNAL(triggered()), this, SLOT(quit())); + hTray->setContextMenu(trayMenu); + hTray->show(); + } + + MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui_WMain) + { + this->setWindowIcon(QIcon(":/icons/Qv2ray.ico")); + ui->setupUi(this); + UpdateConfigTable(); + // ui->configTable->setContextMenuPolicy(Qt::CustomContextMenu); + // connect(ui->configTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); + this->vinstance = new Qv2ray::v2Instance(this); + CreateTrayIcon(); + + if (QFileInfo("config.json").exists()) { + vinstance->start(); } - MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) - , ui(new Ui_MainWindow) - { - this->setWindowIcon(QIcon(":/icons/Qv2ray.ico")); - ui->setupUi(this); - UpdateConfigTable(); - // ui->configTable->setContextMenuPolicy(Qt::CustomContextMenu); - // connect(ui->configTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); - this->vinstance = new v2Instance(this); - CreateTrayIcon(); + // QAction *select = new QAction("Select", ui->configTable); + // QAction *del = new QAction("Delete", ui->configTable); + // QAction *rename = new QAction("Rename", ui->configTable); + // popMenu->addAction(select); + // popMenu->addAction(del); + // popMenu->addAction(rename); + // connect(select, SIGNAL(triggered()), this, SLOT(select_triggered())); + // connect(del, SIGNAL(triggered()), this, SLOT(delConf())); + // connect(rename, SIGNAL(triggered()), this, SLOT(renameRow())); + // connect(ui->logText, SIGNAL(textChanged()), this, SLOT(scrollToBottom())); + // bar = ui->logText->verticalScrollBar(); + } - if (QFileInfo("config.json").exists()) { - vinstance->start(); - } + MainWindow::~MainWindow() + { + hTray->hide(); + delete this->hTray; + delete this->vinstance; + delete ui; + } - // QAction *select = new QAction("Select", ui->configTable); - // QAction *del = new QAction("Delete", ui->configTable); - // QAction *rename = new QAction("Rename", ui->configTable); - // popMenu->addAction(select); - // popMenu->addAction(del); - // popMenu->addAction(rename); - // connect(select, SIGNAL(triggered()), this, SLOT(select_triggered())); - // connect(del, SIGNAL(triggered()), this, SLOT(delConf())); - // connect(rename, SIGNAL(triggered()), this, SLOT(renameRow())); - // connect(ui->logText, SIGNAL(textChanged()), this, SLOT(scrollToBottom())); - // bar = ui->logText->verticalScrollBar(); - } + void MainWindow::on_actionEdit_triggered() + { + ConnectionEditWindow *e = new ConnectionEditWindow(this); + e->setAttribute(Qt::WA_DeleteOnClose); + e->show(); + } - MainWindow::~MainWindow() - { - hTray->hide(); - delete this->hTray; - delete this->vinstance; - delete ui; - } + void MainWindow::on_actionExisting_config_triggered() + { + ImportConfig *f = new ImportConfig(this); + f->setAttribute(Qt::WA_DeleteOnClose); + f->show(); + } - void MainWindow::on_actionEdit_triggered() - { - ConnectionEditWindow *e = new ConnectionEditWindow(this); - e->setAttribute(Qt::WA_DeleteOnClose); - e->show(); - } + void MainWindow::showMenu(QPoint pos) + { + Q_UNUSED(pos) + // if(ui->configTable->indexAt(pos).column() != -1) { + // popMenu->move(cursor().pos()); + // popMenu->show(); + // } + } + void MainWindow::select_triggered() + { + // int row = ui->configTable->selectionModel()->currentIndex().row(); + // int idIntable = ui->configTable->model()->data(ui->configTable->model()->index(row, 4)).toInt(); + // this->geneConf(idIntable); + // if(this->v2Inst->v2Process->state() == QProcess::Running) { + // this->on_restartButton_clicked(); + // } + } - void MainWindow::on_actionExisting_config_triggered() - { - ImportConfig *f = new ImportConfig(this); - f->setAttribute(Qt::WA_DeleteOnClose); - f->show(); - } + void MainWindow::DeleteConfig() + { + } + void MainWindow::UpdateConfigTable() + { + } + void MainWindow::GenerateConfig(int idIntable) + { + Q_UNUSED(idIntable) + //Hv2Config tmpConf; + //emit UpdateConfigTable(); + //if (tmpConf.isCustom == 1) { + // QString src = "conf/" + QString::number(idIntable) + ".conf"; + // overrideInbounds(src); + // if (QFile::exists("config.json")) { + // QFile::remove("config.json"); + // } + // QFile::copy(src, "config.json"); + //} else { + // // TODO: Config generator + //} + } + void MainWindow::UpdateLog() + { + ui->logText->insertPlainText(this->vinstance->vProcess->readAllStandardOutput()); + } - void MainWindow::showMenu(QPoint pos) - { - Q_UNUSED(pos) - // if(ui->configTable->indexAt(pos).column() != -1) { - // popMenu->move(cursor().pos()); - // popMenu->show(); - // } - } - void MainWindow::select_triggered() - { - // int row = ui->configTable->selectionModel()->currentIndex().row(); - // int idIntable = ui->configTable->model()->data(ui->configTable->model()->index(row, 4)).toInt(); - // this->geneConf(idIntable); - // if(this->v2Inst->v2Process->state() == QProcess::Running) { - // this->on_restartButton_clicked(); - // } - } + void MainWindow::on_startButton_clicked() + { + ui->logText->clear(); + bool startFlag = this->vinstance->start(); + trayMenu->actions()[2]->setEnabled(!startFlag); + trayMenu->actions()[3]->setEnabled(startFlag); + trayMenu->actions()[4]->setEnabled(startFlag); + } - void MainWindow::DeleteConfig() - { - } - void MainWindow::UpdateConfigTable() - { - } - void MainWindow::GenerateConfig(int idIntable) - { - Q_UNUSED(idIntable) - //Hv2Config tmpConf; - //emit UpdateConfigTable(); - //if (tmpConf.isCustom == 1) { - // QString src = "conf/" + QString::number(idIntable) + ".conf"; - // overrideInbounds(src); - // if (QFile::exists("config.json")) { - // QFile::remove("config.json"); - // } - // QFile::copy(src, "config.json"); - //} else { - // // TODO: Config generator - //} - } - void MainWindow::UpdateLog() - { - ui->logText->insertPlainText(this->vinstance->vProcess->readAllStandardOutput()); - } + void MainWindow::on_stopButton_clicked() + { + this->vinstance->stop(); + ui->logText->clear(); + trayMenu->actions()[2]->setEnabled(true); + trayMenu->actions()[3]->setEnabled(false); + trayMenu->actions()[4]->setEnabled(false); + } - void MainWindow::on_startButton_clicked() - { - ui->logText->clear(); - bool startFlag = this->vinstance->start(); - trayMenu->actions()[2]->setEnabled(!startFlag); - trayMenu->actions()[3]->setEnabled(startFlag); - trayMenu->actions()[4]->setEnabled(startFlag); - } + void MainWindow::on_restartButton_clicked() + { + on_stopButton_clicked(); + on_startButton_clicked(); + } - void MainWindow::on_stopButton_clicked() - { - this->vinstance->stop(); - ui->logText->clear(); - trayMenu->actions()[2]->setEnabled(true); - trayMenu->actions()[3]->setEnabled(false); - trayMenu->actions()[4]->setEnabled(false); - } + void MainWindow::on_clbutton_clicked() + { + ui->logText->clear(); + } - void MainWindow::on_restartButton_clicked() - { - on_stopButton_clicked(); - on_startButton_clicked(); - } + void MainWindow::on_rtButton_clicked() + { + emit UpdateConfigTable(); + } - void MainWindow::on_clbutton_clicked() - { - ui->logText->clear(); - } + void MainWindow::closeEvent(QCloseEvent *event) + { + this->hide(); + event->ignore(); + } - void MainWindow::on_rtButton_clicked() - { - emit UpdateConfigTable(); - } - - void MainWindow::closeEvent(QCloseEvent *event) - { - this->hide(); - event->ignore(); - } - - void MainWindow::on_activatedTray(QSystemTrayIcon::ActivationReason reason) - { - switch (reason) { - case QSystemTrayIcon::Trigger: - // Toggle Show/Hide + void MainWindow::on_activatedTray(QSystemTrayIcon::ActivationReason reason) + { + switch (reason) { + case QSystemTrayIcon::Trigger: + // Toggle Show/Hide #ifndef __APPLE__ - // Every single click will trigger the Show/Hide toggling. - // So, as a hobby on common MacOS Apps, we 'don't toggle visibility on click'. - toggleMainWindowVisibility(); + // Every single click will trigger the Show/Hide toggling. + // So, as a hobby on common MacOS Apps, we 'don't toggle visibility on click'. + toggleMainWindowVisibility(); #endif - break; + break; - case QSystemTrayIcon::DoubleClick: - if (this->isHidden()) { - this->show(); - } + case QSystemTrayIcon::DoubleClick: + if (this->isHidden()) { + this->show(); + } - break; + break; - case QSystemTrayIcon::MiddleClick: + case QSystemTrayIcon::MiddleClick: - // TODO: Check if an alert message box is present. - // If so, do nothing but please wait for the message box to be closed. - if (this->vinstance->vProcess->state() == QProcess::ProcessState::Running) { - on_stopButton_clicked(); - } else { - on_startButton_clicked(); - } + // TODO: Check if an alert message box is present. + // If so, do nothing but please wait for the message box to be closed. + if (this->vinstance->vProcess->state() == QProcess::ProcessState::Running) { + on_stopButton_clicked(); + } else { + on_startButton_clicked(); + } - break; + break; - case QSystemTrayIcon::Unknown: - break; + case QSystemTrayIcon::Unknown: + break; - case QSystemTrayIcon::Context: - break; - } - } - - void MainWindow::toggleMainWindowVisibility() - { - if (this->isHidden()) { - this->show(); - trayMenu->actions()[0]->setText(tr("#Hide")); - } else { - this->hide(); - trayMenu->actions()[0]->setText(tr("#Show")); - } - } - - void MainWindow::quit() - { - QCoreApplication::quit(); - } - - void MainWindow::on_actionExit_triggered() - { - quit(); - } - - void MainWindow::renameRow() - { - // QString text = QInputDialog::getText(this, "Rename config", "New name:", QLineEdit::Normal); - // int row = ui->configTable->currentIndex().row(); - // int idIntable = ui->configTable->model()->data(ui->configTable->model()->index(row, 4)).toInt(); - // SQLiteDB mydb; - // QString updateString = "update confs set alias = '" + text + "' where id = " + QString::number(idIntable); - // mydb.DoQuery(updateString); - // emit updateConfTable(); - } - - void MainWindow::scrollToBottom() - { - bar->setValue(bar->maximum()); - } - - void MainWindow::on_actionPreferences_triggered() - { - PrefrencesWindow *v = new PrefrencesWindow(this); - v->setAttribute(Qt::WA_DeleteOnClose); - v->show(); - } - - void MainWindow::on_pushButton_clicked() - { - auto confedit = new ConnectionEditWindow(); - confedit->show(); + case QSystemTrayIcon::Context: + break; } } + + void MainWindow::toggleMainWindowVisibility() + { + if (this->isHidden()) { + this->show(); + trayMenu->actions()[0]->setText(tr("#Hide")); + } else { + this->hide(); + trayMenu->actions()[0]->setText(tr("#Show")); + } + } + + void MainWindow::quit() + { + QCoreApplication::quit(); + } + + void MainWindow::on_actionExit_triggered() + { + quit(); + } + + void MainWindow::renameRow() + { + // QString text = QInputDialog::getText(this, "Rename config", "New name:", QLineEdit::Normal); + // int row = ui->configTable->currentIndex().row(); + // int idIntable = ui->configTable->model()->data(ui->configTable->model()->index(row, 4)).toInt(); + // SQLiteDB mydb; + // QString updateString = "update confs set alias = '" + text + "' where id = " + QString::number(idIntable); + // mydb.DoQuery(updateString); + // emit updateConfTable(); + } + + void MainWindow::scrollToBottom() + { + bar->setValue(bar->maximum()); + } + + void MainWindow::on_actionPreferences_triggered() + { + PrefrencesWindow *v = new PrefrencesWindow(this); + v->setAttribute(Qt::WA_DeleteOnClose); + v->show(); + } + + void MainWindow::on_pushButton_clicked() + { + auto confedit = new ConnectionEditWindow(); + confedit->show(); + } } diff --git a/src/w_MainWindow.h b/src/w_MainWindow.h index 6c3e1612..e97e0c76 100644 --- a/src/w_MainWindow.h +++ b/src/w_MainWindow.h @@ -10,53 +10,51 @@ #include "vinteract.hpp" #include "V2ConfigObjects.hpp" -namespace Qv2ray + +namespace Ui { - namespace Ui_Impl + class MainWindow : public QMainWindow { - class MainWindow : public QMainWindow - { - Q_OBJECT - public: - explicit MainWindow(QWidget *parent = nullptr); - v2Instance *vinstance; - QSystemTrayIcon *hTray; - QMenu *trayMenu = new QMenu(this); - QMenu *popMenu = new QMenu(this); - QScrollBar *bar; - ~MainWindow(); + Q_OBJECT + public: + explicit MainWindow(QWidget *parent = nullptr); + Qv2ray::v2Instance *vinstance; + QSystemTrayIcon *hTray; + QMenu *trayMenu = new QMenu(this); + QMenu *popMenu = new QMenu(this); + QScrollBar *bar; + ~MainWindow(); - private slots: - void on_restartButton_clicked(); - void on_actionEdit_triggered(); - void on_actionExisting_config_triggered(); - void UpdateConfigTable(); - void DeleteConfig(); - void showMenu(QPoint pos); - void UpdateLog(); - void on_startButton_clicked(); - void on_stopButton_clicked(); - void select_triggered(); - void on_clbutton_clicked(); - void on_rtButton_clicked(); - void GenerateConfig(int idIntable); - void on_activatedTray(QSystemTrayIcon::ActivationReason reason); - void toggleMainWindowVisibility(); - void quit(); - void on_actionExit_triggered(); - void renameRow(); - void scrollToBottom(); - void on_actionPreferences_triggered(); + private slots: + void on_restartButton_clicked(); + void on_actionEdit_triggered(); + void on_actionExisting_config_triggered(); + void UpdateConfigTable(); + void DeleteConfig(); + void showMenu(QPoint pos); + void UpdateLog(); + void on_startButton_clicked(); + void on_stopButton_clicked(); + void select_triggered(); + void on_clbutton_clicked(); + void on_rtButton_clicked(); + void GenerateConfig(int idIntable); + void on_activatedTray(QSystemTrayIcon::ActivationReason reason); + void toggleMainWindowVisibility(); + void quit(); + void on_actionExit_triggered(); + void renameRow(); + void scrollToBottom(); + void on_actionPreferences_triggered(); - void on_pushButton_clicked(); + void on_pushButton_clicked(); - private: - Ui_MainWindow *ui; - void closeEvent(QCloseEvent *); - void createTrayAction(); - void CreateTrayIcon(); - }; - } + private: + Ui_WMain *ui; + void closeEvent(QCloseEvent *); + void createTrayAction(); + void CreateTrayIcon(); + }; } diff --git a/src/w_MainWindow.ui b/src/w_MainWindow.ui index 15f196f3..7654679a 100644 --- a/src/w_MainWindow.ui +++ b/src/w_MainWindow.ui @@ -1,7 +1,7 @@ - MainWindow - + WMain + 0 diff --git a/src/w_PrefrencesWindow.cpp b/src/w_PrefrencesWindow.cpp index 633ca143..eb95a3a9 100644 --- a/src/w_PrefrencesWindow.cpp +++ b/src/w_PrefrencesWindow.cpp @@ -16,104 +16,102 @@ #include #endif -using namespace Qv2ray; -using namespace Utils; +using namespace Qv2ray::Utils; -namespace Qv2ray +namespace Ui { - namespace Ui_Impl + PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent), + CurrentConfig(), + ui(new Ui_WPrefrences) { - PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent), CurrentConfig(), ui(new Ui_PrefrencesWindow) - { - ui->setupUi(this); - CurrentConfig = GetGlobalConfig(); - ui->languageComboBox->setCurrentText(QString::fromStdString(CurrentConfig.language)); - ui->runAsRootCheckBox->setChecked(CurrentConfig.runAsRoot); - ui->logLevelCheckBox->setCurrentText(QString::fromStdString(CurrentConfig.logLevel)); - // - ui->httpCB->setChecked(CurrentConfig.httpSetting.enabled); - ui->httpPortLE->setText(QString::fromStdString(to_string(CurrentConfig.httpSetting.port))); - ui->httpAuthCB->setChecked(CurrentConfig.httpSetting.useAuthentication); - ui->httpAuthUsernameTxt->setText(QString::fromStdString(CurrentConfig.httpSetting.authUsername)); - ui->httpAuthPasswordTxt->setText(QString::fromStdString(CurrentConfig.httpSetting.authPassword)); - ui->httpPortLE->setValidator(new QIntValidator()); - // - ui->socksCB->setChecked(CurrentConfig.socksSetting.enabled); - ui->socksPortLE->setText(QString::fromStdString(to_string(CurrentConfig.socksSetting.port))); - ui->socksAuthCB->setChecked(CurrentConfig.socksSetting.useAuthentication); - ui->socksAuthUsernameTxt->setText(QString::fromStdString(CurrentConfig.socksSetting.authUsername)); - ui->socksAuthPasswordTxt->setText(QString::fromStdString(CurrentConfig.socksSetting.authPassword)); - // - ui->httpPortLE->setValidator(new QIntValidator()); - ui->socksPortLE->setValidator(new QIntValidator()); - parentMW = parent; - } + ui->setupUi(this); + CurrentConfig = GetGlobalConfig(); + ui->languageComboBox->setCurrentText(QString::fromStdString(CurrentConfig.language)); + ui->runAsRootCheckBox->setChecked(CurrentConfig.runAsRoot); + ui->logLevelCheckBox->setCurrentText(QString::fromStdString(CurrentConfig.logLevel)); + // + ui->httpCB->setChecked(CurrentConfig.httpSetting.enabled); + ui->httpPortLE->setText(QString::fromStdString(to_string(CurrentConfig.httpSetting.port))); + ui->httpAuthCB->setChecked(CurrentConfig.httpSetting.useAuthentication); + ui->httpAuthUsernameTxt->setText(QString::fromStdString(CurrentConfig.httpSetting.authUsername)); + ui->httpAuthPasswordTxt->setText(QString::fromStdString(CurrentConfig.httpSetting.authPassword)); + ui->httpPortLE->setValidator(new QIntValidator()); + // + ui->socksCB->setChecked(CurrentConfig.socksSetting.enabled); + ui->socksPortLE->setText(QString::fromStdString(to_string(CurrentConfig.socksSetting.port))); + ui->socksAuthCB->setChecked(CurrentConfig.socksSetting.useAuthentication); + ui->socksAuthUsernameTxt->setText(QString::fromStdString(CurrentConfig.socksSetting.authUsername)); + ui->socksAuthPasswordTxt->setText(QString::fromStdString(CurrentConfig.socksSetting.authPassword)); + // + ui->httpPortLE->setValidator(new QIntValidator()); + ui->socksPortLE->setValidator(new QIntValidator()); + parentMW = parent; + } - PrefrencesWindow::~PrefrencesWindow() - { - delete ui; - } + PrefrencesWindow::~PrefrencesWindow() + { + delete ui; + } - void PrefrencesWindow::on_buttonBox_accepted() - { - if (v2Instance::checkVCoreExes()) { - if (ui->httpPortLE->text().toInt() != ui->socksPortLE->text().toInt()) { + void PrefrencesWindow::on_buttonBox_accepted() + { + if (Qv2ray::v2Instance::checkVCoreExes()) { + if (ui->httpPortLE->text().toInt() != ui->socksPortLE->text().toInt()) { #ifndef _WIN32 - // Set UID and GID in *nix - // The file is actually not here - QFileInfo v2rayCoreExeFile("v2ray"); + // Set UID and GID in *nix + // The file is actually not here + QFileInfo v2rayCoreExeFile("v2ray"); - if (ui->runAsRootCheckBox->isChecked() && v2rayCoreExeFile.ownerId() != 0) { - QProcess::execute("pkexec", QStringList() << "bash" - << "-c" - << "chown root:root " + QCoreApplication::applicationDirPath() + "/v2ray" + ";chmod +s " + QCoreApplication::applicationDirPath() + "/v2ray"); - } else if (!ui->runAsRootCheckBox->isChecked() && v2rayCoreExeFile.ownerId() == 0) { - uid_t uid = getuid(); - gid_t gid = getgid(); - QProcess::execute("pkexec", QStringList() << "chown" << QString::number(uid) + ":" + QString::number(gid) << QCoreApplication::applicationDirPath() + "/v2ray"); - } - - v2rayCoreExeFile.refresh(); - //rootObj.insert("v2suidEnabled", v2rayCoreExeFile.ownerId() == 0); -#else - // No such uid gid thing on windows.... -#endif - } else { - showWarnMessageBox(this, tr("Prefrences"), tr("PortNumbersCannotBeSame")); + if (ui->runAsRootCheckBox->isChecked() && v2rayCoreExeFile.ownerId() != 0) { + QProcess::execute("pkexec", QStringList() << "bash" + << "-c" + << "chown root:root " + QCoreApplication::applicationDirPath() + "/v2ray" + ";chmod +s " + QCoreApplication::applicationDirPath() + "/v2ray"); + } else if (!ui->runAsRootCheckBox->isChecked() && v2rayCoreExeFile.ownerId() == 0) { + uid_t uid = getuid(); + gid_t gid = getgid(); + QProcess::execute("pkexec", QStringList() << "chown" << QString::number(uid) + ":" + QString::number(gid) << QCoreApplication::applicationDirPath() + "/v2ray"); } - } - } - void PrefrencesWindow::on_httpCB_stateChanged(int checked) - { - if (checked != Qt::Checked) { - ui->httpPortLE->setDisabled(true); - } else { - ui->httpPortLE->setEnabled(true); - } - } - - void PrefrencesWindow::on_socksCB_stateChanged(int checked) - { - if (checked != Qt::Checked) { - ui->socksPortLE->setEnabled(false); - } else { - ui->socksPortLE->setEnabled(true); - } - } - - void PrefrencesWindow::on_httpAuthCB_stateChanged(int checked) - { - if (checked) { - } - } - - void PrefrencesWindow::on_runAsRootCheckBox_stateChanged(int arg1) - { - Q_UNUSED(arg1) -#ifdef _WIN32 - showWarnMessageBox(this, tr("Prefrences"), tr("RunAsRootNotOnWindows")); + v2rayCoreExeFile.refresh(); + //rootObj.insert("v2suidEnabled", v2rayCoreExeFile.ownerId() == 0); +#else + // No such uid gid thing on windows.... #endif + } else { + showWarnMessageBox(this, tr("Prefrences"), tr("PortNumbersCannotBeSame")); + } } } + + void PrefrencesWindow::on_httpCB_stateChanged(int checked) + { + if (checked != Qt::Checked) { + ui->httpPortLE->setDisabled(true); + } else { + ui->httpPortLE->setEnabled(true); + } + } + + void PrefrencesWindow::on_socksCB_stateChanged(int checked) + { + if (checked != Qt::Checked) { + ui->socksPortLE->setEnabled(false); + } else { + ui->socksPortLE->setEnabled(true); + } + } + + void PrefrencesWindow::on_httpAuthCB_stateChanged(int checked) + { + if (checked) { + } + } + + void PrefrencesWindow::on_runAsRootCheckBox_stateChanged(int arg1) + { + Q_UNUSED(arg1) +#ifdef _WIN32 + showWarnMessageBox(this, tr("Prefrences"), tr("RunAsRootNotOnWindows")); +#endif + } } diff --git a/src/w_PrefrencesWindow.h b/src/w_PrefrencesWindow.h index 07409e10..41b89e73 100644 --- a/src/w_PrefrencesWindow.h +++ b/src/w_PrefrencesWindow.h @@ -5,32 +5,29 @@ #include #include "HConfigObjects.hpp" -namespace Qv2ray +namespace Ui { - namespace Ui_Impl + class PrefrencesWindow : public QDialog { - class PrefrencesWindow : public QDialog - { - Q_OBJECT + Q_OBJECT - public: - explicit PrefrencesWindow(QWidget *parent = nullptr); - ~PrefrencesWindow(); - QWidget *parentMW; + public: + explicit PrefrencesWindow(QWidget *parent = nullptr); + ~PrefrencesWindow(); + QWidget *parentMW; - private slots: - void on_buttonBox_accepted(); - void on_httpCB_stateChanged(int arg1); - void on_socksCB_stateChanged(int arg1); + private slots: + void on_buttonBox_accepted(); + void on_httpCB_stateChanged(int arg1); + void on_socksCB_stateChanged(int arg1); - void on_httpAuthCB_stateChanged(int arg1); + void on_httpAuthCB_stateChanged(int arg1); - void on_runAsRootCheckBox_stateChanged(int arg1); + void on_runAsRootCheckBox_stateChanged(int arg1); - private: - Qv2ray::QvConfigModels::Qv2Config CurrentConfig; - Ui_PrefrencesWindow *ui; - }; - } + private: + Qv2ray::QvConfigModels::Qv2Config CurrentConfig; + Ui_WPrefrences *ui; + }; } #endif // HVCONF_H diff --git a/src/w_PrefrencesWindow.ui b/src/w_PrefrencesWindow.ui index 12586791..30869764 100644 --- a/src/w_PrefrencesWindow.ui +++ b/src/w_PrefrencesWindow.ui @@ -1,7 +1,7 @@ - PrefrencesWindow - + WPrefrences + 0 @@ -345,7 +345,7 @@ buttonBox accepted() - PrefrencesWindow + WPrefrences accept() @@ -361,7 +361,7 @@ buttonBox rejected() - PrefrencesWindow + WPrefrences reject() diff --git a/translations/en-US.ts b/translations/en-US.ts index 9f9c123a..7244b12e 100644 --- a/translations/en-US.ts +++ b/translations/en-US.ts @@ -1,559 +1,6 @@ - - ConnectionEditWindow - - - #ConnectionSettings - Connection Settings - - - - - #Host - Host - - - - #Port - Port - - - - #Name - Name - - - - #UUID - UUID - - - - #AlterID - Alter ID - - - - - #Security - Security Settings - - - - auto - Auto - - - - - aes-128-gcm - aes-128-gcm - - - - - chacha20-poly1305 - chacha20-poly1305 - - - - - - - - none - Do not use - - - - #Transport - Transport Settings - - - - tcp (TCP) - tcp (TCP) - - - - http (HTTP) - http (HTTP) - - - - ws (WebSocket) - ws (WebSocket) - - - - kcp (mKCP) - kcp (mKCP) - - - - domainsocket (Domain Socket) - domainsocket (Domain Socket) - - - - quic (Quick UDP Internet Connection) - quic (Quick UDP Internet Connection) - - - - #TransportSettings - Transport Settings - - - - TCP - TCP - - - - http - HTTP - - - - - - #Type - Type - - - - #Request - Request - - - - - #InsertDefaultContent - Insert Default Content - - - - #Response - Response - - - - HTTP - HTTP - - - - - - #Path - Path - - - - WebSocket - WebSocket - - - - - #Headers - Headers - - - - mKCP - mKCP - - - - #MTU - MTU - - - - #TTI (ms) - TTI (ms) - - - - #UplinkCapacity (MB/s) - Uplink Capacity (MB/s) - - - - #Congestion - Congestion Control - - - - #Enabled - Enabled - - - - #DownlinkCapacity (MB/s) - Downlink Capacity (MB/s) - - - - #ReadBufferSize (MB) - Read Buffer Size (MB) - - - - #WriteBufferSize (MB) - Write Buffer Size (MB) - - - - - #Header - Headers - - - - - srtp (SRTP, FaceTime) - srtp (SRTP, FaceTime) - - - - - utp (BitTorrent) - utp (BitTorrent) - - - - - wechat-video (WeChat Video Message) - wechat-video (WeChat Video Message) - - - - - dtls (DTLS 1.2) - dtls (DTLS 1.2) - - - - - wireguard (WireGuard fake packets) - wireguard (WireGuard fake packets) - - - - DomainSocket - DomainSocket - - - - QUIC - QUIC - - - - #Key - Key - - - - ImportConfig - - - Import file - Import file - - - - #ImportFrom - Import From - - - - Existing File - Existing File - - - - VMess Connection String - VMess Connection String - - - - #FromFile - From file - - - - #Path - Path - - - - #SelectFile - Select File - - - - #Name - Name - - - - #Inbound - Inbound Settings - - - - #UseCurrent - Use Current Settings - - - - #UseImported - Use Imported Inbound Settings - - - - #From VMess Connection String - From VMess Connection String - - - - #VMess Connection String - VMess Connection String - - - - MainWindow - - - Qv2ray - - - - - #Start - Start - - - - #Stop - Stop - - - - #Restart - Restart - - - - #ClearLog - Clear Log - - - - #HostList - Host List - - - - #ConfigDetail - Detailed Config Info - - - - #Host - Host - - - - #Port - Port - - - - #UUID - UUID - - - - #Transport - Transport Settings - - - - - #ConnectionSettings - Connection Settings - - - - #File - File - - - - #NewConnection - New Connection - - - - #ManuallyInput - Manually Input Config - - - - #ImportConnection - Import Config File - - - - #Exit - Exit - - - - #Preferences - Preferences - - - - PrefrencesWindow - - - Prefrences - Preferences - - - - #General - General - - - - #Language - Language - - - - zh-CN - - - - - en-US - - - - - #RunAsRoot - Run v2ray as root - - - - - - - - - - #Enabled - Enabled - - - - #LogLevel - Log Level - - - - debug - Debug - - - - info - Info - - - - warning - Warning - - - - error - Error - - - - none - Do not use - - - - #MuxCool - Mux Settings - - - - #Concurrency - Maximum Connections - - - - #InboundSettings - Inbound Settings - - - - - #Port - Port - - - - 8080 - - - - - - #Username - Username - - - - - #Auth - Authentication - - - - - #Password - Password - - - - 9001 - - - - - HTTP - HTTP - - - - SOCKS - SOCKS - - QObject @@ -583,79 +30,632 @@ - Qv2ray::Ui_Impl::ImportConfig + Ui::ImportConfig - + OpenConfigFile - Open Config File + Open Config File - + ImportConfig - Import Config + Import Config - + CannotGenerateConfig - Failed to generate config file + Failed to generate config file - Qv2ray::Ui_Impl::MainWindow + Ui::MainWindow - + Qv2ray - + + + + + + #Hide + Hide + + + + #Quit + Quit - - #Hide - Hide + #Start + Start - #Quit - Quit + #Stop + Stop - #Start - Start - - - - #Stop - Stop - - - #Restart - Restart + Restart - + #Show - Show + Show - Qv2ray::Ui_Impl::PrefrencesWindow + Ui::PrefrencesWindow - - + + Prefrences - Preferences + Preferences - + PortNumbersCannotBeSame - Port numbers cannot be the same + Port numbers cannot be the same - + RunAsRootNotOnWindows - Run as root is not avaliable on Windows Platform + Run as root is not avaliable on Windows Platform + + + + WConnectionEdit + + + #ConnectionSettings + Connection Settings + + + + + #Host + Host + + + + #Port + Port + + + + #Name + Name + + + + #UUID + UUID + + + + #AlterID + Alter ID + + + + + #Security + Security Settings + + + + auto + Auto + + + + + aes-128-gcm + aes-128-gcm + + + + + chacha20-poly1305 + chacha20-poly1305 + + + + + + + + none + Do not use + + + + #Transport + Transport Settings + + + + tcp (TCP) + tcp (TCP) + + + + http (HTTP) + http (HTTP) + + + + ws (WebSocket) + ws (WebSocket) + + + + kcp (mKCP) + kcp (mKCP) + + + + domainsocket (Domain Socket) + domainsocket (Domain Socket) + + + + quic (Quick UDP Internet Connection) + quic (Quick UDP Internet Connection) + + + + #TransportSettings + Transport Settings + + + + TCP + TCP + + + + http + HTTP + + + + + + #Type + Type + + + + #Request + Request + + + + + #InsertDefaultContent + Insert Default Content + + + + #Response + Response + + + + HTTP + HTTP + + + + + + #Path + Path + + + + WebSocket + WebSocket + + + + + #Headers + Headers + + + + mKCP + mKCP + + + + #MTU + MTU + + + + #TTI (ms) + TTI (ms) + + + + #UplinkCapacity (MB/s) + Uplink Capacity (MB/s) + + + + #Congestion + Congestion Control + + + + #Enabled + Enabled + + + + #DownlinkCapacity (MB/s) + Downlink Capacity (MB/s) + + + + #ReadBufferSize (MB) + Read Buffer Size (MB) + + + + #WriteBufferSize (MB) + Write Buffer Size (MB) + + + + + #Header + Headers + + + + + srtp (SRTP, FaceTime) + srtp (SRTP, FaceTime) + + + + + utp (BitTorrent) + utp (BitTorrent) + + + + + wechat-video (WeChat Video Message) + wechat-video (WeChat Video Message) + + + + + dtls (DTLS 1.2) + dtls (DTLS 1.2) + + + + + wireguard (WireGuard fake packets) + wireguard (WireGuard fake packets) + + + + DomainSocket + DomainSocket + + + + QUIC + QUIC + + + + #Key + Key + + + + WImportConfig + + + Import file + Import file + + + + #ImportFrom + Import From + + + + Existing File + Existing File + + + + VMess Connection String + VMess Connection String + + + + #FromFile + From file + + + + #Path + Path + + + + #SelectFile + Select File + + + + #Name + Name + + + + #Inbound + Inbound Settings + + + + #UseCurrent + Use Current Settings + + + + #UseImported + Use Imported Inbound Settings + + + + #From VMess Connection String + From VMess Connection String + + + + #VMess Connection String + VMess Connection String + + + + WMain + + + Qv2ray + + + + + #Start + Start + + + + #Stop + Stop + + + + #Restart + Restart + + + + #ClearLog + Clear Log + + + + #HostList + Host List + + + + #ConfigDetail + Detailed Config Info + + + + #Host + Host + + + + #Port + Port + + + + #UUID + UUID + + + + #Transport + Transport Settings + + + + + #ConnectionSettings + Connection Settings + + + + #File + File + + + + #NewConnection + New Connection + + + + #ManuallyInput + Manually Input Config + + + + #ImportConnection + Import Config File + + + + #Exit + Exit + + + + #Preferences + Preferences + + + + WPrefrences + + + Prefrences + Preferences + + + + #General + General + + + + #Language + Language + + + + zh-CN + + + + + en-US + + + + + #RunAsRoot + Run v2ray as root + + + + + + + + + + #Enabled + Enabled + + + + #LogLevel + Log Level + + + + debug + Debug + + + + info + Info + + + + warning + Warning + + + + error + Error + + + + none + Do not use + + + + #MuxCool + Mux Settings + + + + #Concurrency + Maximum Connections + + + + #InboundSettings + Inbound Settings + + + + HTTP + HTTP + + + + + #Port + Port + + + + 8080 + + + + + + #Username + Username + + + + + #Auth + Authentication + + + + + #Password + Password + + + + SOCKS + SOCKS + + + + 9001 + diff --git a/translations/zh-CN.ts b/translations/zh-CN.ts index 5e1ef12e..ac79590d 100644 --- a/translations/zh-CN.ts +++ b/translations/zh-CN.ts @@ -1,559 +1,6 @@ - - ConnectionEditWindow - - - #ConnectionSettings - 连接设置 - - - - - #Host - 域名 - - - - #Port - 端口 - - - - #Name - 名称 - - - - #UUID - UUID - - - - #AlterID - Alter ID - - - - - #Security - 安全设置 - - - - auto - 自动 - - - - - aes-128-gcm - aes-128-gcm - - - - - chacha20-poly1305 - chacha20-poly1305 - - - - - - - - none - 不使用 - - - - #Transport - 传输设置 - - - - tcp (TCP) - tcp (TCP) - - - - http (HTTP) - http (HTTP) - - - - ws (WebSocket) - ws (WebSocket) - - - - kcp (mKCP) - kcp (mKCP) - - - - domainsocket (Domain Socket) - domainsocket (Domain Socket) - - - - quic (Quick UDP Internet Connection) - quic (Quick UDP Internet Connection) - - - - #TransportSettings - 传输设置 - - - - TCP - TCP - - - - http - HTTP - - - - - - #Type - 类型 - - - - #Request - 请求 - - - - - #InsertDefaultContent - 默认值 - - - - #Response - 相应 - - - - HTTP - HTTP - - - - - - #Path - 路径 - - - - WebSocket - WebSocket - - - - - #Headers - 头伪装 - - - - mKCP - mKCP - - - - #MTU - 最大传输单元 - - - - #TTI (ms) - 传输时间间隔 - - - - #UplinkCapacity (MB/s) - 上行链路容量 (MB/s) - - - - #Congestion - 拥塞控制 - - - - #Enabled - 启用 - - - - #DownlinkCapacity (MB/s) - 下行链路容量 (MB/s) - - - - #ReadBufferSize (MB) - 读取缓冲区大小 (MB) - - - - #WriteBufferSize (MB) - 写入缓冲区大小 (MB) - - - - - #Header - 头伪装 - - - - - srtp (SRTP, FaceTime) - srtp (SRTP, FaceTime) - - - - - utp (BitTorrent) - utp (BitTorrent) - - - - - wechat-video (WeChat Video Message) - wechat-video (WeChat Video Message) - - - - - dtls (DTLS 1.2) - dtls (DTLS 1.2) - - - - - wireguard (WireGuard fake packets) - wireguard (WireGuard fake packets) - - - - DomainSocket - DomainSocket - - - - QUIC - QUIC - - - - #Key - 密钥 - - - - ImportConfig - - - Import file - 导入文件 - - - - #ImportFrom - 导入源 - - - - Existing File - 现有文件 - - - - VMess Connection String - VMess 连接字符串 - - - - #FromFile - 从文件 - - - - #Path - 路径 - - - - #SelectFile - 选择文件 - - - - #Name - 名称 - - - - #Inbound - 入站设置 - - - - #UseCurrent - 使用现有设置 - - - - #UseImported - 使用导入的设置 - - - - #From VMess Connection String - 从 VMess 连接字符串 - - - - #VMess Connection String - VMess 连接字符串 - - - - MainWindow - - - Qv2ray - - - - - #Start - 启动 - - - - #Stop - 停止 - - - - #Restart - 重新启动 - - - - #ClearLog - 清除日志 - - - - #HostList - 服务器列表 - - - - #ConfigDetail - 配置详细信息 - - - - #Host - 域名 - - - - #Port - 端口 - - - - #UUID - UUID - - - - #Transport - 传输设置 - - - - - #ConnectionSettings - 连接设置 - - - - #File - 文件 - - - - #NewConnection - 新建连接 - - - - #ManuallyInput - 手动输入配置 - - - - #ImportConnection - 导入配置文件 - - - - #Exit - 退出 - - - - #Preferences - 首选项 - - - - PrefrencesWindow - - - Prefrences - 首选项 - - - - #General - 一般 - - - - #Language - 语言 - - - - zh-CN - - - - - en-US - - - - - #RunAsRoot - 使用 root 启动 - - - - - - - - - - #Enabled - 启用 - - - - #LogLevel - 日志等级 - - - - debug - 调试 - - - - info - 信息 - - - - warning - 警告 - - - - error - 错误 - - - - none - 不使用 - - - - #MuxCool - Mux 设置 - - - - #Concurrency - 最大并发连接数 - - - - #InboundSettings - 入站设置 - - - - - #Port - 端口 - - - - 8080 - - - - - - #Username - 用户名 - - - - - #Auth - 鉴权 - - - - - #Password - 密码 - - - - 9001 - - - - - HTTP - HTTP - - - - SOCKS - SOCKS - - QObject @@ -583,79 +30,632 @@ - Qv2ray::Ui_Impl::ImportConfig + Ui::ImportConfig - + OpenConfigFile - 打开配置文件 + 打开配置文件 - + ImportConfig - 导入配置 + 导入配置 - + CannotGenerateConfig - 无法生成配置文件 + 无法生成配置文件 - Qv2ray::Ui_Impl::MainWindow + Ui::MainWindow - + Qv2ray - + + + + + + #Hide + 隐藏 + + + + #Quit + 退出 - - #Hide - 隐藏 + #Start + 启动 - #Quit - 退出 + #Stop + 停止 - #Start - 启动 - - - - #Stop - 停止 - - - #Restart - 重新启动 + 重新启动 - + #Show - 显示 + 显示 - Qv2ray::Ui_Impl::PrefrencesWindow + Ui::PrefrencesWindow - - + + Prefrences - 首选项 + 首选项 - + PortNumbersCannotBeSame - 端口号不能相同 + 端口号不能相同 - + RunAsRootNotOnWindows - Windows 平台不支持这个选项 + Windows 平台不支持这个选项 + + + + WConnectionEdit + + + #ConnectionSettings + 连接设置 + + + + + #Host + 域名 + + + + #Port + 端口 + + + + #Name + 名称 + + + + #UUID + UUID + + + + #AlterID + Alter ID + + + + + #Security + 安全设置 + + + + auto + 自动 + + + + + aes-128-gcm + aes-128-gcm + + + + + chacha20-poly1305 + chacha20-poly1305 + + + + + + + + none + 不使用 + + + + #Transport + 传输设置 + + + + tcp (TCP) + tcp (TCP) + + + + http (HTTP) + http (HTTP) + + + + ws (WebSocket) + ws (WebSocket) + + + + kcp (mKCP) + kcp (mKCP) + + + + domainsocket (Domain Socket) + domainsocket (Domain Socket) + + + + quic (Quick UDP Internet Connection) + quic (Quick UDP Internet Connection) + + + + #TransportSettings + 传输设置 + + + + TCP + TCP + + + + http + HTTP + + + + + + #Type + 类型 + + + + #Request + 请求 + + + + + #InsertDefaultContent + 默认值 + + + + #Response + 相应 + + + + HTTP + HTTP + + + + + + #Path + 路径 + + + + WebSocket + WebSocket + + + + + #Headers + 头伪装 + + + + mKCP + mKCP + + + + #MTU + 最大传输单元 + + + + #TTI (ms) + 传输时间间隔 + + + + #UplinkCapacity (MB/s) + 上行链路容量 (MB/s) + + + + #Congestion + 拥塞控制 + + + + #Enabled + 启用 + + + + #DownlinkCapacity (MB/s) + 下行链路容量 (MB/s) + + + + #ReadBufferSize (MB) + 读取缓冲区大小 (MB) + + + + #WriteBufferSize (MB) + 写入缓冲区大小 (MB) + + + + + #Header + 头伪装 + + + + + srtp (SRTP, FaceTime) + srtp (SRTP, FaceTime) + + + + + utp (BitTorrent) + utp (BitTorrent) + + + + + wechat-video (WeChat Video Message) + wechat-video (WeChat Video Message) + + + + + dtls (DTLS 1.2) + dtls (DTLS 1.2) + + + + + wireguard (WireGuard fake packets) + wireguard (WireGuard fake packets) + + + + DomainSocket + DomainSocket + + + + QUIC + QUIC + + + + #Key + 密钥 + + + + WImportConfig + + + Import file + 导入文件 + + + + #ImportFrom + 导入源 + + + + Existing File + 现有文件 + + + + VMess Connection String + VMess 连接字符串 + + + + #FromFile + 从文件 + + + + #Path + 路径 + + + + #SelectFile + 选择文件 + + + + #Name + 名称 + + + + #Inbound + 入站设置 + + + + #UseCurrent + 使用现有设置 + + + + #UseImported + 使用导入的设置 + + + + #From VMess Connection String + 从 VMess 连接字符串 + + + + #VMess Connection String + VMess 连接字符串 + + + + WMain + + + Qv2ray + + + + + #Start + 启动 + + + + #Stop + 停止 + + + + #Restart + 重新启动 + + + + #ClearLog + 清除日志 + + + + #HostList + 服务器列表 + + + + #ConfigDetail + 配置详细信息 + + + + #Host + 域名 + + + + #Port + 端口 + + + + #UUID + UUID + + + + #Transport + 传输设置 + + + + + #ConnectionSettings + 连接设置 + + + + #File + 文件 + + + + #NewConnection + 新建连接 + + + + #ManuallyInput + 手动输入配置 + + + + #ImportConnection + 导入配置文件 + + + + #Exit + 退出 + + + + #Preferences + 首选项 + + + + WPrefrences + + + Prefrences + 首选项 + + + + #General + 一般 + + + + #Language + 语言 + + + + zh-CN + + + + + en-US + + + + + #RunAsRoot + 使用 root 启动 + + + + + + + + + + #Enabled + 启用 + + + + #LogLevel + 日志等级 + + + + debug + 调试 + + + + info + 信息 + + + + warning + 警告 + + + + error + 错误 + + + + none + 不使用 + + + + #MuxCool + Mux 设置 + + + + #Concurrency + 最大并发连接数 + + + + #InboundSettings + 入站设置 + + + + HTTP + HTTP + + + + + #Port + 端口 + + + + 8080 + + + + + + #Username + 用户名 + + + + + #Auth + 鉴权 + + + + + #Password + 密码 + + + + SOCKS + SOCKS + + + + 9001 +