forked from qt-creator/qt-creator
Utils: Remove the non-QTC_USE_STORE case
Change-Id: I857a38c80470d1b474ca0f291a93ed58fbcc0bf4 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -161,11 +161,7 @@ QString Id::toString() const
|
||||
/*! \internal */
|
||||
Key Id::toKey() const
|
||||
{
|
||||
#ifdef QTC_USE_STORE
|
||||
return name();
|
||||
#else
|
||||
return toString();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@@ -38,7 +38,6 @@ Store storeFromVariant(const QVariant &value)
|
||||
return Store();
|
||||
}
|
||||
|
||||
#ifdef QTC_USE_STORE
|
||||
static QVariantList storeListFromMapList(const QVariantList &mapList)
|
||||
{
|
||||
QVariantList storeList;
|
||||
@@ -70,11 +69,9 @@ static QVariantList mapListFromStoreList(const QVariantList &storeList)
|
||||
|
||||
return mapList;
|
||||
}
|
||||
#endif
|
||||
|
||||
Store storeFromMap(const QVariantMap &map)
|
||||
{
|
||||
#ifdef QTC_USE_STORE
|
||||
Store store;
|
||||
for (auto it = map.begin(); it != map.end(); ++it) {
|
||||
if (it.value().type() == QVariant::Map) {
|
||||
@@ -87,14 +84,10 @@ Store storeFromMap(const QVariantMap &map)
|
||||
}
|
||||
}
|
||||
return store;
|
||||
#else
|
||||
return map;
|
||||
#endif
|
||||
}
|
||||
|
||||
QVariantMap mapFromStore(const Store &store)
|
||||
{
|
||||
#ifdef QTC_USE_STORE
|
||||
QVariantMap map;
|
||||
for (auto it = store.begin(); it != store.end(); ++it) {
|
||||
if (it.value().metaType() == QMetaType::fromType<Store>())
|
||||
@@ -105,9 +98,6 @@ QVariantMap mapFromStore(const Store &store)
|
||||
map.insert(stringFromKey(it.key()), it.value());
|
||||
}
|
||||
return map;
|
||||
#else
|
||||
return store;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isStore(const QVariant &value)
|
||||
|
@@ -12,11 +12,7 @@ namespace Utils {
|
||||
|
||||
using KeyList = QList<Key>;
|
||||
|
||||
#ifdef QTC_USE_STORE
|
||||
using Store = QMap<Key, QVariant>;
|
||||
#else
|
||||
using Store = QVariantMap;
|
||||
#endif
|
||||
|
||||
QTCREATOR_UTILS_EXPORT KeyList keysFromStrings(const QStringList &list);
|
||||
QTCREATOR_UTILS_EXPORT QStringList stringsFromKeys(const KeyList &list);
|
||||
@@ -33,6 +29,4 @@ QTCREATOR_UTILS_EXPORT Key numberedKey(const Key &key, int number);
|
||||
|
||||
} // Utils
|
||||
|
||||
#ifdef QTC_USE_STORE
|
||||
Q_DECLARE_METATYPE(Utils::Store)
|
||||
#endif
|
||||
|
@@ -9,23 +9,9 @@
|
||||
|
||||
namespace Utils {
|
||||
|
||||
// Opt-in to new classes during the transition phase.
|
||||
#define QTC_USE_STORE
|
||||
|
||||
#ifdef QTC_USE_STORE
|
||||
|
||||
using Key = QByteArray;
|
||||
|
||||
inline Key keyFromString(const QString &str) { return str.toUtf8(); }
|
||||
inline QString stringFromKey(const Key &key) { return QString::fromUtf8(key); }
|
||||
|
||||
#else
|
||||
|
||||
using Key = QString;
|
||||
|
||||
inline Key keyFromString(const QString &str) { return str; }
|
||||
inline QString stringFromKey(const Key &key) { return key; }
|
||||
|
||||
#endif
|
||||
|
||||
} // Utils
|
||||
|
@@ -25,11 +25,7 @@ namespace FakeVim::Internal {
|
||||
|
||||
#ifdef FAKEVIM_STANDALONE
|
||||
|
||||
#ifdef QTC_USE_STORE
|
||||
using Key = QByteArray;
|
||||
#else
|
||||
using Key = QString;
|
||||
#endif
|
||||
|
||||
class FvBaseAspect
|
||||
{
|
||||
|
Reference in New Issue
Block a user