2010-01-07 11:21:11 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2010-01-07 11:21:11 +01:00
|
|
|
** 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"
|
|
|
|
|
|
2010-07-16 17:09:05 +02:00
|
|
|
#include "maemodeviceconfiglistmodel.h"
|
2010-01-07 11:21:11 +01:00
|
|
|
#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);
|
|
|
|
|
|
2010-01-07 13:55:46 +01:00
|
|
|
mainLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
2010-01-07 18:17:24 +01:00
|
|
|
m_configNameLineEdit = new QLineEdit(m_runConfiguration->displayName());
|
2010-01-07 11:21:11 +01:00
|
|
|
mainLayout->addRow(tr("Run configuration name:"), m_configNameLineEdit);
|
2010-03-31 18:28:04 +02:00
|
|
|
|
2010-01-07 11:21:11 +01:00
|
|
|
QWidget *devConfWidget = new QWidget;
|
|
|
|
|
QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
|
|
|
|
|
m_devConfBox = new QComboBox;
|
|
|
|
|
m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
2010-07-16 17:09:05 +02:00
|
|
|
m_devConfBox->setModel(runConfiguration->deviceConfigModel());
|
2010-02-03 15:20:12 +01:00
|
|
|
devConfLayout->setMargin(0);
|
2010-01-07 11:21:11 +01:00
|
|
|
devConfLayout->addWidget(m_devConfBox);
|
2010-03-31 18:28:04 +02:00
|
|
|
QLabel *addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>")
|
|
|
|
|
.arg(QLatin1String("deviceconfig")));
|
2010-04-09 16:52:15 +02:00
|
|
|
addDevConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
2010-01-07 11:21:11 +01:00
|
|
|
devConfLayout->addWidget(addDevConfLabel);
|
2010-04-09 16:52:15 +02:00
|
|
|
|
|
|
|
|
QLabel *debuggerConfLabel = new QLabel(tr("<a href=\"%1\">Set Debugger</a>")
|
|
|
|
|
.arg(QLatin1String("debugger")));
|
|
|
|
|
debuggerConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
|
|
|
|
devConfLayout->addWidget(debuggerConfLabel);
|
2010-03-31 18:28:04 +02:00
|
|
|
|
2010-05-14 15:45:43 +02:00
|
|
|
mainLayout->addRow(new QLabel(tr("Device configuration:")), devConfWidget);
|
2010-07-14 17:26:51 +02:00
|
|
|
m_executableLabel = new QLabel(m_runConfiguration->localExecutableFilePath());
|
2010-01-07 11:21:11 +01:00
|
|
|
mainLayout->addRow(tr("Executable:"), m_executableLabel);
|
|
|
|
|
m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
|
|
|
|
|
mainLayout->addRow(tr("Arguments:"), m_argsLineEdit);
|
2010-03-31 18:28:04 +02:00
|
|
|
|
2010-07-16 17:09:05 +02:00
|
|
|
handleCurrentDeviceConfigChanged();
|
2010-01-07 11:21:11 +01:00
|
|
|
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
|
|
|
|
|
SLOT(configNameEdited(QString)));
|
|
|
|
|
connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
|
|
|
|
|
SLOT(argumentsEdited(QString)));
|
2010-07-16 17:09:05 +02:00
|
|
|
connect(m_devConfBox, SIGNAL(activated(int)), this,
|
|
|
|
|
SLOT(setCurrentDeviceConfig(int)));
|
|
|
|
|
connect(runConfiguration->deviceConfigModel(), SIGNAL(currentChanged()),
|
|
|
|
|
this, SLOT(handleCurrentDeviceConfigChanged()));
|
2010-01-07 11:21:11 +01:00
|
|
|
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
|
|
|
|
|
SLOT(updateTargetInformation()));
|
|
|
|
|
connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
|
2010-03-31 18:28:04 +02:00
|
|
|
SLOT(showSettingsDialog(QString)));
|
|
|
|
|
connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this,
|
|
|
|
|
SLOT(showSettingsDialog(QString)));
|
2010-01-07 11:21:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MaemoRunConfigurationWidget::configNameEdited(const QString &text)
|
|
|
|
|
{
|
2010-01-07 18:17:24 +01:00
|
|
|
m_runConfiguration->setDisplayName(text);
|
2010-01-07 11:21:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MaemoRunConfigurationWidget::argumentsEdited(const QString &text)
|
|
|
|
|
{
|
|
|
|
|
m_runConfiguration->setArguments(text.split(' ', QString::SkipEmptyParts));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MaemoRunConfigurationWidget::updateTargetInformation()
|
|
|
|
|
{
|
2010-07-14 17:26:51 +02:00
|
|
|
m_executableLabel->setText(m_runConfiguration->localExecutableFilePath());
|
2010-01-07 11:21:11 +01:00
|
|
|
}
|
|
|
|
|
|
2010-03-31 18:28:04 +02:00
|
|
|
void MaemoRunConfigurationWidget::showSettingsDialog(const QString &link)
|
2010-01-07 11:21:11 +01:00
|
|
|
{
|
2010-04-09 16:52:15 +02:00
|
|
|
if (link == QLatin1String("deviceconfig")) {
|
2010-03-31 18:28:04 +02:00
|
|
|
MaemoSettingsPage *page = MaemoManager::instance().settingsPage();
|
|
|
|
|
Core::ICore::instance()->showOptionsDialog(page->category(), page->id());
|
2010-04-09 16:52:15 +02:00
|
|
|
} else if (link == QLatin1String("debugger")) {
|
|
|
|
|
Core::ICore::instance()->showOptionsDialog(QLatin1String("O.Debugger"),
|
|
|
|
|
QLatin1String("M.Gdb"));
|
2010-03-31 18:28:04 +02:00
|
|
|
}
|
2010-01-07 11:21:11 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 17:09:05 +02:00
|
|
|
void MaemoRunConfigurationWidget::handleCurrentDeviceConfigChanged()
|
|
|
|
|
{
|
|
|
|
|
m_devConfBox->setCurrentIndex(m_runConfiguration->deviceConfigModel()
|
|
|
|
|
->currentIndex());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MaemoRunConfigurationWidget::setCurrentDeviceConfig(int index)
|
|
|
|
|
{
|
|
|
|
|
m_runConfiguration->deviceConfigModel()->setCurrentIndex(index);
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-07 11:21:11 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qt4ProjectManager
|