2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "projectwindow.h"
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2010-01-21 13:46:19 +01:00
|
|
|
#include "doubletabwidget.h"
|
2014-07-11 16:54:04 +02:00
|
|
|
#include "panelswidget.h"
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "kitmanager.h"
|
2008-12-02 16:19:05 +01:00
|
|
|
#include "project.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "projectexplorer.h"
|
2014-07-28 14:35:53 +02:00
|
|
|
#include "projectpanelfactory.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "session.h"
|
2010-12-10 19:02:19 +01:00
|
|
|
#include "target.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
#include <coreplugin/idocument.h>
|
2009-01-19 12:39:20 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2014-06-16 18:25:52 +04:00
|
|
|
#include <utils/algorithm.h>
|
2009-11-30 16:23:28 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStackedWidget>
|
2014-07-11 16:54:04 +02:00
|
|
|
#include <QVBoxLayout>
|
2009-09-29 18:06:13 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace ProjectExplorer::Internal;
|
2009-08-06 15:31:32 +02:00
|
|
|
///
|
|
|
|
|
// ProjectWindow
|
|
|
|
|
///
|
|
|
|
|
|
2009-06-08 19:13:46 +02:00
|
|
|
ProjectWindow::ProjectWindow(QWidget *parent)
|
2010-01-21 13:46:19 +01:00
|
|
|
: QWidget(parent),
|
2014-07-14 17:39:46 +02:00
|
|
|
m_ignoreChange(false),
|
2014-07-11 13:08:09 +02:00
|
|
|
m_currentWidget(0)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-25 16:01:46 +01:00
|
|
|
// Setup overall layout:
|
|
|
|
|
QVBoxLayout *viewLayout = new QVBoxLayout(this);
|
|
|
|
|
viewLayout->setMargin(0);
|
|
|
|
|
viewLayout->setSpacing(0);
|
2009-09-17 13:59:10 +02:00
|
|
|
|
2010-01-21 13:46:19 +01:00
|
|
|
m_tabWidget = new DoubleTabWidget(this);
|
|
|
|
|
viewLayout->addWidget(m_tabWidget);
|
2009-10-07 15:46:07 +02:00
|
|
|
|
2009-11-25 16:01:46 +01:00
|
|
|
// Setup our container for the contents:
|
2010-01-21 13:46:19 +01:00
|
|
|
m_centralWidget = new QStackedWidget(this);
|
|
|
|
|
viewLayout->addWidget(m_centralWidget);
|
2009-11-25 16:01:46 +01:00
|
|
|
|
2013-09-05 11:46:07 +02:00
|
|
|
// Connections
|
2010-01-21 13:46:19 +01:00
|
|
|
connect(m_tabWidget, SIGNAL(currentIndexChanged(int,int)),
|
|
|
|
|
this, SLOT(showProperties(int,int)));
|
2009-09-17 13:59:10 +02:00
|
|
|
|
2013-09-05 11:46:07 +02:00
|
|
|
QObject *sessionManager = SessionManager::instance();
|
|
|
|
|
connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
2010-03-11 13:42:41 +01:00
|
|
|
this, SLOT(registerProject(ProjectExplorer::Project*)));
|
2013-09-05 11:46:07 +02:00
|
|
|
connect(sessionManager, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
2010-03-11 13:42:41 +01:00
|
|
|
this, SLOT(deregisterProject(ProjectExplorer::Project*)));
|
2009-11-25 15:18:51 +01:00
|
|
|
|
2013-09-05 11:46:07 +02:00
|
|
|
connect(sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
2012-03-05 22:30:59 +01:00
|
|
|
this, SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
2010-03-24 18:36:06 +01:00
|
|
|
|
2013-09-05 11:46:07 +02:00
|
|
|
connect(sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
|
2014-07-14 17:39:46 +02:00
|
|
|
this, SLOT(projectDisplayNameChanged(ProjectExplorer::Project*)));
|
2012-04-16 19:18:26 +04:00
|
|
|
|
2009-11-25 15:18:51 +01:00
|
|
|
// Update properties to empty project for now:
|
2010-01-21 13:46:19 +01:00
|
|
|
showProperties(-1, -1);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectWindow::~ProjectWindow()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-28 16:59:03 +02:00
|
|
|
void ProjectWindow::aboutToShutdown()
|
2009-10-07 15:46:07 +02:00
|
|
|
{
|
2012-05-03 16:10:00 +02:00
|
|
|
showProperties(-1, -1); // that's a bit stupid, but otherwise stuff is still
|
|
|
|
|
// connected to the session
|
2014-07-25 15:59:33 +02:00
|
|
|
m_cache.clear();
|
2013-10-11 16:18:04 +02:00
|
|
|
disconnect(KitManager::instance(), 0, this, 0);
|
2013-09-05 11:46:07 +02:00
|
|
|
disconnect(SessionManager::instance(), 0, this, 0);
|
2009-10-07 15:46:07 +02:00
|
|
|
}
|
|
|
|
|
|
2012-07-16 15:12:58 +02:00
|
|
|
void ProjectWindow::removedTarget(Target *)
|
2012-07-12 13:31:35 +02:00
|
|
|
{
|
|
|
|
|
Project *p = qobject_cast<Project *>(sender());
|
|
|
|
|
QTC_ASSERT(p, return);
|
|
|
|
|
if (p->targets().isEmpty())
|
|
|
|
|
projectUpdated(p);
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-25 15:59:33 +02:00
|
|
|
void ProjectWindow::projectUpdated(Project *project)
|
2011-10-28 10:15:04 +00:00
|
|
|
{
|
|
|
|
|
// Called after a project was configured
|
2014-07-25 15:59:33 +02:00
|
|
|
int currentIndex = m_tabWidget->currentIndex();
|
|
|
|
|
int oldSubIndex = m_tabWidget->currentSubIndex();
|
2011-10-28 10:15:04 +00:00
|
|
|
|
2014-07-25 15:59:33 +02:00
|
|
|
removeCurrentWidget();
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2014-07-25 15:59:33 +02:00
|
|
|
int newSubIndex = m_cache.recheckFactories(project, oldSubIndex);
|
|
|
|
|
if (newSubIndex == -1)
|
|
|
|
|
newSubIndex = 0;
|
|
|
|
|
m_tabWidget->setSubTabs(currentIndex, m_cache.tabNames(project));
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_tabWidget->setCurrentIndex(currentIndex, newSubIndex);
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
|
|
|
|
|
QWidget *widget = m_cache.widgetFor(project, newSubIndex);
|
|
|
|
|
if (widget) {
|
|
|
|
|
m_currentWidget = widget;
|
|
|
|
|
m_centralWidget->addWidget(m_currentWidget);
|
|
|
|
|
m_centralWidget->setCurrentWidget(m_currentWidget);
|
|
|
|
|
m_currentWidget->show();
|
2010-03-05 09:36:05 +01:00
|
|
|
}
|
2014-07-14 17:39:46 +02:00
|
|
|
}
|
2010-03-05 09:36:05 +01:00
|
|
|
|
2014-07-14 17:39:46 +02:00
|
|
|
void ProjectWindow::projectDisplayNameChanged(Project *project)
|
|
|
|
|
{
|
2014-07-25 15:59:33 +02:00
|
|
|
int index = m_cache.indexForProject(project);
|
2014-07-14 17:39:46 +02:00
|
|
|
if (index < 0)
|
|
|
|
|
return;
|
2010-12-10 19:02:19 +01:00
|
|
|
|
2014-07-14 17:39:46 +02:00
|
|
|
m_ignoreChange = true;
|
|
|
|
|
bool isCurrentIndex = m_tabWidget->currentIndex() == index;
|
|
|
|
|
int subIndex = m_tabWidget->currentSubIndex();
|
|
|
|
|
QStringList subTabs = m_tabWidget->subTabs(index);
|
|
|
|
|
m_tabWidget->removeTab(index);
|
|
|
|
|
|
2014-07-25 15:59:33 +02:00
|
|
|
m_cache.sort();
|
|
|
|
|
|
|
|
|
|
int newIndex = m_cache.indexForProject(project);
|
2014-07-14 17:39:46 +02:00
|
|
|
m_tabWidget->insertTab(newIndex, project->displayName(), project->projectFilePath().toString(), subTabs);
|
|
|
|
|
|
|
|
|
|
if (isCurrentIndex)
|
|
|
|
|
m_tabWidget->setCurrentIndex(newIndex, subIndex);
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectWindow::registerProject(ProjectExplorer::Project *project)
|
|
|
|
|
{
|
2014-07-25 15:59:33 +02:00
|
|
|
if (m_cache.isRegistered(project))
|
2014-07-14 17:39:46 +02:00
|
|
|
return;
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2014-07-25 15:59:33 +02:00
|
|
|
m_cache.registerProject(project);
|
|
|
|
|
m_tabWidget->insertTab(m_cache.indexForProject(project),
|
|
|
|
|
project->displayName(),
|
|
|
|
|
project->projectFilePath().toString(),
|
|
|
|
|
m_cache.tabNames(project));
|
2012-07-12 13:31:35 +02:00
|
|
|
|
|
|
|
|
connect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)),
|
|
|
|
|
this, SLOT(removedTarget(ProjectExplorer::Target*)));
|
2010-01-21 13:46:19 +01:00
|
|
|
}
|
|
|
|
|
|
2014-07-03 16:36:17 +02:00
|
|
|
bool ProjectWindow::deregisterProject(ProjectExplorer::Project *project)
|
2010-01-21 13:46:19 +01:00
|
|
|
{
|
2014-07-25 15:59:33 +02:00
|
|
|
int index = m_cache.indexForProject(project);
|
|
|
|
|
if (index == -1)
|
2014-07-03 16:36:17 +02:00
|
|
|
return false;
|
2010-03-11 13:42:41 +01:00
|
|
|
|
2014-07-25 15:59:33 +02:00
|
|
|
QVector<QWidget *> deletedWidgets = m_cache.deregisterProject(project);
|
|
|
|
|
if (deletedWidgets.contains(m_currentWidget))
|
|
|
|
|
m_currentWidget = 0;
|
|
|
|
|
|
2010-01-21 13:46:19 +01:00
|
|
|
m_tabWidget->removeTab(index);
|
2012-07-12 13:31:35 +02:00
|
|
|
disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)),
|
|
|
|
|
this, SLOT(removedTarget(ProjectExplorer::Target*)));
|
2014-07-03 16:36:17 +02:00
|
|
|
return true;
|
2009-10-07 15:46:07 +02:00
|
|
|
}
|
|
|
|
|
|
2010-03-24 18:36:06 +01:00
|
|
|
void ProjectWindow::startupProjectChanged(ProjectExplorer::Project *p)
|
|
|
|
|
{
|
2014-07-25 15:59:33 +02:00
|
|
|
int index = m_cache.indexForProject(p);
|
2010-03-26 11:01:47 +01:00
|
|
|
if (index != -1)
|
|
|
|
|
m_tabWidget->setCurrentIndex(index);
|
2010-03-11 13:42:41 +01:00
|
|
|
}
|
|
|
|
|
|
2010-01-21 13:46:19 +01:00
|
|
|
void ProjectWindow::showProperties(int index, int subIndex)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2014-07-14 17:39:46 +02:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
|
2014-07-25 15:59:33 +02:00
|
|
|
removeCurrentWidget();
|
|
|
|
|
Project *project = m_cache.projectFor(index);
|
|
|
|
|
if (!project) {
|
2010-01-21 13:46:19 +01:00
|
|
|
return;
|
2010-08-26 18:47:32 +02:00
|
|
|
}
|
2010-02-22 15:47:47 +01:00
|
|
|
|
2014-07-25 15:59:33 +02:00
|
|
|
QWidget *widget = m_cache.widgetFor(project, subIndex);
|
|
|
|
|
if (widget) {
|
2014-07-11 18:23:30 +02:00
|
|
|
m_currentWidget = widget;
|
2010-03-25 16:16:38 +01:00
|
|
|
m_centralWidget->addWidget(m_currentWidget);
|
|
|
|
|
m_centralWidget->setCurrentWidget(m_currentWidget);
|
2014-07-25 15:59:33 +02:00
|
|
|
m_currentWidget->show();
|
2014-08-19 19:03:32 +02:00
|
|
|
if (hasFocus()) // we get assigned focus from setFocusToCurrentMode, pass that on
|
|
|
|
|
m_currentWidget->setFocus();
|
2010-03-25 16:16:38 +01:00
|
|
|
}
|
|
|
|
|
|
2013-09-05 11:46:07 +02:00
|
|
|
SessionManager::setStartupProject(project);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectWindow::removeCurrentWidget()
|
|
|
|
|
{
|
|
|
|
|
if (m_currentWidget) {
|
|
|
|
|
m_centralWidget->removeWidget(m_currentWidget);
|
2014-07-25 15:59:33 +02:00
|
|
|
m_currentWidget->hide();
|
|
|
|
|
m_currentWidget = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WidgetCache
|
|
|
|
|
void WidgetCache::registerProject(Project *project)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(!isRegistered(project), return);
|
|
|
|
|
|
|
|
|
|
QList<ProjectPanelFactory *> fac = ProjectPanelFactory::factories();
|
|
|
|
|
int factorySize = fac.size();
|
|
|
|
|
|
|
|
|
|
ProjectInfo info;
|
|
|
|
|
info.project = project;
|
|
|
|
|
info.widgets.resize(factorySize);
|
|
|
|
|
info.supports.resize(factorySize);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < factorySize; ++i)
|
|
|
|
|
info.supports[i] = fac.at(i)->supports(project);
|
|
|
|
|
|
|
|
|
|
m_projects.append(info);
|
|
|
|
|
sort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVector<QWidget *> WidgetCache::deregisterProject(Project *project)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(isRegistered(project), return QVector<QWidget *>());
|
|
|
|
|
|
|
|
|
|
int index = indexForProject(project);
|
|
|
|
|
ProjectInfo info = m_projects.at(index);
|
|
|
|
|
QVector<QWidget *> deletedWidgets = info.widgets;
|
|
|
|
|
qDeleteAll(info.widgets);
|
|
|
|
|
m_projects.removeAt(index);
|
|
|
|
|
return deletedWidgets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList WidgetCache::tabNames(Project *project) const
|
|
|
|
|
{
|
|
|
|
|
int index = indexForProject(project);
|
|
|
|
|
if (index == -1)
|
|
|
|
|
return QStringList();
|
|
|
|
|
|
|
|
|
|
QList<ProjectPanelFactory *> fac = ProjectPanelFactory::factories();
|
|
|
|
|
|
|
|
|
|
ProjectInfo info = m_projects.at(index);
|
|
|
|
|
int end = info.supports.size();
|
|
|
|
|
QStringList names;
|
|
|
|
|
for (int i = 0; i < end; ++i)
|
|
|
|
|
if (info.supports.at(i))
|
|
|
|
|
names << fac.at(i)->displayName();
|
|
|
|
|
return names;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int WidgetCache::factoryIndex(int projectIndex, int supportsIndex) const
|
|
|
|
|
{
|
|
|
|
|
QList<ProjectPanelFactory *> fac = ProjectPanelFactory::factories();
|
|
|
|
|
int end = fac.size();
|
|
|
|
|
const ProjectInfo &info = m_projects.at(projectIndex);
|
|
|
|
|
for (int i = 0; i < end; ++i) {
|
|
|
|
|
if (info.supports.at(i)) {
|
|
|
|
|
if (supportsIndex == 0)
|
|
|
|
|
return i;
|
|
|
|
|
else
|
|
|
|
|
--supportsIndex;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
2014-07-25 15:59:33 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget *WidgetCache::widgetFor(Project *project, int supportsIndex)
|
|
|
|
|
{
|
|
|
|
|
int projectIndex = indexForProject(project);
|
|
|
|
|
if (projectIndex == -1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
QList<ProjectPanelFactory *> fac = ProjectPanelFactory::factories();
|
|
|
|
|
|
|
|
|
|
int factoryIndex = factoryIndex(projectIndex, supportsIndex);
|
|
|
|
|
if (factoryIndex < 0 ||factoryIndex >= m_projects.at(projectIndex).widgets.size())
|
|
|
|
|
return 0;
|
|
|
|
|
if (!m_projects.at(projectIndex).widgets.at(factoryIndex))
|
|
|
|
|
m_projects[projectIndex].widgets[factoryIndex] = fac.at(factoryIndex)->createWidget(project);
|
|
|
|
|
return m_projects.at(projectIndex).widgets.at(factoryIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool WidgetCache::isRegistered(Project *project) const
|
|
|
|
|
{
|
|
|
|
|
return Utils::anyOf(m_projects, [&project](ProjectInfo pinfo) {
|
|
|
|
|
return pinfo.project == project;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int WidgetCache::indexForProject(Project *project) const
|
|
|
|
|
{
|
|
|
|
|
return Utils::indexOf(m_projects, [&project](ProjectInfo pinfo) {
|
|
|
|
|
return pinfo.project == project;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Project *WidgetCache::projectFor(int projectIndex) const
|
|
|
|
|
{
|
|
|
|
|
if (projectIndex < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
if (projectIndex >= m_projects.size())
|
|
|
|
|
return 0;
|
|
|
|
|
return m_projects.at(projectIndex).project;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WidgetCache::sort()
|
|
|
|
|
{
|
|
|
|
|
Utils::sort(m_projects, [](const ProjectInfo &a, const ProjectInfo &b) -> bool {
|
|
|
|
|
QString aName = a.project->displayName();
|
|
|
|
|
QString bName = b.project->displayName();
|
|
|
|
|
if (aName == bName) {
|
|
|
|
|
Utils::FileName aPath = a.project->projectFilePath();
|
|
|
|
|
Utils::FileName bPath = b.project->projectFilePath();
|
|
|
|
|
if (aPath == bPath)
|
|
|
|
|
return a.project < b.project;
|
|
|
|
|
else
|
|
|
|
|
return aPath < bPath;
|
|
|
|
|
} else {
|
|
|
|
|
return aName < bName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int WidgetCache::recheckFactories(Project *project, int oldSupportsIndex)
|
|
|
|
|
{
|
|
|
|
|
int projectIndex = indexForProject(project);
|
|
|
|
|
int factoryIndex = factoryIndex(projectIndex, oldSupportsIndex);
|
|
|
|
|
|
|
|
|
|
ProjectInfo &info = m_projects[projectIndex];
|
|
|
|
|
QList<ProjectPanelFactory *> fac = ProjectPanelFactory::factories();
|
|
|
|
|
int end = fac.size();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < end; ++i) {
|
|
|
|
|
info.supports[i] = fac.at(i)->supports(project);
|
|
|
|
|
if (!info.supports.at(i)) {
|
|
|
|
|
delete info.widgets.at(i);
|
|
|
|
|
info.widgets[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (factoryIndex < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!info.supports.at(factoryIndex))
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
int newIndex = 0;
|
|
|
|
|
for (int i = 0; i < factoryIndex; ++i) {
|
|
|
|
|
if (info.supports.at(i))
|
|
|
|
|
++newIndex;
|
|
|
|
|
}
|
|
|
|
|
return newIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WidgetCache::clear()
|
|
|
|
|
{
|
|
|
|
|
while (!m_projects.isEmpty())
|
|
|
|
|
deregisterProject(m_projects.first().project);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|