Minor code change according to suggestions
This commit is contained in:
@@ -633,7 +633,7 @@ Document *Application::getDocumentByPath(const char *path, PathMatchMode checkCa
|
||||
if(!path || !path[0])
|
||||
return nullptr;
|
||||
if(DocFileMap.empty()) {
|
||||
for(auto &v : DocMap) {
|
||||
for(const auto &v : DocMap) {
|
||||
const auto &file = v.second->FileName.getStrValue();
|
||||
if(file.size())
|
||||
DocFileMap[FileInfo(file.c_str()).filePath()] = v.second;
|
||||
@@ -643,15 +643,15 @@ Document *Application::getDocumentByPath(const char *path, PathMatchMode checkCa
|
||||
if(it != DocFileMap.end())
|
||||
return it->second;
|
||||
|
||||
if (checkCanonical == MatchAbsolute)
|
||||
if (checkCanonical == PathMatchMode::MatchAbsolute)
|
||||
return nullptr;
|
||||
|
||||
std::string filepath = FileInfo(path).filePath();
|
||||
QString canonicalPath = QFileInfo(QString::fromUtf8(path)).canonicalFilePath();
|
||||
for (auto &v : DocMap) {
|
||||
for (const auto &v : DocMap) {
|
||||
QFileInfo fi(QString::fromUtf8(v.second->FileName.getValue()));
|
||||
if (canonicalPath == fi.canonicalFilePath()) {
|
||||
if (checkCanonical == MatchCanonical)
|
||||
if (checkCanonical == PathMatchMode::MatchCanonical)
|
||||
return v.second;
|
||||
bool samePath = (canonicalPath == QString::fromUtf8(filepath.c_str()));
|
||||
FC_WARN("Identical physical path '" << canonicalPath.toUtf8().constData() << "'\n"
|
||||
@@ -778,7 +778,7 @@ std::vector<Document*> Application::openDocuments(const std::vector<std::string>
|
||||
break;
|
||||
_pendingDocs = std::move(_pendingDocsReopen);
|
||||
_pendingDocsReopen.clear();
|
||||
for(auto &file : _pendingDocs) {
|
||||
for(const auto &file : _pendingDocs) {
|
||||
auto doc = getDocumentByPath(file.c_str());
|
||||
if(doc)
|
||||
closeDocument(doc->getName());
|
||||
@@ -791,7 +791,7 @@ std::vector<Document*> Application::openDocuments(const std::vector<std::string>
|
||||
|
||||
std::vector<Document*> docs;
|
||||
docs.reserve(newDocs.size());
|
||||
for(auto &d : newDocs) {
|
||||
for(const auto &d : newDocs) {
|
||||
auto doc = d.getDocument();
|
||||
if(!doc)
|
||||
continue;
|
||||
@@ -843,7 +843,7 @@ std::vector<Document*> Application::openDocuments(const std::vector<std::string>
|
||||
seq.next();
|
||||
}
|
||||
// Close the document for reloading
|
||||
for(auto doc : docs)
|
||||
for(const auto doc : docs)
|
||||
closeDocument(doc->getName());
|
||||
|
||||
}while(!_pendingDocs.empty());
|
||||
@@ -883,7 +883,7 @@ Document* Application::openDocumentPrivate(const char * FileName,
|
||||
}
|
||||
|
||||
// Before creating a new document we check whether the document is already open
|
||||
auto doc = getDocumentByPath(File.filePath().c_str(), MatchCanonicalWarning);
|
||||
auto doc = getDocumentByPath(File.filePath().c_str(), PathMatchMode::MatchCanonicalWarning);
|
||||
if(doc) {
|
||||
if(doc->testStatus(App::Document::PartialDoc)
|
||||
|| doc->testStatus(App::Document::PartialRestore)) {
|
||||
@@ -897,7 +897,7 @@ Document* Application::openDocumentPrivate(const char * FileName,
|
||||
doc = nullptr;
|
||||
} else if(_allowPartial) {
|
||||
bool reopen = false;
|
||||
for(auto &name : objNames) {
|
||||
for(const auto &name : objNames) {
|
||||
auto obj = doc->getObject(name.c_str());
|
||||
if(!obj || obj->testStatus(App::PartialObject)) {
|
||||
reopen = true;
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
App::Document* getDocument(const char *Name) const;
|
||||
|
||||
/// Path matching mode for getDocumentByPath()
|
||||
enum PathMatchMode {
|
||||
enum class PathMatchMode {
|
||||
/// Match by resolving to absolute file path
|
||||
MatchAbsolute = 0,
|
||||
/** Match by absolute path first. If not found then match by resolving
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
* @return Return the document found by matching with the given path
|
||||
*/
|
||||
App::Document* getDocumentByPath(const char *path,
|
||||
PathMatchMode checkCanonical = MatchAbsolute) const;
|
||||
PathMatchMode checkCanonical = PathMatchMode::MatchAbsolute) const;
|
||||
|
||||
/// gets the (internal) name of the document
|
||||
const char * getDocumentName(const App::Document* ) const;
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
AllowPartialRecompute = 8, // allow recomputing editing object if SkipRecompute is set
|
||||
TempDoc = 9, // Mark as temporary document without prompt for save
|
||||
RestoreError = 10,
|
||||
LinkStampChanged = 11, // Indicates during restore time if any linked document's time stamp has changed
|
||||
LinkStampChanged = 11, // Indicates during restore time if any linked document's time stamp has changed
|
||||
};
|
||||
|
||||
/** @name Properties */
|
||||
|
||||
@@ -197,7 +197,7 @@ void ViewProviderDocumentObject::onChanged(const App::Property* prop)
|
||||
// modified then it must be be reversed.
|
||||
if (!testStatus(Gui::ViewStatus::TouchDocument)) {
|
||||
// Note: reverting document modified status like that is not
|
||||
// appropreiate because we can't tell if there is any other
|
||||
// appropriate because we can't tell if there is any other
|
||||
// property being changed due to the change of Visibility here.
|
||||
// Temporary setting the Visibility property as 'NoModify' is
|
||||
// the proper way.
|
||||
|
||||
@@ -399,7 +399,7 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
|
||||
updateVisual();
|
||||
// updateVisual() may not be triggered by any change (e.g.
|
||||
// triggered by an external object through forceUpdate()). And
|
||||
// since DiffuseColor is not changed here either, do not falsly set
|
||||
// since DiffuseColor is not changed here either, do not falsely set
|
||||
// the document modified status
|
||||
Base::ObjectStatusLocker<App::Property::Status,App::Property> guard(
|
||||
App::Property::NoModify, &DiffuseColor);
|
||||
|
||||
Reference in New Issue
Block a user