commit 11fd283fbee2d726780a20bf9da82428d73b48a9
parent 789d035d7ab590592a739f395a45cde726aefccc
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 18 Jun 2016 21:41:27 -0400
refactoring: rename DownloadOpts → NetworkOpts
Diffstat:
12 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/config.cpp b/src/config.cpp
@@ -37,7 +37,7 @@ static const auto_char *PRERELEASES_KEY = AUTO_STR("prereleases");
static const auto_char *BROWSER_GRP = AUTO_STR("browser");
static const auto_char *TYPEFILTER_KEY = AUTO_STR("typefilter");
-static const auto_char *DOWNLOAD_GRP = AUTO_STR("download");
+static const auto_char *NETWORK_GRP = AUTO_STR("network");
static const auto_char *PROXY_KEY = AUTO_STR("proxy");
static const auto_char *SIZE_KEY = AUTO_STR("size");
@@ -62,7 +62,7 @@ void Config::resetOptions()
{
m_install = {false, false};
m_browser = {0};
- m_download = {""};
+ m_network = {""};
}
void Config::restoreSelfRemote()
@@ -135,7 +135,7 @@ void Config::read(const Path &path)
m_browser.typeFilter = getUInt(BROWSER_GRP,
TYPEFILTER_KEY, m_browser.typeFilter);
- m_download.proxy = getString(DOWNLOAD_GRP, PROXY_KEY, m_download.proxy);
+ m_network.proxy = getString(NETWORK_GRP, PROXY_KEY, m_network.proxy);
readRemotes();
restoreSelfRemote();
@@ -151,7 +151,7 @@ void Config::write()
setUInt(BROWSER_GRP, TYPEFILTER_KEY, m_browser.typeFilter);
- setString(DOWNLOAD_GRP, PROXY_KEY, m_download.proxy);
+ setString(NETWORK_GRP, PROXY_KEY, m_network.proxy);
writeRemotes();
}
diff --git a/src/config.hpp b/src/config.hpp
@@ -34,7 +34,7 @@ struct BrowserOpts {
unsigned int typeFilter;
};
-struct DownloadOpts {
+struct NetworkOpts {
std::string proxy;
};
@@ -51,7 +51,7 @@ public:
bool isFirstRun() const { return m_isFirstRun; }
InstallOpts *install() { return &m_install; }
BrowserOpts *browser() { return &m_browser; }
- DownloadOpts *download() { return &m_download; }
+ NetworkOpts *network() { return &m_network; }
RemoteList *remotes() { return &m_remotes; }
private:
@@ -76,7 +76,7 @@ private:
InstallOpts m_install;
BrowserOpts m_browser;
- DownloadOpts m_download;
+ NetworkOpts m_network;
void readRemotes();
void restoreSelfRemote();
diff --git a/src/download.cpp b/src/download.cpp
@@ -40,7 +40,7 @@ void Download::Cleanup()
curl_global_cleanup();
}
-Download::Download(const string &name, const string &url, const DownloadOpts &opts)
+Download::Download(const string &name, const string &url, const NetworkOpts &opts)
: m_name(name), m_url(url), m_opts(opts), m_threadHandle(nullptr)
{
reset();
diff --git a/src/download.hpp b/src/download.hpp
@@ -47,12 +47,12 @@ public:
static void Init();
static void Cleanup();
- Download(const std::string &name, const std::string &url, const DownloadOpts &);
+ Download(const std::string &name, const std::string &url, const NetworkOpts &);
~Download();
const std::string &name() const { return m_name; }
const std::string &url() const { return m_url; }
- const DownloadOpts &options() const { return m_opts; }
+ const NetworkOpts &options() const { return m_opts; }
State state();
const std::string &contents();
@@ -87,7 +87,7 @@ private:
std::string m_name;
std::string m_url;
- DownloadOpts m_opts;
+ NetworkOpts m_opts;
WDL_Mutex m_mutex;
diff --git a/src/import.cpp b/src/import.cpp
@@ -88,7 +88,7 @@ void Import::fetch()
setWaiting(true);
- const DownloadOpts &opts = *m_reapack->config()->download();
+ const NetworkOpts &opts = *m_reapack->config()->network();
Download *dl = m_download = new Download({}, url, opts);
dl->onFinish([=] {
diff --git a/src/index.cpp b/src/index.cpp
@@ -93,7 +93,7 @@ IndexPtr Index::load(const string &name, const char *data)
}
Download *Index::fetch(const Remote &remote,
- const bool stale, const DownloadOpts &opts)
+ const bool stale, const NetworkOpts &opts)
{
time_t mtime = 0, now = time(nullptr);
diff --git a/src/index.hpp b/src/index.hpp
@@ -35,7 +35,7 @@ class Index;
class Path;
class Remote;
class TiXmlElement;
-struct DownloadOpts;
+struct NetworkOpts;
struct Link { std::string name; std::string url; };
@@ -50,7 +50,7 @@ public:
static Path pathFor(const std::string &name);
static LinkType linkTypeFor(const char *rel);
static IndexPtr load(const std::string &name, const char *data = nullptr);
- static Download *fetch(const Remote &, bool stale, const DownloadOpts &);
+ static Download *fetch(const Remote &, bool stale, const NetworkOpts &);
Index(const std::string &name);
~Index();
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -397,7 +397,7 @@ void Manager::options()
void Manager::setupNetwork()
{
const auto ret = Dialog::Show<NetworkConfig>(instance(), handle(),
- m_config->download());
+ m_config->network());
if(ret == IDOK)
m_config->write();
@@ -487,7 +487,7 @@ Remote Manager::getRemote(const int index) const
return m_config->remotes()->get(remoteName);
}
-NetworkConfig::NetworkConfig(DownloadOpts *opts)
+NetworkConfig::NetworkConfig(NetworkOpts *opts)
: Dialog(IDD_NETCONF_DIALOG), m_opts(opts)
{
}
diff --git a/src/manager.hpp b/src/manager.hpp
@@ -29,7 +29,7 @@
class Config;
class ReaPack;
class Remote;
-struct DownloadOpts;
+struct NetworkOpts;
class Manager : public Dialog {
public:
@@ -80,7 +80,7 @@ private:
class NetworkConfig : public Dialog {
public:
- NetworkConfig(DownloadOpts *);
+ NetworkConfig(NetworkOpts *);
protected:
void onInit() override;
@@ -89,7 +89,7 @@ protected:
private:
void apply();
- DownloadOpts *m_opts;
+ NetworkOpts *m_opts;
HWND m_proxy;
};
diff --git a/src/reapack.cpp b/src/reapack.cpp
@@ -323,7 +323,7 @@ void ReaPack::fetchIndexes(const vector<Remote> &remotes,
void ReaPack::doFetchIndex(const Remote &remote, DownloadQueue *queue,
HWND parent, const bool stale)
{
- Download *dl = Index::fetch(remote, stale, *m_config->download());
+ Download *dl = Index::fetch(remote, stale, *m_config->network());
if(!dl)
return;
diff --git a/src/task.cpp b/src/task.cpp
@@ -67,7 +67,7 @@ void InstallTask::doStart()
const Path &path = it->first;
const Source *src = it->second;
- const DownloadOpts &opts = *transaction()->config()->download();
+ const NetworkOpts &opts = *transaction()->config()->network();
Download *dl = new Download(src->fullName(), src->url(), opts);
dl->onFinish(bind(&InstallTask::saveSource, this, dl, src));
diff --git a/src/transaction.cpp b/src/transaction.cpp
@@ -129,7 +129,7 @@ void Transaction::fetchIndex(const Remote &remote, const IndexCallback &cb)
if(m_remotes.count(name) > 1)
return;
- Download *dl = Index::fetch(remote, true, *m_config->download());
+ Download *dl = Index::fetch(remote, true, *m_config->network());
if(!dl) {
// the index was last downloaded less than a few seconds ago