Merge pull request #6882 from aws-lumberyard-dev/cgalvan/RemovedUnusedEditorUtils

Removed some unused EditorUtils functions
This commit is contained in:
Chris Galvan
2022-01-13 13:09:21 -06:00
committed by GitHub
3 changed files with 0 additions and 199 deletions
-17
View File
@@ -176,23 +176,6 @@ QString TrimTrailingZeros(QString str)
return str;
}
//////////////////////////////////////////////////////////////////////////
// This function is supposed to format float in user-friendly way,
// omitting the exponent notation.
//
// Why not using printf? Its formatting rules has following drawbacks:
// %g - will use exponent for small numbers;
// %.Nf - doesn't allow to control total amount of significant numbers,
// which exposes limited precision during binary-to-decimal fraction
// conversion.
//////////////////////////////////////////////////////////////////////////
void FormatFloatForUI(QString& str, int significantDigits, double value)
{
str = TrimTrailingZeros(QString::number(value, 'f', significantDigits));
return;
}
//////////////////////////////////////////////////////////////////////////-
//////////////////////////////////////////////////////////////////////////
QColor ColorLinearToGamma(ColorF col)
{
-165
View File
@@ -212,22 +212,6 @@ namespace XmlHelpers
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Drag Drop helper functions
//////////////////////////////////////////////////////////////////////////
namespace EditorDragDropHelpers
{
inline QString GetAnimationNameClipboardFormat()
{
return QStringLiteral("application/x-animation-browser-copy");
}
inline QString GetFragmentClipboardFormat()
{
return QStringLiteral("application/x-preview-fragment-properties");
}
}
//////////////////////////////////////////////////////////////////////////
/*!
@@ -292,116 +276,6 @@ public:
}
};
//////////////////////////////////////////////////////////////////////////
//
// Convert String representation of color to RGB integer value.
//
//////////////////////////////////////////////////////////////////////////
inline QColor String2Color(const QString& val)
{
unsigned int r = 0, g = 0, b = 0;
int res = 0;
res = azsscanf(val.toUtf8().data(), "R:%d,G:%d,B:%d", &r, &g, &b);
if (res != 3)
{
res = azsscanf(val.toUtf8().data(), "R:%d G:%d B:%d", &r, &g, &b);
}
if (res != 3)
{
res = azsscanf(val.toUtf8().data(), "%d,%d,%d", &r, &g, &b);
}
if (res != 3)
{
res = azsscanf(val.toUtf8().data(), "%d %d %d", &r, &g, &b);
}
if (res != 3)
{
azsscanf(val.toUtf8().data(), "%x", &r);
return r;
}
return QColor(r, g, b);
}
// Converts QColor to Vector.
inline Vec3 Rgb2Vec(const QColor& color)
{
return Vec3(aznumeric_cast<float>(color.redF()), aznumeric_cast<float>(color.greenF()), aznumeric_cast<float>(color.blueF()));
}
// Converts QColor to ColorF.
inline ColorF Rgb2ColorF(const QColor& color)
{
return ColorF(aznumeric_cast<float>(color.redF()), aznumeric_cast<float>(color.greenF()), aznumeric_cast<float>(color.blueF()), 1.0f);
}
// Converts QColor to Vector.
inline QColor Vec2Rgb(const Vec3& color)
{
return QColor(aznumeric_cast<int>(color.x * 255), aznumeric_cast<int>(color.y * 255), aznumeric_cast<int>(color.z * 255));
}
// Converts ColorF to QColor.
inline QColor ColorF2Rgb(const ColorF& color)
{
return QColor(aznumeric_cast<int>(color.r * 255), aznumeric_cast<int>(color.g * 255), aznumeric_cast<int>(color.b * 255));
}
//////////////////////////////////////////////////////////////////////////
// Tokenize string.
//////////////////////////////////////////////////////////////////////////
inline QString TokenizeString(const QString& s, LPCSTR pszTokens, int& iStart)
{
assert(iStart >= 0);
QByteArray str = s.toUtf8();
if (pszTokens == nullptr)
{
return str;
}
auto pszPlace = str.begin() + iStart;
auto pszEnd = str.end();
if (pszPlace < pszEnd)
{
int nIncluding = (int)strspn(pszPlace, pszTokens);
;
if ((pszPlace + nIncluding) < pszEnd)
{
pszPlace += nIncluding;
int nExcluding = (int)strcspn(pszPlace, pszTokens);
int iFrom = iStart + nIncluding;
int nUntil = nExcluding;
iStart = iFrom + nUntil + 1;
return (str.mid(iFrom, nUntil));
}
}
// return empty string, done tokenizing
iStart = -1;
return "";
}
// This template function will join strings from a vector into a single string, using a separator char
template<class T>
inline void JoinStrings(const QList<T>& rStrings, QString& rDestStr, char aSeparator = ',')
{
for (size_t i = 0, iCount = rStrings.size(); i < iCount; ++i)
{
rDestStr += rStrings[i];
if (i < iCount - 1)
{
rDestStr += aSeparator;
}
}
}
// This function will split a string containing separated strings, into a vector of strings
// better version of TokenizeString
inline void SplitString(const QString& rSrcStr, QStringList& rDestStrings, char aSeparator = ',')
@@ -435,45 +309,6 @@ inline void SplitString(const QString& rSrcStr, QStringList& rDestStrings, char
}
}
// Format unsigned number to string with 1000s separator
inline QString FormatWithThousandsSeperator(const unsigned int number)
{
QString string;
string = QString::number(number);
for (int p = string.length() - 3; p > 0; p -= 3)
{
string.insert(p, ',');
}
return string;
}
void FormatFloatForUI(QString& str, int significantDigits, double value);
//////////////////////////////////////////////////////////////////////////
// Simply sub string searching case insensitive.
//////////////////////////////////////////////////////////////////////////
inline const char* strstri(const char* pString, const char* pSubstring)
{
int i, j, k;
for (i = 0; pString[i]; i++)
{
for (j = i, k = 0; tolower(pString[j]) == tolower(pSubstring[k]); j++, k++)
{
if (!pSubstring[k + 1])
{
return (pString + i);
}
}
}
return nullptr;
}
inline bool CheckVirtualKey(Qt::MouseButton button)
{
return (qApp->property("pressedMouseButtons").toInt() & button) != 0;
@@ -92,23 +92,6 @@ QString TrimTrailingZeros(QString str)
return str;
}
//////////////////////////////////////////////////////////////////////////
// This function is supposed to format float in user-friendly way,
// omitting the exponent notation.
//
// Why not using printf? Its formatting rules has following drawbacks:
// %g - will use exponent for small numbers;
// %.Nf - doesn't allow to control total amount of significant numbers,
// which exposes limited precision during binary-to-decimal fraction
// conversion.
//////////////////////////////////////////////////////////////////////////
void FormatFloatForUI(QString& str, int significantDigits, double value)
{
str = TrimTrailingZeros(QString::number(value, 'f', significantDigits));
return;
}
//////////////////////////////////////////////////////////////////////////-
//////////////////////////////////////////////////////////////////////////
QColor ColorLinearToGamma(ColorF col)
{