forked from qt-creator/qt-creator
C++: handle case-insensitive file names in the CPlusPlus::Snapshot
... by keying on Utils::FileName Task-number: QTCREATORBUG-12390 Change-Id: Ia98afb5a9160a7fd9225a2f9e02539ff3c35ae86 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
a8ece5e9b0
commit
a48adcf9be
@@ -624,6 +624,13 @@ FileName FileName::fromUserInput(const QString &filename)
|
||||
return FileName(clean);
|
||||
}
|
||||
|
||||
/// Constructs a FileName from \a fileName, which is encoded as UTF-8.
|
||||
/// \a fileName is not checked for validity.
|
||||
FileName FileName::fromUtf8(const char *filename, int filenameSize)
|
||||
{
|
||||
return FileName(QString::fromUtf8(filename, filenameSize));
|
||||
}
|
||||
|
||||
FileName::FileName(const QString &string)
|
||||
: QString(string)
|
||||
{
|
||||
@@ -726,6 +733,25 @@ QTextStream &operator<<(QTextStream &s, const FileName &fn)
|
||||
return s << fn.toString();
|
||||
}
|
||||
|
||||
int FileNameList::removeDuplicates()
|
||||
{
|
||||
QSet<FileName> seen;
|
||||
int removed = 0;
|
||||
|
||||
for (int i = 0; i < size(); ) {
|
||||
const FileName &fn = at(i);
|
||||
if (seen.contains(fn)) {
|
||||
removeAt(i);
|
||||
++removed;
|
||||
} else {
|
||||
seen.insert(fn);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
static bool isFileDrop(const QMimeData *d, QList<FileDropSupport::FileSpec> *files = 0)
|
||||
{
|
||||
// internal drop
|
||||
|
||||
Reference in New Issue
Block a user