Implemented version list sorting.
Resolves MMC-8: https://jira.forkk.net/browse/MMC-8
This commit is contained in:
@ -104,6 +104,30 @@ public:
|
||||
*/
|
||||
virtual InstVersion *copyVersion(InstVersionList *newParent) const = 0;
|
||||
|
||||
/*!
|
||||
* Checks if this version is less (older) than the given version.
|
||||
* \param other The version to compare this one to.
|
||||
* \return True if this version is older than the given version.
|
||||
*/
|
||||
virtual bool isLessThan(const InstVersion &other) const;
|
||||
|
||||
/*!
|
||||
* Checks if this version is greater (newer) than the given version.
|
||||
* \param other The version to compare this one to.
|
||||
* \return True if this version is newer than the given version.
|
||||
*/
|
||||
virtual bool isGreaterThan(const InstVersion &other) const;
|
||||
|
||||
/*!
|
||||
* \sa shouldSortBefore()
|
||||
*/
|
||||
virtual bool operator<(const InstVersion &rhs) { return isLessThan(rhs); }
|
||||
|
||||
/*!
|
||||
* \sa shouldSortAfter()
|
||||
*/
|
||||
virtual bool operator>(const InstVersion &rhs) { return isGreaterThan(rhs); }
|
||||
|
||||
protected:
|
||||
QString m_descriptor;
|
||||
QString m_name;
|
||||
|
@ -88,6 +88,11 @@ public:
|
||||
*/
|
||||
virtual const InstVersion *getLatestStable();
|
||||
|
||||
/*!
|
||||
* Sorts the version list.
|
||||
*/
|
||||
virtual void sort() = 0;
|
||||
|
||||
protected slots:
|
||||
/*!
|
||||
* Updates this list with the given list of versions.
|
||||
|
@ -45,12 +45,14 @@ public:
|
||||
virtual const InstVersion *at(int i) const;
|
||||
virtual int count() const;
|
||||
virtual void printToStdOut() const;
|
||||
virtual void sort();
|
||||
|
||||
/*!
|
||||
* Gets the main version list instance.
|
||||
*/
|
||||
static MinecraftVersionList &getMainList();
|
||||
|
||||
|
||||
protected:
|
||||
QList<InstVersion *>m_vlist;
|
||||
|
||||
|
Reference in New Issue
Block a user