Add a macro that enables qt-compatibility in the renderdoc replay API

* This will be used to remove the ToQStr everywhere (where it's not
  used for actual stringification of enums/structs)
This commit is contained in:
baldurk
2017-08-16 18:28:11 +01:00
parent cfd816d7f3
commit ef84f494a2
13 changed files with 40 additions and 40 deletions
@@ -55,15 +55,16 @@ public:
makeIconStates(exeIcon, Pixmaps::page_white_code(parent));
makeIconStates(dirIcon, Pixmaps::folder(parent));
Renderer.GetHomeFolder(true, [this](const char *path, const rdctype::array<PathEntry> &files) {
QString homeDir = QString::fromUtf8(path);
Renderer.GetHomeFolder(true, [this](const rdctype::str &path,
const rdctype::array<PathEntry> &files) {
QString homeDir = path;
if(QChar(QLatin1Char(path[0])).isLetter() && path[1] == ':')
{
NTPaths = true;
// NT paths
Renderer.ListFolder(lit("/"), true, [this, homeDir](const char *path,
Renderer.ListFolder(lit("/"), true, [this, homeDir](const rdctype::str &path,
const rdctype::array<PathEntry> &files) {
for(int i = 0; i < files.count; i++)
{
@@ -448,37 +449,37 @@ private:
if(!(node->file.flags & PathProperty::Directory))
return;
Renderer.ListFolder(
makePath(node), true, [this, node](const char *path, const rdctype::array<PathEntry> &files) {
Renderer.ListFolder(makePath(node), true, [this, node](const rdctype::str &path,
const rdctype::array<PathEntry> &files) {
if(files.count == 1 && (files[0].flags & PathProperty::ErrorAccessDenied))
{
node->file.flags |= PathProperty::ErrorAccessDenied;
return;
}
if(files.count == 1 && (files[0].flags & PathProperty::ErrorAccessDenied))
{
node->file.flags |= PathProperty::ErrorAccessDenied;
return;
}
QVector<PathEntry> sortedFiles;
sortedFiles.reserve(files.count);
for(const PathEntry &f : files)
sortedFiles.push_back(f);
QVector<PathEntry> sortedFiles;
sortedFiles.reserve(files.count);
for(const PathEntry &f : files)
sortedFiles.push_back(f);
qSort(sortedFiles.begin(), sortedFiles.end(), [](const PathEntry &a, const PathEntry &b) {
// sort greater than so that files with the flag are sorted before those without
if((a.flags & PathProperty::Directory) != (b.flags & PathProperty::Directory))
return (a.flags & PathProperty::Directory) > (b.flags & PathProperty::Directory);
qSort(sortedFiles.begin(), sortedFiles.end(), [](const PathEntry &a, const PathEntry &b) {
// sort greater than so that files with the flag are sorted before those without
if((a.flags & PathProperty::Directory) != (b.flags & PathProperty::Directory))
return (a.flags & PathProperty::Directory) > (b.flags & PathProperty::Directory);
return strcmp(a.filename.c_str(), b.filename.c_str()) < 0;
});
return strcmp(a.filename.c_str(), b.filename.c_str()) < 0;
});
for(int i = 0; i < sortedFiles.count(); i++)
{
FSNode *child = new FSNode();
child->parent = node;
child->parentIndex = i;
child->file = sortedFiles[i];
node->children.push_back(child);
}
});
for(int i = 0; i < sortedFiles.count(); i++)
{
FSNode *child = new FSNode();
child->parent = node;
child->parentIndex = i;
child->file = sortedFiles[i];
node->children.push_back(child);
}
});
}
};