forked from qt-creator/qt-creator
ClassView: Dissolve the internal 'Utils' class
It's regularly getting in my way, and it's rather a namespace anyway. Also, move the functions that are only used once closer to their place of use. Change-Id: I97951aae1b69c04f391afbdd1b491a8a9173a977 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -24,8 +24,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "classviewsymbolinformation.h"
|
||||
|
||||
#include "classviewconstants.h"
|
||||
#include "classviewutils.h"
|
||||
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QPair>
|
||||
#include <QHash>
|
||||
|
||||
@@ -61,7 +65,46 @@ SymbolInformation::SymbolInformation(const QString &valueName, const QString &va
|
||||
|
||||
int SymbolInformation::iconTypeSortOrder() const
|
||||
{
|
||||
return Utils::iconTypeSortOrder(m_iconType);
|
||||
namespace Icons = Utils::CodeModelIcon;
|
||||
constexpr int IconSortOrder[] = {
|
||||
Icons::Namespace,
|
||||
Icons::Enum,
|
||||
Icons::Class,
|
||||
Icons::FuncPublic,
|
||||
Icons::FuncProtected,
|
||||
Icons::FuncPrivate,
|
||||
Icons::FuncPublicStatic,
|
||||
Icons::FuncProtectedStatic,
|
||||
Icons::FuncPrivateStatic,
|
||||
Icons::Signal,
|
||||
Icons::SlotPublic,
|
||||
Icons::SlotProtected,
|
||||
Icons::SlotPrivate,
|
||||
Icons::VarPublic,
|
||||
Icons::VarProtected,
|
||||
Icons::VarPrivate,
|
||||
Icons::VarPublicStatic,
|
||||
Icons::VarProtectedStatic,
|
||||
Icons::VarPrivateStatic,
|
||||
Icons::Enumerator,
|
||||
Icons::Keyword,
|
||||
Icons::Macro,
|
||||
Icons::Unknown
|
||||
};
|
||||
|
||||
static QHash<int, int> sortOrder;
|
||||
|
||||
// initialization
|
||||
if (sortOrder.isEmpty()) {
|
||||
for (int i : IconSortOrder)
|
||||
sortOrder.insert(i, sortOrder.count());
|
||||
}
|
||||
|
||||
// if it is missing - return the same value
|
||||
if (!sortOrder.contains(m_iconType))
|
||||
return m_iconType;
|
||||
|
||||
return sortOrder[m_iconType];
|
||||
}
|
||||
|
||||
bool SymbolInformation::operator<(const SymbolInformation &other) const
|
||||
|
||||
Reference in New Issue
Block a user