[fix] Fixed QList std::list conversion function for Qt5.14 and fixed #186

This commit is contained in:
Leroy.H.Y 2019-12-21 21:56:51 +08:00
parent 18d9169c56
commit 9c53a99606
No known key found for this signature in database
GPG Key ID: 6AC1673B587DC37D
12 changed files with 118 additions and 103 deletions

View File

@ -1 +1 @@
1897
1904

View File

@ -41,6 +41,7 @@ SOURCES += \
src/QvCoreConfigOperations_Convertion.cpp \
src/QvCoreConfigOperations_Generation.cpp \
src/QvUtils.cpp \
src/ui/w_PreferencesWindow.cpp \
src/utils/QJsonModel.cpp \
src/ui/w_ExportConfig.cpp \
src/ui/w_InboundEditor.cpp \
@ -50,7 +51,6 @@ SOURCES += \
src/ui/w_JsonEditor.cpp \
src/ui/w_MainWindow.cpp \
src/ui/w_ImportConfig.cpp \
src/ui/w_PrefrencesWindow.cpp \
src/ui/w_ScreenShot_Core.cpp \
src/ui/NetSpeedBar/QvNetSpeedBar.cpp \
libs/gen/v2ray_api_commands.pb.cc \
@ -83,7 +83,7 @@ HEADERS += \
src/ui/w_JsonEditor.hpp \
src/ui/w_MainWindow.hpp \
src/ui/w_OutboundEditor.hpp \
src/ui/w_PrefrencesWindow.hpp \
src/ui/w_PreferencesWindow.hpp \
src/ui/w_RoutesEditor.hpp \
src/ui/w_SubscriptionEditor.hpp \
src/ui/w_ScreenShot_Core.hpp \
@ -100,7 +100,7 @@ FORMS += \
src/ui/w_JsonEditor.ui \
src/ui/w_MainWindow.ui \
src/ui/w_OutboundEditor.ui \
src/ui/w_PrefrencesWindow.ui \
src/ui/w_PreferencesWindow.ui \
src/ui/w_RoutesEditor.ui \
src/ui/w_ScreenShot_Core.ui \
src/ui/w_SubscriptionEditor.ui

View File

@ -94,6 +94,23 @@ namespace Qv2ray
// If no match, we are good.
return QRegExp(R"([\/\\\"?%*:|><]|(^\.{1,2}$))").indexIn(str) == -1;
}
// These functions a sugers to prevent warnings from deprecated Qt 5.14 functions.
template<typename TYPE>
std::list<TYPE> toStdList(QList<TYPE> list)
{
std::list<TYPE> _list{list.begin(), list.end()};
return _list;
}
template<typename TYPE>
QList<TYPE> toQList(std::list<TYPE> list)
{
QList<TYPE> _list{list.begin(), list.end()};
return _list;
}
}
}

View File

@ -47,7 +47,7 @@ namespace Qv2ray
QvMessageBox(nullptr, tr("Cannot start v2ray"),
tr("v2ray core file cannot be found at:") + NEWLINE +
QSTRING(conf.v2CorePath) + NEWLINE + NEWLINE +
tr("Please go to Prefrence Window to change the location.") + NEWLINE +
tr("Please go to Preference Window to change the location.") + NEWLINE +
tr("Or place your v2ray core file in the location above."));
return false;
}

View File

@ -260,7 +260,7 @@ int main(int argc, char *argv[])
QvMessageBox(
nullptr, "Translation Failed",
"Cannot load translation for " + QSTRING(confObject.uiConfig.language) + ", English is now used.\r\n\r\n"
"Please go to Prefrences Window to change or Report a Bug at: \r\n"
"Please go to Preferences Window to change or Report a Bug at: \r\n"
"https://github.com/lhy0403/Qv2ray/issues/new");
}

View File

@ -702,7 +702,7 @@
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_30">
<property name="text">
<string>If you want to use tProxy, please go to Prefrence Window to enable this feature.</string>
<string>If you want to use tProxy, please go to Preference Window to enable this feature.</string>
</property>
</widget>
</item>

View File

@ -16,7 +16,7 @@
#include "w_OutboundEditor.hpp"
#include "w_ImportConfig.hpp"
#include "w_RoutesEditor.hpp"
#include "w_PrefrencesWindow.hpp"
#include "w_PreferencesWindow.hpp"
#include "w_SubscriptionEditor.hpp"
#include "w_JsonEditor.hpp"
#include "w_ExportConfig.hpp"
@ -213,7 +213,7 @@ MainWindow::MainWindow(QWidget *parent):
} else {
QvMessageBox(this, tr("Autostarting a config"), tr("Could not find a specified config named: ") + NEWLINE +
name + NEWLINE + NEWLINE +
tr("Please reset the settings in Prefrence Window"));
tr("Please reset the settings in Preference Window"));
this->show();
}
} else if (connectionListWidget->topLevelItemCount() > 0) {
@ -341,7 +341,7 @@ void MainWindow::ReloadConnections()
connectionListWidget->addTopLevelItem(new QTreeWidgetItem(QStringList() << _o.connectionName));
}
auto _subsConnections = GetSubscriptionConnections(QMap<string, string>(currentConfig.subscribes).keys().toStdList());
auto _subsConnections = GetSubscriptionConnections(toStdList(QMap<string, string>(currentConfig.subscribes).keys()));
for (auto i = 0; i < _subsConnections.count(); i++) {
auto subName = _subsConnections.keys()[i];
@ -574,7 +574,7 @@ void MainWindow::on_stopButton_clicked()
LOG(MODULE_UI, "Stopping PAC server")
}
// BUG If unset from the prefrences. this will not work...
// BUG If unset from the preferences. this will not work...
if (currentConfig.inboundConfig.setSystemProxy) {
ClearSystemProxy();
LOG(MODULE_UI, "Clearing System Proxy")
@ -726,10 +726,10 @@ void MainWindow::ShowAndSetConnection(QString guiConnectionName, bool SetConnect
on_reconnectButton_clicked();
}
}
void MainWindow::on_prefrencesBtn_clicked()
void MainWindow::on_preferencesBtn_clicked()
{
PrefrencesWindow *w = new PrefrencesWindow(this);
connect(w, &PrefrencesWindow::s_reload_config, this, &MainWindow::OnConfigListChanged);
PreferencesWindow *w = new PreferencesWindow(this);
connect(w, &PreferencesWindow::s_reload_config, this, &MainWindow::OnConfigListChanged);
w->show();
}
void MainWindow::on_connectionListWidget_doubleClicked(const QModelIndex &index)

View File

@ -56,7 +56,7 @@ class MainWindow : public QMainWindow, Ui::MainWindow
void quit();
void on_actionExit_triggered();
void on_prefrencesBtn_clicked();
void on_preferencesBtn_clicked();
void on_connectionListWidget_doubleClicked(const QModelIndex &index);

View File

@ -83,9 +83,9 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="prefrencesBtn">
<widget class="QPushButton" name="preferencesBtn">
<property name="text">
<string>Prefrences</string>
<string>Preferences</string>
</property>
</widget>
</item>
@ -625,7 +625,7 @@
<tabstop>stopButton</tabstop>
<tabstop>reconnectButton</tabstop>
<tabstop>clearlogButton</tabstop>
<tabstop>prefrencesBtn</tabstop>
<tabstop>preferencesBtn</tabstop>
<tabstop>importConfigButton</tabstop>
<tabstop>duplicateBtn</tabstop>
<tabstop>removeConfigButton</tabstop>

View File

@ -9,15 +9,14 @@
#include "QvNetSpeedPlugin.hpp"
#include "QvCoreConfigOperations.hpp"
#include "w_PrefrencesWindow.hpp"
#include "w_PreferencesWindow.hpp"
#include "QvHTTPRequestHelper.hpp"
#define LOADINGCHECK if(!finishedLoading) return;
#define NEEDRESTART if(finishedLoading) IsConnectionPropertyChanged = true;
PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent),
CurrentConfig(),
ui(new Ui::PrefrencesWindow)
PreferencesWindow::PreferencesWindow(QWidget *parent) : QDialog(parent),
CurrentConfig()
{
setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@ -144,7 +143,7 @@ PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent),
autoStartSubsCombo->setCurrentText(autoSub);
if (CurrentConfig.autoStartConfig.subscriptionName.empty()) {
autoStartConnCombo->addItems(ConvertQStringList(QList<string>::fromStdList(CurrentConfig.configs)));
autoStartConnCombo->addItems(ConvertQStringList(toQList(CurrentConfig.configs)));
} else {
auto list = GetSubscriptionConnection(autoSub.toStdString());
autoStartConnCombo->addItems(list.keys());
@ -154,18 +153,18 @@ PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent),
finishedLoading = true;
}
PrefrencesWindow::~PrefrencesWindow()
PreferencesWindow::~PreferencesWindow()
{
delete ui;
//
}
void PrefrencesWindow::on_buttonBox_accepted()
void PreferencesWindow::on_buttonBox_accepted()
{
int sp = socksPortLE->text().toInt();
int hp = httpPortLE->text().toInt() ;
if (!(sp == 0 || hp == 0) && sp == hp) {
QvMessageBox(this, tr("Prefrences"), tr("Port numbers cannot be the same"));
QvMessageBox(this, tr("Preferences"), tr("Port numbers cannot be the same"));
return;
}
@ -173,7 +172,7 @@ void PrefrencesWindow::on_buttonBox_accepted()
emit s_reload_config(IsConnectionPropertyChanged);
}
void PrefrencesWindow::on_httpCB_stateChanged(int checked)
void PreferencesWindow::on_httpCB_stateChanged(int checked)
{
NEEDRESTART
bool enabled = checked == Qt::Checked;
@ -181,7 +180,7 @@ void PrefrencesWindow::on_httpCB_stateChanged(int checked)
CurrentConfig.inboundConfig.useHTTP = enabled;
}
void PrefrencesWindow::on_socksCB_stateChanged(int checked)
void PreferencesWindow::on_socksCB_stateChanged(int checked)
{
NEEDRESTART
bool enabled = checked == Qt::Checked;
@ -189,7 +188,7 @@ void PrefrencesWindow::on_socksCB_stateChanged(int checked)
CurrentConfig.inboundConfig.useSocks = enabled;
}
void PrefrencesWindow::on_httpAuthCB_stateChanged(int checked)
void PreferencesWindow::on_httpAuthCB_stateChanged(int checked)
{
NEEDRESTART
bool enabled = checked == Qt::Checked;
@ -198,7 +197,7 @@ void PrefrencesWindow::on_httpAuthCB_stateChanged(int checked)
CurrentConfig.inboundConfig.http_useAuth = enabled;
}
void PrefrencesWindow::on_socksAuthCB_stateChanged(int checked)
void PreferencesWindow::on_socksAuthCB_stateChanged(int checked)
{
NEEDRESTART
bool enabled = checked == Qt::Checked;
@ -207,7 +206,7 @@ void PrefrencesWindow::on_socksAuthCB_stateChanged(int checked)
CurrentConfig.inboundConfig.socks_useAuth = enabled;
}
void PrefrencesWindow::on_languageComboBox_currentTextChanged(const QString &arg1)
void PreferencesWindow::on_languageComboBox_currentTextChanged(const QString &arg1)
{
LOADINGCHECK
//
@ -221,68 +220,68 @@ void PrefrencesWindow::on_languageComboBox_currentTextChanged(const QString &arg
// LOG(MODULE_UI, "Loaded translations " + arg1.toStdString())
// retranslateUi(this);
//} else {
// QvMessageBox(this, tr("#Prefrences"), tr("#SwitchTranslationError"));
// QvMessageBox(this, tr("#Preferences"), tr("#SwitchTranslationError"));
//}
//
//emit retranslateUi(this);
}
void PrefrencesWindow::on_logLevelComboBox_currentIndexChanged(int index)
void PreferencesWindow::on_logLevelComboBox_currentIndexChanged(int index)
{
NEEDRESTART
CurrentConfig.logLevel = index;
}
void PrefrencesWindow::on_vCoreAssetsPathTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_vCoreAssetsPathTxt_textEdited(const QString &arg1)
{
NEEDRESTART
CurrentConfig.v2AssetsPath = arg1.toStdString();
}
void PrefrencesWindow::on_listenIPTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_listenIPTxt_textEdited(const QString &arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.listenip = arg1.toStdString();
//pacAccessPathTxt->setText("http://" + arg1 + ":" + QString::number(pacPortSB->value()) + "/pac");
}
void PrefrencesWindow::on_httpAuthUsernameTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_httpAuthUsernameTxt_textEdited(const QString &arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.httpAccount.user = arg1.toStdString();
}
void PrefrencesWindow::on_httpAuthPasswordTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_httpAuthPasswordTxt_textEdited(const QString &arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.httpAccount.pass = arg1.toStdString();
}
void PrefrencesWindow::on_socksAuthUsernameTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_socksAuthUsernameTxt_textEdited(const QString &arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.socksAccount.user = arg1.toStdString();
}
void PrefrencesWindow::on_socksAuthPasswordTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_socksAuthPasswordTxt_textEdited(const QString &arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.socksAccount.pass = arg1.toStdString();
}
void PrefrencesWindow::on_proxyDefaultCb_stateChanged(int arg1)
void PreferencesWindow::on_proxyDefaultCb_stateChanged(int arg1)
{
NEEDRESTART
CurrentConfig.connectionConfig.enableProxy = arg1 == Qt::Checked;
}
void PrefrencesWindow::on_localDNSCb_stateChanged(int arg1)
void PreferencesWindow::on_localDNSCb_stateChanged(int arg1)
{
NEEDRESTART
CurrentConfig.connectionConfig.withLocalDNS = arg1 == Qt::Checked;
}
void PrefrencesWindow::on_selectVAssetBtn_clicked()
void PreferencesWindow::on_selectVAssetBtn_clicked()
{
NEEDRESTART
QString dir = QFileDialog::getExistingDirectory(this, tr("Open v2ray assets folder"), QDir::currentPath());
@ -293,7 +292,7 @@ void PrefrencesWindow::on_selectVAssetBtn_clicked()
}
}
void PrefrencesWindow::on_selectVCoreBtn_clicked()
void PreferencesWindow::on_selectVCoreBtn_clicked()
{
QString core = QFileDialog::getOpenFileName(this, tr("Open v2ray core file"), QDir::currentPath());
@ -303,13 +302,13 @@ void PrefrencesWindow::on_selectVCoreBtn_clicked()
}
}
void PrefrencesWindow::on_vCorePathTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_vCorePathTxt_textEdited(const QString &arg1)
{
NEEDRESTART
CurrentConfig.v2CorePath = arg1.toStdString();
}
void PrefrencesWindow::on_DNSListTxt_textChanged()
void PreferencesWindow::on_DNSListTxt_textChanged()
{
if (finishedLoading) {
try {
@ -331,18 +330,18 @@ void PrefrencesWindow::on_DNSListTxt_textChanged()
}
}
void PrefrencesWindow::on_aboutQt_clicked()
void PreferencesWindow::on_aboutQt_clicked()
{
QApplication::aboutQt();
}
void PrefrencesWindow::on_cancelIgnoreVersionBtn_clicked()
void PreferencesWindow::on_cancelIgnoreVersionBtn_clicked()
{
CurrentConfig.ignoredVersion.clear();
cancelIgnoreVersionBtn->setEnabled(false);
}
void PrefrencesWindow::on_tProxyCheckBox_stateChanged(int arg1)
void PreferencesWindow::on_tProxyCheckBox_stateChanged(int arg1)
{
#ifdef __linux
@ -415,7 +414,7 @@ void PrefrencesWindow::on_tProxyCheckBox_stateChanged(int arg1)
if (ret != 0) {
LOG(MODULE_UI, "WARN: setcap exits with code: " + to_string(ret))
QvMessageBox(this, tr("Prefrences"), tr("Failed to setcap onto v2ray executable. You may need to run `setcap` manually."));
QvMessageBox(this, tr("Preferences"), tr("Failed to setcap onto v2ray executable. You may need to run `setcap` manually."));
}
CurrentConfig.tProxySupport = true;
@ -426,7 +425,7 @@ void PrefrencesWindow::on_tProxyCheckBox_stateChanged(int arg1)
if (ret != 0) {
LOG(MODULE_UI, "WARN: setcap exits with code: " + to_string(ret))
QvMessageBox(this, tr("Prefrences"), tr("Failed to setcap onto v2ray executable. You may need to run `setcap` manually."));
QvMessageBox(this, tr("Preferences"), tr("Failed to setcap onto v2ray executable. You may need to run `setcap` manually."));
}
CurrentConfig.tProxySupport = false;
@ -437,49 +436,49 @@ void PrefrencesWindow::on_tProxyCheckBox_stateChanged(int arg1)
#else
Q_UNUSED(arg1)
// No such tProxy thing on Windows and macOS
QvMessageBox(this, tr("Prefrences"), tr("tProxy is not supported on macOS and Windows"));
QvMessageBox(this, tr("Preferences"), tr("tProxy is not supported on macOS and Windows"));
CurrentConfig.tProxySupport = false;
tProxyCheckBox->setChecked(false);
#endif
}
void PrefrencesWindow::on_bypassCNCb_stateChanged(int arg1)
void PreferencesWindow::on_bypassCNCb_stateChanged(int arg1)
{
NEEDRESTART
CurrentConfig.connectionConfig.bypassCN = arg1 == Qt::Checked;
}
void PrefrencesWindow::on_statsCheckbox_stateChanged(int arg1)
void PreferencesWindow::on_statsCheckbox_stateChanged(int arg1)
{
NEEDRESTART
CurrentConfig.connectionConfig.enableStats = arg1 == Qt::Checked;
}
void PrefrencesWindow::on_statsPortBox_valueChanged(int arg1)
void PreferencesWindow::on_statsPortBox_valueChanged(int arg1)
{
NEEDRESTART
CurrentConfig.connectionConfig.statsPort = arg1;
}
void PrefrencesWindow::on_socksPortLE_valueChanged(int arg1)
void PreferencesWindow::on_socksPortLE_valueChanged(int arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.socks_port = arg1;
}
void PrefrencesWindow::on_httpPortLE_valueChanged(int arg1)
void PreferencesWindow::on_httpPortLE_valueChanged(int arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.http_port = arg1;
}
void PrefrencesWindow::on_socksUDPCB_stateChanged(int arg1)
void PreferencesWindow::on_socksUDPCB_stateChanged(int arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.socksUDP = arg1 == Qt::Checked;
socksUDPIP->setEnabled(arg1 == Qt::Checked);
}
void PrefrencesWindow::on_socksUDPIP_textEdited(const QString &arg1)
void PreferencesWindow::on_socksUDPIP_textEdited(const QString &arg1)
{
NEEDRESTART
CurrentConfig.inboundConfig.socksLocalIP = arg1.toStdString();
@ -491,7 +490,7 @@ void PrefrencesWindow::on_socksUDPIP_textEdited(const QString &arg1)
#define CurrentBarLine CurrentBarPage.Lines[this->CurrentBarLineId]
#define SET_LINE_LIST_TEXT nsBarLinesList->currentItem()->setText(GetBarLineDescription(CurrentBarLine));
void PrefrencesWindow::on_nsBarPageAddBTN_clicked()
void PreferencesWindow::on_nsBarPageAddBTN_clicked()
{
QvBarPage page;
CurrentConfig.toolBarConfig.Pages.push_back(page);
@ -512,7 +511,7 @@ void PrefrencesWindow::on_nsBarPageAddBTN_clicked()
nsBarPagesList->setCurrentRow(static_cast<int>(CurrentBarPageId));
}
void PrefrencesWindow::on_nsBarPageDelBTN_clicked()
void PreferencesWindow::on_nsBarPageDelBTN_clicked()
{
if (nsBarPagesList->currentRow() >= 0) {
RemoveItem(CurrentConfig.toolBarConfig.Pages, static_cast<size_t>(nsBarPagesList->currentRow()));
@ -530,13 +529,13 @@ void PrefrencesWindow::on_nsBarPageDelBTN_clicked()
}
}
void PrefrencesWindow::on_nsBarPageYOffset_valueChanged(int arg1)
void PreferencesWindow::on_nsBarPageYOffset_valueChanged(int arg1)
{
LOADINGCHECK
CurrentBarPage.OffsetYpx = arg1;
}
void PrefrencesWindow::on_nsBarLineAddBTN_clicked()
void PreferencesWindow::on_nsBarLineAddBTN_clicked()
{
// WARNING Is it really just this simple?
QvBarLine line;
@ -549,7 +548,7 @@ void PrefrencesWindow::on_nsBarLineAddBTN_clicked()
nsBarLinesList->setCurrentRow(static_cast<int>(CurrentBarPage.Lines.size() - 1));
}
void PrefrencesWindow::on_nsBarLineDelBTN_clicked()
void PreferencesWindow::on_nsBarLineDelBTN_clicked()
{
if (nsBarLinesList->currentRow() >= 0) {
RemoveItem(CurrentBarPage.Lines, static_cast<size_t>(nsBarLinesList->currentRow()));
@ -565,7 +564,7 @@ void PrefrencesWindow::on_nsBarLineDelBTN_clicked()
}
}
void PrefrencesWindow::on_nsBarPagesList_currentRowChanged(int currentRow)
void PreferencesWindow::on_nsBarPagesList_currentRowChanged(int currentRow)
{
if (currentRow < 0) return;
@ -590,7 +589,7 @@ void PrefrencesWindow::on_nsBarPagesList_currentRowChanged(int currentRow)
}
}
void PrefrencesWindow::on_nsBarLinesList_currentRowChanged(int currentRow)
void PreferencesWindow::on_nsBarLinesList_currentRowChanged(int currentRow)
{
if (currentRow < 0) return;
@ -598,28 +597,28 @@ void PrefrencesWindow::on_nsBarLinesList_currentRowChanged(int currentRow)
ShowLineParameters(CurrentBarLine);
}
void PrefrencesWindow::on_fontComboBox_currentFontChanged(const QFont &f)
void PreferencesWindow::on_fontComboBox_currentFontChanged(const QFont &f)
{
LOADINGCHECK
CurrentBarLine.Family = f.family().toStdString();
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_nsBarFontBoldCB_stateChanged(int arg1)
void PreferencesWindow::on_nsBarFontBoldCB_stateChanged(int arg1)
{
LOADINGCHECK
CurrentBarLine.Bold = arg1 == Qt::Checked;
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_nsBarFontItalicCB_stateChanged(int arg1)
void PreferencesWindow::on_nsBarFontItalicCB_stateChanged(int arg1)
{
LOADINGCHECK
CurrentBarLine.Italic = arg1 == Qt::Checked;
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_nsBarFontASB_valueChanged(int arg1)
void PreferencesWindow::on_nsBarFontASB_valueChanged(int arg1)
{
LOADINGCHECK
CurrentBarLine.ColorA = arg1;
@ -627,7 +626,7 @@ void PrefrencesWindow::on_nsBarFontASB_valueChanged(int arg1)
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_nsBarFontRSB_valueChanged(int arg1)
void PreferencesWindow::on_nsBarFontRSB_valueChanged(int arg1)
{
LOADINGCHECK
CurrentBarLine.ColorR = arg1;
@ -635,7 +634,7 @@ void PrefrencesWindow::on_nsBarFontRSB_valueChanged(int arg1)
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_nsBarFontGSB_valueChanged(int arg1)
void PreferencesWindow::on_nsBarFontGSB_valueChanged(int arg1)
{
LOADINGCHECK
CurrentBarLine.ColorG = arg1;
@ -643,7 +642,7 @@ void PrefrencesWindow::on_nsBarFontGSB_valueChanged(int arg1)
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_nsBarFontBSB_valueChanged(int arg1)
void PreferencesWindow::on_nsBarFontBSB_valueChanged(int arg1)
{
LOADINGCHECK
CurrentBarLine.ColorB = arg1;
@ -651,14 +650,14 @@ void PrefrencesWindow::on_nsBarFontBSB_valueChanged(int arg1)
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_nsBarFontSizeSB_valueChanged(double arg1)
void PreferencesWindow::on_nsBarFontSizeSB_valueChanged(double arg1)
{
LOADINGCHECK
CurrentBarLine.Size = arg1;
SET_LINE_LIST_TEXT
}
QString PrefrencesWindow::GetBarLineDescription(QvBarLine barLine)
QString PreferencesWindow::GetBarLineDescription(QvBarLine barLine)
{
QString result = "Empty";
result = NetSpeedPluginMessages[barLine.ContentType];
@ -672,7 +671,7 @@ QString PrefrencesWindow::GetBarLineDescription(QvBarLine barLine)
return result;
}
void PrefrencesWindow::ShowLineParameters(QvBarLine &barLine)
void PreferencesWindow::ShowLineParameters(QvBarLine &barLine)
{
finishedLoading = false;
@ -701,7 +700,7 @@ void PrefrencesWindow::ShowLineParameters(QvBarLine &barLine)
nsBarVerticalLayout->setEnabled(true);
}
void PrefrencesWindow::on_chooseColorBtn_clicked()
void PreferencesWindow::on_chooseColorBtn_clicked()
{
LOADINGCHECK
QColorDialog d(QColor::fromRgb(CurrentBarLine.ColorR, CurrentBarLine.ColorG, CurrentBarLine.ColorB, CurrentBarLine.ColorA), this);
@ -714,34 +713,34 @@ void PrefrencesWindow::on_chooseColorBtn_clicked()
}
}
void PrefrencesWindow::on_nsBarTagTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_nsBarTagTxt_textEdited(const QString &arg1)
{
LOADINGCHECK
CurrentBarLine.Message = arg1.toStdString();
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_nsBarContentCombo_currentIndexChanged(const QString &arg1)
void PreferencesWindow::on_nsBarContentCombo_currentIndexChanged(const QString &arg1)
{
LOADINGCHECK
CurrentBarLine.ContentType = NetSpeedPluginMessages.key(arg1);
SET_LINE_LIST_TEXT
}
void PrefrencesWindow::on_applyNSBarSettingsBtn_clicked()
void PreferencesWindow::on_applyNSBarSettingsBtn_clicked()
{
auto conf = GetGlobalConfig();
conf.toolBarConfig = CurrentConfig.toolBarConfig;
SetGlobalConfig(conf);
}
void PrefrencesWindow::on_themeCombo_currentTextChanged(const QString &arg1)
void PreferencesWindow::on_themeCombo_currentTextChanged(const QString &arg1)
{
LOADINGCHECK
CurrentConfig.uiConfig.theme = arg1.toStdString();
}
void PrefrencesWindow::on_darkThemeCB_stateChanged(int arg1)
void PreferencesWindow::on_darkThemeCB_stateChanged(int arg1)
{
LOADINGCHECK
CurrentConfig.uiConfig.useDarkTheme = arg1 == Qt::Checked;
@ -757,13 +756,13 @@ void PrefrencesWindow::on_darkThemeCB_stateChanged(int arg1)
#endif
}
void PrefrencesWindow::on_darkTrayCB_stateChanged(int arg1)
void PreferencesWindow::on_darkTrayCB_stateChanged(int arg1)
{
LOADINGCHECK
CurrentConfig.uiConfig.useDarkTrayIcon = arg1 == Qt::Checked;
}
void PrefrencesWindow::on_enablePACCB_stateChanged(int arg1)
void PreferencesWindow::on_enablePACCB_stateChanged(int arg1)
{
LOADINGCHECK
NEEDRESTART
@ -772,7 +771,7 @@ void PrefrencesWindow::on_enablePACCB_stateChanged(int arg1)
pacGroupBox->setEnabled(enabled);
}
void PrefrencesWindow::on_pacGoBtn_clicked()
void PreferencesWindow::on_pacGoBtn_clicked()
{
LOADINGCHECK
QString gfwLocation;
@ -828,7 +827,7 @@ void PrefrencesWindow::on_pacGoBtn_clicked()
StringToFile(&fileContent, &privateGFWListFile);
}
void PrefrencesWindow::on_pacPortSB_valueChanged(int arg1)
void PreferencesWindow::on_pacPortSB_valueChanged(int arg1)
{
LOADINGCHECK
NEEDRESTART
@ -836,14 +835,14 @@ void PrefrencesWindow::on_pacPortSB_valueChanged(int arg1)
//pacAccessPathTxt->setText("http://" + listenIPTxt->text() + ":" + QString::number(arg1) + "/pac");
}
void PrefrencesWindow::on_setSysProxyCB_stateChanged(int arg1)
void PreferencesWindow::on_setSysProxyCB_stateChanged(int arg1)
{
LOADINGCHECK
NEEDRESTART
CurrentConfig.inboundConfig.setSystemProxy = arg1 == Qt::Checked;
}
void PrefrencesWindow::on_pacProxyCB_currentIndexChanged(int index)
void PreferencesWindow::on_pacProxyCB_currentIndexChanged(int index)
{
LOADINGCHECK
NEEDRESTART
@ -852,20 +851,20 @@ void PrefrencesWindow::on_pacProxyCB_currentIndexChanged(int index)
CurrentConfig.inboundConfig.pacConfig.useSocksProxy = index == 1;
}
void PrefrencesWindow::on_pushButton_clicked()
void PreferencesWindow::on_pushButton_clicked()
{
LOADINGCHECK
QDesktopServices::openUrl(QUrl::fromUserInput(QV2RAY_RULES_DIR));
}
void PrefrencesWindow::on_pacProxyTxt_textEdited(const QString &arg1)
void PreferencesWindow::on_pacProxyTxt_textEdited(const QString &arg1)
{
LOADINGCHECK
NEEDRESTART
CurrentConfig.inboundConfig.pacConfig.localIP = arg1.toStdString();
}
void PrefrencesWindow::on_autoStartSubsCombo_currentIndexChanged(const QString &arg1)
void PreferencesWindow::on_autoStartSubsCombo_currentIndexChanged(const QString &arg1)
{
LOADINGCHECK
CurrentConfig.autoStartConfig.subscriptionName = arg1.toStdString();
@ -873,14 +872,14 @@ void PrefrencesWindow::on_autoStartSubsCombo_currentIndexChanged(const QString &
if (arg1.isEmpty()) {
autoStartConnCombo->addItem("");
autoStartConnCombo->addItems(ConvertQStringList(QList<string>::fromStdList(CurrentConfig.configs)));
autoStartConnCombo->addItems(ConvertQStringList(toQList(CurrentConfig.configs)));
} else {
auto list = GetSubscriptionConnection(arg1.toStdString());
autoStartConnCombo->addItems(list.keys());
}
}
void PrefrencesWindow::on_autoStartConnCombo_currentIndexChanged(const QString &arg1)
void PreferencesWindow::on_autoStartConnCombo_currentIndexChanged(const QString &arg1)
{
LOADINGCHECK
CurrentConfig.autoStartConfig.connectionName = arg1.toStdString();

View File

@ -2,16 +2,16 @@
#define HVCONF_H
#include <QDialog>
#include <ui_w_PrefrencesWindow.h>
#include <ui_w_PreferencesWindow.h>
#include "Qv2rayBase.hpp"
class PrefrencesWindow : public QDialog, private Ui::PrefrencesWindow
class PreferencesWindow : public QDialog, private Ui::PreferencesWindow
{
Q_OBJECT
public:
explicit PrefrencesWindow(QWidget *parent = nullptr);
~PrefrencesWindow();
explicit PreferencesWindow(QWidget *parent = nullptr);
~PreferencesWindow();
signals:
void s_reload_config(bool need_restart);
@ -147,6 +147,5 @@ class PrefrencesWindow : public QDialog, private Ui::PrefrencesWindow
bool IsConnectionPropertyChanged = false;
bool finishedLoading = false;
Qv2rayConfig CurrentConfig;
Ui::PrefrencesWindow *ui;
};
#endif // HVCONF_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PrefrencesWindow</class>
<widget class="QDialog" name="PrefrencesWindow">
<class>PreferencesWindow</class>
<widget class="QDialog" name="PreferencesWindow">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
@ -20,7 +20,7 @@
</size>
</property>
<property name="windowTitle">
<string>Prefrences</string>
<string>Preferences</string>
</property>
<property name="modal">
<bool>true</bool>
@ -1678,7 +1678,7 @@ p, li { white-space: pre-wrap; }
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PrefrencesWindow</receiver>
<receiver>PreferencesWindow</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@ -1694,7 +1694,7 @@ p, li { white-space: pre-wrap; }
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PrefrencesWindow</receiver>
<receiver>PreferencesWindow</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">