2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Started video player UI in MediaView.

This commit is contained in:
John Preston
2016-07-11 21:05:46 +03:00
parent 41cd427834
commit 356b48bcca
35 changed files with 1407 additions and 41 deletions

View File

@@ -327,8 +327,11 @@ bool Generator::writeHeaderStyleNamespace() {
header_->stream() << "void init_" << baseName_ << "();\n\n";
header_->popNamespace();
}
bool wroteForwardDeclarations = writeStructsForwardDeclarations();
if (module_.hasStructs()) {
header_->newline();
if (!wroteForwardDeclarations) {
header_->newline();
}
if (!writeStructsDefinitions()) {
return false;
}
@@ -338,6 +341,32 @@ bool Generator::writeHeaderStyleNamespace() {
return true;
}
bool Generator::writeStructsForwardDeclarations() {
bool hasNoExternalStructs = module_.enumVariables([this](const Variable &value) -> bool {
if (value.value.type().tag == structure::TypeTag::Struct) {
if (!module_.findStructInModule(value.value.type().name, module_)) {
return false;
}
}
return true;
});
if (hasNoExternalStructs) {
return false;
}
header_->newline();
bool result = module_.enumVariables([this](const Variable &value) -> bool {
if (value.value.type().tag == structure::TypeTag::Struct) {
if (!module_.findStructInModule(value.value.type().name, module_)) {
header_->stream() << "struct " << value.value.type().name.back() << ";\n";
}
}
return true;
});
header_->newline();
return result;
}
bool Generator::writeStructsDefinitions() {
if (!module_.hasStructs()) {
return true;

View File

@@ -47,6 +47,7 @@ private:
QString valueAssignmentCode(structure::Value value) const;
bool writeHeaderStyleNamespace();
bool writeStructsForwardDeclarations();
bool writeStructsDefinitions();
bool writeRefsDeclarations();

View File

@@ -94,6 +94,9 @@ public:
return !fullpath_.isEmpty();
}
const Struct *findStructInModule(const FullName &name, const Module &module) const;
const Variable *findVariableInModule(const FullName &name, const Module &module) const;
private:
QString fullpath_;
std::vector<std::unique_ptr<Module>> included_;
@@ -102,9 +105,6 @@ private:
QMap<QString, int> structsByName_;
QMap<QString, int> variablesByName_;
const Struct *findStructInModule(const FullName &name, const Module &module) const;
const Variable *findVariableInModule(const FullName &name, const Module &module) const;
};
} // namespace structure