Commit af57685c authored by ck's avatar ck
Browse files

Maemo: Improve remote mounts GUI.

Reviewed-by: kh1
parent 576642a7
......@@ -86,6 +86,16 @@ void MaemoRemoteMountsModel::setLocalDir(int pos, const QString &localDir)
emit dataChanged(currentIndex, currentIndex);
}
int MaemoRemoteMountsModel::validMountSpecificationCount() const
{
int count = 0;
foreach (const MountSpecification &m, m_mountSpecs) {
if (m.isValid())
++count;
}
return count;
}
bool MaemoRemoteMountsModel::hasValidMountSpecifications() const
{
foreach (const MountSpecification &m, m_mountSpecs) {
......@@ -168,7 +178,7 @@ QVariant MaemoRemoteMountsModel::data(const QModelIndex &index, int role) const
return mountSpec.remoteMountPoint;
break;
case PortRow:
if (role == Qt::DisplayRole)
if (role == Qt::DisplayRole || role == Qt::EditRole)
return mountSpec.port;
break;
}
......
......@@ -53,6 +53,7 @@ public:
explicit MaemoRemoteMountsModel(QObject *parent = 0);
int mountSpecificationCount() const { return m_mountSpecs.count(); }
int validMountSpecificationCount() const;
MountSpecification mountSpecificationAt(int pos) const { return m_mountSpecs.at(pos); }
bool hasValidMountSpecifications() const;
......
......@@ -43,6 +43,7 @@
#include <coreplugin/icore.h>
#include <projectexplorer/environmenteditmodel.h>
#include <utils/detailswidget.h>
#include <QtGui/QComboBox>
#include <QtGui/QFileDialog>
......@@ -99,12 +100,13 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
formLayout->addRow(tr("Arguments:"), m_argsLineEdit);
mainLayout->addSpacing(20);
QGroupBox *mountViewBox = new QGroupBox;
m_detailsContainer = new Utils::DetailsWidget(this);
QWidget *mountViewWidget = new QWidget;
m_detailsContainer->setWidget(mountViewWidget);
#ifndef Q_OS_WIN
mainLayout->addWidget(mountViewBox);
mainLayout->addWidget(m_detailsContainer);
#endif
mountViewBox->setTitle(tr("Local Directories to mount from device"));
QVBoxLayout *mountViewLayout = new QVBoxLayout(mountViewBox);
QVBoxLayout *mountViewLayout = new QVBoxLayout(mountViewWidget);
QHBoxLayout *hostAddressLayout = new QHBoxLayout;
mountViewLayout->addLayout(hostAddressLayout);
QLabel *hostNameLabel
......@@ -160,6 +162,7 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
handleCurrentDeviceConfigChanged();
enableOrDisableRemoveButton();
handleRemoteMountsChanged();
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
SLOT(configNameEdited(QString)));
......@@ -175,6 +178,7 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
SLOT(showSettingsDialog(QString)));
connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this,
SLOT(showSettingsDialog(QString)));
connect(addMountButton, SIGNAL(clicked()), this, SLOT(addMount()));
connect(m_removeMountButton, SIGNAL(clicked()), this, SLOT(removeMount()));
connect(m_mountView, SIGNAL(doubleClicked(QModelIndex)), this,
......@@ -182,6 +186,17 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
connect(m_mountView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this,
SLOT(enableOrDisableRemoveButton()));
connect(m_runConfiguration->remoteMounts(),
SIGNAL(rowsInserted(QModelIndex, int, int)), this,
SLOT(handleRemoteMountsChanged()));
connect(m_runConfiguration->remoteMounts(),
SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
SLOT(handleRemoteMountsChanged()));
connect(m_runConfiguration->remoteMounts(),
SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
SLOT(handleRemoteMountsChanged()));
connect(m_runConfiguration->remoteMounts(), SIGNAL(modelReset()), this,
SLOT(handleRemoteMountsChanged()));
connect(m_environmentWidget, SIGNAL(userChangesChanged()), this,
SLOT(userChangesEdited()));
......@@ -335,5 +350,26 @@ void MaemoRunConfigurationWidget::userEnvironmentChangesChanged(const QList<Proj
m_environmentWidget->setUserChanges(userChanges);
}
void MaemoRunConfigurationWidget::handleRemoteMountsChanged()
{
const int mountCount
= m_runConfiguration->remoteMounts()->validMountSpecificationCount();
QString text;
switch (mountCount) {
case 0:
text = tr("No local directories to be mounted from the device.");
break;
case 1:
text = tr("One local directory to be mounted from the device.");
break;
default:
text = tr("%1 local directories to be mounted from the device.")
.arg(mountCount);
break;
}
m_detailsContainer->setSummaryText(QLatin1String("<b>") + text
+ QLatin1String("</b>"));
}
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -52,6 +52,8 @@ namespace ProjectExplorer {
class EnvironmentWidget;
}
namespace Utils { class DetailsWidget; }
namespace Qt4ProjectManager {
namespace Internal {
......@@ -84,6 +86,7 @@ private slots:
void baseEnvironmentChanged();
void systemEnvironmentChanged();
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &userChanges);
void handleRemoteMountsChanged();
private:
QLineEdit *m_configNameLineEdit;
......@@ -93,6 +96,7 @@ private:
QLineEdit *m_hostAddressLineEdit;
QTableView *m_mountView;
QToolButton *m_removeMountButton;
Utils::DetailsWidget *m_detailsContainer;
MaemoRunConfiguration *m_runConfiguration;
bool m_ignoreChange;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment