modify file changes to ui
This commit is contained in:
parent
252db1fc9f
commit
ddd69461dd
@ -14,15 +14,18 @@
|
||||
|
||||
QWorkspaceAttribute::QWorkspaceAttribute(class WorkSpace* workspace)
|
||||
: workspace_(workspace) {
|
||||
|
||||
if (workspace_) {
|
||||
filesSeq_ = workspace_->GetFilesSeq();
|
||||
}
|
||||
}
|
||||
|
||||
bool QWorkspaceAttribute::operator==(const QWorkspaceAttribute& other) {
|
||||
return workspace_ == other.workspace_;
|
||||
return workspace_ == other.workspace_ && filesSeq_ == other.filesSeq_;
|
||||
}
|
||||
|
||||
QWorkspaceAttribute& QWorkspaceAttribute::operator=(const QWorkspaceAttribute& other) {
|
||||
workspace_ = other.workspace_;
|
||||
filesSeq_ = other.filesSeq_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
#include <osg/Vec3>
|
||||
#include "workspace/FileEntry.h"
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
class QWorkspaceAttribute {
|
||||
public:
|
||||
@ -86,6 +87,8 @@ public:
|
||||
QString GetFileEntryAbsPath(FileEntryType type, int index) const;
|
||||
private:
|
||||
class WorkSpace* workspace_{ nullptr };
|
||||
// Snapshot of workspace files change sequence to detect mutations
|
||||
std::uint64_t filesSeq_{ 0 };
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -134,6 +134,7 @@ WorkSpace::FileEntryResult WorkSpace::CreateFileEntry(FileEntryType type) {
|
||||
}
|
||||
// push a placeholder; actual filename may be set elsewhere via SetWavePath/SetRDPath/etc
|
||||
vec.push_back(FileEntry{ type, QString() });
|
||||
++filesSeq_;
|
||||
// Notify listeners (e.g., PropertyBrowser) to refresh workspace properties
|
||||
emit FilesChanged(type);
|
||||
return FileEntryResult::Ok;
|
||||
@ -154,6 +155,7 @@ bool WorkSpace::SetFileEntryCount(FileEntryType type, int count) {
|
||||
} else {
|
||||
vec.resize(count);
|
||||
}
|
||||
++filesSeq_;
|
||||
emit FilesChanged(type);
|
||||
return true;
|
||||
}
|
||||
@ -177,6 +179,7 @@ bool WorkSpace::SetFileEntryPath(FileEntryType type, int index, const QString& p
|
||||
return false;
|
||||
}
|
||||
vec[index].fileName = fileInfo.fileName();
|
||||
++filesSeq_;
|
||||
emit FilesChanged(type);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <cstdint>
|
||||
#include <QObject>
|
||||
|
||||
#include <osgEarth/Viewpoint>
|
||||
@ -162,13 +163,17 @@ private:
|
||||
osgEarth::Viewpoint homeViewpoint_;
|
||||
|
||||
bool leaded_{ false };
|
||||
std::vector<class Entity*> entities_;
|
||||
OEScene* scene_{ nullptr };
|
||||
class Timestep* timestep_{ nullptr };
|
||||
class LampStatus* lampStatus_{ nullptr };
|
||||
class Entity* trackedEntity_{ nullptr };
|
||||
std::vector<class Entity*> entities_;
|
||||
OEScene* scene_{ nullptr };
|
||||
class Timestep* timestep_{ nullptr };
|
||||
class LampStatus* lampStatus_{ nullptr };
|
||||
class Entity* trackedEntity_{ nullptr };
|
||||
// Stored as file entries under workspace dir, keyed by type
|
||||
std::map<FileEntryType, std::vector<FileEntry>> files_;
|
||||
// Monotonic sequence for file entries changes, used to trigger UI refresh
|
||||
std::uint64_t filesSeq_{ 0 };
|
||||
public:
|
||||
std::uint64_t GetFilesSeq() const { return filesSeq_; }
|
||||
friend class WorkSpaceXMLWrite;
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user