OpenMS
InputFileList.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow $
6 // $Authors: Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
14 #include <QWidget>
15 
16 namespace Ui
17 {
18  class InputFileList;
19 }
20 
21 namespace OpenMS
22 {
23  namespace Internal
24  {
30  class InputFileList : public QWidget
31  {
32  Q_OBJECT
33 
34  public:
36  explicit InputFileList(QWidget* parent = nullptr);
39  void dragEnterEvent(QDragEnterEvent* e) override;
41  void dropEvent(QDropEvent* e) override;
42  void dragMoveEvent(QDragMoveEvent* pEvent) override;
43 
45  void getFilenames(QStringList& files) const;
49  void setFilenames(const QStringList& files);
50 
52  const QString& getCWD() const;
54  void setCWD(const QString& cwd, bool force = false);
55 
57  void keyPressEvent(QKeyEvent* e) override;
58 
59  public slots:
60 
66  void removeAll();
69 
70  signals:
72  void updatedCWD(QString new_cwd);
73 
74  protected:
76  void addFiles_(const QStringList& files);
77 
79  void updateCWD_();
80 
81 
82  QString cwd_;
83 
84  private:
86  };
87  } // ns Internal
88 } // ns OpenMS
89 
90 // this is required to allow parent widgets (auto UIC'd from .ui) to have a InputFileList member
OpenMS::Internal::InputFileList InputFileList
Definition: InputFileList.h:91
A widget shows a list of input files (i.e. existing files on a mounted drive), which allows adding/re...
Definition: InputFileList.h:31
void dropEvent(QDropEvent *e) override
support drag'n'drop of files from OS window manager
void editCurrentItem()
Shows a TOPPASInputFileDialog which edits the current item.
void getFilenames(QStringList &files) const
Stores the list of all filenames in the list widget in files.
void dragEnterEvent(QDragEnterEvent *e) override
support drag'n'drop of files from OS window manager
void keyPressEvent(QKeyEvent *e) override
support Ctrl+C to copy currently selected items to clipboard
void setFilenames(const QStringList &files)
Set the list of all filenames in the list widget.
InputFileList(QWidget *parent=nullptr)
C'tor.
void updateCWD_()
updates the CWD, based on the last file in the current list
void addFiles_(const QStringList &files)
add files to the list, and update 'cwd_' by using the path of the last filename
void updatedCWD(QString new_cwd)
emitted when a new file is added (by drag'n'drop or 'Add..' button)
void removeAll()
Removes all files from the list.
void showFileDialog()
Lets the user select files via a file dialog.
QString cwd_
current working dir, i.e. the last position a file was added from
Definition: InputFileList.h:82
const QString & getCWD() const
get the CWD (according to most recently added file)
StringList getFilenames() const
Stores the list of all filenames in the list widget in files.
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 alre...
Ui::InputFileList * ui_
Definition: InputFileList.h:85
void dragMoveEvent(QDragMoveEvent *pEvent) override
void removeSelected()
Removes all currently selected files from the list.
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Definition: FLASHDeconvWizardBase.h:37