diff options
Diffstat (limited to 'src/plugins')
31 files changed, 2544 insertions, 1402 deletions
diff --git a/src/plugins/qnx/bardescriptordocument.h b/src/plugins/qnx/bardescriptordocument.h index ca767458bd..1f271801b7 100644 --- a/src/plugins/qnx/bardescriptordocument.h +++ b/src/plugins/qnx/bardescriptordocument.h @@ -39,7 +39,8 @@ namespace Qnx { namespace Internal { -struct BarDescriptorAsset { +class BarDescriptorAsset { +public: QString source; QString destination; bool entry; diff --git a/src/plugins/qnx/bardescriptordocumentnodehandlers.cpp b/src/plugins/qnx/bardescriptordocumentnodehandlers.cpp index a547fbf16d..0d74ef1c96 100644 --- a/src/plugins/qnx/bardescriptordocumentnodehandlers.cpp +++ b/src/plugins/qnx/bardescriptordocumentnodehandlers.cpp @@ -31,6 +31,13 @@ #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> @@ -68,9 +75,39 @@ int BarDescriptorDocumentAbstractNodeHandler::order() const return m_order; } -BarDescriptorEditorWidget *BarDescriptorDocumentAbstractNodeHandler::editorWidget() const +BarDescriptorEditorPackageInformationWidget *BarDescriptorDocumentAbstractNodeHandler::packageInformationWidget() const { - return m_editorWidget; + 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 @@ -123,13 +160,13 @@ bool BarDescriptorDocumentIdNodeHandler::fromNode(const QDomNode &node) if (!canHandle(node)) return false; - editorWidget()->setPackageId(loadSimpleTextElement(node)); + packageInformationWidget()->setPackageId(loadSimpleTextElement(node)); return true; } QDomNode BarDescriptorDocumentIdNodeHandler::toNode(QDomDocument &doc) const { - return createSimpleTextElement(doc, QLatin1String("id"), editorWidget()->packageId()); + return createSimpleTextElement(doc, QLatin1String("id"), packageInformationWidget()->packageId()); } // ---------------------------------------------------------------------------- @@ -149,13 +186,13 @@ bool BarDescriptorDocumentVersionNumberNodeHandler::fromNode(const QDomNode &nod if (!canHandle(node)) return false; - editorWidget()->setPackageVersion(loadSimpleTextElement(node)); + packageInformationWidget()->setPackageVersion(loadSimpleTextElement(node)); return true; } QDomNode BarDescriptorDocumentVersionNumberNodeHandler::toNode(QDomDocument &doc) const { - return createSimpleTextElement(doc, QLatin1String("versionNumber"), editorWidget()->packageVersion()); + return createSimpleTextElement(doc, QLatin1String("versionNumber"), packageInformationWidget()->packageVersion()); } // ---------------------------------------------------------------------------- @@ -175,13 +212,13 @@ bool BarDescriptorDocumentBuildIdNodeHandler::fromNode(const QDomNode &node) if (!canHandle(node)) return false; - editorWidget()->setPackageBuildId(loadSimpleTextElement(node)); + packageInformationWidget()->setPackageBuildId(loadSimpleTextElement(node)); return true; } QDomNode BarDescriptorDocumentBuildIdNodeHandler::toNode(QDomDocument &doc) const { - return createSimpleTextElement(doc, QLatin1String("buildId"), editorWidget()->packageBuildId()); + return createSimpleTextElement(doc, QLatin1String("buildId"), packageInformationWidget()->packageBuildId()); } // ---------------------------------------------------------------------------- @@ -203,7 +240,7 @@ bool BarDescriptorDocumentApplicationNameNodeHandler::fromNode(const QDomNode &n if (!canHandle(node)) return false; - editorWidget()->setApplicationName(loadSimpleTextElement(node)); + entryPointWidget()->setApplicationName(loadSimpleTextElement(node)); return true; } @@ -211,7 +248,7 @@ QDomNode BarDescriptorDocumentApplicationNameNodeHandler::toNode(QDomDocument &d { // TODO: Add support for localization - return createSimpleTextElement(doc, QLatin1String("name"), editorWidget()->applicationName()); + return createSimpleTextElement(doc, QLatin1String("name"), entryPointWidget()->applicationName()); } // ---------------------------------------------------------------------------- @@ -233,13 +270,13 @@ bool BarDescriptorDocumentApplicationDescriptionNodeHandler::fromNode(const QDom if (!canHandle(node)) return false; - editorWidget()->setApplicationDescription(loadSimpleTextElement(node)); + entryPointWidget()->setApplicationDescription(loadSimpleTextElement(node)); return true; } QDomNode BarDescriptorDocumentApplicationDescriptionNodeHandler::toNode(QDomDocument &doc) const { - return createSimpleTextElement(doc, QLatin1String("description"), editorWidget()->applicationDescription()); + return createSimpleTextElement(doc, QLatin1String("description"), entryPointWidget()->applicationDescription()); } // ---------------------------------------------------------------------------- @@ -281,14 +318,14 @@ bool BarDescriptorDocumentApplicationIconNodeHandler::fromNode(const QDomNode &n QDomNode imageNode = node.firstChild(); QDomText imageTextNode = imageNode.firstChild().toText(); - editorWidget()->setApplicationIcon(imageTextNode.data()); + entryPointWidget()->setApplicationIcon(imageTextNode.data()); return true; } QDomNode BarDescriptorDocumentApplicationIconNodeHandler::toNode(QDomDocument &doc) const { // TODO: Add support for localization - const QString iconFileName = editorWidget()->applicationIconFileName(); + const QString iconFileName = entryPointWidget()->applicationIconFileName(); if (iconFileName.isEmpty()) return QDomElement(); @@ -336,7 +373,7 @@ bool BarDescriptorDocumentSplashScreenNodeHandler::fromNode(const QDomNode &node while (!imageNode.isNull()) { if (imageNode.tagName().toLower() == QLatin1String("image")) { QDomText imageTextNode = imageNode.firstChild().toText(); - editorWidget()->appendSplashScreen(imageTextNode.data()); + entryPointWidget()->appendSplashScreen(imageTextNode.data()); } imageNode = imageNode.nextSiblingElement(); } @@ -345,7 +382,7 @@ bool BarDescriptorDocumentSplashScreenNodeHandler::fromNode(const QDomNode &node QDomNode BarDescriptorDocumentSplashScreenNodeHandler::toNode(QDomDocument &doc) const { - QStringList splashScreens = editorWidget()->splashScreens(); + QStringList splashScreens = entryPointWidget()->splashScreens(); if (splashScreens.isEmpty()) return QDomElement(); @@ -385,7 +422,7 @@ bool BarDescriptorDocumentAssetNodeHandler::fromNode(const QDomNode &node) asset.destination = dest; asset.entry = entry == QLatin1String("true"); - editorWidget()->addAsset(asset); + assetsWidget()->addAsset(asset); return true; } @@ -393,7 +430,7 @@ QDomNode BarDescriptorDocumentAssetNodeHandler::toNode(QDomDocument &doc) const { QDomDocumentFragment fragment = doc.createDocumentFragment(); - QList<BarDescriptorAsset> assets = editorWidget()->assets(); + QList<BarDescriptorAsset> assets = assetsWidget()->assets(); foreach (const BarDescriptorAsset &asset, assets) { QDomElement assetElem = doc.createElement(QLatin1String("asset")); assetElem.setAttribute(QLatin1String("path"), asset.source); @@ -435,15 +472,15 @@ bool BarDescriptorDocumentInitialWindowNodeHandler::fromNode(const QDomNode &nod QDomElement child = node.firstChildElement(); while (!child.isNull()) { if (child.tagName() == QLatin1String("aspectRatio")) { - editorWidget()->setOrientation(loadSimpleTextElement(child)); + generalWidget()->setOrientation(loadSimpleTextElement(child)); } else if (child.tagName() == QLatin1String("autoOrients")) { if (loadSimpleTextElement(child) == QLatin1String("true")) - editorWidget()->setOrientation(QLatin1String("auto-orient")); + generalWidget()->setOrientation(QLatin1String("auto-orient")); } else if (child.tagName() == QLatin1String("systemChrome")) { - editorWidget()->setChrome(loadSimpleTextElement(child)); + generalWidget()->setChrome(loadSimpleTextElement(child)); } else if (child.tagName() == QLatin1String("transparent")) { const QString transparent = loadSimpleTextElement(child); - editorWidget()->setTransparent(transparent == QLatin1String("true")); + generalWidget()->setTransparent(transparent == QLatin1String("true")); } child = child.nextSiblingElement(); } @@ -455,14 +492,14 @@ QDomNode BarDescriptorDocumentInitialWindowNodeHandler::toNode(QDomDocument &doc { QDomElement element = doc.createElement(QLatin1String("initialWindow")); - if (editorWidget()->orientation() == QLatin1String("auto-orient")) { + if (generalWidget()->orientation() == QLatin1String("auto-orient")) { element.appendChild(createSimpleTextElement(doc, QLatin1String("autoOrients"), QLatin1String("true"))); - } else if (!editorWidget()->orientation().isEmpty()) { - element.appendChild(createSimpleTextElement(doc, QLatin1String("aspectRatio"), editorWidget()->orientation())); + } 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"), editorWidget()->chrome())); - element.appendChild(createSimpleTextElement(doc, QLatin1String("transparent"), editorWidget()->transparent() ? QLatin1String("true") : QLatin1String("false"))); + element.appendChild(createSimpleTextElement(doc, QLatin1String("systemChrome"), generalWidget()->chrome())); + element.appendChild(createSimpleTextElement(doc, QLatin1String("transparent"), generalWidget()->transparent() ? QLatin1String("true") : QLatin1String("false"))); return element; } @@ -487,7 +524,7 @@ bool BarDescriptorDocumentActionNodeHandler::fromNode(const QDomNode &node) QString value = loadSimpleTextElement(node); if (value != QLatin1String("run_native")) // This has no representation in the GUI, and is always added - editorWidget()->checkPermission(value); + permissionsWidget()->checkPermission(value); return true; } @@ -501,7 +538,7 @@ QDomNode BarDescriptorDocumentActionNodeHandler::toNode(QDomDocument &doc) const runNativeElement.appendChild(doc.createTextNode(QLatin1String("run_native"))); frag.appendChild(runNativeElement); - QStringList checkedIdentifiers = editorWidget()->checkedPermissions(); + QStringList checkedIdentifiers = permissionsWidget()->checkedPermissions(); foreach (const QString &identifier, checkedIdentifiers) frag.appendChild(createSimpleTextElement(doc, QLatin1String("action"), identifier)); @@ -525,7 +562,7 @@ bool BarDescriptorDocumentArgNodeHandler::fromNode(const QDomNode &node) if (!canHandle(node)) return false; - editorWidget()->appendApplicationArgument(loadSimpleTextElement(node)); + generalWidget()->appendApplicationArgument(loadSimpleTextElement(node)); return true; } @@ -533,7 +570,7 @@ QDomNode BarDescriptorDocumentArgNodeHandler::toNode(QDomDocument &doc) const { QDomDocumentFragment frag = doc.createDocumentFragment(); - QStringList arguments = editorWidget()->applicationArguments(); + QStringList arguments = generalWidget()->applicationArguments(); foreach (const QString &argument, arguments) frag.appendChild(createSimpleTextElement(doc, QLatin1String("arg"), argument)); @@ -573,14 +610,14 @@ bool BarDescriptorDocumentEnvNodeHandler::fromNode(const QDomNode &node) QString value = element.attribute(QLatin1String("value")); Utils::EnvironmentItem item(var, value); - editorWidget()->appendEnvironmentItem(item); + environmentWidget()->appendEnvironmentItem(item); return true; } QDomNode BarDescriptorDocumentEnvNodeHandler::toNode(QDomDocument &doc) const { QDomDocumentFragment frag = doc.createDocumentFragment(); - QList<Utils::EnvironmentItem> environmentItems = editorWidget()->environment(); + QList<Utils::EnvironmentItem> environmentItems = environmentWidget()->environment(); foreach (const Utils::EnvironmentItem &item, environmentItems) { QDomElement element = doc.createElement(QLatin1String("env")); @@ -610,13 +647,13 @@ bool BarDescriptorDocumentAuthorNodeHandler::fromNode(const QDomNode &node) if (!canHandle(node)) return false; - editorWidget()->setAuthor(loadSimpleTextElement(node)); + authorInformationWidget()->setAuthor(loadSimpleTextElement(node)); return true; } QDomNode BarDescriptorDocumentAuthorNodeHandler::toNode(QDomDocument &doc) const { - return createSimpleTextElement(doc, QLatin1String("author"), editorWidget()->author()); + return createSimpleTextElement(doc, QLatin1String("author"), authorInformationWidget()->author()); } // ---------------------------------------------------------------------------- @@ -636,13 +673,13 @@ bool BarDescriptorDocumentAuthorIdNodeHandler::fromNode(const QDomNode &node) if (!canHandle(node)) return false; - editorWidget()->setAuthorId(loadSimpleTextElement(node)); + authorInformationWidget()->setAuthorId(loadSimpleTextElement(node)); return true; } QDomNode BarDescriptorDocumentAuthorIdNodeHandler::toNode(QDomDocument &doc) const { - return createSimpleTextElement(doc, QLatin1String("authorId"), editorWidget()->authorId()); + return createSimpleTextElement(doc, QLatin1String("authorId"), authorInformationWidget()->authorId()); } // ---------------------------------------------------------------------------- diff --git a/src/plugins/qnx/bardescriptordocumentnodehandlers.h b/src/plugins/qnx/bardescriptordocumentnodehandlers.h index ad9db9bcf4..1da5c3bf79 100644 --- a/src/plugins/qnx/bardescriptordocumentnodehandlers.h +++ b/src/plugins/qnx/bardescriptordocumentnodehandlers.h @@ -39,6 +39,13 @@ namespace Qnx { namespace Internal { class BarDescriptorEditorWidget; +class BarDescriptorEditorAssetsWidget; +class BarDescriptorEditorAuthorInformationWidget; +class BarDescriptorEditorEntryPointWidget; +class BarDescriptorEditorEnvironmentWidget; +class BarDescriptorEditorGeneralWidget; +class BarDescriptorEditorPackageInformationWidget; +class BarDescriptorEditorPermissionsWidget; class BarDescriptorDocumentAbstractNodeHandler { @@ -54,7 +61,15 @@ public: int order() const; protected: - BarDescriptorEditorWidget *editorWidget() const; + 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; diff --git a/src/plugins/qnx/bardescriptoreditorabstractpanelwidget.cpp b/src/plugins/qnx/bardescriptoreditorabstractpanelwidget.cpp new file mode 100644 index 0000000000..4feed728d4 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorabstractpanelwidget.cpp @@ -0,0 +1,83 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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 "bardescriptoreditorabstractpanelwidget.h" + +#include <utils/pathchooser.h> + +#include <QCheckBox> +#include <QComboBox> +#include <QLineEdit> +#include <QTextEdit> + +using namespace Qnx; +using namespace Qnx::Internal; + +BarDescriptorEditorAbstractPanelWidget::BarDescriptorEditorAbstractPanelWidget(QWidget *parent) : + QWidget(parent) +{ +} + + +void BarDescriptorEditorAbstractPanelWidget::setComboBoxBlocked(QComboBox *comboBox, int index) +{ + bool blocked = comboBox->blockSignals(true); + comboBox->setCurrentIndex(index); + comboBox->blockSignals(blocked); +} + +void BarDescriptorEditorAbstractPanelWidget::setCheckBoxBlocked(QCheckBox *checkBox, bool checked) +{ + bool blocked = checkBox->blockSignals(true); + checkBox->setChecked(checked); + checkBox->blockSignals(blocked); +} + +void BarDescriptorEditorAbstractPanelWidget::setLineEditBlocked(QLineEdit *lineEdit, const QString &text) +{ + bool blocked = lineEdit->blockSignals(true); + lineEdit->setText(text); + lineEdit->blockSignals(blocked); +} + +void BarDescriptorEditorAbstractPanelWidget::setTextEditBlocked(QTextEdit *textEdit, const QString &text) +{ + bool blocked = textEdit->blockSignals(true); + textEdit->setPlainText(text); + textEdit->blockSignals(blocked); +} + +void BarDescriptorEditorAbstractPanelWidget::setPathChooserBlocked(Utils::PathChooser *pathChooser, const QString &path) +{ + bool blocked = pathChooser->blockSignals(true); + pathChooser->setPath(path); + pathChooser->blockSignals(blocked); +} diff --git a/src/plugins/qnx/bardescriptoreditorabstractpanelwidget.h b/src/plugins/qnx/bardescriptoreditorabstractpanelwidget.h new file mode 100644 index 0000000000..e5336040d6 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorabstractpanelwidget.h @@ -0,0 +1,73 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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_BARDESCRIPTOREDITORABSTRACTPANELWIDGET_H +#define QNX_INTERNAL_BARDESCRIPTOREDITORABSTRACTPANELWIDGET_H + +#include <QWidget> + +namespace Utils { +class PathChooser; +} + +QT_BEGIN_NAMESPACE +class QCheckBox; +class QComboBox; +class QLineEdit; +class QTextEdit; +QT_END_NAMESPACE + +namespace Qnx { +namespace Internal { + +class BarDescriptorEditorAbstractPanelWidget : public QWidget +{ + Q_OBJECT +public: + explicit BarDescriptorEditorAbstractPanelWidget(QWidget *parent = 0); + + virtual void clear() = 0; + +signals: + void changed(); + +protected: + void setComboBoxBlocked(QComboBox *comboBox, int index); + void setCheckBoxBlocked(QCheckBox *checkBox, bool checked); + void setLineEditBlocked(QLineEdit *lineEdit, const QString &text); + void setTextEditBlocked(QTextEdit *textEdit, const QString &text); + void setPathChooserBlocked(Utils::PathChooser *pathChooser, const QString &path); +}; + +} // namespace Internal +} // namespace Qnx + +#endif // QNX_INTERNAL_BARDESCRIPTOREDITORABSTRACTPANELWIDGET_H diff --git a/src/plugins/qnx/bardescriptoreditorassetswidget.cpp b/src/plugins/qnx/bardescriptoreditorassetswidget.cpp new file mode 100644 index 0000000000..7dfaae789d --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorassetswidget.cpp @@ -0,0 +1,205 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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 "bardescriptoreditorassetswidget.h" +#include "ui_bardescriptoreditorassetswidget.h" + +#include "bardescriptordocument.h" + +#include <utils/qtcassert.h> + +#include <QFileDialog> +#include <QStandardItemModel> + +using namespace Qnx; +using namespace Qnx::Internal; + +BarDescriptorEditorAssetsWidget::BarDescriptorEditorAssetsWidget(QWidget *parent) : + BarDescriptorEditorAbstractPanelWidget(parent), + m_ui(new Ui::BarDescriptorEditorAssetsWidget) +{ + m_ui->setupUi(this); + + QStringList headerLabels; + headerLabels << tr("Path") << tr("Destination") << tr("Entry-Point"); + m_assetsModel = new QStandardItemModel(this); + m_assetsModel->setHorizontalHeaderLabels(headerLabels); + m_ui->assets->setModel(m_assetsModel); + + connect(m_ui->addAsset, SIGNAL(clicked()), this, SLOT(addNewAsset())); + connect(m_ui->removeAsset, SIGNAL(clicked()), this, SLOT(removeSelectedAsset())); + connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); + connectAssetsModel(); +} + +BarDescriptorEditorAssetsWidget::~BarDescriptorEditorAssetsWidget() +{ + delete m_ui; +} + +void BarDescriptorEditorAssetsWidget::clear() +{ + // We can't just block signals, as the view depends on them + disconnectAssetsModel(); + m_assetsModel->removeRows(0, m_assetsModel->rowCount()); + connectAssetsModel(); +} + +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 +{ + return m_assetsModel; +} + +void BarDescriptorEditorAssetsWidget::addAsset(const QString &fullPath) +{ + if (fullPath.isEmpty()) + return; + + BarDescriptorAsset asset; + asset.source = fullPath; + asset.destination = QFileInfo(fullPath).fileName(); + asset.entry = false; + addAssetInternal(asset); +} + +void BarDescriptorEditorAssetsWidget::removeAsset(const QString &fullPath) +{ + QList<QStandardItem*> assetItems = m_assetsModel->findItems(fullPath); + foreach (QStandardItem *assetItem, assetItems) { + QList<QStandardItem*> assetRow = m_assetsModel->takeRow(assetItem->row()); + while (!assetRow.isEmpty()) + delete assetRow.takeLast(); + } +} + +void BarDescriptorEditorAssetsWidget::addNewAsset() +{ + const QString fileName = QFileDialog::getOpenFileName(this, tr("Select File to Add")); + if (fileName.isEmpty()) + return; + addAsset(fileName); +} + +void BarDescriptorEditorAssetsWidget::removeSelectedAsset() +{ + QModelIndexList selectedIndexes = m_ui->assets->selectionModel()->selectedRows(); + if (selectedIndexes.isEmpty()) + return; + + foreach (const QModelIndex &index, selectedIndexes) + m_assetsModel->removeRow(index.row()); +} + +void BarDescriptorEditorAssetsWidget::updateEntryCheckState(QStandardItem *item) +{ + if (item->column() != 2 || item->checkState() == Qt::Unchecked) + return; + + disconnect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); + for (int i = 0; i < m_assetsModel->rowCount(); ++i) { + QStandardItem *other = m_assetsModel->item(i, 2); + if (other == item) + continue; + + // Only one asset can be the entry point + other->setCheckState(Qt::Unchecked); + } + connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); +} + +void BarDescriptorEditorAssetsWidget::connectAssetsModel() +{ + connect(m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); + connect(m_assetsModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SIGNAL(changed())); + connect(m_assetsModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SIGNAL(changed())); +} + +void BarDescriptorEditorAssetsWidget::disconnectAssetsModel() +{ + 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 dest = asset.destination; + QTC_ASSERT(!path.isEmpty(), return); + QTC_ASSERT(!dest.isEmpty(), return); + + if (hasAsset(asset)) + return; + + QList<QStandardItem *> items; + items << new QStandardItem(path); + items << new QStandardItem(dest); + + QStandardItem *entryItem = new QStandardItem(); + entryItem->setCheckable(true); + entryItem->setCheckState(asset.entry ? Qt::Checked : Qt::Unchecked); + items << entryItem; + m_assetsModel->appendRow(items); +} + +bool BarDescriptorEditorAssetsWidget::hasAsset(const BarDescriptorAsset &asset) +{ + for (int i = 0; i < m_assetsModel->rowCount(); ++i) { + QStandardItem *sourceItem = m_assetsModel->item(i, 0); + QStandardItem *destItem = m_assetsModel->item(i, 1); + if (sourceItem->text() == asset.source && destItem->text() == asset.destination) + return true; + } + + return false; +} diff --git a/src/plugins/qnx/bardescriptoreditorassetswidget.h b/src/plugins/qnx/bardescriptoreditorassetswidget.h new file mode 100644 index 0000000000..de7f4f3a70 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorassetswidget.h @@ -0,0 +1,90 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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_BARDESCRIPTOREDITORASSETSWIDGET_H +#define QNX_INTERNAL_BARDESCRIPTOREDITORASSETSWIDGET_H + +#include "bardescriptoreditorabstractpanelwidget.h" + +QT_BEGIN_NAMESPACE +class QStandardItem; +class QStandardItemModel; +QT_END_NAMESPACE + +namespace Qnx { +namespace Internal { + +namespace Ui { +class BarDescriptorEditorAssetsWidget; +} + +class BarDescriptorAsset; + +class BarDescriptorEditorAssetsWidget : public BarDescriptorEditorAbstractPanelWidget +{ + Q_OBJECT + +public: + explicit BarDescriptorEditorAssetsWidget(QWidget *parent = 0); + ~BarDescriptorEditorAssetsWidget(); + + void clear(); + + void addAsset(const BarDescriptorAsset &asset); + QList<BarDescriptorAsset> assets() const; + + QStandardItemModel *assetsModel() const; + +public slots: + void addAsset(const QString &fullPath); + void removeAsset(const QString &fullPath); + +private slots: + void addNewAsset(); + void removeSelectedAsset(); + void updateEntryCheckState(QStandardItem *item); + +private: + void connectAssetsModel(); + void disconnectAssetsModel(); + + void addAssetInternal(const BarDescriptorAsset &asset); + bool hasAsset(const BarDescriptorAsset &asset); + + Ui::BarDescriptorEditorAssetsWidget *m_ui; + + QStandardItemModel *m_assetsModel; +}; + + +} // namespace Internal +} // namespace Qnx +#endif // QNX_INTERNAL_BARDESCRIPTOREDITORASSETSWIDGET_H diff --git a/src/plugins/qnx/bardescriptoreditorassetswidget.ui b/src/plugins/qnx/bardescriptoreditorassetswidget.ui new file mode 100644 index 0000000000..42242b9273 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorassetswidget.ui @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Qnx::Internal::BarDescriptorEditorAssetsWidget</class> + <widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorAssetsWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>380</width> + <height>245</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="assets"> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QPushButton" name="addAsset"> + <property name="text"> + <string>Add...</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="removeAsset"> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.cpp b/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.cpp new file mode 100644 index 0000000000..18cf63714c --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.cpp @@ -0,0 +1,122 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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 "bardescriptoreditorauthorinformationwidget.h" +#include "ui_bardescriptoreditorauthorinformationwidget.h" + +#include "blackberrydebugtokenreader.h" +#include "blackberrydeviceconfiguration.h" +#include "qnxconstants.h" + +#include <projectexplorer/devicesupport/devicemanager.h> +#include <utils/qtcassert.h> + +#include <QInputDialog> +#include <QMessageBox> + +using namespace Qnx; +using namespace Qnx::Internal; + +BarDescriptorEditorAuthorInformationWidget::BarDescriptorEditorAuthorInformationWidget(QWidget *parent) : + BarDescriptorEditorAbstractPanelWidget(parent), + m_ui(new Ui::BarDescriptorEditorAuthorInformationWidget) +{ + m_ui->setupUi(this); + + m_ui->setFromDebugToken->setVisible(BlackBerryDebugTokenReader::isSupported()); + + connect(m_ui->author, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(m_ui->authorId, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(m_ui->setFromDebugToken, SIGNAL(clicked()), this, SLOT(setAuthorFromDebugToken())); +} + +BarDescriptorEditorAuthorInformationWidget::~BarDescriptorEditorAuthorInformationWidget() +{ + delete m_ui; +} + +void BarDescriptorEditorAuthorInformationWidget::clear() +{ + setLineEditBlocked(m_ui->author, QString()); + setLineEditBlocked(m_ui->authorId, QString()); +} + +QString BarDescriptorEditorAuthorInformationWidget::author() const +{ + 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() +{ + // To select debug token, make it fancier once the debug token management is done in + // Qt Creator + QStringList debugTokens; + ProjectExplorer::DeviceManager *deviceManager = ProjectExplorer::DeviceManager::instance(); + for (int i = 0; i < deviceManager->deviceCount(); ++i) { + ProjectExplorer::IDevice::ConstPtr device = deviceManager->deviceAt(i); + if (device->type() == Core::Id(Constants::QNX_BB_OS_TYPE)) { + BlackBerryDeviceConfiguration::ConstPtr bbDevice = device.dynamicCast<const BlackBerryDeviceConfiguration>(); + QTC_ASSERT(bbDevice, continue); + + debugTokens << bbDevice->debugToken(); + } + } + debugTokens.removeDuplicates(); + + bool ok; + QString debugToken = QInputDialog::getItem(this, tr("Select Debug Token"), tr("Debug token:"), debugTokens, 0, false, &ok); + if (!ok || debugToken.isEmpty()) + return; + + BlackBerryDebugTokenReader debugTokenReader(debugToken); + if (!debugTokenReader.isValid()) { + QMessageBox::warning(this, tr("Error Reading Debug Token"), tr("There was a problem reading debug token.")); + return; + } + + m_ui->author->setText(debugTokenReader.author()); + m_ui->authorId->setText(debugTokenReader.authorId()); +} diff --git a/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.h b/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.h new file mode 100644 index 0000000000..7ea37c93a6 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.h @@ -0,0 +1,70 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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_BARDESCRIPTOREDITORAUTHORINFORMATIONWIDGET_H +#define QNX_INTERNAL_BARDESCRIPTOREDITORAUTHORINFORMATIONWIDGET_H + +#include "bardescriptoreditorabstractpanelwidget.h" + +namespace Qnx { +namespace Internal { + +namespace Ui { +class BarDescriptorEditorAuthorInformationWidget; +} + +class BarDescriptorEditorAuthorInformationWidget : public BarDescriptorEditorAbstractPanelWidget +{ + Q_OBJECT + +public: + explicit BarDescriptorEditorAuthorInformationWidget(QWidget *parent = 0); + ~BarDescriptorEditorAuthorInformationWidget(); + + void clear(); + + QString author() const; + void setAuthor(const QString &author); + + QString authorId() const; + void setAuthorId(const QString &authorId); + +private slots: + void setAuthorFromDebugToken(); + +private: + Ui::BarDescriptorEditorAuthorInformationWidget *m_ui; +}; + +} // namespace Internal +} // namespace Qnx + +#endif // QNX_INTERNAL_BARDESCRIPTOREDITORAUTHORINFORMATIONWIDGET_H diff --git a/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.ui b/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.ui new file mode 100644 index 0000000000..cd2de19308 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorauthorinformationwidget.ui @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Qnx::Internal::BarDescriptorEditorAuthorInformationWidget</class> + <widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorAuthorInformationWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>371</width> + <height>90</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Author:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="author"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Author ID:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="authorId"/> + </item> + <item row="3" column="1"> + <widget class="QPushButton" name="setFromDebugToken"> + <property name="text"> + <string>Set from debug token...</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/qnx/bardescriptoreditorentrypointwidget.cpp b/src/plugins/qnx/bardescriptoreditorentrypointwidget.cpp new file mode 100644 index 0000000000..01cf97ee01 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorentrypointwidget.cpp @@ -0,0 +1,329 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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 "bardescriptoreditorentrypointwidget.h" +#include "ui_bardescriptoreditorentrypointwidget.h" + +#include <QFileDialog> +#include <QStringListModel> + +using namespace Qnx; +using namespace Qnx::Internal; + +namespace { +// Recommended maximum size for icons according to +// http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/r_barfile_dtd_ref_image.html +static int AppIconMaxWidth = 114; +static int AppIconMaxHeight = 114; + +// Recommended maximum size for splashscreens according to +// http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/r_barfile_dtd_ref_splashscreens.html +static int SplashScreenMaxWidth = 1280; +static int SplashScreenMaxHeight = 1280; +} + +BarDescriptorEditorEntryPointWidget::BarDescriptorEditorEntryPointWidget(QWidget *parent) : + BarDescriptorEditorAbstractPanelWidget(parent), + m_ui(new Ui::BarDescriptorEditorEntryPointWidget) +{ + m_ui->setupUi(this); + + m_ui->iconFilePath->setExpectedKind(Utils::PathChooser::File); + m_ui->iconFilePath->setPromptDialogFilter(tr("Images (*.jpg *.png)")); + + m_ui->iconWarningLabel->setVisible(false); + m_ui->iconWarningPixmap->setVisible(false); + + m_ui->splashScreenWarningLabel->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->iconClearButton, SIGNAL(clicked()), this, SLOT(clearIcon())); + + m_splashScreenModel = new QStringListModel(this); + m_ui->splashScreensView->setModel(m_splashScreenModel); + connect(m_ui->addSplashScreen, SIGNAL(clicked()), this, SLOT(browseForSplashScreen())); + 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))); +} + +BarDescriptorEditorEntryPointWidget::~BarDescriptorEditorEntryPointWidget() +{ + 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) +{ + m_assetsModel = QWeakPointer<QStandardItemModel>(assetsModel); +} + +void BarDescriptorEditorEntryPointWidget::setApplicationIconPreview(const QString &path) +{ + setImagePreview(m_ui->iconPreviewLabel, path); +} + +void BarDescriptorEditorEntryPointWidget::validateIconSize(const QString &path) +{ + validateImage(path, m_ui->iconWarningLabel, m_ui->iconWarningPixmap, QSize(AppIconMaxWidth, AppIconMaxHeight)); +} + +void BarDescriptorEditorEntryPointWidget::handleIconChanged(const QString &path) +{ + if (path == m_prevIconPath) + return; + + setApplicationIconPreview(path); + validateIconSize(path); + + emit changed(); + emit imageRemoved(m_prevIconPath); + + m_prevIconPath = path; + if (QFileInfo(path).exists()) + emit imageAdded(path); +} + +void BarDescriptorEditorEntryPointWidget::clearIcon() +{ + m_ui->iconFilePath->setPath(QString()); +} + +void BarDescriptorEditorEntryPointWidget::browseForSplashScreen() +{ + const QString fileName = QFileDialog::getOpenFileName(this, tr("Select Splash Screen"), QString(), tr("Images (*.jpg *.png)")); + if (fileName.isEmpty()) + return; + + if (m_splashScreenModel->stringList().contains(fileName)) + return; + + int rowCount = m_splashScreenModel->rowCount(); + m_splashScreenModel->insertRow(rowCount); + m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fileName); + emit imageAdded(fileName); +} + +void BarDescriptorEditorEntryPointWidget::removeSelectedSplashScreen() +{ + QModelIndexList selectedIndexes = m_ui->splashScreensView->selectionModel()->selectedRows(); + if (selectedIndexes.isEmpty()) + return; + + foreach (const QModelIndex &index, selectedIndexes) { + QString path = m_splashScreenModel->data(index, Qt::DisplayRole).toString(); + emit imageRemoved(path); + + m_splashScreenModel->removeRow(index.row()); + } +} + +void BarDescriptorEditorEntryPointWidget::handleSplashScreenSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected) +{ + Q_UNUSED(deselected); + + const bool emptySelection = selected.indexes().isEmpty(); + m_ui->removeSplashScreen->setEnabled(!emptySelection); + + if (!emptySelection) { + QString path = m_splashScreenModel->data(selected.indexes().at(0), Qt::DisplayRole).toString(); + setImagePreview(m_ui->splashScreenPreviewLabel, path); + validateSplashScreenSize(path); + } else { + setImagePreview(m_ui->splashScreenPreviewLabel, QString()); + m_ui->splashScreenWarningLabel->setVisible(false); + m_ui->splashScreenWarningPixmap->setVisible(false); + } +} + +void BarDescriptorEditorEntryPointWidget::appendSplashScreenDelayed(const QString &splashScreenPath) +{ + const QString fullSplashScreenPath = localAssetPathFromDestination(splashScreenPath); + if (fullSplashScreenPath.isEmpty()) + return; + + disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); + int rowCount = m_splashScreenModel->rowCount(); + m_splashScreenModel->insertRow(rowCount); + m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fullSplashScreenPath); + connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); +} + +void BarDescriptorEditorEntryPointWidget::setImagePreview(QLabel *previewLabel, const QString &path) +{ + if (path.isEmpty()) { + previewLabel->clear(); + return; + } + + QPixmap originalPixmap(path); + if (originalPixmap.isNull()) { + previewLabel->clear(); + return; + } + + QSize size = previewLabel->minimumSize(); + QPixmap scaledPixmap = originalPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation); + if (scaledPixmap.isNull()) { + previewLabel->clear(); + return; + } + + previewLabel->setPixmap(scaledPixmap); +} + +void BarDescriptorEditorEntryPointWidget::validateSplashScreenSize(const QString &path) +{ + validateImage(path, m_ui->splashScreenWarningLabel, m_ui->splashScreenWarningPixmap, QSize(SplashScreenMaxWidth, SplashScreenMaxHeight)); +} + +void BarDescriptorEditorEntryPointWidget::validateImage(const QString &path, QLabel *warningMessage, QLabel *warningPixmap, const QSize &maximumSize) +{ + ImageValidationResult result = Valid; + + QSize actualSize; + if (!path.isEmpty()) { + QImage img(path); + if (img.isNull()) { + result = CouldNotLoad; + } else { + actualSize = img.size(); + if (actualSize.width() > maximumSize.width() || actualSize.height() > maximumSize.height()) + result = IncorrectSize; + } + } + + switch (result) { + case CouldNotLoad: + warningMessage->setText(tr("<font color=\"red\">Could not open '%1' for reading.</font>").arg(path)); + warningMessage->setVisible(true); + warningPixmap->setVisible(true); + break; + case IncorrectSize: { + warningMessage->setText(tr("<font color=\"red\">The selected image is too big (%1x%2). The maximum size is %3x%4 pixels.</font>") + .arg(actualSize.width()).arg(actualSize.height()) + .arg(maximumSize.width()).arg(maximumSize.height())); + warningMessage->setVisible(true); + warningPixmap->setVisible(true); + break; + } + case Valid: + default: + warningMessage->setVisible(false); + warningPixmap->setVisible(false); + break; + } +} + +void BarDescriptorEditorEntryPointWidget::setApplicationIconDelayed(const QString &iconPath) +{ + const QString fullIconPath = localAssetPathFromDestination(iconPath); + if (fullIconPath.isEmpty()) + return; + + setPathChooserBlocked(m_ui->iconFilePath, fullIconPath); + setApplicationIconPreview(fullIconPath); + validateIconSize(fullIconPath); +} + +QString BarDescriptorEditorEntryPointWidget::localAssetPathFromDestination(const QString &destination) +{ + if (!m_assetsModel) + return QString(); + + for (int i = 0; i < m_assetsModel.data()->rowCount(); ++i) { + QStandardItem *destItem = m_assetsModel.data()->item(i, 1); + if (destItem->text() == destination) + return m_assetsModel.data()->item(i, 0)->text(); + } + + return QString(); +} diff --git a/src/plugins/qnx/bardescriptoreditorentrypointwidget.h b/src/plugins/qnx/bardescriptoreditorentrypointwidget.h new file mode 100644 index 0000000000..71ed27b79d --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorentrypointwidget.h @@ -0,0 +1,116 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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_BARDESCRIPTOREDITORENTRYPOINTWIDGET_H +#define QNX_INTERNAL_BARDESCRIPTOREDITORENTRYPOINTWIDGET_H + +#include "bardescriptoreditorabstractpanelwidget.h" + +#include <QStandardItemModel> + +QT_BEGIN_NAMESPACE +class QItemSelection; +class QLabel; +class QStringListModel; +QT_END_NAMESPACE + +namespace Qnx { +namespace Internal { + +namespace Ui { +class BarDescriptorEditorEntryPointWidget; +} + +class BarDescriptorEditorEntryPointWidget : public BarDescriptorEditorAbstractPanelWidget +{ + Q_OBJECT + +public: + explicit BarDescriptorEditorEntryPointWidget(QWidget *parent = 0); + ~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); + +signals: + void imageAdded(const QString &path); + void imageRemoved(const QString &path); + +private slots: + void setApplicationIconDelayed(const QString &iconPath); + void setApplicationIconPreview(const QString &path); + void validateIconSize(const QString &path); + void handleIconChanged(const QString &path); + void clearIcon(); + + void browseForSplashScreen(); + void removeSelectedSplashScreen(); + void handleSplashScreenSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void appendSplashScreenDelayed(const QString &splashScreenPath); + +private: + enum ImageValidationResult { + Valid, + CouldNotLoad, + IncorrectSize + }; + + void setImagePreview(QLabel *previewLabel, const QString &path); + void validateSplashScreenSize(const QString &path); + void validateImage(const QString &path, QLabel *warningMessage, QLabel *warningPixmap, const QSize &maximumSize); + + QString localAssetPathFromDestination(const QString &path); + + QStringListModel *m_splashScreenModel; + QWeakPointer<QStandardItemModel> m_assetsModel; + + QString m_prevIconPath; + + Ui::BarDescriptorEditorEntryPointWidget *m_ui; +}; + + +} // namespace Internal +} // namespace Qnx +#endif // QNX_INTERNAL_BARDESCRIPTOREDITORENTRYPOINTWIDGET_H diff --git a/src/plugins/qnx/bardescriptoreditorentrypointwidget.ui b/src/plugins/qnx/bardescriptoreditorentrypointwidget.ui new file mode 100644 index 0000000000..5811dd917b --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorentrypointwidget.ui @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Qnx::Internal::BarDescriptorEditorEntryPointWidget</class> + <widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorEntryPointWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>611</width> + <height>455</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Name:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="applicationName"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Description:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QTextEdit" name="applicationDescription"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Icon:</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <widget class="QLabel" name="iconPreviewLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>90</width> + <height>90</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="Utils::PathChooser" name="iconFilePath" native="true"/> + </item> + <item> + <widget class="QPushButton" name="iconClearButton"> + <property name="text"> + <string>Clear</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="iconWarningPixmap"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QLabel" name="iconWarningLabel"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Splash screens:</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QListView" name="splashScreensView"/> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <widget class="QPushButton" name="addSplashScreen"> + <property name="text"> + <string>Add...</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="removeSplashScreen"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="splashScreenPreviewLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>90</width> + <height>90</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + <item row="9" column="0"> + <widget class="QLabel" name="splashScreenWarningPixmap"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap> + </property> + </widget> + </item> + <item row="9" column="1"> + <widget class="QLabel" name="splashScreenWarningLabel"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>Utils::PathChooser</class> + <extends>QWidget</extends> + <header location="global">utils/pathchooser.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources> + <include location="../projectexplorer/projectexplorer.qrc"/> + </resources> + <connections/> +</ui> diff --git a/src/plugins/qnx/bardescriptoreditorenvironmentwidget.cpp b/src/plugins/qnx/bardescriptoreditorenvironmentwidget.cpp new file mode 100644 index 0000000000..383d2df2a9 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorenvironmentwidget.cpp @@ -0,0 +1,73 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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 "bardescriptoreditorenvironmentwidget.h" +#include "ui_bardescriptoreditorenvironmentwidget.h" + +using namespace Qnx; +using namespace Qnx::Internal; + +BarDescriptorEditorEnvironmentWidget::BarDescriptorEditorEnvironmentWidget(QWidget *parent) : + BarDescriptorEditorAbstractPanelWidget(parent), + m_ui(new Ui::BarDescriptorEditorEnvironmentWidget) +{ + m_ui->setupUi(this); + + m_ui->environmentWidget->setBaseEnvironmentText(tr("Device Environment")); + + connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); +} + +BarDescriptorEditorEnvironmentWidget::~BarDescriptorEditorEnvironmentWidget() +{ + delete m_ui; +} + +void BarDescriptorEditorEnvironmentWidget::clear() +{ + disconnect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); + m_ui->environmentWidget->setUserChanges(QList<Utils::EnvironmentItem>()); + connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); +} + +QList<Utils::EnvironmentItem> BarDescriptorEditorEnvironmentWidget::environment() const +{ + return m_ui->environmentWidget->userChanges(); +} + +void BarDescriptorEditorEnvironmentWidget::appendEnvironmentItem(const Utils::EnvironmentItem &envItem) +{ + disconnect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SIGNAL(changed())); + 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())); +} diff --git a/src/plugins/qnx/bardescriptoreditorenvironmentwidget.h b/src/plugins/qnx/bardescriptoreditorenvironmentwidget.h new file mode 100644 index 0000000000..ac120f4f72 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorenvironmentwidget.h @@ -0,0 +1,66 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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_BARDESCRIPTOREDITORENVIRONMENTWIDGET_H +#define QNX_INTERNAL_BARDESCRIPTOREDITORENVIRONMENTWIDGET_H + +#include "bardescriptoreditorabstractpanelwidget.h" + +#include <utils/environment.h> + +namespace Qnx { +namespace Internal { + +namespace Ui { +class BarDescriptorEditorEnvironmentWidget; +} + +class BarDescriptorEditorEnvironmentWidget : public BarDescriptorEditorAbstractPanelWidget +{ + Q_OBJECT + +public: + explicit BarDescriptorEditorEnvironmentWidget(QWidget *parent = 0); + ~BarDescriptorEditorEnvironmentWidget(); + + void clear(); + + QList<Utils::EnvironmentItem> environment() const; + void appendEnvironmentItem(const Utils::EnvironmentItem &envItem); + +private: + Ui::BarDescriptorEditorEnvironmentWidget *m_ui; +}; + + +} // namespace Internal +} // namespace Qnx +#endif // QNX_INTERNAL_BARDESCRIPTOREDITORENVIRONMENTWIDGET_H diff --git a/src/plugins/qnx/bardescriptoreditorenvironmentwidget.ui b/src/plugins/qnx/bardescriptoreditorenvironmentwidget.ui new file mode 100644 index 0000000000..07cfedf493 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorenvironmentwidget.ui @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Qnx::Internal::BarDescriptorEditorEnvironmentWidget</class> + <widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorEnvironmentWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="ProjectExplorer::EnvironmentWidget" name="environmentWidget" native="true"/> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>ProjectExplorer::EnvironmentWidget</class> + <extends>QWidget</extends> + <header location="global">projectexplorer/environmentwidget.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/qnx/bardescriptoreditorgeneralwidget.cpp b/src/plugins/qnx/bardescriptoreditorgeneralwidget.cpp new file mode 100644 index 0000000000..d930b17e7d --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorgeneralwidget.cpp @@ -0,0 +1,123 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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 "bardescriptoreditorgeneralwidget.h" +#include "ui_bardescriptoreditorgeneralwidget.h" + +#include <utils/qtcassert.h> + +using namespace Qnx; +using namespace Qnx::Internal; + +BarDescriptorEditorGeneralWidget::BarDescriptorEditorGeneralWidget(QWidget *parent) : + BarDescriptorEditorAbstractPanelWidget(parent), + m_ui(new Ui::BarDescriptorEditorGeneralWidget) +{ + m_ui->setupUi(this); + + m_ui->orientation->addItem(tr("Default"), QLatin1String("")); + m_ui->orientation->addItem(tr("Auto-orient"), QLatin1String("auto-orient")); + m_ui->orientation->addItem(tr("Landscape"), QLatin1String("landscape")); + m_ui->orientation->addItem(tr("Portrait"), QLatin1String("portrait")); + + m_ui->chrome->addItem(tr("Standard"), QLatin1String("standard")); + m_ui->chrome->addItem(tr("None"), QLatin1String("none")); + + connect(m_ui->orientation, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); + connect(m_ui->chrome, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); + connect(m_ui->transparentMainWindow, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_ui->applicationArguments, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); +} + +BarDescriptorEditorGeneralWidget::~BarDescriptorEditorGeneralWidget() +{ + delete m_ui; +} + +void BarDescriptorEditorGeneralWidget::clear() +{ + setComboBoxBlocked(m_ui->orientation, m_ui->orientation->findData(QLatin1String(""))); + setComboBoxBlocked(m_ui->chrome, m_ui->chrome->findData(QLatin1String("none"))); + setCheckBoxBlocked(m_ui->transparentMainWindow, false); + setLineEditBlocked(m_ui->applicationArguments, QString()); +} + +QString BarDescriptorEditorGeneralWidget::orientation() const +{ + return m_ui->orientation->itemData(m_ui->orientation->currentIndex()).toString(); +} + +void BarDescriptorEditorGeneralWidget::setOrientation(const QString &orientation) +{ + int index = m_ui->orientation->findData(orientation); + QTC_ASSERT(index >= 0, return); + + setComboBoxBlocked(m_ui->orientation, index); +} + +QString BarDescriptorEditorGeneralWidget::chrome() const +{ + return m_ui->chrome->itemData(m_ui->chrome->currentIndex()).toString(); +} + +void BarDescriptorEditorGeneralWidget::setChrome(const QString &chrome) +{ + 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(' ')); +} diff --git a/src/plugins/qnx/bardescriptoreditorgeneralwidget.h b/src/plugins/qnx/bardescriptoreditorgeneralwidget.h new file mode 100644 index 0000000000..2e01d961c5 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorgeneralwidget.h @@ -0,0 +1,73 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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_BARDESCRIPTOREDITORGENERALWIDGET_H +#define QNX_INTERNAL_BARDESCRIPTOREDITORGENERALWIDGET_H + +#include "bardescriptoreditorabstractpanelwidget.h" + +namespace Qnx { +namespace Internal { + +namespace Ui { +class BarDescriptorEditorGeneralWidget; +} + +class BarDescriptorEditorGeneralWidget : public BarDescriptorEditorAbstractPanelWidget +{ + Q_OBJECT + +public: + explicit BarDescriptorEditorGeneralWidget(QWidget *parent = 0); + ~BarDescriptorEditorGeneralWidget(); + + void clear(); + + QString orientation() const; + 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: + Ui::BarDescriptorEditorGeneralWidget *m_ui; +}; + + +} // namespace Internal +} // namespace Qnx +#endif // QNX_INTERNAL_BARDESCRIPTOREDITORGENERALWIDGET_H diff --git a/src/plugins/qnx/bardescriptoreditorgeneralwidget.ui b/src/plugins/qnx/bardescriptoreditorgeneralwidget.ui new file mode 100644 index 0000000000..8a4c3d8787 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorgeneralwidget.ui @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Qnx::Internal::BarDescriptorEditorGeneralWidget</class> + <widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorGeneralWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>373</width> + <height>112</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Orientation:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="orientation"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>Chrome:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="chrome"/> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QCheckBox" name="transparentMainWindow"> + <property name="text"> + <string>Transparent main window</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Application Arguments:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="applicationArguments"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.cpp b/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.cpp new file mode 100644 index 0000000000..f6dceba879 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.cpp @@ -0,0 +1,99 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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 "bardescriptoreditorpackageinformationwidget.h" +#include "ui_bardescriptoreditorpackageinformationwidget.h" + +using namespace Qnx; +using namespace Qnx::Internal; + +BarDescriptorEditorPackageInformationWidget::BarDescriptorEditorPackageInformationWidget(QWidget *parent) : + BarDescriptorEditorAbstractPanelWidget(parent), + m_ui(new Ui::BarDescriptorEditorPackageInformationWidget) +{ + m_ui->setupUi(this); + + QRegExp versionNumberRegExp(QLatin1String("(\\d{1,3}\\.)?(\\d{1,3}\\.)?(\\d{1,3})")); + QRegExpValidator *versionNumberValidator = new QRegExpValidator(versionNumberRegExp, this); + m_ui->packageVersion->setValidator(versionNumberValidator); + + connect(m_ui->packageId, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(m_ui->packageVersion, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(m_ui->packageBuildId, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); +} + +BarDescriptorEditorPackageInformationWidget::~BarDescriptorEditorPackageInformationWidget() +{ + 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); +} diff --git a/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.h b/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.h new file mode 100644 index 0000000000..97eec51e3b --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.h @@ -0,0 +1,71 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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_BARDESCRIPTOREDITORPACKAGEINFORMATIONWIDGET_H +#define QNX_INTERNAL_BARDESCRIPTOREDITORPACKAGEINFORMATIONWIDGET_H + +#include "bardescriptoreditorabstractpanelwidget.h" + +namespace Qnx { +namespace Internal { + +namespace Ui { +class BarDescriptorEditorPackageInformationWidget; +} + +class BarDescriptorEditorPackageInformationWidget : public BarDescriptorEditorAbstractPanelWidget +{ + Q_OBJECT + +public: + explicit BarDescriptorEditorPackageInformationWidget(QWidget *parent = 0); + ~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: + Ui::BarDescriptorEditorPackageInformationWidget *m_ui; +}; + + +} // namespace Internal +} // namespace Qnx + +#endif // QNX_INTERNAL_BARDESCRIPTOREDITORPACKAGEINFORMATIONWIDGET_H diff --git a/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.ui b/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.ui new file mode 100644 index 0000000000..dbfe6e85a9 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorpackageinformationwidget.ui @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Qnx::Internal::BarDescriptorEditorPackageInformationWidget</class> + <widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorPackageInformationWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>372</width> + <height>85</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Package ID:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="packageId"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Package version:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="packageVersion"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Package build ID:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="packageBuildId"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/qnx/bardescriptoreditorpermissionswidget.cpp b/src/plugins/qnx/bardescriptoreditorpermissionswidget.cpp new file mode 100644 index 0000000000..a1ba9ed9d6 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorpermissionswidget.cpp @@ -0,0 +1,76 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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 "bardescriptoreditorpermissionswidget.h" +#include "ui_bardescriptoreditorpermissionswidget.h" + +#include "bardescriptorpermissionsmodel.h" + +using namespace Qnx; +using namespace Qnx::Internal; + +BarDescriptorEditorPermissionsWidget::BarDescriptorEditorPermissionsWidget(QWidget *parent) : + BarDescriptorEditorAbstractPanelWidget(parent), + m_ui(new Ui::BarDescriptorEditorPermissionsWidget) +{ + m_ui->setupUi(this); + + m_permissionsModel = new BarDescriptorPermissionsModel(this); + m_ui->permissionsView->setModel(m_permissionsModel); + + connect(m_ui->selectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(checkAll())); + connect(m_ui->deselectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(uncheckAll())); + connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); +} + +BarDescriptorEditorPermissionsWidget::~BarDescriptorEditorPermissionsWidget() +{ + 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 +{ + return m_permissionsModel->checkedIdentifiers(); +} + +void BarDescriptorEditorPermissionsWidget::checkPermission(const QString &identifier) +{ + disconnect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); + m_permissionsModel->checkPermission(identifier); + connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed())); +} diff --git a/src/plugins/qnx/bardescriptoreditorpermissionswidget.h b/src/plugins/qnx/bardescriptoreditorpermissionswidget.h new file mode 100644 index 0000000000..5a57d11de2 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorpermissionswidget.h @@ -0,0 +1,68 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.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_BARDESCRIPTOREDITORPERMISSIONSWIDGET_H +#define QNX_INTERNAL_BARDESCRIPTOREDITORPERMISSIONSWIDGET_H + +#include "bardescriptoreditorabstractpanelwidget.h" + +namespace Qnx { +namespace Internal { + +class BarDescriptorPermissionsModel; + +namespace Ui { +class BarDescriptorEditorPermissionsWidget; +} + +class BarDescriptorEditorPermissionsWidget : public BarDescriptorEditorAbstractPanelWidget +{ + Q_OBJECT + +public: + explicit BarDescriptorEditorPermissionsWidget(QWidget *parent = 0); + ~BarDescriptorEditorPermissionsWidget(); + + void clear(); + + QStringList checkedPermissions() const; + void checkPermission(const QString &identifier); + +private: + Ui::BarDescriptorEditorPermissionsWidget *m_ui; + + BarDescriptorPermissionsModel *m_permissionsModel; +}; + + +} // namespace Internal +} // namespace Qnx +#endif // QNX_INTERNAL_BARDESCRIPTOREDITORPERMISSIONSWIDGET_H diff --git a/src/plugins/qnx/bardescriptoreditorpermissionswidget.ui b/src/plugins/qnx/bardescriptoreditorpermissionswidget.ui new file mode 100644 index 0000000000..0d90505cc0 --- /dev/null +++ b/src/plugins/qnx/bardescriptoreditorpermissionswidget.ui @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Qnx::Internal::BarDescriptorEditorPermissionsWidget</class> + <widget class="QWidget" name="Qnx::Internal::BarDescriptorEditorPermissionsWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>314</width> + <height>171</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTreeView" name="permissionsView"> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> + <property name="itemsExpandable"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="selectAllPermissions"> + <property name="text"> + <string>Select All</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="deselectAllPermissions"> + <property name="text"> + <string>Deselect All</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/qnx/bardescriptoreditorwidget.cpp b/src/plugins/qnx/bardescriptoreditorwidget.cpp index 7be20dd967..9b1bcae156 100644 --- a/src/plugins/qnx/bardescriptoreditorwidget.cpp +++ b/src/plugins/qnx/bardescriptoreditorwidget.cpp @@ -30,252 +30,133 @@ ****************************************************************************/ #include "bardescriptoreditorwidget.h" -#include "ui_bardescriptoreditorwidget.h" #include "qnxconstants.h" #include "bardescriptoreditor.h" -#include "bardescriptorpermissionsmodel.h" -#include "blackberrydeviceconfiguration.h" -#include "blackberrydebugtokenreader.h" - -#include <projectexplorer/devicesupport/devicemanager.h> -#include <qtsupport/qtversionmanager.h> +#include "bardescriptoreditorassetswidget.h" +#include "bardescriptoreditorauthorinformationwidget.h" +#include "bardescriptoreditorentrypointwidget.h" +#include "bardescriptoreditorenvironmentwidget.h" +#include "bardescriptoreditorgeneralwidget.h" +#include "bardescriptoreditorpackageinformationwidget.h" +#include "bardescriptoreditorpermissionswidget.h" + +#include <projectexplorer/iprojectproperties.h> +#include <projectexplorer/projectwindow.h> #include <texteditor/plaintexteditor.h> -#include <utils/qtcassert.h> -#include <utils/fancylineedit.h> - -#include <QFileDialog> -#include <QInputDialog> -#include <QItemSelection> -#include <QMessageBox> -#include <QStandardItemModel> -#include <QStringListModel> using namespace Qnx; using namespace Qnx::Internal; -namespace { -void setTextBlocked(QLineEdit *lineEdit, const QString &value) -{ - bool blocked = lineEdit->blockSignals(true); - lineEdit->setText(value); - lineEdit->blockSignals(blocked); -} - -void setComboBoxDataBlocked(QComboBox *comboBox, const QString &data) -{ - int index = comboBox->findData(data); - QTC_CHECK(index > -1); - bool blocked = comboBox->blockSignals(true); - comboBox->setCurrentIndex(index); - comboBox->blockSignals(blocked); -} - -void setPathBlocked(Utils::PathChooser *pathChooser, const QString &path) -{ - bool blocked = pathChooser->blockSignals(true); - pathChooser->setPath(path); - pathChooser->blockSignals(blocked); -} - -void setCheckBoxBlocked(QCheckBox *checkBox, bool check) -{ - bool blocked = checkBox->blockSignals(true); - checkBox->setChecked(check); - checkBox->blockSignals(blocked); -} - -// Recommended maximum size for icons according to -// http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/r_barfile_dtd_ref_image.html -static int AppIconMaxWidth = 114; -static int AppIconMaxHeight = 114; - -// Recommended maximum size for splashscreens according to -// http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/r_barfile_dtd_ref_splashscreens.html -static int SplashScreenMaxWidth = 1280; -static int SplashScreenMaxHeight = 1280; -} - BarDescriptorEditorWidget::BarDescriptorEditorWidget(QWidget *parent) : QStackedWidget(parent) , m_editor(0) , m_dirty(false) - , m_ui(new Ui::BarDescriptorEditorWidget) { - m_ui->setupUi(this); - - setCurrentIndex(0); - initGeneralPage(); initApplicationPage(); initAssetsPage(); initSourcePage(); -} -BarDescriptorEditorWidget::~BarDescriptorEditorWidget() -{ - delete m_ui; + setCurrentIndex(0); } void BarDescriptorEditorWidget::initGeneralPage() { - m_ui->setFromDebugToken->setVisible(BlackBerryDebugTokenReader::isSupported()); - - QRegExp versionNumberRegExp(QLatin1String("(\\d{1,3}\\.)?(\\d{1,3}\\.)?(\\d{1,3})")); - QRegExpValidator *versionNumberValidator = new QRegExpValidator(versionNumberRegExp, this); - m_ui->packageVersion->setValidator(versionNumberValidator); - - connect(m_ui->packageId, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); - connect(m_ui->packageVersion, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); - connect(m_ui->packageBuildId, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); - - connect(m_ui->author, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); - connect(m_ui->authorId, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); - connect(m_ui->setFromDebugToken, SIGNAL(clicked()), this, SLOT(setAuthorFromDebugToken())); -} - -void BarDescriptorEditorWidget::clearGeneralPage() -{ - setTextBlocked(m_ui->packageId, QString()); - setTextBlocked(m_ui->packageVersion, QString()); - setTextBlocked(m_ui->packageBuildId, QString()); + ProjectExplorer::PanelsWidget *generalPanel = new ProjectExplorer::PanelsWidget(this); + initPanelSize(generalPanel); + addWidget(generalPanel); - setTextBlocked(m_ui->author, QString()); - setTextBlocked(m_ui->authorId, QString()); + // Entry-Point Text and Images + ProjectExplorer::PropertiesPanel *entryPointPanel = new ProjectExplorer::PropertiesPanel; + m_entryPointWidget = new BarDescriptorEditorEntryPointWidget; + entryPointPanel->setDisplayName(tr("Entry-Point Text and Images")); + entryPointPanel->setWidget(m_entryPointWidget); + generalPanel->addPropertiesPanel(entryPointPanel); + + // Package Information + ProjectExplorer::PropertiesPanel *packageInformationPanel = new ProjectExplorer::PropertiesPanel; + m_packageInformationWidget = new BarDescriptorEditorPackageInformationWidget; + packageInformationPanel->setDisplayName(tr("Package Information")); + packageInformationPanel->setWidget(m_packageInformationWidget); + generalPanel->addPropertiesPanel(packageInformationPanel); + + // Author information + ProjectExplorer::PropertiesPanel *authorInformationPanel = new ProjectExplorer::PropertiesPanel; + m_authorInformationWidget = new BarDescriptorEditorAuthorInformationWidget; + authorInformationPanel->setDisplayName(tr("Author Information")); + authorInformationPanel->setWidget(m_authorInformationWidget); + 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() { - // General - m_ui->orientation->addItem(tr("Default"), QLatin1String("")); - m_ui->orientation->addItem(tr("Auto-orient"), QLatin1String("auto-orient")); - m_ui->orientation->addItem(tr("Landscape"), QLatin1String("landscape")); - m_ui->orientation->addItem(tr("Portrait"), QLatin1String("portrait")); + ProjectExplorer::PanelsWidget *applicationPanel = new ProjectExplorer::PanelsWidget(this); + initPanelSize(applicationPanel); + addWidget(applicationPanel); - m_ui->chrome->addItem(tr("Standard"), QLatin1String("standard")); - m_ui->chrome->addItem(tr("None"), QLatin1String("none")); - - connect(m_ui->orientation, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty())); - connect(m_ui->chrome, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty())); - connect(m_ui->transparentMainWindow, SIGNAL(toggled(bool)), this, SLOT(setDirty())); - connect(m_ui->applicationArguments, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); + // General + ProjectExplorer::PropertiesPanel *generalPanel = new ProjectExplorer::PropertiesPanel; + m_generalWidget = new BarDescriptorEditorGeneralWidget; + generalPanel->setDisplayName(tr("General")); + generalPanel->setWidget(m_generalWidget); + applicationPanel->addPropertiesPanel(generalPanel); //Permissions - m_permissionsModel = new BarDescriptorPermissionsModel(this); - m_ui->permissionsView->setModel(m_permissionsModel); - - connect(m_ui->selectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(checkAll())); - connect(m_ui->deselectAllPermissions, SIGNAL(clicked()), m_permissionsModel, SLOT(uncheckAll())); - connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); + ProjectExplorer::PropertiesPanel *permissionsPanel = new ProjectExplorer::PropertiesPanel; + m_permissionsWidget = new BarDescriptorEditorPermissionsWidget; + permissionsPanel->setDisplayName(tr("Permissions")); + permissionsPanel->setWidget(m_permissionsWidget); + applicationPanel->addPropertiesPanel(permissionsPanel); // Environment - m_ui->environmentWidget->setBaseEnvironmentText(tr("Device Environment")); - - connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SLOT(setDirty())); + ProjectExplorer::PropertiesPanel *environmentPanel = new ProjectExplorer::PropertiesPanel; + m_environmentWidget = new BarDescriptorEditorEnvironmentWidget; + environmentPanel->setDisplayName(tr("Environment")); + environmentPanel->setWidget(m_environmentWidget); + applicationPanel->addPropertiesPanel(environmentPanel); - // Entry-Point Text and Images - m_ui->iconFilePath->setExpectedKind(Utils::PathChooser::File); - m_ui->iconFilePath->setPromptDialogFilter(tr("Images (*.jpg *.png)")); - - m_ui->iconWarningLabel->setVisible(false); - m_ui->iconWarningPixmap->setVisible(false); - - m_ui->splashScreenWarningLabel->setVisible(false); - m_ui->splashScreenWarningPixmap->setVisible(false); - - connect(m_ui->applicationName, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); - connect(m_ui->applicationDescription, SIGNAL(textChanged()), this, SLOT(setDirty())); - - connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(setDirty())); - connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(addImageAsAsset(QString))); - connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(setApplicationIconPreview(QString))); - connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(validateIconSize(QString))); - connect(m_ui->iconClearButton, SIGNAL(clicked()), m_ui->iconFilePath->lineEdit(), SLOT(clear())); - - m_splashScreenModel = new QStringListModel(this); - m_ui->splashScreensView->setModel(m_splashScreenModel); - connect(m_ui->addSplashScreen, SIGNAL(clicked()), this, SLOT(browseForSplashScreen())); - connect(m_ui->removeSplashScreen, SIGNAL(clicked()), this, SLOT(removeSelectedSplashScreen())); - connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - connect(m_ui->splashScreensView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleSplashScreenSelectionChanged(QItemSelection, QItemSelection))); + 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::clearApplicationPage() +void BarDescriptorEditorWidget::initAssetsPage() { - // General - setComboBoxDataBlocked(m_ui->orientation, QLatin1String("")); - setComboBoxDataBlocked(m_ui->chrome, QLatin1String("none")); - setCheckBoxBlocked(m_ui->transparentMainWindow, false); - setTextBlocked(m_ui->applicationArguments, QString()); - - // Permissions - disconnect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - m_permissionsModel->uncheckAll(); - connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - - // Environment - disconnect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SLOT(setDirty())); - m_ui->environmentWidget->setUserChanges(QList<Utils::EnvironmentItem>()); - connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SLOT(setDirty())); - - // Entry-Point Text and Images - setPathBlocked(m_ui->iconFilePath, QString()); - setApplicationIconPreview(QString()); + ProjectExplorer::PanelsWidget *assetsPanel = new ProjectExplorer::PanelsWidget(this); + initPanelSize(assetsPanel); + addWidget(assetsPanel); - disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - m_splashScreenModel->setStringList(QStringList()); - connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - setImagePreview(m_ui->splashScreenPreviewLabel, QString()); + ProjectExplorer::PropertiesPanel *assetsPropertiesPanel = new ProjectExplorer::PropertiesPanel; + m_assetsWidget = new BarDescriptorEditorAssetsWidget; + assetsPropertiesPanel->setDisplayName(tr("Assets")); + assetsPropertiesPanel->setWidget(m_assetsWidget); + assetsPanel->addPropertiesPanel(assetsPropertiesPanel); -} + connect(m_assetsWidget, SIGNAL(changed()), this, SLOT(setDirty())); -void BarDescriptorEditorWidget::initAssetsPage() -{ - QStringList headerLabels; - headerLabels << tr("Path") << tr("Destination") << tr("Entry-Point"); - m_assetsModel = new QStandardItemModel(this); - m_assetsModel->setHorizontalHeaderLabels(headerLabels); - m_ui->assets->setModel(m_assetsModel); - - connect(m_ui->addAsset, SIGNAL(clicked()), this, SLOT(addNewAsset())); - connect(m_ui->removeAsset, SIGNAL(clicked()), this, SLOT(removeSelectedAsset())); - connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); - connectAssetsModel(); -} - -void BarDescriptorEditorWidget::clearAssetsPage() -{ - // We can't just block signals, as the view depends on them - disconnectAssetsModel(); - m_assetsModel->removeRows(0, m_assetsModel->rowCount()); - connectAssetsModel(); + m_entryPointWidget->setAssetsModel(m_assetsWidget->assetsModel()); + connect(m_entryPointWidget, SIGNAL(imageAdded(QString)), m_assetsWidget, SLOT(addAsset(QString))); + connect(m_entryPointWidget, SIGNAL(imageRemoved(QString)), m_assetsWidget, SLOT(removeAsset(QString))); } void BarDescriptorEditorWidget::initSourcePage() { - m_ui->xmlSourceView->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE)); - connect(m_ui->xmlSourceView, SIGNAL(textChanged()), this, SLOT(setDirty())); -} - -void BarDescriptorEditorWidget::clearSourcePage() -{ - disconnect(m_ui->xmlSourceView, SIGNAL(textChanged()), this, SLOT(setDirty())); - m_ui->xmlSourceView->clear(); - connect(m_ui->xmlSourceView, SIGNAL(textChanged()), this, SLOT(setDirty())); -} + m_xmlSourceWidget = new TextEditor::PlainTextEditorWidget(this); + addWidget(m_xmlSourceWidget); -void BarDescriptorEditorWidget::disconnectAssetsModel() -{ - disconnect(m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - disconnect(m_assetsModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(setDirty())); - disconnect(m_assetsModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(setDirty())); + m_xmlSourceWidget->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE)); + connect(m_xmlSourceWidget, SIGNAL(textChanged()), this, SLOT(setDirty())); } -void BarDescriptorEditorWidget::connectAssetsModel() +void BarDescriptorEditorWidget::initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget) { - connect(m_assetsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - connect(m_assetsModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(setDirty())); - connect(m_assetsModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(setDirty())); + panelsWidget->widget()->setMaximumWidth(900); + panelsWidget->widget()->setMinimumWidth(0); } Core::IEditor *BarDescriptorEditorWidget::editor() const @@ -288,409 +169,51 @@ Core::IEditor *BarDescriptorEditorWidget::editor() const return m_editor; } -QString BarDescriptorEditorWidget::packageId() const -{ - return m_ui->packageId->text(); -} - -void BarDescriptorEditorWidget::setPackageId(const QString &packageId) +BarDescriptorEditorPackageInformationWidget *BarDescriptorEditorWidget::packageInformationWidget() const { - setTextBlocked(m_ui->packageId, packageId); + return m_packageInformationWidget; } -QString BarDescriptorEditorWidget::packageVersion() const +BarDescriptorEditorAuthorInformationWidget *BarDescriptorEditorWidget::authorInformationWidget() 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 BarDescriptorEditorWidget::setPackageVersion(const QString &packageVersion) -{ - setTextBlocked(m_ui->packageVersion, packageVersion); + return m_authorInformationWidget; } -QString BarDescriptorEditorWidget::packageBuildId() const +BarDescriptorEditorEntryPointWidget *BarDescriptorEditorWidget::entryPointWidget() const { - return m_ui->packageBuildId->text(); + return m_entryPointWidget; } -void BarDescriptorEditorWidget::setPackageBuildId(const QString &packageBuildId) +BarDescriptorEditorGeneralWidget *BarDescriptorEditorWidget::generalWidget() const { - setTextBlocked(m_ui->packageBuildId, packageBuildId); + return m_generalWidget; } -QString BarDescriptorEditorWidget::author() const +BarDescriptorEditorPermissionsWidget *BarDescriptorEditorWidget::permissionsWidget() const { - return m_ui->author->text(); + return m_permissionsWidget; } -void BarDescriptorEditorWidget::setAuthor(const QString &author) +BarDescriptorEditorEnvironmentWidget *BarDescriptorEditorWidget::environmentWidget() const { - setTextBlocked(m_ui->author, author); + return m_environmentWidget; } -QString BarDescriptorEditorWidget::authorId() const +BarDescriptorEditorAssetsWidget *BarDescriptorEditorWidget::assetsWidget() const { - return m_ui->authorId->text(); -} - -void BarDescriptorEditorWidget::setAuthorId(const QString &authorId) -{ - setTextBlocked(m_ui->authorId, authorId); -} - -QString BarDescriptorEditorWidget::orientation() const -{ - return m_ui->orientation->itemData(m_ui->orientation->currentIndex()).toString(); -} - -void BarDescriptorEditorWidget::setOrientation(const QString &orientation) -{ - setComboBoxDataBlocked(m_ui->orientation, orientation); -} - -QString BarDescriptorEditorWidget::chrome() const -{ - return m_ui->chrome->itemData(m_ui->chrome->currentIndex()).toString(); -} - -void BarDescriptorEditorWidget::setChrome(const QString &chrome) -{ - setComboBoxDataBlocked(m_ui->chrome, chrome); -} - -bool BarDescriptorEditorWidget::transparent() const -{ - return m_ui->transparentMainWindow->isChecked(); -} - -void BarDescriptorEditorWidget::setTransparent(bool transparent) -{ - setCheckBoxBlocked(m_ui->transparentMainWindow, transparent); -} - -void BarDescriptorEditorWidget::appendApplicationArgument(const QString &argument) -{ - QString completeArguments = m_ui->applicationArguments->text(); - if (!completeArguments.isEmpty()) - completeArguments.append(QLatin1Char(' ')); - completeArguments.append(argument); - - setTextBlocked(m_ui->applicationArguments, completeArguments); -} - -QStringList BarDescriptorEditorWidget::applicationArguments() const -{ - // TODO: Should probably handle "argument with spaces within quotes" - return m_ui->applicationArguments->text().split(QLatin1Char(' ')); -} - -QStringList BarDescriptorEditorWidget::checkedPermissions() const -{ - return m_permissionsModel->checkedIdentifiers(); -} - -void BarDescriptorEditorWidget::checkPermission(const QString &identifier) -{ - disconnect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - m_permissionsModel->checkPermission(identifier); - connect(m_permissionsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); -} - -QList<Utils::EnvironmentItem> BarDescriptorEditorWidget::environment() const -{ - return m_ui->environmentWidget->userChanges(); -} - -void BarDescriptorEditorWidget::appendEnvironmentItem(const Utils::EnvironmentItem &envItem) -{ - disconnect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SLOT(setDirty())); - QList<Utils::EnvironmentItem> items = m_ui->environmentWidget->userChanges(); - items.append(envItem); - m_ui->environmentWidget->setUserChanges(items); - connect(m_ui->environmentWidget, SIGNAL(userChangesChanged()), this, SLOT(setDirty())); -} - -QString BarDescriptorEditorWidget::applicationName() const -{ - return m_ui->applicationName->text(); -} - -void BarDescriptorEditorWidget::setApplicationName(const QString &applicationName) -{ - setTextBlocked(m_ui->applicationName, applicationName); -} - -QString BarDescriptorEditorWidget::applicationDescription() const -{ - return m_ui->applicationDescription->toPlainText(); -} - -void BarDescriptorEditorWidget::setApplicationDescription(const QString &applicationDescription) -{ - bool blocked = m_ui->applicationDescription->blockSignals(true); - m_ui->applicationDescription->setPlainText(applicationDescription); - m_ui->applicationDescription->blockSignals(blocked); -} - -QString BarDescriptorEditorWidget::applicationIconFileName() const -{ - return QFileInfo(m_ui->iconFilePath->path()).fileName(); -} - -void BarDescriptorEditorWidget::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 BarDescriptorEditorWidget::splashScreens() const -{ - QStringList result; - - foreach (const QString &splashScreen, m_splashScreenModel->stringList()) - result << QFileInfo(splashScreen).fileName(); - - return result; -} - -void BarDescriptorEditorWidget::appendSplashScreen(const QString &splashScreenPath) -{ - // During file loading, the assets might not have been read yet - QMetaObject::invokeMethod(this, "appendSplashScreenDelayed", Qt::QueuedConnection, Q_ARG(QString, splashScreenPath)); -} - -void BarDescriptorEditorWidget::setApplicationIconDelayed(const QString &iconPath) -{ - const QString fullIconPath = localAssetPathFromDestination(iconPath); - setPathBlocked(m_ui->iconFilePath, fullIconPath); - setApplicationIconPreview(fullIconPath); - validateIconSize(fullIconPath); -} - -void BarDescriptorEditorWidget::setImagePreview(QLabel *previewLabel, const QString &path) -{ - if (path.isEmpty()) { - previewLabel->clear(); - return; - } - - QPixmap originalPixmap(path); - if (originalPixmap.isNull()) { - previewLabel->clear(); - return; - } - - QSize size = previewLabel->minimumSize(); - QPixmap scaledPixmap = originalPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation); - if (scaledPixmap.isNull()) { - previewLabel->clear(); - return; - } - - previewLabel->setPixmap(scaledPixmap); -} - -void BarDescriptorEditorWidget::validateImage(const QString &path, QLabel *warningMessage, QLabel *warningPixmap, const QSize &maximumSize) -{ - ImageValidationResult result = Valid; - - QSize actualSize; - if (!path.isEmpty()) { - QImage img(path); - if (img.isNull()) { - result = CouldNotLoad; - } else { - actualSize = img.size(); - if (actualSize.width() > maximumSize.width() || actualSize.height() > maximumSize.height()) - result = IncorrectSize; - } - } - - switch (result) { - case CouldNotLoad: - warningMessage->setText(tr("<font color=\"red\">Could not open '%1' for reading.</font>").arg(path)); - warningMessage->setVisible(true); - warningPixmap->setVisible(true); - break; - case IncorrectSize: { - warningMessage->setText(tr("<font color=\"red\">The selected image is too big (%1x%2). The maximum size is %3x%4 pixels.</font>") - .arg(actualSize.width()).arg(actualSize.height()) - .arg(maximumSize.width()).arg(maximumSize.height())); - warningMessage->setVisible(true); - warningPixmap->setVisible(true); - break; - } - case Valid: - default: - warningMessage->setVisible(false); - warningPixmap->setVisible(false); - break; - } -} - -void BarDescriptorEditorWidget::setApplicationIconPreview(const QString &path) -{ - setImagePreview(m_ui->iconPreviewLabel, path); -} - -void BarDescriptorEditorWidget::validateIconSize(const QString &path) -{ - validateImage(path, m_ui->iconWarningLabel, m_ui->iconWarningPixmap, QSize(AppIconMaxWidth, AppIconMaxHeight)); -} - -void BarDescriptorEditorWidget::appendSplashScreenDelayed(const QString &splashScreenPath) -{ - const QString fullSplashScreenPath = localAssetPathFromDestination(splashScreenPath); - - disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); - int rowCount = m_splashScreenModel->rowCount(); - m_splashScreenModel->insertRow(rowCount); - m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fullSplashScreenPath); - connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setDirty())); -} - -void BarDescriptorEditorWidget::browseForSplashScreen() -{ - const QString fileName = QFileDialog::getOpenFileName(this, tr("Select Splash Screen"), QString(), tr("Images (*.jpg *.png)")); - if (fileName.isEmpty()) - return; - - if (m_splashScreenModel->stringList().contains(fileName)) - return; - - int rowCount = m_splashScreenModel->rowCount(); - m_splashScreenModel->insertRow(rowCount); - m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fileName); - addImageAsAsset(fileName); -} - -void BarDescriptorEditorWidget::removeSelectedSplashScreen() -{ - QModelIndexList selectedIndexes = m_ui->splashScreensView->selectionModel()->selectedRows(); - if (selectedIndexes.isEmpty()) - return; - - foreach (const QModelIndex &index, selectedIndexes) { - QString path = m_splashScreenModel->data(index, Qt::DisplayRole).toString(); - - QList<QStandardItem*> assetItems = m_assetsModel->findItems(path); - foreach (QStandardItem *assetItem, assetItems) { - QList<QStandardItem*> assetRow = m_assetsModel->takeRow(assetItem->row()); - while (!assetRow.isEmpty()) - delete assetRow.takeLast(); - } - - m_splashScreenModel->removeRow(index.row()); - } -} - -void BarDescriptorEditorWidget::handleSplashScreenSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected) -{ - Q_UNUSED(deselected); - - const bool emptySelection = selected.indexes().isEmpty(); - m_ui->removeSplashScreen->setEnabled(!emptySelection); - - if (!emptySelection) { - QString path = m_splashScreenModel->data(selected.indexes().at(0), Qt::DisplayRole).toString(); - setImagePreview(m_ui->splashScreenPreviewLabel, path); - validateSplashScreenSize(path); - } else { - setImagePreview(m_ui->splashScreenPreviewLabel, QString()); - m_ui->splashScreenWarningLabel->setVisible(false); - m_ui->splashScreenWarningPixmap->setVisible(false); - } -} - -void BarDescriptorEditorWidget::validateSplashScreenSize(const QString &path) -{ - validateImage(path, m_ui->splashScreenWarningLabel, m_ui->splashScreenWarningPixmap, QSize(SplashScreenMaxWidth, SplashScreenMaxHeight)); -} - -void BarDescriptorEditorWidget::addAsset(const BarDescriptorAsset &asset) -{ - disconnectAssetsModel(); - addAssetInternal(asset); - connectAssetsModel(); -} - -void BarDescriptorEditorWidget::addAssetInternal(const BarDescriptorAsset &asset) -{ - const QString path = asset.source; - const QString dest = asset.destination; - QTC_ASSERT(!path.isEmpty(), return); - QTC_ASSERT(!dest.isEmpty(), return); - - if (hasAsset(asset)) - return; - - QList<QStandardItem *> items; - items << new QStandardItem(path); - items << new QStandardItem(dest); - - QStandardItem *entryItem = new QStandardItem(); - entryItem->setCheckable(true); - entryItem->setCheckState(asset.entry ? Qt::Checked : Qt::Unchecked); - items << entryItem; - m_assetsModel->appendRow(items); - -} - -bool BarDescriptorEditorWidget::hasAsset(const BarDescriptorAsset &asset) -{ - // TODO: Move this to a specific BarDescriptorAssetModel - for (int i = 0; i < m_assetsModel->rowCount(); ++i) { - QStandardItem *sourceItem = m_assetsModel->item(i, 0); - QStandardItem *destItem = m_assetsModel->item(i, 1); - if (sourceItem->text() == asset.source && destItem->text() == asset.destination) - return true; - } - - return false; -} - -QString BarDescriptorEditorWidget::localAssetPathFromDestination(const QString &destination) -{ - for (int i = 0; i < m_assetsModel->rowCount(); ++i) { - QStandardItem *destItem = m_assetsModel->item(i, 1); - if (destItem->text() == destination) - return m_assetsModel->item(i, 0)->text(); - } - - return QString(); -} - -QList<BarDescriptorAsset> BarDescriptorEditorWidget::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; + return m_assetsWidget; } QString BarDescriptorEditorWidget::xmlSource() const { - return m_ui->xmlSourceView->toPlainText(); + return m_xmlSourceWidget->toPlainText(); } void BarDescriptorEditorWidget::setXmlSource(const QString &xmlSource) { - disconnect(m_ui->xmlSourceView, SIGNAL(textChanged()), this, SLOT(setDirty())); - m_ui->xmlSourceView->setPlainText(xmlSource); - connect(m_ui->xmlSourceView, SIGNAL(textChanged()), this, SLOT(setDirty())); + bool blocked = m_xmlSourceWidget->blockSignals(true); + m_xmlSourceWidget->setPlainText(xmlSource); + m_xmlSourceWidget->blockSignals(blocked); } bool BarDescriptorEditorWidget::isDirty() const @@ -700,10 +223,19 @@ bool BarDescriptorEditorWidget::isDirty() const void BarDescriptorEditorWidget::clear() { - clearGeneralPage(); - clearApplicationPage(); - clearAssetsPage(); - clearSourcePage(); + 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) @@ -716,88 +248,3 @@ BarDescriptorEditor *BarDescriptorEditorWidget::createEditor() { return new BarDescriptorEditor(this); } - -void BarDescriptorEditorWidget::addNewAsset() -{ - const QString fileName = QFileDialog::getOpenFileName(this, tr("Select File to Add")); - if (fileName.isEmpty()) - return; - - QFileInfo fi(fileName); - BarDescriptorAsset asset; - asset.source = fileName; - asset.destination = fi.fileName(); - asset.entry = false; // TODO - addAssetInternal(asset); -} - -void BarDescriptorEditorWidget::removeSelectedAsset() -{ - QModelIndexList selectedIndexes = m_ui->assets->selectionModel()->selectedRows(); - if (selectedIndexes.isEmpty()) - return; - - foreach (const QModelIndex &index, selectedIndexes) - m_assetsModel->removeRow(index.row()); -} - -void BarDescriptorEditorWidget::updateEntryCheckState(QStandardItem *item) -{ - if (item->column() != 2 || item->checkState() == Qt::Unchecked) - return; - - disconnect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); - for (int i = 0; i < m_assetsModel->rowCount(); ++i) { - QStandardItem *other = m_assetsModel->item(i, 2); - if (other == item) - continue; - - // Only one asset can be the entry point - other->setCheckState(Qt::Unchecked); - } - connect(m_assetsModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(updateEntryCheckState(QStandardItem*))); -} - -void BarDescriptorEditorWidget::addImageAsAsset(const QString &path) -{ - if (path.isEmpty()) - return; - - BarDescriptorAsset asset; - asset.source = path; - asset.destination = QFileInfo(path).fileName(); - asset.entry = false; - addAssetInternal(asset); -} - -void BarDescriptorEditorWidget::setAuthorFromDebugToken() -{ - // To select debug token, make it fancier once the debug token management is done in - // Qt Creator - QStringList debugTokens; - ProjectExplorer::DeviceManager *deviceManager = ProjectExplorer::DeviceManager::instance(); - for (int i = 0; i < deviceManager->deviceCount(); ++i) { - ProjectExplorer::IDevice::ConstPtr device = deviceManager->deviceAt(i); - if (device->type() == Core::Id(Constants::QNX_BB_OS_TYPE)) { - BlackBerryDeviceConfiguration::ConstPtr bbDevice = device.dynamicCast<const BlackBerryDeviceConfiguration>(); - QTC_ASSERT(bbDevice, continue); - - debugTokens << bbDevice->debugToken(); - } - } - debugTokens.removeDuplicates(); - - bool ok; - QString debugToken = QInputDialog::getItem(this, tr("Select Debug Token"), tr("Debug token:"), debugTokens, 0, false, &ok); - if (!ok || debugToken.isEmpty()) - return; - - BlackBerryDebugTokenReader debugTokenReader(debugToken); - if (!debugTokenReader.isValid()) { - QMessageBox::warning(this, tr("Error Reading Debug Token"), tr("There was a problem reading debug token")); - return; - } - - m_ui->author->setText(debugTokenReader.author()); - m_ui->authorId->setText(debugTokenReader.authorId()); -} diff --git a/src/plugins/qnx/bardescriptoreditorwidget.h b/src/plugins/qnx/bardescriptoreditorwidget.h index c650d908c4..ba4409268b 100644 --- a/src/plugins/qnx/bardescriptoreditorwidget.h +++ b/src/plugins/qnx/bardescriptoreditorwidget.h @@ -34,34 +34,31 @@ #include "bardescriptordocument.h" -#include <utils/environment.h> - #include <QStackedWidget> -QT_BEGIN_NAMESPACE -class QItemSelection; -class QLabel; -class QLineEdit; -class QStandardItemModel; -class QStandardItem; -class QStringListModel; -QT_END_NAMESPACE - namespace Core { class IEditor; } -namespace Qnx { -namespace Internal { +namespace ProjectExplorer { +class PanelsWidget; +} -namespace Ui { -class BarDescriptorEditorWidget; +namespace TextEditor { +class PlainTextEditorWidget; } +namespace Qnx { +namespace Internal { + class BarDescriptorEditor; -class BarDescriptorPermissionsModel; -class BarDescriptorQtAssetsModel; -class BarDescriptorQtAssetsProxyModel; +class BarDescriptorEditorEntryPointWidget; +class BarDescriptorEditorPackageInformationWidget; +class BarDescriptorEditorAuthorInformationWidget; +class BarDescriptorEditorGeneralWidget; +class BarDescriptorEditorPermissionsWidget; +class BarDescriptorEditorEnvironmentWidget; +class BarDescriptorEditorAssetsWidget; class BarDescriptorEditorWidget : public QStackedWidget { @@ -69,60 +66,18 @@ class BarDescriptorEditorWidget : public QStackedWidget public: explicit BarDescriptorEditorWidget(QWidget *parent = 0); - ~BarDescriptorEditorWidget(); Core::IEditor *editor() const; - // General - QString packageId() const; - void setPackageId(const QString &packageId); - - QString packageVersion() const; - void setPackageVersion(const QString &packageVersion); - - QString packageBuildId() const; - void setPackageBuildId(const QString &packageBuildId); - - QString author() const; - void setAuthor(const QString &author); - - QString authorId() const; - void setAuthorId(const QString &authorId); - - // Application - QString orientation() const; - void setOrientation(const QString &orientation); - - QString chrome() const; - void setChrome(const QString &chrome); - - bool transparent() const; - void setTransparent(bool transparent); + BarDescriptorEditorEntryPointWidget *entryPointWidget() const; + BarDescriptorEditorPackageInformationWidget *packageInformationWidget() const; + BarDescriptorEditorAuthorInformationWidget *authorInformationWidget() const; - void appendApplicationArgument(const QString &argument); - QStringList applicationArguments() const; + BarDescriptorEditorGeneralWidget *generalWidget() const; + BarDescriptorEditorPermissionsWidget *permissionsWidget() const; + BarDescriptorEditorEnvironmentWidget *environmentWidget() const; - QStringList checkedPermissions() const; - void checkPermission(const QString &identifier); - - QList<Utils::EnvironmentItem> environment() const; - void appendEnvironmentItem(const Utils::EnvironmentItem &envItem); - - 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); - - // Assets - void addAsset(const BarDescriptorAsset &asset); - QList<BarDescriptorAsset> assets() const; + BarDescriptorEditorAssetsWidget *assetsWidget() const; QString xmlSource() const; void setXmlSource(const QString &xmlSource); @@ -136,64 +91,31 @@ public slots: signals: void changed(); -private slots: - void setAuthorFromDebugToken(); - - void addNewAsset(); - void removeSelectedAsset(); - void updateEntryCheckState(QStandardItem *item); - void addImageAsAsset(const QString &path); - - void setApplicationIconDelayed(const QString &iconPath); - void setApplicationIconPreview(const QString &path); - void validateIconSize(const QString &path); - - void appendSplashScreenDelayed(const QString &splashScreenPath); - void browseForSplashScreen(); - void removeSelectedSplashScreen(); - void handleSplashScreenSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); - void validateSplashScreenSize(const QString &path); - private: - enum ImageValidationResult { - Valid, - CouldNotLoad, - IncorrectSize - }; - BarDescriptorEditor *createEditor(); void initGeneralPage(); - void clearGeneralPage(); void initApplicationPage(); - void clearApplicationPage(); void initAssetsPage(); - void clearAssetsPage(); void initSourcePage(); - void clearSourcePage(); - - void disconnectAssetsModel(); - void connectAssetsModel(); - - void addAssetInternal(const BarDescriptorAsset &asset); - bool hasAsset(const BarDescriptorAsset &asset); - QString localAssetPathFromDestination(const QString &path); - - void setImagePreview(QLabel *previewLabel, const QString &path); - void validateImage(const QString &path, QLabel *warningMessage, QLabel *warningPixmap, const QSize &maximumSize); + void initPanelSize(ProjectExplorer::PanelsWidget *panelsWidget); mutable Core::IEditor *m_editor; bool m_dirty; - // Application - BarDescriptorPermissionsModel *m_permissionsModel; - QStringListModel *m_splashScreenModel; + // New UI + BarDescriptorEditorEntryPointWidget *m_entryPointWidget; + BarDescriptorEditorPackageInformationWidget *m_packageInformationWidget; + BarDescriptorEditorAuthorInformationWidget *m_authorInformationWidget; + + BarDescriptorEditorGeneralWidget *m_generalWidget; + BarDescriptorEditorPermissionsWidget *m_permissionsWidget; + BarDescriptorEditorEnvironmentWidget *m_environmentWidget; - // Assets - QStandardItemModel *m_assetsModel; + BarDescriptorEditorAssetsWidget *m_assetsWidget; - Ui::BarDescriptorEditorWidget *m_ui; + TextEditor::PlainTextEditorWidget *m_xmlSourceWidget; }; diff --git a/src/plugins/qnx/bardescriptoreditorwidget.ui b/src/plugins/qnx/bardescriptoreditorwidget.ui deleted file mode 100644 index 0872dc2a6e..0000000000 --- a/src/plugins/qnx/bardescriptoreditorwidget.ui +++ /dev/null @@ -1,583 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>Qnx::Internal::BarDescriptorEditorWidget</class> - <widget class="QStackedWidget" name="Qnx::Internal::BarDescriptorEditorWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1039</width> - <height>735</height> - </rect> - </property> - <property name="windowTitle"> - <string>StackedWidget</string> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="generalPage"> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <item> - <widget class="QScrollArea" name="scrollArea"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1031</width> - <height>727</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="maximumSize"> - <size> - <width>900</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Package Information</string> - </property> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Package ID:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="packageId"> - <property name="maxLength"> - <number>50</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Package version:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="packageVersion"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Package build ID:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="packageBuildId"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_6"> - <property name="maximumSize"> - <size> - <width>900</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Author Information</string> - </property> - <layout class="QFormLayout" name="formLayout_3"> - <item row="0" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Author:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="author"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>Author ID:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="authorId"/> - </item> - <item row="4" column="1"> - <widget class="QPushButton" name="setFromDebugToken"> - <property name="text"> - <string>Set from debug token...</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="applicationPage"> - <layout class="QVBoxLayout" name="verticalLayout_10"> - <item> - <widget class="QScrollArea" name="scrollArea_2"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_2"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>1014</width> - <height>854</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="maximumSize"> - <size> - <width>900</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Entry-Point Text and Images</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="1" column="1"> - <widget class="QLineEdit" name="applicationName"/> - </item> - <item row="3" column="1"> - <widget class="QTextEdit" name="applicationDescription"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="5" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> - <widget class="QLabel" name="iconPreviewLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>90</width> - <height>90</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="Utils::PathChooser" name="iconFilePath" native="true"/> - </item> - <item> - <widget class="QPushButton" name="iconClearButton"> - <property name="text"> - <string>Clear</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Splash screens:</string> - </property> - </widget> - </item> - <item row="9" column="0" colspan="2"> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QListView" name="splashScreensView"/> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_9"> - <item> - <widget class="QPushButton" name="addSplashScreen"> - <property name="text"> - <string>Add...</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="removeSplashScreen"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Remove</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="splashScreenPreviewLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>90</width> - <height>90</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Icon:</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Description:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Name:</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QLabel" name="iconWarningLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="iconWarningPixmap"> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap> - </property> - </widget> - </item> - <item row="10" column="0"> - <widget class="QLabel" name="splashScreenWarningPixmap"> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap> - </property> - </widget> - </item> - <item row="10" column="1"> - <widget class="QLabel" name="splashScreenWarningLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="maximumSize"> - <size> - <width>900</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>General</string> - </property> - <layout class="QFormLayout" name="formLayout_4"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>Orientation:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="orientation"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>Chrome:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="chrome"/> - </item> - <item row="2" column="0" colspan="2"> - <widget class="QCheckBox" name="transparentMainWindow"> - <property name="text"> - <string>Transparent main window</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>Application Arguments:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLineEdit" name="applicationArguments"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="maximumSize"> - <size> - <width>900</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Permissions</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QTreeView" name="permissionsView"> - <property name="rootIsDecorated"> - <bool>false</bool> - </property> - <property name="itemsExpandable"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="selectAllPermissions"> - <property name="text"> - <string>Select All</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="deselectAllPermissions"> - <property name="text"> - <string>Deselect All</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="maximumSize"> - <size> - <width>900</width> - <height>16777215</height> - </size> - </property> - <property name="title"> - <string>Environment</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_11"> - <item> - <widget class="ProjectExplorer::EnvironmentWidget" name="environmentWidget" native="true"/> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="assetsPage"> - <property name="maximumSize"> - <size> - <width>900</width> - <height>16777215</height> - </size> - </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QTreeView" name="assets"> - <property name="rootIsDecorated"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <widget class="QPushButton" name="addAsset"> - <property name="text"> - <string>Add...</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="removeAsset"> - <property name="text"> - <string>Remove</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="sourcePage"> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="TextEditor::PlainTextEditorWidget" name="xmlSourceView"/> - </item> - </layout> - </widget> - </widget> - <customwidgets> - <customwidget> - <class>TextEditor::PlainTextEditorWidget</class> - <extends>QPlainTextEdit</extends> - <header location="global">texteditor/plaintexteditor.h</header> - </customwidget> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QWidget</extends> - <header location="global">utils/pathchooser.h</header> - <container>1</container> - </customwidget> - <customwidget> - <class>ProjectExplorer::EnvironmentWidget</class> - <extends>QWidget</extends> - <header location="global">projectexplorer/environmentwidget.h</header> - <container>1</container> - </customwidget> - </customwidgets> - <resources> - <include location="../projectexplorer/projectexplorer.qrc"/> - </resources> - <connections/> -</ui> diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro index 434dfc4e09..b9fc959922 100644 --- a/src/plugins/qnx/qnx.pro +++ b/src/plugins/qnx/qnx.pro @@ -79,7 +79,15 @@ SOURCES += qnxplugin.cpp \ blackberrydeviceinformation.cpp \ blackberrysshkeysgenerator.cpp \ blackberryprocessparser.cpp \ - blackberrysigningpasswordsdialog.cpp + blackberrysigningpasswordsdialog.cpp \ + bardescriptoreditorpackageinformationwidget.cpp \ + bardescriptoreditorauthorinformationwidget.cpp \ + bardescriptoreditorentrypointwidget.cpp \ + bardescriptoreditorgeneralwidget.cpp \ + bardescriptoreditorpermissionswidget.cpp \ + bardescriptoreditorenvironmentwidget.cpp \ + bardescriptoreditorassetswidget.cpp \ + bardescriptoreditorabstractpanelwidget.cpp HEADERS += qnxplugin.h\ qnxconstants.h \ @@ -158,7 +166,15 @@ HEADERS += qnxplugin.h\ blackberrydeviceinformation.h \ blackberrysshkeysgenerator.h \ blackberryprocessparser.h \ - blackberrysigningpasswordsdialog.h + blackberrysigningpasswordsdialog.h \ + bardescriptoreditorpackageinformationwidget.h \ + bardescriptoreditorauthorinformationwidget.h \ + bardescriptoreditorentrypointwidget.h \ + bardescriptoreditorgeneralwidget.h \ + bardescriptoreditorpermissionswidget.h \ + bardescriptoreditorenvironmentwidget.h \ + bardescriptoreditorassetswidget.h \ + bardescriptoreditorabstractpanelwidget.h FORMS += \ blackberrydeviceconfigurationwizardsetuppage.ui \ @@ -168,14 +184,20 @@ FORMS += \ blackberrydeviceconfigurationwidget.ui \ qnxbaseqtconfigwidget.ui \ blackberryndksettingswidget.ui \ - bardescriptoreditorwidget.ui \ blackberrykeyswidget.ui \ blackberryregisterkeydialog.ui \ blackberryimportcertificatedialog.ui \ blackberrycreatecertificatedialog.ui \ blackberrydebugtokenrequestdialog.ui \ blackberrycreatepackagestepconfigwidget.ui \ - blackberrysigningpasswordsdialog.ui + blackberrysigningpasswordsdialog.ui \ + bardescriptoreditorpackageinformationwidget.ui \ + bardescriptoreditorauthorinformationwidget.ui \ + bardescriptoreditorentrypointwidget.ui \ + bardescriptoreditorgeneralwidget.ui \ + bardescriptoreditorpermissionswidget.ui \ + bardescriptoreditorenvironmentwidget.ui \ + bardescriptoreditorassetswidget.ui include(../../private_headers.pri) diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index adaf0aa35a..991be19502 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -24,11 +24,33 @@ QtcPlugin { "bardescriptordocumentnodehandlers.h", "bardescriptoreditor.cpp", "bardescriptoreditor.h", + "bardescriptoreditorabstractpanelwidget.cpp", + "bardescriptoreditorabstractpanelwidget.h", + "bardescriptoreditorassetswidget.cpp", + "bardescriptoreditorassetswidget.h", + "bardescriptoreditorassetswidget.ui", + "bardescriptoreditorauthorinformationwidget.cpp", + "bardescriptoreditorauthorinformationwidget.h", + "bardescriptoreditorauthorinformationwidget.ui", + "bardescriptoreditorentrypointwidget.cpp", + "bardescriptoreditorentrypointwidget.h", + "bardescriptoreditorentrypointwidget.ui", + "bardescriptoreditorenvironmentwidget.cpp", + "bardescriptoreditorenvironmentwidget.h", + "bardescriptoreditorenvironmentwidget.ui", "bardescriptoreditorfactory.cpp", "bardescriptoreditorfactory.h", + "bardescriptoreditorgeneralwidget.cpp", + "bardescriptoreditorgeneralwidget.h", + "bardescriptoreditorgeneralwidget.ui", + "bardescriptoreditorpackageinformationwidget.cpp", + "bardescriptoreditorpackageinformationwidget.h", + "bardescriptoreditorpackageinformationwidget.ui", + "bardescriptoreditorpermissionswidget.cpp", + "bardescriptoreditorpermissionswidget.h", + "bardescriptoreditorpermissionswidget.ui", "bardescriptoreditorwidget.cpp", "bardescriptoreditorwidget.h", - "bardescriptoreditorwidget.ui", "bardescriptormagicmatcher.cpp", "bardescriptormagicmatcher.h", "bardescriptorpermissionsmodel.cpp", |