mupp 1.1.0
Loading...
Searching...
No Matches
PVarDialog.h
Go to the documentation of this file.
1/***************************************************************************
2
3 PVarDialog.h
4
5 Author: Andreas Suter
6 e-mail: andreas.suter@psi.ch
7
8***************************************************************************/
9
10/***************************************************************************
11 * Copyright (C) 2007-2026 by Andreas Suter *
12 * andreas.suter@psi.ch *
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program; if not, write to the *
26 * Free Software Foundation, Inc., *
27 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
28 ***************************************************************************/
29
30#ifndef _PVARDIALOG_H_
31#define _PVARDIALOG_H_
32
33#include <memory>
34
35#include <QDialog>
36#include <QPushButton>
37#include <QPlainTextEdit>
38#include <QListWidget>
39#include <QVector>
40
41//-----------------------------------------------------------------------------
50{
51 QString fCollName;
52 QStringList fVarName;
53};
54
55//-----------------------------------------------------------------------------
63class PShowVarNameDialog : public QDialog
64{
65 Q_OBJECT
66
67 public:
73};
74
75//-----------------------------------------------------------------------------
92class PVarDialog : public QDialog
93{
94 Q_OBJECT
95
96 public:
104 PVarDialog(QVector<PCollInfo> collection_list, bool darkTheme,
105 QWidget *parent = nullptr,
106 Qt::WindowFlags f = Qt::WindowFlags());
107
108 private:
109 std::unique_ptr<QPlainTextEdit> fVarEdit;
110 std::unique_ptr<QListWidget> fCollectionView;
111 std::unique_ptr<QPushButton> fCancel;
112 std::unique_ptr<QPushButton> fAdd;
113 std::unique_ptr<QPushButton> fCheck;
114 std::unique_ptr<QPushButton> fHelp;
115 std::unique_ptr<QPushButton> fShowVarName;
116
117 QVector<PCollInfo> fCollList;
118
123 bool basic_check();
124
134
141 QStringList collectVarNames(QStringList &list, bool& ok);
142
152 bool hasErrorDef(QStringList &varNames, QString& name);
153
154 private slots:
158 void check();
159
163 void add();
164
168 void help();
169
173 void showVarNames();
174
175 signals:
181 void check_request(QString varStr, QVector<int> idx);
182
188 void add_request(QString varStr, QVector<int> idx);
189};
190
191#endif // _PVARDIALOG_H_
PShowVarNameDialog(PCollInfo &info)
Constructor for PShowVarNameDialog.
void check()
Slot to validate variable definitions and emit check_request signal.
bool basic_check()
Performs basic validation checks on variable definitions.
void add()
Slot to validate and add variable definitions, emitting add_request signal.
QVector< PCollInfo > fCollList
vector holding all collection information
Definition PVarDialog.h:117
QStringList collectVarNames(QStringList &list, bool &ok)
Collects all variable names from a tokenized string list.
void showVarNames()
Slot to show a dialog displaying variable names from the selected collection.
void help()
Slot to display help information about variable syntax.
std::unique_ptr< QPushButton > fCheck
check button to validate variable definitions
Definition PVarDialog.h:113
std::unique_ptr< QPushButton > fAdd
add button to add variables to mupp GUI
Definition PVarDialog.h:112
std::unique_ptr< QPushButton > fShowVarName
button to show variable names from selected collection
Definition PVarDialog.h:115
std::unique_ptr< QListWidget > fCollectionView
list widget displaying available collections
Definition PVarDialog.h:110
bool hasErrorDef(QStringList &varNames, QString &name)
Checks that each variable has a corresponding error definition.
void add_request(QString varStr, QVector< int > idx)
Signal emitted when user requests to add variable definitions.
std::unique_ptr< QPushButton > fCancel
cancel button to reject the dialog
Definition PVarDialog.h:111
std::unique_ptr< QPushButton > fHelp
help button to display syntax information
Definition PVarDialog.h:114
void check_request(QString varStr, QVector< int > idx)
Signal emitted when user requests to check variable definitions.
std::unique_ptr< QPlainTextEdit > fVarEdit
text editor for variable definitions
Definition PVarDialog.h:109
bool var_consistency_check()
Validates that all identifiers exist in selected collections.
PVarDialog(QVector< PCollInfo > collection_list, bool darkTheme, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Constructor for PVarDialog.
The PCollInfo struct holds collection information.
Definition PVarDialog.h:50
QStringList fVarName
variable names of the given collection
Definition PVarDialog.h:52
QString fCollName
collection name (may include path)
Definition PVarDialog.h:51