summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2016-08-09 12:21:43 +0200
committerKai Koehne <kai.koehne@qt.io>2016-08-29 07:51:33 +0000
commit89d766d65393a0445ddf5100b7db39f6ba1ed901 (patch)
tree0f8c8553dc60455e92fef4d823fb3d37b1e3894b
parent5b38f4489539eebd93a5fca5cc6de105868faa9d (diff)
Remove unused tool qconfigv5.8.0-alpha1
The tool is of no use since Qt 5, and also is not compiling anymore. Change-Id: I0f5154fb189fff9806fb803ec9de44d3705cdc49 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r--src/qconfig/feature.cpp227
-rw-r--r--src/qconfig/feature.h112
-rw-r--r--src/qconfig/featuretreemodel.cpp438
-rw-r--r--src/qconfig/featuretreemodel.h91
-rw-r--r--src/qconfig/graphics.h182
-rw-r--r--src/qconfig/main.cpp545
-rw-r--r--src/qconfig/qconfig.pro6
7 files changed, 0 insertions, 1601 deletions
diff --git a/src/qconfig/feature.cpp b/src/qconfig/feature.cpp
deleted file mode 100644
index 71cb8816f..000000000
--- a/src/qconfig/feature.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "feature.h"
-#include <QTextStream>
-#include <QRegExp>
-#include <QLibraryInfo>
-#include <QFileInfo>
-#include <QApplication>
-#include <QPalette>
-
-QT_BEGIN_NAMESPACE
-
-QMap<QString, Feature*> Feature::instances;
-
-Feature* Feature::getInstance(const QString &key)
-{
- QString ukey = key.toUpper();
- if (!instances.contains(ukey))
- instances[ukey] = new Feature(ukey);
- return instances[ukey];
-}
-
-Feature::~Feature()
-{
- delete d;
-}
-
-void Feature::clear()
-{
- foreach (Feature *f, instances.values())
- delete f;
- instances.clear();
-}
-
-static QString listToHtml(const QString &title, const QStringList &list)
-{
- if (list.isEmpty())
- return QString();
-
- QString str;
- QTextStream stream(&str);
-
- stream << "<h3>" << title << ":</h3>";
- stream << "<ul>";
- foreach (QString l, list)
- stream << "<li>" << l << "</li>";
- stream << "</ul>";
-
- return str;
-}
-
-static QString listToHtml(const QString &title, const QList<Feature*> &list)
-{
- QStringList stringlist;
- foreach (Feature *f, list) {
- QString s("[%3] <a href=\"feature://%1\">%2</a>");
- s = s.arg(f->key()).arg(f->key());
- s = s.arg(f->selectable() && f->enabled() ? "On" : "Off");
- stringlist << s;
- }
- return listToHtml(title, stringlist);
-}
-
-static QString linkify(const QString &src)
-{
- static QRegExp classRegexp("\\b(Q[\\w]+)");
- QString docRoot = QLibraryInfo::location(QLibraryInfo::DocumentationPath);
- QString result = src;
- int pos = 0;
- while ((pos = classRegexp.indexIn(result, pos)) != -1) {
- QString className = classRegexp.cap(1);
- QString file = docRoot + "/html/" + className.toLower() + ".html";
- QFileInfo info(file);
- if (info.isFile()) {
- QString link = QString("<a href=\"file://%1\">%2</a>")
- .arg(file).arg(className);
- result.replace(pos, className.length(), link);
- pos += link.length();
- } else {
- pos += className.length();
- }
- }
-
- return result;
-}
-
-QString Feature::toHtml() const
-{
- QString str;
- QTextStream stream(&str);
-
- const QString linkColor = QApplication::palette().color(QPalette::Link).name();
- stream << "<h2><font size=\"+2\" color=\"" << linkColor << "\">"
- << key() << "</font></h2>"
- << "<h2><font size=\"+2\">" << title() << "</font></h2>";
- if (!description().isEmpty())
- stream << "<p>" << description() << "</p>";
- stream << listToHtml("Section", QStringList(section()))
- << listToHtml("Requires", dependencies())
- << listToHtml("Required for", supports())
- << listToHtml("See also", relations());
-
- return linkify(str);
-}
-
-Feature::Feature(const QString &key) : d(new FeaturePrivate(key)) {}
-
-void Feature::setTitle(const QString &title)
-{
- d->title = title;
-}
-
-void Feature::setSection(const QString &section)
-{
- d->section = section;
-}
-
-void Feature::setDescription(const QString &description)
-{
- d->description = description;
-}
-
-void Feature::addRelation(const QString &key)
-{
- d->relations.insert(getInstance(key));
-}
-
-void Feature::setRelations(const QStringList &keys)
-{
- foreach(QString key, keys)
- if (key != "???")
- addRelation(key);
-}
-
-QList<Feature*> Feature::relations() const
-{
- return d->relations.toList();
-}
-
-void Feature::addDependency(const QString &key)
-{
- Feature *f = getInstance(key);
- d->dependencies.insert(f);
- f->d->supports.insert(this);
-}
-
-void Feature::setDependencies(const QStringList &keys)
-{
- foreach(QString key, keys)
- addDependency(key);
-}
-
-QList<Feature*> Feature::dependencies() const
-{
- return d->dependencies.toList();
-}
-
-QList<Feature*> Feature::supports() const
-{
- return d->supports.toList();
-}
-
-/*
- Returns a html formatted detailed description of this Feature.
-*/
-QString Feature::getDocumentation() const
-{
- return QString() + "<h2>" + d->title + "</h2>";
-
-}
-
-void Feature::setEnabled(bool on)
-{
- if (on == d->enabled)
- return;
-
- d->enabled = on;
- foreach (Feature *f, supports())
- f->updateSelectable();
- emit changed();
-}
-
-/*
- Update whether this feature should be selectable.
- A feature is selectable if all its dependencies are enabled.
-*/
-void Feature::updateSelectable()
-{
- bool selectable = true;
- foreach (Feature *f, dependencies())
- if (!f->selectable() || !f->enabled())
- selectable = false;
- if (selectable != d->selectable) {
- d->selectable = selectable;
- foreach (Feature *f, supports())
- f->updateSelectable();
- emit changed();
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/qconfig/feature.h b/src/qconfig/feature.h
deleted file mode 100644
index d120ffcee..000000000
--- a/src/qconfig/feature.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef FEATURE_H
-#define FEATURE_H
-
-#include <QString>
-#include <QStringList>
-#include <QMap>
-#include <QSet>
-#include <QList>
-
-QT_BEGIN_NAMESPACE
-
-class Feature;
-
-class FeaturePrivate
-{
-public:
- FeaturePrivate(const QString &k)
- : key(k), enabled(true), selectable(true) {};
-
- const QString key;
- QString section;
- QString title;
- QString description;
- QSet<Feature*> dependencies;
- QSet<Feature*> supports; // features who depends on this one
- QSet<Feature*> relations;
- bool enabled;
- bool selectable;
-};
-
-class Feature : public QObject
-{
- Q_OBJECT
-
-public:
- static Feature* getInstance(const QString &key);
- static void clear();
-
-public:
- QString key() const { return d->key; }
-
- void setTitle(const QString &title);
- QString title() const { return d->title; }
-
- void setSection(const QString &section);
- QString section() const { return d->section; }
-
- void setDescription(const QString &description);
- QString description() const { return d->description; };
-
- void addRelation(const QString &key);
- void setRelations(const QStringList &keys);
- QList<Feature*> relations() const;
-
- void addDependency(const QString &dependency);
- void setDependencies(const QStringList &dependencies);
- QList<Feature*> dependencies() const;
-
- QList<Feature*> supports() const;
- QString getDocumentation() const;
-
- void setEnabled(bool on);
- bool enabled() const { return d->enabled; };
-
- bool selectable() const { return d->selectable; }
-
- QString toHtml() const;
-
- ~Feature();
-
-signals:
- void changed();
-
-private:
- Feature(const QString &key);
- void updateSelectable();
-
- static QMap<QString, Feature*> instances;
- FeaturePrivate *d;
-};
-
-QT_END_NAMESPACE
-
-#endif // FEATURE_H
diff --git a/src/qconfig/featuretreemodel.cpp b/src/qconfig/featuretreemodel.cpp
deleted file mode 100644
index 307c90113..000000000
--- a/src/qconfig/featuretreemodel.cpp
+++ /dev/null
@@ -1,438 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "featuretreemodel.h"
-#include "feature.h"
-#include <QPalette>
-#include <QColor>
-#include <QApplication>
-#include <QtDebug>
-
-QT_BEGIN_NAMESPACE
-
-class Node
-{
-public:
- Node(Feature *f, Node *p = 0) : feature(f), parent(p) {}
- ~Node();
- Node* find(const Feature *child) const;
- bool contains(const Feature *child) const { return find(child) != 0; }
- bool insert(Node *n);
-
- Feature *feature;
- Node *parent;
- QList<Node*> children; // maybe convert to Map to get keys sorted
-};
-
-Node::~Node()
-{
- while (!children.isEmpty())
- delete children.takeFirst();
-}
-
-Node* Node::find(const Feature *f) const
-{
- if (this->feature == f)
- return const_cast<Node*>(this);
-
- foreach (Node *n, children)
- if (Node *m = n->find(f))
- return m;
-
- return 0;
-}
-
-static bool nodePtrLessThan(const Node *n1, const Node *n2)
-{
- return (n1->feature->key() < n2->feature->key());
-}
-
-/*
- Try insert \a n into the tree with this node as root.
- n is inserted as a child if it has a dependency to this node.
- Returns true if child is inserted into the tree, false otherwise.
-*/
-bool Node::insert(Node *n)
-{
- Feature *f = const_cast<Feature*>(n->feature);
- if (feature->supports().contains(f)) {
- children.append(n);
- qSort(children.begin(), children.end(), nodePtrLessThan);
- n->parent = this;
- return true;
- }
- foreach (Node *child, children)
- if (child->insert(n))
- return true;
- return false;
-}
-
-static bool isSection(const QModelIndex &index)
-{
- return index.isValid() && (index.internalId() == 0);
-}
-
-FeatureTreeModel::FeatureTreeModel(QObject *parent)
- : QAbstractItemModel(parent)
-{
-}
-
-FeatureTreeModel::~FeatureTreeModel()
-{
- foreach (QString section, sections.keys())
- while (!sections[section].isEmpty())
- delete sections[section].takeFirst();
-}
-
-/*
- Returns true if the model already contains \a in \a section, false otherwise.
-*/
-bool FeatureTreeModel::contains(const QString &section, const Feature *f) const
-{
- return (find(section, f) != 0);
-}
-
-Node* FeatureTreeModel::find(const QString &section, const Feature *f) const
-{
- QList<Node*> roots = sections[section];
- foreach (Node *root, roots)
- if (Node *n = root->find(f))
- return n;
- return 0;
-}
-
-/*
- Add new \a feature to the tree.
- When all feature is added, buildTree() must be called to build the
- dependency tree.
-*/
-void FeatureTreeModel::addFeature(Feature *feature)
-{
- const QString section = feature->section();
- Q_ASSERT(!contains(section, feature));
-
- connect(feature, SIGNAL(changed()), this, SLOT(featureChanged()));
-
- Node *node = new Node(feature, 0);
-
- // try insert any toplevel nodes as child of this one
- foreach (Node *n, sections[section])
- if (node->insert(n))
- sections[section].removeAll(n);
-
- // try insert this node as a child of any existing node
- foreach (Node *n, sections[section])
- if (n->insert(node)) {
- emit layoutChanged();
- return;
- }
-
- // not a child, insert as a toplevel node
- sections[section].append(node);
- qSort(sections[section].begin(), sections[section].end(), nodePtrLessThan);
- emit layoutChanged();
-}
-
-QModelIndex FeatureTreeModel::createIndex(int row, int column,
- const QModelIndex &parent,
- const Node *node) const
-{
- QModelIndex index = QAbstractItemModel::createIndex(row, column,
- (void*)node);
- if (parent.isValid())
- parentMap[index] = parent;
- if (node)
- featureIndexMap[node->feature] = index;
- return index;
-}
-
-QModelIndex FeatureTreeModel::index(int row, int column,
- const QModelIndex &parent) const
-{
- if (!parent.isValid()) { // index is a section
- if (row < sections.size() && column == 0)
- return QAbstractItemModel::createIndex(row, column);
- return QModelIndex();
- }
-
- if (isSection(parent)) { // index is a toplevel feature
- const int parentRow = parent.row();
- if (parentRow < sections.size()) {
- QString section = sections.keys().at(parentRow);
- QList<Node*> nodes = sections[section];
- if (row < nodes.size() && column < 2)
- return createIndex(row, column, parent, nodes.at(row));
- }
- return QModelIndex();
- }
-
- // parent is a feature
- Node *parentNode = static_cast<Node*>(parent.internalPointer());
- QList<Node*> children = parentNode->children;
- if (row < children.size() && column < 2)
- return createIndex(row, column, parent, children.at(row));
-
- return QModelIndex();
-}
-
-QModelIndex FeatureTreeModel::index(const QModelIndex &parent,
- const Feature *feature) const
-{
- const int rows = rowCount(parent);
- for (int i = 0; i < rows; ++i) {
- QModelIndex child = index(i, 0, parent);
- Node *node = static_cast<Node*>(child.internalPointer());
- if (node && node->feature == feature)
- return child;
- QModelIndex childSearch = index(child, feature);
- if (childSearch.isValid())
- return childSearch;
- }
- return QModelIndex();
-}
-
-QModelIndex FeatureTreeModel::index(const Feature *feature) const
-{
- if (featureIndexMap.contains(feature))
- return featureIndexMap.value(feature);
-
- // exhaustive search
- int sectionRow = sections.keys().indexOf(feature->section());
- QModelIndex sectionIndex = index(sectionRow, 0, QModelIndex());
-
- return index(sectionIndex, feature);
-}
-
-QModelIndex FeatureTreeModel::parent(const QModelIndex &index) const
-{
- if (!index.isValid())
- return QModelIndex();
-
- if (parentMap.contains(index))
- return parentMap.value(index);
- return QModelIndex();
-}
-
-int FeatureTreeModel::rowCount(const QModelIndex &parent) const
-{
- if (!parent.isValid())
- return sections.size();
-
- if (isSection(parent)) {
- const QString section = sections.keys().at(parent.row());
- return sections[section].size();
- }
-
- const Node *node = static_cast<Node*>(parent.internalPointer());
- return node->children.size();
-}
-
-int FeatureTreeModel::columnCount(const QModelIndex &parent) const
-{
-#if 0
- if (!parent.isValid())
- return 0;
-
- if (isSection(parent))
- return 1;
-#endif
- Q_UNUSED(parent);
- return 2; // Feature: [key, name]
-}
-
-QVariant FeatureTreeModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- const Node *node = static_cast<Node*>(index.internalPointer());
-
- switch (role) {
- case Qt::DisplayRole: {
- if (node == 0) // index is a section
- return sections.keys().at(index.row());
- if (index.column() == 0)
- return node->feature->key();
- Q_ASSERT(index.column() == 1);
- return node->feature->title();
- }
- case Qt::CheckStateRole: {
- if (node && index.column() == 0)
- return (node->feature->enabled() ?
- Qt::Checked : Qt::Unchecked);
- break;
- }
- case Qt::TextColorRole: {
- if (node && index.column() == 0) // feature key
- if (node->feature->selectable())
- return QApplication::palette().color(QPalette::Link);
- break;
- }
- case Qt::TextAlignmentRole:
- case Qt::BackgroundColorRole:
- case Qt::FontRole:
- case Qt::ToolTipRole: // TODO
- case Qt::StatusTipRole: // TODO
- case Qt::WhatsThisRole: // TODO
- case Qt::DecorationRole:
- case Qt::EditRole:
- default:
- break;
- }
- return QVariant();
-}
-
-bool FeatureTreeModel::setData(const QModelIndex &index,
- const QVariant &value, int role)
-{
- if (!index.isValid())
- return false;
-
- Node *node = static_cast<Node*>(index.internalPointer());
- if (!node)
- return false;
-
- if (role == Qt::CheckStateRole) {
- Qt::CheckState state = static_cast<Qt::CheckState>(value.toInt());
- if (state == Qt::Checked)
- node->feature->setEnabled(true);
- else if (state == Qt::Unchecked)
- node->feature->setEnabled(false);
- emit dataChanged(index, index);
- return true;
- }
- return false;
-}
-
-Qt::ItemFlags FeatureTreeModel::flags(const QModelIndex &index) const
-{
- if (!index.isValid() || index.internalPointer() == 0)
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-
- const Node *node = static_cast<Node*>(index.internalPointer());
- const Feature *feature = node->feature;
- Qt::ItemFlags flags = Qt::ItemIsUserCheckable | Qt::ItemIsSelectable;
-
- if (feature->selectable())
- flags |= Qt::ItemIsEnabled;
-
- return flags;
-}
-
-QVariant FeatureTreeModel::headerData(int section, Qt::Orientation orientation,
- int role) const
-{
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
- if (section == 0)
- return QString("Id");
- else if (section == 1)
- return QString("Name");
- }
-
- return QVariant();
-}
-
-Feature* FeatureTreeModel::getFeature(const QModelIndex &index) const
-{
- if (!index.isValid())
- return 0;
- if (isSection(index))
- return 0;
- Node *node = static_cast<Node*>(index.internalPointer());
- return const_cast<Feature*>(node->feature);
-}
-
-void FeatureTreeModel::featureChanged()
-{
- Feature *feature = qobject_cast<Feature*>(sender());
- if (feature) {
- QModelIndex featureIndex = index(feature);
- emit dataChanged(featureIndex, featureIndex);
- } else {
- emit layoutChanged();
- }
-}
-
-void FeatureTreeModel::readConfig(QTextStream &stream)
-{
- static QRegExp regexp("\\s*#\\s*define\\s+QT_NO_(\\S+)\\s*");
-
- while (!stream.atEnd()) {
- QString line = stream.readLine();
- if (regexp.exactMatch(line)) {
- Feature *f = Feature::getInstance(regexp.cap(1));
- f->setEnabled(false);
- }
- }
-}
-/*
- Search for all disabled child features of \a parent.
- Returns a list of feature keys for the disabled items.
-*/
-QStringList FeatureTreeModel::findDisabled(const QModelIndex &parent) const
-{
- QStringList stringList;
-
- const int rows = rowCount(parent);
- for (int i = 0; i < rows; ++i) {
- QModelIndex child = index(i, 0, parent);
- Node *node = static_cast<Node*>(child.internalPointer());
- if (node && node->feature && !node->feature->enabled())
- stringList << node->feature->key();
- stringList << findDisabled(child);
- }
- return stringList;
-}
-
-void FeatureTreeModel::writeConfig(QTextStream &stream) const
-{
- const int sectionCount = rowCount(QModelIndex());
-
- for (int i = 0; i < sectionCount; ++i) {
- QModelIndex section = index(i, 0, QModelIndex());
- QStringList disabled = findDisabled(section);
- if (disabled.size() > 0) {
- stream << '\n' << "/* " << sections.keys().at(i) << " */" << '\n';
- foreach (QString feature, disabled)
- stream << "#ifndef QT_NO_" << feature << '\n'
- << "# define QT_NO_" << feature << '\n'
- << "#endif" << '\n';
- }
- }
-}
-
-void FeatureTreeModel::clear()
-{
- Feature::clear();
- sections.clear();
- parentMap.clear();
- featureIndexMap.clear();
- emit layoutChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/qconfig/featuretreemodel.h b/src/qconfig/featuretreemodel.h
deleted file mode 100644
index fa145609a..000000000
--- a/src/qconfig/featuretreemodel.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef FEATURETREEMODEL_H
-#define FEATURETREEMODEL_H
-
-#include <QAbstractItemModel>
-#include <QMap>
-#include <QHash>
-#include <QTextStream>
-
-QT_BEGIN_NAMESPACE
-
-class Feature;
-class Node;
-
-uint qHash(const QModelIndex&);
-
-class FeatureTreeModel : public QAbstractItemModel
-{
- Q_OBJECT
-
-public:
- FeatureTreeModel(QObject *parent = 0);
- ~FeatureTreeModel();
-
- void clear();
-
- QVariant data(const QModelIndex &index, int role) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
- Qt::ItemFlags flags(const QModelIndex &index) const;
- QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
- QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const;
- QModelIndex index(const Feature *feature) const;
- QModelIndex parent(const QModelIndex &index) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
-
- void addFeature(Feature *feature);
- Feature* getFeature(const QModelIndex &index) const;
-
- void readConfig(QTextStream &stream);
- void writeConfig(QTextStream &stream) const;
-
-public slots:
- void featureChanged();
-
-private:
- QModelIndex createIndex(int row, int column,
- const QModelIndex &parent,
- const Node *feature) const;
- QModelIndex index(const QModelIndex &parent, const Feature *feature) const;
- bool contains(const QString &section, const Feature *f) const;
- Node* find(const QString &section, const Feature *f) const;
- QStringList findDisabled(const QModelIndex &parent) const;
-
- QMap<QString, QList<Node*> > sections;
- mutable QHash<QModelIndex, QModelIndex> parentMap;
- mutable QHash<const Feature*, QModelIndex> featureIndexMap;
-};
-
-QT_END_NAMESPACE
-
-#endif // FEATURETREEMODEL_H
diff --git a/src/qconfig/graphics.h b/src/qconfig/graphics.h
deleted file mode 100644
index 8547ee858..000000000
--- a/src/qconfig/graphics.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GRAPHICS_H
-#define GRAPHICS_H
-
-static const char *logo_xpm[] = {
-/* width height ncolors chars_per_pixel */
-"50 50 17 1",
-/* colors */
-" c #000000",
-". c #495808",
-"X c #2A3304",
-"o c #242B04",
-"O c #030401",
-"+ c #9EC011",
-"@ c #93B310",
-"# c #748E0C",
-"$ c #A2C511",
-"% c #8BA90E",
-"& c #99BA10",
-"* c #060701",
-"= c #181D02",
-"- c #212804",
-"; c #61770A",
-": c #0B0D01",
-"/ c None",
-/* pixels */
-"/$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$/",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$+++$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$@;.o=::=o.;@$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$+#X* **X#+$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$#oO* O **o#+$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$&.* OO O*.&$$$$$$$$$$$$$",
-"$$$$$$$$$$$$@XOO * OO X&$$$$$$$$$$$$",
-"$$$$$$$$$$$@XO OO O **:::OOO OOO X@$$$$$$$$$$$",
-"$$$$$$$$$$&XO O-;#@++@%.oOO X&$$$$$$$$$$",
-"$$$$$$$$$$.O : *-#+$$$$$$$$+#- : O O*.$$$$$$$$$$",
-"$$$$$$$$$#*OO O*.&$$$$$$$$$$$$+.OOOO **#$$$$$$$$$",
-"$$$$$$$$+-OO O *;$$$$$$$$$$$&$$$$;* o+$$$$$$$$",
-"$$$$$$$$#O* O .+$$$$$$$$$$@X;$$$+.O *#$$$$$$$$",
-"$$$$$$$$X* -&$$$$$$$$$$@- :;$$$&- OX$$$$$$$$",
-"$$$$$$$@*O *O#$$$$$$$$$$@oOO**;$$$# O*%$$$$$$$",
-"$$$$$$$; -+$$$$$$$$$@o O OO ;+$$-O *;$$$$$$$",
-"$$$$$$$. ;$$$$$$$$$@-OO OO X&$$;O .$$$$$$$",
-"$$$$$$$o *#$$$$$$$$@o O O O-@$$$#O *o$$$$$$$",
-"$$$$$$+= *@$$$$$$$@o* OO -@$$$$&: =$$$$$$$",
-"$$$$$$+: :+$$$$$$@- *-@$$$$$$: :+$$$$$$",
-"$$$$$$+: :+$$$$$@o* O *-@$$$$$$: :+$$$$$$",
-"$$$$$$$= :@$$$$@o*OOO -@$$$$@: =+$$$$$$",
-"$$$$$$$- O%$$$@o* O O O O-@$$$#* OX$$$$$$$",
-"$$$$$$$. O *O;$$&o O*O* *O -@$$; O.$$$$$$$",
-"$$$$$$$;* Oo+$$;O*O:OO-- Oo@+= *;$$$$$$$",
-"$$$$$$$@* O O#$$$;*OOOo@@-O Oo;O* **@$$$$$$$",
-"$$$$$$$$X* OOO-+$$$;O o@$$@- O O OX$$$$$$$$",
-"$$$$$$$$#* * O.$$$$;X@$$$$@-O O O#$$$$$$$$",
-"$$$$$$$$+oO O OO.+$$+&$$$$$$@-O o+$$$$$$$$",
-"$$$$$$$$$#* **.&$$$$$$$$$$@o OO:#$$$$$$$$$",
-"$$$$$$$$$+. O* O-#+$$$$$$$$+;O OOO:@$$$$$$$$$",
-"$$$$$$$$$$&X *O -;#@++@#;=O O -@$$$$$$$$",
-"$$$$$$$$$$$&X O O*O::::O OO Oo@$$$$$$$",
-"$$$$$$$$$$$$@XOO OO O*X+$$$$$$",
-"$$$$$$$$$$$$$&.* ** O :: *:#$$$$$$$",
-"$$$$$$$$$$$$$$$#o*OO O Oo#@-OOO=#$$$$$$$$",
-"$$$$$$$$$$$$$$$$+#X:* * O**X#+$$@-*:#$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$%;.o=::=o.#@$$$$$$@X#$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$+++$$$$$$$$$$$+$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
-"/$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$/",
-};
-
-static const char *expanded_xpm[] = {
-"32 32 3 1",
-" c None",
-"# c #000000",
-"a c #0000c0",
-" ## ",
-" ## ",
-" #############aaaaaaaaaaaaa ",
-" ## # ",
-" ## # ",
-" ## # ",
-" ## # ",
-" ## # ",
-" ## # ",
-" ## #aaaaaaaaaaaaa ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" #############aaaaaaaaaaaaa ",
-" ## # ",
-" ## # ",
-" ## # ",
-" ## # ",
-" ## # ",
-" ## #aaaaaaaaaaaaa ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" #############aaaaaaaaaaaaa ",
-" ## # ",
-" ## # ",
-" ## # ",
-" ## # "};
-
-static const char *collapsed_xpm[] = {
-"32 32 3 1",
-" c None",
-"# c #000000",
-"a c #0000c0",
-" ## ",
-" ## ",
-" ##aaaaaaaaaaaaaaaaaa ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ##aaaaaaaaaaaaaaaaaa ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ##aaaaaaaaaaaaaaaaaa ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ##aaaaaaaaaaaaaaaaaa ",
-" ## ",
-" ## ",
-" ## ",
-" ## ",
-" ## "};
-
-#endif // GRAPHICS_H
diff --git a/src/qconfig/main.cpp b/src/qconfig/main.cpp
deleted file mode 100644
index a9ff84869..000000000
--- a/src/qconfig/main.cpp
+++ /dev/null
@@ -1,545 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "graphics.h"
-#include "feature.h"
-#include "featuretreemodel.h"
-
-#include <QtCore/QLibraryInfo>
-#include <QtCore/QSettings>
-#include <QtWidgets/QTextBrowser>
-#include <QtWidgets/QTreeView>
-#include <QtWidgets/QMainWindow>
-#include <QtWidgets/QSplitter>
-#include <QtWidgets/QMenu>
-#include <QtWidgets/QMenuBar>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QToolBar>
-#include <QtWidgets/QToolButton>
-#include <QtWidgets/QMessageBox>
-#include <QtWidgets/QFileDialog>
-#include <QtWidgets/QStatusBar>
-#include <QtWidgets/QApplication>
-
-QT_BEGIN_NAMESPACE
-
-static QString defaultPath;
-
-class FeatureTextBrowser : public QTextBrowser {
- Q_OBJECT
-public:
- FeatureTextBrowser(QWidget *parent) : QTextBrowser(parent) {
- QString docRoot;
- docRoot = QLibraryInfo::location(QLibraryInfo::DocumentationPath)
- + "/html";
- setSearchPaths(searchPaths() << docRoot);
- }
-
-signals:
- void featureClicked(const QString &feature);
-
-public slots:
- void setSource(const QUrl &url)
- {
- if (url.scheme() == "feature")
- emit featureClicked(url.authority());
- else
- QTextBrowser::setSource(url);
- }
-};
-
-class Main : public QMainWindow {
- Q_OBJECT
-public:
- Main();
- ~Main();
- void loadFeatures(const QString& filename);
- void loadConfig(const QString& filename);
-
-public slots:
- void modelChanged();
- void showInfo(const QModelIndex &index);
- void showInfo(const QString &feature);
- void openConfig();
- void saveConfig();
- void expandView();
- void collapseView();
- void about();
- void aboutQt();
- void quit();
- void clear();
- void enableAll();
- void disableAll();
-
-private:
- QTextBrowser *textBrowser;
- QTreeView *featureTree;
- FeatureTreeModel *featureModel;
-
- void init();
- void updateStatus(int numFeatures = -1);
- void completelyExpandIndex(const QModelIndex &parent);
-};
-
-template<typename Func>
-void foreachIndex_helper(const QModelIndex &parent, Func func)
-{
- const QAbstractItemModel *model = parent.model();
- const int rows = model->rowCount(parent);
- for (int i = 0; i < rows; ++i) {
- const QModelIndex child = model->index(i, 0, parent);
- func(child);
- foreachIndex_helper(child, func);
- }
-}
-
-template<typename Func>
-void foreachIndex(const QAbstractItemModel *model, Func func)
-{
- const int rows = model->rowCount(QModelIndex());
- for (int i = 0; i < rows; ++i) {
- const QModelIndex child = model->index(i, 0, QModelIndex());
- func(child);
- foreachIndex_helper(child, func);
- }
-}
-
-struct CheckStateSetter {
-
- CheckStateSetter(Qt::CheckState state, QAbstractItemModel *m)
- : checkState(state), model(m) {}
-
- void operator()(const QModelIndex &index) {
- model->setData(index, checkState, Qt::CheckStateRole);
- }
-
- Qt::CheckState checkState;
- QAbstractItemModel *model;
-};
-
-void Main::disableAll()
-{
- QAbstractItemModel *model = featureTree->model();
- foreachIndex(model, CheckStateSetter(Qt::Unchecked, model));
-}
-
-void Main::enableAll()
-{
- QAbstractItemModel *model = featureTree->model();
- foreachIndex(model, CheckStateSetter(Qt::Checked, model));
-}
-
-Main::Main()
-{
- setWindowIcon(QIcon(QPixmap(logo_xpm)));
-
- QSplitter *splitter = new QSplitter(this);
-
- featureModel = new FeatureTreeModel(this);
- featureTree = new QTreeView(splitter);
- splitter->addWidget(featureTree);
- featureTree->setRootIsDecorated(true);
- featureTree->setModel(featureModel);
- featureTree->show();
-
- textBrowser = new FeatureTextBrowser(splitter);
- textBrowser->setFrameStyle(QFrame::WinPanel|QFrame::Sunken);
- splitter->addWidget(textBrowser);
- textBrowser->show();
-
- connect(textBrowser, SIGNAL(featureClicked(QString)),
- this, SLOT(showInfo(QString)));
- connect(featureTree, SIGNAL(activated(QModelIndex)),
- this, SLOT(showInfo(QModelIndex)));
- connect(featureModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(modelChanged()));
- connect(featureTree, SIGNAL(clicked(QModelIndex)),
- this, SLOT(showInfo(QModelIndex)));
-
- setCentralWidget(splitter);
-
- QMenu *file = menuBar()->addMenu("&File");
- file->addAction("&Open...", this, SLOT(openConfig()),
- Qt::CTRL + Qt::Key_O);
- file->addAction("&Save As...", this, SLOT(saveConfig()),
- Qt::CTRL + Qt::Key_S);
- file->addSeparator();
- file->addAction("&Reset", this, SLOT(clear()));
- file->addSeparator();
- file->addAction("E&xit", this, SLOT(quit()), Qt::CTRL + Qt::Key_Q);
-
- QMenu *edit = menuBar()->addMenu("&Tools");
- edit->addAction("&Enable all features", this, SLOT(enableAll()));
- edit->addAction("&Disable all features", this, SLOT(disableAll()));
-
- menuBar()->addSeparator();
-
- QMenu *help = menuBar()->addMenu("&Help");
- help->addAction("&About", this, SLOT(about()));
- help->addAction("About &Qt", this, SLOT(aboutQt()));
-
- QToolBar *tb = new QToolBar("Expand/Collapse features");
- QToolButton *button;
-
- button = new QToolButton(tb);
- button->setIcon(QIcon(QPixmap(collapsed_xpm)));
- button->setText("Collapse");
- button->setToolTip("Collapse");
- connect(button, SIGNAL(clicked()), this, SLOT(collapseView()));
- tb->addWidget(button);
-
- button = new QToolButton(tb);
- button->setIcon(QIcon(QPixmap(expanded_xpm)));
- button->setText("Expand");
- button->setToolTip("Expand");
- connect(button, SIGNAL(clicked()), this, SLOT(expandView()));
- tb->addWidget(button);
- addToolBar(tb);
-
- init();
-}
-
-Main::~Main()
-{
- delete textBrowser;
- delete featureModel;
- delete featureTree;
-}
-
-void Main::clear()
-{
- QSettings settings;
- settings.clear();
- featureModel->clear();
- featureTree->reset();
- init();
-}
-
-void Main::quit()
-{
- if (isWindowModified()) {
- int button = QMessageBox::question(this, "Quit Program",
- "You have unsaved changes.\n"
- "Do you want to quit anyway?",
- QMessageBox::Yes,
- QMessageBox::No);
- if (static_cast<QMessageBox::Button>(button) != QMessageBox::Yes)
- return;
- }
- QApplication::instance()->quit();
-}
-
-/*
- Recursively expand expand \a parent and all of its children.
-*/
-void Main::completelyExpandIndex(const QModelIndex &parent)
-{
- featureTree->setExpanded(parent, true);
-
- const QAbstractItemModel *model = featureTree->model();
- const int rows = model->rowCount(parent);
- for (int i = 0; i < rows; ++i)
- completelyExpandIndex(model->index(i, 0, parent));
-}
-
-void Main::expandView()
-{
- completelyExpandIndex(QModelIndex());
-}
-
-void Main::collapseView()
-{
- const QAbstractItemModel *model = featureTree->model();
- const int rows = model->rowCount(QModelIndex());
- for (int i = 0; i < rows; ++i) {
- QModelIndex index = model->index(i, 0, QModelIndex());
- featureTree->setExpanded(index, false);
- }
-}
-
-void Main::updateStatus(int numFeatures)
-{
- QSettings settings;
- QString featureFile = settings.value("featureFile").toString();
- QString configFile = settings.value("lastConfig").toString();
- QString message("Using features from %1");
-
- if (numFeatures >= 0) {
- QString s("%1 features loaded from %2");
- statusBar()->showMessage(s.arg(numFeatures).arg(featureFile));
- }
- QString appName = QApplication::applicationName();
- if (configFile.isEmpty())
- configFile = "New File";
- setWindowTitle(appName + " - " + configFile + "[*]");
-}
-
-void Main::modelChanged()
-{
- setWindowModified(true);
-}
-
-void Main::init()
-{
- QSettings settings;
- QString features = settings.value("featureFile").toString();
-
- if (features.isEmpty() || !QFileInfo(features).isFile()) {
- features = QFileDialog::getOpenFileName(this,
- "Open a feature file",
- defaultPath,
- "Qt Features (qfeatures.txt)");
- }
- settings.setValue("featureFile", features);
- loadFeatures(features);
-
- expandView();
- collapseView();
-
- QString confFile = settings.value("lastConfig").toString();
- if (confFile.isEmpty())
- return;
- loadConfig(confFile);
-}
-
-void Main::openConfig()
-{
- QSettings settings;
- QString configDir;
-
- QString prevFile = settings.value("lastConfig").toString();
- if (!prevFile.isEmpty())
- configDir = QFileInfo(prevFile).path();
-
- if (configDir.isEmpty())
- configDir = defaultPath;
-
- QString configFile;
- configFile = QFileDialog::getOpenFileName(this,
- "Open a configuration file",
- configDir,
- "Header files (*.h)");
- enableAll();
- if (!configFile.isEmpty())
- loadConfig(configFile);
- settings.setValue("lastConfig", QFileInfo(configFile).absoluteFilePath());
-}
-
-void Main::saveConfig()
-{
- QSettings settings;
- QString configDir;
-
- QString prevFile = settings.value("lastConfig").toString();
- if (!prevFile.isEmpty())
- configDir = QFileInfo(prevFile).path();
-
- if (configDir.isEmpty())
- configDir = defaultPath;
-
- QString configFile;
- configFile = QFileDialog::getSaveFileName(this,
- "Save configuration file",
- configDir,
- "Header files (*.h)");
- if (configFile.isEmpty())
- return;
-
- QFile file(configFile);
- if (!file.open(QIODevice::WriteOnly)) {
- QMessageBox::warning(this,"Warning",
- "Cannot write to file " + configFile);
- return;
- }
-
- QTextStream stream(&file);
- FeatureTreeModel *model;
- model = static_cast<FeatureTreeModel*>(featureTree->model());
- model->writeConfig(stream);
-
- settings.setValue("lastConfig", QFileInfo(configFile).absoluteFilePath());
- setWindowModified(false);
- updateStatus();
-}
-
-void Main::loadConfig(const QString &filename)
-{
- if (!QFileInfo(filename).isFile())
- return;
-
- QFile file(filename);
- if (!file.open(QIODevice::ReadOnly)) {
- QMessageBox::warning(this,"Warning", "Cannot open file " + filename);
- return;
- }
-
- QTextStream stream(&file);
- FeatureTreeModel *model;
- model = static_cast<FeatureTreeModel*>(featureTree->model());
- model->readConfig(stream);
-
- QSettings settings;
- settings.setValue("lastConfig", QFileInfo(filename).absoluteFilePath());
- setWindowModified(false);
- updateStatus();
-}
-
-void Main::loadFeatures(const QString &filename)
-{
- Feature::clear();
-
- QFile file(filename);
- if (!file.open(QIODevice::ReadOnly)) {
- QMessageBox::warning(this,"Warning", "Cannot open file " + filename);
- return;
- }
-
- Feature *feature = 0;
- int numFeatures = 0;
- updateStatus(numFeatures);
- QTextStream s(&file);
- for (QString line = s.readLine(); !s.atEnd(); line = s.readLine()) {
- line = line.simplified();
- if (line.isEmpty())
- continue;
- if (line.startsWith('#'))
- continue;
-
- int colon = line.indexOf(':');
- if (colon < 0) { // assume description
- QString description = feature->description().simplified();
- description += " " + line;
- feature->setDescription(description);
- continue;
- }
-
- QString tag = line.left(colon);
- QString value = line.mid(colon+1).simplified();
- if (tag == "Feature") {
- if (feature)
- featureModel->addFeature(feature);
- feature = Feature::getInstance(value);
- updateStatus(++numFeatures);
- } else if (tag == "Requires") {
- Q_ASSERT(feature);
- feature->setDependencies(value.split(' ', QString::SkipEmptyParts));
- } else if (tag == "Name") {
- Q_ASSERT(feature);
- feature->setTitle(value);
- } else if (tag == "Section") {
- Q_ASSERT(feature);
- feature->setSection(value);
- } else if (tag == "SeeAlso") {
- Q_ASSERT(feature);
- feature->setRelations(value.split(' ', QString::SkipEmptyParts));
- } else if (tag == "Description") {
- Q_ASSERT(feature);
- feature->setDescription(value);
- }
- }
- if (feature)
- featureModel->addFeature(feature);
-
- featureTree->resizeColumnToContents(0);
-
- QSettings settings;
- settings.setValue("featureFile", QFileInfo(filename).absoluteFilePath());
-
- updateStatus();
-}
-
-void Main::showInfo(const QModelIndex &index)
-{
- FeatureTreeModel *model;
- model = static_cast<FeatureTreeModel*>(featureTree->model());
-
- if (const Feature *feature = model->getFeature(index))
- textBrowser->setHtml(feature->toHtml());
-
- // Ensure index is visible
- QModelIndex parent = model->parent(index);
- while (parent.isValid()) {
- featureTree->setExpanded(parent, true);
- parent = model->parent(parent);
- }
-
- featureTree->scrollTo(index);
- featureTree->setCurrentIndex(index);
-}
-
-void Main::showInfo(const QString &feature)
-{
- const Feature *f = Feature::getInstance(feature);
- FeatureTreeModel *model;
- model = static_cast<FeatureTreeModel*>(featureTree->model());
- showInfo(model->index(f));
-}
-
-void Main::about()
-{
- QMessageBox::about(this, "About qconfig",
- "<p><b><font size=\"+2\">Qtopia Core build configuration</font></b></p>"
- "<p></p>"
- "<p>Version 2.0</p>"
- "<p>Copyright (C) 2016 The Qt Company Ltd.</p>"
- "<p></p>"
- );
-}
-
-void Main::aboutQt()
-{
- QMessageBox::aboutQt( this, tr("qconfig") );
-}
-
-QT_END_NAMESPACE
-
-int main(int argc, char** argv)
-{
- QT_USE_NAMESPACE
- QApplication app(argc,argv);
- app.setOrganizationDomain("qt-project.org");
- app.setOrganizationName("QtProject");
- app.setApplicationName("QConfig");
- Main m;
-
- defaultPath = QLibraryInfo::location(QLibraryInfo::PrefixPath)
- + "/src/corelib/global";
-
- for (int i = 1; i < argc; ++i) {
- QString arg = argv[i];
- if (arg == "-f" && i+1 < argc)
- m.loadFeatures(argv[++i]);
- else if (arg == "-c" && i+1 < argc)
- m.loadConfig(argv[++i]);
- }
- m.resize(m.sizeHint() + QSize(500,300));
- m.show();
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/src/qconfig/qconfig.pro b/src/qconfig/qconfig.pro
deleted file mode 100644
index aa64dde32..000000000
--- a/src/qconfig/qconfig.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-QT += widgets
-
-HEADERS = feature.h featuretreemodel.h graphics.h
-SOURCES = main.cpp feature.cpp featuretreemodel.cpp
-
-load(qt_app)