summaryrefslogtreecommitdiffstats
path: root/depends
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-08-25 22:48:41 +0200
committerPetr Mrázek <peterix@gmail.com>2013-08-25 22:48:41 +0200
commitf0990fae4bc6e54837764c0ded1461b9f1770401 (patch)
tree619dd1c5007d902e2d349bb42e3f66454596713a /depends
parentd884f849d60db44f05a6a6b22f4ffcf520900389 (diff)
downloadMultiMC-f0990fae4bc6e54837764c0ded1461b9f1770401.tar
MultiMC-f0990fae4bc6e54837764c0ded1461b9f1770401.tar.gz
MultiMC-f0990fae4bc6e54837764c0ded1461b9f1770401.tar.lz
MultiMC-f0990fae4bc6e54837764c0ded1461b9f1770401.tar.xz
MultiMC-f0990fae4bc6e54837764c0ded1461b9f1770401.zip
Many improvements
PermGen can be tweaked from the settings menu Groups are saved on change/exit Install target is no longer completely broken All the deplibs are now static Added notes dialog Fixed ini file format support (can save strings with newlines, tabs. UTF-8 is explicitly used!) Rename button now uses line breaks so it doesn't grow ever wider (Added a custom tool button subclass) There is now a CAT button. Meow.
Diffstat (limited to 'depends')
-rw-r--r--depends/groupview/CMakeLists.txt2
-rw-r--r--depends/settings/CMakeLists.txt2
-rw-r--r--depends/settings/include/inifile.h10
-rw-r--r--depends/settings/src/inifile.cpp30
-rw-r--r--depends/util/CMakeLists.txt2
5 files changed, 30 insertions, 16 deletions
diff --git a/depends/groupview/CMakeLists.txt b/depends/groupview/CMakeLists.txt
index 3fa2b044..c3a3dafa 100644
--- a/depends/groupview/CMakeLists.txt
+++ b/depends/groupview/CMakeLists.txt
@@ -37,5 +37,5 @@ include_directories(${CMAKE_BINARY_DIR}/include)
add_definitions(-DLIBGROUPVIEW_LIBRARY)
-add_library(libGroupView SHARED ${LIBGROUPVIEW_SOURCES} ${LIBGROUPVIEW_HEADERS})
+add_library(libGroupView STATIC ${LIBGROUPVIEW_SOURCES} ${LIBGROUPVIEW_HEADERS})
qt5_use_modules(libGroupView Core Widgets)
diff --git a/depends/settings/CMakeLists.txt b/depends/settings/CMakeLists.txt
index e5aae0b7..911b604b 100644
--- a/depends/settings/CMakeLists.txt
+++ b/depends/settings/CMakeLists.txt
@@ -46,6 +46,6 @@ include_directories(${LIBSETTINGS_INCLUDE_DIR})
add_definitions(-DLIBSETTINGS_LIBRARY)
-add_library(libSettings SHARED ${LIBSETTINGS_SOURCES} ${LIBSETTINGS_HEADERS} ${LIBSETTINGS_HEADERS_PRIVATE})
+add_library(libSettings STATIC ${LIBSETTINGS_SOURCES} ${LIBSETTINGS_HEADERS} ${LIBSETTINGS_HEADERS_PRIVATE})
qt5_use_modules(libSettings Core)
target_link_libraries(libSettings)
diff --git a/depends/settings/include/inifile.h b/depends/settings/include/inifile.h
index 94467832..e3ff6b64 100644
--- a/depends/settings/include/inifile.h
+++ b/depends/settings/include/inifile.h
@@ -13,13 +13,11 @@
* limitations under the License.
*/
-#ifndef INIFILE_H
-#define INIFILE_H
-
-#include <QMap>
+#pragma once
#include <QString>
#include <QVariant>
+
#include "libsettings_config.h"
// Sectionless INI parser (for instance config files)
@@ -33,6 +31,6 @@ public:
QVariant get(QString key, QVariant def) const;
void set(QString key, QVariant val);
+ QString unescape(QString orig);
+ QString escape(QString orig);
};
-
-#endif // INIFILE_H
diff --git a/depends/settings/src/inifile.cpp b/depends/settings/src/inifile.cpp
index 43545a4a..b3ee3a90 100644
--- a/depends/settings/src/inifile.cpp
+++ b/depends/settings/src/inifile.cpp
@@ -19,21 +19,40 @@
#include <QTextStream>
#include <QStringList>
+
INIFile::INIFile()
{
}
+QString INIFile::unescape(QString orig)
+{
+ orig.replace("\\n", "\n");
+ orig.replace("\\t", "\t");
+ orig.replace("\\\\", "\\");
+ return orig;
+}
+QString INIFile::escape(QString orig)
+{
+ orig.replace("\\", "\\\\");
+ orig.replace("\n", "\\n");
+ orig.replace("\t", "\\t");
+ return orig;
+}
+
bool INIFile::saveFile(QString fileName)
{
// TODO Handle errors.
QFile file(fileName);
file.open(QIODevice::WriteOnly);
QTextStream out(&file);
+ out.setCodec("UTF-8");
for (Iterator iter = begin(); iter != end(); iter++)
{
- out << iter.key() << "=" << iter.value().toString() << "\n";
+ QString value = iter.value().toString();
+ value = escape(value);
+ out << iter.key() << "=" << value << "\n";
}
return true;
@@ -45,6 +64,7 @@ bool INIFile::loadFile(QString fileName)
QFile file(fileName);
file.open(QIODevice::ReadOnly);
QTextStream in(&file);
+ in.setCodec("UTF-8");
QStringList lines = in.readAll().split('\n');
for (int i = 0; i < lines.count(); i++)
@@ -59,13 +79,9 @@ bool INIFile::loadFile(QString fileName)
QString key = line.left(eqPos).trimmed();
QString valueStr = line.right(line.length() - eqPos - 1).trimmed();
+ valueStr = unescape(valueStr);
+
QVariant value(valueStr);
- /*
- QString dbg = key;
- dbg += " = ";
- dbg += valueStr;
- qDebug(dbg.toLocal8Bit());
- */
this->operator [](key) = value;
}
diff --git a/depends/util/CMakeLists.txt b/depends/util/CMakeLists.txt
index 7affb5ea..86542c43 100644
--- a/depends/util/CMakeLists.txt
+++ b/depends/util/CMakeLists.txt
@@ -45,7 +45,7 @@ SET(LIBUTIL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE)
add_definitions(-DLIBUTIL_LIBRARY)
-add_library(libUtil SHARED ${LIBUTIL_SOURCES} ${LIBUTIL_HEADERS})
+add_library(libUtil STATIC ${LIBUTIL_SOURCES} ${LIBUTIL_HEADERS})
# qt5_use_modules(libUtil Core Network)
qt5_use_modules(libUtil Core)
target_link_libraries(libUtil)