qtplatz data editor startup walkthrough — debugging tip
qtplatz data editor is based on qt-creator framework. When user select "File" -> "Open" and select a file, it goes to EditorManager::openEditor() method defined in src/plugins/coreplugin/edtormanager.cpp
EditorManager::openEditor() method is trying to create corresponding editor using EditorManager::createEditor() method. This method look for appropriate editor from file extension using internal mime database that will discuss later in this section.
You can add debug trace message by changing debugEditorManager enumeration defined in editormanager.cpp set to non zero value.
Datafile plugin owns DataprocessorFactory object, wich is the factory for a data processor. Each data processor is responsible to access and modify an opned data file.
Dataprocessor::open( const QString& ) is the entry point for opening data file as read only. This method immediately invokes adcontrols::datafile::open( const std::wstring&, bool )
and then
adcontrols::datafileBrokerImpl::open( const std::wstring&, bool)
is trying all library registered datafile_factoy.
Each plugin shared library (dll) should implement an entry "datafile_factory" that returns your own implementation of "datafile" object.
Register memetype in dataproc-mimetype.xml
Add something like following xml snippet into dataproc-mimetype.xml in Dataproc plugin project source code.
<mime-type type="application/text.dataset> <sub-class-of type="application/octet-stream"/> <comment>Spectrum file</comment> <glob pattern=*.txt"/> </mime-type>
You should use appropriate extension instead of .txt above. After rebuild dataproc plugin library, your own
datafile_factory::access( const std::wstring& )
will be invoked when open a file.
CAUTION: You must use type="application/octet-stream" even your file is ascii text. Set type="plain/text" will come to text editor used to implemented in Core plugin but is disabled.