Example #1
0
/******************************************************************************
* This method is called when a reference target changes.
******************************************************************************/
bool FileSourceEditor::referenceEvent(RefTarget* source, ReferenceEvent* event)
{
	if(source == editObject()) {
		if(event->type() == ReferenceEvent::ObjectStatusChanged || event->type() == ReferenceEvent::TitleChanged) {
			updateInformationLabel();
		}
#if 0
		else if(event->type() == ReferenceEvent::ReferenceAdded || event->type() == ReferenceEvent::ReferenceRemoved) {
			ReferenceFieldEvent* refEvent = static_cast<ReferenceFieldEvent*>(event);
			if(refEvent->field() == PROPERTY_FIELD(FileSource::_dataObjects)) {
				DataObject* dataObj = dynamic_object_cast<DataObject>(event->type() == ReferenceEvent::ReferenceAdded ? refEvent->newTarget() : refEvent->oldTarget());
				if(dataObj) {
					if(event->type() == ReferenceEvent::ReferenceAdded) {
						// Open a new sub-editor.
						OORef<PropertiesEditor> subEditor = dataObj->createPropertiesEditor();
						if(subEditor) {
							subEditor->initialize(container(), mainWindow(), _subEditorRolloutParams);
							subEditor->setEditObject(dataObj);
							_subEditors.push_back(subEditor);
						}
					}
					else {
						// Close sub-editor.
						for(int i = (int)_subEditors.size() - 1; i >= 0; i--) {
							if(_subEditors[i]->editObject() == dataObj)
								_subEditors.erase(_subEditors.begin() + i);
						}
					}
				}
			}
		}
#endif
	}
	return PropertiesEditor::referenceEvent(source, event);
}
Example #2
0
/******************************************************************************
* Is called when a new object has been loaded into the editor.
******************************************************************************/
void FileSourceEditor::onEditorContentsReplaced(RefTarget* newObject)
{
	updateInformationLabel();

#if 0
	// Close old sub-editors.
	_subEditors.clear();
	if(newObject) {
		FileSource* obj = static_object_cast<FileSource>(newObject);
		// Open new sub-editors.
		for(DataObject* dataObj : obj->dataObjects()) {
			OORef<PropertiesEditor> subEditor = dataObj->createPropertiesEditor();
			if(subEditor) {
				subEditor->initialize(container(), mainWindow(), _subEditorRolloutParams);
				subEditor->setEditObject(dataObj);
				_subEditors.push_back(subEditor);
			}
		}
	}
#endif
}
Example #3
0
/******************************************************************************
* This is called when the user has changed the source URL.
******************************************************************************/
void FileSourceEditor::onWildcardPatternEntered()
{
	FileSource* obj = static_object_cast<FileSource>(editObject());
	OVITO_CHECK_OBJECT_POINTER(obj);

	undoableTransaction(tr("Change wildcard pattern"), [this, obj]() {
		if(!obj->importer())
			return;

		QString pattern = _wildcardPatternTextbox->text().trimmed();
		if(pattern.isEmpty())
			return;

		QUrl newUrl = obj->sourceUrl();
		QFileInfo fileInfo(newUrl.path());
		fileInfo.setFile(fileInfo.dir(), pattern);
		newUrl.setPath(fileInfo.filePath());
		if(!newUrl.isValid())
			throw Exception(tr("URL is not valid."));

		obj->setSource(newUrl, obj->importer());
	});
	updateInformationLabel();
}
Example #4
0
void FullScreenContent::slotPreferredMetaInfoKeyListChanged(const QStringList& list)
{
    GwenviewConfig::setFullScreenPreferredMetaInfoKeyList(list);
    GwenviewConfig::self()->save();
    updateInformationLabel();
}
Example #5
0
void FullScreenContent::updateCurrentUrlWidgets()
{
    updateInformationLabel();
    updateMetaInfoDialog();
}