From b0053e6b4e1941dbfe97ac4fc5aa63c5795ab6d5 Mon Sep 17 00:00:00 2001 From: Marcus Pfaff Date: Wed, 22 Feb 2017 12:20:58 +0100 Subject: [PATCH] ProjectManager bugfixes & improvements --- .../src/project/abstract_workspace_gui.h | 4 +- itemframework/src/project/file_helper.cpp | 16 + itemframework/src/project/file_helper.h | 9 + itemframework/src/project/file_project.cpp | 4 - .../project/file_workspace_edit_dialog.cpp | 19 +- .../src/project/file_workspace_edit_dialog.h | 1 + .../src/project/file_workspace_edit_dialog.ui | 4 +- .../src/project/file_workspace_gui.cpp | 322 +++++++++--------- .../src/project/file_workspace_gui.h | 16 +- .../src/project/file_workspace_new_dialog.cpp | 8 +- .../src/project/file_workspace_new_dialog.ui | 2 +- .../project/project_changed_extern_dialog.cpp | 11 +- .../project/project_changed_extern_dialog.h | 4 +- .../project/project_changed_extern_dialog.ui | 68 +--- itemframework/src/project/project_gui.cpp | 59 ++-- itemframework/src/project/project_gui.h | 2 +- .../src/project/project_manager_config.h | 1 + .../src/project/project_manager_gui.cpp | 90 ++--- .../src/project/project_manager_gui.h | 1 - .../src/project/select_workspace_dialog.cpp | 46 +-- .../src/project/sql_workspace_gui.cpp | 4 +- itemframework/src/project/sql_workspace_gui.h | 4 +- 22 files changed, 302 insertions(+), 393 deletions(-) diff --git a/itemframework/src/project/abstract_workspace_gui.h b/itemframework/src/project/abstract_workspace_gui.h index 43ea1bd..902e0fc 100644 --- a/itemframework/src/project/abstract_workspace_gui.h +++ b/itemframework/src/project/abstract_workspace_gui.h @@ -20,8 +20,8 @@ class AbstractWorkspaceGui : public QObject Q_OBJECT public: virtual ~AbstractWorkspaceGui(); - virtual QDialog* dialogNewWorkspace(QDialog* parent = 0) const = 0; - virtual QDialog* dialogLoadWorkspace(QDialog* parent = 0) const = 0; + virtual QDialog* dialogNewWorkspace(QDialog* parent = 0) = 0; + virtual QDialog* dialogLoadWorkspace(QDialog* parent = 0) = 0; virtual QDialog* dialogEditWorkspace(QDialog* parent = 0, QSharedPointer workspace = QSharedPointer()) const = 0; virtual QString workspaceTypeName() const = 0; virtual void addListWidgetItem(QListWidget* parentListWidget) = 0; diff --git a/itemframework/src/project/file_helper.cpp b/itemframework/src/project/file_helper.cpp index e4b968b..e043675 100644 --- a/itemframework/src/project/file_helper.cpp +++ b/itemframework/src/project/file_helper.cpp @@ -26,6 +26,22 @@ bool FileHelper::directoryExists(const QString &directoryPath) return directory.isDir(); } +bool FileHelper::createDirectory(const QString &directoryPath){ + QDir directory(directoryPath); + + if(directory.exists()){ + return true; + } + + if(!QDir().mkpath(directoryPath)){ + _lastError = QString("Make workspace path \"%1\" failed.").arg(directoryPath); + return false; + } + + _lastError.clear(); + return true; +} + bool FileHelper::removeFile(const QString& filePath) { QFile file(filePath); diff --git a/itemframework/src/project/file_helper.h b/itemframework/src/project/file_helper.h index 2a98991..032b699 100644 --- a/itemframework/src/project/file_helper.h +++ b/itemframework/src/project/file_helper.h @@ -57,6 +57,15 @@ class FileHelper */ static bool directoryExists(const QString& directoryPath); + /** + * @return Returns \c true if the directory was created, otherwise returns \c false. + * + * @param directoryPath The directoryPath as string. + * + * \sa directoryExists + */ + static bool createDirectory(const QString &directoryPath); + /** * @return Returns \c true if the file was removed or does not exists, otherwise returns \c false. * diff --git a/itemframework/src/project/file_project.cpp b/itemframework/src/project/file_project.cpp index 431de40..8d60a63 100644 --- a/itemframework/src/project/file_project.cpp +++ b/itemframework/src/project/file_project.cpp @@ -141,10 +141,6 @@ bool FileProject::save() setExternChanged(false); setDirty(false); - if (FileHelper::fileExists(_autosaveFilePath)) { - autosave(); - } - return true; } diff --git a/itemframework/src/project/file_workspace_edit_dialog.cpp b/itemframework/src/project/file_workspace_edit_dialog.cpp index 637cd09..e885f75 100644 --- a/itemframework/src/project/file_workspace_edit_dialog.cpp +++ b/itemframework/src/project/file_workspace_edit_dialog.cpp @@ -11,16 +11,12 @@ FileWorkspaceEditDialog::FileWorkspaceEditDialog(QString lastUsedPath, QDialog* _workspacePropertiesEdited = new FileWorkspaceData; _actionFileExists = new QAction(QIcon(":/core/projectmanager/workspace_not_valid.png"), "", this); _actionFileExists->setToolTip(QLatin1String("File already exists.")); + _lastUsedPath = lastUsedPath; - if (lastUsedPath.isEmpty()) { - _lastUsedPath = QString(HomeFolderUser); - } else { - _lastUsedPath = lastUsedPath; - } - - _ui->selectedWorkspaceFile->setToolTip(QString("e.g workspaceFile.%1").arg(WspFileExt)); + _ui->selectedWorkspaceFile->setToolTip(QString("workspaceFile.%1").arg(WspFileExt)); connect(_ui->selectedWorkspaceName, &QLineEdit::textChanged, this, &FileWorkspaceEditDialog::onWorkspaceNameChanged); connect(_ui->selectedWorkspaceFile, &QLineEdit::textChanged, this, &FileWorkspaceEditDialog::onWorkspaceFileChanged); + connect(_ui->selectedWorkspaceDirectory, &QLineEdit::textChanged, this, &FileWorkspaceEditDialog::onWorkspaceDirectoryChanged); connect(_ui->selectedWorkspaceDescription, &QTextEdit::textChanged, this, &FileWorkspaceEditDialog::onWorkspaceDescriptionChanged); } @@ -171,7 +167,7 @@ void FileWorkspaceEditDialog::accept() { _workspacePropertiesEdited->name = _ui->selectedWorkspaceName->text(); _workspacePropertiesEdited->fileName = _ui->selectedWorkspaceFile->text(); - _workspacePropertiesEdited->directory = _ui->selectedWorkspaceDirectory->text(); + _workspacePropertiesEdited->directory = QDir::cleanPath(_ui->selectedWorkspaceDirectory->text()); _workspacePropertiesEdited->filePath = QString(_workspacePropertiesEdited->directory + Slash + _workspacePropertiesEdited->fileName); _workspacePropertiesEdited->description = _ui->selectedWorkspaceDescription->toPlainText(); @@ -267,7 +263,7 @@ void FileWorkspaceEditDialog::showFileDialog() _lastUsedPath = dir; } - overrideValidation(); + onWorkspaceDirectoryChanged(); } void FileWorkspaceEditDialog::onWorkspaceNameChanged(QString name) @@ -319,3 +315,8 @@ void FileWorkspaceEditDialog::onWorkspaceIsDefaultChanged() { overrideValidation(); } + +void FileWorkspaceEditDialog::onWorkspaceDirectoryChanged() +{ + overrideValidation(); +} diff --git a/itemframework/src/project/file_workspace_edit_dialog.h b/itemframework/src/project/file_workspace_edit_dialog.h index 9cc6a84..945646a 100644 --- a/itemframework/src/project/file_workspace_edit_dialog.h +++ b/itemframework/src/project/file_workspace_edit_dialog.h @@ -56,6 +56,7 @@ private slots: void onWorkspaceFileChanged(QString file); void onWorkspaceDescriptionChanged(); void onWorkspaceIsDefaultChanged(); + void onWorkspaceDirectoryChanged(); }; #endif // FILE_WORKSPACE_EDIT_DIALOG_H diff --git a/itemframework/src/project/file_workspace_edit_dialog.ui b/itemframework/src/project/file_workspace_edit_dialog.ui index d4b5a90..054327c 100644 --- a/itemframework/src/project/file_workspace_edit_dialog.ui +++ b/itemframework/src/project/file_workspace_edit_dialog.ui @@ -29,7 +29,7 @@ true - e.g. workspace.twsp + workspace.twsp @@ -120,7 +120,7 @@ - true + false diff --git a/itemframework/src/project/file_workspace_gui.cpp b/itemframework/src/project/file_workspace_gui.cpp index c86cb04..96b0d5b 100644 --- a/itemframework/src/project/file_workspace_gui.cpp +++ b/itemframework/src/project/file_workspace_gui.cpp @@ -6,7 +6,6 @@ #include "file_workspace_load_dialog.h" #include "file_workspace_edit_dialog.h" #include "item/item_view.h" -#include "project_manager_config.h" #include "wizard_workspace_export.h" #include "wizard_workspace_import.h" #include @@ -38,41 +37,164 @@ QString FileWorkspaceGui::workspaceTypeName() const return tr("File Workspace"); } -QDialog* FileWorkspaceGui::dialogNewWorkspace(QDialog* parent) const +bool FileWorkspaceGui::isTypeFriendly(const QSharedPointer& workspace) const +{ + return !qSharedPointerCast(workspace).isNull(); +} + +void FileWorkspaceGui::addListWidgetItem(QListWidget* parentListWidget) { - QDialog* dialogNewWorkspace = new FileWorkspaceNewDialog(lastUsedWorkspacePath(), parent); - connect(dialogNewWorkspace, &QDialog::accepted, this, &FileWorkspaceGui::newWorkspaceAccepted); + QListWidgetItem* listWidgetItem = new QListWidgetItem(parentListWidget); + listWidgetItem->setText(tr("File")); + listWidgetItem->setIcon(QIcon(":/core/projectmanager/localdrive")); +} + +QDialog* FileWorkspaceGui::dialogNewWorkspace(QDialog* parent) +{ + FileWorkspaceNewDialog* fileWorkspaceNewDialog = new FileWorkspaceNewDialog(lastUsedWorkspacePath(), parent); + + connect(fileWorkspaceNewDialog, &QDialog::accepted, [this, fileWorkspaceNewDialog](){ + const FileWorkspaceData* workspaceData = fileWorkspaceNewDialog->data(); + + if(!FileHelper::directoryExists(workspaceData->directory)){ + if(!FileHelper::createDirectory(workspaceData->directory)){ + QMessageBox::warning(0, tr("Create new workspace."), FileHelper::lastError(), QMessageBox::Ok); + return; + } + } + + // Create new file workspace with prefered filename and workspacename + auto fileWorkspace = newFileWorkspace(workspaceData); + setLastUsedWorkspacePath(fileWorkspace->path()); + + if (!fileWorkspace->isValid()) { + const QString workspaceErrorMessage = tr("%1.\n\nConnection: \n%2") + .arg(fileWorkspace->lastError()) + .arg(fileWorkspace->connectionString()); + QMessageBox::warning(0, tr("Loading workspace."), workspaceErrorMessage, QMessageBox::Ok); + return; + } + + // Emit acceptWorkspace signal to send this workspace to the select workspace dialog + emit acceptWorkspace(fileWorkspace); + + }); // Return a QDialog pointer. This widget provides an UI to create a new workspace - return dialogNewWorkspace; + return fileWorkspaceNewDialog; } -QDialog* FileWorkspaceGui::dialogLoadWorkspace(QDialog* parent) const +QDialog* FileWorkspaceGui::dialogLoadWorkspace(QDialog* parent) { // Return a fileDialog-LoadWorkspace widget pointer. This widget provides an UI to load workspace. - QDialog* dialogLoadWorkspace = new FileWorkspaceLoadDialog(lastUsedWorkspacePath(), parent); - connect(dialogLoadWorkspace, &QDialog::accepted, this, &FileWorkspaceGui::loadWorkspaceAccepted); + FileWorkspaceLoadDialog* fileWorkspaceLoadDialog = new FileWorkspaceLoadDialog(lastUsedWorkspacePath(), parent); + + connect(fileWorkspaceLoadDialog, &QDialog::accepted, [this, fileWorkspaceLoadDialog](){ + fileWorkspaceLoadDialog->setVisible(true); + QStringList workspaceFile = fileWorkspaceLoadDialog->selectedFiles(); + + if (!workspaceFile.isEmpty()) { + // Create new file workspace with prefered filename and workspacename + auto fileWorkspace = FileWorkspace::createFileWorkspaceFromFile(workspaceFile.first()); + setLastUsedWorkspacePath(fileWorkspace->path()); + + if (!fileWorkspace->isValid()) { + const QString workspaceErrorMessage = tr("Workspace is invalid.\n\nConnection: \n%1\n\nError:\n%2") + .arg(fileWorkspace->connectionString()) + .arg(fileWorkspace->lastError()); + + QMessageBox::warning(0, tr("Loading workspace."), workspaceErrorMessage, QMessageBox::Ok); + return; + } + + // Emit acceptWorkspace signal to send this workspace to the select workspace dialog + emit acceptWorkspace(fileWorkspace); + } + }); + // Return a QDialog pointer. This widget provides an UI to create a new workspace - return dialogLoadWorkspace; + return fileWorkspaceLoadDialog; } QDialog* FileWorkspaceGui::dialogEditWorkspace(QDialog* parent, QSharedPointer workspace) const { FileWorkspaceEditDialog* fileWorkspaceEditDialog = new FileWorkspaceEditDialog(lastUsedWorkspacePath(), parent); fileWorkspaceEditDialog->setWorkspace(workspace); - connect(fileWorkspaceEditDialog, &QDialog::accepted, this, &FileWorkspaceGui::editWorkspaceAccepted); - return fileWorkspaceEditDialog; -} + bool workspaceIsNull = workspace.isNull(); -void FileWorkspaceGui::addListWidgetItem(QListWidget* parentListWidget) -{ - QListWidgetItem* listWidgetItem = new QListWidgetItem(parentListWidget); - listWidgetItem->setText(tr("File")); - listWidgetItem->setIcon(QIcon(":/core/projectmanager/localdrive")); -} + connect(fileWorkspaceEditDialog, &QDialog::accepted, [this, fileWorkspaceEditDialog, workspaceIsNull](){ + const FileWorkspaceData* workspacePropertiesInitial = fileWorkspaceEditDialog->workspacePropertiesInitial(); + const FileWorkspaceData* workspacePropertiesEdited = fileWorkspaceEditDialog->workspacePropertiesEdited(); -bool FileWorkspaceGui::isTypeFriendly(const QSharedPointer& workspace) const -{ - return !qSharedPointerCast(workspace).isNull(); + QSharedPointer fileWorkspace = fileWorkspaceEditDialog->workspace(); + + if(workspaceIsNull){ + // Edit workspace called by edit button. + // Search for this workspace in recent workspace list to get the right shared pointer object. + for(QSharedPointer workspace : projectManager()->recentWorkspaces()){ + if(workspace->compare(fileWorkspace)){ + fileWorkspace = qSharedPointerCast(workspace); + break; + } + } + } + + if(!fileWorkspace.isNull()){ + fileWorkspace->setFileEditMode(true); + + if(workspacePropertiesEdited->filePath != workspacePropertiesInitial->filePath){ + // Copy the workspace file to a new destination + + if(!FileHelper::directoryExists(workspacePropertiesEdited->directory)){ + if(!FileHelper::createDirectory(workspacePropertiesEdited->directory)){ + QMessageBox::warning(0, tr("Create new workspace."), FileHelper::lastError(), QMessageBox::Ok); + return; + } + } + + QFile dstWorkspaceFile(workspacePropertiesEdited->filePath); + QFile srcWorkspaceFile(workspacePropertiesInitial->filePath); + + + + if (dstWorkspaceFile.exists() && !dstWorkspaceFile.remove()) { + QMessageBox::warning(0, tr("Edit workspace file failed."), + QString("Destination file %1 exists and could not be removed.").arg(dstWorkspaceFile.fileName()), + QMessageBox::Ok, + QMessageBox::Ok); + return; + } + + if (!srcWorkspaceFile.copy(dstWorkspaceFile.fileName())) { + QMessageBox::warning(0, tr("Edit workspace file failed."), + QString("Source file %1 could not be copied to destination file %2."). + arg(srcWorkspaceFile.fileName()). + arg(dstWorkspaceFile.fileName()), + QMessageBox::Ok, + QMessageBox::Ok); + return; + } + + if (!srcWorkspaceFile.remove()) { + QMessageBox::warning(0, tr("Edit workspace file failed."), + QString("Source file %1 could not be removed.").arg(srcWorkspaceFile.fileName()), + QMessageBox::Ok, + QMessageBox::Ok); + return; + } + + + fileWorkspace->setFilePath(workspacePropertiesEdited->filePath); + } + + fileWorkspace->setName(workspacePropertiesEdited->name); + fileWorkspace->setDescription(workspacePropertiesEdited->description); + fileWorkspace->update(); + fileWorkspace->save(); + fileWorkspace->setFileEditMode(false); + } + }); + + return fileWorkspaceEditDialog; } bool FileWorkspaceGui::removeProject(const QSharedPointer& projectGui, bool showMessagebox) @@ -234,138 +356,15 @@ void FileWorkspaceGui::workspaceMenuRequested(const QPoint& position) connect(workspaceInfo, &QAction::triggered, this, &FileWorkspaceGui::showWorkspaceInformation); connect(importProjects, &QAction::triggered, this, &FileWorkspaceGui::showImportWorkspaceWizard); connect(exportWorkspace, &QAction::triggered, this, &FileWorkspaceGui::showExportWorkspaceWizard); - connect(editWorkspace, &QAction::triggered, this, &FileWorkspaceGui::showEditWorkspaceDialog); - connect(switchWorkspace, &QAction::triggered, this, &AbstractWorkspaceGui::switchWorkspace); - contextMenu.exec(position); -} - -void FileWorkspaceGui::showEditWorkspaceDialog(){ - QDialog* editWorkspaceDialog = dialogEditWorkspace(0, workspace()); - editWorkspaceDialog->exec(); -} - -void FileWorkspaceGui::loadWorkspaceAccepted() -{ - FileWorkspaceLoadDialog* fileWorkspaceLoadDialog = qobject_cast(sender()); - - if (fileWorkspaceLoadDialog == nullptr) { - return; - } - - fileWorkspaceLoadDialog->setVisible(true); - QStringList workspaceFile = fileWorkspaceLoadDialog->selectedFiles(); - - if (!workspaceFile.isEmpty()) { - const QString workspaceFilePath = workspaceFile.first(); - // Create new file workspace with prefered filename and workspacename - QSharedPointer fileWorkspace = FileWorkspace::createFileWorkspaceFromFile(workspaceFilePath); - - if (fileWorkspace.isNull()) { - return; - } - - _lastUsedWorkspacePath = fileWorkspace->path(); - - if (!fileWorkspace->isValid()) { - const QString workspaceErrorMessage = tr("Workspace is invalid.\n\nConnection: \n%1\n\nError:\n%2") - .arg(fileWorkspace->connectionString()) - .arg(fileWorkspace->lastError()); - - QMessageBox::warning(0, tr("Loading workspace."), workspaceErrorMessage, QMessageBox::Ok); - return; - } - // Emit acceptWorkspace signal to send this workspace to the select workspace dialog - emit acceptWorkspace(fileWorkspace); - } -} -void FileWorkspaceGui::newWorkspaceAccepted() -{ - FileWorkspaceNewDialog* fileWorkspaceNewDialog = qobject_cast(sender()); - - if (fileWorkspaceNewDialog == nullptr) { - return; - } - - const FileWorkspaceData* workspaceProperties = fileWorkspaceNewDialog->data(); - // Create new file workspace with prefered filename and workspacename - QSharedPointer fileWorkspace = newFileWorkspace(workspaceProperties); - _lastUsedWorkspacePath = fileWorkspace->path(); - - if (!fileWorkspace->isValid()) { - const QString workspaceErrorMessage = tr("%1.\n\nConnection: \n%2") - .arg(fileWorkspace->lastError()) - .arg(fileWorkspace->connectionString()); - QMessageBox::warning(0, tr("Loading workspace."), workspaceErrorMessage, QMessageBox::Ok); - return; - } - - // Emit acceptWorkspace signal to send this workspace to the select workspace dialog - emit acceptWorkspace(fileWorkspace); -} + connect(editWorkspace, &QAction::triggered, [this](){ + QDialog* editWorkspaceDialog = dialogEditWorkspace(0, workspace()); + editWorkspaceDialog->exec(); + }); -void FileWorkspaceGui::editWorkspaceAccepted() -{ - FileWorkspaceEditDialog* fileWorkspaceEditDialog = qobject_cast(sender()); - if (fileWorkspaceEditDialog == nullptr) { - return; - } - - const FileWorkspaceData* workspacePropertiesInitial = fileWorkspaceEditDialog->workspacePropertiesInitial(); - const FileWorkspaceData* workspacePropertiesEdited = fileWorkspaceEditDialog->workspacePropertiesEdited(); - QSharedPointer fileWorkspace = fileWorkspaceEditDialog->workspace(); - - if(!fileWorkspace.isNull()){ - if(workspacePropertiesEdited->filePath != workspacePropertiesInitial->filePath){ - // Copy the workspace file to a new destination - QFile dstWorkspaceFile(workspacePropertiesEdited->filePath); - QFile srcWorkspaceFile(workspacePropertiesInitial->filePath); - - fileWorkspace->setFileEditMode(true); - - if (dstWorkspaceFile.exists() && !dstWorkspaceFile.remove()) { - QMessageBox::warning(0, tr("Edit workspace file failed."), - QString("Destination file %1 exists and could not be removed.").arg(dstWorkspaceFile.fileName()), - QMessageBox::Ok, - QMessageBox::Ok); - return; - } - - if (!srcWorkspaceFile.copy(dstWorkspaceFile.fileName())) { - QMessageBox::warning(0, tr("Edit workspace file failed."), - QString("Source file %1 could not be copied to destination file %2."). - arg(srcWorkspaceFile.fileName()). - arg(dstWorkspaceFile.fileName()), - QMessageBox::Ok, - QMessageBox::Ok); - return; - } - - if (!srcWorkspaceFile.remove()) { - QMessageBox::warning(0, tr("Edit workspace file failed."), - QString("Source file %1 could not be removed.").arg(srcWorkspaceFile.fileName()), - QMessageBox::Ok, - QMessageBox::Ok); - return; - } - - fileWorkspace->setFileEditMode(false); - fileWorkspace->setFilePath(workspacePropertiesEdited->filePath); - } - - fileWorkspace->setName(workspacePropertiesEdited->name); - fileWorkspace->setDescription(workspacePropertiesEdited->description); - fileWorkspace->update(); - - if (!fileWorkspace->save()) { - QMessageBox::warning(0, tr("Edit workspace file failed."), - QString("Could not save workspace file \"%1\".").arg(fileWorkspace->fileName()), - QMessageBox::Ok, - QMessageBox::Ok); - return; - } - } + //connect(switchWorkspace, &QAction::triggered, this, &AbstractWorkspaceGui::switchWorkspace); + contextMenu.exec(position); } void FileWorkspaceGui::showNewProjectDialog() @@ -390,7 +389,7 @@ void FileWorkspaceGui::showNewProjectDialog() FileProVersion, projectDescription); - auto fileProject = QSharedPointer(new FileProject(workspace()->settingsScope(), + QSharedPointer fileProject = QSharedPointer(new FileProject(workspace()->settingsScope(), projectPath, projectDomDocument)); fileProject->setFastLoad(fastLoad); @@ -398,6 +397,7 @@ void FileWorkspaceGui::showNewProjectDialog() fileProject->save(); fileWorkspace->addProject(fileProject); addProjectGui(QSharedPointer(new ProjectGui(this, fileProject))); + fileProject->autosave(); } } @@ -453,17 +453,25 @@ QSharedPointer FileWorkspaceGui::newFileWorkspace(const FileWorks QString FileWorkspaceGui::lastUsedWorkspacePath() const { - if(_lastUsedWorkspacePath.isEmpty()){ - QSharedPointer fileWorkspace = qSharedPointerCast(_projectManager->currentWorkspace()); + return _lastUsedWorkspacePath; +} - if(fileWorkspace.isNull()){ - return QString(HomeFolderUser); +void FileWorkspaceGui::setLastUsedWorkspacePath(const QString &lastUsedWorkspacePath) +{ + if(lastUsedWorkspacePath.isEmpty()){ + const auto fileWorkspace = qSharedPointerCast(_projectManager->currentWorkspace()); + if(!fileWorkspace.isNull()){ + _lastUsedWorkspacePath = fileWorkspace->path(); + } else { + _lastUsedWorkspacePath = DefaultWorkspaceFolder; } + } - return fileWorkspace->path(); + if(lastUsedWorkspacePath == _lastUsedWorkspacePath){ + return; } - return _lastUsedWorkspacePath; + _lastUsedWorkspacePath = lastUsedWorkspacePath; } void FileWorkspaceGui::onProjectLoad(const QSharedPointer& projectGui) diff --git a/itemframework/src/project/file_workspace_gui.h b/itemframework/src/project/file_workspace_gui.h index ad6b5c7..1b9672c 100644 --- a/itemframework/src/project/file_workspace_gui.h +++ b/itemframework/src/project/file_workspace_gui.h @@ -11,6 +11,7 @@ #include "project_gui.h" #include "file_workspace.h" #include "file_datatype_helper.h" +#include "project_manager_config.h" class FileProjectNewDialog; class FileProjectEditDialog; @@ -27,8 +28,8 @@ class FileWorkspaceGui : public AbstractWorkspaceGui Q_INVOKABLE FileWorkspaceGui(); ~FileWorkspaceGui(); QString workspaceTypeName() const override; - QDialog* dialogNewWorkspace(QDialog* parent = 0) const Q_DECL_OVERRIDE; - QDialog* dialogLoadWorkspace(QDialog* parent = 0) const Q_DECL_OVERRIDE; + QDialog* dialogNewWorkspace(QDialog* parent = 0) Q_DECL_OVERRIDE; + QDialog* dialogLoadWorkspace(QDialog* parent = 0) Q_DECL_OVERRIDE; QDialog* dialogEditWorkspace(QDialog* parent = 0, QSharedPointer workspace = QSharedPointer()) const Q_DECL_OVERRIDE; void addListWidgetItem(QListWidget* parentListWidget) Q_DECL_OVERRIDE; bool isTypeFriendly(const QSharedPointer& workspace) const Q_DECL_OVERRIDE; @@ -42,25 +43,24 @@ class FileWorkspaceGui : public AbstractWorkspaceGui void searchProjectSource(QSharedPointer projectGui) Q_DECL_OVERRIDE; void createProjectsFromImport(const QStringList& projectPaths, bool overwrite = false) Q_DECL_OVERRIDE; + + private slots: void showExportWorkspaceWizard(); void showImportWorkspaceWizard(); void workspaceMenuRequested(const QPoint& position); - void newWorkspaceAccepted(); - void loadWorkspaceAccepted(); - void editWorkspaceAccepted(); void showNewProjectDialog(); - void showEditWorkspaceDialog(); void showOpenProjectDialog(); void showWorkspaceInformation(); void onProjectLoad(const QSharedPointer& projectGui) override; void onProjectUnload(const QSharedPointer& projectGui) override; private: - QSharedPointer newFileWorkspace(const FileWorkspaceData* workspaceProperties); + static QSharedPointer newFileWorkspace(const FileWorkspaceData* workspaceProperties); + void setLastUsedWorkspacePath(const QString &lastUsedWorkspacePath); QString lastUsedWorkspacePath() const; FileWorkspaceNewDialog* _widgetNewWorkspace = nullptr; FileWorkspaceLoadDialog* _widgetLoadWorkspace = nullptr; - QString _lastUsedWorkspacePath; + QString _lastUsedWorkspacePath = DefaultWorkspaceFolder; }; #endif // FILE_WORKSPACE_GUI_H diff --git a/itemframework/src/project/file_workspace_new_dialog.cpp b/itemframework/src/project/file_workspace_new_dialog.cpp index b1d95c5..7e6f348 100644 --- a/itemframework/src/project/file_workspace_new_dialog.cpp +++ b/itemframework/src/project/file_workspace_new_dialog.cpp @@ -10,10 +10,6 @@ FileWorkspaceNewDialog::FileWorkspaceNewDialog(QString lastUsedPath, QDialog* pa _parent = parent; _lastUsedPath = lastUsedPath; - if (_lastUsedPath.isEmpty()) { - _lastUsedPath = QDir(HomeFolderUser).absolutePath(); - } - ui->lineEditPath->setText(_lastUsedPath); _data = new FileWorkspaceData; @@ -131,9 +127,9 @@ void FileWorkspaceNewDialog::accept() const bool isDefault = ui->checkBoxDefault->isChecked(); _data->name = name; - _data->filePath = filePath; + _data->filePath = QDir::cleanPath(filePath); _data->fileName = fileName; - _data->directory = directory; + _data->directory = QDir::cleanPath(directory); _data->description = description; _data->isDefault = isDefault; diff --git a/itemframework/src/project/file_workspace_new_dialog.ui b/itemframework/src/project/file_workspace_new_dialog.ui index 00fa130..8873b48 100644 --- a/itemframework/src/project/file_workspace_new_dialog.ui +++ b/itemframework/src/project/file_workspace_new_dialog.ui @@ -51,7 +51,7 @@ - true + false diff --git a/itemframework/src/project/project_changed_extern_dialog.cpp b/itemframework/src/project/project_changed_extern_dialog.cpp index 898a947..78aacb7 100644 --- a/itemframework/src/project/project_changed_extern_dialog.cpp +++ b/itemframework/src/project/project_changed_extern_dialog.cpp @@ -8,7 +8,6 @@ ProjectChangedExternDialog::ProjectChangedExternDialog(QWidget* parent) : ui(new Ui::ProjectChangedExternDialog) { ui->setupUi(this); - _projectChangedAction = NoAction; } ProjectChangedExternDialog::~ProjectChangedExternDialog() @@ -53,18 +52,12 @@ void ProjectChangedExternDialog::accept() if (buttonName == QStringLiteral("pushButtonYes")) { // Reload the project _projectChangedAction = Discard; - } else if (buttonName == QStringLiteral("pushButtonYesToAll")) { - // Reload all projects - _projectChangedAction = DiscardAll; } else if (buttonName == QStringLiteral("pushButtonNo")) { // Save the project _projectChangedAction = Save; - } else if (buttonName == QStringLiteral("pushButtonNoToAll")) { - // Save all projects - _projectChangedAction = SaveAll; } else { - // Should not happen but if we are save - _projectChangedAction = NoAction; + // Close the project + _projectChangedAction = Close; } QDialog::accept(); diff --git a/itemframework/src/project/project_changed_extern_dialog.h b/itemframework/src/project/project_changed_extern_dialog.h index 44ae445..2bbe75f 100644 --- a/itemframework/src/project/project_changed_extern_dialog.h +++ b/itemframework/src/project/project_changed_extern_dialog.h @@ -7,10 +7,8 @@ class QTextEdit; enum ProjectChangedAction { Save, - SaveAll, Discard, - DiscardAll, - NoAction + Close }; namespace Ui diff --git a/itemframework/src/project/project_changed_extern_dialog.ui b/itemframework/src/project/project_changed_extern_dialog.ui index 0ad7718..06c01c4 100644 --- a/itemframework/src/project/project_changed_extern_dialog.ui +++ b/itemframework/src/project/project_changed_extern_dialog.ui @@ -32,20 +32,7 @@ - Yes - - - - - - - false - - - - - - Yes to all + &Yes @@ -55,27 +42,14 @@ - No - - - - - - - false - - - - - - No to all + &No - Details... + &Details... true @@ -88,7 +62,7 @@ - Close + &Close @@ -102,7 +76,7 @@ pushButtonClose clicked() ProjectChangedExternDialog - reject() + accept() 774 @@ -130,22 +104,6 @@ - - pushButtonNoToAll - clicked() - ProjectChangedExternDialog - accept() - - - 603 - 129 - - - 433 - 88 - - - pushButtonYes clicked() @@ -162,22 +120,6 @@ - - pushButtonYesToAll - clicked() - ProjectChangedExternDialog - accept() - - - 262 - 129 - - - 433 - 88 - - - pushButtonDetails toggled(bool) diff --git a/itemframework/src/project/project_gui.cpp b/itemframework/src/project/project_gui.cpp index 1b853f3..ac48155 100644 --- a/itemframework/src/project/project_gui.cpp +++ b/itemframework/src/project/project_gui.cpp @@ -21,7 +21,6 @@ ProjectGui::ProjectGui(AbstractWorkspaceGui* parent, QSharedPointername(); - _projectName = _project->name(); connect(GuiManager::instance(), &GuiManager::mainWindowActivationChange, this, &ProjectGui::onMainWindowActivationChanged); connect(_project.data(), &AbstractProject::stateChange, this, &ProjectGui::onStateChanged); connect(_project.data(), &AbstractProject::externDomChange, this, &ProjectGui::onExternDomChanged); @@ -169,6 +168,8 @@ void ProjectGui::reset() _project->reset(); if (isLoaded()) { + _realSceneChangedFlag = false; + if (!reloadDomDocument() || !isValid()) { QMessageBox::warning(0, tr("Error loading Project"), tr("Project is invalid.")); unload(); @@ -178,24 +179,33 @@ void ProjectGui::reset() bool ProjectGui::save(bool autosave) { + QDomDocument projectDomDocumentTemplate = _project->projectDomDocumentTemplate( _project->name(), + _project->version(), + _project->description()); + QDomElement projectRootDomElement = projectDomDocumentTemplate.documentElement(); + ItemView* tmpItemView = nullptr; + if (isLoaded()) { - QDomDocument projectDomDocumentTemplate = _project->projectDomDocumentTemplate(_project->name(), - _project->version(), - _project->description()); - QDomElement projectRootDomElement = projectDomDocumentTemplate.documentElement(); - _itemView->save(projectDomDocumentTemplate, projectRootDomElement); - - - if (_project->setDomDocument(projectDomDocumentTemplate)) { - if (autosave) { - return _project->autosave(); - } else { - return _project->save(); - } - } + tmpItemView = _itemView; + } else { + tmpItemView = new ItemView(sharedFromThis()); + } + + tmpItemView->save(projectDomDocumentTemplate, projectRootDomElement); + + if (!_project->setDomDocument(projectDomDocumentTemplate)) { + return false; + } + + if (autosave) { + return _project->autosave(); + } else { + return _project->save(); } - return false; + if(!isLoaded()) { + delete tmpItemView; + } } bool ProjectGui::load() @@ -405,15 +415,8 @@ void ProjectGui::showProjectChangedByExternalDialog() reset(); break; - case ProjectChangedAction::SaveAll: - _parent->saveExternChangedProjects(); - break; - - case ProjectChangedAction::DiscardAll: - _parent->resetExternChangedProjects(); - break; - - default: + case ProjectChangedAction::Close: + _parent->unloadProject(sharedFromThis()); break; } } @@ -521,9 +524,13 @@ void ProjectGui::onEditTrigger() void ProjectGui::onItemViewSceneChanged() { _project->setDirty(true); + _realSceneChangedFlag = true; } void ProjectGui::onAutosaveTimeout() { - save(true); + if(_realSceneChangedFlag){ + _realSceneChangedFlag = false; + save(true); + } } diff --git a/itemframework/src/project/project_gui.h b/itemframework/src/project/project_gui.h index e7b4def..52fd126 100644 --- a/itemframework/src/project/project_gui.h +++ b/itemframework/src/project/project_gui.h @@ -59,12 +59,12 @@ class ProjectGui : public QObject, public QEnableSharedFromThis bool _isLoaded = false; int _tabWidgetIndex = -1; QString _projectGuiLabel; - QString _projectName; QString _description; bool _domChanged = false; QString _lastError; QPoint _dialogPositionOffset; QPointer _projectInfoDialog; + bool _realSceneChangedFlag = false; signals: void projectGuiLabelChanged(QSharedPointer projectGui); diff --git a/itemframework/src/project/project_manager_config.h b/itemframework/src/project/project_manager_config.h index 998a326..a3fc0ec 100644 --- a/itemframework/src/project/project_manager_config.h +++ b/itemframework/src/project/project_manager_config.h @@ -37,6 +37,7 @@ // Dir Locations #define HomeFolderUser QStandardPaths::writableLocation(QStandardPaths::HomeLocation) +#define DefaultWorkspaceFolder QString("%1/%2").arg(HomeFolderUser).arg(QStringLiteral("Workspace")) #define TravizWorkDirectory "settingWorkDirectory" // File extensions diff --git a/itemframework/src/project/project_manager_gui.cpp b/itemframework/src/project/project_manager_gui.cpp index aed0ae7..bb7f003 100644 --- a/itemframework/src/project/project_manager_gui.cpp +++ b/itemframework/src/project/project_manager_gui.cpp @@ -94,14 +94,18 @@ AbstractWorkspaceGui* ProjectManagerGui::abstractWorkspaceGuiClass( const QSharedPointer& workspace, const QVector& workspaceGuis) { - // Find correct parent workspace gui class. - for (AbstractWorkspaceGui* workspaceGui : workspaceGuis) { - if (workspaceGui->isTypeFriendly(workspace)) { - return workspaceGui; + if(!workspace.isNull()){ + + // Find correct parent workspace gui class. + for (AbstractWorkspaceGui* workspaceGui : workspaceGuis) { + if (workspaceGui->isTypeFriendly(workspace)) { + return workspaceGui; + } } + + qWarning() << QString("No present WorkspaceGui class was matched with Workspace %1.").arg(workspace->metaObject()->className()); } - qWarning() << QString("No present WorkspaceGui class was matched with Workspace %1.").arg(workspace->metaObject()->className()); return nullptr; } @@ -118,8 +122,6 @@ void ProjectManagerGui::updateMenuEntries() // Create new qaction for every recent used workspace. QAction* action = new QAction(workspace->name(), _menuWorkspaces); - // Store abstract workspace as qvariant data in qaction object. - action->setData(QVariant::fromValue(workspace)); if (!currentWorkspace.isNull() && workspace->compare(currentWorkspace)) { // If workspace is "current workspace" then mark entry (black square pixmap icon). @@ -127,7 +129,11 @@ void ProjectManagerGui::updateMenuEntries() } // Connect action trigger to switch workspace. - connect(action, &QAction::triggered, this, &ProjectManagerGui::onSwitchWorkspaceAction); + connect(action, &QAction::triggered, [this, workspace](){ + if (!openWorkspace(workspace)) { + qWarning() << QString("Switch to workspace %1 failed.").arg(workspace->name()); + } + }); if (!workspace->isValid()) { action->setDisabled(true); @@ -138,13 +144,12 @@ void ProjectManagerGui::updateMenuEntries() _menuWorkspaces->addAction(action); } - if(!currentWorkspace.isNull()){ - AbstractWorkspaceGui* abstractWorkspaceGui = abstractWorkspaceGuiClass(currentWorkspace, _abstractWorkspaceGuiClasses); - if(abstractWorkspaceGui != nullptr){ - abstractWorkspaceGui->setSwitchWorkspaceMenu(_menuWorkspaces); - } + AbstractWorkspaceGui* abstractWorkspaceGui = abstractWorkspaceGuiClass(currentWorkspace, _abstractWorkspaceGuiClasses); + if(abstractWorkspaceGui != nullptr){ + abstractWorkspaceGui->setSwitchWorkspaceMenu(_menuWorkspaces); } - // Set updated submenu to switch workspace fast to main menu entry "Workspaces" + + // Set updated submenu to switch workspace fast to main menu entry "Workspaces" actionWorkspaces->setMenu(_menuWorkspaces); } @@ -228,7 +233,6 @@ bool ProjectManagerGui::openWorkspace(QSharedPointer workspac _lastError = tr("Workspace is null."); return false; } - _lastError.clear(); if (!workspace->test()) { @@ -237,38 +241,23 @@ bool ProjectManagerGui::openWorkspace(QSharedPointer workspac } _lastError.clear(); - // Close current workspace - QSharedPointer currentWorkspace = _projectManager->currentWorkspace(); - AbstractWorkspaceGui* abstractWorkspaceGui = nullptr; - - if (!currentWorkspace.isNull()) { - if (currentWorkspace->compare(workspace)) { - _lastError = tr("Workspace %1 is already open").arg(workspace->name()); - return false; - } - - _lastError.clear(); - - if (!closeWorkspace()) { - _lastError = tr("Could not close Workspace %1.").arg(workspace->name()); - return false; - } - _lastError.clear(); - abstractWorkspaceGui = abstractWorkspaceGuiClass(currentWorkspace, _abstractWorkspaceGuiClasses); - if (abstractWorkspaceGui != nullptr) { - disconnect(abstractWorkspaceGui, &AbstractWorkspaceGui::switchWorkspace, this, &ProjectManagerGui::onSwitchWorkspaceAction); - } + if(workspace->compare(_projectManager->currentWorkspace())){ + _lastError = tr("Workspace %1 is already open").arg(workspace->name()); + return false; } + _lastError.clear(); + + // Close current workspace + closeWorkspace(); // Link new workspace to gui workspace class - abstractWorkspaceGui = abstractWorkspaceGuiClass(workspace, _abstractWorkspaceGuiClasses); + AbstractWorkspaceGui* abstractWorkspaceGui = abstractWorkspaceGuiClass(workspace, _abstractWorkspaceGuiClasses); if (abstractWorkspaceGui == nullptr) { _lastError = tr("No present WorkspaceGui class was matched with Workspace %1.").arg(workspace->name()); return false; } - _lastError.clear(); // Open workspace. @@ -276,13 +265,11 @@ bool ProjectManagerGui::openWorkspace(QSharedPointer workspac _lastError = tr("Error open Workspace %1.").arg(workspace->name()); return false; } - _lastError.clear(); // Set current workspace, update menu and connect workspace to switch workspace slot _projectManager->setCurrentWorkspace(workspace); updateMenuEntries(); - connect(abstractWorkspaceGui, &AbstractWorkspaceGui::switchWorkspace, this, &ProjectManagerGui::onSwitchWorkspaceAction); return true; } @@ -316,28 +303,6 @@ void ProjectManagerGui::openWorkspaceManager() showSelectWorkspaceDialog(); } -void ProjectManagerGui::onSwitchWorkspaceAction() -{ - // Get sender qobject and cast it to qaction. - QAction* action = qobject_cast(sender()); - - if (action != nullptr) { - // Handle the data property -> get selected workspace and switch. - QSharedPointer workspace = action->data().value>(); - - if (workspace.isNull()) { - qWarning() << QString("Workspace cast failed. Workspace is null"); - return; - } - - if (!openWorkspace(workspace)) { - qWarning() << QString("Action button switch to workspace %1 failed.").arg(workspace->name()); - } - } else { - qWarning() << QString("Error - qobject_cast faild. Could not cast to QAction"); - } -} - void ProjectManagerGui::onWorkspaceNameChanged(const QString& workspaceName) { Q_UNUSED(workspaceName); @@ -347,6 +312,7 @@ void ProjectManagerGui::onWorkspaceNameChanged(const QString& workspaceName) void ProjectManagerGui::onWorkspaceUpdated() { _projectManager->saveRecentWorkspacesSettings(); + updateMenuEntries(); } void ProjectManagerGui::onRecentWorkspaceListChanged() diff --git a/itemframework/src/project/project_manager_gui.h b/itemframework/src/project/project_manager_gui.h index 33286f2..a88b067 100644 --- a/itemframework/src/project/project_manager_gui.h +++ b/itemframework/src/project/project_manager_gui.h @@ -55,7 +55,6 @@ class ProjectManagerGui : public QObject, public Singleton private slots: void openWorkspaceManager(); - void onSwitchWorkspaceAction(); void onWorkspaceNameChanged(const QString& workspaceName); void onWorkspaceUpdated(); void onRecentWorkspaceListChanged(); diff --git a/itemframework/src/project/select_workspace_dialog.cpp b/itemframework/src/project/select_workspace_dialog.cpp index b6a376e..6f8a3ec 100644 --- a/itemframework/src/project/select_workspace_dialog.cpp +++ b/itemframework/src/project/select_workspace_dialog.cpp @@ -247,7 +247,11 @@ void SelectWorkspaceDialog::showContextMenu(const QPoint& position, const QShare } if(workspace->isValid()){ - connect(actionEditWorkspace, &QAction::triggered, this, &SelectWorkspaceDialog::showDialogEditWorkspace); + connect(actionEditWorkspace, &QAction::triggered, [this, workspace](){ + AbstractWorkspaceGui* workspaceGui = ProjectManagerGui::abstractWorkspaceGuiClass(workspace, _workspaceGuiVector); + QDialog* editWorkspaceDialog = workspaceGui->dialogEditWorkspace(0, workspace); + editWorkspaceDialog->exec(); + }); connect(actionDeleteWorkspace, &QAction::triggered, this, &SelectWorkspaceDialog::deleteWorkspace); connect(actionSetDefault, &QAction::toggled, this, &SelectWorkspaceDialog::defaultWorkspaceChange); } else { @@ -311,29 +315,20 @@ void SelectWorkspaceDialog::loadRecentUsedWorkspace(QTreeWidgetItem* item, int c item->setToolTip(TreeWidgetColumn::Connection, QString("")); } - acceptWorkspace(workspace); + setSelectedWorkspace(workspace); + accept(); } } void SelectWorkspaceDialog::setSelectedWorkspace(const QSharedPointer& workspace) { - clearSelectedWorkspace(); _selectedWorkspace = workspace; - - if (!_selectedWorkspace.isNull()) { - _ui->buttonAcceptDialog->setEnabled(true); - } else { - _ui->buttonAcceptDialog->setEnabled(false); - } + _ui->buttonAcceptDialog->setEnabled(true); } void SelectWorkspaceDialog::clearSelectedWorkspace() { - if (!_selectedWorkspace.isNull()) { - disconnect(_selectedWorkspace.data()); - _selectedWorkspace.clear(); - } - + _selectedWorkspace.clear(); _ui->buttonAcceptDialog->setEnabled(false); } @@ -473,27 +468,8 @@ void SelectWorkspaceDialog::showDialogLoadWorkspace() void SelectWorkspaceDialog::showDialogEditWorkspace() { - QPushButton* button = qobject_cast(sender()); - - // Item (workspace) is selected in treewidget and this action was performed by item context menue (edit workspace). - if (button == nullptr) { - QList items = _ui->treeWidgetRecentWorkspace->selectedItems(); - - if (!items.isEmpty()) { - auto workspace = items.first()->data(TreeWidgetColumn::Workspace, Qt::UserRole).value>(); - - if (!workspace.isNull()) { - AbstractWorkspaceGui* workspaceGui = ProjectManagerGui::abstractWorkspaceGuiClass(workspace, _workspaceGuiVector); - QDialog* editWorkspaceDialog = workspaceGui->dialogEditWorkspace(0, workspace); - editWorkspaceDialog->exec(); - return; - } - } - } else { - // No item (workspace) is selected in treewidget and this action was performed by the edit button - QDialog* dialogEditWorkspace = createDialogWorkspaceGui(WorkspaceGuiType::editWorkspace, _workspaceGuiVector); - dialogEditWorkspace->exec(); - } + QDialog* dialogEditWorkspace = createDialogWorkspaceGui(WorkspaceGuiType::editWorkspace, _workspaceGuiVector); + dialogEditWorkspace->exec(); } void SelectWorkspaceDialog::onWorkspaceUpdated() diff --git a/itemframework/src/project/sql_workspace_gui.cpp b/itemframework/src/project/sql_workspace_gui.cpp index bb85cdf..a0f8164 100644 --- a/itemframework/src/project/sql_workspace_gui.cpp +++ b/itemframework/src/project/sql_workspace_gui.cpp @@ -16,13 +16,13 @@ QString SqlWorkspaceGui::workspaceTypeName() const return QStringLiteral("Sql Workspace"); } -QDialog* SqlWorkspaceGui::dialogNewWorkspace(QDialog* parent) const +QDialog* SqlWorkspaceGui::dialogNewWorkspace(QDialog* parent) { Q_UNUSED(parent); return new QDialog(); } -QDialog* SqlWorkspaceGui::dialogLoadWorkspace(QDialog* parent) const +QDialog* SqlWorkspaceGui::dialogLoadWorkspace(QDialog* parent) { Q_UNUSED(parent); return new QDialog(); diff --git a/itemframework/src/project/sql_workspace_gui.h b/itemframework/src/project/sql_workspace_gui.h index 713f626..2d12514 100644 --- a/itemframework/src/project/sql_workspace_gui.h +++ b/itemframework/src/project/sql_workspace_gui.h @@ -13,8 +13,8 @@ class SqlWorkspaceGui : public AbstractWorkspaceGui Q_INVOKABLE SqlWorkspaceGui(); void addListWidgetItem(QListWidget* parentListWidget) Q_DECL_OVERRIDE; QString workspaceTypeName() const Q_DECL_OVERRIDE; - QDialog* dialogNewWorkspace(QDialog* parent = 0) const Q_DECL_OVERRIDE; - QDialog* dialogLoadWorkspace(QDialog* parent = 0) const Q_DECL_OVERRIDE; + QDialog* dialogNewWorkspace(QDialog* parent = 0) Q_DECL_OVERRIDE; + QDialog* dialogLoadWorkspace(QDialog* parent = 0) Q_DECL_OVERRIDE; QDialog* dialogEditWorkspace(QDialog* parent = 0, QSharedPointer workspace = QSharedPointer()) const Q_DECL_OVERRIDE; bool isTypeFriendly(const QSharedPointer& workspace) const Q_DECL_OVERRIDE; bool removeProject(const QSharedPointer& projectGui, bool showMessagebox = true) Q_DECL_OVERRIDE;