forked from qt-creator/qt-creator
ProjectWindow: Remove unnecessary code
Since projects without targets are special, this code apparently tracked if hasTarget() changed due to a kitUpdate. But we are already connected to targetRemoved() and checks whether a project has no target anymore. Thus this code is redundant and can be removed. Change-Id: I245887075509ed4c0ecda383de0227ccbc58b9af Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -1253,8 +1253,6 @@ void ProjectExplorerPlugin::closeAllProjects()
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::extensionsInitialized()
|
void ProjectExplorerPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
d->m_proWindow->extensionsInitialized();
|
|
||||||
|
|
||||||
// Register factories for all project managers
|
// Register factories for all project managers
|
||||||
QList<IProjectManager*> projectManagers =
|
QList<IProjectManager*> projectManagers =
|
||||||
ExtensionSystem::PluginManager::getObjects<IProjectManager>();
|
ExtensionSystem::PluginManager::getObjects<IProjectManager>();
|
||||||
|
@@ -92,11 +92,6 @@ ProjectWindow::~ProjectWindow()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectWindow::extensionsInitialized()
|
|
||||||
{
|
|
||||||
connect(KitManager::instance(), SIGNAL(kitsChanged()), this, SLOT(handleKitChanges()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectWindow::aboutToShutdown()
|
void ProjectWindow::aboutToShutdown()
|
||||||
{
|
{
|
||||||
showProperties(-1, -1); // that's a bit stupid, but otherwise stuff is still
|
showProperties(-1, -1); // that's a bit stupid, but otherwise stuff is still
|
||||||
@@ -122,27 +117,6 @@ void ProjectWindow::projectUpdated(Project *p)
|
|||||||
m_tabWidget->setCurrentIndex(index);
|
m_tabWidget->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectWindow::handleKitChanges()
|
|
||||||
{
|
|
||||||
bool changed = false;
|
|
||||||
int index = m_tabWidget->currentIndex();
|
|
||||||
QList<Project *> projects = m_tabIndexToProject;
|
|
||||||
foreach (ProjectExplorer::Project *project, projects) {
|
|
||||||
if (m_hasTarget.value(project) != hasTarget(project)) {
|
|
||||||
changed = true;
|
|
||||||
if (deregisterProject(project))
|
|
||||||
registerProject(project);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (changed)
|
|
||||||
m_tabWidget->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ProjectWindow::hasTarget(ProjectExplorer::Project *project)
|
|
||||||
{
|
|
||||||
return !project->targets().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectWindow::registerProject(ProjectExplorer::Project *project)
|
void ProjectWindow::registerProject(ProjectExplorer::Project *project)
|
||||||
{
|
{
|
||||||
if (!project || m_tabIndexToProject.contains(project))
|
if (!project || m_tabIndexToProject.contains(project))
|
||||||
@@ -160,9 +134,6 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project)
|
|||||||
|
|
||||||
QStringList subtabs;
|
QStringList subtabs;
|
||||||
|
|
||||||
bool projectHasTarget = hasTarget(project);
|
|
||||||
m_hasTarget.insert(project, projectHasTarget);
|
|
||||||
|
|
||||||
// Add the project specific pages
|
// Add the project specific pages
|
||||||
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
|
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
|
||||||
Utils::sort(factories, &IProjectPanelFactory::prioritySort);
|
Utils::sort(factories, &IProjectPanelFactory::prioritySort);
|
||||||
|
@@ -56,13 +56,11 @@ public:
|
|||||||
~ProjectWindow();
|
~ProjectWindow();
|
||||||
|
|
||||||
void aboutToShutdown();
|
void aboutToShutdown();
|
||||||
void extensionsInitialized();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void projectUpdated(ProjectExplorer::Project *p);
|
void projectUpdated(ProjectExplorer::Project *p);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleKitChanges();
|
|
||||||
void showProperties(int index, int subIndex);
|
void showProperties(int index, int subIndex);
|
||||||
void registerProject(ProjectExplorer::Project*);
|
void registerProject(ProjectExplorer::Project*);
|
||||||
bool deregisterProject(ProjectExplorer::Project*);
|
bool deregisterProject(ProjectExplorer::Project*);
|
||||||
@@ -70,14 +68,12 @@ private slots:
|
|||||||
void removedTarget(ProjectExplorer::Target*);
|
void removedTarget(ProjectExplorer::Target*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool hasTarget(ProjectExplorer::Project *project);
|
|
||||||
void removeCurrentWidget();
|
void removeCurrentWidget();
|
||||||
|
|
||||||
DoubleTabWidget *m_tabWidget;
|
DoubleTabWidget *m_tabWidget;
|
||||||
QStackedWidget *m_centralWidget;
|
QStackedWidget *m_centralWidget;
|
||||||
QWidget *m_currentWidget;
|
QWidget *m_currentWidget;
|
||||||
QList<ProjectExplorer::Project *> m_tabIndexToProject;
|
QList<ProjectExplorer::Project *> m_tabIndexToProject;
|
||||||
QMap<ProjectExplorer::Project *, bool> m_hasTarget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user