26 #include <QFileDialog> 27 #include <QMessageBox> 28 #include <QRegularExpression> 48 QAction::setText(tr(
"Import Registration Templates..."));
49 QUndoCommand::setText(tr(
"Import Registration Templates..."));
94 QString itemType = item->text();
97 return (itemType ==
"Registrations");
116 templateFileNames = QFileDialog::getOpenFileNames(
117 qobject_cast<QWidget *>(parent()),
118 "Import Registration Templates",
120 "Registrations (*.def);; All Files (*)");
122 if (!templateFileNames.isEmpty()) {
123 QUndoCommand::setText(tr(
"Import %1 Template(s)").arg(templateFileNames.count()));
147 "registrations/" + templateFolder.dirName() );
149 foreach (
FileName filename, templateFileNames) {
150 QFile::copy(filename.
expanded(), templateFolder.path() +
"/" + filename.
name());
151 m_list->append(
new Template(templateFolder.path() +
"/" + filename.
name(),
153 templateFolder.dirName()));
156 if (!m_list->isEmpty()) {
171 if (m_list &&
project()->templates().size() > 0) {
177 foreach (
Template *currentTemplate, *m_list) {
178 delete currentTemplate;
The main project for ipce.
File name manipulation and expansion.
~ImportRegistrationTemplateWorkOrder()
Destructor.
virtual bool setupExecution()
This sets up the state for the work order.
void execute()
Imports the templates.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
ImportRegistrationTemplateWorkOrder(Project *project)
Creates a work order to import registration templates.
virtual bool isExecutable(ProjectItem *item)
This method returns true if the user clicked on a project tree node with the text "Registrations"...
virtual ImportRegistrationTemplateWorkOrder * clone() const
This method clones the current ImportRegistrationTemplateWorkOrder and returns it.
void addTemplates(TemplateList *templateFiles)
Add new templates to m_mapTemplates or m_regTemplates and update project item model.
ProjectItem * findItemData(const QVariant &data, int role=Qt::UserRole+1)
Returns the first item found that contains the given data in the given role or a null pointer if no i...
void deleteFromDisk(Project *project)
Delete all of the contained Templates from disk.
Directory * directory() const
Returns the directory associated with this Project.
bool setupExecution()
Sets up the work order for execution.
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
Provide Undo/redo abilities, serialization, and history for an operation.
void undoExecution()
Deletes the previously imported templates.
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
Add registration templates to a project.
void setModifiesDiskState(bool changesProjectOnDisk)
Represents an item of a ProjectItemModel in Qt's model-view framework.
Namespace for ISIS/Bullet specific routines.
Project * project() const
Returns the Project this WorkOrder is attached to.
QDir addTemplateFolder(QString prefix)
Create and navigate to the appropriate template type folder in the project directory.
QStringList internalData() const
Gets the internal data for this WorkOrder.
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
void setClean(bool value)
Function to change the clean state of the project.