This makes use of a Maemo target perform acceptably for big projects.
Task-number: QTCREATORBUG-2703
Reviewed-by: kh1
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of Qt Creator.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "maemodeployablelistwidget.h"
-#include "ui_maemodeployablelistwidget.h"
-
-#include "maemodeployablelistmodel.h"
-
-#include <utils/qtcassert.h>
-
-#include <QtCore/QDir>
-#include <QtCore/QFile>
-#include <QtCore/QFileInfo>
-#include <QtGui/QFileDialog>
-#include <QtGui/QMessageBox>
-
-namespace Qt4ProjectManager {
-namespace Internal {
-
-MaemoDeployableListWidget::MaemoDeployableListWidget(QWidget *parent,
- MaemoDeployableListModel *model)
- : QWidget(parent), m_ui(new Ui::MaemoDeployableListWidget), m_model(model)
-{
- m_ui->setupUi(this);
- m_ui->addFileButton->hide();
- m_ui->removeFileButton->hide();
- m_ui->deployablesView->setWordWrap(false);
- m_ui->deployablesView->setModel(m_model);
- connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- m_ui->deployablesView, SLOT(resizeColumnsToContents()));
- connect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)),
- m_ui->deployablesView, SLOT(resizeColumnsToContents()));
- connect(m_ui->deployablesView->selectionModel(),
- SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this,
- SLOT(enableOrDisableRemoveButton()));
- m_ui->deployablesView->resizeColumnsToContents();
- m_ui->deployablesView->resizeRowsToContents();
- m_ui->deployablesView->horizontalHeader()->setStretchLastSection(true);
- enableOrDisableRemoveButton();
-}
-
-MaemoDeployableListWidget::~MaemoDeployableListWidget()
-{
- delete m_ui;
-}
-
-void MaemoDeployableListWidget::addFile()
-{
- const QString title = tr("Choose a local file");
- const QString localFile = QFileDialog::getOpenFileName(this, title, m_model->projectDir()); // TODO: Support directories.
- if (localFile.isEmpty())
- return;
- const MaemoDeployable
- deployable(QDir::toNativeSeparators(QFileInfo(localFile).absoluteFilePath()),
- "/");
- QString errorString;
- if (!m_model->addDeployable(deployable, &errorString)) {
- QMessageBox::information(this, tr("Error adding file"), errorString);
- } else {
- const QModelIndex newIndex
- = m_model->index(m_model->rowCount() - 1, 1);
- m_ui->deployablesView->selectionModel()->clear();
- m_ui->deployablesView->scrollTo(newIndex);
- m_ui->deployablesView->edit(newIndex);
- }
-}
-
-void MaemoDeployableListWidget::removeFile()
-{
- const QModelIndexList selectedRows
- = m_ui->deployablesView->selectionModel()->selectedRows();
- if (selectedRows.isEmpty())
- return;
- const int row = selectedRows.first().row();
- if (row != 0) {
- QString errorString;
- if (!m_model->removeDeployableAt(row, &errorString)) {
- QMessageBox::information(this, tr("Error removing file"),
- errorString);
- }
- }
-}
-
-void MaemoDeployableListWidget::enableOrDisableRemoveButton()
-{
- const QModelIndexList selectedRows
- = m_ui->deployablesView->selectionModel()->selectedRows();
- m_ui->removeFileButton->setEnabled(!selectedRows.isEmpty()
- && selectedRows.first().row() != 0);
-}
-
-} // namespace Internal
-} // namespace Qt4ProjectManager
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of Qt Creator.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAEMODEPLOYABLELISTWIDGET_H
-#define MAEMODEPLOYABLELISTWIDGET_H
-
-#include <QtGui/QWidget>
-
-QT_BEGIN_NAMESPACE
-namespace Ui {
- class MaemoDeployableListWidget;
-}
-QT_END_NAMESPACE
-
-namespace Qt4ProjectManager {
-namespace Internal {
-class MaemoDeployableListModel;
-
-class MaemoDeployableListWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- MaemoDeployableListWidget(QWidget *parent, MaemoDeployableListModel *model);
- ~MaemoDeployableListWidget();
- MaemoDeployableListModel *model() const { return m_model; }
-
-private slots:
- void addFile();
- void removeFile();
- void enableOrDisableRemoveButton();
-
-private:
- Ui::MaemoDeployableListWidget *m_ui;
- MaemoDeployableListModel * const m_model;
-};
-
-} // namespace Internal
-} // namespace Qt4ProjectManager
-
-#endif // MAEMODEPLOYABLELISTWIDGET_H
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MaemoDeployableListWidget</class>
- <widget class="QWidget" name="MaemoDeployableListWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>491</width>
- <height>289</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QTableView" name="deployablesView">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>1</horstretch>
- <verstretch>1</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>400</width>
- <height>200</height>
- </size>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::SingleSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
- <property name="showGrid">
- <bool>false</bool>
- </property>
- <attribute name="horizontalHeaderVisible">
- <bool>true</bool>
- </attribute>
- <attribute name="horizontalHeaderCascadingSectionResizes">
- <bool>false</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QToolButton" name="addFileButton">
- <property name="toolTip">
- <string>Add File to Package</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../coreplugin/core.qrc">
- <normaloff>:/core/images/plus.png</normaloff>:/core/images/plus.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="removeFileButton">
- <property name="toolTip">
- <string>Remove File from Package</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../coreplugin/core.qrc">
- <normaloff>:/core/images/minus.png</normaloff>:/core/images/minus.png</iconset>
- </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>
- <include location="../../coreplugin/core.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>addFileButton</sender>
- <signal>clicked()</signal>
- <receiver>MaemoDeployableListWidget</receiver>
- <slot>addFile()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>475</x>
- <y>32</y>
- </hint>
- <hint type="destinationlabel">
- <x>488</x>
- <y>242</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>removeFileButton</sender>
- <signal>clicked()</signal>
- <receiver>MaemoDeployableListWidget</receiver>
- <slot>removeFile()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>456</x>
- <y>66</y>
- </hint>
- <hint type="destinationlabel">
- <x>490</x>
- <y>182</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>addFile()</slot>
- <slot>removeFile()</slot>
- </slots>
-</ui>
|| qt4BuildConfiguration()->qt4Target()->project()->activeTarget()->id()
!= QLatin1String(Qt4ProjectManager::Constants::MAEMO_DEVICE_TARGET_ID))
return;
- disconnect(qt4BuildConfiguration()->qt4Target()->qt4Project(),
- SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
- m_updateTimer, SLOT(start()));
+ const Qt4ProFileNode *const rootNode
+ = qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode();
+ if (!rootNode) // Happens on project creation by wizard.
+ return;
m_updateTimer->stop();
m_proFileOption = QSharedPointer<ProFileOption>(new ProFileOption);
m_proFileOption->properties
= qt4BuildConfiguration()->qtVersion()->versionInfo();
m_proFileOption->target_mode = ProFileOption::TARG_UNIX_MODE;
- const Qt4ProFileNode *const rootNode
- = qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode();
- if (!rootNode) // Happens on project creation by wizard.
- return;
+ disconnect(qt4BuildConfiguration()->qt4Target()->qt4Project(),
+ SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
+ m_updateTimer, SLOT(start()));
+ beginResetModel();
qDeleteAll(m_listModels);
m_listModels.clear();
createModels(rootNode);
}
}
- emit modelsCreated();
+ endResetModel();
connect(qt4BuildConfiguration()->qt4Target()->qt4Project(),
SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
m_updateTimer, SLOT(start()));
return bc;
}
+int MaemoDeployables::rowCount(const QModelIndex &parent) const
+{
+ return parent.isValid() ? 0 : modelCount();
+}
+
+QVariant MaemoDeployables::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() || index.row() < 0 || index.row() >= modelCount()
+ || index.column() != 0)
+ return QVariant();
+ const MaemoDeployableListModel *const model = m_listModels.at(index.row());
+ if (role == Qt::ForegroundRole && !model->hasTargetPath()) {
+ QBrush brush;
+ brush.setColor(Qt::red);
+ return brush;
+ }
+ if (role == Qt::DisplayRole)
+ return QFileInfo(model->proFilePath()).fileName();
+ return QVariant();
+}
+
} // namespace Qt4ProjectManager
} // namespace Internal
#include "maemodeployable.h"
#include "maemodeployablelistmodel.h"
+#include <QtCore/QAbstractListModel>
#include <QtCore/QHash>
#include <QtCore/QList>
-#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
QT_FORWARD_DECLARE_CLASS(QTimer);
class Qt4BuildConfiguration;
class Qt4ProFileNode;
-class MaemoDeployables : public QObject
+class MaemoDeployables : public QAbstractListModel
{
Q_OBJECT
public:
MaemoDeployableListModel *modelAt(int i) const { return m_listModels.at(i); }
const ProjectExplorer::BuildStep *buildStep() const { return m_buildStep; }
-signals:
- void modelsCreated();
-
private:
typedef QHash<QString, MaemoDeployableListModel::ProFileUpdateSetting> UpdateSettingsMap;
+ virtual int rowCount(const QModelIndex &parent) const;
+ virtual QVariant data(const QModelIndex &index, int role) const;
+
Q_SLOT void createModels();
Q_SLOT void init();
void createModels(const Qt4ProFileNode *proFileNode);
#include "maemodeploystep.h"
#include "maemodeployablelistmodel.h"
-#include "maemodeployablelistwidget.h"
#include "maemodeployables.h"
#include "maemodeviceconfiglistmodel.h"
#include "maemorunconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/target.h>
+#include <utils/qtcassert.h>
namespace Qt4ProjectManager {
namespace Internal {
m_step(step)
{
ui->setupUi(this);
-
- connect(m_step->deployables(), SIGNAL(modelsCreated()), this,
- SLOT(handleModelsCreated()));
- handleModelsCreated();
+ ui->tableView->setTextElideMode(Qt::ElideMiddle);
+ ui->modelComboBox->setModel(m_step->deployables());
+ connect(m_step->deployables(), SIGNAL(modelAboutToBeReset()),
+ SLOT(handleModelListToBeReset()));
+
+ // Queued connection because of race condition with combo box's reaction
+ // to modelReset().
+ connect(m_step->deployables(), SIGNAL(modelReset()),
+ SLOT(handleModelListReset()), Qt::QueuedConnection);
+
+ connect(ui->modelComboBox, SIGNAL(currentIndexChanged(int)),
+ SLOT(setModel(int)));
+ handleModelListReset();
}
MaemoDeployStepWidget::~MaemoDeployStepWidget()
return QString();
}
-
-void MaemoDeployStepWidget::handleModelsCreated()
-{
- ui->tabWidget->clear();
- for (int i = 0; i < m_step->deployables()->modelCount(); ++i) {
- MaemoDeployableListModel * const model
- = m_step->deployables()->modelAt(i);
- ui->tabWidget->addTab(new MaemoDeployableListWidget(this, model),
- model->projectName());
- }
-}
-
void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
{
m_step->deviceConfigModel()->setCurrentIndex(index);
m_step->setDeployToSysrootEnabled(doDeploy);
}
+void MaemoDeployStepWidget::handleModelListToBeReset()
+{
+ ui->tableView->setModel(0);
+}
+
+void MaemoDeployStepWidget::handleModelListReset()
+{
+ QTC_ASSERT(m_step->deployables()->modelCount() == ui->modelComboBox->count(), return);
+ if (m_step->deployables()->modelCount() > 0) {
+ if (ui->modelComboBox->currentIndex() == -1)
+ ui->modelComboBox->setCurrentIndex(0);
+ else
+ setModel(ui->modelComboBox->currentIndex());
+ }
+}
+
+void MaemoDeployStepWidget::setModel(int row)
+{
+ if (row != -1) {
+ ui->tableView->setModel(m_step->deployables()->modelAt(row));
+ ui->tableView->resizeRowsToContents();
+ }
+}
+
} // namespace Internal
} // namespace Qt4ProjectManager
private:
Q_SLOT void handleDeviceUpdate();
- Q_SLOT void handleModelsCreated();
Q_SLOT void handleDeviceConfigModelChanged();
Q_SLOT void setCurrentDeviceConfig(int index);
Q_SLOT void setDeployToSysroot(bool doDeloy);
+ Q_SLOT void setModel(int row);
+ Q_SLOT void handleModelListToBeReset();
+ Q_SLOT void handleModelListReset();
virtual void init();
virtual QString summaryText() const;
<rect>
<x>0</x>
<y>0</y>
- <width>460</width>
- <height>277</height>
+ <width>662</width>
+ <height>418</height>
</rect>
</property>
<property name="windowTitle">
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
<widget class="QLabel" name="deviceConfigLabel">
<property name="text">
<string>Device configuration:</string>
</property>
</widget>
</item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QComboBox" name="deviceConfigComboBox"/>
- </item>
- <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>
- </layout>
+ <item>
+ <widget class="QComboBox" name="deviceConfigComboBox"/>
</item>
- <item row="1" column="1">
- <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 row="1" column="0">
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
<widget class="QCheckBox" name="deployToSysrootCheckBox">
<property name="text">
<string>Also deploy to sysroot</string>
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
<item>
- <widget class="QLabel" name="installLabel">
- <property name="toolTip">
- <string>These show the INSTALLS settings from the project file(s).</string>
- </property>
- <property name="text">
- <string><b>Files to install:</b></string>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
- <widget class="QTabWidget" name="tabWidget"/>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="installLabel">
+ <property name="toolTip">
+ <string>These show the INSTALLS settings from the project file(s).</string>
+ </property>
+ <property name="text">
+ <string><b>Files to install for subproject:</b></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="modelComboBox">
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTableView" name="tableView">
+ <property name="showGrid">
+ <bool>false</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>400</number>
+ </attribute>
+ <attribute name="horizontalHeaderMinimumSectionSize">
+ <number>100</number>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ </widget>
</item>
</layout>
</widget>
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation()));
connect(m_runConfiguration->deployStep()->deployables(),
- SIGNAL(modelsCreated()), this, SLOT(handleDeploySpecsChanged()));
+ SIGNAL(modelReset()), this, SLOT(handleDeploySpecsChanged()));
handleDeploySpecsChanged();
}
SLOT(handleActiveProjectChanged(ProjectExplorer::Project*)));
connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
this, SLOT(handleProjectToBeRemoved(ProjectExplorer::Project*)));
- handleActiveProjectChanged(session->startupProject());
+ handleActiveProjectChanged(session->startupProject());
}
void MaemoTemplatesManager::handleActiveProjectChanged(ProjectExplorer::Project *project)
const Qt4Target * const qt4Target = qobject_cast<Qt4Target *>(target);
const MaemoDeployStep * const deployStep
= MaemoGlobal::buildStep<MaemoDeployStep>(qt4Target->activeDeployConfiguration());
- connect(deployStep->deployables(), SIGNAL(modelsCreated()), this,
+ connect(deployStep->deployables(), SIGNAL(modelReset()), this,
SLOT(handleProFileUpdated()), Qt::QueuedConnection);
Project * const project = target->project();
$$PWD/maemoprofilewrapper.h \
$$PWD/maemodeployables.h \
$$PWD/maemodeployable.h \
- $$PWD/maemodeployablelistwidget.h \
$$PWD/maemodeploystep.h \
$$PWD/maemodeploystepwidget.h \
$$PWD/maemodeploystepfactory.h \
$$PWD/maemoqemumanager.cpp \
$$PWD/maemoprofilewrapper.cpp \
$$PWD/maemodeployables.cpp \
- $$PWD/maemodeployablelistwidget.cpp \
$$PWD/maemodeploystep.cpp \
$$PWD/maemodeploystepwidget.cpp \
$$PWD/maemodeploystepfactory.cpp \
$$PWD/maemosettingswidget.ui \
$$PWD/maemosshconfigdialog.ui \
$$PWD/maemopackagecreationwidget.ui \
- $$PWD/maemodeployablelistwidget.ui \
$$PWD/maemodeploystepwidget.ui \
$$PWD/maemoprofilesupdatedialog.ui