Load WebUI certificate & key from file path

This allow users to update certificate & key more easily, i.e. without the need to import them
into qbt.

Closes #6675, #7547, #8315, #8564.
This commit is contained in:
Chocobo1 2019-01-17 09:42:01 +08:00
commit 5cdb3b6a2d
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
12 changed files with 212 additions and 277 deletions

View file

@ -60,7 +60,6 @@ class OptionsDialog : public QDialog
Q_OBJECT
using ThisType = OptionsDialog;
private:
enum Tabs
{
TAB_UI,
@ -73,6 +72,12 @@ private:
TAB_ADVANCED
};
enum class ShowError
{
NotShow,
Show
};
public:
// Constructor / Destructor
OptionsDialog(QWidget *parent = nullptr);
@ -102,10 +107,10 @@ private slots:
void on_randomButton_clicked();
void on_addScanFolderButton_clicked();
void on_removeScanFolderButton_clicked();
void on_btnWebUiCrt_clicked();
void on_btnWebUiKey_clicked();
void on_registerDNSBtn_clicked();
void setLocale(const QString &localeStr);
void webUIHttpsCertChanged(const QString &path, ShowError showError);
void webUIHttpsKeyChanged(const QString &path, ShowError showError);
private:
// Methods
@ -164,17 +169,14 @@ private:
int getMaxActiveDownloads() const;
int getMaxActiveUploads() const;
int getMaxActiveTorrents() const;
// WebUI
bool isWebUiEnabled() const;
QString webUiUsername() const;
QString webUiPassword() const;
// WebUI SSL Cert / key
bool setSslKey(const QByteArray &key);
bool setSslCertificate(const QByteArray &cert);
bool schedTimesOk();
bool webUIAuthenticationOk();
bool isAlternativeWebUIPathValid();
QByteArray m_sslCert, m_sslKey;
bool schedTimesOk();
Ui::OptionsDialog *m_ui;
QAbstractButton *m_applyButton;