Fix always to end of line jumping cursor in MakeStepConfigWidget

Also rename some methods/signal to make clearer that those only are
relevevant for user changes not for all arguments.
This commit is contained in:
dt
2009-11-30 19:30:51 +01:00
parent 2de390cfdb
commit 3565fe4e82
5 changed files with 32 additions and 25 deletions

View File

@@ -54,7 +54,7 @@ MakeStep::MakeStep(ProjectExplorer::BuildConfiguration *bc)
MakeStep::MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc) MakeStep::MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
: AbstractMakeStep(bs, bc), : AbstractMakeStep(bs, bc),
m_clean(bs->m_clean), m_clean(bs->m_clean),
m_makeargs(bs->m_makeargs), m_userArgs(bs->m_userArgs),
m_makeCmd(bs->m_makeCmd) m_makeCmd(bs->m_makeCmd)
{ {
@@ -84,7 +84,7 @@ void MakeStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map)
void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map) void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
{ {
m_makeargs = map.value("makeargs").toStringList(); m_userArgs = map.value("makeargs").toStringList();
m_makeCmd = map.value("makeCmd").toString(); m_makeCmd = map.value("makeCmd").toString();
if (map.value("clean").isValid() && map.value("clean").toBool()) if (map.value("clean").isValid() && map.value("clean").toBool())
m_clean = true; m_clean = true;
@@ -93,7 +93,7 @@ void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map) void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
{ {
map["makeargs"] = m_makeargs; map["makeargs"] = m_userArgs;
map["makeCmd"] = m_makeCmd; map["makeCmd"] = m_makeCmd;
if (m_clean) if (m_clean)
map["clean"] = true; map["clean"] = true;
@@ -128,7 +128,7 @@ bool MakeStep::init()
// we should stop the clean queue // we should stop the clean queue
// That is mostly so that rebuild works on a alrady clean project // That is mostly so that rebuild works on a alrady clean project
setIgnoreReturnValue(m_clean); setIgnoreReturnValue(m_clean);
QStringList args = m_makeargs; QStringList args = m_userArgs;
if (!m_clean) { if (!m_clean) {
if (!bc->defaultMakeTarget().isEmpty()) if (!bc->defaultMakeTarget().isEmpty())
args << bc->defaultMakeTarget(); args << bc->defaultMakeTarget();
@@ -196,19 +196,19 @@ ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
return new MakeStepConfigWidget(this); return new MakeStepConfigWidget(this);
} }
QStringList MakeStep::makeArguments() QStringList MakeStep::userArguments()
{ {
return m_makeargs; return m_userArgs;
} }
void MakeStep::setMakeArguments(const QStringList &arguments) void MakeStep::setUserArguments(const QStringList &arguments)
{ {
m_makeargs = arguments; m_userArgs = arguments;
emit changed(); emit userArgumentsChanged();
} }
MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep) MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
: BuildStepConfigWidget(), m_makeStep(makeStep) : BuildStepConfigWidget(), m_makeStep(makeStep), m_ignoreChange(false)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)), connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)),
@@ -216,8 +216,8 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)), connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
this, SLOT(makeArgumentsLineEditTextEdited())); this, SLOT(makeArgumentsLineEditTextEdited()));
connect(makeStep, SIGNAL(changed()), connect(makeStep, SIGNAL(userArgumentsChanged()),
this, SLOT(update())); this, SLOT(userArgumentsChanged()));
connect(makeStep->buildConfiguration(), SIGNAL(buildDirectoryChanged()), connect(makeStep->buildConfiguration(), SIGNAL(buildDirectoryChanged()),
this, SLOT(updateDetails())); this, SLOT(updateDetails()));
@@ -257,7 +257,7 @@ void MakeStepConfigWidget::updateDetails()
// FIXME doing this without the user having a way to override this is rather bad // FIXME doing this without the user having a way to override this is rather bad
// so we only do it for unix and if the user didn't override the make command // so we only do it for unix and if the user didn't override the make command
// but for now this is the least invasive change // but for now this is the least invasive change
QStringList args = m_makeStep->makeArguments(); QStringList args = m_makeStep->userArguments();
ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN; ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN;
ProjectExplorer::ToolChain *toolChain = bc->toolChain(); ProjectExplorer::ToolChain *toolChain = bc->toolChain();
if (toolChain) if (toolChain)
@@ -281,9 +281,11 @@ QString MakeStepConfigWidget::displayName() const
return m_makeStep->displayName(); return m_makeStep->displayName();
} }
void MakeStepConfigWidget::update() void MakeStepConfigWidget::userArgumentsChanged()
{ {
init(); const QStringList &makeArguments = m_makeStep->userArguments();
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
updateDetails();
} }
void MakeStepConfigWidget::init() void MakeStepConfigWidget::init()
@@ -293,7 +295,7 @@ void MakeStepConfigWidget::init()
const QString &makeCmd = m_makeStep->m_makeCmd; const QString &makeCmd = m_makeStep->m_makeCmd;
m_ui.makeLineEdit->setText(makeCmd); m_ui.makeLineEdit->setText(makeCmd);
const QStringList &makeArguments = m_makeStep->makeArguments(); const QStringList &makeArguments = m_makeStep->userArguments();
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments)); m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
updateDetails(); updateDetails();
} }
@@ -306,8 +308,10 @@ void MakeStepConfigWidget::makeLineEditTextEdited()
void MakeStepConfigWidget::makeArgumentsLineEditTextEdited() void MakeStepConfigWidget::makeArgumentsLineEditTextEdited()
{ {
m_makeStep->setMakeArguments( m_ignoreChange = true;
m_makeStep->setUserArguments(
ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text())); ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
m_ignoreChange = false;
updateDetails(); updateDetails();
} }

View File

@@ -80,8 +80,8 @@ public:
virtual QString displayName(); virtual QString displayName();
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
virtual bool immutable() const; virtual bool immutable() const;
QStringList makeArguments(); QStringList userArguments();
void setMakeArguments(const QStringList &arguments); void setUserArguments(const QStringList &arguments);
virtual void restoreFromGlobalMap(const QMap<QString, QVariant> &map); virtual void restoreFromGlobalMap(const QMap<QString, QVariant> &map);
@@ -91,10 +91,10 @@ public:
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map); virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
signals: signals:
void changed(); void userArgumentsChanged();
private: private:
bool m_clean; bool m_clean;
QStringList m_makeargs; QStringList m_userArgs;
QString m_makeCmd; QString m_makeCmd;
}; };
@@ -109,13 +109,14 @@ public:
private slots: private slots:
void makeLineEditTextEdited(); void makeLineEditTextEdited();
void makeArgumentsLineEditTextEdited(); void makeArgumentsLineEditTextEdited();
void update();
void updateMakeOverrideLabel(); void updateMakeOverrideLabel();
void updateDetails(); void updateDetails();
void userArgumentsChanged();
private: private:
Ui::MakeStep m_ui; Ui::MakeStep m_ui;
MakeStep *m_makeStep; MakeStep *m_makeStep;
QString m_summaryText; QString m_summaryText;
bool m_ignoreChange;
}; };
} // Qt4ProjectManager } // Qt4ProjectManager

View File

@@ -327,6 +327,8 @@ void QMakeStepConfigWidget::userArgumentsChanged()
return; return;
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->userArguments()); QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->userArguments());
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs); m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
updateTitleLabel();
updateEffectiveQMakeCall();
} }
void QMakeStepConfigWidget::init() void QMakeStepConfigWidget::init()

View File

@@ -480,7 +480,7 @@ Qt4BuildConfiguration *Qt4Project::addQt4BuildConfiguration(QString displayName,
// set some options for qmake and make // set some options for qmake and make
if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets
makeStep->setMakeArguments(QStringList() << (debug ? "debug" : "release")); makeStep->setUserArguments(QStringList() << (debug ? "debug" : "release"));
bc->setValue("buildConfiguration", int(qmakeBuildConfiguration)); bc->setValue("buildConfiguration", int(qmakeBuildConfiguration));

View File

@@ -306,7 +306,7 @@ void Qt4ProjectConfigWidget::importLabelClicked()
// If we are switching to BuildAll we want "release" in there and no "debug" // If we are switching to BuildAll we want "release" in there and no "debug"
// or "debug" in there and no "release" // or "debug" in there and no "release"
// If we are switching to not BuildAl we want neither "release" nor "debug" in there // If we are switching to not BuildAl we want neither "release" nor "debug" in there
QStringList makeCmdArguments = makeStep->makeArguments(); QStringList makeCmdArguments = makeStep->userArguments();
bool debug = qmakeBuildConfig & QtVersion::DebugBuild; bool debug = qmakeBuildConfig & QtVersion::DebugBuild;
if (qmakeBuildConfig & QtVersion::BuildAll) { if (qmakeBuildConfig & QtVersion::BuildAll) {
makeCmdArguments.removeAll(debug ? "release" : "debug"); makeCmdArguments.removeAll(debug ? "release" : "debug");
@@ -316,7 +316,7 @@ void Qt4ProjectConfigWidget::importLabelClicked()
makeCmdArguments.removeAll("debug"); makeCmdArguments.removeAll("debug");
makeCmdArguments.removeAll("release"); makeCmdArguments.removeAll("release");
} }
makeStep->setMakeArguments(makeCmdArguments); makeStep->setUserArguments(makeCmdArguments);
} }
} }
setupQtVersionsComboBox(); setupQtVersionsComboBox();