|
Isis 3 Programmer Reference
|
Go to the documentation of this file.
26 #include <QFileDialog>
27 #include <QMessageBox>
28 #include <QRegularExpression>
32 #include "ProjectItemModel.h"
34 #include "TemplateList.h"
48 QAction::setText(tr(
"Import Map Templates..."));
49 QUndoCommand::setText(tr(
"Import Map Templates..."));
94 QString itemType = item->text();
97 return (itemType ==
"Maps");
116 templateFileNames = QFileDialog::getOpenFileNames(
117 qobject_cast<QWidget *>(parent()),
118 "Import Map Templates",
120 "Maps (*.map);; All Files (*)");
122 if (!templateFileNames.isEmpty()) {
123 QUndoCommand::setText(tr(
"Import %1 Template(s)").arg(templateFileNames.count()));
147 "maps/" + 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;
virtual ImportMapTemplateWorkOrder * clone() const
This method clones the current ImportMapTemplateWorkOrder and returns it.
virtual bool setupExecution()
This sets up the state for the work order.
Provide Undo/redo abilities, serialization, and history for an operation.
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
File name manipulation and expansion.
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
bool setupExecution()
Sets up the work order for execution.
void addTemplates(TemplateList *templateFiles)
Add new templates to m_mapTemplates or m_regTemplates and update project item model.
The main project for ipce.
Directory * directory() const
Returns the directory associated with this Project.
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...
void deleteFromDisk(Project *project)
Delete all of the contained Templates from disk.
Project * project() const
Returns the Project this WorkOrder is attached to.
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 execute()
Imports the templates.
ImportMapTemplateWorkOrder(Project *project)
Creates a work order to import map templates.
Add map templates to a project.
QStringList internalData() const
Gets the internal data for this WorkOrder.
void setModifiesDiskState(bool changesProjectOnDisk)
QDir addTemplateFolder(QString prefix)
Create and navigate to the appropriate template type folder in the project directory.
~ImportMapTemplateWorkOrder()
Destructor.
void undoExecution()
Deletes the previously imported templates.
void setClean(bool value)
Function to change the clean state of the project.
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
virtual bool isExecutable(ProjectItem *item)
This method returns true if the user clicked on a project tree node with the text "Maps".
This is free and unencumbered software released into the public domain.
Represents an item of a ProjectItemModel in Qt's model-view framework.