2018-08-17 11:27:07 +00:00
|
|
|
#ifndef EDITMETHODDIALOG_H
|
|
|
|
#define EDITMETHODDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2019-02-02 10:59:58 +00:00
|
|
|
#include <QComboBox>
|
|
|
|
|
2018-08-17 11:27:07 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "Cutter.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class EditMethodDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
class EditMethodDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2019-02-02 13:14:39 +00:00
|
|
|
/*!
|
|
|
|
* \param classFixed whether the user should be able to change the class. If false, a QComboBox will be shown, otherwise a plain QLabel.
|
|
|
|
*/
|
2019-02-02 10:59:58 +00:00
|
|
|
explicit EditMethodDialog(bool classFixed, QWidget *parent = nullptr);
|
2018-08-17 11:27:07 +00:00
|
|
|
~EditMethodDialog();
|
|
|
|
|
|
|
|
void setClass(const QString &className);
|
2019-02-01 20:40:34 +00:00
|
|
|
void setMethod(const AnalMethodDescription &desc);
|
2018-08-17 11:27:07 +00:00
|
|
|
|
|
|
|
QString getClass();
|
2019-02-01 20:40:34 +00:00
|
|
|
AnalMethodDescription getMethod();
|
2018-08-17 11:27:07 +00:00
|
|
|
|
2019-02-02 13:14:39 +00:00
|
|
|
/*!
|
|
|
|
* \brief Helper function to display the dialog
|
|
|
|
*
|
|
|
|
* \param title title of the dialog
|
|
|
|
* \param classFixed whether the user should be able to change the class
|
|
|
|
* \param className initial class name, will be overwritten if the user changed the class
|
|
|
|
* \param desc initial data for the method information
|
|
|
|
* \return whether the dialog was accepted by the user
|
|
|
|
*/
|
|
|
|
static bool showDialog(const QString &title, bool classFixed, QString *className, AnalMethodDescription *desc, QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Show the dialog to add a new method a given class
|
|
|
|
*/
|
2019-02-01 20:40:34 +00:00
|
|
|
static void newMethod(QString className = nullptr, const QString &meth = QString(), QWidget *parent = nullptr);
|
2019-02-02 13:14:39 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Show the dialog to edit a given method of a given class
|
|
|
|
*/
|
2019-02-01 20:40:34 +00:00
|
|
|
static void editMethod(const QString &className, const QString &meth, QWidget *parent = nullptr);
|
2018-08-17 11:27:07 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_buttonBox_accepted();
|
|
|
|
void on_buttonBox_rejected();
|
|
|
|
|
|
|
|
void updateVirtualUI();
|
|
|
|
void validateInput();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Ui::EditMethodDialog> ui;
|
|
|
|
|
2019-02-02 10:59:58 +00:00
|
|
|
QComboBox *classComboBox = nullptr;
|
|
|
|
QLabel *classLabel = nullptr;
|
2019-02-02 13:14:39 +00:00
|
|
|
/*!
|
|
|
|
* This will only be used when the dialog was created with classFixed = true in order to remember the class name.
|
|
|
|
*/
|
2019-02-02 10:59:58 +00:00
|
|
|
QString fixedClass;
|
|
|
|
|
2018-08-17 11:27:07 +00:00
|
|
|
bool inputValid();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITMETHODDIALOG_H
|