Merge branch 'inst_rewrite' of https://github.com/Forkk/MultiMC5

This commit is contained in:
Petr Mrázek 2013-02-21 19:37:35 +01:00
commit 294c8e21c8
5 changed files with 28 additions and 31 deletions

View File

@ -8,6 +8,19 @@ SET(CMAKE_INCLUDE_CURRENT_DIR ON)
# Output all executables and shared libs in the main build folder, not in subfolders.
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
######## Set compiler flags ########
IF(APPLE)
# assume clang 4.1.0+, add C++0x/C++11 stuff
message(STATUS "Using APPLE CMAKE_CXX_FLAGS")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++")
ELSEIF(UNIX)
# assume GCC, add C++0x/C++11 stuff
MESSAGE(STATUS "Using UNIX CMAKE_CXX_FLAGS")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ELSEIF(MINGW)
MESSAGE(STATUS "Using MINGW CMAKE_CXX_FLAGS")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
ENDIF()
################################ INCLUDE LIBRARIES ################################
@ -73,21 +86,6 @@ ENDIF(${BIGENDIAN})
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
######## Set compiler flags ########
IF(APPLE)
# assume clang 4.1.0+, add C++0x/C++11 stuff
message(STATUS "Using APPLE CMAKE_CXX_FLAGS")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++")
ELSEIF(UNIX)
# assume GCC, add C++0x/C++11 stuff
MESSAGE(STATUS "Using UNIX CMAKE_CXX_FLAGS")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ELSEIF(MINGW)
MESSAGE(STATUS "Using MINGW CMAKE_CXX_FLAGS")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
ENDIF()
######## Set version numbers ########
SET(MultiMC_VERSION_MAJOR 5)
SET(MultiMC_VERSION_MINOR 0)

View File

@ -26,7 +26,7 @@
class Instance;
class LIBMMCINST_EXPORT InstanceList : public QObject, public SigList<QSharedPointer<Instance>>
class LIBMMCINST_EXPORT InstanceList : public QObject, public SigList< QSharedPointer<Instance> >
{
Q_OBJECT
public:

View File

@ -100,7 +100,7 @@ InstTypeList InstanceLoader::typeList()
{
InstTypeList typeList;
for (auto iter = m_typeMap.begin(); iter != m_typeMap.end(); iter++)
for (QMap<QString, InstanceTypeInterface *>::iterator iter = m_typeMap.begin(); iter != m_typeMap.end(); iter++)
{
typeList.append(*iter);
}

View File

@ -26,7 +26,6 @@
template <typename T>
class SigList : public QList<T>
{
public:
explicit SigList() : QList<T>() {}
@ -35,11 +34,11 @@ public:
virtual void clear();
virtual void erase(iterator pos);
virtual void erase(iterator first, iterator last);
virtual void erase(typename QList<T>::iterator pos);
virtual void erase(typename QList<T>::iterator first, typename QList<T>::iterator last);
virtual void insert(int i, const T &t);
virtual void insert(iterator before, const T &t);
virtual void insert(typename QList<T>::iterator before, const T &t);
virtual void move(int from, int to);

View File

@ -19,7 +19,7 @@ template <typename T>
void SigList<T>::append(const T &value)
{
QList<T>::append(value);
onItemAdded(value, length() - 1);
onItemAdded(value, QList<T>::length() - 1);
}
template <typename T>
@ -32,7 +32,7 @@ void SigList<T>::prepend(const T &value)
template <typename T>
void SigList<T>::append(const QList<T> &other)
{
int index = length();
int index = QList<T>::length();
QList<T>::append(other);
onItemsAdded(other, index);
}
@ -45,7 +45,7 @@ void SigList<T>::clear()
}
template <typename T>
void SigList<T>::erase(QList<T>::iterator pos)
void SigList<T>::erase(typename QList<T>::iterator pos)
{
T value = *pos;
int index = indexOf(*pos);
@ -54,12 +54,12 @@ void SigList<T>::erase(QList<T>::iterator pos)
}
template <typename T>
void SigList<T>::erase(QList<T>::iterator first, QList<T>::iterator last)
void SigList<T>::erase(typename QList<T>::iterator first, typename QList<T>::iterator last)
{
QList<T> removedValues;
int firstIndex = indexOf(*first);
for (QList<T>::iterator iter = first; iter < last; iter++)
for (SigList<T>::iterator iter = first; iter < last; iter++)
{
removedValues << *iter;
QList<T>::erase(iter);
@ -76,7 +76,7 @@ void SigList<T>::insert(int i, const T &t)
}
template <typename T>
void SigList<T>::insert(QList<T>::iterator before, const T &t)
void SigList<T>::insert(typename QList<T>::iterator before, const T &t)
{
QList<T>::insert(before, t);
onItemAdded(t, indexOf(t));
@ -85,7 +85,7 @@ void SigList<T>::insert(QList<T>::iterator before, const T &t)
template <typename T>
void SigList<T>::move(int from, int to)
{
const T &item = at(from);
const T &item = QList<T>::at(from);
QList<T>::move(from, to);
onItemMoved(item, from, to);
}
@ -120,8 +120,8 @@ void SigList<T>::swap(QList<T> &other)
template <typename T>
void SigList<T>::swap(int i, int j)
{
const T &item1 = at(i);
const T &item2 = at(j);
const T &item1 = QList<T>::at(i);
const T &item2 = QList<T>::at(j);
QList<T>::swap(i, j);
onItemMoved(item1, i, j);
onItemMoved(item2, j, i);
@ -144,7 +144,7 @@ T SigList<T>::takeFirst()
template <typename T>
T SigList<T>::takeLast()
{
return takeAt(length() - 1);
return takeAt(QList<T>::length() - 1);
}
template <typename T>