summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--depends/util/src/pathutils.cpp1
-rw-r--r--depends/util/src/userutils.cpp1
-rw-r--r--gui/dialogs/VersionSelectDialog.cpp2
-rw-r--r--gui/groupview/GroupView.cpp12
-rw-r--r--gui/pages/ModFolderPage.cpp1
-rw-r--r--gui/pages/ScreenshotsPage.cpp61
-rw-r--r--gui/pages/VersionPage.cpp1
-rw-r--r--logic/RWStorage.h60
-rw-r--r--logic/auth/flows/AuthenticateTask.cpp1
-rw-r--r--logic/auth/flows/RefreshTask.cpp1
-rw-r--r--logic/auth/flows/ValidateTask.cpp1
-rw-r--r--logic/liteloader/LiteLoaderInstaller.cpp9
-rw-r--r--logic/liteloader/LiteLoaderVersionList.cpp17
-rw-r--r--logic/liteloader/LiteLoaderVersionList.h3
-rw-r--r--logic/minecraft/InstanceVersion.cpp1
-rw-r--r--logic/minecraft/VersionBuilder.cpp1
-rw-r--r--logic/settings/SettingsObject.h2
18 files changed, 93 insertions, 85 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd670573..83057b3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -417,6 +417,9 @@ SET(MULTIMC_SOURCES
logic/MMCJson.h
logic/MMCJson.cpp
+ # RW lock protected map
+ logic/RWStorage.h
+
# network stuffs
logic/net/NetAction.h
logic/net/MD5EtagDownload.h
diff --git a/depends/util/src/pathutils.cpp b/depends/util/src/pathutils.cpp
index 3a964806..1d09fe45 100644
--- a/depends/util/src/pathutils.cpp
+++ b/depends/util/src/pathutils.cpp
@@ -19,7 +19,6 @@
#include <QDir>
#include <QDesktopServices>
#include <QUrl>
-#include <QDebug>
QString PathCombine(QString path1, QString path2)
{
diff --git a/depends/util/src/userutils.cpp b/depends/util/src/userutils.cpp
index 060a58e9..a26af5af 100644
--- a/depends/util/src/userutils.cpp
+++ b/depends/util/src/userutils.cpp
@@ -75,7 +75,6 @@ bool Util::createShortCut(QString location, QString dest, QStringList args, QStr
{
#if LINUX
location = PathCombine(location, name + ".desktop");
- qDebug("location: %s", qPrintable(location));
QFile f(location);
f.open(QIODevice::WriteOnly | QIODevice::Text);
diff --git a/gui/dialogs/VersionSelectDialog.cpp b/gui/dialogs/VersionSelectDialog.cpp
index fd8b569d..2745eccc 100644
--- a/gui/dialogs/VersionSelectDialog.cpp
+++ b/gui/dialogs/VersionSelectDialog.cpp
@@ -18,8 +18,6 @@
#include <QHeaderView>
-#include <QDebug>
-
#include <gui/dialogs/ProgressDialog.h>
#include "gui/Platform.h"
diff --git a/gui/groupview/GroupView.cpp b/gui/groupview/GroupView.cpp
index 7094b34c..69a06fd3 100644
--- a/gui/groupview/GroupView.cpp
+++ b/gui/groupview/GroupView.cpp
@@ -3,7 +3,6 @@
#include <QPainter>
#include <QApplication>
#include <QtMath>
-#include <QDebug>
#include <QMouseEvent>
#include <QListView>
#include <QPersistentModelIndex>
@@ -12,6 +11,7 @@
#include <QScrollBar>
#include "Group.h"
+#include "logger/QsLog.h"
template <typename T> bool listsIntersect(const QList<T> &l1, const QList<T> t2)
{
@@ -917,10 +917,10 @@ QModelIndex GroupView::moveCursor(QAbstractItemView::CursorAction cursorAction,
auto current = currentIndex();
if(!current.isValid())
{
- qDebug() << "model row: invalid";
+ QLOG_DEBUG() << "model row: invalid";
return current;
}
- qDebug() << "model row: " << current.row();
+ QLOG_DEBUG() << "model row: " << current.row();
auto cat = category(current);
int i = m_groups.indexOf(cat);
if(i >= 0)
@@ -934,11 +934,11 @@ QModelIndex GroupView::moveCursor(QAbstractItemView::CursorAction cursorAction,
break;
beginning_row += group->numRows();
}
- qDebug() << "category: " << real_group->text;
+ QLOG_DEBUG() << "category: " << real_group->text;
QPair<int, int> pos = categoryInternalPosition(current);
int row = beginning_row + pos.second;
- qDebug() << "row: " << row;
- qDebug() << "column: " << pos.first;
+ QLOG_DEBUG() << "row: " << row;
+ QLOG_DEBUG() << "column: " << pos.first;
}
return current;
}
diff --git a/gui/pages/ModFolderPage.cpp b/gui/pages/ModFolderPage.cpp
index 2035e57a..7e0eea52 100644
--- a/gui/pages/ModFolderPage.cpp
+++ b/gui/pages/ModFolderPage.cpp
@@ -18,7 +18,6 @@
#include <pathutils.h>
#include <QFileDialog>
#include <QMessageBox>
-#include <QDebug>
#include <QEvent>
#include <QKeyEvent>
#include <QDesktopServices>
diff --git a/gui/pages/ScreenshotsPage.cpp b/gui/pages/ScreenshotsPage.cpp
index f3ec0c1d..466b3c19 100644
--- a/gui/pages/ScreenshotsPage.cpp
+++ b/gui/pages/ScreenshotsPage.cpp
@@ -21,66 +21,7 @@
#include "logic/screenshots/ImgurAlbumCreation.h"
#include "logic/tasks/SequentialTask.h"
-template <typename K, typename V>
-class RWStorage
-{
-public:
- void add(K key, V value)
- {
- QWriteLocker l(&lock);
- cache[key] = value;
- stale_entries.remove(key);
- }
- V get(K key)
- {
- QReadLocker l(&lock);
- if(cache.contains(key))
- {
- return cache[key];
- }
- else return V();
- }
- bool get(K key, V& value)
- {
- QReadLocker l(&lock);
- if(cache.contains(key))
- {
- value = cache[key];
- return true;
- }
- else return false;
- }
- bool has(K key)
- {
- QReadLocker l(&lock);
- return cache.contains(key);
- }
- bool stale(K key)
- {
- QReadLocker l(&lock);
- if(!cache.contains(key))
- return true;
- return stale_entries.contains(key);
- }
- void setStale(K key)
- {
- QReadLocker l(&lock);
- if(cache.contains(key))
- {
- stale_entries.insert(key);
- }
- }
- void clear()
- {
- QWriteLocker l(&lock);
- cache.clear();
- }
-private:
- QReadWriteLock lock;
- QMap<K, V> cache;
- QSet<K> stale_entries;
-};
-
+#include "logic/RWStorage.h"
typedef RWStorage<QString, QIcon> SharedIconCache;
typedef std::shared_ptr<SharedIconCache> SharedIconCachePtr;
diff --git a/gui/pages/VersionPage.cpp b/gui/pages/VersionPage.cpp
index d3df5b46..ec83ef87 100644
--- a/gui/pages/VersionPage.cpp
+++ b/gui/pages/VersionPage.cpp
@@ -18,7 +18,6 @@
#include <pathutils.h>
#include <QFileDialog>
#include <QMessageBox>
-#include <QDebug>
#include <QEvent>
#include <QKeyEvent>
diff --git a/logic/RWStorage.h b/logic/RWStorage.h
new file mode 100644
index 00000000..b1598ca4
--- /dev/null
+++ b/logic/RWStorage.h
@@ -0,0 +1,60 @@
+#pragma once
+template <typename K, typename V>
+class RWStorage
+{
+public:
+ void add(K key, V value)
+ {
+ QWriteLocker l(&lock);
+ cache[key] = value;
+ stale_entries.remove(key);
+ }
+ V get(K key)
+ {
+ QReadLocker l(&lock);
+ if(cache.contains(key))
+ {
+ return cache[key];
+ }
+ else return V();
+ }
+ bool get(K key, V& value)
+ {
+ QReadLocker l(&lock);
+ if(cache.contains(key))
+ {
+ value = cache[key];
+ return true;
+ }
+ else return false;
+ }
+ bool has(K key)
+ {
+ QReadLocker l(&lock);
+ return cache.contains(key);
+ }
+ bool stale(K key)
+ {
+ QReadLocker l(&lock);
+ if(!cache.contains(key))
+ return true;
+ return stale_entries.contains(key);
+ }
+ void setStale(K key)
+ {
+ QReadLocker l(&lock);
+ if(cache.contains(key))
+ {
+ stale_entries.insert(key);
+ }
+ }
+ void clear()
+ {
+ QWriteLocker l(&lock);
+ cache.clear();
+ }
+private:
+ QReadWriteLock lock;
+ QMap<K, V> cache;
+ QSet<K> stale_entries;
+}; \ No newline at end of file
diff --git a/logic/auth/flows/AuthenticateTask.cpp b/logic/auth/flows/AuthenticateTask.cpp
index 340235e3..33634fd4 100644
--- a/logic/auth/flows/AuthenticateTask.cpp
+++ b/logic/auth/flows/AuthenticateTask.cpp
@@ -22,7 +22,6 @@
#include <QJsonObject>
#include <QJsonArray>
#include <QVariant>
-#include <QDebug>
#include "logger/QsLog.h"
diff --git a/logic/auth/flows/RefreshTask.cpp b/logic/auth/flows/RefreshTask.cpp
index 7e926c2b..61974476 100644
--- a/logic/auth/flows/RefreshTask.cpp
+++ b/logic/auth/flows/RefreshTask.cpp
@@ -21,7 +21,6 @@
#include <QJsonObject>
#include <QJsonArray>
#include <QVariant>
-#include <QDebug>
#include "logger/QsLog.h"
diff --git a/logic/auth/flows/ValidateTask.cpp b/logic/auth/flows/ValidateTask.cpp
index f3fc1e71..dd73218f 100644
--- a/logic/auth/flows/ValidateTask.cpp
+++ b/logic/auth/flows/ValidateTask.cpp
@@ -22,7 +22,6 @@
#include <QJsonObject>
#include <QJsonArray>
#include <QVariant>
-#include <QDebug>
#include "logger/QsLog.h"
diff --git a/logic/liteloader/LiteLoaderInstaller.cpp b/logic/liteloader/LiteLoaderInstaller.cpp
index ea1a4396..863c7fcb 100644
--- a/logic/liteloader/LiteLoaderInstaller.cpp
+++ b/logic/liteloader/LiteLoaderInstaller.cpp
@@ -49,13 +49,12 @@ bool LiteLoaderInstaller::add(OneSixInstance *to)
QJsonArray libraries;
- for (auto libStr : m_version->libraries)
+ for (auto rawLibrary : m_version->libraries)
{
- OneSixLibrary lib(libStr);
+ rawLibrary->insertType = RawLibrary::Prepend;
+ OneSixLibrary lib(rawLibrary);
lib.finalize();
- QJsonObject libObj = lib.toJson();
- libObj.insert("insert", QString("prepend"));
- libraries.append(libObj);
+ libraries.append(lib.toJson());
}
// liteloader
diff --git a/logic/liteloader/LiteLoaderVersionList.cpp b/logic/liteloader/LiteLoaderVersionList.cpp
index ef95eefd..c9a21cb9 100644
--- a/logic/liteloader/LiteLoaderVersionList.cpp
+++ b/logic/liteloader/LiteLoaderVersionList.cpp
@@ -16,6 +16,7 @@
#include "LiteLoaderVersionList.h"
#include "MultiMC.h"
#include "logic/net/URLConstants.h"
+#include <MMCError.h>
#include <QtXml>
@@ -206,7 +207,21 @@ void LLListLoadTask::listDownloaded()
const QJsonArray libs = artefact.value("libraries").toArray();
for (auto lIt = libs.begin(); lIt != libs.end(); ++lIt)
{
- version->libraries.append((*lIt).toObject().value("name").toString());
+ auto libobject = (*lIt).toObject();
+ try
+ {
+ auto lib = RawLibrary::fromJson(libobject, "versions.json");
+ if(lib->m_name.startsWith("org.ow2.asm:asm-all:"))
+ {
+ lib->m_base_url = "http://repo.maven.apache.org/maven2/";
+ }
+ version->libraries.append(lib);
+ }
+ catch (MMCError &e)
+ {
+ QLOG_ERROR() << "Couldn't read JSON object:";
+ continue;
+ }
}
perMcVersionList.append(version);
}
diff --git a/logic/liteloader/LiteLoaderVersionList.h b/logic/liteloader/LiteLoaderVersionList.h
index 0aecc3e1..91ed077c 100644
--- a/logic/liteloader/LiteLoaderVersionList.h
+++ b/logic/liteloader/LiteLoaderVersionList.h
@@ -23,6 +23,7 @@
#include "logic/BaseVersionList.h"
#include "logic/tasks/Task.h"
#include "logic/net/NetJob.h"
+#include <logic/minecraft/RawLibrary.h>
class LLListLoadTask;
class QNetworkReply;
@@ -55,7 +56,7 @@ public:
int timestamp;
bool isLatest;
QString tweakClass;
- QStringList libraries;
+ QList<RawLibraryPtr> libraries;
// meta
QString defaultUrl;
diff --git a/logic/minecraft/InstanceVersion.cpp b/logic/minecraft/InstanceVersion.cpp
index 91393b53..e71609e6 100644
--- a/logic/minecraft/InstanceVersion.cpp
+++ b/logic/minecraft/InstanceVersion.cpp
@@ -13,7 +13,6 @@
* limitations under the License.
*/
-#include <QDebug>
#include <QFile>
#include <QDir>
#include <QUuid>
diff --git a/logic/minecraft/VersionBuilder.cpp b/logic/minecraft/VersionBuilder.cpp
index ddcf6333..66e7d327 100644
--- a/logic/minecraft/VersionBuilder.cpp
+++ b/logic/minecraft/VersionBuilder.cpp
@@ -22,7 +22,6 @@
#include <QMessageBox>
#include <QObject>
#include <QDir>
-#include <QDebug>
#include <qresource.h>
#include <modutils.h>
diff --git a/logic/settings/SettingsObject.h b/logic/settings/SettingsObject.h
index e46a1b7f..4f11310d 100644
--- a/logic/settings/SettingsObject.h
+++ b/logic/settings/SettingsObject.h
@@ -91,7 +91,7 @@ public:
/*!
* \brief Sets the value of the setting with the given ID.
- * If no setting with the given ID exists, returns false and logs to qDebug
+ * If no setting with the given ID exists, returns false
* \param id The ID of the setting to change.
* \param value The new value of the setting.
* \return True if successful, false if it failed.