mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 19:00:22 +08:00
[fix] Fixed a SIGABORT on port editing. See: #92
Former-commit-id: cc5a70e57c
This commit is contained in:
parent
72d5cac9f4
commit
026e6ae2f4
@ -104,8 +104,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//
|
//
|
||||||
QApplication _qApp(argc, argv);
|
QApplication _qApp(argc, argv);
|
||||||
|
|
||||||
// Qv2ray Initialize
|
// Qv2ray Initialize
|
||||||
initQv();
|
if (!initQv()) return -1;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Set special font in Windows
|
// Set special font in Windows
|
||||||
QFont font;
|
QFont font;
|
||||||
|
@ -33,7 +33,7 @@ PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent),
|
|||||||
//
|
//
|
||||||
bool have_http = CurrentConfig.inBoundSettings.http_port != 0;
|
bool have_http = CurrentConfig.inBoundSettings.http_port != 0;
|
||||||
ui->httpCB->setChecked(have_http);
|
ui->httpCB->setChecked(have_http);
|
||||||
ui->httpPortLE->setText(QSTRING(to_string(CurrentConfig.inBoundSettings.http_port)));
|
ui->httpPortLE->setValue(CurrentConfig.inBoundSettings.http_port);
|
||||||
ui->httpAuthCB->setChecked(CurrentConfig.inBoundSettings.http_useAuth);
|
ui->httpAuthCB->setChecked(CurrentConfig.inBoundSettings.http_useAuth);
|
||||||
//
|
//
|
||||||
ui->httpAuthCB->setEnabled(have_http);
|
ui->httpAuthCB->setEnabled(have_http);
|
||||||
@ -42,12 +42,11 @@ PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent),
|
|||||||
ui->httpAuthPasswordTxt->setEnabled(have_http && CurrentConfig.inBoundSettings.http_useAuth);
|
ui->httpAuthPasswordTxt->setEnabled(have_http && CurrentConfig.inBoundSettings.http_useAuth);
|
||||||
ui->httpAuthUsernameTxt->setText(QSTRING(CurrentConfig.inBoundSettings.httpAccount.user));
|
ui->httpAuthUsernameTxt->setText(QSTRING(CurrentConfig.inBoundSettings.httpAccount.user));
|
||||||
ui->httpAuthPasswordTxt->setText(QSTRING(CurrentConfig.inBoundSettings.httpAccount.pass));
|
ui->httpAuthPasswordTxt->setText(QSTRING(CurrentConfig.inBoundSettings.httpAccount.pass));
|
||||||
ui->httpPortLE->setValidator(new QIntValidator());
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
bool have_socks = CurrentConfig.inBoundSettings.socks_port != 0;
|
bool have_socks = CurrentConfig.inBoundSettings.socks_port != 0;
|
||||||
ui->socksCB->setChecked(have_socks);
|
ui->socksCB->setChecked(have_socks);
|
||||||
ui->socksPortLE->setText(QSTRING(to_string(CurrentConfig.inBoundSettings.socks_port)));
|
ui->socksPortLE->setValue(CurrentConfig.inBoundSettings.socks_port);
|
||||||
ui->socksAuthCB->setChecked(CurrentConfig.inBoundSettings.socks_useAuth);
|
ui->socksAuthCB->setChecked(CurrentConfig.inBoundSettings.socks_useAuth);
|
||||||
//
|
//
|
||||||
ui->socksAuthCB->setEnabled(have_socks);
|
ui->socksAuthCB->setEnabled(have_socks);
|
||||||
@ -56,7 +55,6 @@ PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent),
|
|||||||
ui->socksAuthPasswordTxt->setEnabled(have_socks && CurrentConfig.inBoundSettings.socks_useAuth);
|
ui->socksAuthPasswordTxt->setEnabled(have_socks && CurrentConfig.inBoundSettings.socks_useAuth);
|
||||||
ui->socksAuthUsernameTxt->setText(QSTRING(CurrentConfig.inBoundSettings.socksAccount.user));
|
ui->socksAuthUsernameTxt->setText(QSTRING(CurrentConfig.inBoundSettings.socksAccount.user));
|
||||||
ui->socksAuthPasswordTxt->setText(QSTRING(CurrentConfig.inBoundSettings.socksAccount.pass));
|
ui->socksAuthPasswordTxt->setText(QSTRING(CurrentConfig.inBoundSettings.socksAccount.pass));
|
||||||
ui->socksPortLE->setValidator(new QIntValidator());
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
ui->vCoreAssetsPathTxt->setText(QSTRING(CurrentConfig.v2AssetsPath));
|
ui->vCoreAssetsPathTxt->setText(QSTRING(CurrentConfig.v2AssetsPath));
|
||||||
@ -118,7 +116,7 @@ void PrefrencesWindow::on_httpCB_stateChanged(int checked)
|
|||||||
CurrentConfig.inBoundSettings.http_port = checked == Qt::Checked ? CurrentConfig.inBoundSettings.http_port : 0;
|
CurrentConfig.inBoundSettings.http_port = checked == Qt::Checked ? CurrentConfig.inBoundSettings.http_port : 0;
|
||||||
|
|
||||||
if (checked != Qt::Checked) {
|
if (checked != Qt::Checked) {
|
||||||
ui->httpPortLE->setText("0");
|
ui->httpPortLE->setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +130,7 @@ void PrefrencesWindow::on_socksCB_stateChanged(int checked)
|
|||||||
CurrentConfig.inBoundSettings.socks_port = checked == Qt::Checked ? CurrentConfig.inBoundSettings.socks_port : 0;
|
CurrentConfig.inBoundSettings.socks_port = checked == Qt::Checked ? CurrentConfig.inBoundSettings.socks_port : 0;
|
||||||
|
|
||||||
if (checked != Qt::Checked) {
|
if (checked != Qt::Checked) {
|
||||||
ui->socksPortLE->setText("0");
|
ui->socksPortLE->setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,18 +195,6 @@ void PrefrencesWindow::on_listenIPTxt_textEdited(const QString &arg1)
|
|||||||
CurrentConfig.inBoundSettings.listenip = arg1.toStdString();
|
CurrentConfig.inBoundSettings.listenip = arg1.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrefrencesWindow::on_socksPortLE_textEdited(const QString &arg1)
|
|
||||||
{
|
|
||||||
NEEDRESTART
|
|
||||||
CurrentConfig.inBoundSettings.socks_port = stoi(arg1.toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrefrencesWindow::on_httpPortLE_textEdited(const QString &arg1)
|
|
||||||
{
|
|
||||||
NEEDRESTART
|
|
||||||
CurrentConfig.inBoundSettings.http_port = stoi(arg1.toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrefrencesWindow::on_httpAuthUsernameTxt_textEdited(const QString &arg1)
|
void PrefrencesWindow::on_httpAuthUsernameTxt_textEdited(const QString &arg1)
|
||||||
{
|
{
|
||||||
NEEDRESTART
|
NEEDRESTART
|
||||||
@ -348,3 +334,15 @@ void PrefrencesWindow::on_tProxyCheckBox_stateChanged(int arg1)
|
|||||||
QvMessageBox(this, tr("Prefrences"), tr("tProxy is not supported on macOS and Windows"));
|
QvMessageBox(this, tr("Prefrences"), tr("tProxy is not supported on macOS and Windows"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrefrencesWindow::on_socksPortLE_valueChanged(int arg1)
|
||||||
|
{
|
||||||
|
NEEDRESTART
|
||||||
|
CurrentConfig.inBoundSettings.socks_port = arg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrefrencesWindow::on_httpPortLE_valueChanged(int arg1)
|
||||||
|
{
|
||||||
|
NEEDRESTART
|
||||||
|
CurrentConfig.inBoundSettings.http_port = arg1;
|
||||||
|
}
|
||||||
|
@ -43,9 +43,9 @@ class PrefrencesWindow : public QDialog
|
|||||||
|
|
||||||
void on_listenIPTxt_textEdited(const QString &arg1);
|
void on_listenIPTxt_textEdited(const QString &arg1);
|
||||||
|
|
||||||
void on_socksPortLE_textEdited(const QString &arg1);
|
void on_socksPortLE_valueChanged(int arg1);
|
||||||
|
|
||||||
void on_httpPortLE_textEdited(const QString &arg1);
|
void on_httpPortLE_valueChanged(int arg1);
|
||||||
|
|
||||||
void on_httpAuthUsernameTxt_textEdited(const QString &arg1);
|
void on_httpAuthUsernameTxt_textEdited(const QString &arg1);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -247,9 +247,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="socksPortLE">
|
<widget class="QSpinBox" name="socksPortLE">
|
||||||
<property name="text">
|
<property name="minimum">
|
||||||
<string/>
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -314,15 +317,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="httpPortLE">
|
<widget class="QSpinBox" name="httpPortLE">
|
||||||
<property name="text">
|
<property name="minimum">
|
||||||
<string/>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragEnabled">
|
<property name="maximum">
|
||||||
<bool>false</bool>
|
<number>65535</number>
|
||||||
</property>
|
|
||||||
<property name="clearButtonEnabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user