OpenMS
InputFileList Class Reference

A widget shows a list of input files (i.e. existing files on a mounted drive), which allows adding/removing files and supports drag'n'drop from the window manager. More...

#include <OpenMS/VISUAL/InputFileList.h>

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

Public Slots

void showFileDialog ()
 Lets the user select files via a file dialog. More...
 
void removeSelected ()
 Removes all currently selected files from the list. More...
 
void removeAll ()
 Removes all files from the list. More...
 
void editCurrentItem ()
 Shows a TOPPASInputFileDialog which edits the current item. More...
 

Signals

void updatedCWD (QString new_cwd)
 emitted when a new file is added (by drag'n'drop or 'Add..' button) More...
 

Public Member Functions

 InputFileList (QWidget *parent=nullptr)
 C'tor. More...
 
 ~InputFileList ()
 
void dragEnterEvent (QDragEnterEvent *e) override
 support drag'n'drop of files from OS window manager More...
 
void dropEvent (QDropEvent *e) override
 support drag'n'drop of files from OS window manager More...
 
void dragMoveEvent (QDragMoveEvent *pEvent) override
 
void getFilenames (QStringList &files) const
 Stores the list of all filenames in the list widget in files. More...
 
StringList getFilenames () const
 Stores the list of all filenames in the list widget in files. More...
 
void setFilenames (const QStringList &files)
 Set the list of all filenames in the list widget. More...
 
const QString & getCWD () const
 get the CWD (according to most recently added file) More...
 
void setCWD (const QString &cwd, bool force=false)
 set the current working directory (for opening files), but only if the current input list is not already populated. Use force to set the CWD in any case. More...
 
void keyPressEvent (QKeyEvent *e) override
 support Ctrl+C to copy currently selected items to clipboard More...
 

Protected Member Functions

void addFiles_ (const QStringList &files)
 add files to the list, and update 'cwd_' by using the path of the last filename More...
 
void updateCWD_ ()
 updates the CWD, based on the last file in the current list More...
 

Protected Attributes

QString cwd_
 current working dir, i.e. the last position a file was added from More...
 

Private Attributes

Ui::InputFileListui_
 

Detailed Description

A widget shows a list of input files (i.e. existing files on a mounted drive), which allows adding/removing files and supports drag'n'drop from the window manager.

Constructor & Destructor Documentation

◆ InputFileList()

InputFileList ( QWidget parent = nullptr)
explicit

C'tor.

◆ ~InputFileList()

Member Function Documentation

◆ addFiles_()

void addFiles_ ( const QStringList &  files)
protected

add files to the list, and update 'cwd_' by using the path of the last filename

◆ dragEnterEvent()

void dragEnterEvent ( QDragEnterEvent *  e)
override

support drag'n'drop of files from OS window manager

◆ dragMoveEvent()

void dragMoveEvent ( QDragMoveEvent *  pEvent)
override

◆ dropEvent()

void dropEvent ( QDropEvent *  e)
override

support drag'n'drop of files from OS window manager

◆ editCurrentItem

void editCurrentItem ( )
slot

Shows a TOPPASInputFileDialog which edits the current item.

◆ getCWD()

const QString& getCWD ( ) const

get the CWD (according to most recently added file)

◆ getFilenames() [1/2]

StringList getFilenames ( ) const

Stores the list of all filenames in the list widget in files.

◆ getFilenames() [2/2]

void getFilenames ( QStringList &  files) const

Stores the list of all filenames in the list widget in files.

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  e)
override

support Ctrl+C to copy currently selected items to clipboard

◆ removeAll

void removeAll ( )
slot

Removes all files from the list.

◆ removeSelected

void removeSelected ( )
slot

Removes all currently selected files from the list.

◆ setCWD()

void setCWD ( const QString &  cwd,
bool  force = false 
)

set the current working directory (for opening files), but only if the current input list is not already populated. Use force to set the CWD in any case.

◆ setFilenames()

void setFilenames ( const QStringList &  files)

Set the list of all filenames in the list widget.

◆ showFileDialog

void showFileDialog ( )
slot

Lets the user select files via a file dialog.

◆ updateCWD_()

void updateCWD_ ( )
protected

updates the CWD, based on the last file in the current list

◆ updatedCWD

void updatedCWD ( QString  new_cwd)
signal

emitted when a new file is added (by drag'n'drop or 'Add..' button)

Member Data Documentation

◆ cwd_

QString cwd_
protected

current working dir, i.e. the last position a file was added from

◆ ui_

Ui::InputFileList* ui_
private