Commit 880ff482 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Added clearComment/clearAllComments functions to base object. Added...

Added clearComment/clearAllComments functions to base object. Added corresponding slots to core. Added slotSetView() to core.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16206 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b9b8b43e
......@@ -1682,6 +1682,47 @@ void Core::deleteObject( int _id ){
}
void Core::setObjectComment(int _id, QString key, QString comment) {
if ( _id == -1 ) return;
BaseObject* object = objectRoot_->childExists(_id);
if (!object || object == objectRoot_) {
std::cerr << "No such object." << std::endl;
return;
}
object->getCommentByKey(key) = comment;
}
void Core::clearObjectComment(int _id, QString key) {
if ( _id == -1 ) return;
BaseObject* object = objectRoot_->childExists(_id);
if (!object || object == objectRoot_) {
std::cerr << "No such object." << std::endl;
return;
}
object->clearComment(key);
}
void Core::clearAllComments(int _id) {
if ( _id == -1 ) return;
BaseObject* object = objectRoot_->childExists(_id);
if (!object || object == objectRoot_) {
std::cerr << "No such object." << std::endl;
return;
}
object->clearAllComments();
}
void Core::slotDeleteAllObjects( ){
// Remember ids
......
......@@ -645,6 +645,10 @@ public slots:
/// Called to delete an object
void deleteObject( int _id );
void setObjectComment(int objId, QString key, QString comment);
void clearObjectComment(int objId, QString key);
void clearAllComments(int objId);
/// set fullscreen mode
void fullscreen( bool _state );
......@@ -716,6 +720,8 @@ public slots:
/// Unblock the scenegraph updates
void unblockSceneGraphUpdates();
void setView(QString view);
//===========================================================================
/** @name Scripting functions for controlling view modes
* @{ */
......
......@@ -333,6 +333,9 @@ void Core::unblockSceneGraphUpdates() {
OpenFlipper::Options::unblockSceneGraphUpdates();
}
void Core::setView(QString view) {
coreWidget_->slotSetView(view);
}
//=============================================================================
//== Script Special Functions =================================================
......
......@@ -552,6 +552,14 @@ class DLLEXPORTONLY BaseObject : public QObject {
return !commentsByKey_.empty();
}
void clearComment(const QString &key) {
commentsByKey_.remove(key);
}
void clearAllComments() {
commentsByKey_.clear();
}
/** Returns a reference to all comments. */
const QMap<QString, QString> &getAllComments() const {
return commentsByKey_;
......
......@@ -908,6 +908,9 @@ public:
/// Paste the view, the window and toolbox size to the last active examiner
void slotPasteViewAndWindow( );
/// Set the supplied serialized view
void slotSetView( QString view );
/// Copy view from the last active examiner
void slotCopyView( );
......
......@@ -867,6 +867,10 @@ void CoreWidget::slotPasteView( ) {
examiner_widgets_[PluginFunctions::activeExaminer()]->actionPasteView();
}
void CoreWidget::slotSetView( QString view ) {
examiner_widgets_[PluginFunctions::activeExaminer()]->actionSetView(view);
}
void CoreWidget::slotPasteViewAndWindow()
{
QSize size;
......
......@@ -1138,6 +1138,9 @@ void glViewer::actionPasteView(QSize * _windowSize /*= NULL*/, int *_splitterWid
decodeView(view,_windowSize,_splitterWidth);
}
void glViewer::actionSetView(QString view) {
decodeView(view, 0, 0);
}
//-----------------------------------------------------------------------------
......@@ -2050,7 +2053,17 @@ void glViewer::snapshot( int _width, int _height, bool _alpha, bool _hideCoordsy
// Capture image
snapshot(image, _width, _height, _alpha, _hideCoordsys, samples);
/*
* Meta data
*/
QString comments = PluginFunctions::collectObjectComments(true, false).join("\n");
if (!comments.isEmpty())
image.setText("Mesh Comments", comments);
QString view;
encodeView(view);
image.setText("View", view);
QFileInfo fi(properties_.snapshotName());
QString fname = fi.path() + QDir::separator() +fi.baseName() + "." + QString::number(properties_.snapshotCounter()).rightJustified(7,'0') + "." + properties_.snapshotFileType().toLower();
......
......@@ -366,6 +366,8 @@ public slots:
*/
void actionCopyView(const QSize &_windowSize = QSize(-1,-1), const int _splitterWidth = -1);
void actionSetView(QString view);
//-------------------------------------------------------------- public signals
signals:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment