forked from qt-creator/qt-creator
ResourceEditor: Replace ResourceWizard with a JsonWizard
Change-Id: I0fb76c8627f65329d1bfebecf44cc3c75e6b07b5 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
2
share/qtcreator/templates/wizards/files/qrc/file.qrc
Normal file
2
share/qtcreator/templates/wizards/files/qrc/file.qrc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<RCC/>
|
||||||
|
|
||||||
37
share/qtcreator/templates/wizards/files/qrc/wizard.json
Normal file
37
share/qtcreator/templates/wizards/files/qrc/wizard.json
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"kind": "file",
|
||||||
|
"id": "F.Resource",
|
||||||
|
"category": "R.Qt",
|
||||||
|
"trDescription": "Creates a Qt Resource file (.qrc).",
|
||||||
|
"trDisplayName": "Qt Resource File",
|
||||||
|
"trDisplayCategory": "Qt",
|
||||||
|
"icon": "../../global/genericfilewizard.png",
|
||||||
|
"featuresRequired": [ "Plugin.ResourceEditor" ],
|
||||||
|
|
||||||
|
"pages" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"trDisplayName": "Location",
|
||||||
|
"trShortTitle": "Location",
|
||||||
|
"typeId": "File"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trDisplayName": "Project Management",
|
||||||
|
"trShortTitle": "Summary",
|
||||||
|
"typeId": "Summary"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"generators" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"typeId": "File",
|
||||||
|
"data":
|
||||||
|
{
|
||||||
|
"source": "file.qrc",
|
||||||
|
"target": "%{JS: Cpp.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/vnd.qt.xml.resource')}')}",
|
||||||
|
"openInEditor": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ include(qrceditor/qrceditor.pri)
|
|||||||
|
|
||||||
HEADERS += resourceeditorfactory.h \
|
HEADERS += resourceeditorfactory.h \
|
||||||
resourceeditorplugin.h \
|
resourceeditorplugin.h \
|
||||||
resourcewizard.h \
|
|
||||||
resourceeditorw.h \
|
resourceeditorw.h \
|
||||||
resourceeditorconstants.h \
|
resourceeditorconstants.h \
|
||||||
resource_global.h \
|
resource_global.h \
|
||||||
@@ -11,7 +10,6 @@ resourcenode.h
|
|||||||
|
|
||||||
SOURCES +=resourceeditorfactory.cpp \
|
SOURCES +=resourceeditorfactory.cpp \
|
||||||
resourceeditorplugin.cpp \
|
resourceeditorplugin.cpp \
|
||||||
resourcewizard.cpp \
|
|
||||||
resourceeditorw.cpp \
|
resourceeditorw.cpp \
|
||||||
resourcenode.cpp
|
resourcenode.cpp
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ QtcPlugin {
|
|||||||
"resourceeditorfactory.cpp", "resourceeditorfactory.h",
|
"resourceeditorfactory.cpp", "resourceeditorfactory.h",
|
||||||
"resourceeditorplugin.cpp", "resourceeditorplugin.h",
|
"resourceeditorplugin.cpp", "resourceeditorplugin.h",
|
||||||
"resourceeditorw.cpp", "resourceeditorw.h",
|
"resourceeditorw.cpp", "resourceeditorw.h",
|
||||||
"resourcewizard.cpp", "resourcewizard.h",
|
|
||||||
"resource_global.h", "resourcenode.cpp", "resourcenode.h"
|
"resource_global.h", "resourcenode.cpp", "resourcenode.h"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include "resourceeditorw.h"
|
#include "resourceeditorw.h"
|
||||||
#include "resourceeditorconstants.h"
|
#include "resourceeditorconstants.h"
|
||||||
#include "resourcewizard.h"
|
|
||||||
#include "resourceeditorfactory.h"
|
#include "resourceeditorfactory.h"
|
||||||
#include "resourcenode.h"
|
#include "resourcenode.h"
|
||||||
|
|
||||||
@@ -128,15 +127,6 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err
|
|||||||
ResourceEditorFactory *editor = new ResourceEditorFactory(this);
|
ResourceEditorFactory *editor = new ResourceEditorFactory(this);
|
||||||
addAutoReleasedObject(editor);
|
addAutoReleasedObject(editor);
|
||||||
|
|
||||||
ResourceWizard *wizard = new ResourceWizard;
|
|
||||||
wizard->setDescription(tr("Creates a Qt Resource file (.qrc) that you can add to a Qt Widget Project."));
|
|
||||||
wizard->setDisplayName(tr("Qt Resource file"));
|
|
||||||
wizard->setId(QLatin1String("F.Resource"));
|
|
||||||
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
|
||||||
wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
|
||||||
|
|
||||||
addAutoReleasedObject(wizard);
|
|
||||||
|
|
||||||
errorMessage->clear();
|
errorMessage->clear();
|
||||||
|
|
||||||
// Register undo and redo
|
// Register undo and redo
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** 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 Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "resourcewizard.h"
|
|
||||||
#include "resourceeditorw.h"
|
|
||||||
#include "resourceeditorconstants.h"
|
|
||||||
|
|
||||||
using namespace ResourceEditor;
|
|
||||||
using namespace ResourceEditor::Internal;
|
|
||||||
|
|
||||||
Core::GeneratedFiles
|
|
||||||
ResourceWizard::generateFilesFromPath(const QString &path,
|
|
||||||
const QString &name,
|
|
||||||
QString *errorMessage) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(errorMessage)
|
|
||||||
const QString suffix = preferredSuffix(QLatin1String(Constants::C_RESOURCE_MIMETYPE));
|
|
||||||
const QString fileName = Core::BaseFileWizardFactory::buildFileName(path, name, suffix);
|
|
||||||
Core::GeneratedFile file(fileName);
|
|
||||||
file.setContents(QLatin1String("<RCC/>"));
|
|
||||||
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
|
||||||
return Core::GeneratedFiles() << file;
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** 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 Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef RESOURCEWIZARD_H
|
|
||||||
#define RESOURCEWIZARD_H
|
|
||||||
|
|
||||||
#include <coreplugin/basefilewizardfactory.h>
|
|
||||||
|
|
||||||
namespace ResourceEditor {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class ResourceWizard : public Core::StandardFileWizardFactory
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Core::GeneratedFiles generateFilesFromPath(const QString &path, const QString &name,
|
|
||||||
QString *errorMessage) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace ResourceEditor
|
|
||||||
|
|
||||||
#endif //RESOURCEWIZARD_H
|
|
||||||
Reference in New Issue
Block a user