28#include "IException.h"
32#include "ProjectItem.h"
33#include "ProjectItemModel.h"
37 RemoveImagesWorkOrder::RemoveImagesWorkOrder(
Project *project) :
WorkOrder(project) {
41 QAction::setText(
"&Delete images from project...");
43 setModifiesDiskState(
true);
54 RemoveImagesWorkOrder::~RemoveImagesWorkOrder() {
86 long itemCount = selectedItems.count();
88 if (selectedItems.at(0)->isImage()) {
89 QUndoCommand::setText(
"&Delete image " + selectedItems.at(0)->image()->fileName() +
" from project...");
91 else if (selectedItems.at(0)->isImageList()) {
92 QUndoCommand::setText(
"&Delete " + QString::number(selectedItems.at(0)->imageList()->count(), 10) +
" images from project...");
97 QList<ImageList *> imageListAdded;
105 totalCount += item->
imageList()->count();
106 imageListAdded.append(item->
imageList());
112 foreach (
Image *image, images) {
118 QUndoCommand::setText(
"&Delete " + QString::number(totalCount, 10) +
" images from project...");
140 QList<ProjectItem *> needToRemoveItems;
144 QList<ImageList *> imageListToProcess;
145 foreach (
ProjectItem *selectedItem, selectedItems) {
146 if (selectedItem->isImage()) {
147 Image *selectedImage = selectedItem->image();
150 foreach (
ImageList* projectImageList, projectImageLists) {
151 projectImageList->removeAll(selectedImage);
154 else if (selectedItem->isImageList()) {
155 imageListToProcess.append(selectedItem->imageList());
156 needToRemoveItems.append(selectedItem);
160 "Item cannot be removed from the project.",
166 foreach (
ImageList* projectImageList, projectImageLists) {
167 projectImageList->removeAll(selectedImage);
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
This represents a cube in a project-based GUI interface.
Internalizes a list of images and allows for operations on the entire list.
void append(Image *const &value)
Appends an image to the image list.
The main project for ipce.
static QStringList images(QStringList)
Verify that the input fileNames are image files.
Directory * directory() const
Returns the directory associated with this Project.
void setClean(bool value)
Function to change the clean state of the project.
Represents an item of a ProjectItemModel in Qt's model-view framework.
bool isImageList() const
Returns true if an ImageList is stored in the data of the item.
ImageList * imageList() const
Returns the ImageList stored in the data of the item.
Image * image() const
Returns the Image stored in the data of the item.
bool isImage() const
Returns true if an Image is stored in the data of the item.
QList< ProjectItem * > selectedItems()
Returns a list of the selected items of the internal selection model.
virtual void removeItems(QList< ProjectItem * > items)
Removes a list of items and their children from the model.
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
Removes selected images from current project.
bool setupExecution()
@description Set up the execution.
virtual bool isExecutable(ImageList *images)
Determines if we can remove this ImageList.
void execute()
@description Remove any selected items from the project directory.
Provide Undo/redo abilities, serialization, and history for an operation.
virtual bool setupExecution()
This sets up the state for the work order.
Project * project() const
Returns the Project this WorkOrder is attached to.
ImageList * imageList()
Returns a pointer to the ImageList for this WorkOrder.
This is free and unencumbered software released into the public domain.