#pragma once

#include <QDialog>
#include <QLineEdit>
#include <QString>
#include <QPushButton>
#include <QFormLayout>
#include <QCheckBox>
#include <QLabel>

struct Record2;
#include "ui_addapp.h"

class AddApp : public QDialog
{
	Q_OBJECT

public:
	AddApp(bool isEdit = false, Record2 *orig_name_str=nullptr,QWidget* parent = nullptr);
	~AddApp();
	QString get_exe_path()
	{
		return path_str;
	}
	QString get_orig_name()
	{
		return orig_name_str;
	}
	QString get_name()
	{
		return name_str;
	}
	QString get_sort()
	{
		return sort_str;
	}
	bool *get_categories()
	{
		return categories;
	}
	bool changed = false;
private:
	Ui::AddAppClass ui;
	QFormLayout *form;
	bool *categories;
	QPushButton *path;
	QPushButton* submit_btn;
	QLineEdit *name;
	QLabel *name_label;
	QLineEdit *orig_name;
	QLineEdit *sort;
	QMap<int,QCheckBox*> categories_list;
	QString sort_str;
	QString name_str;
	QString orig_name_str;
	QString path_str;
	QVBoxLayout* layout_inner;
	bool isEdit;
private slots:
	void broswer_exe();
	void submit();
	
};
