forked from qt-creator/qt-creator
Maemo: Make deploy step widget extensible.
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
#include "maemodeploystepwidget.h"
|
#include "maemodeploystepwidget.h"
|
||||||
#include "ui_maemodeploystepwidget.h"
|
#include "ui_maemodeploystepwidget.h"
|
||||||
|
|
||||||
#include "abstractlinuxdevicedeploystep.h"
|
#include "abstractmaemodeploystep.h"
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
#include "maemosettingspages.h"
|
#include "maemosettingspages.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
@@ -53,8 +53,7 @@ using namespace ProjectExplorer;
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
MaemoDeployStepWidget::MaemoDeployStepWidget(AbstractLinuxDeviceDeployStep *step) :
|
MaemoDeployStepBaseWidget::MaemoDeployStepBaseWidget(AbstractLinuxDeviceDeployStep *step) :
|
||||||
ProjectExplorer::BuildStepConfigWidget(),
|
|
||||||
ui(new Ui::MaemoDeployStepWidget),
|
ui(new Ui::MaemoDeployStepWidget),
|
||||||
m_step(step)
|
m_step(step)
|
||||||
{
|
{
|
||||||
@@ -67,12 +66,12 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(AbstractLinuxDeviceDeployStep *step
|
|||||||
SLOT(handleStepToBeRemoved(int)));
|
SLOT(handleStepToBeRemoved(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
MaemoDeployStepWidget::~MaemoDeployStepWidget()
|
MaemoDeployStepBaseWidget::~MaemoDeployStepBaseWidget()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeployStepWidget::init()
|
void MaemoDeployStepBaseWidget::init()
|
||||||
{
|
{
|
||||||
ui->deviceConfigComboBox->setModel(m_step->maemoDeployConfig()->deviceConfigModel());
|
ui->deviceConfigComboBox->setModel(m_step->maemoDeployConfig()->deviceConfigModel());
|
||||||
connect(&m_step->helper(), SIGNAL(deviceConfigChanged()),
|
connect(&m_step->helper(), SIGNAL(deviceConfigChanged()),
|
||||||
@@ -84,7 +83,7 @@ void MaemoDeployStepWidget::init()
|
|||||||
SLOT(showDeviceConfigurations()));
|
SLOT(showDeviceConfigurations()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeployStepWidget::handleDeviceUpdate()
|
void MaemoDeployStepBaseWidget::handleDeviceUpdate()
|
||||||
{
|
{
|
||||||
const MaemoDeviceConfig::ConstPtr &devConf = m_step->helper().deviceConfig();
|
const MaemoDeviceConfig::ConstPtr &devConf = m_step->helper().deviceConfig();
|
||||||
const MaemoDeviceConfig::Id internalId
|
const MaemoDeviceConfig::Id internalId
|
||||||
@@ -95,7 +94,7 @@ void MaemoDeployStepWidget::handleDeviceUpdate()
|
|||||||
emit updateSummary();
|
emit updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeployStepWidget::handleStepToBeRemoved(int step)
|
void MaemoDeployStepBaseWidget::handleStepToBeRemoved(int step)
|
||||||
{
|
{
|
||||||
BuildStepList * const list = m_step->maemoDeployConfig()->stepList();
|
BuildStepList * const list = m_step->maemoDeployConfig()->stepList();
|
||||||
const AbstractLinuxDeviceDeployStep * const alds
|
const AbstractLinuxDeviceDeployStep * const alds
|
||||||
@@ -104,7 +103,7 @@ void MaemoDeployStepWidget::handleStepToBeRemoved(int step)
|
|||||||
disconnect(list, 0, this, 0);
|
disconnect(list, 0, this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoDeployStepWidget::summaryText() const
|
QString MaemoDeployStepBaseWidget::summaryText() const
|
||||||
{
|
{
|
||||||
QString error;
|
QString error;
|
||||||
if (!m_step->isDeploymentPossible(error)) {
|
if (!m_step->isDeploymentPossible(error)) {
|
||||||
@@ -112,16 +111,11 @@ QString MaemoDeployStepWidget::summaryText() const
|
|||||||
+ tr("Cannot deploy: %1").arg(error)
|
+ tr("Cannot deploy: %1").arg(error)
|
||||||
+ QLatin1String("</font>");
|
+ QLatin1String("</font>");
|
||||||
}
|
}
|
||||||
return tr("<b>%1 to device</b>: %2").arg(dynamic_cast<BuildStep *>(m_step)->displayName(),
|
return tr("<b>%1 using device</b>: %2").arg(dynamic_cast<BuildStep *>(m_step)->displayName(),
|
||||||
MaemoGlobal::deviceConfigurationName(m_step->helper().deviceConfig()));
|
MaemoGlobal::deviceConfigurationName(m_step->helper().deviceConfig()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoDeployStepWidget::displayName() const
|
void MaemoDeployStepBaseWidget::setCurrentDeviceConfig(int index)
|
||||||
{
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
|
|
||||||
{
|
{
|
||||||
disconnect(&m_step->helper(), SIGNAL(deviceConfigChanged()), this,
|
disconnect(&m_step->helper(), SIGNAL(deviceConfigChanged()), this,
|
||||||
SLOT(handleDeviceUpdate()));
|
SLOT(handleDeviceUpdate()));
|
||||||
@@ -131,12 +125,20 @@ void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
|
|||||||
updateSummary();
|
updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeployStepWidget::showDeviceConfigurations()
|
void MaemoDeployStepBaseWidget::showDeviceConfigurations()
|
||||||
{
|
{
|
||||||
MaemoDeviceConfigurationsSettingsPage *page
|
MaemoDeviceConfigurationsSettingsPage *page
|
||||||
= MaemoManager::instance().deviceConfigurationsSettingsPage();
|
= MaemoManager::instance().deviceConfigurationsSettingsPage();
|
||||||
Core::ICore::instance()->showOptionsDialog(page->category(), page->id());
|
Core::ICore::instance()->showOptionsDialog(page->category(), page->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MaemoDeployStepWidget::MaemoDeployStepWidget(AbstractMaemoDeployStep *step)
|
||||||
|
: m_baseWidget(step)
|
||||||
|
{
|
||||||
|
connect(&m_baseWidget, SIGNAL(updateSummary()), SIGNAL(updateSummary()));
|
||||||
|
(new QVBoxLayout(this))->addWidget(&m_baseWidget);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
@@ -44,14 +44,21 @@ QT_END_NAMESPACE
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class AbstractLinuxDeviceDeployStep;
|
class AbstractLinuxDeviceDeployStep;
|
||||||
|
class AbstractMaemoDeployStep;
|
||||||
|
|
||||||
class MaemoDeployStepWidget : public ProjectExplorer::BuildStepConfigWidget
|
class MaemoDeployStepBaseWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MaemoDeployStepWidget(AbstractLinuxDeviceDeployStep *step);
|
MaemoDeployStepBaseWidget(AbstractLinuxDeviceDeployStep *step);
|
||||||
~MaemoDeployStepWidget();
|
~MaemoDeployStepBaseWidget();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
QString summaryText() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void updateSummary();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_SLOT void handleDeviceUpdate();
|
Q_SLOT void handleDeviceUpdate();
|
||||||
@@ -59,14 +66,24 @@ private:
|
|||||||
Q_SLOT void showDeviceConfigurations();
|
Q_SLOT void showDeviceConfigurations();
|
||||||
Q_SLOT void handleStepToBeRemoved(int step);
|
Q_SLOT void handleStepToBeRemoved(int step);
|
||||||
|
|
||||||
virtual void init();
|
|
||||||
virtual QString summaryText() const;
|
|
||||||
virtual QString displayName() const;
|
|
||||||
|
|
||||||
Ui::MaemoDeployStepWidget *ui;
|
Ui::MaemoDeployStepWidget *ui;
|
||||||
AbstractLinuxDeviceDeployStep *const m_step;
|
AbstractLinuxDeviceDeployStep *const m_step;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MaemoDeployStepWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MaemoDeployStepWidget(AbstractMaemoDeployStep *step);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void init() { return m_baseWidget.init(); }
|
||||||
|
virtual QString summaryText() const { return m_baseWidget.summaryText(); }
|
||||||
|
virtual QString displayName() const { return QString(); }
|
||||||
|
|
||||||
|
MaemoDeployStepBaseWidget m_baseWidget;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user