2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2021-02-06 19:00:48 +01:00
|
|
|
Copyright 2006-2020 The QElectroTech Team
|
2007-12-01 10:47:15 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech 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
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2007-04-05 01:13:14 +00:00
|
|
|
#ifndef NEW_ELEMENT_WIZARD_H
|
|
|
|
#define NEW_ELEMENT_WIZARD_H
|
2016-05-14 17:10:03 +00:00
|
|
|
|
2020-12-08 19:57:35 +01:00
|
|
|
#include "ElementsCollection/elementslocation.h"
|
|
|
|
|
2016-05-14 17:10:03 +00:00
|
|
|
#include <QWizard>
|
|
|
|
|
2019-01-02 16:56:46 +00:00
|
|
|
class NameListWidget;
|
2009-04-03 19:30:25 +00:00
|
|
|
class QFileNameEdit;
|
2016-05-14 17:10:03 +00:00
|
|
|
class QTreeView;
|
2016-05-15 14:46:01 +00:00
|
|
|
class ElementsCollectionModel;
|
2016-05-14 17:10:03 +00:00
|
|
|
|
2007-04-04 02:13:14 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class provides a wizard dialog enabling users to to specify the basic
|
|
|
|
parameters of the electrical elements they intend to draw.
|
|
|
|
|
|
|
|
These parameters include:
|
|
|
|
- the category the element should be saved to
|
|
|
|
- the filename the element should be saved to
|
|
|
|
- localized names
|
2007-04-04 02:13:14 +00:00
|
|
|
*/
|
2016-05-15 14:46:01 +00:00
|
|
|
class NewElementWizard : public QWizard
|
|
|
|
{
|
2007-04-04 02:13:14 +00:00
|
|
|
Q_OBJECT
|
2007-04-12 03:13:13 +00:00
|
|
|
|
2016-05-15 14:46:01 +00:00
|
|
|
// constructors, destructor
|
2007-04-04 02:13:14 +00:00
|
|
|
public:
|
2020-06-09 23:06:31 +02:00
|
|
|
NewElementWizard(QWidget * = nullptr, Qt::WindowFlags = Qt::Widget);
|
2017-08-05 02:10:01 +00:00
|
|
|
~NewElementWizard() override;
|
2016-05-15 14:46:01 +00:00
|
|
|
|
|
|
|
void preselectedLocation(const ElementsLocation &location);
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
private:
|
2016-05-15 14:46:01 +00:00
|
|
|
NewElementWizard(const NewElementWizard &);
|
2007-04-04 02:13:14 +00:00
|
|
|
|
2016-05-15 14:46:01 +00:00
|
|
|
// attributes
|
2007-04-04 02:13:14 +00:00
|
|
|
private:
|
2016-05-15 14:46:01 +00:00
|
|
|
enum WizardState { Category, Filename, Names };
|
|
|
|
QFileNameEdit *m_qle_filename;
|
2019-01-02 16:56:46 +00:00
|
|
|
NameListWidget *m_names_list;
|
2016-05-15 14:46:01 +00:00
|
|
|
QString m_chosen_file;
|
|
|
|
QTreeView *m_tree_view = nullptr;
|
|
|
|
ElementsLocation m_chosen_location;
|
|
|
|
ElementsCollectionModel *m_model = nullptr;
|
2007-04-04 02:13:14 +00:00
|
|
|
|
2016-05-15 14:46:01 +00:00
|
|
|
// methods
|
2007-04-06 02:47:25 +00:00
|
|
|
private:
|
2016-05-15 14:46:01 +00:00
|
|
|
QWizardPage *buildStep1();
|
|
|
|
QWizardPage *buildStep2();
|
|
|
|
QWizardPage *buildStep3();
|
|
|
|
bool validStep1();
|
|
|
|
bool validStep2();
|
2017-08-05 02:10:01 +00:00
|
|
|
bool validateCurrentPage() override;
|
2016-05-15 14:46:01 +00:00
|
|
|
void createNewElement();
|
2007-04-04 02:13:14 +00:00
|
|
|
};
|
2007-04-05 01:13:14 +00:00
|
|
|
#endif
|