Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef _CONTENT_HISTORY_H
Toshihiro Shimizu 890ddd
#define _CONTENT_HISTORY_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Campbell Barton d0e335
#include <qstring></qstring>
Campbell Barton d0e335
#include <qdatetime></qdatetime>
Toshihiro Shimizu 890ddd
#include <map></map>
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TNZCORE_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! this class keeps tracks of modification times on contents, as well as user
Shinya Kitaoka 120a6e
//! and machine info;
Shinya Kitaoka 120a6e
//! typically used for levels and scene files (or whatever you like...)
Toshihiro Shimizu 890ddd
// it is used for visualitation purposed only in the infoview, in example
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TContentHistory {
Shinya Kitaoka 120a6e
  bool m_isLevel;
Shinya Kitaoka 120a6e
  std::map<tframeid, qdatetime=""> m_records;</tframeid,>
Shinya Kitaoka 120a6e
  QString m_frozenHistory;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  const QString currentToString() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  //! set isLevel=true if you want to keep track of single-frames modifications
Shinya Kitaoka 120a6e
  TContentHistory(bool isLevel);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~TContentHistory();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TContentHistory *clone() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  //! history can come only from a deserialization
Shinya Kitaoka 120a6e
  //! WARNING! any preexistent history will be erased by calling this method
Shinya Kitaoka 120a6e
  void deserialize(const QString &history);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  //! the returned string is only for visualitation and serialization
Shinya Kitaoka 120a6e
  const QString serialize() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  //! after calling this method, following history info added will not "merge"
Shinya Kitaoka 120a6e
  //! with the history until now
Shinya Kitaoka 120a6e
  void fixCurrentHistory();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  //! do not call this 2 methods if isLevel==false! (assertion fails)
Shinya Kitaoka 120a6e
  void frameModifiedNow(const TFrameId &id) { frameRangeModifiedNow(id, id); }
Shinya Kitaoka 120a6e
  void frameRangeModifiedNow(const TFrameId &fromId, const TFrameId &toId);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  //! do not call this method if isLevel==true! (assertion fails)
Shinya Kitaoka 120a6e
  void modifiedNow();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif