forked from qt-creator/qt-creator
BlackBerry: Refactored BarDescriptorDocument
The BarDescriptorDocument now operates directly on the underlying QDomDocument, and is much better at keeping the tags on their original lines. Any new values are appended to the end of the document. A generic API is provided for changing the values inside the document, BarDescriptorDocument::setValue(..). BarDescriptorDocument no longer depends on the BarDescriptorEditorWidget, which should make it easier to implement splitting of the editor. Task-number: QTCREATORBUG-11012 Change-Id: Icfd681e3af016ea819b99b8cad2cede46600e910 Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com> Reviewed-by: Mehdi Fekari <mfekari@blackberry.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
This commit is contained in:
committed by
Tobias Nätterlund
parent
717e384bb5
commit
3994e698cd
@@ -32,47 +32,21 @@
|
|||||||
#include "bardescriptordocument.h"
|
#include "bardescriptordocument.h"
|
||||||
|
|
||||||
#include "qnxconstants.h"
|
#include "qnxconstants.h"
|
||||||
#include "bardescriptoreditor.h"
|
|
||||||
#include "bardescriptoreditorwidget.h"
|
|
||||||
#include "bardescriptordocumentnodehandlers.h"
|
|
||||||
|
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QFile>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QMetaEnum>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
BarDescriptorDocument::BarDescriptorDocument(BarDescriptorEditorWidget *editorWidget)
|
BarDescriptorDocument::BarDescriptorDocument(QObject *parent)
|
||||||
: Core::TextDocument(editorWidget)
|
: Core::TextDocument(parent)
|
||||||
, m_nodeHandlers(QList<BarDescriptorDocumentAbstractNodeHandler *>())
|
|
||||||
, m_editorWidget(editorWidget)
|
|
||||||
{
|
{
|
||||||
// General
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentIdNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentVersionNumberNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentBuildIdNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentAuthorNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentAuthorIdNodeHandler(m_editorWidget));
|
|
||||||
|
|
||||||
// Application
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentApplicationNameNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentApplicationDescriptionNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentApplicationIconNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentSplashScreenNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentInitialWindowNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentArgNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentActionNodeHandler(m_editorWidget));
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentEnvNodeHandler(m_editorWidget));
|
|
||||||
|
|
||||||
// Assets
|
|
||||||
registerNodeHandler(new BarDescriptorDocumentAssetNodeHandler(m_editorWidget));
|
|
||||||
|
|
||||||
// blackberry-nativepackager requires the XML file to be in UTF-8 encoding,
|
// blackberry-nativepackager requires the XML file to be in UTF-8 encoding,
|
||||||
// force if possible
|
// force if possible
|
||||||
if (QTextCodec *defaultUTF8 = QTextCodec::codecForName("UTF-8"))
|
if (QTextCodec *defaultUTF8 = QTextCodec::codecForName("UTF-8"))
|
||||||
@@ -83,10 +57,6 @@ BarDescriptorDocument::BarDescriptorDocument(BarDescriptorEditorWidget *editorWi
|
|||||||
|
|
||||||
BarDescriptorDocument::~BarDescriptorDocument()
|
BarDescriptorDocument::~BarDescriptorDocument()
|
||||||
{
|
{
|
||||||
while (!m_nodeHandlers.isEmpty()) {
|
|
||||||
BarDescriptorDocumentAbstractNodeHandler *nodeHandler = m_nodeHandlers.takeFirst();
|
|
||||||
delete nodeHandler;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BarDescriptorDocument::open(QString *errorString, const QString &fileName) {
|
bool BarDescriptorDocument::open(QString *errorString, const QString &fileName) {
|
||||||
@@ -95,9 +65,8 @@ bool BarDescriptorDocument::open(QString *errorString, const QString &fileName)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
setFilePath(fileName);
|
setFilePath(fileName);
|
||||||
m_editorWidget->setFilePath(fileName);
|
|
||||||
|
|
||||||
bool result = loadContent(contents);
|
const bool result = loadContent(contents, false);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
*errorString = tr("%1 does not appear to be a valid application descriptor file").arg(QDir::toNativeSeparators(fileName));
|
*errorString = tr("%1 does not appear to be a valid application descriptor file").arg(QDir::toNativeSeparators(fileName));
|
||||||
@@ -110,12 +79,12 @@ bool BarDescriptorDocument::save(QString *errorString, const QString &fn, bool a
|
|||||||
QTC_ASSERT(!autoSave, return false);
|
QTC_ASSERT(!autoSave, return false);
|
||||||
QTC_ASSERT(fn.isEmpty(), return false);
|
QTC_ASSERT(fn.isEmpty(), return false);
|
||||||
|
|
||||||
bool result = write(filePath(), xmlSource(), errorString);
|
const bool result = write(filePath(), xmlSource(), errorString);
|
||||||
if (!result)
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_editorWidget->setDirty(false);
|
m_dirty = false;
|
||||||
emit changed();
|
emit Core::IDocument::changed();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +112,7 @@ bool BarDescriptorDocument::shouldAutoSave() const
|
|||||||
|
|
||||||
bool BarDescriptorDocument::isModified() const
|
bool BarDescriptorDocument::isModified() const
|
||||||
{
|
{
|
||||||
return m_editorWidget->isDirty();
|
return m_dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BarDescriptorDocument::isSaveAsAllowed() const
|
bool BarDescriptorDocument::isSaveAsAllowed() const
|
||||||
@@ -172,91 +141,435 @@ bool BarDescriptorDocument::reload(QString *errorString, Core::IDocument::Reload
|
|||||||
|
|
||||||
QString BarDescriptorDocument::xmlSource() const
|
QString BarDescriptorDocument::xmlSource() const
|
||||||
{
|
{
|
||||||
BarDescriptorEditor *editor = qobject_cast<BarDescriptorEditor*>(m_editorWidget->editor());
|
const int indent = 4;
|
||||||
QTC_ASSERT(editor, return QString());
|
return m_barDocument.toString(indent);
|
||||||
|
|
||||||
if (editor->activePage() == BarDescriptorEditor::Source) {
|
|
||||||
return m_editorWidget->xmlSource();
|
|
||||||
} else {
|
|
||||||
QDomDocument doc;
|
|
||||||
doc.appendChild(doc.createProcessingInstruction(QLatin1String("xml"), QLatin1String("version='1.0' encoding='") + QLatin1String(codec()->name()) + QLatin1String("' standalone='no'")));
|
|
||||||
|
|
||||||
// QNX
|
|
||||||
QDomElement rootElem = doc.createElement(QLatin1String("qnx"));
|
|
||||||
rootElem.setAttribute(QLatin1String("xmlns"), QLatin1String("http://www.qnx.com/schemas/application/1.0"));
|
|
||||||
|
|
||||||
QMap<int, BarDescriptorDocumentAbstractNodeHandler*> nodeHandlerMap;
|
|
||||||
foreach (BarDescriptorDocumentAbstractNodeHandler *nodeHandler, m_nodeHandlers)
|
|
||||||
nodeHandlerMap.insertMulti(nodeHandler->order(), nodeHandler);
|
|
||||||
|
|
||||||
QList<BarDescriptorDocumentAbstractNodeHandler*> nodeHandlers = nodeHandlerMap.values();
|
|
||||||
foreach (BarDescriptorDocumentAbstractNodeHandler *nodeHandler, nodeHandlers)
|
|
||||||
rootElem.appendChild(nodeHandler->toNode(doc));
|
|
||||||
|
|
||||||
doc.appendChild(rootElem);
|
|
||||||
|
|
||||||
return doc.toString(4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BarDescriptorDocument::loadContent(const QString &xmlSource, QString *errorMessage, int *errorLine)
|
bool BarDescriptorDocument::loadContent(const QString &xmlCode, bool setDirty, QString *errorMessage, int *errorLine)
|
||||||
{
|
{
|
||||||
QDomDocument doc;
|
if (xmlCode == xmlSource())
|
||||||
bool result = doc.setContent(xmlSource, errorMessage, errorLine);
|
|
||||||
if (!result)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomElement docElem = doc.documentElement();
|
|
||||||
if (docElem.tagName() != QLatin1String("qnx"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_editorWidget->clear();
|
|
||||||
|
|
||||||
removeUnknownNodeHandlers();
|
|
||||||
foreach (BarDescriptorDocumentAbstractNodeHandler *nodeHandler, m_nodeHandlers)
|
|
||||||
nodeHandler->clear();
|
|
||||||
|
|
||||||
QDomNode node = docElem.firstChildElement();
|
|
||||||
while (!node.isNull()) {
|
|
||||||
BarDescriptorDocumentAbstractNodeHandler *nodeHandler = nodeHandlerForDomNode(node);
|
|
||||||
if (!nodeHandler) {
|
|
||||||
nodeHandler = new BarDescriptorDocumentUnknownNodeHandler(m_editorWidget);
|
|
||||||
registerNodeHandler(nodeHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!nodeHandler->handle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
node = node.nextSibling();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_editorWidget->setXmlSource(xmlSource);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
bool result = m_barDocument.setContent(xmlCode, errorMessage, errorLine);
|
||||||
|
|
||||||
|
m_dirty = setDirty;
|
||||||
|
|
||||||
|
emitAllChanged();
|
||||||
|
emit Core::IDocument::changed();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorDocument::registerNodeHandler(BarDescriptorDocumentAbstractNodeHandler *nodeHandler)
|
QVariant BarDescriptorDocument::value(BarDescriptorDocument::Tag tag) const
|
||||||
{
|
{
|
||||||
m_nodeHandlers << nodeHandler;
|
const QString tagName = QString::fromLatin1(metaObject()->enumerator(metaObject()->enumeratorOffset()).valueToKey(tag));
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorDocumentAbstractNodeHandler *BarDescriptorDocument::nodeHandlerForDomNode(const QDomNode &node)
|
switch (tag) {
|
||||||
{
|
case id:
|
||||||
foreach (BarDescriptorDocumentAbstractNodeHandler *handler, m_nodeHandlers) {
|
case versionNumber:
|
||||||
if (handler->canHandle(node) && !dynamic_cast<BarDescriptorDocumentUnknownNodeHandler*>(handler))
|
case buildId:
|
||||||
return handler;
|
case name:
|
||||||
|
case description:
|
||||||
|
case author:
|
||||||
|
case publisher:
|
||||||
|
case authorId:
|
||||||
|
return stringValue(tagName);
|
||||||
|
case icon:
|
||||||
|
return childStringListValue(tagName, QLatin1String("image")).value(0);
|
||||||
|
case splashScreens:
|
||||||
|
return childStringListValue(tagName, QLatin1String("image"));
|
||||||
|
case asset: {
|
||||||
|
QVariant var;
|
||||||
|
var.setValue(assets());
|
||||||
|
return var;
|
||||||
|
}
|
||||||
|
case aspectRatio:
|
||||||
|
case autoOrients:
|
||||||
|
case systemChrome:
|
||||||
|
return childStringListValue(QLatin1String("initialWindow"), tagName).value(0);
|
||||||
|
case transparent:
|
||||||
|
return childStringListValue(QLatin1String("initialWindow"), tagName).value(0) == QLatin1String("true");
|
||||||
|
case arg:
|
||||||
|
case action:
|
||||||
|
return stringListValue(tagName);
|
||||||
|
case env:
|
||||||
|
QVariant var;
|
||||||
|
var.setValue(environment());
|
||||||
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorDocument::removeUnknownNodeHandlers()
|
void BarDescriptorDocument::setValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
{
|
{
|
||||||
for (int i = m_nodeHandlers.size() - 1; i >= 0; --i) {
|
const QMetaEnum tagEnum = metaObject()->enumerator(metaObject()->enumeratorOffset());
|
||||||
BarDescriptorDocumentUnknownNodeHandler *nodeHandler = dynamic_cast<BarDescriptorDocumentUnknownNodeHandler*>(m_nodeHandlers[i]);
|
const QString tagName = QString::fromLatin1(tagEnum.valueToKey(tag));
|
||||||
if (nodeHandler) {
|
|
||||||
m_nodeHandlers.removeAt(i);
|
switch (tag) {
|
||||||
delete nodeHandler;
|
case id:
|
||||||
|
case versionNumber:
|
||||||
|
case buildId:
|
||||||
|
case name:
|
||||||
|
case description:
|
||||||
|
case authorId:
|
||||||
|
setStringValue(tagName, value.toString());
|
||||||
|
break;
|
||||||
|
case icon:
|
||||||
|
case splashScreens:
|
||||||
|
setChildStringListValue(tagName, QLatin1String("image"), value.toStringList());
|
||||||
|
break;
|
||||||
|
case asset:
|
||||||
|
setAssets(value.value<BarDescriptorAssetList>());
|
||||||
|
break;
|
||||||
|
case aspectRatio:
|
||||||
|
case autoOrients:
|
||||||
|
case systemChrome:
|
||||||
|
setChildStringListValue(QLatin1String("initialWindow"), tagName, value.toStringList());
|
||||||
|
break;
|
||||||
|
case transparent:
|
||||||
|
setChildStringListValue(QLatin1String("initialWindow"), tagName, QStringList() << (value.toBool() ? QLatin1String("true") : QLatin1String("false")));
|
||||||
|
break;
|
||||||
|
case arg:
|
||||||
|
case action:
|
||||||
|
setStringListValue(tagName, value.toStringList());
|
||||||
|
break;
|
||||||
|
case env:
|
||||||
|
setEnvironment(value.value<QList<Utils::EnvironmentItem> >());
|
||||||
|
break;
|
||||||
|
case author:
|
||||||
|
case publisher:
|
||||||
|
// Unset <publisher> when setting <author> as only one should be used
|
||||||
|
setStringValue(QString::fromLatin1(tagEnum.valueToKey(author)), value.toString());
|
||||||
|
setStringValue(QString::fromLatin1(tagEnum.valueToKey(publisher)), QLatin1String(""));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_dirty = true;
|
||||||
|
emit changed(tag, value);
|
||||||
|
emit Core::IDocument::changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BarDescriptorDocument::stringValue(const QString &tagName) const
|
||||||
|
{
|
||||||
|
QDomNodeList nodes = m_barDocument.elementsByTagName(tagName);
|
||||||
|
if (nodes.isEmpty() || nodes.size() > 1)
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
QDomNode node = nodes.item(0);
|
||||||
|
QDomText textNode = node.firstChild().toText();
|
||||||
|
if (textNode.isNull())
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
return textNode.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorDocument::setStringValue(const QString &tagName, const QString &value)
|
||||||
|
{
|
||||||
|
QDomNodeList nodes = m_barDocument.elementsByTagName(tagName);
|
||||||
|
|
||||||
|
if (nodes.size() > 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QDomNode existingNode = nodes.item(0);
|
||||||
|
if (existingNode.isNull() && value.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!existingNode.isNull() && value.isEmpty()) {
|
||||||
|
m_barDocument.documentElement().removeChild(existingNode);
|
||||||
|
} else if (existingNode.isNull()) {
|
||||||
|
QDomElement newNode = m_barDocument.createElement(tagName);
|
||||||
|
newNode.appendChild(m_barDocument.createTextNode(value));
|
||||||
|
m_barDocument.documentElement().appendChild(newNode);
|
||||||
|
} else {
|
||||||
|
QDomText textNode = existingNode.firstChild().toText();
|
||||||
|
if (textNode.isNull())
|
||||||
|
return;
|
||||||
|
textNode.setData(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList BarDescriptorDocument::childStringListValue(const QString &tagName, const QString &childTagName) const
|
||||||
|
{
|
||||||
|
QDomNodeList nodes = m_barDocument.elementsByTagName(tagName);
|
||||||
|
if (nodes.isEmpty() || nodes.size() > 1)
|
||||||
|
return QStringList();
|
||||||
|
|
||||||
|
QDomNode parentNode = nodes.item(0);
|
||||||
|
QDomElement childElm = parentNode.firstChildElement(childTagName);
|
||||||
|
if (childElm.isNull())
|
||||||
|
return QStringList();
|
||||||
|
|
||||||
|
QStringList result;
|
||||||
|
while (!childElm.isNull()) {
|
||||||
|
QDomText textNode = childElm.firstChild().toText();
|
||||||
|
if (textNode.isNull())
|
||||||
|
return QStringList();
|
||||||
|
|
||||||
|
result.append(textNode.data());
|
||||||
|
|
||||||
|
childElm = childElm.nextSiblingElement(childTagName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorDocument::setChildStringListValue(const QString &tagName, const QString &childTagName, const QStringList &stringList)
|
||||||
|
{
|
||||||
|
QDomNodeList nodes = m_barDocument.elementsByTagName(tagName);
|
||||||
|
|
||||||
|
if (nodes.size() > 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QDomNode existingNode = nodes.item(0);
|
||||||
|
|
||||||
|
if (existingNode.isNull()) {
|
||||||
|
QDomElement newParentNode = m_barDocument.createElement(tagName);
|
||||||
|
|
||||||
|
foreach (const QString &value, stringList) {
|
||||||
|
QDomElement newChildNode = m_barDocument.createElement(childTagName);
|
||||||
|
QDomText newTextNode = m_barDocument.createTextNode(value);
|
||||||
|
newChildNode.appendChild(newTextNode);
|
||||||
|
newParentNode.appendChild(newChildNode);
|
||||||
|
}
|
||||||
|
m_barDocument.documentElement().appendChild(newParentNode);
|
||||||
|
} else {
|
||||||
|
QStringList values = stringList;
|
||||||
|
QDomElement childElm = existingNode.firstChildElement(childTagName);
|
||||||
|
if (!childElm.isNull()) {
|
||||||
|
// Loop through existing elements, remove the existing nodes
|
||||||
|
// that no longer are in "values", and remove from "values"
|
||||||
|
// the existing nodes that don't need re-creation
|
||||||
|
while (!childElm.isNull()) {
|
||||||
|
QDomText textNode = childElm.firstChild().toText();
|
||||||
|
if (textNode.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QDomElement toRemove;
|
||||||
|
if (!values.contains(textNode.data()))
|
||||||
|
toRemove = childElm;
|
||||||
|
else
|
||||||
|
values.removeAll(textNode.data());
|
||||||
|
|
||||||
|
childElm = childElm.nextSiblingElement(childTagName);
|
||||||
|
|
||||||
|
if (!toRemove.isNull())
|
||||||
|
existingNode.removeChild(toRemove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the new elements
|
||||||
|
int newElementCount = 0;
|
||||||
|
foreach (const QString &value, values) {
|
||||||
|
if (value.isEmpty())
|
||||||
|
continue;
|
||||||
|
QDomElement newChildNode = m_barDocument.createElement(childTagName);
|
||||||
|
newChildNode.appendChild(m_barDocument.createTextNode(value));
|
||||||
|
existingNode.appendChild(newChildNode);
|
||||||
|
++newElementCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newElementCount == 0)
|
||||||
|
m_barDocument.documentElement().removeChild(existingNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList BarDescriptorDocument::stringListValue(const QString &tagName) const
|
||||||
|
{
|
||||||
|
QStringList result;
|
||||||
|
|
||||||
|
QDomElement childElm = m_barDocument.documentElement().firstChildElement(tagName);
|
||||||
|
while (!childElm.isNull()) {
|
||||||
|
QDomText textNode = childElm.firstChild().toText();
|
||||||
|
if (textNode.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
result.append(textNode.data());
|
||||||
|
|
||||||
|
childElm = childElm.nextSiblingElement(tagName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorDocument::setStringListValue(const QString &tagName, const QStringList &stringList)
|
||||||
|
{
|
||||||
|
QStringList values = stringList;
|
||||||
|
QDomElement childElm = m_barDocument.documentElement().firstChildElement(tagName);
|
||||||
|
if (!childElm.isNull()) {
|
||||||
|
// Loop through existing elements, remove the existing nodes
|
||||||
|
// that no longer are in "values", and remove from "values"
|
||||||
|
// the existing nodes that don't need re-creation
|
||||||
|
while (!childElm.isNull()) {
|
||||||
|
QDomText textNode = childElm.firstChild().toText();
|
||||||
|
if (textNode.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QDomElement toRemove;
|
||||||
|
if (!values.contains(textNode.data()))
|
||||||
|
toRemove = childElm;
|
||||||
|
else
|
||||||
|
values.removeAll(textNode.data());
|
||||||
|
|
||||||
|
childElm = childElm.nextSiblingElement(tagName);
|
||||||
|
|
||||||
|
if (!toRemove.isNull())
|
||||||
|
m_barDocument.documentElement().removeChild(toRemove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the new elements
|
||||||
|
foreach (const QString &value, values) {
|
||||||
|
if (value.isEmpty())
|
||||||
|
continue;
|
||||||
|
QDomElement newChildNode = m_barDocument.createElement(tagName);
|
||||||
|
newChildNode.appendChild(m_barDocument.createTextNode(value));
|
||||||
|
m_barDocument.documentElement().appendChild(newChildNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BarDescriptorAssetList BarDescriptorDocument::assets() const
|
||||||
|
{
|
||||||
|
BarDescriptorAssetList result;
|
||||||
|
QDomNodeList nodes = m_barDocument.elementsByTagName(QLatin1String("asset"));
|
||||||
|
if (nodes.isEmpty())
|
||||||
|
return result;
|
||||||
|
|
||||||
|
for (int i = 0; i < nodes.size(); ++i) {
|
||||||
|
QDomElement assetElm = nodes.item(i).toElement();
|
||||||
|
if (assetElm.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QDomText textNode = assetElm.firstChild().toText();
|
||||||
|
if (textNode.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QString path = assetElm.attribute(QLatin1String("path"));
|
||||||
|
QString entry = assetElm.attribute(QLatin1String("entry"));
|
||||||
|
QString dest = textNode.data();
|
||||||
|
|
||||||
|
BarDescriptorAsset asset;
|
||||||
|
asset.source = path;
|
||||||
|
asset.destination = dest;
|
||||||
|
asset.entry = entry == QLatin1String("true");
|
||||||
|
result.append(asset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorDocument::setAssets(const BarDescriptorAssetList &assets)
|
||||||
|
{
|
||||||
|
QDomNodeList nodes = m_barDocument.elementsByTagName(QLatin1String("asset"));
|
||||||
|
|
||||||
|
BarDescriptorAssetList newAssets = assets;
|
||||||
|
QList<QDomNode> toRemove;
|
||||||
|
|
||||||
|
for (int i = 0; i < nodes.size(); ++i) {
|
||||||
|
QDomElement assetElm = nodes.at(i).toElement();
|
||||||
|
if (assetElm.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QDomText textNode = assetElm.firstChild().toText();
|
||||||
|
if (textNode.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QString source = assetElm.attribute(QLatin1String("path"));
|
||||||
|
bool found = false;
|
||||||
|
foreach (const BarDescriptorAsset &asset, newAssets) {
|
||||||
|
if (asset.source == source) {
|
||||||
|
found = true;
|
||||||
|
if (asset.entry) {
|
||||||
|
assetElm.setAttribute(QLatin1String("type"), QLatin1String("Qnx/Elf"));
|
||||||
|
assetElm.setAttribute(QLatin1String("entry"), QLatin1String("true"));
|
||||||
|
} else {
|
||||||
|
assetElm.removeAttribute(QLatin1String("type"));
|
||||||
|
assetElm.removeAttribute(QLatin1String("entry"));
|
||||||
|
}
|
||||||
|
textNode.setData(asset.destination);
|
||||||
|
|
||||||
|
newAssets.removeAll(asset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
toRemove.append(assetElm);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const QDomNode &node, toRemove)
|
||||||
|
m_barDocument.documentElement().removeChild(node);
|
||||||
|
|
||||||
|
foreach (const BarDescriptorAsset &asset, newAssets) {
|
||||||
|
QDomElement assetElm = m_barDocument.createElement(QLatin1String("asset"));
|
||||||
|
assetElm.setAttribute(QLatin1String("path"), asset.source);
|
||||||
|
if (asset.entry) {
|
||||||
|
assetElm.setAttribute(QLatin1String("type"), QLatin1String("Qnx/Elf"));
|
||||||
|
assetElm.setAttribute(QLatin1String("entry"), QLatin1String("true"));
|
||||||
|
}
|
||||||
|
assetElm.appendChild(m_barDocument.createTextNode(asset.destination));
|
||||||
|
m_barDocument.documentElement().appendChild(assetElm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Utils::EnvironmentItem> BarDescriptorDocument::environment() const
|
||||||
|
{
|
||||||
|
QList<Utils::EnvironmentItem> result;
|
||||||
|
|
||||||
|
QDomElement envElm = m_barDocument.documentElement().firstChildElement(QLatin1String("env"));
|
||||||
|
while (!envElm.isNull()) {
|
||||||
|
QString var = envElm.attribute(QLatin1String("var"));
|
||||||
|
QString value = envElm.attribute(QLatin1String("value"));
|
||||||
|
|
||||||
|
Utils::EnvironmentItem item(var, value);
|
||||||
|
result.append(item);
|
||||||
|
|
||||||
|
envElm = envElm.nextSiblingElement(QLatin1String("env"));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorDocument::setEnvironment(const QList<Utils::EnvironmentItem> &environment)
|
||||||
|
{
|
||||||
|
QDomNodeList envNodes = m_barDocument.elementsByTagName(QLatin1String("env"));
|
||||||
|
|
||||||
|
QList<Utils::EnvironmentItem> newEnvironment = environment;
|
||||||
|
QList<QDomElement> toRemove;
|
||||||
|
for (int i = 0; i < envNodes.size(); ++i) {
|
||||||
|
QDomElement elm = envNodes.at(i).toElement();
|
||||||
|
if (elm.isNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QString var = elm.attribute(QLatin1String("var"));
|
||||||
|
bool found = false;
|
||||||
|
foreach (const Utils::EnvironmentItem item, newEnvironment) {
|
||||||
|
if (item.name == var) {
|
||||||
|
found = true;
|
||||||
|
elm.setAttribute(QLatin1String("value"), item.value);
|
||||||
|
newEnvironment.removeAll(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
toRemove.append(elm);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const QDomNode &node, toRemove)
|
||||||
|
m_barDocument.documentElement().removeChild(node);
|
||||||
|
|
||||||
|
foreach (const Utils::EnvironmentItem item, newEnvironment) {
|
||||||
|
QDomElement elm = m_barDocument.createElement(QLatin1String("env"));
|
||||||
|
elm.setAttribute(QLatin1String("var"), item.name);
|
||||||
|
elm.setAttribute(QLatin1String("value"), item.value);
|
||||||
|
m_barDocument.documentElement().appendChild(elm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorDocument::emitAllChanged()
|
||||||
|
{
|
||||||
|
QMetaEnum tags = metaObject()->enumerator(metaObject()->enumeratorOffset());
|
||||||
|
for (int i = 0; i < tags.keyCount(); ++i) {
|
||||||
|
Tag tag = static_cast<Tag>(tags.value(i));
|
||||||
|
emit changed(tag, value(tag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,10 @@
|
|||||||
#define QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H
|
#define QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H
|
||||||
|
|
||||||
#include <coreplugin/textdocument.h>
|
#include <coreplugin/textdocument.h>
|
||||||
|
#include <utils/environment.h>
|
||||||
|
|
||||||
#include <QDomNode>
|
#include <QDomDocument>
|
||||||
|
#include <QMetaType>
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -44,16 +46,44 @@ public:
|
|||||||
QString source;
|
QString source;
|
||||||
QString destination;
|
QString destination;
|
||||||
bool entry;
|
bool entry;
|
||||||
|
|
||||||
|
bool operator==(const BarDescriptorAsset &asset) const
|
||||||
|
{
|
||||||
|
return source == asset.source && destination == asset.destination;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BarDescriptorEditorWidget;
|
typedef QList<BarDescriptorAsset> BarDescriptorAssetList;
|
||||||
class BarDescriptorDocumentAbstractNodeHandler;
|
|
||||||
|
|
||||||
class BarDescriptorDocument : public Core::TextDocument
|
class BarDescriptorDocument : public Core::TextDocument
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_ENUMS(Tag)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BarDescriptorDocument(BarDescriptorEditorWidget *editorWidget);
|
enum Tag {
|
||||||
|
id = 0,
|
||||||
|
versionNumber,
|
||||||
|
buildId,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
icon,
|
||||||
|
splashScreens,
|
||||||
|
asset,
|
||||||
|
aspectRatio,
|
||||||
|
autoOrients,
|
||||||
|
systemChrome,
|
||||||
|
transparent,
|
||||||
|
arg,
|
||||||
|
action,
|
||||||
|
env,
|
||||||
|
author,
|
||||||
|
publisher,
|
||||||
|
authorId
|
||||||
|
};
|
||||||
|
|
||||||
|
explicit BarDescriptorDocument(QObject *parent = 0);
|
||||||
~BarDescriptorDocument();
|
~BarDescriptorDocument();
|
||||||
|
|
||||||
bool open(QString *errorString, const QString &fileName);
|
bool open(QString *errorString, const QString &fileName);
|
||||||
@@ -71,19 +101,43 @@ public:
|
|||||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
|
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
|
||||||
|
|
||||||
QString xmlSource() const;
|
QString xmlSource() const;
|
||||||
bool loadContent(const QString &xmlSource, QString *errorMessage = 0, int *errorLine = 0);
|
bool loadContent(const QString &xmlCode, bool setDirty, QString *errorMessage = 0, int *errorLine = 0);
|
||||||
|
|
||||||
|
QVariant value(Tag tag) const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void changed(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void registerNodeHandler(BarDescriptorDocumentAbstractNodeHandler *nodeHandler);
|
QString stringValue(const QString &tagName) const;
|
||||||
BarDescriptorDocumentAbstractNodeHandler *nodeHandlerForDomNode(const QDomNode &node);
|
void setStringValue(const QString &tagName, const QString &value);
|
||||||
void removeUnknownNodeHandlers();
|
|
||||||
|
|
||||||
QList<BarDescriptorDocumentAbstractNodeHandler *> m_nodeHandlers;
|
QStringList childStringListValue(const QString &tagName, const QString &childTagName) const;
|
||||||
|
void setChildStringListValue(const QString &tagName, const QString &childTagName, const QStringList &stringList);
|
||||||
|
|
||||||
BarDescriptorEditorWidget *m_editorWidget;
|
QStringList stringListValue(const QString &tagName) const;
|
||||||
|
void setStringListValue(const QString &tagName, const QStringList &stringList);
|
||||||
|
|
||||||
|
BarDescriptorAssetList assets() const;
|
||||||
|
void setAssets(const BarDescriptorAssetList &assets);
|
||||||
|
|
||||||
|
QList<Utils::EnvironmentItem> environment() const;
|
||||||
|
void setEnvironment(const QList<Utils::EnvironmentItem> &environment);
|
||||||
|
|
||||||
|
void emitAllChanged();
|
||||||
|
|
||||||
|
bool m_dirty;
|
||||||
|
QDomDocument m_barDocument;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(Qnx::Internal::BarDescriptorAssetList)
|
||||||
|
Q_DECLARE_METATYPE(QList<Utils::EnvironmentItem>)
|
||||||
|
Q_DECLARE_METATYPE(Qnx::Internal::BarDescriptorDocument::Tag)
|
||||||
|
|
||||||
#endif // QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H
|
#endif // QNX_INTERNAL_BARDESCRIPTORDOCUMENT_H
|
||||||
|
|||||||
@@ -1,708 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
|
|
||||||
**
|
|
||||||
** Contact: BlackBerry (qt@blackberry.com)
|
|
||||||
** Contact: KDAB (info@kdab.com)
|
|
||||||
**
|
|
||||||
** 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 "bardescriptordocumentnodehandlers.h"
|
|
||||||
#include "bardescriptoreditorwidget.h"
|
|
||||||
#include "bardescriptoreditorassetswidget.h"
|
|
||||||
#include "bardescriptoreditorauthorinformationwidget.h"
|
|
||||||
#include "bardescriptoreditorentrypointwidget.h"
|
|
||||||
#include "bardescriptoreditorenvironmentwidget.h"
|
|
||||||
#include "bardescriptoreditorgeneralwidget.h"
|
|
||||||
#include "bardescriptoreditorpackageinformationwidget.h"
|
|
||||||
#include "bardescriptoreditorpermissionswidget.h"
|
|
||||||
|
|
||||||
#include <utils/environment.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QDomNode>
|
|
||||||
|
|
||||||
using namespace Qnx;
|
|
||||||
using namespace Qnx::Internal;
|
|
||||||
|
|
||||||
BarDescriptorDocumentAbstractNodeHandler::BarDescriptorDocumentAbstractNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: m_editorWidget(editorWidget)
|
|
||||||
, m_order(0xFFFF)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorDocumentAbstractNodeHandler::~BarDescriptorDocumentAbstractNodeHandler()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentAbstractNodeHandler::handle(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (m_order == 0xFFFF)
|
|
||||||
m_order = node.lineNumber();
|
|
||||||
|
|
||||||
return fromNode(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorDocumentAbstractNodeHandler::clear()
|
|
||||||
{
|
|
||||||
m_order = 0xFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
int BarDescriptorDocumentAbstractNodeHandler::order() const
|
|
||||||
{
|
|
||||||
return m_order;
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorPackageInformationWidget *BarDescriptorDocumentAbstractNodeHandler::packageInformationWidget() const
|
|
||||||
{
|
|
||||||
return m_editorWidget->packageInformationWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorAuthorInformationWidget *BarDescriptorDocumentAbstractNodeHandler::authorInformationWidget() const
|
|
||||||
{
|
|
||||||
return m_editorWidget->authorInformationWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorEntryPointWidget *BarDescriptorDocumentAbstractNodeHandler::entryPointWidget() const
|
|
||||||
{
|
|
||||||
return m_editorWidget->entryPointWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorGeneralWidget *BarDescriptorDocumentAbstractNodeHandler::generalWidget() const
|
|
||||||
{
|
|
||||||
return m_editorWidget->generalWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorPermissionsWidget *BarDescriptorDocumentAbstractNodeHandler::permissionsWidget() const
|
|
||||||
{
|
|
||||||
return m_editorWidget->permissionsWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorEnvironmentWidget *BarDescriptorDocumentAbstractNodeHandler::environmentWidget() const
|
|
||||||
{
|
|
||||||
return m_editorWidget->environmentWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorAssetsWidget *BarDescriptorDocumentAbstractNodeHandler::assetsWidget() const
|
|
||||||
{
|
|
||||||
return m_editorWidget->assetsWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentAbstractNodeHandler::canHandleSimpleTextElement(const QDomNode &node, const QString &tagName) const
|
|
||||||
{
|
|
||||||
QDomElement element = node.toElement();
|
|
||||||
if (element.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (element.tagName().toLower() != tagName.toLower())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomText textNode = element.firstChild().toText();
|
|
||||||
if (textNode.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorDocumentAbstractNodeHandler::loadSimpleTextElement(const QDomNode &node)
|
|
||||||
{
|
|
||||||
QDomElement element = node.toElement();
|
|
||||||
QDomText textNode = element.firstChild().toText();
|
|
||||||
return textNode.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomElement BarDescriptorDocumentAbstractNodeHandler::createSimpleTextElement(QDomDocument &doc, const QString &tagName, const QString &textValue) const
|
|
||||||
{
|
|
||||||
if (textValue.isEmpty())
|
|
||||||
return QDomElement();
|
|
||||||
|
|
||||||
QDomElement elem = doc.createElement(tagName);
|
|
||||||
elem.appendChild(doc.createTextNode(textValue));
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentIdNodeHandler::BarDescriptorDocumentIdNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentIdNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentIdNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
packageInformationWidget()->setPackageId(loadSimpleTextElement(node));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentIdNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
return createSimpleTextElement(doc, QLatin1String("id"), packageInformationWidget()->packageId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentVersionNumberNodeHandler::BarDescriptorDocumentVersionNumberNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentVersionNumberNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("versionNumber"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentVersionNumberNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
packageInformationWidget()->setPackageVersion(loadSimpleTextElement(node));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentVersionNumberNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
return createSimpleTextElement(doc, QLatin1String("versionNumber"), packageInformationWidget()->packageVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentBuildIdNodeHandler::BarDescriptorDocumentBuildIdNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentBuildIdNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("buildId"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentBuildIdNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
packageInformationWidget()->setPackageBuildId(loadSimpleTextElement(node));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentBuildIdNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
return createSimpleTextElement(doc, QLatin1String("buildId"), packageInformationWidget()->packageBuildId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentApplicationNameNodeHandler::BarDescriptorDocumentApplicationNameNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentApplicationNameNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("name"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentApplicationNameNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
// TODO: Add support for localization
|
|
||||||
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
entryPointWidget()->setApplicationName(loadSimpleTextElement(node));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentApplicationNameNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
// TODO: Add support for localization
|
|
||||||
|
|
||||||
return createSimpleTextElement(doc, QLatin1String("name"), entryPointWidget()->applicationName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentApplicationDescriptionNodeHandler::BarDescriptorDocumentApplicationDescriptionNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentApplicationDescriptionNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("description"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentApplicationDescriptionNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
// TODO: Add support for localization
|
|
||||||
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
entryPointWidget()->setApplicationDescription(loadSimpleTextElement(node));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentApplicationDescriptionNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
return createSimpleTextElement(doc, QLatin1String("description"), entryPointWidget()->applicationDescription());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentApplicationIconNodeHandler::BarDescriptorDocumentApplicationIconNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentApplicationIconNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
QDomElement element = node.toElement();
|
|
||||||
if (element.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (element.tagName() != QLatin1String("icon"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomElement imageElement = element.firstChild().toElement();
|
|
||||||
if (imageElement.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (imageElement.tagName() != QLatin1String("image"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomText imageTextNode = imageElement.firstChild().toText();
|
|
||||||
if (imageTextNode.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentApplicationIconNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
// TODO: Add support for localization
|
|
||||||
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomNode imageNode = node.firstChild();
|
|
||||||
QDomText imageTextNode = imageNode.firstChild().toText();
|
|
||||||
entryPointWidget()->setApplicationIcon(imageTextNode.data());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentApplicationIconNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
// TODO: Add support for localization
|
|
||||||
const QString iconFileName = entryPointWidget()->applicationIconFileName();
|
|
||||||
if (iconFileName.isEmpty())
|
|
||||||
return QDomElement();
|
|
||||||
|
|
||||||
QDomElement iconElement = doc.createElement(QLatin1String("icon"));
|
|
||||||
iconElement.appendChild(createSimpleTextElement(doc, QLatin1String("image"), iconFileName));
|
|
||||||
return iconElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentSplashScreenNodeHandler::BarDescriptorDocumentSplashScreenNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentSplashScreenNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
QDomElement element = node.toElement();
|
|
||||||
if (element.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (element.tagName().toLower() != QLatin1String("splashscreens"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomElement imageElement = element.firstChild().toElement();
|
|
||||||
if (imageElement.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (imageElement.tagName().toLower() != QLatin1String("image"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomText imageTextNode = imageElement.firstChild().toText();
|
|
||||||
if (imageTextNode.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentSplashScreenNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomElement imageNode = node.firstChildElement();
|
|
||||||
while (!imageNode.isNull()) {
|
|
||||||
if (imageNode.tagName().toLower() == QLatin1String("image")) {
|
|
||||||
QDomText imageTextNode = imageNode.firstChild().toText();
|
|
||||||
entryPointWidget()->appendSplashScreen(imageTextNode.data());
|
|
||||||
}
|
|
||||||
imageNode = imageNode.nextSiblingElement();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentSplashScreenNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
QStringList splashScreens = entryPointWidget()->splashScreens();
|
|
||||||
if (splashScreens.isEmpty())
|
|
||||||
return QDomElement();
|
|
||||||
|
|
||||||
QDomElement splashScreenElement = doc.createElement(QLatin1String("splashScreens"));
|
|
||||||
foreach (const QString &splashScreen, splashScreens)
|
|
||||||
splashScreenElement.appendChild(createSimpleTextElement(doc, QLatin1String("image"), splashScreen));
|
|
||||||
|
|
||||||
return splashScreenElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentAssetNodeHandler::BarDescriptorDocumentAssetNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentAssetNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("asset"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentAssetNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomElement element = node.toElement();
|
|
||||||
|
|
||||||
QString path = element.attribute(QLatin1String("path"));
|
|
||||||
QString entry = element.attribute(QLatin1String("entry"));
|
|
||||||
QDomText destNode = element.firstChild().toText();
|
|
||||||
QString dest = destNode.data();
|
|
||||||
|
|
||||||
BarDescriptorAsset asset;
|
|
||||||
asset.source = path;
|
|
||||||
asset.destination = dest;
|
|
||||||
asset.entry = entry == QLatin1String("true");
|
|
||||||
|
|
||||||
assetsWidget()->addAsset(asset);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentAssetNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
QDomDocumentFragment fragment = doc.createDocumentFragment();
|
|
||||||
|
|
||||||
QList<BarDescriptorAsset> assets = assetsWidget()->assets();
|
|
||||||
foreach (const BarDescriptorAsset &asset, assets) {
|
|
||||||
QDomElement assetElem = doc.createElement(QLatin1String("asset"));
|
|
||||||
assetElem.setAttribute(QLatin1String("path"), asset.source);
|
|
||||||
if (asset.entry) {
|
|
||||||
assetElem.setAttribute(QLatin1String("type"), QLatin1String("Qnx/Elf"));
|
|
||||||
assetElem.setAttribute(QLatin1String("entry"), QLatin1String("true"));
|
|
||||||
}
|
|
||||||
assetElem.appendChild(doc.createTextNode(asset.destination));
|
|
||||||
fragment.appendChild(assetElem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentInitialWindowNodeHandler::BarDescriptorDocumentInitialWindowNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentInitialWindowNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
QDomElement element = node.toElement();
|
|
||||||
if (element.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (element.tagName() != QLatin1String("initialWindow"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentInitialWindowNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomElement child = node.firstChildElement();
|
|
||||||
while (!child.isNull()) {
|
|
||||||
if (child.tagName() == QLatin1String("aspectRatio")) {
|
|
||||||
generalWidget()->setOrientation(loadSimpleTextElement(child));
|
|
||||||
} else if (child.tagName() == QLatin1String("autoOrients")) {
|
|
||||||
if (loadSimpleTextElement(child) == QLatin1String("true"))
|
|
||||||
generalWidget()->setOrientation(QLatin1String("auto-orient"));
|
|
||||||
} else if (child.tagName() == QLatin1String("systemChrome")) {
|
|
||||||
generalWidget()->setChrome(loadSimpleTextElement(child));
|
|
||||||
} else if (child.tagName() == QLatin1String("transparent")) {
|
|
||||||
const QString transparent = loadSimpleTextElement(child);
|
|
||||||
generalWidget()->setTransparent(transparent == QLatin1String("true"));
|
|
||||||
}
|
|
||||||
child = child.nextSiblingElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentInitialWindowNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
QDomElement element = doc.createElement(QLatin1String("initialWindow"));
|
|
||||||
|
|
||||||
if (generalWidget()->orientation() == QLatin1String("auto-orient")) {
|
|
||||||
element.appendChild(createSimpleTextElement(doc, QLatin1String("autoOrients"), QLatin1String("true")));
|
|
||||||
} else if (!generalWidget()->orientation().isEmpty()) {
|
|
||||||
element.appendChild(createSimpleTextElement(doc, QLatin1String("aspectRatio"), generalWidget()->orientation()));
|
|
||||||
element.appendChild(createSimpleTextElement(doc, QLatin1String("autoOrients"), QLatin1String("false")));
|
|
||||||
}
|
|
||||||
element.appendChild(createSimpleTextElement(doc, QLatin1String("systemChrome"), generalWidget()->chrome()));
|
|
||||||
element.appendChild(createSimpleTextElement(doc, QLatin1String("transparent"), generalWidget()->transparent() ? QLatin1String("true") : QLatin1String("false")));
|
|
||||||
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
BarDescriptorDocumentActionNodeHandler::BarDescriptorDocumentActionNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentActionNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("action"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentActionNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QString value = loadSimpleTextElement(node);
|
|
||||||
if (value != QLatin1String("run_native")) // This has no representation in the GUI, and is always added
|
|
||||||
permissionsWidget()->checkPermission(value);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentActionNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
QDomDocumentFragment frag = doc.createDocumentFragment();
|
|
||||||
|
|
||||||
QDomElement runNativeElement = doc.createElement(QLatin1String("action"));
|
|
||||||
runNativeElement.setAttribute(QLatin1String("system"), QLatin1String("true"));
|
|
||||||
runNativeElement.appendChild(doc.createTextNode(QLatin1String("run_native")));
|
|
||||||
frag.appendChild(runNativeElement);
|
|
||||||
|
|
||||||
QStringList checkedIdentifiers = permissionsWidget()->checkedPermissions();
|
|
||||||
foreach (const QString &identifier, checkedIdentifiers)
|
|
||||||
frag.appendChild(createSimpleTextElement(doc, QLatin1String("action"), identifier));
|
|
||||||
|
|
||||||
return frag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentArgNodeHandler::BarDescriptorDocumentArgNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentArgNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("arg"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentArgNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
generalWidget()->appendApplicationArgument(loadSimpleTextElement(node));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentArgNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
QDomDocumentFragment frag = doc.createDocumentFragment();
|
|
||||||
|
|
||||||
QStringList arguments = generalWidget()->applicationArguments();
|
|
||||||
foreach (const QString &argument, arguments)
|
|
||||||
frag.appendChild(createSimpleTextElement(doc, QLatin1String("arg"), argument));
|
|
||||||
|
|
||||||
return frag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentEnvNodeHandler::BarDescriptorDocumentEnvNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentEnvNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
QDomElement element = node.toElement();
|
|
||||||
if (element.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (element.tagName() != QLatin1String("env"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!element.hasAttribute(QLatin1String("var")) || !element.hasAttribute(QLatin1String("value")))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentEnvNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomElement element = node.toElement();
|
|
||||||
|
|
||||||
QString var = element.attribute(QLatin1String("var"));
|
|
||||||
QString value = element.attribute(QLatin1String("value"));
|
|
||||||
|
|
||||||
Utils::EnvironmentItem item(var, value);
|
|
||||||
environmentWidget()->appendEnvironmentItem(item);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentEnvNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
QDomDocumentFragment frag = doc.createDocumentFragment();
|
|
||||||
QList<Utils::EnvironmentItem> environmentItems = environmentWidget()->environment();
|
|
||||||
|
|
||||||
foreach (const Utils::EnvironmentItem &item, environmentItems) {
|
|
||||||
QDomElement element = doc.createElement(QLatin1String("env"));
|
|
||||||
element.setAttribute(QLatin1String("var"), item.name);
|
|
||||||
element.setAttribute(QLatin1String("value"), item.value);
|
|
||||||
frag.appendChild(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
return frag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentAuthorNodeHandler::BarDescriptorDocumentAuthorNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentAuthorNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("author"))
|
|
||||||
|| canHandleSimpleTextElement(node, QLatin1String("publisher"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentAuthorNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
authorInformationWidget()->setAuthor(loadSimpleTextElement(node));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentAuthorNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
return createSimpleTextElement(doc, QLatin1String("author"), authorInformationWidget()->author());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentAuthorIdNodeHandler::BarDescriptorDocumentAuthorIdNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentAuthorIdNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
return canHandleSimpleTextElement(node, QLatin1String("authorId"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentAuthorIdNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
if (!canHandle(node))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
authorInformationWidget()->setAuthorId(loadSimpleTextElement(node));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentAuthorIdNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
return createSimpleTextElement(doc, QLatin1String("authorId"), authorInformationWidget()->authorId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BarDescriptorDocumentUnknownNodeHandler::BarDescriptorDocumentUnknownNodeHandler(BarDescriptorEditorWidget *editorWidget)
|
|
||||||
: BarDescriptorDocumentAbstractNodeHandler(editorWidget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentUnknownNodeHandler::canHandle(const QDomNode &node) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(node);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorDocumentUnknownNodeHandler::fromNode(const QDomNode &node)
|
|
||||||
{
|
|
||||||
m_node = node.cloneNode();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNode BarDescriptorDocumentUnknownNodeHandler::toNode(QDomDocument &doc) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(doc);
|
|
||||||
return m_node;
|
|
||||||
}
|
|
||||||
@@ -1,302 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
|
|
||||||
**
|
|
||||||
** Contact: BlackBerry (qt@blackberry.com)
|
|
||||||
** Contact: KDAB (info@kdab.com)
|
|
||||||
**
|
|
||||||
** 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 QNX_INTERNAL_BARDESCRIPTORDOCUMENTNODEHANDLERS_H
|
|
||||||
#define QNX_INTERNAL_BARDESCRIPTORDOCUMENTNODEHANDLERS_H
|
|
||||||
|
|
||||||
#include <QDomNode>
|
|
||||||
#include <QSharedPointer>
|
|
||||||
|
|
||||||
namespace Qnx {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class BarDescriptorEditorWidget;
|
|
||||||
class BarDescriptorEditorAssetsWidget;
|
|
||||||
class BarDescriptorEditorAuthorInformationWidget;
|
|
||||||
class BarDescriptorEditorEntryPointWidget;
|
|
||||||
class BarDescriptorEditorEnvironmentWidget;
|
|
||||||
class BarDescriptorEditorGeneralWidget;
|
|
||||||
class BarDescriptorEditorPackageInformationWidget;
|
|
||||||
class BarDescriptorEditorPermissionsWidget;
|
|
||||||
|
|
||||||
class BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentAbstractNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
virtual ~BarDescriptorDocumentAbstractNodeHandler();
|
|
||||||
|
|
||||||
virtual bool canHandle(const QDomNode &node) const = 0;
|
|
||||||
bool handle(const QDomNode &node);
|
|
||||||
virtual QDomNode toNode(QDomDocument &doc) const = 0;
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
int order() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
BarDescriptorEditorPackageInformationWidget *packageInformationWidget() const;
|
|
||||||
BarDescriptorEditorAuthorInformationWidget *authorInformationWidget() const;
|
|
||||||
|
|
||||||
BarDescriptorEditorEntryPointWidget *entryPointWidget() const;
|
|
||||||
BarDescriptorEditorGeneralWidget *generalWidget() const;
|
|
||||||
BarDescriptorEditorPermissionsWidget *permissionsWidget() const;
|
|
||||||
BarDescriptorEditorEnvironmentWidget *environmentWidget() const;
|
|
||||||
|
|
||||||
BarDescriptorEditorAssetsWidget *assetsWidget() const;
|
|
||||||
|
|
||||||
virtual bool fromNode(const QDomNode &node) = 0;
|
|
||||||
|
|
||||||
bool canHandleSimpleTextElement(const QDomNode &node, const QString &tagName) const;
|
|
||||||
QString loadSimpleTextElement(const QDomNode &node);
|
|
||||||
QDomElement createSimpleTextElement(QDomDocument &doc, const QString &tagName, const QString &textValue) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
BarDescriptorEditorWidget *m_editorWidget;
|
|
||||||
|
|
||||||
int m_order;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentIdNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentIdNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentVersionNumberNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentVersionNumberNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentBuildIdNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentBuildIdNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentApplicationNameNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentApplicationNameNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentApplicationDescriptionNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentApplicationDescriptionNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentApplicationIconNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentApplicationIconNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentSplashScreenNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentSplashScreenNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentAssetNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentAssetNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentInitialWindowNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentInitialWindowNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentActionNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentActionNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentArgNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentArgNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentEnvNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentEnvNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentAuthorNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentAuthorNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentAuthorIdNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentAuthorIdNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BarDescriptorDocumentUnknownNodeHandler : public BarDescriptorDocumentAbstractNodeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorDocumentUnknownNodeHandler(BarDescriptorEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
bool canHandle(const QDomNode &node) const;
|
|
||||||
QDomNode toNode(QDomDocument &doc) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool fromNode(const QDomNode &node);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QDomNode m_node;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qnx
|
|
||||||
|
|
||||||
#endif // QNX_INTERNAL_BARDESCRIPTORDOCUMENTNODEHANDLERS_H
|
|
||||||
@@ -56,10 +56,10 @@ namespace Internal {
|
|||||||
|
|
||||||
BarDescriptorEditor::BarDescriptorEditor()
|
BarDescriptorEditor::BarDescriptorEditor()
|
||||||
{
|
{
|
||||||
|
m_file = new BarDescriptorDocument(this);
|
||||||
|
|
||||||
BarDescriptorEditorWidget *editorWidget = new BarDescriptorEditorWidget(this);
|
BarDescriptorEditorWidget *editorWidget = new BarDescriptorEditorWidget(this);
|
||||||
setWidget(editorWidget);
|
setWidget(editorWidget);
|
||||||
m_file = new BarDescriptorDocument(editorWidget);
|
|
||||||
connect(editorWidget, SIGNAL(changed()), m_file, SIGNAL(changed()));
|
|
||||||
|
|
||||||
m_toolBar = new QToolBar(editorWidget);
|
m_toolBar = new QToolBar(editorWidget);
|
||||||
|
|
||||||
@@ -106,7 +106,15 @@ BarDescriptorEditor::BarDescriptorEditor()
|
|||||||
bool BarDescriptorEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
bool BarDescriptorEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(fileName == realFileName, return false);
|
QTC_ASSERT(fileName == realFileName, return false);
|
||||||
return m_file->open(errorString, fileName);
|
|
||||||
|
bool result = m_file->open(errorString, fileName);
|
||||||
|
if (result) {
|
||||||
|
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
|
||||||
|
QTC_ASSERT(editorWidget, return false);
|
||||||
|
editorWidget->setFilePath(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IDocument *BarDescriptorEditor::document()
|
Core::IDocument *BarDescriptorEditor::document()
|
||||||
@@ -142,31 +150,6 @@ void BarDescriptorEditor::setActivePage(BarDescriptorEditor::EditorPage page)
|
|||||||
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
|
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
|
||||||
QTC_ASSERT(editorWidget, return);
|
QTC_ASSERT(editorWidget, return);
|
||||||
|
|
||||||
int prevPage = editorWidget->currentIndex();
|
|
||||||
|
|
||||||
if (prevPage == page)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (page == Source) {
|
|
||||||
editorWidget->setXmlSource(m_file->xmlSource());
|
|
||||||
updateCursorPosition();
|
|
||||||
} else if (prevPage == Source) {
|
|
||||||
TaskHub::clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR);
|
|
||||||
QString errorMsg;
|
|
||||||
int errorLine;
|
|
||||||
if (!m_file->loadContent(editorWidget->xmlSource(), &errorMsg, &errorLine)) {
|
|
||||||
TaskHub::addTask(Task::Error, errorMsg, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR,
|
|
||||||
Utils::FileName::fromString(m_file->filePath()), errorLine);
|
|
||||||
TaskHub::requestPopup();
|
|
||||||
|
|
||||||
foreach (QAction *action, m_actionGroup->actions())
|
|
||||||
if (action->data().toInt() == Source)
|
|
||||||
action->setChecked(true);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_cursorPositionAction->setVisible(page == Source);
|
m_cursorPositionAction->setVisible(page == Source);
|
||||||
editorWidget->setCurrentIndex(page);
|
editorWidget->setCurrentIndex(page);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,12 @@
|
|||||||
#include "bardescriptoreditorabstractpanelwidget.h"
|
#include "bardescriptoreditorabstractpanelwidget.h"
|
||||||
|
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QSignalMapper>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
@@ -44,40 +46,86 @@ using namespace Qnx::Internal;
|
|||||||
BarDescriptorEditorAbstractPanelWidget::BarDescriptorEditorAbstractPanelWidget(QWidget *parent) :
|
BarDescriptorEditorAbstractPanelWidget::BarDescriptorEditorAbstractPanelWidget(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
|
m_signalMapper = new QSignalMapper(this);
|
||||||
|
connect(m_signalMapper, SIGNAL(mapped(int)), this, SLOT(handleSignalMapped(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BarDescriptorEditorAbstractPanelWidget::setValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
void BarDescriptorEditorAbstractPanelWidget::setComboBoxBlocked(QComboBox *comboBox, int index)
|
|
||||||
{
|
{
|
||||||
bool blocked = comboBox->blockSignals(true);
|
if (m_blockedSignals.contains(tag))
|
||||||
comboBox->setCurrentIndex(index);
|
return;
|
||||||
comboBox->blockSignals(blocked);
|
|
||||||
|
blockSignalMapping(tag);
|
||||||
|
updateWidgetValue(tag, value);
|
||||||
|
unblockSignalMapping(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAbstractPanelWidget::setCheckBoxBlocked(QCheckBox *checkBox, bool checked)
|
void BarDescriptorEditorAbstractPanelWidget::addSignalMapping(BarDescriptorDocument::Tag tag, QObject *object, const char *signal)
|
||||||
{
|
{
|
||||||
bool blocked = checkBox->blockSignals(true);
|
m_signalMapper->setMapping(object, tag);
|
||||||
checkBox->setChecked(checked);
|
connect(object, signal, m_signalMapper, SLOT(map()));
|
||||||
checkBox->blockSignals(blocked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAbstractPanelWidget::setLineEditBlocked(QLineEdit *lineEdit, const QString &text)
|
void BarDescriptorEditorAbstractPanelWidget::blockSignalMapping(BarDescriptorDocument::Tag tag)
|
||||||
{
|
{
|
||||||
bool blocked = lineEdit->blockSignals(true);
|
m_blockedSignals.prepend(tag);
|
||||||
lineEdit->setText(text);
|
|
||||||
lineEdit->blockSignals(blocked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAbstractPanelWidget::setTextEditBlocked(QTextEdit *textEdit, const QString &text)
|
void BarDescriptorEditorAbstractPanelWidget::unblockSignalMapping(BarDescriptorDocument::Tag tag)
|
||||||
{
|
{
|
||||||
bool blocked = textEdit->blockSignals(true);
|
BarDescriptorDocument::Tag removedTag = m_blockedSignals.takeFirst();
|
||||||
textEdit->setPlainText(text);
|
QTC_CHECK(removedTag == tag);
|
||||||
textEdit->blockSignals(blocked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAbstractPanelWidget::setPathChooserBlocked(Utils::PathChooser *pathChooser, const QString &path)
|
void BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
{
|
{
|
||||||
bool blocked = pathChooser->blockSignals(true);
|
QObject *object = m_signalMapper->mapping(static_cast<int>(tag));
|
||||||
pathChooser->setPath(path);
|
if (!object)
|
||||||
pathChooser->blockSignals(blocked);
|
return;
|
||||||
|
|
||||||
|
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(object))
|
||||||
|
lineEdit->setText(value.toString());
|
||||||
|
else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(object))
|
||||||
|
textEdit->setPlainText(value.toString());
|
||||||
|
else if (Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(object))
|
||||||
|
pathChooser->setPath(value.toString());
|
||||||
|
else if (QComboBox *comboBox = qobject_cast<QComboBox *>(object))
|
||||||
|
comboBox->setCurrentIndex(comboBox->findData(value.toString()));
|
||||||
|
else if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(object))
|
||||||
|
checkBox->setChecked(value.toBool());
|
||||||
|
else
|
||||||
|
QTC_CHECK(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorEditorAbstractPanelWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||||
|
{
|
||||||
|
QObject *sender = m_signalMapper->mapping(tag);
|
||||||
|
|
||||||
|
if (!sender)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender))
|
||||||
|
emit changed(tag, lineEdit->text());
|
||||||
|
else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(sender))
|
||||||
|
emit changed(tag, textEdit->toPlainText());
|
||||||
|
else if (Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(sender))
|
||||||
|
emit changed(tag, pathChooser->path());
|
||||||
|
else if (QComboBox *comboBox = qobject_cast<QComboBox *>(sender))
|
||||||
|
emit changed(tag, comboBox->itemData(comboBox->currentIndex()));
|
||||||
|
else if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(sender))
|
||||||
|
emit changed(tag, checkBox->isChecked());
|
||||||
|
else
|
||||||
|
QTC_CHECK(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorEditorAbstractPanelWidget::handleSignalMapped(int id)
|
||||||
|
{
|
||||||
|
BarDescriptorDocument::Tag tag = static_cast<BarDescriptorDocument::Tag>(id);
|
||||||
|
|
||||||
|
if (m_blockedSignals.contains(tag))
|
||||||
|
return;
|
||||||
|
|
||||||
|
blockSignalMapping(tag);
|
||||||
|
emitChanged(tag);
|
||||||
|
unblockSignalMapping(tag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "bardescriptordocument.h"
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class PathChooser;
|
class PathChooser;
|
||||||
}
|
}
|
||||||
@@ -42,6 +44,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
class QSignalMapper;
|
||||||
|
class QStringListModel;
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@@ -54,17 +58,26 @@ class BarDescriptorEditorAbstractPanelWidget : public QWidget
|
|||||||
public:
|
public:
|
||||||
explicit BarDescriptorEditorAbstractPanelWidget(QWidget *parent = 0);
|
explicit BarDescriptorEditorAbstractPanelWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
virtual void clear() = 0;
|
public slots:
|
||||||
|
void setValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setComboBoxBlocked(QComboBox *comboBox, int index);
|
virtual void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
void setCheckBoxBlocked(QCheckBox *checkBox, bool checked);
|
virtual void emitChanged(BarDescriptorDocument::Tag tag);
|
||||||
void setLineEditBlocked(QLineEdit *lineEdit, const QString &text);
|
|
||||||
void setTextEditBlocked(QTextEdit *textEdit, const QString &text);
|
void addSignalMapping(BarDescriptorDocument::Tag tag, QObject *object, const char *signal);
|
||||||
void setPathChooserBlocked(Utils::PathChooser *pathChooser, const QString &path);
|
void blockSignalMapping(BarDescriptorDocument::Tag tag);
|
||||||
|
void unblockSignalMapping(BarDescriptorDocument::Tag tag);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleSignalMapped(int id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSignalMapper *m_signalMapper;
|
||||||
|
QList<BarDescriptorDocument::Tag> m_blockedSignals;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ BarDescriptorEditorAssetsWidget::BarDescriptorEditorAssetsWidget(QWidget *parent
|
|||||||
connect(m_ui->addAsset, SIGNAL(clicked()), this, SLOT(addNewAsset()));
|
connect(m_ui->addAsset, SIGNAL(clicked()), this, SLOT(addNewAsset()));
|
||||||
connect(m_ui->removeAsset, SIGNAL(clicked()), this, SLOT(removeSelectedAsset()));
|
connect(m_ui->removeAsset, SIGNAL(clicked()), this, SLOT(removeSelectedAsset()));
|
||||||
connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*)));
|
connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*)));
|
||||||
connectAssetsModel();
|
|
||||||
|
addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
||||||
|
addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
||||||
|
addSignalMapping(BarDescriptorDocument::asset, m_assetsModel, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BarDescriptorEditorAssetsWidget::~BarDescriptorEditorAssetsWidget()
|
BarDescriptorEditorAssetsWidget::~BarDescriptorEditorAssetsWidget()
|
||||||
@@ -67,32 +70,9 @@ BarDescriptorEditorAssetsWidget::~BarDescriptorEditorAssetsWidget()
|
|||||||
|
|
||||||
void BarDescriptorEditorAssetsWidget::clear()
|
void BarDescriptorEditorAssetsWidget::clear()
|
||||||
{
|
{
|
||||||
// We can't just block signals, as the view depends on them
|
blockSignalMapping(BarDescriptorDocument::asset);
|
||||||
disconnectAssetsModel();
|
|
||||||
m_assetsModel->removeRows(0, m_assetsModel->rowCount());
|
m_assetsModel->removeRows(0, m_assetsModel->rowCount());
|
||||||
connectAssetsModel();
|
unblockSignalMapping(BarDescriptorDocument::asset);
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorAssetsWidget::addAsset(const BarDescriptorAsset &asset)
|
|
||||||
{
|
|
||||||
disconnectAssetsModel();
|
|
||||||
addAssetInternal(asset);
|
|
||||||
connectAssetsModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BarDescriptorAsset> BarDescriptorEditorAssetsWidget::assets() const
|
|
||||||
{
|
|
||||||
QList<BarDescriptorAsset> result;
|
|
||||||
|
|
||||||
for (int i = 0; i < m_assetsModel->rowCount(); ++i) {
|
|
||||||
BarDescriptorAsset asset;
|
|
||||||
asset.source = m_assetsModel->item(i, 0)->text();
|
|
||||||
asset.destination = m_assetsModel->item(i, 1)->text();
|
|
||||||
asset.entry = m_assetsModel->item(i, 2)->checkState() == Qt::Checked;
|
|
||||||
result << asset;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStandardItemModel *BarDescriptorEditorAssetsWidget::assetsModel() const
|
QStandardItemModel *BarDescriptorEditorAssetsWidget::assetsModel() const
|
||||||
@@ -100,6 +80,19 @@ QStandardItemModel *BarDescriptorEditorAssetsWidget::assetsModel() const
|
|||||||
return m_assetsModel;
|
return m_assetsModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BarDescriptorEditorAssetsWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
|
{
|
||||||
|
if (tag != BarDescriptorDocument::asset) {
|
||||||
|
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clear();
|
||||||
|
BarDescriptorAssetList assets = value.value<BarDescriptorAssetList>();
|
||||||
|
foreach (const BarDescriptorAsset asset, assets)
|
||||||
|
addAsset(asset);
|
||||||
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAssetsWidget::addAsset(const QString &fullPath)
|
void BarDescriptorEditorAssetsWidget::addAsset(const QString &fullPath)
|
||||||
{
|
{
|
||||||
if (fullPath.isEmpty())
|
if (fullPath.isEmpty())
|
||||||
@@ -109,7 +102,7 @@ void BarDescriptorEditorAssetsWidget::addAsset(const QString &fullPath)
|
|||||||
asset.source = fullPath;
|
asset.source = fullPath;
|
||||||
asset.destination = QFileInfo(fullPath).fileName();
|
asset.destination = QFileInfo(fullPath).fileName();
|
||||||
asset.entry = false;
|
asset.entry = false;
|
||||||
addAssetInternal(asset);
|
addAsset(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAssetsWidget::removeAsset(const QString &fullPath)
|
void BarDescriptorEditorAssetsWidget::removeAsset(const QString &fullPath)
|
||||||
@@ -157,21 +150,28 @@ void BarDescriptorEditorAssetsWidget::updateEntryCheckState(QStandardItem *item)
|
|||||||
connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*)));
|
connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAssetsWidget::connectAssetsModel()
|
void BarDescriptorEditorAssetsWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||||
{
|
{
|
||||||
connect(m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
if (tag != BarDescriptorDocument::asset) {
|
||||||
connect(m_assetsModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(changed()));
|
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||||
connect(m_assetsModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(changed()));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BarDescriptorAssetList result;
|
||||||
|
for (int i = 0; i < m_assetsModel->rowCount(); ++i) {
|
||||||
|
BarDescriptorAsset asset;
|
||||||
|
asset.source = m_assetsModel->item(i, 0)->text();
|
||||||
|
asset.destination = m_assetsModel->item(i, 1)->text();
|
||||||
|
asset.entry = m_assetsModel->item(i, 2)->checkState() == Qt::Checked;
|
||||||
|
result.append(asset);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant var;
|
||||||
|
var.setValue(result);
|
||||||
|
emit changed(tag, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAssetsWidget::disconnectAssetsModel()
|
void BarDescriptorEditorAssetsWidget::addAsset(const BarDescriptorAsset &asset)
|
||||||
{
|
|
||||||
disconnect(m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
|
||||||
disconnect(m_assetsModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(changed()));
|
|
||||||
disconnect(m_assetsModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(changed()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorAssetsWidget::addAssetInternal(const BarDescriptorAsset &asset)
|
|
||||||
{
|
{
|
||||||
const QString path = asset.source;
|
const QString path = asset.source;
|
||||||
const QString dest = asset.destination;
|
const QString dest = asset.destination;
|
||||||
|
|||||||
@@ -56,27 +56,24 @@ public:
|
|||||||
explicit BarDescriptorEditorAssetsWidget(QWidget *parent = 0);
|
explicit BarDescriptorEditorAssetsWidget(QWidget *parent = 0);
|
||||||
~BarDescriptorEditorAssetsWidget();
|
~BarDescriptorEditorAssetsWidget();
|
||||||
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
void addAsset(const BarDescriptorAsset &asset);
|
|
||||||
QList<BarDescriptorAsset> assets() const;
|
|
||||||
|
|
||||||
QStandardItemModel *assetsModel() const;
|
QStandardItemModel *assetsModel() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addAsset(const QString &fullPath);
|
void addAsset(const QString &fullPath);
|
||||||
void removeAsset(const QString &fullPath);
|
void removeAsset(const QString &fullPath);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
|
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addNewAsset();
|
void addNewAsset();
|
||||||
void removeSelectedAsset();
|
void removeSelectedAsset();
|
||||||
void updateEntryCheckState(QStandardItem *item);
|
void updateEntryCheckState(QStandardItem *item);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void connectAssetsModel();
|
void clear();
|
||||||
void disconnectAssetsModel();
|
void addAsset(const BarDescriptorAsset &asset);
|
||||||
|
|
||||||
void addAssetInternal(const BarDescriptorAsset &asset);
|
|
||||||
bool hasAsset(const BarDescriptorAsset &asset);
|
bool hasAsset(const BarDescriptorAsset &asset);
|
||||||
|
|
||||||
Ui::BarDescriptorEditorAssetsWidget *m_ui;
|
Ui::BarDescriptorEditorAssetsWidget *m_ui;
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ BarDescriptorEditorAuthorInformationWidget::BarDescriptorEditorAuthorInformation
|
|||||||
|
|
||||||
m_ui->setFromDebugToken->setVisible(BlackBerryDebugTokenReader::isSupported());
|
m_ui->setFromDebugToken->setVisible(BlackBerryDebugTokenReader::isSupported());
|
||||||
|
|
||||||
connect(m_ui->author, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::author, m_ui->author, SIGNAL(textChanged(QString)));
|
||||||
connect(m_ui->authorId, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::authorId, m_ui->authorId, SIGNAL(textChanged(QString)));
|
||||||
connect(m_ui->setFromDebugToken, SIGNAL(clicked()), this, SLOT(setAuthorFromDebugToken()));
|
connect(m_ui->setFromDebugToken, SIGNAL(clicked()), this, SLOT(setAuthorFromDebugToken()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,30 +63,13 @@ BarDescriptorEditorAuthorInformationWidget::~BarDescriptorEditorAuthorInformatio
|
|||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAuthorInformationWidget::clear()
|
void BarDescriptorEditorAuthorInformationWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
{
|
{
|
||||||
setLineEditBlocked(m_ui->author, QString());
|
if (tag == BarDescriptorDocument::publisher && !value.toString().isEmpty())
|
||||||
setLineEditBlocked(m_ui->authorId, QString());
|
// <publisher> is deprecated and hence not connected to the author field as we only want to read it from the XML
|
||||||
}
|
m_ui->author->setText(value.toString());
|
||||||
|
else
|
||||||
QString BarDescriptorEditorAuthorInformationWidget::author() const
|
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||||
{
|
|
||||||
return m_ui->author->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorAuthorInformationWidget::setAuthor(const QString &author)
|
|
||||||
{
|
|
||||||
setLineEditBlocked(m_ui->author, author);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorEditorAuthorInformationWidget::authorId() const
|
|
||||||
{
|
|
||||||
return m_ui->authorId->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorAuthorInformationWidget::setAuthorId(const QString &authorId)
|
|
||||||
{
|
|
||||||
setLineEditBlocked(m_ui->authorId, authorId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorAuthorInformationWidget::setAuthorFromDebugToken()
|
void BarDescriptorEditorAuthorInformationWidget::setAuthorFromDebugToken()
|
||||||
|
|||||||
@@ -49,13 +49,8 @@ public:
|
|||||||
explicit BarDescriptorEditorAuthorInformationWidget(QWidget *parent = 0);
|
explicit BarDescriptorEditorAuthorInformationWidget(QWidget *parent = 0);
|
||||||
~BarDescriptorEditorAuthorInformationWidget();
|
~BarDescriptorEditorAuthorInformationWidget();
|
||||||
|
|
||||||
void clear();
|
protected:
|
||||||
|
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
QString author() const;
|
|
||||||
void setAuthor(const QString &author);
|
|
||||||
|
|
||||||
QString authorId() const;
|
|
||||||
void setAuthorId(const QString &authorId);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setAuthorFromDebugToken();
|
void setAuthorFromDebugToken();
|
||||||
|
|||||||
@@ -65,9 +65,6 @@ BarDescriptorEditorEntryPointWidget::BarDescriptorEditorEntryPointWidget(QWidget
|
|||||||
m_ui->splashScreenWarningLabel->setVisible(false);
|
m_ui->splashScreenWarningLabel->setVisible(false);
|
||||||
m_ui->splashScreenWarningPixmap->setVisible(false);
|
m_ui->splashScreenWarningPixmap->setVisible(false);
|
||||||
|
|
||||||
connect(m_ui->applicationName, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
|
|
||||||
connect(m_ui->applicationDescription, SIGNAL(textChanged()), this, SIGNAL(changed()));
|
|
||||||
|
|
||||||
connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(handleIconChanged(QString)));
|
connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(handleIconChanged(QString)));
|
||||||
connect(m_ui->iconClearButton, SIGNAL(clicked()), this, SLOT(clearIcon()));
|
connect(m_ui->iconClearButton, SIGNAL(clicked()), this, SLOT(clearIcon()));
|
||||||
|
|
||||||
@@ -75,8 +72,14 @@ BarDescriptorEditorEntryPointWidget::BarDescriptorEditorEntryPointWidget(QWidget
|
|||||||
m_ui->splashScreensView->setModel(m_splashScreenModel);
|
m_ui->splashScreensView->setModel(m_splashScreenModel);
|
||||||
connect(m_ui->addSplashScreen, SIGNAL(clicked()), this, SLOT(browseForSplashScreen()));
|
connect(m_ui->addSplashScreen, SIGNAL(clicked()), this, SLOT(browseForSplashScreen()));
|
||||||
connect(m_ui->removeSplashScreen, SIGNAL(clicked()), this, SLOT(removeSelectedSplashScreen()));
|
connect(m_ui->removeSplashScreen, SIGNAL(clicked()), this, SLOT(removeSelectedSplashScreen()));
|
||||||
connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
|
||||||
connect(m_ui->splashScreensView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleSplashScreenSelectionChanged(QItemSelection,QItemSelection)));
|
connect(m_ui->splashScreensView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleSplashScreenSelectionChanged(QItemSelection,QItemSelection)));
|
||||||
|
|
||||||
|
addSignalMapping(BarDescriptorDocument::name, m_ui->applicationName, SIGNAL(textChanged(QString)));
|
||||||
|
addSignalMapping(BarDescriptorDocument::description, m_ui->applicationDescription, SIGNAL(textChanged()));
|
||||||
|
addSignalMapping(BarDescriptorDocument::icon, m_ui->iconFilePath, SIGNAL(changed(QString)));
|
||||||
|
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
||||||
|
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
||||||
|
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BarDescriptorEditorEntryPointWidget::~BarDescriptorEditorEntryPointWidget()
|
BarDescriptorEditorEntryPointWidget::~BarDescriptorEditorEntryPointWidget()
|
||||||
@@ -84,68 +87,40 @@ BarDescriptorEditorEntryPointWidget::~BarDescriptorEditorEntryPointWidget()
|
|||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorEntryPointWidget::clear()
|
|
||||||
{
|
|
||||||
setPathChooserBlocked(m_ui->iconFilePath, QString());
|
|
||||||
setApplicationIconPreview(QString());
|
|
||||||
|
|
||||||
disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
|
||||||
m_splashScreenModel->setStringList(QStringList());
|
|
||||||
connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
|
||||||
setImagePreview(m_ui->splashScreenPreviewLabel, QString());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorEditorEntryPointWidget::applicationName() const
|
|
||||||
{
|
|
||||||
return m_ui->applicationName->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorEntryPointWidget::setApplicationName(const QString &applicationName)
|
|
||||||
{
|
|
||||||
setLineEditBlocked(m_ui->applicationName, applicationName);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorEditorEntryPointWidget::applicationDescription() const
|
|
||||||
{
|
|
||||||
return m_ui->applicationDescription->toPlainText();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorEntryPointWidget::setApplicationDescription(const QString &applicationDescription)
|
|
||||||
{
|
|
||||||
setTextEditBlocked(m_ui->applicationDescription, applicationDescription);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorEditorEntryPointWidget::applicationIconFileName() const
|
|
||||||
{
|
|
||||||
return QFileInfo(m_ui->iconFilePath->path()).fileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorEntryPointWidget::setApplicationIcon(const QString &iconPath)
|
|
||||||
{
|
|
||||||
// During file loading, the assets might not have been read yet
|
|
||||||
QMetaObject::invokeMethod(this, "setApplicationIconDelayed", Qt::QueuedConnection, Q_ARG(QString, iconPath));
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList BarDescriptorEditorEntryPointWidget::splashScreens() const
|
|
||||||
{
|
|
||||||
QStringList result;
|
|
||||||
|
|
||||||
foreach (const QString &splashScreen, m_splashScreenModel->stringList())
|
|
||||||
result << QFileInfo(splashScreen).fileName();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorEntryPointWidget::appendSplashScreen(const QString &splashScreenPath)
|
|
||||||
{
|
|
||||||
QMetaObject::invokeMethod(this, "appendSplashScreenDelayed", Qt::QueuedConnection, Q_ARG(QString, splashScreenPath));
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorEntryPointWidget::setAssetsModel(QStandardItemModel *assetsModel)
|
void BarDescriptorEditorEntryPointWidget::setAssetsModel(QStandardItemModel *assetsModel)
|
||||||
{
|
{
|
||||||
m_assetsModel = QWeakPointer<QStandardItemModel>(assetsModel);
|
m_assetsModel = QWeakPointer<QStandardItemModel>(assetsModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BarDescriptorEditorEntryPointWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
|
{
|
||||||
|
// During file loading, the assets might not have been read yet
|
||||||
|
if (tag == BarDescriptorDocument::icon) {
|
||||||
|
QMetaObject::invokeMethod(this, "setApplicationIconDelayed", Qt::QueuedConnection, Q_ARG(QString, value.toString()));
|
||||||
|
} else if (tag == BarDescriptorDocument::splashScreens) {
|
||||||
|
QStringList splashScreens = value.toStringList();
|
||||||
|
foreach (const QString &splashScreen, splashScreens)
|
||||||
|
QMetaObject::invokeMethod(this, "appendSplashScreenDelayed", Qt::QueuedConnection, Q_ARG(QString, splashScreen));
|
||||||
|
} else {
|
||||||
|
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorEditorEntryPointWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||||
|
{
|
||||||
|
if (tag == BarDescriptorDocument::icon) {
|
||||||
|
emit changed(tag, QFileInfo(m_ui->iconFilePath->path()).fileName());
|
||||||
|
} else if (tag == BarDescriptorDocument::splashScreens) {
|
||||||
|
QStringList list;
|
||||||
|
foreach (const QString &splashScreen, m_splashScreenModel->stringList())
|
||||||
|
list << QFileInfo(splashScreen).fileName();
|
||||||
|
|
||||||
|
emit changed(tag, list);
|
||||||
|
} else {
|
||||||
|
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorEntryPointWidget::setApplicationIconPreview(const QString &path)
|
void BarDescriptorEditorEntryPointWidget::setApplicationIconPreview(const QString &path)
|
||||||
{
|
{
|
||||||
setImagePreview(m_ui->iconPreviewLabel, path);
|
setImagePreview(m_ui->iconPreviewLabel, path);
|
||||||
@@ -164,7 +139,7 @@ void BarDescriptorEditorEntryPointWidget::handleIconChanged(const QString &path)
|
|||||||
setApplicationIconPreview(path);
|
setApplicationIconPreview(path);
|
||||||
validateIconSize(path);
|
validateIconSize(path);
|
||||||
|
|
||||||
emit changed();
|
if (!m_splashScreenModel->stringList().contains(m_prevIconPath))
|
||||||
emit imageRemoved(m_prevIconPath);
|
emit imageRemoved(m_prevIconPath);
|
||||||
|
|
||||||
m_prevIconPath = path;
|
m_prevIconPath = path;
|
||||||
@@ -200,6 +175,7 @@ void BarDescriptorEditorEntryPointWidget::removeSelectedSplashScreen()
|
|||||||
|
|
||||||
foreach (const QModelIndex &index, selectedIndexes) {
|
foreach (const QModelIndex &index, selectedIndexes) {
|
||||||
QString path = m_splashScreenModel->data(index, Qt::DisplayRole).toString();
|
QString path = m_splashScreenModel->data(index, Qt::DisplayRole).toString();
|
||||||
|
if (path != m_ui->iconFilePath->path())
|
||||||
emit imageRemoved(path);
|
emit imageRemoved(path);
|
||||||
|
|
||||||
m_splashScreenModel->removeRow(index.row());
|
m_splashScreenModel->removeRow(index.row());
|
||||||
@@ -230,11 +206,11 @@ void BarDescriptorEditorEntryPointWidget::appendSplashScreenDelayed(const QStrin
|
|||||||
if (fullSplashScreenPath.isEmpty())
|
if (fullSplashScreenPath.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
blockSignalMapping(BarDescriptorDocument::splashScreens);
|
||||||
int rowCount = m_splashScreenModel->rowCount();
|
int rowCount = m_splashScreenModel->rowCount();
|
||||||
m_splashScreenModel->insertRow(rowCount);
|
m_splashScreenModel->insertRow(rowCount);
|
||||||
m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fullSplashScreenPath);
|
m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fullSplashScreenPath);
|
||||||
connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
unblockSignalMapping(BarDescriptorDocument::splashScreens);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorEntryPointWidget::setImagePreview(QLabel *previewLabel, const QString &path)
|
void BarDescriptorEditorEntryPointWidget::setImagePreview(QLabel *previewLabel, const QString &path)
|
||||||
@@ -309,9 +285,11 @@ void BarDescriptorEditorEntryPointWidget::setApplicationIconDelayed(const QStrin
|
|||||||
if (fullIconPath.isEmpty())
|
if (fullIconPath.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setPathChooserBlocked(m_ui->iconFilePath, fullIconPath);
|
blockSignalMapping(BarDescriptorDocument::icon);
|
||||||
|
m_ui->iconFilePath->setPath(fullIconPath);
|
||||||
setApplicationIconPreview(fullIconPath);
|
setApplicationIconPreview(fullIconPath);
|
||||||
validateIconSize(fullIconPath);
|
validateIconSize(fullIconPath);
|
||||||
|
unblockSignalMapping(BarDescriptorDocument::icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BarDescriptorEditorEntryPointWidget::localAssetPathFromDestination(const QString &destination)
|
QString BarDescriptorEditorEntryPointWidget::localAssetPathFromDestination(const QString &destination)
|
||||||
|
|||||||
@@ -57,26 +57,16 @@ public:
|
|||||||
explicit BarDescriptorEditorEntryPointWidget(QWidget *parent = 0);
|
explicit BarDescriptorEditorEntryPointWidget(QWidget *parent = 0);
|
||||||
~BarDescriptorEditorEntryPointWidget();
|
~BarDescriptorEditorEntryPointWidget();
|
||||||
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
QString applicationName() const;
|
|
||||||
void setApplicationName(const QString &applicationName);
|
|
||||||
|
|
||||||
QString applicationDescription() const;
|
|
||||||
void setApplicationDescription(const QString &applicationDescription);
|
|
||||||
|
|
||||||
QString applicationIconFileName() const;
|
|
||||||
void setApplicationIcon(const QString &iconPath);
|
|
||||||
|
|
||||||
QStringList splashScreens() const;
|
|
||||||
void appendSplashScreen(const QString &splashScreenPath);
|
|
||||||
|
|
||||||
void setAssetsModel(QStandardItemModel *assetsModel);
|
void setAssetsModel(QStandardItemModel *assetsModel);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void imageAdded(const QString &path);
|
void imageAdded(const QString &path);
|
||||||
void imageRemoved(const QString &path);
|
void imageRemoved(const QString &path);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
|
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setApplicationIconDelayed(const QString &iconPath);
|
void setApplicationIconDelayed(const QString &iconPath);
|
||||||
void setApplicationIconPreview(const QString &path);
|
void setApplicationIconPreview(const QString &path);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ BarDescriptorEditorEnvironmentWidget::BarDescriptorEditorEnvironmentWidget(QWidg
|
|||||||
|
|
||||||
m_ui->environmentWidget->setBaseEnvironmentText(tr("Device Environment"));
|
m_ui->environmentWidget->setBaseEnvironmentText(tr("Device Environment"));
|
||||||
|
|
||||||
connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::env, m_ui->environmentWidget, SIGNAL(userChangesChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
BarDescriptorEditorEnvironmentWidget::~BarDescriptorEditorEnvironmentWidget()
|
BarDescriptorEditorEnvironmentWidget::~BarDescriptorEditorEnvironmentWidget()
|
||||||
@@ -51,23 +51,24 @@ BarDescriptorEditorEnvironmentWidget::~BarDescriptorEditorEnvironmentWidget()
|
|||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorEnvironmentWidget::clear()
|
void BarDescriptorEditorEnvironmentWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
{
|
{
|
||||||
disconnect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed()));
|
if (tag != BarDescriptorDocument::env) {
|
||||||
m_ui->environmentWidget->setUserChanges(QList<Utils::EnvironmentItem>());
|
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||||
connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed()));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui->environmentWidget->setUserChanges(value.value<QList<Utils::EnvironmentItem> >());
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Utils::EnvironmentItem> BarDescriptorEditorEnvironmentWidget::environment() const
|
void BarDescriptorEditorEnvironmentWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||||
{
|
{
|
||||||
return m_ui->environmentWidget->userChanges();
|
if (tag != BarDescriptorDocument::env) {
|
||||||
}
|
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorEnvironmentWidget::appendEnvironmentItem(const Utils::EnvironmentItem &envItem)
|
QVariant var;
|
||||||
{
|
var.setValue(m_ui->environmentWidget->userChanges());
|
||||||
disconnect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed()));
|
emit changed(tag, var);
|
||||||
QList<Utils::EnvironmentItem> items = m_ui->environmentWidget->userChanges();
|
|
||||||
items.append(envItem);
|
|
||||||
m_ui->environmentWidget->setUserChanges(items);
|
|
||||||
connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed()));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,10 +51,9 @@ public:
|
|||||||
explicit BarDescriptorEditorEnvironmentWidget(QWidget *parent = 0);
|
explicit BarDescriptorEditorEnvironmentWidget(QWidget *parent = 0);
|
||||||
~BarDescriptorEditorEnvironmentWidget();
|
~BarDescriptorEditorEnvironmentWidget();
|
||||||
|
|
||||||
void clear();
|
protected:
|
||||||
|
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
QList<Utils::EnvironmentItem> environment() const;
|
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||||
void appendEnvironmentItem(const Utils::EnvironmentItem &envItem);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BarDescriptorEditorEnvironmentWidget *m_ui;
|
Ui::BarDescriptorEditorEnvironmentWidget *m_ui;
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ BarDescriptorEditorGeneralWidget::BarDescriptorEditorGeneralWidget(QWidget *pare
|
|||||||
m_ui->chrome->addItem(tr("Standard"), QLatin1String("standard"));
|
m_ui->chrome->addItem(tr("Standard"), QLatin1String("standard"));
|
||||||
m_ui->chrome->addItem(tr("None"), QLatin1String("none"));
|
m_ui->chrome->addItem(tr("None"), QLatin1String("none"));
|
||||||
|
|
||||||
connect(m_ui->orientation, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::aspectRatio, m_ui->orientation, SIGNAL(currentIndexChanged(int)));
|
||||||
connect(m_ui->chrome, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::systemChrome, m_ui->chrome, SIGNAL(currentIndexChanged(int)));
|
||||||
connect(m_ui->transparentMainWindow, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::transparent, m_ui->transparentMainWindow, SIGNAL(toggled(bool)));
|
||||||
connect(m_ui->applicationArguments, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::arg, m_ui->applicationArguments, SIGNAL(textChanged(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BarDescriptorEditorGeneralWidget::~BarDescriptorEditorGeneralWidget()
|
BarDescriptorEditorGeneralWidget::~BarDescriptorEditorGeneralWidget()
|
||||||
@@ -62,62 +62,41 @@ BarDescriptorEditorGeneralWidget::~BarDescriptorEditorGeneralWidget()
|
|||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorGeneralWidget::clear()
|
void BarDescriptorEditorGeneralWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
{
|
{
|
||||||
setComboBoxBlocked(m_ui->orientation, m_ui->orientation->findData(QLatin1String("")));
|
if (tag == BarDescriptorDocument::aspectRatio) {
|
||||||
setComboBoxBlocked(m_ui->chrome, m_ui->chrome->findData(QLatin1String("none")));
|
m_ui->orientation->setCurrentIndex(m_ui->orientation->findData(value));
|
||||||
setCheckBoxBlocked(m_ui->transparentMainWindow, false);
|
} else if (tag == BarDescriptorDocument::autoOrients) {
|
||||||
setLineEditBlocked(m_ui->applicationArguments, QString());
|
if (value.toString() == QLatin1String("true")) {
|
||||||
|
blockSignalMapping(BarDescriptorDocument::aspectRatio);
|
||||||
|
m_ui->orientation->setCurrentIndex(m_ui->orientation->findData(QLatin1String("auto-orient")));
|
||||||
|
unblockSignalMapping(BarDescriptorDocument::aspectRatio);
|
||||||
|
}
|
||||||
|
} else if (tag == BarDescriptorDocument::arg) {
|
||||||
|
m_ui->applicationArguments->setText(value.toStringList().join(QLatin1String(" ")));
|
||||||
|
} else {
|
||||||
|
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BarDescriptorEditorGeneralWidget::orientation() const
|
void BarDescriptorEditorGeneralWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||||
{
|
{
|
||||||
return m_ui->orientation->itemData(m_ui->orientation->currentIndex()).toString();
|
if (tag == BarDescriptorDocument::aspectRatio) {
|
||||||
}
|
QString value = m_ui->orientation->itemData(m_ui->orientation->currentIndex()).toString();
|
||||||
|
if (value == QLatin1String("auto-orient")) {
|
||||||
void BarDescriptorEditorGeneralWidget::setOrientation(const QString &orientation)
|
emit changed(BarDescriptorDocument::aspectRatio, QLatin1String(""));
|
||||||
{
|
emit changed(BarDescriptorDocument::autoOrients, QLatin1String("true"));
|
||||||
int index = m_ui->orientation->findData(orientation);
|
return;
|
||||||
QTC_ASSERT(index >= 0, return);
|
} else if (!value.isEmpty()) {
|
||||||
|
emit changed(BarDescriptorDocument::aspectRatio, value);
|
||||||
setComboBoxBlocked(m_ui->orientation, index);
|
emit changed(BarDescriptorDocument::autoOrients, QLatin1String("false"));
|
||||||
}
|
} else {
|
||||||
|
emit changed(BarDescriptorDocument::aspectRatio, value);
|
||||||
QString BarDescriptorEditorGeneralWidget::chrome() const
|
emit changed(BarDescriptorDocument::autoOrients, QLatin1String(""));
|
||||||
{
|
}
|
||||||
return m_ui->chrome->itemData(m_ui->chrome->currentIndex()).toString();
|
} else if (tag == BarDescriptorDocument::arg) {
|
||||||
}
|
emit changed(tag, m_ui->applicationArguments->text().split(QLatin1Char(' ')));
|
||||||
|
} else {
|
||||||
void BarDescriptorEditorGeneralWidget::setChrome(const QString &chrome)
|
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||||
{
|
}
|
||||||
int index = m_ui->chrome->findData(chrome);
|
|
||||||
QTC_ASSERT(index >= 0, return);
|
|
||||||
|
|
||||||
setComboBoxBlocked(m_ui->chrome, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorEditorGeneralWidget::transparent() const
|
|
||||||
{
|
|
||||||
return m_ui->transparentMainWindow->isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorGeneralWidget::setTransparent(bool transparent)
|
|
||||||
{
|
|
||||||
setCheckBoxBlocked(m_ui->transparentMainWindow, transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorGeneralWidget::appendApplicationArgument(const QString &argument)
|
|
||||||
{
|
|
||||||
QString completeArguments = m_ui->applicationArguments->text();
|
|
||||||
if (!completeArguments.isEmpty())
|
|
||||||
completeArguments.append(QLatin1Char(' '));
|
|
||||||
completeArguments.append(argument);
|
|
||||||
|
|
||||||
setLineEditBlocked(m_ui->applicationArguments, completeArguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList BarDescriptorEditorGeneralWidget::applicationArguments() const
|
|
||||||
{
|
|
||||||
// TODO: Should probably handle "argument with spaces within quotes"
|
|
||||||
return m_ui->applicationArguments->text().split(QLatin1Char(' '));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,19 +49,9 @@ public:
|
|||||||
explicit BarDescriptorEditorGeneralWidget(QWidget *parent = 0);
|
explicit BarDescriptorEditorGeneralWidget(QWidget *parent = 0);
|
||||||
~BarDescriptorEditorGeneralWidget();
|
~BarDescriptorEditorGeneralWidget();
|
||||||
|
|
||||||
void clear();
|
protected:
|
||||||
|
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
QString orientation() const;
|
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||||
void setOrientation(const QString &orientation);
|
|
||||||
|
|
||||||
QString chrome() const;
|
|
||||||
void setChrome(const QString &chrome);
|
|
||||||
|
|
||||||
bool transparent() const;
|
|
||||||
void setTransparent(bool transparent);
|
|
||||||
|
|
||||||
void appendApplicationArgument(const QString &argument);
|
|
||||||
QStringList applicationArguments() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BarDescriptorEditorGeneralWidget *m_ui;
|
Ui::BarDescriptorEditorGeneralWidget *m_ui;
|
||||||
|
|||||||
@@ -45,55 +45,12 @@ BarDescriptorEditorPackageInformationWidget::BarDescriptorEditorPackageInformati
|
|||||||
QRegExpValidator *versionNumberValidator = new QRegExpValidator(versionNumberRegExp, this);
|
QRegExpValidator *versionNumberValidator = new QRegExpValidator(versionNumberRegExp, this);
|
||||||
m_ui->packageVersion->setValidator(versionNumberValidator);
|
m_ui->packageVersion->setValidator(versionNumberValidator);
|
||||||
|
|
||||||
connect(m_ui->packageId, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::id, m_ui->packageId, SIGNAL(textChanged(QString)));
|
||||||
connect(m_ui->packageVersion, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::versionNumber, m_ui->packageVersion, SIGNAL(textChanged(QString)));
|
||||||
connect(m_ui->packageBuildId, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
|
addSignalMapping(BarDescriptorDocument::buildId, m_ui->packageBuildId, SIGNAL(textChanged(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BarDescriptorEditorPackageInformationWidget::~BarDescriptorEditorPackageInformationWidget()
|
BarDescriptorEditorPackageInformationWidget::~BarDescriptorEditorPackageInformationWidget()
|
||||||
{
|
{
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorPackageInformationWidget::clear()
|
|
||||||
{
|
|
||||||
setLineEditBlocked(m_ui->packageId, QString());
|
|
||||||
setLineEditBlocked(m_ui->packageVersion, QString());
|
|
||||||
setLineEditBlocked(m_ui->packageBuildId, QString());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorEditorPackageInformationWidget::packageId() const
|
|
||||||
{
|
|
||||||
return m_ui->packageId->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorPackageInformationWidget::setPackageId(const QString &packageId)
|
|
||||||
{
|
|
||||||
setLineEditBlocked(m_ui->packageId, packageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorEditorPackageInformationWidget::packageVersion() const
|
|
||||||
{
|
|
||||||
QString version = m_ui->packageVersion->text();
|
|
||||||
int pos = 0;
|
|
||||||
if (m_ui->packageVersion->validator()->validate(version, pos) == QValidator::Intermediate) {
|
|
||||||
if (version.endsWith(QLatin1Char('.')))
|
|
||||||
version = version.left(version.size() - 1);
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorPackageInformationWidget::setPackageVersion(const QString &packageVersion)
|
|
||||||
{
|
|
||||||
setLineEditBlocked(m_ui->packageVersion, packageVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BarDescriptorEditorPackageInformationWidget::packageBuildId() const
|
|
||||||
{
|
|
||||||
return m_ui->packageBuildId->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorPackageInformationWidget::setPackageBuildId(const QString &packageBuildId)
|
|
||||||
{
|
|
||||||
setLineEditBlocked(m_ui->packageBuildId, packageBuildId);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -49,17 +49,6 @@ public:
|
|||||||
explicit BarDescriptorEditorPackageInformationWidget(QWidget *parent = 0);
|
explicit BarDescriptorEditorPackageInformationWidget(QWidget *parent = 0);
|
||||||
~BarDescriptorEditorPackageInformationWidget();
|
~BarDescriptorEditorPackageInformationWidget();
|
||||||
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
QString packageId() const;
|
|
||||||
void setPackageId(const QString &packageId);
|
|
||||||
|
|
||||||
QString packageVersion() const;
|
|
||||||
void setPackageVersion(const QString &packageVersion);
|
|
||||||
|
|
||||||
QString packageBuildId() const;
|
|
||||||
void setPackageBuildId(const QString &packageBuildId);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BarDescriptorEditorPackageInformationWidget *m_ui;
|
Ui::BarDescriptorEditorPackageInformationWidget *m_ui;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ BarDescriptorEditorPermissionsWidget::BarDescriptorEditorPermissionsWidget(QWidg
|
|||||||
|
|
||||||
connect(m_ui->selectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(checkAll()));
|
connect(m_ui->selectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(checkAll()));
|
||||||
connect(m_ui->deselectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(uncheckAll()));
|
connect(m_ui->deselectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(uncheckAll()));
|
||||||
connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
|
||||||
|
addSignalMapping(BarDescriptorDocument::action, m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BarDescriptorEditorPermissionsWidget::~BarDescriptorEditorPermissionsWidget()
|
BarDescriptorEditorPermissionsWidget::~BarDescriptorEditorPermissionsWidget()
|
||||||
@@ -56,13 +57,6 @@ BarDescriptorEditorPermissionsWidget::~BarDescriptorEditorPermissionsWidget()
|
|||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorPermissionsWidget::clear()
|
|
||||||
{
|
|
||||||
disconnect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
|
||||||
m_permissionsModel->uncheckAll();
|
|
||||||
connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList BarDescriptorEditorPermissionsWidget::checkedPermissions() const
|
QStringList BarDescriptorEditorPermissionsWidget::checkedPermissions() const
|
||||||
{
|
{
|
||||||
return m_permissionsModel->checkedIdentifiers();
|
return m_permissionsModel->checkedIdentifiers();
|
||||||
@@ -70,7 +64,29 @@ QStringList BarDescriptorEditorPermissionsWidget::checkedPermissions() const
|
|||||||
|
|
||||||
void BarDescriptorEditorPermissionsWidget::checkPermission(const QString &identifier)
|
void BarDescriptorEditorPermissionsWidget::checkPermission(const QString &identifier)
|
||||||
{
|
{
|
||||||
disconnect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
blockSignalMapping(BarDescriptorDocument::action);
|
||||||
m_permissionsModel->checkPermission(identifier);
|
m_permissionsModel->checkPermission(identifier);
|
||||||
connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
|
unblockSignalMapping(BarDescriptorDocument::action);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorEditorPermissionsWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
|
||||||
|
{
|
||||||
|
if (tag != BarDescriptorDocument::action) {
|
||||||
|
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList permissions = value.toStringList();
|
||||||
|
Q_FOREACH (const QString &permission, permissions)
|
||||||
|
checkPermission(permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarDescriptorEditorPermissionsWidget::emitChanged(BarDescriptorDocument::Tag tag)
|
||||||
|
{
|
||||||
|
if (tag != BarDescriptorDocument::action) {
|
||||||
|
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit changed(tag, checkedPermissions());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,12 +51,14 @@ public:
|
|||||||
explicit BarDescriptorEditorPermissionsWidget(QWidget *parent = 0);
|
explicit BarDescriptorEditorPermissionsWidget(QWidget *parent = 0);
|
||||||
~BarDescriptorEditorPermissionsWidget();
|
~BarDescriptorEditorPermissionsWidget();
|
||||||
|
|
||||||
void clear();
|
protected:
|
||||||
|
void updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
|
void emitChanged(BarDescriptorDocument::Tag tag);
|
||||||
|
|
||||||
|
private:
|
||||||
QStringList checkedPermissions() const;
|
QStringList checkedPermissions() const;
|
||||||
void checkPermission(const QString &identifier);
|
void checkPermission(const QString &identifier);
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::BarDescriptorEditorPermissionsWidget *m_ui;
|
Ui::BarDescriptorEditorPermissionsWidget *m_ui;
|
||||||
|
|
||||||
BarDescriptorPermissionsModel *m_permissionsModel;
|
BarDescriptorPermissionsModel *m_permissionsModel;
|
||||||
|
|||||||
@@ -44,9 +44,12 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/iprojectproperties.h>
|
#include <projectexplorer/iprojectproperties.h>
|
||||||
#include <projectexplorer/projectwindow.h>
|
#include <projectexplorer/projectwindow.h>
|
||||||
|
#include <projectexplorer/task.h>
|
||||||
|
#include <projectexplorer/taskhub.h>
|
||||||
#include <texteditor/plaintexteditor.h>
|
#include <texteditor/plaintexteditor.h>
|
||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
@@ -54,7 +57,6 @@ using namespace Qnx::Internal;
|
|||||||
BarDescriptorEditorWidget::BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent)
|
BarDescriptorEditorWidget::BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent)
|
||||||
: QStackedWidget(parent)
|
: QStackedWidget(parent)
|
||||||
, m_editor(editor)
|
, m_editor(editor)
|
||||||
, m_dirty(false)
|
|
||||||
{
|
{
|
||||||
Core::IContext *myContext = new Core::IContext(this);
|
Core::IContext *myContext = new Core::IContext(this);
|
||||||
myContext->setWidget(this);
|
myContext->setWidget(this);
|
||||||
@@ -67,6 +69,25 @@ BarDescriptorEditorWidget::BarDescriptorEditorWidget(BarDescriptorEditor *editor
|
|||||||
initSourcePage();
|
initSourcePage();
|
||||||
|
|
||||||
setCurrentIndex(0);
|
setCurrentIndex(0);
|
||||||
|
|
||||||
|
connect(m_entryPointWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(m_packageInformationWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(m_authorInformationWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(m_generalWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(m_permissionsWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(m_environmentWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(m_assetsWidget, SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), barDescriptorDocument(), SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_entryPointWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_packageInformationWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_authorInformationWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_generalWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_permissionsWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_environmentWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed(BarDescriptorDocument::Tag,QVariant)), m_assetsWidget, SLOT(setValue(BarDescriptorDocument::Tag,QVariant)));
|
||||||
|
|
||||||
|
connect(m_xmlSourceWidget, SIGNAL(textChanged()), this, SLOT(updateDocumentContent()));
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorWidget::initGeneralPage()
|
void BarDescriptorEditorWidget::initGeneralPage()
|
||||||
@@ -95,10 +116,6 @@ void BarDescriptorEditorWidget::initGeneralPage()
|
|||||||
authorInformationPanel->setDisplayName(tr("Author Information"));
|
authorInformationPanel->setDisplayName(tr("Author Information"));
|
||||||
authorInformationPanel->setWidget(m_authorInformationWidget);
|
authorInformationPanel->setWidget(m_authorInformationWidget);
|
||||||
generalPanel->addPropertiesPanel(authorInformationPanel);
|
generalPanel->addPropertiesPanel(authorInformationPanel);
|
||||||
|
|
||||||
connect(m_entryPointWidget, SIGNAL(changed()), this, SLOT(setDirty()));
|
|
||||||
connect(m_packageInformationWidget, SIGNAL(changed()), this, SLOT(setDirty()));
|
|
||||||
connect(m_authorInformationWidget, SIGNAL(changed()), this, SLOT(setDirty()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorWidget::initApplicationPage()
|
void BarDescriptorEditorWidget::initApplicationPage()
|
||||||
@@ -127,10 +144,6 @@ void BarDescriptorEditorWidget::initApplicationPage()
|
|||||||
environmentPanel->setDisplayName(tr("Environment"));
|
environmentPanel->setDisplayName(tr("Environment"));
|
||||||
environmentPanel->setWidget(m_environmentWidget);
|
environmentPanel->setWidget(m_environmentWidget);
|
||||||
applicationPanel->addPropertiesPanel(environmentPanel);
|
applicationPanel->addPropertiesPanel(environmentPanel);
|
||||||
|
|
||||||
connect(m_generalWidget, SIGNAL(changed()), this, SLOT(setDirty()));
|
|
||||||
connect(m_permissionsWidget, SIGNAL(changed()), this, SLOT(setDirty()));
|
|
||||||
connect(m_environmentWidget, SIGNAL(changed()), this, SLOT(setDirty()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorWidget::initAssetsPage()
|
void BarDescriptorEditorWidget::initAssetsPage()
|
||||||
@@ -145,8 +158,6 @@ void BarDescriptorEditorWidget::initAssetsPage()
|
|||||||
assetsPropertiesPanel->setWidget(m_assetsWidget);
|
assetsPropertiesPanel->setWidget(m_assetsWidget);
|
||||||
assetsPanel->addPropertiesPanel(assetsPropertiesPanel);
|
assetsPanel->addPropertiesPanel(assetsPropertiesPanel);
|
||||||
|
|
||||||
connect(m_assetsWidget, SIGNAL(changed()), this, SLOT(setDirty()));
|
|
||||||
|
|
||||||
m_entryPointWidget->setAssetsModel(m_assetsWidget->assetsModel());
|
m_entryPointWidget->setAssetsModel(m_assetsWidget->assetsModel());
|
||||||
connect(m_entryPointWidget, SIGNAL(imageAdded(QString)), m_assetsWidget, SLOT(addAsset(QString)));
|
connect(m_entryPointWidget, SIGNAL(imageAdded(QString)), m_assetsWidget, SLOT(addAsset(QString)));
|
||||||
connect(m_entryPointWidget, SIGNAL(imageRemoved(QString)), m_assetsWidget, SLOT(removeAsset(QString)));
|
connect(m_entryPointWidget, SIGNAL(imageRemoved(QString)), m_assetsWidget, SLOT(removeAsset(QString)));
|
||||||
@@ -159,7 +170,6 @@ void BarDescriptorEditorWidget::initSourcePage()
|
|||||||
|
|
||||||
TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget);
|
TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget);
|
||||||
m_xmlSourceWidget->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
|
m_xmlSourceWidget->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
|
||||||
connect(m_xmlSourceWidget, SIGNAL(textChanged()), this, SLOT(setDirty()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget)
|
void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget)
|
||||||
@@ -168,46 +178,6 @@ void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *pan
|
|||||||
panelsWidget->widget()->setMinimumWidth(0);
|
panelsWidget->widget()->setMinimumWidth(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *BarDescriptorEditorWidget::editor() const
|
|
||||||
{
|
|
||||||
return m_editor;
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorPackageInformationWidget *BarDescriptorEditorWidget::packageInformationWidget() const
|
|
||||||
{
|
|
||||||
return m_packageInformationWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorAuthorInformationWidget *BarDescriptorEditorWidget::authorInformationWidget() const
|
|
||||||
{
|
|
||||||
return m_authorInformationWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorEntryPointWidget *BarDescriptorEditorWidget::entryPointWidget() const
|
|
||||||
{
|
|
||||||
return m_entryPointWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorGeneralWidget *BarDescriptorEditorWidget::generalWidget() const
|
|
||||||
{
|
|
||||||
return m_generalWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorPermissionsWidget *BarDescriptorEditorWidget::permissionsWidget() const
|
|
||||||
{
|
|
||||||
return m_permissionsWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorEnvironmentWidget *BarDescriptorEditorWidget::environmentWidget() const
|
|
||||||
{
|
|
||||||
return m_environmentWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
BarDescriptorEditorAssetsWidget *BarDescriptorEditorWidget::assetsWidget() const
|
|
||||||
{
|
|
||||||
return m_assetsWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() const
|
TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() const
|
||||||
{
|
{
|
||||||
return m_xmlSourceWidget;
|
return m_xmlSourceWidget;
|
||||||
@@ -216,51 +186,44 @@ TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() cons
|
|||||||
void BarDescriptorEditorWidget::setFilePath(const QString &filePath)
|
void BarDescriptorEditorWidget::setFilePath(const QString &filePath)
|
||||||
{
|
{
|
||||||
Core::IDocument *doc = m_xmlSourceWidget->baseTextDocument();
|
Core::IDocument *doc = m_xmlSourceWidget->baseTextDocument();
|
||||||
if (doc) {
|
if (doc)
|
||||||
doc->setFilePath(filePath);
|
doc->setFilePath(filePath);
|
||||||
// setFilePath() call leads to a textChanged() signal emitted
|
}
|
||||||
// and therefore having this editor-widget to become dirty
|
|
||||||
// therefore we have to explicitly unset the dirty flag
|
void BarDescriptorEditorWidget::updateDocumentContent()
|
||||||
setDirty(false);
|
{
|
||||||
|
ProjectExplorer::TaskHub::clearTasks(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR);
|
||||||
|
QString errorMsg;
|
||||||
|
int errorLine;
|
||||||
|
|
||||||
|
disconnect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView()));
|
||||||
|
bool result = barDescriptorDocument()->loadContent(m_xmlSourceWidget->toPlainText(), true, &errorMsg, &errorLine);
|
||||||
|
connect(barDescriptorDocument(), SIGNAL(changed()), this, SLOT(updateSourceView()));
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, errorMsg, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR,
|
||||||
|
Utils::FileName::fromString(barDescriptorDocument()->filePath()), errorLine);
|
||||||
|
ProjectExplorer::TaskHub::requestPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BarDescriptorEditorWidget::xmlSource() const
|
void BarDescriptorEditorWidget::updateSourceView()
|
||||||
{
|
|
||||||
return m_xmlSourceWidget->toPlainText();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorWidget::setXmlSource(const QString &xmlSource)
|
|
||||||
{
|
{
|
||||||
bool blocked = m_xmlSourceWidget->blockSignals(true);
|
bool blocked = m_xmlSourceWidget->blockSignals(true);
|
||||||
m_xmlSourceWidget->setPlainText(xmlSource);
|
|
||||||
|
int line;
|
||||||
|
int column;
|
||||||
|
int position = m_xmlSourceWidget->position();
|
||||||
|
m_xmlSourceWidget->convertPosition(position, &line, &column);
|
||||||
|
|
||||||
|
m_xmlSourceWidget->setPlainText(barDescriptorDocument()->xmlSource());
|
||||||
|
|
||||||
|
m_xmlSourceWidget->gotoLine(line, column);
|
||||||
|
|
||||||
m_xmlSourceWidget->blockSignals(blocked);
|
m_xmlSourceWidget->blockSignals(blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BarDescriptorEditorWidget::isDirty() const
|
BarDescriptorDocument *BarDescriptorEditorWidget::barDescriptorDocument() const
|
||||||
{
|
{
|
||||||
return m_dirty;
|
return qobject_cast<BarDescriptorDocument*>(m_editor->document());
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorWidget::clear()
|
|
||||||
{
|
|
||||||
m_entryPointWidget->clear();
|
|
||||||
m_packageInformationWidget->clear();
|
|
||||||
m_authorInformationWidget->clear();
|
|
||||||
|
|
||||||
m_generalWidget->clear();
|
|
||||||
m_permissionsWidget->clear();
|
|
||||||
m_environmentWidget->clear();
|
|
||||||
|
|
||||||
m_assetsWidget->clear();
|
|
||||||
|
|
||||||
bool blocked = m_xmlSourceWidget->blockSignals(true);
|
|
||||||
m_xmlSourceWidget->clear();
|
|
||||||
m_xmlSourceWidget->blockSignals(blocked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BarDescriptorEditorWidget::setDirty(bool dirty)
|
|
||||||
{
|
|
||||||
m_dirty = dirty;
|
|
||||||
emit changed();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,34 +68,20 @@ class BarDescriptorEditorWidget : public QStackedWidget
|
|||||||
public:
|
public:
|
||||||
explicit BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent = 0);
|
explicit BarDescriptorEditorWidget(BarDescriptorEditor *editor, QWidget *parent = 0);
|
||||||
|
|
||||||
Core::IEditor *editor() const;
|
|
||||||
|
|
||||||
BarDescriptorEditorEntryPointWidget *entryPointWidget() const;
|
|
||||||
BarDescriptorEditorPackageInformationWidget *packageInformationWidget() const;
|
|
||||||
BarDescriptorEditorAuthorInformationWidget *authorInformationWidget() const;
|
|
||||||
|
|
||||||
BarDescriptorEditorGeneralWidget *generalWidget() const;
|
|
||||||
BarDescriptorEditorPermissionsWidget *permissionsWidget() const;
|
|
||||||
BarDescriptorEditorEnvironmentWidget *environmentWidget() const;
|
|
||||||
|
|
||||||
BarDescriptorEditorAssetsWidget *assetsWidget() const;
|
|
||||||
|
|
||||||
TextEditor::BaseTextEditorWidget *sourceWidget() const;
|
TextEditor::BaseTextEditorWidget *sourceWidget() const;
|
||||||
|
|
||||||
void setFilePath(const QString &filePath);
|
void setFilePath(const QString &filePath);
|
||||||
QString xmlSource() const;
|
|
||||||
void setXmlSource(const QString &xmlSource);
|
|
||||||
|
|
||||||
bool isDirty() const;
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void setDirty(bool dirty = true);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed(BarDescriptorDocument::Tag tag, const QVariant &value);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateDocumentContent();
|
||||||
|
void updateSourceView();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
BarDescriptorDocument *barDescriptorDocument() const;
|
||||||
|
|
||||||
void initGeneralPage();
|
void initGeneralPage();
|
||||||
void initApplicationPage();
|
void initApplicationPage();
|
||||||
void initAssetsPage();
|
void initAssetsPage();
|
||||||
@@ -104,8 +90,6 @@ private:
|
|||||||
|
|
||||||
Core::IEditor *m_editor;
|
Core::IEditor *m_editor;
|
||||||
|
|
||||||
bool m_dirty;
|
|
||||||
|
|
||||||
// New UI
|
// New UI
|
||||||
BarDescriptorEditorEntryPointWidget *m_entryPointWidget;
|
BarDescriptorEditorEntryPointWidget *m_entryPointWidget;
|
||||||
BarDescriptorEditorPackageInformationWidget *m_packageInformationWidget;
|
BarDescriptorEditorPackageInformationWidget *m_packageInformationWidget;
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ SOURCES += qnxplugin.cpp \
|
|||||||
bardescriptoreditor.cpp \
|
bardescriptoreditor.cpp \
|
||||||
bardescriptoreditorwidget.cpp \
|
bardescriptoreditorwidget.cpp \
|
||||||
bardescriptordocument.cpp \
|
bardescriptordocument.cpp \
|
||||||
bardescriptordocumentnodehandlers.cpp \
|
|
||||||
bardescriptorpermissionsmodel.cpp \
|
bardescriptorpermissionsmodel.cpp \
|
||||||
blackberrykeyswidget.cpp \
|
blackberrykeyswidget.cpp \
|
||||||
blackberrykeyspage.cpp \
|
blackberrykeyspage.cpp \
|
||||||
@@ -156,7 +155,6 @@ HEADERS += qnxplugin.h\
|
|||||||
bardescriptoreditor.h \
|
bardescriptoreditor.h \
|
||||||
bardescriptoreditorwidget.h \
|
bardescriptoreditorwidget.h \
|
||||||
bardescriptordocument.h \
|
bardescriptordocument.h \
|
||||||
bardescriptordocumentnodehandlers.h \
|
|
||||||
bardescriptorpermissionsmodel.h \
|
bardescriptorpermissionsmodel.h \
|
||||||
blackberrykeyswidget.h \
|
blackberrykeyswidget.h \
|
||||||
blackberrykeyspage.h \
|
blackberrykeyspage.h \
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ QtcPlugin {
|
|||||||
files: [
|
files: [
|
||||||
"bardescriptordocument.cpp",
|
"bardescriptordocument.cpp",
|
||||||
"bardescriptordocument.h",
|
"bardescriptordocument.h",
|
||||||
"bardescriptordocumentnodehandlers.cpp",
|
|
||||||
"bardescriptordocumentnodehandlers.h",
|
|
||||||
"bardescriptoreditor.cpp",
|
"bardescriptoreditor.cpp",
|
||||||
"bardescriptoreditor.h",
|
"bardescriptoreditor.h",
|
||||||
"bardescriptoreditorabstractpanelwidget.cpp",
|
"bardescriptoreditorabstractpanelwidget.cpp",
|
||||||
|
|||||||
@@ -136,4 +136,201 @@ ExtensionSystem::IPlugin::ShutdownFlag QNXPlugin::aboutToShutdown()
|
|||||||
return SynchronousShutdown;
|
return SynchronousShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
#include <QTest>
|
||||||
|
|
||||||
|
#include "bardescriptordocument.h"
|
||||||
|
|
||||||
|
void QNXPlugin::testBarDescriptorDocumentSetValue_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<BarDescriptorDocument::Tag>("tag");
|
||||||
|
QTest::addColumn<QVariant>("value");
|
||||||
|
QTest::addColumn<QString>("baseXml");
|
||||||
|
QTest::addColumn<QString>("xml");
|
||||||
|
QTest::addColumn<bool>("compareResultValue");
|
||||||
|
|
||||||
|
QTest::newRow("new-id") << BarDescriptorDocument::id
|
||||||
|
<< QVariant(QString::fromLatin1("my-application-id"))
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\"/>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <id>my-application-id</id>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< true;
|
||||||
|
|
||||||
|
QTest::newRow("changed-id") << BarDescriptorDocument::id
|
||||||
|
<< QVariant(QString::fromLatin1("my-application-id"))
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <id>some-application-id</id>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <id>my-application-id</id>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< true;
|
||||||
|
|
||||||
|
|
||||||
|
QTest::newRow("removed-id") << BarDescriptorDocument::id
|
||||||
|
<< QVariant(QString::fromLatin1(""))
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <id>some-application-id</id>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\"/>\n")
|
||||||
|
<< true;
|
||||||
|
|
||||||
|
QStringList splashScreens;
|
||||||
|
splashScreens << QLatin1String("image1.png")
|
||||||
|
<< QLatin1String("image2.png");
|
||||||
|
QTest::newRow("new-splashScreens") << BarDescriptorDocument::splashScreens
|
||||||
|
<< QVariant(splashScreens)
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\"/>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <splashScreens>\n"
|
||||||
|
" <image>image1.png</image>\n"
|
||||||
|
" <image>image2.png</image>\n"
|
||||||
|
" </splashScreens>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< true;
|
||||||
|
|
||||||
|
QTest::newRow("changed-splashScreens") << BarDescriptorDocument::splashScreens
|
||||||
|
<< QVariant(splashScreens)
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <splashScreens>\n"
|
||||||
|
" <image>image3.png</image>\n"
|
||||||
|
" <image>image4.png</image>\n"
|
||||||
|
" </splashScreens>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <splashScreens>\n"
|
||||||
|
" <image>image1.png</image>\n"
|
||||||
|
" <image>image2.png</image>\n"
|
||||||
|
" </splashScreens>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< true;
|
||||||
|
|
||||||
|
QTest::newRow("removed-splashScreens") << BarDescriptorDocument::splashScreens
|
||||||
|
<< QVariant(QStringList())
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <splashScreens>\n"
|
||||||
|
" <image>image1.png</image>\n"
|
||||||
|
" <image>image2.png</image>\n"
|
||||||
|
" </splashScreens>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\"/>\n")
|
||||||
|
<< true;
|
||||||
|
|
||||||
|
BarDescriptorAsset asset1;
|
||||||
|
asset1.source = QLatin1String("/path/to/file");
|
||||||
|
asset1.destination = QLatin1String("file");
|
||||||
|
asset1.entry = false;
|
||||||
|
|
||||||
|
BarDescriptorAsset asset2;
|
||||||
|
asset2.source = QLatin1String("/path/to/file2");
|
||||||
|
asset2.destination = QLatin1String("file2");
|
||||||
|
asset2.entry = false; // Cannot test "true", as "type" and "entry" attributes show up in seemingly arbitrary order
|
||||||
|
|
||||||
|
BarDescriptorAssetList assetList1;
|
||||||
|
assetList1 << asset1 << asset2;
|
||||||
|
|
||||||
|
QVariant assets;
|
||||||
|
assets.setValue(assetList1);
|
||||||
|
|
||||||
|
QTest::newRow("new-assets") << BarDescriptorDocument::asset
|
||||||
|
<< assets
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\"/>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <asset path=\"/path/to/file\">file</asset>\n"
|
||||||
|
" <asset path=\"/path/to/file2\">file2</asset>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< false;
|
||||||
|
|
||||||
|
asset2.destination = QLatin1String("file3");
|
||||||
|
BarDescriptorAssetList assetList2;
|
||||||
|
assetList2 << asset1 << asset2;
|
||||||
|
assets.setValue(assetList2);
|
||||||
|
|
||||||
|
QTest::newRow("changed-assets") << BarDescriptorDocument::asset
|
||||||
|
<< assets
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <asset path=\"/path/to/file\">file</asset>\n"
|
||||||
|
" <asset path=\"/path/to/file2\">file2</asset>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <asset path=\"/path/to/file\">file</asset>\n"
|
||||||
|
" <asset path=\"/path/to/file2\">file3</asset>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< false;
|
||||||
|
|
||||||
|
QTest::newRow("maintain-position") << BarDescriptorDocument::id
|
||||||
|
<< QVariant(QString::fromLatin1("my-application-id"))
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <asset path=\"/path/to/file\">file</asset>\n"
|
||||||
|
" <asset path=\"/path/to/file2\">file2</asset>\n"
|
||||||
|
" <id>some-application-id</id>\n"
|
||||||
|
" <splashScreens>\n"
|
||||||
|
" <image>image1.png</image>\n"
|
||||||
|
" <image>image2.png</image>\n"
|
||||||
|
" </splashScreens>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <asset path=\"/path/to/file\">file</asset>\n"
|
||||||
|
" <asset path=\"/path/to/file2\">file2</asset>\n"
|
||||||
|
" <id>my-application-id</id>\n"
|
||||||
|
" <splashScreens>\n"
|
||||||
|
" <image>image1.png</image>\n"
|
||||||
|
" <image>image2.png</image>\n"
|
||||||
|
" </splashScreens>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< true;
|
||||||
|
|
||||||
|
QTest::newRow("removed-icon") << BarDescriptorDocument::icon
|
||||||
|
<< QVariant(QString())
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\">\n"
|
||||||
|
" <icon>\n"
|
||||||
|
" <image>icon1.png</image>\n"
|
||||||
|
" </icon>\n"
|
||||||
|
"</qnx>\n")
|
||||||
|
<< QString::fromLatin1("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
|
"<qnx xmlns=\"http://www.qnx.com/schemas/application/1.0\"/>\n")
|
||||||
|
<< true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QNXPlugin::testBarDescriptorDocumentSetValue()
|
||||||
|
{
|
||||||
|
QFETCH(BarDescriptorDocument::Tag, tag);
|
||||||
|
QFETCH(QVariant, value);
|
||||||
|
QFETCH(QString, baseXml);
|
||||||
|
QFETCH(QString, xml);
|
||||||
|
QFETCH(bool, compareResultValue);
|
||||||
|
|
||||||
|
BarDescriptorDocument doc;
|
||||||
|
doc.loadContent(baseXml, false);
|
||||||
|
QCOMPARE(doc.xmlSource(), baseXml);
|
||||||
|
|
||||||
|
doc.setValue(tag, value);
|
||||||
|
QCOMPARE(doc.xmlSource(), xml);
|
||||||
|
QCOMPARE(doc.isModified(), true);
|
||||||
|
if (compareResultValue)
|
||||||
|
QCOMPARE(doc.value(tag), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2(QNX, QNXPlugin)
|
Q_EXPORT_PLUGIN2(QNX, QNXPlugin)
|
||||||
|
|||||||
@@ -49,6 +49,12 @@ public:
|
|||||||
bool initialize(const QStringList &arguments, QString *errorString);
|
bool initialize(const QStringList &arguments, QString *errorString);
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
ShutdownFlag aboutToShutdown();
|
ShutdownFlag aboutToShutdown();
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
private slots:
|
||||||
|
void testBarDescriptorDocumentSetValue_data();
|
||||||
|
void testBarDescriptorDocumentSetValue();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user