Commit d0b75195 authored by kh1's avatar kh1
Browse files

Some more preparations for task QTCREATORBUG-1663.

parent 9cfa8d5a
......@@ -34,6 +34,7 @@
#include "maemorunconfigurationwidget.h"
#include "deviceenvreader.h"
#include "maemodeviceconfiglistmodel.h"
#include "maemomanager.h"
#include "maemoremotemountsmodel.h"
......@@ -41,6 +42,7 @@
#include "maemosettingspage.h"
#include <coreplugin/icore.h>
#include <projectexplorer/environmenteditmodel.h>
#include <QtGui/QComboBox>
#include <QtGui/QFileDialog>
......@@ -50,6 +52,7 @@
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QPushButton>
#include <QtGui/QTableView>
#include <QtGui/QToolButton>
......@@ -58,7 +61,9 @@ namespace Internal {
MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
MaemoRunConfiguration *runConfiguration, QWidget *parent)
: QWidget(parent), m_runConfiguration(runConfiguration)
: QWidget(parent),
m_runConfiguration(runConfiguration),
m_deviceEnvReader(new DeviceEnvReader(this, runConfiguration))
{
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
......@@ -131,8 +136,35 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
mountViewButtonsLayout->addWidget(m_removeMountButton);
mountViewButtonsLayout->addStretch(1);
QWidget *baseEnvironmentWidget = new QWidget;
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
baseEnvironmentLayout->setMargin(0);
QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
baseEnvironmentLayout->addWidget(label);
QComboBox *m_baseEnvironmentComboBox = new QComboBox(this);
m_baseEnvironmentComboBox->addItems(QStringList() << tr("Clean Environment")
<< tr("System Environment"));
m_baseEnvironmentComboBox->setEnabled(false);
m_baseEnvironmentComboBox->setCurrentIndex(1); // TODO: see next
//m_baseEnvironmentComboBox->setCurrentIndex(rc->baseEnvironmentBase());
//connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
// this, SLOT(baseEnvironmentSelected(int)));
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
m_fetchEnv = new QPushButton(tr("Fetch Device Environment"));
connect(m_fetchEnv, SIGNAL(pressed()), this, SLOT(fetchEnvironment()));
baseEnvironmentLayout->addStretch(10);
baseEnvironmentLayout->addWidget(m_fetchEnv);
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
m_environmentWidget->setBaseEnvironment(m_deviceEnvReader->deviceEnvironment());
m_environmentWidget->setBaseEnvironmentText(tr("System Environment")); // TODO: see next
//m_environmentWidget->setBaseEnvironmentText(rc->baseEnvironmentText());
// m_environmentWidget->setUserChanges(rc->userEnvironmentChanges());
mainLayout->addWidget(m_environmentWidget);
handleCurrentDeviceConfigChanged();
enableOrDisableRemoveButton();
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
SLOT(configNameEdited(QString)));
connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
......@@ -154,6 +186,8 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
connect(m_mountView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this,
SLOT(enableOrDisableRemoveButton()));
connect(m_deviceEnvReader, SIGNAL(finished()), this,
SLOT(fetchEnvironmentFinished()));
}
void MaemoRunConfigurationWidget::configNameEdited(const QString &text)
......@@ -242,5 +276,17 @@ void MaemoRunConfigurationWidget::handleHostAddressChanged()
m_runConfiguration->setLocalHostAddressFromDevice(m_hostAddressLineEdit->text());
}
void MaemoRunConfigurationWidget::fetchEnvironment()
{
m_deviceEnvReader->start();
m_fetchEnv->setEnabled(false);
}
void MaemoRunConfigurationWidget::fetchEnvironmentFinished()
{
m_fetchEnv->setEnabled(true);
m_environmentWidget->setBaseEnvironment(m_deviceEnvReader->deviceEnvironment());
}
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -42,13 +42,19 @@ class QComboBox;
class QLabel;
class QLineEdit;
class QModelIndex;
class QPushButton;
class QTableView;
class QToolButton;
QT_END_NAMESPACE
namespace ProjectExplorer {
class EnvironmentWidget;
}
namespace Qt4ProjectManager {
namespace Internal {
class DeviceEnvReader;
class MaemoRunConfiguration;
class MaemoRunConfigurationWidget : public QWidget
......@@ -70,6 +76,8 @@ private slots:
void changeLocalMountDir(const QModelIndex &index);
void enableOrDisableRemoveButton();
void handleHostAddressChanged();
void fetchEnvironment();
void fetchEnvironmentFinished();
private:
QLineEdit *m_configNameLineEdit;
......@@ -80,6 +88,10 @@ private:
QTableView *m_mountView;
QToolButton *m_removeMountButton;
MaemoRunConfiguration *m_runConfiguration;
QPushButton *m_fetchEnv;
DeviceEnvReader *m_deviceEnvReader;
ProjectExplorer::EnvironmentWidget *m_environmentWidget;
};
} // namespace Internal
......
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