OpenMS  2.7.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LayerAnnotatorBase Class Referenceabstract

#include <OpenMS/VISUAL/LayerData.h>

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

Public Member Functions

 LayerAnnotatorBase (const FileTypes::FileTypeList &supported_types, const String &file_dialog_text, QWidget *gui_lock)
 C'tor with params. More...
 
bool annotateWithFileDialog (LayerData &layer, LogWindow &log, const String &current_path) const
 
bool annotateWithFilename (LayerData &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). Filetype is queried from filename More...
 

Protected Member Functions

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

Protected Attributes

const FileTypes::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 @hint Add new derived classes to getAnnotatorWhichSupports() to enable automatic annotation in TOPPView

Constructor & Destructor Documentation

◆ LayerAnnotatorBase()

LayerAnnotatorBase ( const FileTypes::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

Member Function Documentation

◆ annotateWithFileDialog()

bool annotateWithFileDialog ( LayerData 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 filetype 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 ( LayerData layer,
LogWindow log,
const String filename 
) const

Annotates a layer, given a filename from which to load the data. The filetype 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_ ( LayerData 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 filetype. 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

see getAnnotatorWhichSupports(const FileTypes::Type& type). Filetype is queried from filename

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 FileTypes::FileTypeList supported_types_
protected