mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-26 20:45:54 +00:00
Merge pull request #3029
380b955
Downloader: introduce proxyAddress property (xiphon)
This commit is contained in:
commit
79a87ca03b
2 changed files with 26 additions and 0 deletions
|
@ -220,3 +220,23 @@ quint64 Downloader::total() const
|
||||||
{
|
{
|
||||||
return m_httpClient->contentLength();
|
return m_httpClient->contentLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Downloader::proxyAddress() const
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&m_proxyMutex);
|
||||||
|
return m_proxyAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Downloader::setProxyAddress(QString address)
|
||||||
|
{
|
||||||
|
m_scheduler.run([this, address] {
|
||||||
|
if (!m_httpClient->set_proxy(address.toStdString()))
|
||||||
|
{
|
||||||
|
qCritical() << "Failed to set proxy address" << address;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_proxyMutex);
|
||||||
|
m_proxyAddress = address;
|
||||||
|
emit proxyAddressChanged();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ class Downloader : public QObject
|
||||||
Q_PROPERTY(bool active READ active NOTIFY activeChanged);
|
Q_PROPERTY(bool active READ active NOTIFY activeChanged);
|
||||||
Q_PROPERTY(quint64 loaded READ loaded NOTIFY loadedChanged);
|
Q_PROPERTY(quint64 loaded READ loaded NOTIFY loadedChanged);
|
||||||
Q_PROPERTY(quint64 total READ total NOTIFY totalChanged);
|
Q_PROPERTY(quint64 total READ total NOTIFY totalChanged);
|
||||||
|
Q_PROPERTY(QString proxyAddress READ proxyAddress WRITE setProxyAddress NOTIFY proxyAddressChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Downloader(QObject *parent = nullptr);
|
Downloader(QObject *parent = nullptr);
|
||||||
|
@ -51,11 +52,14 @@ signals:
|
||||||
void activeChanged() const;
|
void activeChanged() const;
|
||||||
void loadedChanged() const;
|
void loadedChanged() const;
|
||||||
void totalChanged() const;
|
void totalChanged() const;
|
||||||
|
void proxyAddressChanged() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool active() const;
|
bool active() const;
|
||||||
quint64 loaded() const;
|
quint64 loaded() const;
|
||||||
quint64 total() const;
|
quint64 total() const;
|
||||||
|
QString proxyAddress() const;
|
||||||
|
void setProxyAddress(QString address);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_active;
|
bool m_active;
|
||||||
|
@ -63,5 +67,7 @@ private:
|
||||||
std::shared_ptr<HttpClient> m_httpClient;
|
std::shared_ptr<HttpClient> m_httpClient;
|
||||||
mutable QReadWriteLock m_mutex;
|
mutable QReadWriteLock m_mutex;
|
||||||
Network m_network;
|
Network m_network;
|
||||||
|
QString m_proxyAddress;
|
||||||
|
mutable QMutex m_proxyMutex;
|
||||||
mutable FutureScheduler m_scheduler;
|
mutable FutureScheduler m_scheduler;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue