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 "typespecificdeviceconfigurationlistmodel.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QTableView>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace RemoteLinux {
|
||||
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
|
||||
{
|
||||
public:
|
||||
Ui::RemoteLinuxDeployConfigurationWidget ui;
|
||||
MyTableView tableView;
|
||||
RemoteLinuxDeployConfiguration *deployConfiguration;
|
||||
};
|
||||
|
||||
@@ -61,6 +84,15 @@ RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(QWidg
|
||||
DeployConfigurationWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate)
|
||||
{
|
||||
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()
|
||||
@@ -75,6 +107,7 @@ void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc)
|
||||
|
||||
connect(d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)),
|
||||
SLOT(showDeviceConfigurations()));
|
||||
connect(&d->tableView, SIGNAL(doubleClicked()), SLOT(openProjectFile()));
|
||||
|
||||
d->ui.deviceConfigsComboBox->setModel(d->deployConfiguration->deviceConfigModel().data());
|
||||
connect(d->ui.deviceConfigsComboBox, SIGNAL(activated(int)),
|
||||
@@ -111,7 +144,7 @@ DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel()
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset()
|
||||
{
|
||||
d->ui.tableView->setModel(0);
|
||||
d->tableView.setModel(0);
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::handleModelListReset()
|
||||
@@ -120,10 +153,13 @@ void RemoteLinuxDeployConfigurationWidget::handleModelListReset()
|
||||
== d->ui.projectsComboBox->count(), return);
|
||||
|
||||
if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) {
|
||||
d->tableView.setToolTip(tr("Double-click to edit the project file"));
|
||||
if (d->ui.projectsComboBox->currentIndex() == -1)
|
||||
d->ui.projectsComboBox->setCurrentIndex(0);
|
||||
else
|
||||
setModel(d->ui.projectsComboBox->currentIndex());
|
||||
} else {
|
||||
d->tableView.setToolTip(QString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,9 +167,9 @@ void RemoteLinuxDeployConfigurationWidget::setModel(int row)
|
||||
{
|
||||
DeployableFilesPerProFile * const proFileInfo = row == -1
|
||||
? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row);
|
||||
d->ui.tableView->setModel(proFileInfo);
|
||||
d->tableView.setModel(proFileInfo);
|
||||
if (proFileInfo)
|
||||
d->ui.tableView->resizeRowsToContents();
|
||||
d->tableView.resizeRowsToContents();
|
||||
emit currentModelChanged(proFileInfo);
|
||||
}
|
||||
|
||||
@@ -159,7 +195,20 @@ void RemoteLinuxDeployConfigurationWidget::handleDeviceConfigurationListChanged(
|
||||
void RemoteLinuxDeployConfigurationWidget::showDeviceConfigurations()
|
||||
{
|
||||
Core::ICore::instance()->showOptionsDialog(LinuxDeviceConfigurationsSettingsPage::pageCategory(),
|
||||
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
|
||||
|
||||
#include "remotelinuxdeployconfigurationwidget.moc"
|
||||
|
||||
@@ -67,6 +67,7 @@ private slots:
|
||||
void handleSelectedDeviceConfigurationChanged(int index);
|
||||
void handleDeviceConfigurationListChanged();
|
||||
void showDeviceConfigurations();
|
||||
void openProjectFile();
|
||||
|
||||
private:
|
||||
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d;
|
||||
|
||||
@@ -86,46 +86,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</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>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
Reference in New Issue
Block a user