forked from qt-creator/qt-creator
RemoteLinux: Guide user to project file from deploy widget.
Change-Id: I52b3885ef0c671e856840fb48136fe5433bc5d8f Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -38,18 +38,41 @@
|
|||||||
#include "remotelinuxsettingspages.h"
|
#include "remotelinuxsettingspages.h"
|
||||||
#include "typespecificdeviceconfigurationlistmodel.h"
|
#include "typespecificdeviceconfigurationlistmodel.h"
|
||||||
|
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtGui/QTableView>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
namespace {
|
||||||
|
class MyTableView : public QTableView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MyTableView(QWidget *parent = 0) : QTableView(parent) {}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void doubleClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
emit doubleClicked();
|
||||||
|
QTableView::mouseDoubleClickEvent(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
class RemoteLinuxDeployConfigurationWidgetPrivate
|
class RemoteLinuxDeployConfigurationWidgetPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Ui::RemoteLinuxDeployConfigurationWidget ui;
|
Ui::RemoteLinuxDeployConfigurationWidget ui;
|
||||||
|
MyTableView tableView;
|
||||||
RemoteLinuxDeployConfiguration *deployConfiguration;
|
RemoteLinuxDeployConfiguration *deployConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -61,6 +84,15 @@ RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(QWidg
|
|||||||
DeployConfigurationWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate)
|
DeployConfigurationWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate)
|
||||||
{
|
{
|
||||||
d->ui.setupUi(this);
|
d->ui.setupUi(this);
|
||||||
|
d->tableView.setTextElideMode(Qt::ElideMiddle);
|
||||||
|
d->tableView.setShowGrid(false);
|
||||||
|
d->tableView.setWordWrap(false);
|
||||||
|
d->tableView.horizontalHeader()->setMinimumSectionSize(100);
|
||||||
|
d->tableView.horizontalHeader()->setDefaultSectionSize(400);
|
||||||
|
d->tableView.horizontalHeader()->setHighlightSections(false);
|
||||||
|
d->tableView.horizontalHeader()->setStretchLastSection(true);
|
||||||
|
d->tableView.verticalHeader()->setVisible(false);
|
||||||
|
layout()->addWidget(&d->tableView);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget()
|
RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget()
|
||||||
@@ -75,6 +107,7 @@ void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc)
|
|||||||
|
|
||||||
connect(d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)),
|
connect(d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)),
|
||||||
SLOT(showDeviceConfigurations()));
|
SLOT(showDeviceConfigurations()));
|
||||||
|
connect(&d->tableView, SIGNAL(doubleClicked()), SLOT(openProjectFile()));
|
||||||
|
|
||||||
d->ui.deviceConfigsComboBox->setModel(d->deployConfiguration->deviceConfigModel().data());
|
d->ui.deviceConfigsComboBox->setModel(d->deployConfiguration->deviceConfigModel().data());
|
||||||
connect(d->ui.deviceConfigsComboBox, SIGNAL(activated(int)),
|
connect(d->ui.deviceConfigsComboBox, SIGNAL(activated(int)),
|
||||||
@@ -111,7 +144,7 @@ DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel()
|
|||||||
|
|
||||||
void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset()
|
void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset()
|
||||||
{
|
{
|
||||||
d->ui.tableView->setModel(0);
|
d->tableView.setModel(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxDeployConfigurationWidget::handleModelListReset()
|
void RemoteLinuxDeployConfigurationWidget::handleModelListReset()
|
||||||
@@ -120,10 +153,13 @@ void RemoteLinuxDeployConfigurationWidget::handleModelListReset()
|
|||||||
== d->ui.projectsComboBox->count(), return);
|
== d->ui.projectsComboBox->count(), return);
|
||||||
|
|
||||||
if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) {
|
if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) {
|
||||||
|
d->tableView.setToolTip(tr("Double-click to edit the project file"));
|
||||||
if (d->ui.projectsComboBox->currentIndex() == -1)
|
if (d->ui.projectsComboBox->currentIndex() == -1)
|
||||||
d->ui.projectsComboBox->setCurrentIndex(0);
|
d->ui.projectsComboBox->setCurrentIndex(0);
|
||||||
else
|
else
|
||||||
setModel(d->ui.projectsComboBox->currentIndex());
|
setModel(d->ui.projectsComboBox->currentIndex());
|
||||||
|
} else {
|
||||||
|
d->tableView.setToolTip(QString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,9 +167,9 @@ void RemoteLinuxDeployConfigurationWidget::setModel(int row)
|
|||||||
{
|
{
|
||||||
DeployableFilesPerProFile * const proFileInfo = row == -1
|
DeployableFilesPerProFile * const proFileInfo = row == -1
|
||||||
? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row);
|
? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row);
|
||||||
d->ui.tableView->setModel(proFileInfo);
|
d->tableView.setModel(proFileInfo);
|
||||||
if (proFileInfo)
|
if (proFileInfo)
|
||||||
d->ui.tableView->resizeRowsToContents();
|
d->tableView.resizeRowsToContents();
|
||||||
emit currentModelChanged(proFileInfo);
|
emit currentModelChanged(proFileInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,4 +198,17 @@ void RemoteLinuxDeployConfigurationWidget::showDeviceConfigurations()
|
|||||||
LinuxDeviceConfigurationsSettingsPage::pageId());
|
LinuxDeviceConfigurationsSettingsPage::pageId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoteLinuxDeployConfigurationWidget::openProjectFile()
|
||||||
|
{
|
||||||
|
const int row = d->ui.projectsComboBox->currentIndex();
|
||||||
|
if (row == -1)
|
||||||
|
return;
|
||||||
|
const DeployableFilesPerProFile * const proFileInfo =
|
||||||
|
d->deployConfiguration->deploymentInfo()->modelAt(row);
|
||||||
|
Core::EditorManager::instance()->openEditor(proFileInfo->proFilePath(), QString(),
|
||||||
|
Core::EditorManager::ModeSwitch);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
|
||||||
|
#include "remotelinuxdeployconfigurationwidget.moc"
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ private slots:
|
|||||||
void handleSelectedDeviceConfigurationChanged(int index);
|
void handleSelectedDeviceConfigurationChanged(int index);
|
||||||
void handleDeviceConfigurationListChanged();
|
void handleDeviceConfigurationListChanged();
|
||||||
void showDeviceConfigurations();
|
void showDeviceConfigurations();
|
||||||
|
void openProjectFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d;
|
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d;
|
||||||
|
|||||||
@@ -86,46 +86,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QTableView" name="tableView">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>150</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Edit the project file to add or remove entries.</string>
|
|
||||||
</property>
|
|
||||||
<property name="textElideMode">
|
|
||||||
<enum>Qt::ElideMiddle</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="showGrid">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
|
||||||
<number>400</number>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="horizontalHeaderHighlightSections">
|
|
||||||
<bool>false</bool>
|
|
||||||
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
Reference in New Issue
Block a user