mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 19:00:22 +08:00
[Fix] Some fixes in Issue #21
This commit is contained in:
parent
28ca0adafd
commit
a3f92dbdca
@ -275,13 +275,14 @@ namespace Qv2ray
|
|||||||
int alterId;
|
int alterId;
|
||||||
string security;
|
string security;
|
||||||
int level;
|
int level;
|
||||||
UserObject() : id(), alterId(64), security("auto"), level(0) {}
|
UserObject() : id(""), alterId(64), security("auto"), level(0) {}
|
||||||
XTOSTRUCT(O(id, alterId, security, level))
|
XTOSTRUCT(O(id, alterId, security, level))
|
||||||
};
|
};
|
||||||
// OUTBound;
|
// OUTBound;
|
||||||
string address;
|
string address;
|
||||||
int port;
|
int port;
|
||||||
list<UserObject> users;
|
list<UserObject> users;
|
||||||
|
ServerObject(): address(""), port(0), users() {}
|
||||||
XTOSTRUCT(O(address, port, users))
|
XTOSTRUCT(O(address, port, users))
|
||||||
};
|
};
|
||||||
list<ServerObject> vnext;
|
list<ServerObject> vnext;
|
||||||
|
@ -16,6 +16,9 @@ ConnectionEditWindow::ConnectionEditWindow(QWidget *parent)
|
|||||||
ui->alterLineEdit->setValidator(new QIntValidator());
|
ui->alterLineEdit->setValidator(new QIntValidator());
|
||||||
//
|
//
|
||||||
LoadGUIContents();
|
LoadGUIContents();
|
||||||
|
vmess = VMessOut::ServerObject();
|
||||||
|
vmess.users.push_back(VMessOut::ServerObject::UserObject());
|
||||||
|
stream = StreamSettingsObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionEditWindow::ConnectionEditWindow(QJsonObject editRootObject, QString alias, QWidget *parent)
|
ConnectionEditWindow::ConnectionEditWindow(QJsonObject editRootObject, QString alias, QWidget *parent)
|
||||||
@ -91,7 +94,7 @@ void ConnectionEditWindow::LoadGUIContents()
|
|||||||
void ConnectionEditWindow::on_buttonBox_accepted()
|
void ConnectionEditWindow::on_buttonBox_accepted()
|
||||||
{
|
{
|
||||||
bool new_config = _alias == "";
|
bool new_config = _alias == "";
|
||||||
auto alias = new_config ? ui->ipLineEdit->text() : _alias;
|
auto alias = new_config ? (ui->ipLineEdit->text() + "_" + ui->portLineEdit->text()) : _alias;
|
||||||
//
|
//
|
||||||
auto outbound = GenerateConnectionJson();
|
auto outbound = GenerateConnectionJson();
|
||||||
QJsonArray outbounds;
|
QJsonArray outbounds;
|
||||||
|
@ -26,8 +26,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
QAction *actionShowHide = new QAction(this->windowIcon(), tr("#Hide"), this);
|
QAction *actionShowHide = new QAction(this->windowIcon(), tr("#Hide"), this);
|
||||||
QAction *actionQuit = new QAction(tr("#Quit"), this);
|
QAction *actionQuit = new QAction(tr("#Quit"), this);
|
||||||
QAction *actionStart = new QAction(tr("#Start"), this);
|
QAction *actionStart = new QAction(tr("#Start"), this);
|
||||||
QAction *actionRestart = new QAction(tr("#Stop"), this);
|
QAction *actionRestart = new QAction(tr("#Restart"), this);
|
||||||
QAction *actionStop = new QAction(tr("#Restart"), this);
|
QAction *actionStop = new QAction(tr("#Stop"), this);
|
||||||
actionStart->setEnabled(true);
|
actionStart->setEnabled(true);
|
||||||
actionStop->setEnabled(false);
|
actionStop->setEnabled(false);
|
||||||
actionRestart->setEnabled(false);
|
actionRestart->setEnabled(false);
|
||||||
@ -95,10 +95,18 @@ void MainWindow::on_startButton_clicked()
|
|||||||
auto full_conf = GenerateRuntimeConfig(connections.value(CurrentConnectionName));
|
auto full_conf = GenerateRuntimeConfig(connections.value(CurrentConnectionName));
|
||||||
StartPreparation(full_conf);
|
StartPreparation(full_conf);
|
||||||
bool startFlag = this->vinstance->Start();
|
bool startFlag = this->vinstance->Start();
|
||||||
ui->statusLabel->setText(tr("#Started") + ": " + CurrentConnectionName);
|
|
||||||
|
if (startFlag) {
|
||||||
|
ui->statusLabel->setText(tr("#Started") + ": " + CurrentConnectionName);
|
||||||
|
}
|
||||||
|
|
||||||
trayMenu->actions()[2]->setEnabled(!startFlag);
|
trayMenu->actions()[2]->setEnabled(!startFlag);
|
||||||
trayMenu->actions()[3]->setEnabled(startFlag);
|
trayMenu->actions()[3]->setEnabled(startFlag);
|
||||||
trayMenu->actions()[4]->setEnabled(startFlag);
|
trayMenu->actions()[4]->setEnabled(startFlag);
|
||||||
|
//
|
||||||
|
ui->startButton->setEnabled(!startFlag);
|
||||||
|
ui->stopButton->setEnabled(startFlag);
|
||||||
|
ui->restartButton->setEnabled(startFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_stopButton_clicked()
|
void MainWindow::on_stopButton_clicked()
|
||||||
@ -111,6 +119,10 @@ void MainWindow::on_stopButton_clicked()
|
|||||||
trayMenu->actions()[2]->setEnabled(true);
|
trayMenu->actions()[2]->setEnabled(true);
|
||||||
trayMenu->actions()[3]->setEnabled(false);
|
trayMenu->actions()[3]->setEnabled(false);
|
||||||
trayMenu->actions()[4]->setEnabled(false);
|
trayMenu->actions()[4]->setEnabled(false);
|
||||||
|
//
|
||||||
|
ui->startButton->setEnabled(true);
|
||||||
|
ui->stopButton->setEnabled(false);
|
||||||
|
ui->restartButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_restartButton_clicked()
|
void MainWindow::on_restartButton_clicked()
|
||||||
@ -243,7 +255,9 @@ void MainWindow::on_delConfigBtn_clicked()
|
|||||||
|
|
||||||
if (currentSelected < 0) return;
|
if (currentSelected < 0) return;
|
||||||
|
|
||||||
if (ui->connectionListWidget->item(currentSelected)->text() == CurrentConnectionName) {
|
bool isRemovingRunning = ui->connectionListWidget->item(currentSelected)->text() == CurrentConnectionName;
|
||||||
|
|
||||||
|
if (isRemovingRunning) {
|
||||||
on_stopButton_clicked();
|
on_stopButton_clicked();
|
||||||
CurrentConnectionName = "";
|
CurrentConnectionName = "";
|
||||||
}
|
}
|
||||||
@ -252,7 +266,10 @@ void MainWindow::on_delConfigBtn_clicked()
|
|||||||
conf.configs = list.toStdList();
|
conf.configs = list.toStdList();
|
||||||
SetGlobalConfig(conf);
|
SetGlobalConfig(conf);
|
||||||
SaveGlobalConfig();
|
SaveGlobalConfig();
|
||||||
reload_config();
|
|
||||||
|
if (isRemovingRunning) {
|
||||||
|
reload_config();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_prefrencesBtn_clicked()
|
void MainWindow::on_prefrencesBtn_clicked()
|
||||||
@ -276,3 +293,8 @@ void MainWindow::on_editConnectionSettingsBtn_clicked()
|
|||||||
w->show();
|
w->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_clearlogButton_clicked()
|
||||||
|
{
|
||||||
|
ui->logText->clear();
|
||||||
|
}
|
||||||
|
@ -48,6 +48,8 @@ class MainWindow : public QMainWindow
|
|||||||
|
|
||||||
void on_editConnectionSettingsBtn_clicked();
|
void on_editConnectionSettingsBtn_clicked();
|
||||||
|
|
||||||
|
void on_clearlogButton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ShowAndSetConnection(int index, bool SetConnection, bool Apply);
|
void ShowAndSetConnection(int index, bool SetConnection, bool Apply);
|
||||||
void LoadConnections();
|
void LoadConnections();
|
||||||
|
@ -50,6 +50,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="stopButton">
|
<widget class="QPushButton" name="stopButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>#Stop</string>
|
<string>#Stop</string>
|
||||||
</property>
|
</property>
|
||||||
@ -57,6 +60,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="restartButton">
|
<widget class="QPushButton" name="restartButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>#Restart</string>
|
<string>#Restart</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Prefrences</string>
|
<string>Prefrences</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="modal">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
Loading…
Reference in New Issue
Block a user