OpenMS
InputFileList.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2023.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Chris Bielow $
32 // $Authors: Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39 
40 #include <QWidget>
41 
42 namespace Ui
43 {
44  class InputFileList;
45 }
46 
47 namespace OpenMS
48 {
49  namespace Internal
50  {
56  class InputFileList : public QWidget
57  {
58  Q_OBJECT
59 
60  public:
62  explicit InputFileList(QWidget* parent = nullptr);
65  void dragEnterEvent(QDragEnterEvent* e) override;
67  void dropEvent(QDropEvent* e) override;
68  void dragMoveEvent(QDragMoveEvent* pEvent) override;
69 
71  void getFilenames(QStringList& files) const;
75  void setFilenames(const QStringList& files);
76 
78  const QString& getCWD() const;
80  void setCWD(const QString& cwd, bool force = false);
81 
83  void keyPressEvent(QKeyEvent* e) override;
84 
85  public slots:
86 
92  void removeAll();
95 
96  signals:
98  void updatedCWD(QString new_cwd);
99 
100  protected:
102  void addFiles_(const QStringList& files);
103 
105  void updateCWD_();
106 
107 
108  QString cwd_;
109 
110  private:
112  };
113  } // ns Internal
114 } // ns OpenMS
115 
116 // this is required to allow parent widgets (auto UIC'd from .ui) to have a InputFileList member
OpenMS::Internal::InputFileList InputFileList
Definition: InputFileList.h:117
A widget shows a list of input files (i.e. existing files on a mounted drive), which allows adding/re...
Definition: InputFileList.h:57
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:108
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:111
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:70
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
Definition: FLASHDeconvWizardBase.h:63