WSL/SLF GitLab Repository

ApplicationsView.h 1.87 KB
Newer Older
Mathias Bavay's avatar
Mathias Bavay committed
1
//SPDX-License-Identifier: GPL-3.0-or-later
2
3
4
5
6
/*****************************************************************************/
/*  Copyright 2019 WSL Institute for Snow and Avalanche Research  SLF-DAVOS  */
/*****************************************************************************/
/* This file is part of INIshell.
   INIshell is free software: you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
9
10
11
12
13
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   INIshell is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15

16
17
   You should have received a copy of the GNU General Public License
   along with INIshell.  If not, see <http://www.gnu.org/licenses/>.
18
19
20
21
22
23
24
*/

/*
 * This panel displays a list of applications or simulations that are read from XML.
 * 2019-11
 */

25
26
27
#ifndef APPLICATIONSVIEW_H
#define APPLICATIONSVIEW_H

Michael Reisecker's avatar
Michael Reisecker committed
28
29
#include <QDir>
#include <QFile>
30
#include <QListWidget>
31
32
#include <QMenu>
#include <QPoint>
33
#include <QString>
34
35
36
37
38
39
#include <QWidget>

class ApplicationsView : public QWidget {
	Q_OBJECT

	public:
40
		explicit ApplicationsView(QString tag_name, QWidget *parent = nullptr);
41
42
43
44
		void addApplication(const QFile &file, const QRegularExpressionMatch &match_inishell);
		void addInfoSeparator(const QString &text, const int &index);
		void clear() { application_list_->clear(); }
		int count() const { return application_list_->count(); }
45
46

	private:
47
		void createContextMenu();
Michael Reisecker's avatar
Michael Reisecker committed
48

49
		QListWidget *application_list_ = nullptr;
50
		QMenu list_context_menu_;
51
		QString tag_name_;
52
53
54

	private slots:
		void onListDoubleClick(QListWidgetItem *item);
55
		void showListContextMenu(const QPoint &coords);
56
57
58
};

#endif //APPLICATIONSVIEW_H