aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmakeprojectmanager
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmakeprojectmanager')
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro6
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs3
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp193
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/libraryparameters.h64
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp161
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizard.h48
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp347
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h78
9 files changed, 0 insertions, 902 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
index 6b5890ecf1..a56131074e 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
@@ -19,9 +19,6 @@ HEADERS += \
profilehighlighter.h \
profilehoverhandler.h \
wizards/qtprojectparameters.h \
- wizards/libraryparameters.h \
- wizards/librarywizard.h \
- wizards/librarywizarddialog.h \
wizards/modulespage.h \
wizards/filespage.h \
wizards/qtwizard.h \
@@ -57,9 +54,6 @@ SOURCES += \
profilehighlighter.cpp \
profilehoverhandler.cpp \
wizards/qtprojectparameters.cpp \
- wizards/libraryparameters.cpp \
- wizards/librarywizard.cpp \
- wizards/librarywizarddialog.cpp \
wizards/modulespage.cpp \
wizards/filespage.cpp \
wizards/qtwizard.cpp \
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
index 08a6d21b14..b510c40348 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
@@ -78,9 +78,6 @@ Project {
prefix: "wizards/"
files: [
"filespage.cpp", "filespage.h",
- "libraryparameters.cpp", "libraryparameters.h",
- "librarywizard.cpp", "librarywizard.h",
- "librarywizarddialog.cpp", "librarywizarddialog.h",
"modulespage.cpp", "modulespage.h",
"qtprojectparameters.cpp", "qtprojectparameters.h",
"qtwizard.cpp", "qtwizard.h",
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
index 98a3adf8b9..a6c256db80 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
@@ -33,7 +33,6 @@
#include "qmakemakestep.h"
#include "qmakebuildconfiguration.h"
#include "desktopqmakerunconfiguration.h"
-#include "wizards/librarywizard.h"
#include "wizards/simpleprojectwizard.h"
#include "wizards/subdirsprojectwizard.h"
#include "customwidgetwizard/customwidgetwizard.h"
@@ -150,7 +149,6 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
IWizardFactory::registerFactoryCreator([] {
return QList<IWizardFactory *> {
new SubdirsProjectWizard,
- new LibraryWizard,
new CustomWidgetWizard,
new SimpleProjectWizard
};
diff --git a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp
deleted file mode 100644
index 83217ce2bf..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp
+++ /dev/null
@@ -1,193 +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 "libraryparameters.h"
-#include "librarywizarddialog.h"
-
-#include <utils/codegeneration.h>
-#include <utils/qtcassert.h>
-
-#include <QTextStream>
-#include <QStringList>
-
-#include <cstring>
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-void LibraryParameters::generateCode(QtProjectParameters:: Type t,
- const QString &headerName,
- const QString &sharedHeader,
- const QString &exportMacro,
- const QString &pluginJsonFileName,
- int indentation,
- bool usePragmaOnce,
- QString *header,
- QString *source) const
-{
- QTextStream headerStr(header);
-
- const QString indent = QString(indentation, QLatin1Char(' '));
-
- // Do we have namespaces?
- QStringList namespaceList = className.split(QLatin1String("::"));
- if (namespaceList.empty()) // Paranoia!
- return;
-
- const QString unqualifiedClassName = namespaceList.takeLast();
-
- // 1) Header
- const QString guard = Utils::headerGuard(headerFileName, namespaceList);
- if (usePragmaOnce)
- headerStr << "#pragma once\n\n";
- else
- headerStr << "#ifndef " << guard << "\n#define " << guard << "\n\n";
-
- if (!sharedHeader.isEmpty())
- Utils::writeIncludeFileDirective(sharedHeader, false, headerStr);
-
- // include base class header
- if (!baseClassName.isEmpty()) {
- Utils::writeIncludeFileDirective(baseClassName, true, headerStr);
- headerStr << '\n';
- }
-
- const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, indent, headerStr);
-
- // Class declaraction
- if (!namespaceIndent.isEmpty())
- headerStr << '\n';
- headerStr << namespaceIndent << "class ";
- if (t == QtProjectParameters::SharedLibrary && !exportMacro.isEmpty())
- headerStr << exportMacro << ' ';
-
- headerStr << unqualifiedClassName;
- if (!baseClassName.isEmpty())
- headerStr << " : public " << baseClassName;
- headerStr << "\n{\n";
-
- // Is this a QObject (plugin)
- const bool inheritsQObject = t == QtProjectParameters::QtPlugin;
- if (inheritsQObject)
- headerStr << namespaceIndent << indent << "Q_OBJECT\n";
- if (t == QtProjectParameters::QtPlugin) { // Write Qt plugin meta data.
- const QString qt5InterfaceName = LibraryWizardDialog::pluginInterface(baseClassName);
- QTC_CHECK(!qt5InterfaceName.isEmpty());
- headerStr << namespaceIndent << indent << "Q_PLUGIN_METADATA(IID \""
- << qt5InterfaceName << '"';
- QTC_CHECK(!pluginJsonFileName.isEmpty());
- headerStr << " FILE \"" << pluginJsonFileName << '"';
- headerStr << ")\n";
- }
-
- headerStr << namespaceIndent << "\npublic:\n";
- if (inheritsQObject) {
- headerStr << namespaceIndent << indent << "explicit " << unqualifiedClassName
- << "(QObject *parent = nullptr);\n";
- } else {
- headerStr << namespaceIndent << indent << unqualifiedClassName << "();\n";
- }
- if (!pureVirtualSignatures.empty()) {
- headerStr << "\nprivate:\n";
- for (const QString &signature : pureVirtualSignatures)
- headerStr << namespaceIndent << indent << signature << " override;\n";
- }
- headerStr << namespaceIndent << "};\n";
- if (!namespaceIndent.isEmpty())
- headerStr << '\n';
- Utils::writeClosingNameSpaces(namespaceList, indent, headerStr);
- if (!usePragmaOnce)
- headerStr << "\n#endif // " << guard << '\n';
-
- /// 2) Source
- QTextStream sourceStr(source);
-
- Utils::writeIncludeFileDirective(headerName, false, sourceStr);
- sourceStr << '\n';
-
- Utils::writeOpeningNameSpaces(namespaceList, indent, sourceStr);
- if (!namespaceIndent.isEmpty())
- sourceStr << '\n';
-
- // Constructor
- sourceStr << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName;
- if (inheritsQObject) {
- sourceStr << "(QObject *parent) :\n"
- << namespaceIndent << indent << baseClassName << "(parent)\n";
- } else {
- sourceStr << "()\n";
- }
- sourceStr << namespaceIndent << "{\n" << namespaceIndent << "}\n";
- for (const QString &signature : pureVirtualSignatures) {
- const int parenIndex = signature.indexOf('(');
- QTC_ASSERT(parenIndex != -1, continue);
- int nameIndex = -1;
- for (int i = parenIndex - 1; i > 0; --i) {
- if (!signature.at(i).isLetterOrNumber()) {
- nameIndex = i + 1;
- break;
- }
- }
- QTC_ASSERT(nameIndex != -1, continue);
- sourceStr << '\n' << namespaceIndent << signature.left(nameIndex);
- if (!std::strchr("&* ", signature.at(nameIndex - 1).toLatin1()))
- sourceStr << ' ';
- sourceStr << unqualifiedClassName << "::" << signature.mid(nameIndex) << '\n';
- sourceStr << namespaceIndent << "{\n" << indent
- << "static_assert(false, \"You need to implement this function\");\n}\n";
- }
-
- Utils::writeClosingNameSpaces(namespaceList, indent, sourceStr);
-}
-
-QString LibraryParameters::generateSharedHeader(const QString &globalHeaderFileName,
- const QString &projectTarget,
- const QString &exportMacro,
- bool usePragmaOnce)
-{
- QString contents;
- if (usePragmaOnce) {
- contents += "#pragma once\n";
- } else {
- contents += "#ifndef " + Utils::headerGuard(globalHeaderFileName) + "\n";
- contents += "#define " + Utils::headerGuard(globalHeaderFileName) + "\n";
- }
- contents += "\n";
- contents += "#include <QtCore/qglobal.h>\n";
- contents += "\n";
- contents += "#if defined(" + QtProjectParameters::libraryMacro(projectTarget) + ")\n";
- contents += "# define " + exportMacro + " Q_DECL_EXPORT\n";
- contents += "#else\n";
- contents += "# define " + exportMacro + " Q_DECL_IMPORT\n";
- contents += "#endif\n";
- contents += "\n";
- if (!usePragmaOnce)
- contents += "#endif // " + Utils::headerGuard(globalHeaderFileName) + '\n';
-
- return contents;
-}
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h
deleted file mode 100644
index 4fe7d00dc1..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h
+++ /dev/null
@@ -1,64 +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 "qtprojectparameters.h"
-
-#include <QStringList>
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-// Additional parameters required besides QtProjectParameters for creating
-// libraries
-struct LibraryParameters {
-
- // generate class
- void generateCode(QtProjectParameters:: Type t,
- const QString &headerName,
- const QString &sharedHeader,
- const QString &exportMacro,
- const QString &pluginJsonFileName,
- int indentation,
- bool usePragmaOnce,
- QString *header,
- QString *source) const;
-
- // Generate the code of the shared header containing the export macro
- static QString generateSharedHeader(const QString &globalHeaderFileName,
- const QString &projectTarget,
- const QString &exportMacro,
- bool usePragmaOnce);
-
- QString className;
- QString baseClassName;
- QString sourceFileName;
- QString headerFileName;
- QStringList pureVirtualSignatures;
-};
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp
deleted file mode 100644
index 239fec9c3f..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp
+++ /dev/null
@@ -1,161 +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 "librarywizard.h"
-#include "librarywizarddialog.h"
-
-#include <cpptools/abstracteditorsupport.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qtsupport/qtsupportconstants.h>
-
-#include <utils/fileutils.h>
-
-#include <QTextStream>
-#include <QCoreApplication>
-
-static const char sharedHeaderPostfixC[] = "_global";
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-LibraryWizard::LibraryWizard()
-{
- setId("H.Qt4Library");
- setCategory(QLatin1String(ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY));
- setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
- ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY_DISPLAY));
- setDisplayName(tr("C++ Library"));
- setDescription(tr("Creates a C++ library based on qmake. This can be used to create:<ul>"
- "<li>a shared C++ library for use with <tt>QPluginLoader</tt> and runtime (Plugins)</li>"
- "<li>a shared or static C++ library for use with another project at linktime</li></ul>"));
- setIcon(QIcon(QLatin1String(":/wizards/images/lib.png")));
- setRequiredFeatures({QtSupport::Constants::FEATURE_QT_PREFIX});
-}
-
-Core::BaseFileWizard *LibraryWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
-{
- LibraryWizardDialog *dialog = new LibraryWizardDialog(this, displayName(), icon(), parent, parameters);
- dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles());
- dialog->setProjectName(LibraryWizardDialog::uniqueProjectName(parameters.defaultPath()));
- dialog->setSuffixes(headerSuffix(), sourceSuffix(), formSuffix());
- return dialog;
-}
-
-static void writeLinuxProFile(QTextStream &str, const QtProjectParameters &params)
-{
- str << "\n"
- "unix {\n";
- if (!params.targetDirectory.isEmpty())
- str << " target.path = " << params.targetDirectory << '\n';
- else
- str << " target.path = /usr/lib\n";
- str << " INSTALLS += target\n"
- "}\n";
-}
-
-Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w,
- QString *errorMessage) const
-{
- Q_UNUSED(errorMessage)
- const auto *dialog = qobject_cast<const LibraryWizardDialog *>(w);
- const QtProjectParameters projectParams = dialog->parameters();
- const QString projectPath = projectParams.projectPath();
- const LibraryParameters params = dialog->libraryParameters();
- const bool usePragmaOnce = CppTools::AbstractEditorSupport::usePragmaOnce();
-
- const QString sharedLibExportMacro = QtProjectParameters::exportMacro(projectParams.fileName);
-
- Core::GeneratedFiles rc;
- // Class header + source
- const QString sourceFileName = buildFileName(projectPath, params.sourceFileName, sourceSuffix());
- Core::GeneratedFile source(sourceFileName);
- source.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
-
- const QString headerFileFullName = buildFileName(projectPath, params.headerFileName, headerSuffix());
- const QString headerFileName = Utils::FileName::fromString(headerFileFullName).fileName();
- QString pluginJsonFileFullName;
- QString pluginJsonFileName;
- if (projectParams.type == QtProjectParameters::QtPlugin) {
- pluginJsonFileFullName = buildFileName(projectPath, projectParams.fileName, QLatin1String("json"));
- pluginJsonFileName = Utils::FileName::fromString(pluginJsonFileFullName).fileName();
- }
-
- Core::GeneratedFile header(headerFileFullName);
-
- // Create files: global header for shared libs
- QString globalHeaderFileName;
- if (projectParams.type == QtProjectParameters::SharedLibrary) {
- const QString globalHeaderName = buildFileName(projectPath, projectParams.fileName.toLower() + QLatin1String(sharedHeaderPostfixC), headerSuffix());
- Core::GeneratedFile globalHeader(globalHeaderName);
- globalHeaderFileName = Utils::FileName::fromString(globalHeader.path()).fileName();
- globalHeader.setContents(CppTools::AbstractEditorSupport::licenseTemplate(globalHeaderFileName)
- + LibraryParameters::generateSharedHeader(globalHeaderFileName, projectParams.fileName, sharedLibExportMacro, usePragmaOnce));
- rc.push_back(globalHeader);
- }
-
- // Generate code
- QString headerContents, sourceContents;
- params.generateCode(projectParams.type, headerFileName,
- globalHeaderFileName, sharedLibExportMacro, pluginJsonFileName,
- /* indentation*/ 4, usePragmaOnce, &headerContents, &sourceContents);
-
- source.setContents(CppTools::AbstractEditorSupport::licenseTemplate(sourceFileName, params.className)
- + sourceContents);
- header.setContents(CppTools::AbstractEditorSupport::licenseTemplate(headerFileFullName, params.className)
- + headerContents);
- rc.push_back(source);
- rc.push_back(header);
- // Create files: profile
- const QString profileName = buildFileName(projectPath, projectParams.fileName, profileSuffix());
- Core::GeneratedFile profile(profileName);
- profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
- QString profileContents;
- {
- QTextStream proStr(&profileContents);
- QtProjectParameters::writeProFileHeader(proStr);
- projectParams.writeProFile(proStr);
- proStr << "\nSOURCES +="
- << " \\\n " << Utils::FileName::fromString(source.path()).fileName()
- << "\n\nHEADERS +="
- << " \\\n " << headerFileName;
- if (!globalHeaderFileName.isEmpty())
- proStr << " \\\n " << globalHeaderFileName << " \n";
- if (!pluginJsonFileName.isEmpty())
- proStr << "\nDISTFILES += " << pluginJsonFileName << " \n";
- writeLinuxProFile(proStr, projectParams);
- }
- profile.setContents(profileContents);
- rc.push_back(profile);
-
- if (!pluginJsonFileName.isEmpty()) {
- Core::GeneratedFile jsonFile(pluginJsonFileFullName);
- jsonFile.setContents(QLatin1String("{\n \"Keys\" : [ ]\n}\n"));
- rc.push_back(jsonFile);
- }
- return rc;
-}
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizard.h b/src/plugins/qmakeprojectmanager/wizards/librarywizard.h
deleted file mode 100644
index f7edeb5330..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizard.h
+++ /dev/null
@@ -1,48 +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 "qtwizard.h"
-#include "libraryparameters.h"
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-class LibraryWizard : public QtWizard
-{
- Q_OBJECT
-
-public:
- LibraryWizard();
-
-protected:
- Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const override;
-
- Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
-};
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
deleted file mode 100644
index 2aed6d43cd..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
+++ /dev/null
@@ -1,347 +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 "librarywizarddialog.h"
-#include "filespage.h"
-#include "libraryparameters.h"
-#include "modulespage.h"
-
-#include <utils/projectintropage.h>
-#include <projectexplorer/projectexplorerconstants.h>
-
-#include <QDebug>
-
-#include <QComboBox>
-#include <QLabel>
-
-enum { debugLibWizard = 0 };
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-struct PluginBaseClasses {
- const char *name;
- const char *module;
- QStringList pureVirtuals;
-
- // blank separated list or 0
- const char *dependentModules;
- const char *targetDirectory;
- const char *pluginInterface;
-};
-using QSL = QStringList;
-
-static const PluginBaseClasses pluginBaseClasses[] =
-{
- {"QAccessiblePlugin", "QtGui",
- QSL{"QAccessibleInterface *create(const QString &key, QObject *object)"},
- "QtCore", "accessible", "QAccessibleFactoryInterface"},
- {"QGenericPlugin", "QtGui", QSL{"QObject *create(const QString &name, const QString &spec)"},
- "QtCore", "generic", "QGenericPluginFactoryInterface"},
- {"QIconEnginePlugin", "QtGui", QSL{"QIconEngine *create(const QString &filename)"},
- "QtCore", "imageformats", "QIconEngineFactoryInterface"},
- {"QImageIOPlugin", "QtGui",
- QSL{"QImageIOPlugin::Capabilities capabilities(QIODevice *device, const QByteArray &format) const",
- "QImageIOHandler *create(QIODevice *device, const QByteArray &format) const"},
- "QtCore", "imageformats", "QImageIOHandlerFactoryInterface"},
- {"QScriptExtensionPlugin", "QtScript",
- QSL{"void initialize(const QString &key, QScriptEngine *engine)", "QStringList keys() const"},
- "QtCore", nullptr, "QScriptExtensionInterface"},
- {"QSqlDriverPlugin", "QtSql", QSL{"QSqlDriver *create(const QString &key)"},
- "QtCore", "sqldrivers", "QSqlDriverFactoryInterface"},
- {"QStylePlugin", "QtWidgets", QSL{"QStyle *create(const QString &key)"},
- "QtCore", "styles", "QStyleFactoryInterface"},
-};
-
-enum { defaultPluginBaseClass = 1 };
-
-static const PluginBaseClasses *findPluginBaseClass(const QString &name)
-{
- const int pluginBaseClassCount = sizeof(pluginBaseClasses)/sizeof(PluginBaseClasses);
- for (int i = 0; i < pluginBaseClassCount; i++)
- if (name == QLatin1String(pluginBaseClasses[i].name))
- return pluginBaseClasses + i;
- return nullptr;
-}
-
-// return dependencies of a plugin as a line ready for the 'QT=' line in a pro
-// file
-static QStringList pluginDependencies(const PluginBaseClasses *plb)
-{
- QStringList dependencies;
- const QChar blank = QLatin1Char(' ');
- // Find the module names and convert to ids
- QStringList pluginModules= plb->dependentModules ?
- QString::fromLatin1(plb->dependentModules).split(blank) :
- QStringList();
- pluginModules.push_back(QLatin1String(plb->module));
- foreach (const QString &module, pluginModules) {
- dependencies.append(ModulesPage::idOfModule(module));
- }
- return dependencies;
-}
-
-// A Project intro page with an additional type chooser.
-class LibraryIntroPage : public Utils::ProjectIntroPage
-{
-public:
- explicit LibraryIntroPage(QWidget *parent = nullptr);
-
- QtProjectParameters::Type type() const;
-
-private:
- QComboBox *m_typeCombo;
-};
-
-LibraryIntroPage::LibraryIntroPage(QWidget *parent) :
- Utils::ProjectIntroPage(parent),
- m_typeCombo(new QComboBox)
-{
- m_typeCombo->setEditable(false);
- m_typeCombo->addItem(LibraryWizardDialog::tr("Shared Library"),
- QVariant(QtProjectParameters::SharedLibrary));
- m_typeCombo->addItem(LibraryWizardDialog::tr("Statically Linked Library"),
- QVariant(QtProjectParameters::StaticLibrary));
- m_typeCombo->addItem(LibraryWizardDialog::tr("Qt Plugin"),
- QVariant(QtProjectParameters::QtPlugin));
- insertControl(0, new QLabel(LibraryWizardDialog::tr("Type")), m_typeCombo);
-}
-
-QtProjectParameters::Type LibraryIntroPage::type() const
-{
- return static_cast<QtProjectParameters::Type>(m_typeCombo->itemData(m_typeCombo->currentIndex()).toInt());
-}
-
-// ------------------- LibraryWizardDialog
-LibraryWizardDialog::LibraryWizardDialog(const Core::BaseFileWizardFactory *factory,
- const QString &templateName,
- const QIcon &icon,
- QWidget *parent,
- const Core::WizardDialogParameters &parameters) :
- BaseQmakeProjectWizardDialog(factory, true, new LibraryIntroPage, -1, parent, parameters),
- m_filesPage(new FilesPage),
- m_pluginBaseClassesInitialized(false),
- m_filesPageId(-1), m_modulesPageId(-1), m_targetPageId(-1)
-{
- setWindowIcon(icon);
- setWindowTitle(templateName);
- setSelectedModules(QLatin1String("core"));
-
- // Note that QWizard::currentIdChanged() is emitted at strange times.
- // Use the intro page instead, set up initially
- setIntroDescription(tr("This wizard generates a C++ Library project."));
-
- if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
- m_targetPageId = addTargetSetupPage();
-
- m_modulesPageId = addModulesPage();
-
- m_filesPage->setNamespacesEnabled(true);
- m_filesPage->setFormFileInputVisible(false);
- m_filesPage->setClassTypeComboVisible(false);
-
- m_filesPageId = addPage(m_filesPage);
-
- Utils::WizardProgressItem *introItem = wizardProgress()->item(startId());
- Utils::WizardProgressItem *targetItem = nullptr;
- if (m_targetPageId != -1)
- targetItem = wizardProgress()->item(m_targetPageId);
- Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId);
- Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId);
- filesItem->setTitle(tr("Details"));
-
- if (targetItem) {
- if (m_targetPageId != -1) {
- targetItem->setNextItems(QList<Utils::WizardProgressItem *>()
- << modulesItem << filesItem);
- targetItem->setNextShownItem(nullptr);
- } else {
- introItem->setNextItems(QList<Utils::WizardProgressItem *>()
- << modulesItem << filesItem);
- introItem->setNextShownItem(nullptr);
- }
- }
-
- connect(this, &QWizard::currentIdChanged, this, &LibraryWizardDialog::slotCurrentIdChanged);
-
- addExtensionPages(extensionPages());
-}
-
-void LibraryWizardDialog::setSuffixes(const QString &header, const QString &source, const QString &form)
-{
- m_filesPage->setSuffixes(header, source, form);
-}
-
-void LibraryWizardDialog::setLowerCaseFiles(bool l)
-{
- m_filesPage->setLowerCaseFiles(l);
-}
-
-QtProjectParameters::Type LibraryWizardDialog::type() const
-{
- return static_cast<const LibraryIntroPage*>(introPage())->type();
-}
-
-bool LibraryWizardDialog::isModulesPageSkipped() const
-{
- // When leaving the intro or target page, the modules page is skipped
- // in the case of a plugin since it knows its dependencies by itself.
- return type() == QtProjectParameters::QtPlugin;
-}
-
-int LibraryWizardDialog::skipModulesPageIfNeeded() const
-{
- if (isModulesPageSkipped())
- return m_filesPageId;
- return m_modulesPageId;
-}
-
-int LibraryWizardDialog::nextId() const
-{
- if (m_targetPageId != -1) {
- if (currentId() == m_targetPageId)
- return skipModulesPageIfNeeded();
- } else if (currentId() == startId()) {
- return skipModulesPageIfNeeded();
- }
-
- return BaseQmakeProjectWizardDialog::nextId();
-}
-
-void LibraryWizardDialog::initializePage(int id)
-{
- if (m_targetPageId != -1 && id == m_targetPageId) {
- Utils::WizardProgressItem *targetsItem = wizardProgress()->item(m_targetPageId);
- Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId);
- Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId);
- if (isModulesPageSkipped())
- targetsItem->setNextShownItem(filesItem);
- else
- targetsItem->setNextShownItem(modulesItem);
-
- }
- BaseQmakeProjectWizardDialog::initializePage(id);
-}
-
-void LibraryWizardDialog::cleanupPage(int id)
-{
- if (m_targetPageId != -1 && id == m_targetPageId) {
- Utils::WizardProgressItem *targetsItem = wizardProgress()->item(m_targetPageId);
- targetsItem->setNextShownItem(nullptr);
- }
- BaseQmakeProjectWizardDialog::cleanupPage(id);
-}
-
-QtProjectParameters LibraryWizardDialog::parameters() const
-{
- QtProjectParameters rc;
- rc.type = type();
- rc.fileName = projectName();
- rc.path = path();
- if (rc.type == QtProjectParameters::QtPlugin) {
- // Plugin: Dependencies & Target directory
- if (const PluginBaseClasses *plb = findPluginBaseClass(m_filesPage->baseClassName())) {
- rc.selectedModules = pluginDependencies(plb);
- if (plb->targetDirectory) {
- rc.targetDirectory = QLatin1String("$$[QT_INSTALL_PLUGINS]/");
- rc.targetDirectory += QLatin1String(plb->targetDirectory);
- }
- }
- } else {
- // Modules from modules page
- rc.selectedModules = selectedModulesList();
- rc.deselectedModules = deselectedModulesList();
- }
- return rc;
-}
-
-void LibraryWizardDialog::slotCurrentIdChanged(int id)
-{
- if (debugLibWizard)
- qDebug() << Q_FUNC_INFO << id;
- if (id == m_filesPageId)
- setupFilesPage();// Switching to files page: Set up base class accordingly (plugin)
-}
-
-void LibraryWizardDialog::setupFilesPage()
-{
- switch (type()) {
- case QtProjectParameters::QtPlugin:
- if (!m_pluginBaseClassesInitialized) {
- if (debugLibWizard)
- qDebug("initializing for plugins");
- QStringList baseClasses;
- const int pluginBaseClassCount = sizeof(pluginBaseClasses)/sizeof(PluginBaseClasses);
- Q_ASSERT(defaultPluginBaseClass < pluginBaseClassCount);
- for (const PluginBaseClasses &pluginBaseClasse : pluginBaseClasses)
- baseClasses.push_back(QLatin1String(pluginBaseClasse.name));
- m_filesPage->setBaseClassChoices(baseClasses);
- m_filesPage->setBaseClassName(baseClasses.at(defaultPluginBaseClass));
- m_pluginBaseClassesInitialized = true;
- }
- m_filesPage->setBaseClassInputVisible(true);
- break;
- default:
- if (!m_filesPage->isComplete()) {
- // Urrm, figure out a good class name. Use project name this time
- QString className = projectName();
- if (!className.isEmpty())
- className[0] = className.at(0).toUpper();
- m_filesPage->setClassName(className);
- m_filesPage->setBaseClassInputVisible(false);
- }
- break;
- }
-}
-
-LibraryParameters LibraryWizardDialog::libraryParameters() const
-{
- LibraryParameters rc;
- rc.className = m_filesPage->className();
- if (type() == QtProjectParameters::QtPlugin) {
- rc.baseClassName = m_filesPage->baseClassName();
- for (const PluginBaseClasses &c : pluginBaseClasses) {
- if (QLatin1String(c.name) == rc.baseClassName) {
- rc.pureVirtualSignatures = c.pureVirtuals;
- break;
- }
- }
- }
- rc.sourceFileName = m_filesPage->sourceFileName();
- rc.headerFileName = m_filesPage->headerFileName();
- return rc;
-}
-
-QString LibraryWizardDialog::pluginInterface(const QString &baseClass)
-{
- if (const PluginBaseClasses *plb = findPluginBaseClass(baseClass))
- if (plb->pluginInterface)
- return QLatin1String("org.qt-project.Qt.") + QLatin1String(plb->pluginInterface);
- return QString();
-}
-
-
-} // namespace Internal
-} // namespace QmakeProjectManager
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h
deleted file mode 100644
index 620ffe7cca..0000000000
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.h
+++ /dev/null
@@ -1,78 +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 "qtwizard.h"
-
-namespace QmakeProjectManager {
-namespace Internal {
-
-struct QtProjectParameters;
-class FilesPage;
-struct LibraryParameters;
-
-// Library wizard dialog.
-class LibraryWizardDialog : public BaseQmakeProjectWizardDialog
-{
- Q_OBJECT
-
-public:
- LibraryWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
- const QIcon &icon,
- QWidget *parent,
- const Core::WizardDialogParameters &parameters);
-
- void setSuffixes(const QString &header, const QString &source, const QString &form= QString());
- void setLowerCaseFiles(bool);
-
- QtProjectParameters parameters() const;
- LibraryParameters libraryParameters() const;
-
- static QString pluginInterface(const QString &baseClass);
-
- int nextId() const override;
-
-protected:
- void initializePage(int id) override;
- void cleanupPage(int id) override;
-
-private:
- void slotCurrentIdChanged(int);
-
- QtProjectParameters::Type type() const;
- void setupFilesPage();
- bool isModulesPageSkipped() const;
- int skipModulesPageIfNeeded() const;
-
- FilesPage *m_filesPage;
- bool m_pluginBaseClassesInitialized;
- int m_filesPageId;
- int m_modulesPageId;
- int m_targetPageId;
-};
-
-} // namespace Internal
-} // namespace QmakeProjectManager