From 7cba5fc48222b3bd34a0aa77261a7fc452006f35 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 8 Dec 2017 13:42:19 +0100 Subject: Move RemoveFileDialog to Utils Change-Id: I88892fc8d43ca3f59598b5b44e0daac0bfb439b5 Reviewed-by: Tobias Hunger --- src/libs/utils/removefiledialog.cpp | 59 +++++++++ src/libs/utils/removefiledialog.h | 51 ++++++++ src/libs/utils/removefiledialog.ui | 140 +++++++++++++++++++++ src/libs/utils/utils-lib.pri | 11 +- src/libs/utils/utils.qbs | 1 + src/plugins/coreplugin/coreplugin.pro | 3 - src/plugins/coreplugin/coreplugin.qbs | 1 - src/plugins/coreplugin/removefiledialog.cpp | 57 --------- src/plugins/coreplugin/removefiledialog.h | 51 -------- src/plugins/coreplugin/removefiledialog.ui | 140 --------------------- src/plugins/projectexplorer/projectexplorer.cpp | 6 +- .../resourceeditor/qrceditor/resourcefile.cpp | 4 +- 12 files changed, 263 insertions(+), 261 deletions(-) create mode 100644 src/libs/utils/removefiledialog.cpp create mode 100644 src/libs/utils/removefiledialog.h create mode 100644 src/libs/utils/removefiledialog.ui delete mode 100644 src/plugins/coreplugin/removefiledialog.cpp delete mode 100644 src/plugins/coreplugin/removefiledialog.h delete mode 100644 src/plugins/coreplugin/removefiledialog.ui (limited to 'src') diff --git a/src/libs/utils/removefiledialog.cpp b/src/libs/utils/removefiledialog.cpp new file mode 100644 index 0000000000..0d2208cff8 --- /dev/null +++ b/src/libs/utils/removefiledialog.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "removefiledialog.h" +#include "ui_removefiledialog.h" + +#include + +namespace Utils { + +RemoveFileDialog::RemoveFileDialog(const QString &filePath, QWidget *parent) : + QDialog(parent), + m_ui(new Ui::RemoveFileDialog) +{ + m_ui->setupUi(this); + m_ui->fileNameLabel->setText(QDir::toNativeSeparators(filePath)); + + // TODO + m_ui->removeVCCheckBox->setVisible(false); +} + +RemoveFileDialog::~RemoveFileDialog() +{ + delete m_ui; +} + +void RemoveFileDialog::setDeleteFileVisible(bool visible) +{ + m_ui->deleteFileCheckBox->setVisible(visible); +} + +bool RemoveFileDialog::isDeleteFileChecked() const +{ + return m_ui->deleteFileCheckBox->isChecked(); +} + +} // Utils diff --git a/src/libs/utils/removefiledialog.h b/src/libs/utils/removefiledialog.h new file mode 100644 index 0000000000..459917e1f8 --- /dev/null +++ b/src/libs/utils/removefiledialog.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "utils_global.h" + +#include + +namespace Utils { + +namespace Ui { class RemoveFileDialog; } + +class QTCREATOR_UTILS_EXPORT RemoveFileDialog : public QDialog +{ + Q_OBJECT + +public: + explicit RemoveFileDialog(const QString &filePath, QWidget *parent = 0); + virtual ~RemoveFileDialog(); + + void setDeleteFileVisible(bool visible); + bool isDeleteFileChecked() const; + +private: + Ui::RemoveFileDialog *m_ui; +}; + +} // namespace Utils diff --git a/src/libs/utils/removefiledialog.ui b/src/libs/utils/removefiledialog.ui new file mode 100644 index 0000000000..88314065b8 --- /dev/null +++ b/src/libs/utils/removefiledialog.ui @@ -0,0 +1,140 @@ + + + Utils::RemoveFileDialog + + + + 0 + 0 + 514 + 159 + + + + + 0 + 0 + + + + Remove File + + + + + + + 0 + 0 + + + + File to remove: + + + + + + + + 0 + 0 + + + + + Courier New + + + + placeholder + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + &Delete file permanently + + + + + + + &Remove from Version Control + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + Utils::RemoveFileDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Utils::RemoveFileDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri index 268ab2597d..e64adf9c90 100644 --- a/src/libs/utils/utils-lib.pri +++ b/src/libs/utils/utils-lib.pri @@ -120,7 +120,8 @@ SOURCES += \ $$PWD/textutils.cpp \ $$PWD/url.cpp \ $$PWD/filecrumblabel.cpp \ - $$PWD/fixedsizeclicklabel.cpp + $$PWD/fixedsizeclicklabel.cpp \ + $$PWD/removefiledialog.cpp win32:SOURCES += $$PWD/consoleprocess_win.cpp else:SOURCES += $$PWD/consoleprocess_unix.cpp @@ -256,12 +257,14 @@ HEADERS += \ $$PWD/filecrumblabel.h \ $$PWD/linecolumn.h \ $$PWD/link.h \ - $$PWD/fixedsizeclicklabel.h + $$PWD/fixedsizeclicklabel.h \ + $$PWD/removefiledialog.h FORMS += $$PWD/filewizardpage.ui \ - $$PWD/projectintropage.ui \ $$PWD/newclasswidget.ui \ - $$PWD/proxycredentialsdialog.ui + $$PWD/projectintropage.ui \ + $$PWD/proxycredentialsdialog.ui \ + $$PWD/removefiledialog.ui RESOURCES += $$PWD/utils.qrc diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs index 5606c114ba..61895256cf 100644 --- a/src/libs/utils/utils.qbs +++ b/src/libs/utils/utils.qbs @@ -193,6 +193,7 @@ Project { "qtcprocess.h", "reloadpromptutils.cpp", "reloadpromptutils.h", + "removefiledialog.cpp", "removefiledialog.h", "removefiledialog.ui", "runextensions.cpp", "runextensions.h", "savedaction.cpp", diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index 5e6e934b76..dd6f03bdaa 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -100,7 +100,6 @@ SOURCES += corejsextensions.cpp \ idocumentfactory.cpp \ textdocument.cpp \ documentmanager.cpp \ - removefiledialog.cpp \ iversioncontrol.cpp \ dialogs/addtovcsdialog.cpp \ ioutputpane.cpp \ @@ -214,7 +213,6 @@ HEADERS += corejsextensions.h \ idocumentfactory.h \ textdocument.h \ documentmanager.h \ - removefiledialog.h \ dialogs/addtovcsdialog.h \ patchtool.h \ windowsupport.h \ @@ -234,7 +232,6 @@ FORMS += dialogs/newdialog.ui \ dialogs/externaltoolconfig.ui \ mimetypesettingspage.ui \ mimetypemagicdialog.ui \ - removefiledialog.ui \ dialogs/addtovcsdialog.ui \ systemsettings.ui diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs index 02ae8a768d..eabf668df7 100644 --- a/src/plugins/coreplugin/coreplugin.qbs +++ b/src/plugins/coreplugin/coreplugin.qbs @@ -89,7 +89,6 @@ Project { "patchtool.cpp", "patchtool.h", "plugindialog.cpp", "plugindialog.h", "reaper.cpp", "reaper.h", "reaper_p.h", - "removefiledialog.cpp", "removefiledialog.h", "removefiledialog.ui", "rightpane.cpp", "rightpane.h", "settingsdatabase.cpp", "settingsdatabase.h", "shellcommand.cpp", "shellcommand.h", diff --git a/src/plugins/coreplugin/removefiledialog.cpp b/src/plugins/coreplugin/removefiledialog.cpp deleted file mode 100644 index b7e6af6942..0000000000 --- a/src/plugins/coreplugin/removefiledialog.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "removefiledialog.h" -#include "ui_removefiledialog.h" - -#include - -using namespace Core; - -RemoveFileDialog::RemoveFileDialog(const QString &filePath, QWidget *parent) : - QDialog(parent), - m_ui(new Ui::RemoveFileDialog) -{ - m_ui->setupUi(this); - m_ui->fileNameLabel->setText(QDir::toNativeSeparators(filePath)); - - // TODO - m_ui->removeVCCheckBox->setVisible(false); -} - -RemoveFileDialog::~RemoveFileDialog() -{ - delete m_ui; -} - -void RemoveFileDialog::setDeleteFileVisible(bool visible) -{ - m_ui->deleteFileCheckBox->setVisible(visible); -} - -bool RemoveFileDialog::isDeleteFileChecked() const -{ - return m_ui->deleteFileCheckBox->isChecked(); -} diff --git a/src/plugins/coreplugin/removefiledialog.h b/src/plugins/coreplugin/removefiledialog.h deleted file mode 100644 index f79dc82e02..0000000000 --- a/src/plugins/coreplugin/removefiledialog.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "core_global.h" - -#include - -namespace Core { - -namespace Ui { class RemoveFileDialog; } - -class CORE_EXPORT RemoveFileDialog : public QDialog -{ - Q_OBJECT - -public: - explicit RemoveFileDialog(const QString &filePath, QWidget *parent = 0); - virtual ~RemoveFileDialog(); - - void setDeleteFileVisible(bool visible); - bool isDeleteFileChecked() const; - -private: - Ui::RemoveFileDialog *m_ui; -}; - -} // namespace Core diff --git a/src/plugins/coreplugin/removefiledialog.ui b/src/plugins/coreplugin/removefiledialog.ui deleted file mode 100644 index 1c89bc6e36..0000000000 --- a/src/plugins/coreplugin/removefiledialog.ui +++ /dev/null @@ -1,140 +0,0 @@ - - - Core::RemoveFileDialog - - - - 0 - 0 - 514 - 159 - - - - - 0 - 0 - - - - Remove File - - - - - - - 0 - 0 - - - - File to remove: - - - - - - - - 0 - 0 - - - - - Courier New - - - - placeholder - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - &Delete file permanently - - - - - - - &Remove from Version Control - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Core::RemoveFileDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Core::RemoveFileDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index a8e98d32a6..31054027fb 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -113,7 +113,6 @@ #include #include #include -#include #include #include #include @@ -128,6 +127,7 @@ #include #include #include +#include #include #include @@ -3221,7 +3221,7 @@ void ProjectExplorerPluginPrivate::removeProject() return; ProjectNode *projectNode = subProjectNode->managingProject(); if (projectNode) { - RemoveFileDialog removeFileDialog(subProjectNode->filePath().toString(), ICore::mainWindow()); + Utils::RemoveFileDialog removeFileDialog(subProjectNode->filePath().toString(), ICore::mainWindow()); removeFileDialog.setDeleteFileVisible(false); if (removeFileDialog.exec() == QDialog::Accepted) projectNode->removeSubProject(subProjectNode->filePath().toString()); @@ -3262,7 +3262,7 @@ void ProjectExplorerPluginPrivate::removeFile() QTC_ASSERT(currentNode && currentNode->nodeType() == NodeType::File, return); const Utils::FileName filePath = currentNode->filePath(); - RemoveFileDialog removeFileDialog(filePath.toString(), ICore::mainWindow()); + Utils::RemoveFileDialog removeFileDialog(filePath.toString(), ICore::mainWindow()); if (removeFileDialog.exec() == QDialog::Accepted) { const bool deleteFile = removeFileDialog.isDeleteFileChecked(); diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp index 5e17105cfa..a38a94da52 100644 --- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp +++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp @@ -28,10 +28,10 @@ #include #include #include -#include #include #include #include +#include #include #include @@ -1234,7 +1234,7 @@ EntryBackup * RelativeResourceModel::removeEntry(const QModelIndex &index) deleteItem(index); return new FileEntryBackup(*this, prefixIndex.row(), index.row(), fileNameBackup, aliasBackup); } - Core::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::mainWindow()); + Utils::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::mainWindow()); if (removeFileDialog.exec() == QDialog::Accepted) { deleteItem(index); Core::FileUtils::removeFile(fileNameBackup, removeFileDialog.isDeleteFileChecked()); -- cgit v1.2.1