OpenMS
LayerAnnotatorBase Class Referenceabstract

#include <OpenMS/VISUAL/LayerDataBase.h>

Inheritance diagram for LayerAnnotatorBase:
[legend]
Collaboration diagram for LayerAnnotatorBase:
[legend]

Public Member Functions

 LayerAnnotatorBase (const FileTypeList &supported_types, const String &file_dialog_text, QWidget *gui_lock)
 C'tor with params. More...
 
virtual ~LayerAnnotatorBase ()=default
 Make D'tor virtual for correct destruction from pointers to base. More...
 
bool annotateWithFileDialog (LayerDataBase &layer, LogWindow &log, const String &current_path) const
 
bool annotateWithFilename (LayerDataBase &layer, LogWindow &log, const String &filename) const
 

Static Public Member Functions

static std::unique_ptr< LayerAnnotatorBasegetAnnotatorWhichSupports (const FileTypes::Type &type)
 
static std::unique_ptr< LayerAnnotatorBasegetAnnotatorWhichSupports (const String &filename)
 see getAnnotatorWhichSupports(const FileTypes::Type& type). File type is queried from filename More...
 

Protected Member Functions

virtual bool annotateWorker_ (LayerDataBase &layer, const String &filename, LogWindow &log) const =0
 

Protected Attributes

const FileTypeList supported_types_
 
const String file_dialog_text_
 
QWidgetgui_lock_ = nullptr
 optional widget which will be locked when calling annotateWorker_() in child-classes More...
 

Detailed Description

A base class to annotate layers of specific types with (identification) data

Note
Add new derived classes to getAnnotatorWhichSupports() to enable automatic annotation in TOPPView

Constructor & Destructor Documentation

◆ LayerAnnotatorBase()

LayerAnnotatorBase ( const FileTypeList supported_types,
const String file_dialog_text,
QWidget gui_lock 
)

C'tor with params.

Parameters
supported_typesWhich identification data types are allowed to be opened by the user in annotate()
file_dialog_textThe header text of the file dialog shown to the user
gui_lockOptional GUI element which will be locked (disabled) during call to 'annotateWorker_'; can be null_ptr

◆ ~LayerAnnotatorBase()

virtual ~LayerAnnotatorBase ( )
virtualdefault

Make D'tor virtual for correct destruction from pointers to base.

Member Function Documentation

◆ annotateWithFileDialog()

bool annotateWithFileDialog ( LayerDataBase layer,
LogWindow log,
const String current_path 
) const

Annotates a layer, writing messages to log and showing QMessageBoxes on errors. The input file is selected via a file-dialog which is opened with current_path as initial path. The file type is checked to be one of the supported_types_ before the annotateWorker_ function is called as implemented by the derived classes

Referenced by TOPPViewBase::annotateWithAMS(), TOPPViewBase::annotateWithID(), and TOPPViewBase::annotateWithOSW().

◆ annotateWithFilename()

bool annotateWithFilename ( LayerDataBase layer,
LogWindow log,
const String filename 
) const

Annotates a layer, given a filename from which to load the data. The file type is checked to be one of the supported_types_ before the annotateWorker_ function is called as implemented by the derived classes

◆ annotateWorker_()

virtual bool annotateWorker_ ( LayerDataBase layer,
const String filename,
LogWindow log 
) const
protectedpure virtual

abstract virtual worker function to annotate a layer using content from the filename returns true on success

Implemented in LayerAnnotatorOSW, LayerAnnotatorAMS, and LayerAnnotatorPeptideID.

◆ getAnnotatorWhichSupports() [1/2]

static std::unique_ptr<LayerAnnotatorBase> getAnnotatorWhichSupports ( const FileTypes::Type type)
static

get a derived annotator class, which supports annotation of the given file type. If multiple class support this type (currently not the case) an Exception::IllegalSelfOperation will be thrown If NO class supports this type, the unique_ptr points to nothing (.get() == nullptr).

Referenced by TOPPViewBase::loadFiles().

◆ getAnnotatorWhichSupports() [2/2]

static std::unique_ptr<LayerAnnotatorBase> getAnnotatorWhichSupports ( const String filename)
static

Member Data Documentation

◆ file_dialog_text_

const String file_dialog_text_
protected

◆ gui_lock_

QWidget* gui_lock_ = nullptr
protected

optional widget which will be locked when calling annotateWorker_() in child-classes

◆ supported_types_

const FileTypeList supported_types_
protected