Commit 695349b6 authored by ck's avatar ck

Maemo: Move MaemoRunConfigurationWidget into separate set of files.

File maemorunconfiguration.cpp now contains what the name indicates.
parent ae535daa
......@@ -31,9 +31,8 @@
#include "maemodeviceconfigurations.h"
#include "maemomanager.h"
#include "maemorunconfigurationwidget.h"
#include "maemoruncontrol.h"
#include "maemosettingspage.h"
#include "maemosshthread.h"
#include "maemotoolchain.h"
#include "profilereader.h"
#include "qt4project.h"
......@@ -49,55 +48,12 @@
#include <projectexplorer/session.h>
#include <QtCore/QDebug>
#include <QtCore/QPair>
#include <QtCore/QProcess>
#include <QtCore/QSharedPointer>
#include <QtGui/QComboBox>
#include <QtGui/QCheckBox>
#include <QtGui/QDesktopServices>
#include <QtGui/QFormLayout>
#include <QtGui/QFrame>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QRadioButton>
#include <QtGui/QToolButton>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
class MaemoRunConfigurationWidget : public QWidget
{
Q_OBJECT
public:
MaemoRunConfigurationWidget(MaemoRunConfiguration *runConfiguration,
QWidget *parent = 0);
private slots:
void configNameEdited(const QString &text);
void argumentsEdited(const QString &args);
void deviceConfigurationChanged(const QString &name);
void resetDeviceConfigurations();
void showSettingsDialog();
void updateSimulatorPath();
void updateTargetInformation();
namespace Qt4ProjectManager {
namespace Internal {
private:
void setSimInfoVisible(const MaemoDeviceConfig &devConf);
QLineEdit *m_configNameLineEdit;
QLineEdit *m_argsLineEdit;
QLabel *m_executableLabel;
QLabel *m_debuggerLabel;
QComboBox *m_devConfBox;
QLabel *m_simPathNameLabel;
QLabel *m_simPathValueLabel;
MaemoRunConfiguration *m_runConfiguration;
};
using namespace ProjectExplorer;
void ErrorDumper::printToStream(QProcess::ProcessError error)
{
......@@ -594,116 +550,8 @@ void MaemoRunConfiguration::updateDeviceConfigurations()
emit deviceConfigurationsUpdated();
}
// #pragma mark -- MaemoRunConfigurationWidget
MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
MaemoRunConfiguration *runConfiguration, QWidget *parent)
: QWidget(parent)
, m_runConfiguration(runConfiguration)
{
QFormLayout *mainLayout = new QFormLayout;
setLayout(mainLayout);
mainLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_configNameLineEdit = new QLineEdit(m_runConfiguration->name());
mainLayout->addRow(tr("Run configuration name:"), m_configNameLineEdit);
QWidget *devConfWidget = new QWidget;
QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
m_devConfBox = new QComboBox;
m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
devConfLayout->addWidget(m_devConfBox);
QLabel *addDevConfLabel
= new QLabel(tr("<a href=\"#\">Manage device configurations</a>"));
devConfLayout->addWidget(addDevConfLabel);
mainLayout->addRow(new QLabel(tr("Device Configuration:")), devConfWidget);
m_executableLabel = new QLabel(m_runConfiguration->executable());
mainLayout->addRow(tr("Executable:"), m_executableLabel);
m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
mainLayout->addRow(tr("Arguments:"), m_argsLineEdit);
m_debuggerLabel = new QLabel(m_runConfiguration->gdbCmd());
mainLayout->addRow(tr("Debugger:"), m_debuggerLabel);
mainLayout->addItem(new QSpacerItem(10, 10));
m_simPathNameLabel = new QLabel(tr("Simulator Path:"));
m_simPathValueLabel = new QLabel(m_runConfiguration->simulatorPath());
mainLayout->addRow(m_simPathNameLabel, m_simPathValueLabel);
resetDeviceConfigurations();
connect(m_runConfiguration, SIGNAL(cachedSimulatorInformationChanged()),
this, SLOT(updateSimulatorPath()));
connect(m_runConfiguration, SIGNAL(deviceConfigurationsUpdated()),
this, SLOT(resetDeviceConfigurations()));
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
SLOT(configNameEdited(QString)));
connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
SLOT(argumentsEdited(QString)));
connect(m_devConfBox, SIGNAL(activated(QString)), this,
SLOT(deviceConfigurationChanged(QString)));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation()));
connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
SLOT(showSettingsDialog()));
}
void MaemoRunConfigurationWidget::configNameEdited(const QString &text)
{
m_runConfiguration->setName(text);
}
void MaemoRunConfigurationWidget::argumentsEdited(const QString &text)
{
m_runConfiguration->setArguments(text.split(' ', QString::SkipEmptyParts));
}
void MaemoRunConfigurationWidget::updateTargetInformation()
{
m_executableLabel->setText(m_runConfiguration->executable());
}
void MaemoRunConfigurationWidget::updateSimulatorPath()
{
m_simPathValueLabel->setText(m_runConfiguration->simulatorPath());
}
void MaemoRunConfigurationWidget::deviceConfigurationChanged(const QString &name)
{
const MaemoDeviceConfig &devConfig
= MaemoDeviceConfigurations::instance().find(name);
setSimInfoVisible(devConfig);
m_runConfiguration->setDeviceConfig(devConfig);
}
void MaemoRunConfigurationWidget::setSimInfoVisible(const MaemoDeviceConfig &devConf)
{
const bool isSimulator = devConf.type == MaemoDeviceConfig::Simulator;
m_simPathNameLabel->setVisible(isSimulator);
m_simPathValueLabel->setVisible(isSimulator);
}
void MaemoRunConfigurationWidget::resetDeviceConfigurations()
{
m_devConfBox->clear();
const QList<MaemoDeviceConfig> &devConfs =
MaemoDeviceConfigurations::instance().devConfigs();
foreach (const MaemoDeviceConfig &devConf, devConfs)
m_devConfBox->addItem(devConf.name);
m_devConfBox->addItem(MaemoDeviceConfig().name);
const MaemoDeviceConfig &devConf = m_runConfiguration->deviceConfig();
m_devConfBox->setCurrentIndex(m_devConfBox->findText(devConf.name));
setSimInfoVisible(devConf);
}
void MaemoRunConfigurationWidget::showSettingsDialog()
{
MaemoSettingsPage *settingsPage = MaemoManager::instance()->settingsPage();
Core::ICore::instance()->showOptionsDialog(settingsPage->category(),
settingsPage->id());
}
// #pragma mark -- MaemoRunConfigurationFactory
MaemoRunConfigurationFactory::MaemoRunConfigurationFactory(QObject* parent)
: IRunConfigurationFactory(parent)
{
......@@ -876,7 +724,5 @@ QWidget* MaemoRunControlFactory::configurationWidget(RunConfiguration *config)
return 0;
}
// #pragma mark -- AbstractMaemoRunControl
#include "maemorunconfiguration.moc"
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -47,7 +47,6 @@ namespace Internal {
class MaemoManager;
class MaemoToolChain;
class Qt4ProFileNode;
using namespace ProjectExplorer;
#define USE_SSL_PASSWORD 0
......@@ -63,11 +62,12 @@ public slots:
};
class MaemoRunConfiguration : public RunConfiguration
class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
public:
MaemoRunConfiguration(Project *project, const QString &proFilePath);
MaemoRunConfiguration(ProjectExplorer::Project *project,
const QString &proFilePath);
~MaemoRunConfiguration();
QString type() const;
......@@ -111,7 +111,7 @@ public:
void setRemotePassword(const QString &password);
const QString remoteUserPassword() const { return m_remoteUserPassword; }
void setRemoteHostRequiresPassword(bool requiresPassword);
void setRemoteHostRequiresPassword(bool requiresPassword);
bool remoteHostRequiresPassword() const { return m_remoteHostRequiresPassword; }
#endif
......@@ -174,7 +174,7 @@ private:
};
class MaemoRunConfigurationFactory : public IRunConfigurationFactory
class MaemoRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
{
Q_OBJECT
public:
......@@ -182,9 +182,10 @@ public:
~MaemoRunConfigurationFactory();
bool canRestore(const QString &type) const;
QStringList availableCreationTypes(Project *project) const;
QStringList availableCreationTypes(ProjectExplorer::Project *project) const;
QString displayNameForType(const QString &type) const;
RunConfiguration *create(Project *project, const QString &type);
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Project *project,
const QString &type);
private slots:
......@@ -197,15 +198,17 @@ private slots:
};
class MaemoRunControlFactory : public IRunControlFactory
class MaemoRunControlFactory : public ProjectExplorer::IRunControlFactory
{
Q_OBJECT
public:
MaemoRunControlFactory(QObject *parent = 0);
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
RunControl* create(RunConfiguration *runConfiguration, const QString &mode);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const;
ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode);
QString displayName() const;
QWidget *configurationWidget(RunConfiguration *runConfiguration);
QWidget *configurationWidget(ProjectExplorer::RunConfiguration *runConfiguration);
};
} // namespace Internal
......
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the 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 "maemorunconfigurationwidget.h"
#include "maemodeviceconfigurations.h"
#include "maemomanager.h"
#include "maemorunconfiguration.h"
#include "maemosettingspage.h"
#include <coreplugin/icore.h>
#include <QtGui/QComboBox>
#include <QtGui/QCheckBox>
#include <QtGui/QDesktopServices>
#include <QtGui/QFormLayout>
#include <QtGui/QFrame>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QRadioButton>
#include <QtGui/QToolButton>
namespace Qt4ProjectManager {
namespace Internal {
MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
MaemoRunConfiguration *runConfiguration, QWidget *parent)
: QWidget(parent), m_runConfiguration(runConfiguration)
{
QFormLayout *mainLayout = new QFormLayout;
setLayout(mainLayout);
// TODO: Does not compile with the canonical form for some reason.
mainLayout->setFormAlignment(/* QFlags<Qt::AlignmentFlag>( */ Qt::AlignLeft /* ) */
| Qt::AlignVCenter);
m_configNameLineEdit = new QLineEdit(m_runConfiguration->name());
mainLayout->addRow(tr("Run configuration name:"), m_configNameLineEdit);
QWidget *devConfWidget = new QWidget;
QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
m_devConfBox = new QComboBox;
m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
devConfLayout->addWidget(m_devConfBox);
QLabel *addDevConfLabel
= new QLabel(tr("<a href=\"#\">Manage device configurations</a>"));
devConfLayout->addWidget(addDevConfLabel);
mainLayout->addRow(new QLabel(tr("Device Configuration:")), devConfWidget);
m_executableLabel = new QLabel(m_runConfiguration->executable());
mainLayout->addRow(tr("Executable:"), m_executableLabel);
m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
mainLayout->addRow(tr("Arguments:"), m_argsLineEdit);
m_debuggerLabel = new QLabel(m_runConfiguration->gdbCmd());
mainLayout->addRow(tr("Debugger:"), m_debuggerLabel);
mainLayout->addItem(new QSpacerItem(10, 10));
m_simPathNameLabel = new QLabel(tr("Simulator Path:"));
m_simPathValueLabel = new QLabel(m_runConfiguration->simulatorPath());
mainLayout->addRow(m_simPathNameLabel, m_simPathValueLabel);
resetDeviceConfigurations();
connect(m_runConfiguration, SIGNAL(cachedSimulatorInformationChanged()),
this, SLOT(updateSimulatorPath()));
connect(m_runConfiguration, SIGNAL(deviceConfigurationsUpdated()),
this, SLOT(resetDeviceConfigurations()));
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
SLOT(configNameEdited(QString)));
connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
SLOT(argumentsEdited(QString)));
connect(m_devConfBox, SIGNAL(activated(QString)), this,
SLOT(deviceConfigurationChanged(QString)));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation()));
connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
SLOT(showSettingsDialog()));
}
void MaemoRunConfigurationWidget::configNameEdited(const QString &text)
{
m_runConfiguration->setName(text);
}
void MaemoRunConfigurationWidget::argumentsEdited(const QString &text)
{
m_runConfiguration->setArguments(text.split(' ', QString::SkipEmptyParts));
}
void MaemoRunConfigurationWidget::updateTargetInformation()
{
m_executableLabel->setText(m_runConfiguration->executable());
}
void MaemoRunConfigurationWidget::updateSimulatorPath()
{
m_simPathValueLabel->setText(m_runConfiguration->simulatorPath());
}
void MaemoRunConfigurationWidget::deviceConfigurationChanged(const QString &name)
{
const MaemoDeviceConfig &devConfig
= MaemoDeviceConfigurations::instance().find(name);
setSimInfoVisible(devConfig);
m_runConfiguration->setDeviceConfig(devConfig);
}
void MaemoRunConfigurationWidget::setSimInfoVisible(const MaemoDeviceConfig &devConf)
{
const bool isSimulator = devConf.type == MaemoDeviceConfig::Simulator;
m_simPathNameLabel->setVisible(isSimulator);
m_simPathValueLabel->setVisible(isSimulator);
}
void MaemoRunConfigurationWidget::resetDeviceConfigurations()
{
m_devConfBox->clear();
const QList<MaemoDeviceConfig> &devConfs =
MaemoDeviceConfigurations::instance().devConfigs();
foreach (const MaemoDeviceConfig &devConf, devConfs)
m_devConfBox->addItem(devConf.name);
m_devConfBox->addItem(MaemoDeviceConfig().name);
const MaemoDeviceConfig &devConf = m_runConfiguration->deviceConfig();
m_devConfBox->setCurrentIndex(m_devConfBox->findText(devConf.name));
setSimInfoVisible(devConf);
}
void MaemoRunConfigurationWidget::showSettingsDialog()
{
MaemoSettingsPage *settingsPage = MaemoManager::instance()->settingsPage();
Core::ICore::instance()->showOptionsDialog(settingsPage->category(),
settingsPage->id());
}
} // namespace Internal
} // namespace Qt4ProjectManager
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the 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 MAEMORUNCONFIGURATIONWIDGET_H
#define MAEMORUNCONFIGURATIONWIDGET_H
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class QComboBox;
class QLabel;
class QLineEdit;
QT_END_NAMESPACE
namespace Qt4ProjectManager {
namespace Internal {
class MaemoDeviceConfig;
class MaemoRunConfiguration;
class MaemoRunConfigurationWidget : public QWidget
{
Q_OBJECT
public:
MaemoRunConfigurationWidget(MaemoRunConfiguration *runConfiguration,
QWidget *parent = 0);
private slots:
void configNameEdited(const QString &text);
void argumentsEdited(const QString &args);
void deviceConfigurationChanged(const QString &name);
void resetDeviceConfigurations();
void showSettingsDialog();
void updateSimulatorPath();
void updateTargetInformation();
private:
void setSimInfoVisible(const MaemoDeviceConfig &devConf);
QLineEdit *m_configNameLineEdit;
QLineEdit *m_argsLineEdit;
QLabel *m_executableLabel;
QLabel *m_debuggerLabel;
QComboBox *m_devConfBox;
QLabel *m_simPathNameLabel;
QLabel *m_simPathValueLabel;
MaemoRunConfiguration *m_runConfiguration;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // MAEMORUNCONFIGURATIONWIDGET_H
......@@ -55,6 +55,10 @@
namespace Qt4ProjectManager {
namespace Internal {
using ProjectExplorer::Environment;
using ProjectExplorer::RunConfiguration;
using ProjectExplorer::ToolChain;
AbstractMaemoRunControl::AbstractMaemoRunControl(RunConfiguration *rc)
: RunControl(rc)
, runConfig(qobject_cast<MaemoRunConfiguration *>(rc))
......
......@@ -2,9 +2,10 @@ SUPPORT_QT_MAEMO = $$(QTCREATOR_WITH_MAEMO)
!isEmpty(SUPPORT_QT_MAEMO) {
message("Adding experimental support for Qt/Maemo applications.")
DEFINES += QTCREATOR_WITH_MAEMO
# DEFINES += USE_SSH_LIB
# LIBS += -L/opt/ne7sshModified/lib/ \
# -lnet7ssh
# DEFINES += USE_SSH_LIB
# LIBS += -L/opt/ne7sshModified/lib/ \
# -lnet7ssh
HEADERS += $$PWD/maemorunconfiguration.h \
$$PWD/maemomanager.h \
$$PWD/maemotoolchain.h \
......@@ -12,7 +13,8 @@ SUPPORT_QT_MAEMO = $$(QTCREATOR_WITH_MAEMO)
$$PWD/maemosettingspage.h \
$$PWD/maemosshconnection.h \
$$PWD/maemosshthread.h \
$$PWD/maemoruncontrol.h
$$PWD/maemoruncontrol.h \
$$PWD/maemorunconfigurationwidget.h
SOURCES += $$PWD/maemorunconfiguration.cpp \
$$PWD/maemomanager.cpp \
$$PWD/maemotoolchain.cpp \
......@@ -20,7 +22,8 @@ SUPPORT_QT_MAEMO = $$(QTCREATOR_WITH_MAEMO)
$$PWD/maemosettingspage.cpp \
$$PWD/maemosshconnection.cpp \
$$PWD/maemosshthread.cpp \
$$PWD/maemoruncontrol.cpp
$$PWD/maemoruncontrol.cpp \
$$PWD/maemorunconfigurationwidget.cpp
FORMS += $$PWD/maemosettingswidget.ui
RESOURCES += $$PWD/qt-maemo.qrc
}
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