summaryrefslogtreecommitdiffstats
path: root/MultiMC.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-09-08 02:15:20 +0200
committerPetr Mrázek <peterix@gmail.com>2013-09-08 02:15:20 +0200
commit6bea4ec988b7caeac63353fb9d2a354f2fd47dad (patch)
tree77dc597c82ff3952d9f34f4ca13da1c36ca89bd8 /MultiMC.cpp
parent6892c11e9f287dcfb1e698f8f46233a01fb7abb6 (diff)
downloadMultiMC-6bea4ec988b7caeac63353fb9d2a354f2fd47dad.tar
MultiMC-6bea4ec988b7caeac63353fb9d2a354f2fd47dad.tar.gz
MultiMC-6bea4ec988b7caeac63353fb9d2a354f2fd47dad.tar.lz
MultiMC-6bea4ec988b7caeac63353fb9d2a354f2fd47dad.tar.xz
MultiMC-6bea4ec988b7caeac63353fb9d2a354f2fd47dad.zip
Use HttpMetaCache to minimize network use.
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index 88eb3e62..f212d830 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -8,6 +8,7 @@
#include "logic/lists/InstanceList.h"
#include "logic/lists/IconList.h"
#include "logic/InstanceLauncher.h"
+#include "logic/net/HttpMetaCache.h"
#include "pathutils.h"
@@ -112,11 +113,16 @@ MultiMC::MultiMC ( int& argc, char** argv )
// load settings
initGlobalSettings();
+
// and instances
m_instances = new InstanceList(m_settings->get("InstanceDir").toString(),this);
std::cout << "Loading Instances..." << std::endl;
m_instances->loadList();
- // network manager
+
+ // init the http meta cache
+ initHttpMetaCache();
+
+ // create the global network manager
m_qnam = new QNetworkAccessManager(this);
// Register meta types.
@@ -137,11 +143,12 @@ MultiMC::MultiMC ( int& argc, char** argv )
MultiMC::~MultiMC()
{
delete m_settings;
+ delete m_metacache;
}
void MultiMC::initGlobalSettings()
{
- m_settings = new INISettingsObject(applicationDirPath() + "/multimc.cfg", this);
+ m_settings = new INISettingsObject("multimc.cfg", this);
// Updates
m_settings->registerSetting(new Setting("UseDevBuilds", false));
m_settings->registerSetting(new Setting("AutoUpdate", true));
@@ -189,6 +196,16 @@ void MultiMC::initGlobalSettings()
m_settings->registerSetting(new Setting("TheCat", false));
}
+void MultiMC::initHttpMetaCache()
+{
+ m_metacache = new HttpMetaCache("metacache");
+ m_metacache->addBase("assets", QDir("assets").absolutePath());
+ m_metacache->addBase("versions", QDir("versions").absolutePath());
+ m_metacache->addBase("libraries", QDir("libraries").absolutePath());
+ m_metacache->Load();
+}
+
+
IconList* MultiMC::icons()
{
if ( !m_icons )