Merge remote-tracking branch 'origin/4.8'

Conflicts:
	src/plugins/debugger/debuggermainwindow.cpp

Change-Id: I07496916dd37b842d57ce5c49f99c079a9095a5f
This commit is contained in:
Orgad Shaneh
2018-09-21 10:48:49 +03:00
65 changed files with 842 additions and 771 deletions

View File

@@ -391,7 +391,7 @@
\uicontrol {Limit result output} check box. To disable automatic scrolling,
deselect the \uicontrol {Automatically scroll results} check box.
Internal messages and run configuration warnings for guessed configurations
Internal messages and run configuration warnings for deduced configurations
are omitted by default. To view them, deselect the \uicontrol {Omit internal
messages} and \uicontrol {Omit run configuration warnings} check boxes.
*/

View File

@@ -38,7 +38,7 @@ public:
class FileIOException : public IOException
{
public:
explicit FileIOException(const QString &errorMsg, const QString &fileName = QString::null,
explicit FileIOException(const QString &errorMsg, const QString &fileName = QString(),
int lineNumber = -1);
QString fileName() const { return m_fileName; }

View File

@@ -54,7 +54,7 @@ public:
}
Tool(const QString &name, const QString &elementType,
const QString &stereotype = QString::null)
const QString &stereotype = QString())
: m_name(name),
m_elementType(elementType),
m_stereotype(stereotype)

View File

@@ -220,7 +220,7 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
orderedMembers[toString(objectBinding->qualifiedId)] = iter;
else if (cast<UiObjectDefinition*>(member))
orderedMembers[QString::null] = iter;
orderedMembers[QString()] = iter;
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
orderedMembers[toString(scriptBinding->qualifiedId)] = iter;
else if (cast<UiPublicMember*>(member))
@@ -517,7 +517,7 @@ void Rewriter::includeEmptyGroupedProperty(UiObjectDefinition *groupedProperty,
#if 0
UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QStringList &propertyOrder)
{
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString::null);
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString());
UiObjectMemberList *lastObjectDef = 0;
UiObjectMemberList *lastNonObjectDef = 0;
@@ -562,7 +562,7 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m
else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(member))
orderedMembers[toString(objectBinding->qualifiedId)] = iter;
else if (cast<UiObjectDefinition*>(member))
orderedMembers[QString::null] = iter;
orderedMembers[QString()] = iter;
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(member))
orderedMembers[toString(scriptBinding->qualifiedId)] = iter;
else if (cast<UiPublicMember*>(member))

View File

@@ -236,7 +236,7 @@ void FancyLineEdit::updateButtonPositions()
{
QRect contentRect = rect();
for (int i = 0; i < 2; ++i) {
Side iconpos = (Side)i;
Side iconpos = Side(i);
if (layoutDirection() == Qt::RightToLeft)
iconpos = (iconpos == Left ? Right : Left);
@@ -473,9 +473,9 @@ void FancyLineEdit::validate()
// Check buttons.
if (d->m_oldText.isEmpty() || t.isEmpty()) {
for (int i = 0; i < 2; ++i) {
if (d->m_iconbutton[i]->hasAutoHide())
d->m_iconbutton[i]->animateShow(!t.isEmpty());
for (auto &button : qAsConst(d->m_iconbutton)) {
if (button->hasAutoHide())
button->animateShow(!t.isEmpty());
}
d->m_oldText = t;
}

View File

@@ -99,7 +99,7 @@ public:
MimeType mimeTypeForName(const QString &nameOrAlias);
MimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device, int *priorityPtr);
MimeType findByData(const QByteArray &data, int *priorityPtr);
QStringList mimeTypeForFileName(const QString &fileName, QString *foundSuffix = 0);
QStringList mimeTypeForFileName(const QString &fileName, QString *foundSuffix = nullptr);
mutable MimeProviderBase *m_provider;
const QString m_defaultMimeType;

View File

@@ -58,15 +58,11 @@ namespace Internal {
struct MimeGlobMatchResult
{
MimeGlobMatchResult()
: m_weight(0), m_matchingPatternLength(0)
{}
void addMatch(const QString &mimeType, int weight, const QString &pattern);
QStringList m_matchingMimeTypes;
int m_weight;
int m_matchingPatternLength;
int m_weight = 0;
int m_matchingPatternLength = 0;
QString m_foundSuffix;
};

View File

@@ -141,14 +141,14 @@ class MimeXMLProvider : public MimeProviderBase
public:
MimeXMLProvider(MimeDatabasePrivate *db);
virtual bool isValid();
virtual MimeType mimeTypeForName(const QString &name);
virtual QStringList findByFileName(const QString &fileName, QString *foundSuffix);
virtual QStringList parents(const QString &mime);
virtual QString resolveAlias(const QString &name);
virtual QStringList listAliases(const QString &name);
virtual MimeType findByMagic(const QByteArray &data, int *accuracyPtr);
virtual QList<MimeType> allMimeTypes();
bool isValid() override;
MimeType mimeTypeForName(const QString &name) override;
QStringList findByFileName(const QString &fileName, QString *foundSuffix) override;
QStringList parents(const QString &mime) override;
QString resolveAlias(const QString &name) override;
QStringList listAliases(const QString &name) override;
MimeType findByMagic(const QByteArray &data, int *accuracyPtr) override;
QList<MimeType> allMimeTypes() override;
bool load(const QString &fileName, QString *errorMessage);
@@ -161,9 +161,9 @@ public:
// Qt Creator additions
void addData(const QString &id, const QByteArray &data);
QMap<int, QList<MimeMagicRule> > magicRulesForMimeType(const MimeType &mimeType);
void setGlobPatternsForMimeType(const MimeType &mimeType, const QStringList &patterns);
void setMagicRulesForMimeType(const MimeType &mimeType, const QMap<int, QList<MimeMagicRule> > &rules);
QMap<int, QList<MimeMagicRule> > magicRulesForMimeType(const MimeType &mimeType) override;
void setGlobPatternsForMimeType(const MimeType &mimeType, const QStringList &patterns) override;
void setMagicRulesForMimeType(const MimeType &mimeType, const QMap<int, QList<MimeMagicRule> > &rules) override;
private:
void ensureLoaded();

View File

@@ -101,22 +101,22 @@ public:
explicit MimeTypeParser(MimeXMLProvider &provider) : m_provider(provider) {}
protected:
inline bool mimeTypeExists(const QString &mimeTypeName)
inline bool mimeTypeExists(const QString &mimeTypeName) override
{ return m_provider.mimeTypeForName(mimeTypeName).isValid(); }
inline bool process(const MimeType &t, QString *)
inline bool process(const MimeType &t, QString *) override
{ m_provider.addMimeType(t); return true; }
inline bool process(const MimeGlobPattern &glob, QString *)
inline bool process(const MimeGlobPattern &glob, QString *) override
{ m_provider.addGlobPattern(glob); return true; }
inline void processParent(const QString &child, const QString &parent)
inline void processParent(const QString &child, const QString &parent) override
{ m_provider.addParent(child, parent); }
inline void processAlias(const QString &alias, const QString &name)
inline void processAlias(const QString &alias, const QString &name) override
{ m_provider.addAlias(alias, name); }
inline void processMagicMatcher(const MimeMagicRuleMatcher &matcher)
inline void processMagicMatcher(const MimeMagicRuleMatcher &matcher) override
{ m_provider.addMagicMatcher(matcher); }
private:

View File

@@ -37,16 +37,12 @@ namespace Internal {
class OutputFormatterPrivate
{
public:
OutputFormatterPrivate()
: plainTextEdit(nullptr), overwriteOutput(false)
{}
QPlainTextEdit *plainTextEdit;
QPlainTextEdit *plainTextEdit = nullptr;
QTextCharFormat formats[NumberOfFormats];
QFont font;
QTextCursor cursor;
AnsiEscapeCodeHandler escapeCodeHandler;
bool overwriteOutput;
bool overwriteOutput = false;
};
} // namespace Internal

View File

@@ -167,7 +167,7 @@ public:
QHBoxLayout *m_hLayout = nullptr;
FancyLineEdit *m_lineEdit = nullptr;
PathChooser::Kind m_acceptingKind;
PathChooser::Kind m_acceptingKind = PathChooser::ExistingDirectory;
QString m_dialogTitleOverride;
QString m_dialogFilter;
QString m_initialBrowsePathOverride;
@@ -181,7 +181,6 @@ public:
PathChooserPrivate::PathChooserPrivate() :
m_hLayout(new QHBoxLayout),
m_lineEdit(new FancyLineEdit),
m_acceptingKind(PathChooser::ExistingDirectory),
m_macroExpander(globalMacroExpander())
{
}

View File

@@ -60,22 +60,19 @@ class ProjectIntroPagePrivate
public:
ProjectIntroPagePrivate();
Ui::ProjectIntroPage m_ui;
bool m_complete;
bool m_complete = false;
QRegularExpressionValidator m_projectNameValidator;
// Status label style sheets
const QString m_errorStyleSheet;
const QString m_warningStyleSheet;
const QString m_hintStyleSheet;
bool m_forceSubProject;
bool m_forceSubProject = false;
QStringList m_projectDirectories;
};
ProjectIntroPagePrivate:: ProjectIntroPagePrivate() :
m_complete(false),
m_errorStyleSheet(QLatin1String("background : red;")),
m_warningStyleSheet(QLatin1String("background : yellow;")),
m_hintStyleSheet(),
m_forceSubProject(false)
m_warningStyleSheet(QLatin1String("background : yellow;"))
{
}

View File

@@ -63,14 +63,14 @@ class TextTip : public QTipLabel
public:
TextTip(QWidget *parent);
virtual void setContent(const QVariant &content);
virtual bool isInteractive() const;
virtual void configure(const QPoint &pos, QWidget *w);
virtual bool canHandleContentReplacement(int typeId) const;
virtual int showTime() const;
virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
virtual void paintEvent(QPaintEvent *event);
virtual void resizeEvent(QResizeEvent *event);
void setContent(const QVariant &content) override;
bool isInteractive() const override;
void configure(const QPoint &pos, QWidget *w) override;
bool canHandleContentReplacement(int typeId) const override;
int showTime() const override;
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
private:
QString m_text;
@@ -81,12 +81,12 @@ class ColorTip : public QTipLabel
public:
ColorTip(QWidget *parent);
virtual void setContent(const QVariant &content);
virtual void configure(const QPoint &pos, QWidget *w);
virtual bool canHandleContentReplacement(int typeId) const;
virtual int showTime() const { return 4000; }
virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
virtual void paintEvent(QPaintEvent *event);
void setContent(const QVariant &content) override;
void configure(const QPoint &pos, QWidget *w) override;
bool canHandleContentReplacement(int typeId) const override;
int showTime() const override { return 4000; }
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
void paintEvent(QPaintEvent *event) override;
private:
QColor m_color;
@@ -98,15 +98,15 @@ class WidgetTip : public QTipLabel
Q_OBJECT
public:
explicit WidgetTip(QWidget *parent = 0);
explicit WidgetTip(QWidget *parent = nullptr);
void pinToolTipWidget(QWidget *parent);
virtual void setContent(const QVariant &content);
virtual void configure(const QPoint &pos, QWidget *w);
virtual bool canHandleContentReplacement(int typeId) const;
virtual int showTime() const { return 30000; }
virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
virtual bool isInteractive() const { return true; }
void setContent(const QVariant &content) override;
void configure(const QPoint &pos, QWidget *w) override;
bool canHandleContentReplacement(int typeId) const override;
int showTime() const override { return 30000; }
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
bool isInteractive() const override { return true; }
private:
QWidget *m_widget;

View File

@@ -128,6 +128,7 @@ namespace Internal {
AndroidPackageInstallationStepWidget::AndroidPackageInstallationStepWidget(AndroidPackageInstallationStep *step)
: m_step(step)
{
setShowWidget(false);
}
QString AndroidPackageInstallationStepWidget::summaryText() const
@@ -140,11 +141,6 @@ QString AndroidPackageInstallationStepWidget::displayName() const
return tr("Make install");
}
bool AndroidPackageInstallationStepWidget::showWidget() const
{
return false;
}
//
// AndroidPackageInstallationStepFactory
//

View File

@@ -61,7 +61,6 @@ public:
QString summaryText() const override;
QString displayName() const override;
bool showWidget() const override;
private:
AndroidPackageInstallationStep *m_step;
};

View File

@@ -53,6 +53,7 @@
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorericons.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <texteditor/texteditor.h>
@@ -183,6 +184,10 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri
m_frameworkManager->activateFrameworksFromSettings(m_settings);
TestTreeModel::instance()->syncTestFrameworks();
connect(ProjectExplorer::SessionManager::instance(),
&ProjectExplorer::SessionManager::startupProjectChanged, this, [this] {
m_runconfigCache.clear();
});
return true;
}
@@ -311,6 +316,23 @@ void AutotestPlugin::updateMenuItemsEnabledState()
ActionManager::command(Constants::ACTION_RUN_DBG_UCURSOR)->action()->setEnabled(canRun);
}
void AutotestPlugin::cacheRunConfigChoice(const QString &buildTargetKey, const ChoicePair &choice)
{
if (s_instance)
s_instance->m_runconfigCache.insert(buildTargetKey, choice);
}
ChoicePair AutotestPlugin::cachedChoiceFor(const QString &buildTargetKey)
{
return s_instance ? s_instance->m_runconfigCache.value(buildTargetKey) : ChoicePair();
}
void AutotestPlugin::clearChoiceCache()
{
if (s_instance)
s_instance->m_runconfigCache.clear();
}
QList<QObject *> AutotestPlugin::createTestObjects() const
{
QList<QObject *> tests;
@@ -319,3 +341,9 @@ QList<QObject *> AutotestPlugin::createTestObjects() const
#endif
return tests;
}
bool ChoicePair::matches(const ProjectExplorer::RunConfiguration *rc) const
{
return rc ? (rc->displayName() == displayName && rc->runnable().executable == executable)
: false;
}

View File

@@ -29,6 +29,10 @@
#include <extensionsystem/iplugin.h>
#include <QMap>
namespace ProjectExplorer { class RunConfiguration; }
namespace Autotest {
namespace Internal {
@@ -39,6 +43,16 @@ struct TestSettings;
class TestSettingsPage;
enum class TestRunMode;
struct ChoicePair
{
explicit ChoicePair(const QString &name = QString(), const QString &exe = QString())
: displayName(name), executable(exe) {}
bool matches(const ProjectExplorer::RunConfiguration *rc) const;
QString displayName;
QString executable;
};
class AutotestPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
@@ -54,6 +68,9 @@ public:
static QSharedPointer<TestSettings> settings();
static void updateMenuItemsEnabledState();
static void cacheRunConfigChoice(const QString &buildTargetKey, const ChoicePair &choice);
static ChoicePair cachedChoiceFor(const QString &buildTargetKey);
static void clearChoiceCache();
private:
bool checkLicense();
@@ -68,6 +85,7 @@ private:
TestSettingsPage *m_testSettingPage = nullptr;
TestNavigationWidgetFactory *m_navigationWidgetFactory = nullptr;
TestResultsPane *m_resultsPane = nullptr;
QMap<QString, ChoicePair> m_runconfigCache;
};
} // namespace Internal

View File

@@ -151,11 +151,11 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
if (targetInfo.targetFilePath.isEmpty()) {
qCDebug(LOG) << "BuildTargetInfos";
const QList<BuildTargetInfo> buildTargets = target->applicationTargets().list;
// if there is only one build target just use it (but be honest that we're guessing)
// if there is only one build target just use it (but be honest that we're deducing)
if (buildTargets.size() == 1) {
targetInfo = buildTargets.first();
m_guessedConfiguration = true;
m_guessedFrom = targetInfo.buildKey;
m_deducedConfiguration = true;
m_deducedFrom = targetInfo.buildKey;
}
}
@@ -223,8 +223,8 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
if (isLocal(rc)) { // FIXME for now only Desktop support
const Runnable runnable = rc->runnable();
m_runnable.environment = runnable.environment;
m_guessedConfiguration = true;
m_guessedFrom = rc->displayName();
m_deducedConfiguration = true;
m_deducedFrom = rc->displayName();
if (runMode == TestRunMode::Debug)
m_runConfig = new TestRunConfiguration(rc->target(), this);
} else {
@@ -234,7 +234,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
}
}
if (m_displayName.isEmpty()) // happens e.g. when guessing the TestConfiguration or error
if (m_displayName.isEmpty()) // happens e.g. when deducing the TestConfiguration or error
m_displayName = (*buildSystemTargets.begin());
}

View File

@@ -84,8 +84,8 @@ public:
ProjectExplorer::RunConfiguration *originalRunConfiguration() const { return m_origRunConfig; }
TestRunConfiguration *runConfiguration() const { return m_runConfig; }
bool hasExecutable() const;
bool isGuessed() const { return m_guessedConfiguration; }
QString runConfigDisplayName() const { return m_guessedConfiguration ? m_guessedFrom
bool isDeduced() const { return m_deducedConfiguration; }
QString runConfigDisplayName() const { return m_deducedConfiguration ? m_deducedFrom
: m_displayName; }
ProjectExplorer::Runnable runnable() const { return m_runnable; }
@@ -99,9 +99,9 @@ private:
QString m_projectFile;
QString m_buildDir;
QString m_displayName;
QString m_guessedFrom;
QString m_deducedFrom;
QPointer<ProjectExplorer::Project> m_project;
bool m_guessedConfiguration = false;
bool m_deducedConfiguration = false;
TestRunConfiguration *m_runConfig = nullptr;
QSet<QString> m_buildTargets;
ProjectExplorer::RunConfiguration *m_origRunConfig = nullptr;

View File

@@ -430,7 +430,7 @@ bool TestResultFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &s
bool TestResultFilterModel::acceptTestCaseResult(const QModelIndex &srcIndex) const
{
for (int row = 0, count = m_sourceModel->rowCount(srcIndex); row < count; ++row) {
const QModelIndex &child = srcIndex.child(row, 0);
const QModelIndex &child = m_sourceModel->index(row, 0, srcIndex);
Result::Type type = m_sourceModel->testResult(child)->result();
if (type == Result::MessageTestCaseSuccess)
type = Result::Pass;

View File

@@ -324,7 +324,7 @@ void TestResultsPane::goToNext()
if (currentIndex.isValid()) {
// try to set next to first child or next sibling
if (m_filterModel->rowCount(currentIndex)) {
nextCurrentIndex = currentIndex.child(0, 0);
nextCurrentIndex = m_filterModel->index(0, 0, currentIndex);
} else {
nextCurrentIndex = currentIndex.sibling(currentIndex.row() + 1, 0);
// if it had no sibling check siblings of parent (and grandparents if necessary)
@@ -369,7 +369,7 @@ void TestResultsPane::goToPrev()
nextCurrentIndex = currentIndex.sibling(currentIndex.row() - 1, 0);
// if the sibling has children, use the last one
while (int rowCount = m_filterModel->rowCount(nextCurrentIndex))
nextCurrentIndex = nextCurrentIndex.child(rowCount - 1, 0);
nextCurrentIndex = m_filterModel->index(rowCount - 1, 0, nextCurrentIndex);
} else {
nextCurrentIndex = currentIndex.parent();
}
@@ -386,7 +386,7 @@ void TestResultsPane::goToPrev()
nextCurrentIndex = m_filterModel->index(m_filterModel->rowCount(QModelIndex()) - 1, 0);
// step through until end
while (int rowCount = m_filterModel->rowCount(nextCurrentIndex))
nextCurrentIndex = nextCurrentIndex.child(rowCount - 1, 0);
nextCurrentIndex = m_filterModel->index(rowCount - 1, 0, nextCurrentIndex);
}
m_treeView->setCurrentIndex(nextCurrentIndex);

View File

@@ -49,6 +49,7 @@
#include <utils/outputformat.h>
#include <utils/qtcprocess.h>
#include <QCheckBox>
#include <QComboBox>
#include <QDialogButtonBox>
#include <QFormLayout>
@@ -137,8 +138,8 @@ static QString processInformation(const QProcess *proc)
static QString rcInfo(const TestConfiguration * const config)
{
QString info = '\n' + TestRunner::tr("Run configuration:") + ' ';
if (config->isGuessed())
info += TestRunner::tr("guessed from");
if (config->isDeduced())
info += TestRunner::tr("deduced from");
return info + " \"" + config->runConfigDisplayName() + '"';
}
@@ -365,6 +366,17 @@ static ProjectExplorer::RunConfiguration *getRunConfiguration(const QString &bui
= Utils::filtered(target->runConfigurations(), [] (const RunConfiguration *rc) {
return !rc->runnable().executable.isEmpty();
});
const ChoicePair oldChoice = AutotestPlugin::cachedChoiceFor(buildTargetKey);
if (!oldChoice.executable.isEmpty()) {
runConfig = Utils::findOrDefault(runConfigurations,
[&oldChoice] (const RunConfiguration *rc) {
return oldChoice.matches(rc);
});
if (runConfig)
return runConfig;
}
if (runConfigurations.size() == 1)
return runConfigurations.first();
@@ -380,6 +392,8 @@ static ProjectExplorer::RunConfiguration *getRunConfiguration(const QString &bui
return false;
return rc->runnable().executable == exe;
});
if (runConfig && dialog.rememberChoice())
AutotestPlugin::cacheRunConfigChoice(buildTargetKey, ChoicePair(dName, exe));
}
return runConfig;
}
@@ -392,11 +406,11 @@ int TestRunner::precheckTestConfigurations()
config->completeTestInformation(TestRunMode::Run);
if (config->project()) {
testCaseCount += config->testCaseCount();
if (!omitWarnings && config->isGuessed()) {
if (!omitWarnings && config->isDeduced()) {
QString message = tr(
"Project's run configuration was guessed for \"%1\".\n"
"Project's run configuration was deduced for \"%1\".\n"
"This might cause trouble during execution.\n"
"(guessed from \"%2\")");
"(deduced from \"%2\")");
message = message.arg(config->displayName()).arg(config->runConfigDisplayName());
emit testResultReady(
TestResultPtr(new FaultyTestResult(Result::MessageWarn, message)));
@@ -669,6 +683,8 @@ RunConfigurationSelectionDialog::RunConfigurationSelectionDialog(const QString &
details.append(QString(" (%1)").arg(buildTargetKey));
m_details = new QLabel(details, this);
m_rcCombo = new QComboBox(this);
m_rememberCB = new QCheckBox(tr("Remember choice. Cached choices can be reset by switching "
"projects or using the option to clear the cache."), this);
m_executable = new QLabel(this);
m_arguments = new QLabel(this);
m_workingDir = new QLabel(this);
@@ -680,6 +696,7 @@ RunConfigurationSelectionDialog::RunConfigurationSelectionDialog(const QString &
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
formLayout->addRow(m_details);
formLayout->addRow(tr("Run Configuration:"), m_rcCombo);
formLayout->addRow(m_rememberCB);
formLayout->addRow(createLine(this));
formLayout->addRow(tr("Executable:"), m_executable);
formLayout->addRow(tr("Arguments:"), m_arguments);
@@ -709,6 +726,11 @@ QString RunConfigurationSelectionDialog::executable() const
return m_executable ? m_executable->text() : QString();
}
bool RunConfigurationSelectionDialog::rememberChoice() const
{
return m_rememberCB ? m_rememberCB->isChecked() : false;
}
void RunConfigurationSelectionDialog::populate()
{
m_rcCombo->addItem(QString(), QStringList({QString(), QString(), QString()})); // empty default

View File

@@ -36,6 +36,7 @@
#include <QQueue>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QComboBox;
class QDialogButtonBox;
class QLabel;
@@ -111,6 +112,7 @@ public:
explicit RunConfigurationSelectionDialog(const QString &buildTargetKey, QWidget *parent = nullptr);
QString displayName() const;
QString executable() const;
bool rememberChoice() const;
private:
void populate();
void updateLabels();
@@ -119,6 +121,7 @@ private:
QLabel *m_arguments;
QLabel *m_workingDir;
QComboBox *m_rcCombo;
QCheckBox *m_rememberCB;
QDialogButtonBox *m_buttonBox;
};

View File

@@ -29,6 +29,7 @@
#include "testsettingspage.h"
#include "testsettings.h"
#include "testtreemodel.h"
#include "autotestplugin.h"
#include <coreplugin/icore.h>
#include <utils/fancylineedit.h>
@@ -139,6 +140,8 @@ TestSettingsWidget::TestSettingsWidget(QWidget *parent)
m_ui.editFilter->setEnabled(enable);
m_ui.removeFilter->setEnabled(enable);
});
connect(m_ui.resetChoicesButton, &QPushButton::clicked,
this, [] { AutotestPlugin::clearChoiceCache(); });
}
void TestSettingsWidget::setSettings(const TestSettings &settings)

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>585</width>
<height>373</height>
<height>431</height>
</rect>
</property>
<property name="windowTitle">
@@ -40,7 +40,7 @@
<item>
<widget class="QCheckBox" name="omitRunConfigWarnCB">
<property name="toolTip">
<string>Hides warnings related to a guessed run configuration.</string>
<string>Hides warnings related to a deduced run configuration.</string>
</property>
<property name="text">
<string>Omit run configuration warnings</string>
@@ -148,6 +148,33 @@ Warning: this is an experimental feature and might lead to failing to execute th
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPushButton" name="resetChoicesButton">
<property name="toolTip">
<string>Clear all cached choices of run configurations for tests where the executable could not be deduced.</string>
</property>
<property name="text">
<string>Reset Cached Choices</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@@ -313,8 +313,7 @@ void Action::addOverrideAction(QAction *action, const Context &context, bool scr
if (context.isEmpty()) {
m_contextActionMap.insert(Constants::C_GLOBAL, action);
} else {
for (int i = 0; i < context.size(); ++i) {
Id id = context.at(i);
for (const Id &id : context) {
if (m_contextActionMap.contains(id))
qWarning("%s", qPrintable(msgActionWarning(action, id, m_contextActionMap.value(id, nullptr))));
m_contextActionMap.insert(id, action);

View File

@@ -150,7 +150,7 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
if (args.overrideColor.isValid())
m_mainWindow->setOverrideColor(args.overrideColor);
m_locator = new Locator;
qsrand(QDateTime::currentDateTime().toTime_t());
std::srand(unsigned(QDateTime::currentDateTime().toSecsSinceEpoch()));
m_mainWindow->init();
m_editMode = new EditMode;
ModeManager::activateMode(m_editMode->id());

View File

@@ -334,7 +334,7 @@ void NewDialog::showDialog()
m_ui->templateCategoryView->setExpanded(m_filterProxyModel->index(row, 0), true);
// Ensure that item description is visible on first show
currentItemChanged(m_ui->templatesView->rootIndex().child(0,0));
currentItemChanged(m_filterProxyModel->index(0, 0, m_ui->templatesView->rootIndex()));
updateOkButton();
show();
@@ -438,7 +438,8 @@ void NewDialog::currentCategoryChanged(const QModelIndex &index)
sourceIndex = m_filterProxyModel->mapFromSource(sourceIndex);
m_ui->templatesView->setRootIndex(sourceIndex);
// Focus the first item by default
m_ui->templatesView->setCurrentIndex(m_ui->templatesView->rootIndex().child(0,0));
m_ui->templatesView->setCurrentIndex(
m_filterProxyModel->index(0, 0, m_ui->templatesView->rootIndex()));
}
}

View File

@@ -261,7 +261,7 @@ QModelIndex ItemViewFind::nextIndex(const QModelIndex &idx, bool *wrapped) const
if (d->m_option == FetchMoreWhileSearching && model->canFetchMore(current))
model->fetchMore(current);
if (model->rowCount(current) > 0)
return current.child(0, 0);
return model->index(0, 0, current);
// no more children, go up and look for parent with more children
QModelIndex nextIndex;

View File

@@ -104,14 +104,14 @@ QModelIndex SearchResultTreeModel::index(int row, int column,
const SearchResultTreeItem *childItem = parentItem->childAt(row);
if (childItem)
return createIndex(row, column, (void *)childItem);
return createIndex(row, column, const_cast<SearchResultTreeItem *>(childItem));
else
return QModelIndex();
}
QModelIndex SearchResultTreeModel::index(SearchResultTreeItem *item) const
{
return createIndex(item->rowOfItem(), 0, (void *)item);
return createIndex(item->rowOfItem(), 0, item);
}
QModelIndex SearchResultTreeModel::parent(const QModelIndex &idx) const
@@ -125,7 +125,7 @@ QModelIndex SearchResultTreeModel::parent(const QModelIndex &idx) const
if (parentItem == m_rootItem)
return QModelIndex();
return createIndex(parentItem->rowOfItem(), 0, (void *)parentItem);
return createIndex(parentItem->rowOfItem(), 0, const_cast<SearchResultTreeItem *>(parentItem));
}
int SearchResultTreeModel::rowCount(const QModelIndex &parent) const
@@ -220,10 +220,9 @@ bool SearchResultTreeModel::setCheckState(const QModelIndex &idx, Qt::CheckState
}
// check children
if (int children = item->childrenCount()) {
for (int i = 0; i < children; ++i) {
setCheckState(idx.child(i, 0), checkState, false);
}
emit dataChanged(idx.child(0, 0), idx.child(children-1, 0));
for (int i = 0; i < children; ++i)
setCheckState(index(i, 0, idx), checkState, false);
emit dataChanged(index(0, 0, idx), index(children-1, 0, idx));
}
return true;
}
@@ -355,7 +354,7 @@ void SearchResultTreeModel::addResultsToCurrentParent(const QList<SearchResultIt
if (existingItem) {
existingItem->setGenerated(false);
existingItem->item = item;
QModelIndex itemIndex = m_currentIndex.child(insertionIndex, 0);
QModelIndex itemIndex = index(insertionIndex, 0, m_currentIndex);
dataChanged(itemIndex, itemIndex);
} else {
beginInsertRows(m_currentIndex, insertionIndex, insertionIndex);
@@ -434,7 +433,7 @@ QModelIndex SearchResultTreeModel::nextIndex(const QModelIndex &idx, bool *wrapp
if (rowCount(idx) > 0) {
// node with children
return idx.child(0, 0);
return index(0, 0, idx);
}
// leaf node
QModelIndex nextIndex;

View File

@@ -30,6 +30,8 @@
#include <extensionsystem/pluginspec.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QDir>
#include <QUrl>
namespace Core {
@@ -67,6 +69,11 @@ Implementation::~Implementation()
m_instance = nullptr;
}
QString documentationPath()
{
return QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DOC_PATH);
}
void registerDocumentation(const QStringList &files)
{
if (checkInstance())

View File

@@ -58,6 +58,8 @@ enum HelpViewerLocation {
ExternalHelpAlways = 3
};
CORE_EXPORT QString documentationPath();
CORE_EXPORT void registerDocumentation(const QStringList &fileNames);
CORE_EXPORT void unregisterDocumentation(const QStringList &nameSpaces);

View File

@@ -445,11 +445,6 @@ QString ICore::installerResourcePath()
+ Constants::IDE_ID;
}
QString ICore::documentationPath()
{
return QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DOC_PATH);
}
/*!
Returns the path to the command line tools that are shipped with \QC (corresponding
to the IDE_LIBEXEC_PATH qmake variable).

View File

@@ -95,7 +95,6 @@ public:
static QString resourcePath();
static QString userResourcePath();
static QString installerResourcePath();
static QString documentationPath();
static QString libexecPath();
static QString clangExecutable(const QString &clangBinDirectory);
static QString clangIncludeDirectory(const QString &clangVersion,

View File

@@ -355,7 +355,7 @@ void MainWindow::openDroppedFiles(const QList<DropSupport::FileSpec> &files)
IContext *MainWindow::currentContextObject() const
{
return m_activeContext.isEmpty() ? 0 : m_activeContext.first();
return m_activeContext.isEmpty() ? nullptr : m_activeContext.first();
}
QStatusBar *MainWindow::statusBar() const
@@ -1086,8 +1086,7 @@ void MainWindow::updateContext()
contexts.add(m_lowPrioAdditionalContexts);
Context uniquecontexts;
for (int i = 0; i < contexts.size(); ++i) {
const Id id = contexts.at(i);
for (const Id &id : qAsConst(contexts)) {
if (!uniquecontexts.contains(id))
uniquecontexts.add(id);
}

View File

@@ -514,12 +514,6 @@ public:
InsertVirtualMethodsDialog *factory)
: CppQuickFixOperation(interface, 0)
, m_factory(factory)
, m_classAST(0)
, m_valid(false)
, m_cppFileName(QString::null)
, m_insertPosDecl(0)
, m_insertPosOutside(0)
, m_functionCount(0)
{
setDescription(QCoreApplication::translate(
"CppEditor::QuickFix", "Insert Virtual Functions of Base Classes"));
@@ -890,13 +884,13 @@ public:
}
private:
InsertVirtualMethodsDialog *m_factory;
const ClassSpecifierAST *m_classAST;
bool m_valid;
InsertVirtualMethodsDialog *m_factory = nullptr;
const ClassSpecifierAST *m_classAST = nullptr;
bool m_valid = false;
QString m_cppFileName;
int m_insertPosDecl;
int m_insertPosOutside;
unsigned m_functionCount;
int m_insertPosDecl = 0;
int m_insertPosOutside = 0;
unsigned m_functionCount = 0;
};
class InsertVirtualMethodsFilterModel : public QSortFilterProxyModel

View File

@@ -924,6 +924,9 @@ void CppSelectionChanger::fineTuneASTNodePositions(ASTNodePositions &positions)
// TODO: Fix more lambda cases.
LambdaIntroducerAST *lambdaIntroducerAST = lambdaExpressionAST->lambda_introducer;
LambdaDeclaratorAST *lambdaDeclaratorAST = lambdaExpressionAST->lambda_declarator;
if (!lambdaDeclaratorAST)
return;
TrailingReturnTypeAST *trailingReturnTypeAST = lambdaDeclaratorAST->trailing_return_type;
unsigned firstSquareBracketTokenIndex = lambdaIntroducerAST->lbracket_token;
unsigned lastParenTokenIndex = lambdaDeclaratorAST->rparen_token;

View File

@@ -32,10 +32,8 @@
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/navigationwidget.h>
#include <coreplugin/outputpane.h>
#include <coreplugin/rightpane.h>
@@ -400,58 +398,6 @@ void DebuggerMainWindowPrivate::selectPerspective(Perspective *perspective)
}
}
QWidget *createModeWindow(const Core::Id &mode, QWidget *switcher)
{
theMainWindow->addSubPerspectiveSwitcher(switcher);
auto editorHolderLayout = new QVBoxLayout;
editorHolderLayout->setMargin(0);
editorHolderLayout->setSpacing(0);
auto editorAndFindWidget = new QWidget;
editorAndFindWidget->setLayout(editorHolderLayout);
editorHolderLayout->addWidget(theMainWindow->centralWidgetStack());
editorHolderLayout->addWidget(new FindToolBarPlaceHolder(editorAndFindWidget));
auto documentAndRightPane = new MiniSplitter;
documentAndRightPane->addWidget(editorAndFindWidget);
documentAndRightPane->addWidget(new RightPanePlaceHolder(mode));
documentAndRightPane->setStretchFactor(0, 1);
documentAndRightPane->setStretchFactor(1, 0);
auto centralEditorWidget = new QWidget;
auto centralLayout = new QVBoxLayout(centralEditorWidget);
centralEditorWidget->setLayout(centralLayout);
centralLayout->setMargin(0);
centralLayout->setSpacing(0);
centralLayout->addWidget(documentAndRightPane);
centralLayout->setStretch(0, 1);
centralLayout->setStretch(1, 0);
// Right-side window with editor, output etc.
auto mainWindowSplitter = new MiniSplitter;
mainWindowSplitter->addWidget(theMainWindow);
mainWindowSplitter->addWidget(new OutputPanePlaceHolder(mode, mainWindowSplitter));
auto outputPane = new OutputPanePlaceHolder(mode, mainWindowSplitter);
outputPane->setObjectName(QLatin1String("DebuggerOutputPanePlaceHolder"));
mainWindowSplitter->addWidget(outputPane);
mainWindowSplitter->setStretchFactor(0, 10);
mainWindowSplitter->setStretchFactor(1, 0);
mainWindowSplitter->setOrientation(Qt::Vertical);
// Navigation and right-side window.
auto splitter = new MiniSplitter;
splitter->setFocusProxy(theMainWindow->centralWidgetStack());
splitter->addWidget(new NavigationWidgetPlaceHolder(mode, Side::Left));
splitter->addWidget(mainWindowSplitter);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
splitter->setObjectName(QLatin1String("DebugModeWidget"));
theMainWindow->setCentralWidget(centralEditorWidget);
return splitter;
}
void DebuggerMainWindowPrivate::depopulateCurrentPerspective()
{
// Clean up old perspective.
@@ -593,6 +539,11 @@ QString Perspective::id() const
return d->m_id;
}
QString Perspective::name() const
{
return d->m_name;
}
void Perspective::setAboutToActivateCallback(const Perspective::Callback &cb)
{
d->m_aboutToActivateCallback = cb;

View File

@@ -87,6 +87,7 @@ public:
void setShouldPersistChecker(const ShouldPersistChecker &checker);
QString id() const; // Currently used by GammaRay plugin.
QString name() const;
QWidget *centralWidget() const;
using Callback = std::function<void()>;
@@ -139,6 +140,4 @@ private:
class DebuggerMainWindowPrivate *d = nullptr;
};
DEBUGGER_EXPORT QWidget *createModeWindow(const Core::Id &mode, QWidget *);
} // Utils

View File

@@ -72,6 +72,7 @@
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/find/itemviewfind.h>
#include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h>
#include <coreplugin/imode.h>
#include <coreplugin/messagebox.h>
@@ -472,7 +473,60 @@ public:
Icons::MODE_DEBUGGER_FLAT, Icons::MODE_DEBUGGER_FLAT_ACTIVE));
setPriority(85);
setId(MODE_DEBUG);
DebuggerMainWindow *mainWindow = DebuggerMainWindow::instance();
auto editorHolderLayout = new QVBoxLayout;
editorHolderLayout->setMargin(0);
editorHolderLayout->setSpacing(0);
auto editorAndFindWidget = new QWidget;
editorAndFindWidget->setLayout(editorHolderLayout);
editorHolderLayout->addWidget(mainWindow->centralWidgetStack());
editorHolderLayout->addWidget(new FindToolBarPlaceHolder(editorAndFindWidget));
auto documentAndRightPane = new MiniSplitter;
documentAndRightPane->addWidget(editorAndFindWidget);
documentAndRightPane->addWidget(new RightPanePlaceHolder(MODE_DEBUG));
documentAndRightPane->setStretchFactor(0, 1);
documentAndRightPane->setStretchFactor(1, 0);
auto centralEditorWidget = new QWidget;
auto centralLayout = new QVBoxLayout(centralEditorWidget);
centralEditorWidget->setLayout(centralLayout);
centralLayout->setMargin(0);
centralLayout->setSpacing(0);
centralLayout->addWidget(documentAndRightPane);
centralLayout->setStretch(0, 1);
centralLayout->setStretch(1, 0);
// Right-side window with editor, output etc.
auto mainWindowSplitter = new MiniSplitter;
mainWindowSplitter->addWidget(mainWindow);
mainWindowSplitter->addWidget(new OutputPanePlaceHolder(MODE_DEBUG, mainWindowSplitter));
auto outputPane = new OutputPanePlaceHolder(MODE_DEBUG, mainWindowSplitter);
outputPane->setObjectName(QLatin1String("DebuggerOutputPanePlaceHolder"));
mainWindowSplitter->addWidget(outputPane);
mainWindowSplitter->setStretchFactor(0, 10);
mainWindowSplitter->setStretchFactor(1, 0);
mainWindowSplitter->setOrientation(Qt::Vertical);
// Navigation and right-side window.
auto splitter = new MiniSplitter;
splitter->setFocusProxy(mainWindow->centralWidgetStack());
splitter->addWidget(new NavigationWidgetPlaceHolder(MODE_DEBUG, Side::Left));
splitter->addWidget(mainWindowSplitter);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
splitter->setObjectName(QLatin1String("DebugModeWidget"));
mainWindow->setCentralWidget(centralEditorWidget);
mainWindow->addSubPerspectiveSwitcher(EngineManager::engineChooser());
setWidget(splitter);
}
~DebugMode() { delete widget(); }
};
///////////////////////////////////////////////////////////////////////
@@ -686,7 +740,6 @@ public:
void updatePresetState();
public:
QPointer<QWidget> m_modeWindow;
QPointer<DebugMode> m_mode;
ActionContainer *m_menu = nullptr;
@@ -1296,11 +1349,9 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
// Debug mode setup
m_mode = new DebugMode;
m_modeWindow = createModeWindow(Constants::MODE_DEBUG, EngineManager::engineChooser());
m_mode->setWidget(m_modeWindow);
m_debugModeContext.setContext(Context(CC::C_EDITORMANAGER));
m_debugModeContext.setWidget(m_modeWindow);
m_debugModeContext.setWidget(m_mode->widget());
ICore::addContextObject(&m_debugModeContext);
//
@@ -2243,9 +2294,6 @@ void DebuggerPluginPrivate::doShutdown()
m_shutdownTimer.stop();
delete m_modeWindow;
m_modeWindow = nullptr;
delete m_mode;
m_mode = nullptr;
emit m_plugin->asynchronousShutdownFinished();

View File

@@ -189,11 +189,7 @@ void TerminalRunner::start()
m_stubProc.setWorkingDirectory(m_stubRunnable.workingDirectory);
if (HostOsInfo::isWindowsHost()) {
// Windows up to xp needs a workaround for attaching to freshly started processes. see proc_stub_win
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
m_stubProc.setMode(ConsoleProcess::Suspend);
else
m_stubProc.setMode(ConsoleProcess::Debug);
m_stubProc.setMode(ConsoleProcess::Suspend);
} else {
m_stubProc.setMode(ConsoleProcess::Debug);
m_stubProc.setSettings(Core::ICore::settings());

View File

@@ -329,7 +329,7 @@ void HelpPlugin::extensionsInitialized()
{
QStringList filesToRegister;
// we might need to register creators inbuild help
filesToRegister.append(ICore::documentationPath() + "/qtcreator.qch");
filesToRegister.append(Core::HelpManager::documentationPath() + "/qtcreator.qch");
Core::HelpManager::registerDocumentation(filesToRegister);
}

View File

@@ -132,13 +132,13 @@ class ConfigWidget : public BuildStepConfigWidget
public:
ConfigWidget(BuildStep *step) : m_step(step)
{
setShowWidget(true);
connect(m_step, &ProjectConfiguration::displayNameChanged,
this, &BuildStepConfigWidget::updateSummary);
}
QString summaryText() const override { return "<b>" + displayName() + "</b>"; }
QString displayName() const override { return m_step->displayName(); }
bool showWidget() const override { return true; }
BuildStep *step() const { return m_step; }
private:

View File

@@ -55,7 +55,7 @@ protected:
public:
virtual bool init(QList<const BuildStep *> &earlierSteps) = 0;
virtual void run(QFutureInterface<bool> &fi) = 0;
virtual BuildStepConfigWidget *createConfigWidget() = 0;
virtual BuildStepConfigWidget *createConfigWidget();
virtual bool immutable() const;
virtual bool runInGuiThread() const;
@@ -174,11 +174,16 @@ public:
virtual QString summaryText() const = 0;
virtual QString additionalSummaryText() const { return QString(); }
virtual QString displayName() const = 0;
virtual bool showWidget() const { return true; }
bool showWidget() const { return m_showWidget; }
void setShowWidget(bool showWidget) { m_showWidget = showWidget; }
signals:
void updateSummary();
void updateAdditionalSummary();
private:
bool m_showWidget = true;
};
class PROJECTEXPLORER_EXPORT SimpleBuildStepConfigWidget : public BuildStepConfigWidget
@@ -189,11 +194,11 @@ public:
{
connect(m_step, &ProjectConfiguration::displayNameChanged,
this, &BuildStepConfigWidget::updateSummary);
setShowWidget(false);
}
QString summaryText() const override { return QLatin1String("<b>") + displayName() + QLatin1String("</b>"); }
QString displayName() const override { return m_step->displayName(); }
bool showWidget() const override { return false; }
BuildStep *step() const { return m_step; }
private:

View File

@@ -0,0 +1,340 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "projectconfigurationaspects.h"
#include "environmentaspect.h"
#include "project.h"
#include "projectexplorer.h"
#include "projectexplorersettings.h"
#include "runconfiguration.h"
#include "target.h"
#include <utils/utilsicons.h>
#include <utils/fancylineedit.h>
#include <utils/pathchooser.h>
#include <utils/qtcprocess.h>
#include <QCheckBox>
#include <QLabel>
#include <QLineEdit>
#include <QFormLayout>
#include <QToolButton>
using namespace Utils;
namespace ProjectExplorer {
namespace Internal {
class BaseBoolAspectPrivate
{
public:
bool m_value = false;
bool m_defaultValue = false;
QString m_label;
QPointer<QCheckBox> m_checkBox; // Owned by configuration widget
};
class BaseStringAspectPrivate
{
public:
BaseStringAspect::DisplayStyle m_displayStyle = BaseStringAspect::LabelDisplay;
QString m_labelText;
std::function<QString(const QString &)> m_displayFilter;
std::unique_ptr<BaseBoolAspect> m_checker;
QString m_value;
QString m_placeHolderText;
QString m_historyCompleterKey;
PathChooser::Kind m_expectedKind = PathChooser::File;
Environment m_environment;
QPointer<QLabel> m_label;
QPointer<QLabel> m_labelDisplay;
QPointer<FancyLineEdit> m_lineEditDisplay;
QPointer<PathChooser> m_pathChooserDisplay;
QPixmap m_labelPixmap;
};
} // Internal
/*!
\class ProjectExplorer::BaseStringAspect
*/
BaseStringAspect::BaseStringAspect()
: d(new Internal::BaseStringAspectPrivate)
{}
BaseStringAspect::~BaseStringAspect() = default;
QString BaseStringAspect::value() const
{
return d->m_value;
}
void BaseStringAspect::setValue(const QString &value)
{
const bool isSame = value == d->m_value;
d->m_value = value;
update();
if (!isSame)
emit changed();
}
void BaseStringAspect::fromMap(const QVariantMap &map)
{
if (!settingsKey().isEmpty())
d->m_value = map.value(settingsKey()).toString();
if (d->m_checker)
d->m_checker->fromMap(map);
}
void BaseStringAspect::toMap(QVariantMap &map) const
{
if (!settingsKey().isEmpty())
map.insert(settingsKey(), d->m_value);
if (d->m_checker)
d->m_checker->toMap(map);
}
FileName BaseStringAspect::fileName() const
{
return FileName::fromString(d->m_value);
}
void BaseStringAspect::setLabelText(const QString &labelText)
{
d->m_labelText = labelText;
if (d->m_label)
d->m_label->setText(labelText);
}
void BaseStringAspect::setLabelPixmap(const QPixmap &labelPixmap)
{
d->m_labelPixmap = labelPixmap;
if (d->m_label)
d->m_label->setPixmap(labelPixmap);
}
QString BaseStringAspect::labelText() const
{
return d->m_labelText;
}
void BaseStringAspect::setDisplayFilter(const std::function<QString(const QString &)> &displayFilter)
{
d->m_displayFilter = displayFilter;
}
bool BaseStringAspect::isChecked() const
{
return !d->m_checker || d->m_checker->value();
}
void BaseStringAspect::setDisplayStyle(DisplayStyle displayStyle)
{
d->m_displayStyle = displayStyle;
}
void BaseStringAspect::setPlaceHolderText(const QString &placeHolderText)
{
d->m_placeHolderText = placeHolderText;
if (d->m_lineEditDisplay)
d->m_lineEditDisplay->setPlaceholderText(placeHolderText);
}
void BaseStringAspect::setHistoryCompleter(const QString &historyCompleterKey)
{
d->m_historyCompleterKey = historyCompleterKey;
if (d->m_lineEditDisplay)
d->m_lineEditDisplay->setHistoryCompleter(historyCompleterKey);
if (d->m_pathChooserDisplay)
d->m_pathChooserDisplay->setHistoryCompleter(historyCompleterKey);
}
void BaseStringAspect::setExpectedKind(const PathChooser::Kind expectedKind)
{
d->m_expectedKind = expectedKind;
if (d->m_pathChooserDisplay)
d->m_pathChooserDisplay->setExpectedKind(expectedKind);
}
void BaseStringAspect::setEnvironment(const Environment &env)
{
d->m_environment = env;
if (d->m_pathChooserDisplay)
d->m_pathChooserDisplay->setEnvironment(env);
}
void BaseStringAspect::addToConfigurationLayout(QFormLayout *layout)
{
QTC_CHECK(!d->m_label);
QWidget *parent = layout->parentWidget();
d->m_label = new QLabel(parent);
d->m_label->setTextInteractionFlags(Qt::TextSelectableByMouse);
d->m_label->setText(d->m_labelText);
if (!d->m_labelPixmap.isNull())
d->m_label->setPixmap(d->m_labelPixmap);
auto hbox = new QHBoxLayout;
switch (d->m_displayStyle) {
case PathChooserDisplay:
d->m_pathChooserDisplay = new PathChooser(parent);
d->m_pathChooserDisplay->setExpectedKind(d->m_expectedKind);
d->m_pathChooserDisplay->setHistoryCompleter(d->m_historyCompleterKey);
d->m_pathChooserDisplay->setEnvironment(d->m_environment);
connect(d->m_pathChooserDisplay, &PathChooser::pathChanged,
this, &BaseStringAspect::setValue);
hbox->addWidget(d->m_pathChooserDisplay);
break;
case LineEditDisplay:
d->m_lineEditDisplay = new FancyLineEdit(parent);
d->m_lineEditDisplay->setPlaceholderText(d->m_placeHolderText);
d->m_lineEditDisplay->setHistoryCompleter(d->m_historyCompleterKey);
connect(d->m_lineEditDisplay, &FancyLineEdit::textEdited,
this, &BaseStringAspect::setValue);
hbox->addWidget(d->m_lineEditDisplay);
break;
case LabelDisplay:
d->m_labelDisplay = new QLabel(parent);
d->m_labelDisplay->setTextInteractionFlags(Qt::TextSelectableByMouse);
hbox->addWidget(d->m_labelDisplay);
break;
}
if (d->m_checker) {
auto form = new QFormLayout;
form->setContentsMargins(0, 0, 0, 0);
form->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
d->m_checker->addToConfigurationLayout(form);
hbox->addLayout(form);
}
layout->addRow(d->m_label, hbox);
update();
}
void BaseStringAspect::update()
{
const QString displayedString = d->m_displayFilter ? d->m_displayFilter(d->m_value)
: d->m_value;
const bool enabled = !d->m_checker || d->m_checker->value();
if (d->m_pathChooserDisplay) {
d->m_pathChooserDisplay->setFileName(FileName::fromString(displayedString));
d->m_pathChooserDisplay->setEnabled(enabled);
}
if (d->m_lineEditDisplay) {
d->m_lineEditDisplay->setText(displayedString);
d->m_lineEditDisplay->setEnabled(enabled);
}
if (d->m_labelDisplay)
d->m_labelDisplay->setText(displayedString);
if (d->m_label) {
d->m_label->setText(d->m_labelText);
if (!d->m_labelPixmap.isNull())
d->m_label->setPixmap(d->m_labelPixmap);
}
}
void BaseStringAspect::makeCheckable(const QString &checkerLabel, const QString &checkerKey)
{
QTC_ASSERT(!d->m_checker, return);
d->m_checker.reset(new BaseBoolAspect);
d->m_checker->setLabel(checkerLabel);
d->m_checker->setSettingsKey(checkerKey);
connect(d->m_checker.get(), &BaseBoolAspect::changed, this, &BaseStringAspect::update);
connect(d->m_checker.get(), &BaseBoolAspect::changed, this, &BaseStringAspect::changed);
update();
}
/*!
\class ProjectExplorer::BaseBoolAspect
*/
BaseBoolAspect::BaseBoolAspect(const QString &settingsKey)
: d(new Internal::BaseBoolAspectPrivate)
{
setSettingsKey(settingsKey);
}
BaseBoolAspect::~BaseBoolAspect() = default;
void BaseBoolAspect::addToConfigurationLayout(QFormLayout *layout)
{
QTC_CHECK(!d->m_checkBox);
d->m_checkBox = new QCheckBox(d->m_label, layout->parentWidget());
d->m_checkBox->setChecked(d->m_value);
layout->addRow(QString(), d->m_checkBox);
connect(d->m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
d->m_value = d->m_checkBox->isChecked();
emit changed();
});
}
void BaseBoolAspect::fromMap(const QVariantMap &map)
{
d->m_value = map.value(settingsKey(), d->m_defaultValue).toBool();
}
void BaseBoolAspect::toMap(QVariantMap &data) const
{
data.insert(settingsKey(), d->m_value);
}
bool BaseBoolAspect::defaultValue() const
{
return d->m_defaultValue;
}
void BaseBoolAspect::setDefaultValue(bool defaultValue)
{
d->m_defaultValue = defaultValue;
}
bool BaseBoolAspect::value() const
{
return d->m_value;
}
void BaseBoolAspect::setValue(bool value)
{
d->m_value = value;
if (d->m_checkBox)
d->m_checkBox->setChecked(d->m_value);
}
void BaseBoolAspect::setLabel(const QString &label)
{
d->m_label = label;
}
} // namespace ProjectExplorer

View File

@@ -0,0 +1,109 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "projectconfiguration.h"
#include "environmentaspect.h"
#include <utils/fileutils.h>
#include <utils/pathchooser.h>
#include <memory>
namespace ProjectExplorer {
namespace Internal {
class BaseBoolAspectPrivate;
class BaseStringAspectPrivate;
} // Internal
class PROJECTEXPLORER_EXPORT BaseBoolAspect : public ProjectConfigurationAspect
{
Q_OBJECT
public:
explicit BaseBoolAspect(const QString &settingsKey = QString());
~BaseBoolAspect() override;
void addToConfigurationLayout(QFormLayout *layout) override;
bool value() const;
void setValue(bool val);
bool defaultValue() const;
void setDefaultValue(bool defaultValue);
void setLabel(const QString &label);
void fromMap(const QVariantMap &map) override;
void toMap(QVariantMap &map) const override;
private:
std::unique_ptr<Internal::BaseBoolAspectPrivate> d;
};
class PROJECTEXPLORER_EXPORT BaseStringAspect : public ProjectConfigurationAspect
{
Q_OBJECT
public:
BaseStringAspect();
~BaseStringAspect() override;
void addToConfigurationLayout(QFormLayout *layout) override;
QString value() const;
void setValue(const QString &val);
QString labelText() const;
void setLabelText(const QString &labelText);
void setLabelPixmap(const QPixmap &labelPixmap);
void setDisplayFilter(const std::function<QString (const QString &)> &displayFilter);
void setPlaceHolderText(const QString &placeHolderText);
void setHistoryCompleter(const QString &historyCompleterKey);
void setExpectedKind(const Utils::PathChooser::Kind expectedKind);
void setEnvironment(const Utils::Environment &env);
bool isChecked() const;
void makeCheckable(const QString &optionalLabel, const QString &optionalBaseKey);
enum DisplayStyle { LabelDisplay, LineEditDisplay, PathChooserDisplay };
void setDisplayStyle(DisplayStyle style);
void fromMap(const QVariantMap &map) override;
void toMap(QVariantMap &map) const override;
Utils::FileName fileName() const;
void setFileName(const Utils::FileName &val);
private:
void update();
std::unique_ptr<Internal::BaseStringAspectPrivate> d;
};
} // namespace ProjectExplorer

View File

@@ -155,7 +155,8 @@ HEADERS += projectexplorer.h \
extracompiler.h \
customexecutablerunconfiguration.h \
projectmacro.h \
makestep.h
makestep.h \
projectconfigurationaspects.h
SOURCES += projectexplorer.cpp \
abi.cpp \
@@ -292,7 +293,8 @@ SOURCES += projectexplorer.cpp \
extracompiler.cpp \
customexecutablerunconfiguration.cpp \
projectmacro.cpp \
makestep.cpp
makestep.cpp \
projectconfigurationaspects.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \

View File

@@ -101,6 +101,7 @@ Project {
"processstep.cpp", "processstep.h", "processstep.ui",
"project.cpp", "project.h",
"projectconfiguration.cpp", "projectconfiguration.h",
"projectconfigurationaspects.cpp", "projectconfigurationaspects.h",
"projectconfigurationmodel.cpp", "projectconfigurationmodel.h",
"projectexplorer.cpp", "projectexplorer.h",
"projectexplorer.qrc",

View File

@@ -642,11 +642,6 @@ bool RunWorkerFactory::canRun(RunConfiguration *runConfiguration, Core::Id runMo
return true;
}
void RunWorkerFactory::setPriority(int priority)
{
m_priority = priority;
}
void RunWorkerFactory::setProducer(const WorkerCreator &producer)
{
m_producer = producer;
@@ -971,15 +966,14 @@ RunWorkerFactory::WorkerCreator RunControl::producer(RunConfiguration *runConfig
const auto canRun = std::bind(&RunWorkerFactory::canRun, std::placeholders::_1, runConfig, runMode);
const QList<RunWorkerFactory *> candidates = Utils::filtered(g_runWorkerFactories, canRun);
// This is legit, there might be combinations that cannot run.
if (candidates.empty())
return {};
const auto higherPriority = std::bind(std::greater<>(),
std::bind(&RunWorkerFactory::priority, std::placeholders::_1),
std::bind(&RunWorkerFactory::priority, std::placeholders::_2));
const auto bestFactory = std::max_element(candidates.begin(), candidates.end(), higherPriority);
return (*bestFactory)->producer();
// There should be at most one top-level producer feeling responsible per combination.
// Breaking a tie should be done by tightening the restrictions on one of them.
QTC_CHECK(candidates.size() == 1);
return candidates.front()->producer();
}
void RunControlPrivate::initiateStart()
@@ -1616,12 +1610,12 @@ void SimpleTargetRunner::start()
connect(&m_launcher, &ApplicationLauncher::remoteStderr,
this, [this](const QString &output) {
appendMessage(output, Utils::StdErrFormatSameLine);
appendMessage(output, Utils::StdErrFormatSameLine, false);
});
connect(&m_launcher, &ApplicationLauncher::remoteStdout,
this, [this](const QString &output) {
appendMessage(output, Utils::StdOutFormatSameLine);
appendMessage(output, Utils::StdOutFormatSameLine, false);
});
connect(&m_launcher, &ApplicationLauncher::finished,

View File

@@ -382,12 +382,10 @@ public:
bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const;
void setPriority(int priority);
void setProducer(const WorkerCreator &producer);
void addConstraint(const Constraint &constraint);
void addSupportedRunMode(Core::Id runMode);
int priority() const { return m_priority; }
WorkerCreator producer() const { return m_producer; }
private:
@@ -399,7 +397,6 @@ private:
QList<Core::Id> m_supportedRunModes;
QList<Constraint> m_constraints;
WorkerCreator m_producer;
int m_priority = 0;
};
/**
@@ -478,13 +475,12 @@ public:
factory->addConstraint(constraint);
}
template <class Worker>
static void registerWorker(Core::Id runMode, const Constraint &constraint, int priority = 0)
static void registerWorker(Core::Id runMode, const Constraint &constraint)
{
auto factory = new RunWorkerFactory;
factory->setProducer([](RunControl *rc) { return new Worker(rc); });
factory->addSupportedRunMode(runMode);
factory->addConstraint(constraint);
factory->setPriority(priority);
}
static WorkerCreator producer(RunConfiguration *runConfiguration, Core::Id runMode);

View File

@@ -292,203 +292,6 @@ void ArgumentsAspect::addToConfigurationLayout(QFormLayout *layout)
layout->addRow(tr("Command line arguments:"), m_chooser);
}
/*!
\class ProjectExplorer::BaseStringAspect
*/
BaseStringAspect::BaseStringAspect() = default;
BaseStringAspect::~BaseStringAspect()
{
delete m_checker;
m_checker = nullptr;
}
QString BaseStringAspect::value() const
{
return m_value;
}
void BaseStringAspect::setValue(const QString &value)
{
const bool isSame = value == m_value;
m_value = value;
update();
if (!isSame)
emit changed();
}
void BaseStringAspect::fromMap(const QVariantMap &map)
{
if (!settingsKey().isEmpty())
m_value = map.value(settingsKey()).toString();
if (m_checker)
m_checker->fromMap(map);
}
void BaseStringAspect::toMap(QVariantMap &map) const
{
if (!settingsKey().isEmpty())
map.insert(settingsKey(), m_value);
if (m_checker)
m_checker->toMap(map);
}
FileName BaseStringAspect::fileName() const
{
return FileName::fromString(m_value);
}
void BaseStringAspect::setLabelText(const QString &labelText)
{
m_labelText = labelText;
if (m_label)
m_label->setText(labelText);
}
void BaseStringAspect::setLabelPixmap(const QPixmap &labelPixmap)
{
m_labelPixmap = labelPixmap;
if (m_label)
m_label->setPixmap(labelPixmap);
}
QString BaseStringAspect::labelText() const
{
return m_labelText;
}
void BaseStringAspect::setDisplayFilter(const std::function<QString(const QString &)> &displayFilter)
{
m_displayFilter = displayFilter;
}
bool BaseStringAspect::isChecked() const
{
return !m_checker || m_checker->value();
}
void BaseStringAspect::setDisplayStyle(DisplayStyle displayStyle)
{
m_displayStyle = displayStyle;
}
void BaseStringAspect::setPlaceHolderText(const QString &placeHolderText)
{
m_placeHolderText = placeHolderText;
if (m_lineEditDisplay)
m_lineEditDisplay->setPlaceholderText(placeHolderText);
}
void BaseStringAspect::setHistoryCompleter(const QString &historyCompleterKey)
{
m_historyCompleterKey = historyCompleterKey;
if (m_lineEditDisplay)
m_lineEditDisplay->setHistoryCompleter(historyCompleterKey);
if (m_pathChooserDisplay)
m_pathChooserDisplay->setHistoryCompleter(historyCompleterKey);
}
void BaseStringAspect::setExpectedKind(const PathChooser::Kind expectedKind)
{
m_expectedKind = expectedKind;
if (m_pathChooserDisplay)
m_pathChooserDisplay->setExpectedKind(expectedKind);
}
void BaseStringAspect::setEnvironment(const Environment &env)
{
m_environment = env;
if (m_pathChooserDisplay)
m_pathChooserDisplay->setEnvironment(env);
}
void BaseStringAspect::addToConfigurationLayout(QFormLayout *layout)
{
QTC_CHECK(!m_label);
QWidget *parent = layout->parentWidget();
m_label = new QLabel(parent);
m_label->setTextInteractionFlags(Qt::TextSelectableByMouse);
m_label->setText(m_labelText);
if (!m_labelPixmap.isNull())
m_label->setPixmap(m_labelPixmap);
auto hbox = new QHBoxLayout;
switch (m_displayStyle) {
case PathChooserDisplay:
m_pathChooserDisplay = new PathChooser(parent);
m_pathChooserDisplay->setExpectedKind(m_expectedKind);
m_pathChooserDisplay->setHistoryCompleter(m_historyCompleterKey);
m_pathChooserDisplay->setEnvironment(m_environment);
connect(m_pathChooserDisplay, &PathChooser::pathChanged,
this, &BaseStringAspect::setValue);
hbox->addWidget(m_pathChooserDisplay);
break;
case LineEditDisplay:
m_lineEditDisplay = new FancyLineEdit(parent);
m_lineEditDisplay->setPlaceholderText(m_placeHolderText);
m_lineEditDisplay->setHistoryCompleter(m_historyCompleterKey);
connect(m_lineEditDisplay, &FancyLineEdit::textEdited,
this, &BaseStringAspect::setValue);
hbox->addWidget(m_lineEditDisplay);
break;
case LabelDisplay:
m_labelDisplay = new QLabel(parent);
m_labelDisplay->setTextInteractionFlags(Qt::TextSelectableByMouse);
hbox->addWidget(m_labelDisplay);
break;
}
if (m_checker) {
auto form = new QFormLayout;
form->setContentsMargins(0, 0, 0, 0);
form->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_checker->addToConfigurationLayout(form);
hbox->addLayout(form);
}
layout->addRow(m_label, hbox);
update();
}
void BaseStringAspect::update()
{
const QString displayedString = m_displayFilter ? m_displayFilter(m_value) : m_value;
const bool enabled = !m_checker || m_checker->value();
if (m_pathChooserDisplay) {
m_pathChooserDisplay->setFileName(FileName::fromString(displayedString));
m_pathChooserDisplay->setEnabled(enabled);
}
if (m_lineEditDisplay) {
m_lineEditDisplay->setText(displayedString);
m_lineEditDisplay->setEnabled(enabled);
}
if (m_labelDisplay)
m_labelDisplay->setText(displayedString);
if (m_label) {
m_label->setText(m_labelText);
if (!m_labelPixmap.isNull())
m_label->setPixmap(m_labelPixmap);
}
}
void BaseStringAspect::makeCheckable(const QString &checkerLabel, const QString &checkerKey)
{
QTC_ASSERT(!m_checker, return);
m_checker = new BaseBoolAspect;
m_checker->setLabel(checkerLabel);
m_checker->setSettingsKey(checkerKey);
connect(m_checker, &BaseBoolAspect::changed, this, &BaseStringAspect::update);
connect(m_checker, &BaseBoolAspect::changed, this, &BaseStringAspect::changed);
update();
}
/*!
\class ProjectExplorer::ExecutableAspect
*/
@@ -607,65 +410,6 @@ void ExecutableAspect::toMap(QVariantMap &map) const
m_alternativeExecutable->toMap(map);
}
/*!
\class ProjectExplorer::BaseBoolAspect
*/
BaseBoolAspect::BaseBoolAspect(const QString &settingsKey)
{
setSettingsKey(settingsKey);
}
BaseBoolAspect::~BaseBoolAspect() = default;
void BaseBoolAspect::addToConfigurationLayout(QFormLayout *layout)
{
QTC_CHECK(!m_checkBox);
m_checkBox = new QCheckBox(m_label, layout->parentWidget());
m_checkBox->setChecked(m_value);
layout->addRow(QString(), m_checkBox);
connect(m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
m_value = m_checkBox->isChecked();
emit changed();
});
}
void BaseBoolAspect::fromMap(const QVariantMap &map)
{
m_value = map.value(settingsKey(), m_defaultValue).toBool();
}
void BaseBoolAspect::toMap(QVariantMap &data) const
{
data.insert(settingsKey(), m_value);
}
bool BaseBoolAspect::defaultValue() const
{
return m_defaultValue;
}
void BaseBoolAspect::setDefaultValue(bool defaultValue)
{
m_defaultValue = defaultValue;
}
bool BaseBoolAspect::value() const
{
return m_value;
}
void BaseBoolAspect::setValue(bool value)
{
m_value = value;
if (m_checkBox)
m_checkBox->setChecked(m_value);
}
void BaseBoolAspect::setLabel(const QString &label)
{
m_label = label;
}
/*!
\class ProjectExplorer::UseLibraryPathsAspect

View File

@@ -25,19 +25,12 @@
#pragma once
#include "runconfiguration.h"
#include "projectconfigurationaspects.h"
#include "applicationlauncher.h"
#include "environmentaspect.h"
#include <utils/fileutils.h>
#include <utils/pathchooser.h>
#include <utils/osspecificaspects.h>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QLabel;
class QLineEdit;
class QFormLayout;
class QToolButton;
QT_END_NAMESPACE
@@ -120,34 +113,6 @@ private:
QPointer<Utils::FancyLineEdit> m_chooser;
};
class PROJECTEXPLORER_EXPORT BaseBoolAspect : public ProjectConfigurationAspect
{
Q_OBJECT
public:
explicit BaseBoolAspect(const QString &settingsKey = QString());
~BaseBoolAspect() override;
void addToConfigurationLayout(QFormLayout *layout) override;
bool value() const;
void setValue(bool val);
bool defaultValue() const;
void setDefaultValue(bool defaultValue);
void setLabel(const QString &label);
void fromMap(const QVariantMap &map) override;
void toMap(QVariantMap &map) const override;
private:
bool m_value = false;
bool m_defaultValue = false;
QString m_label;
QPointer<QCheckBox> m_checkBox; // Owned by configuration widget
};
class PROJECTEXPLORER_EXPORT UseLibraryPathsAspect : public BaseBoolAspect
{
Q_OBJECT
@@ -164,61 +129,6 @@ public:
UseDyldSuffixAspect();
};
class PROJECTEXPLORER_EXPORT BaseStringAspect : public ProjectConfigurationAspect
{
Q_OBJECT
public:
BaseStringAspect();
~BaseStringAspect() override;
void addToConfigurationLayout(QFormLayout *layout) override;
QString value() const;
void setValue(const QString &val);
QString labelText() const;
void setLabelText(const QString &labelText);
void setLabelPixmap(const QPixmap &labelPixmap);
void setDisplayFilter(const std::function<QString (const QString &)> &displayFilter);
void setPlaceHolderText(const QString &placeHolderText);
void setHistoryCompleter(const QString &historyCompleterKey);
void setExpectedKind(const Utils::PathChooser::Kind expectedKind);
void setEnvironment(const Utils::Environment &env);
bool isChecked() const;
void makeCheckable(const QString &optionalLabel, const QString &optionalBaseKey);
enum DisplayStyle { LabelDisplay, LineEditDisplay, PathChooserDisplay };
void setDisplayStyle(DisplayStyle style);
void fromMap(const QVariantMap &map) override;
void toMap(QVariantMap &map) const override;
Utils::FileName fileName() const;
void setFileName(const Utils::FileName &val);
private:
void update();
DisplayStyle m_displayStyle = LabelDisplay;
QString m_labelText;
std::function<QString(const QString &)> m_displayFilter;
BaseBoolAspect *m_checker = nullptr;
QString m_value;
QString m_placeHolderText;
QString m_historyCompleterKey;
Utils::PathChooser::Kind m_expectedKind = Utils::PathChooser::File;
Utils::Environment m_environment;
QPointer<QLabel> m_label;
QPointer<QLabel> m_labelDisplay;
QPointer<Utils::FancyLineEdit> m_lineEditDisplay;
QPointer<Utils::PathChooser> m_pathChooserDisplay;
QPixmap m_labelPixmap;
};
class PROJECTEXPLORER_EXPORT ExecutableAspect : public ProjectConfigurationAspect
{
Q_OBJECT

View File

@@ -281,19 +281,19 @@ void SelectableFilesModel::propagateUp(const QModelIndex &index)
}
}
void SelectableFilesModel::propagateDown(const QModelIndex &index)
void SelectableFilesModel::propagateDown(const QModelIndex &idx)
{
auto t = static_cast<Tree *>(index.internalPointer());
auto t = static_cast<Tree *>(idx.internalPointer());
for (int i = 0; i<t->childDirectories.size(); ++i) {
t->childDirectories[i]->checked = t->checked;
propagateDown(index.child(i, 0));
propagateDown(index(i, 0, idx));
}
for (int i = 0; i<t->files.size(); ++i)
t->files[i]->checked = t->checked;
int rows = rowCount(index);
int rows = rowCount(idx);
if (rows)
emit dataChanged(index.child(0, 0), index.child(rows-1, 0));
emit dataChanged(index(0, 0, idx), index(rows-1, 0, idx));
}
Qt::ItemFlags SelectableFilesModel::flags(const QModelIndex &index) const
@@ -401,14 +401,14 @@ void SelectableFilesModel::selectAllFiles(Tree *root)
emit checkedFilesChanged();
}
Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &idx)
{
bool allChecked = true;
bool allUnchecked = true;
auto t = static_cast<Tree *>(index.internalPointer());
auto t = static_cast<Tree *>(idx.internalPointer());
for (int i=0; i < t->childDirectories.size(); ++i) {
Qt::CheckState childCheckState = applyFilter(index.child(i, 0));
Qt::CheckState childCheckState = applyFilter(index(i, 0, idx));
if (childCheckState == Qt::Checked)
allUnchecked = false;
else if (childCheckState == Qt::Unchecked)
@@ -428,7 +428,7 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
removeBlock = (filter(t->visibleFiles.at(visibleIndex)) == FilterState::HIDDEN);
} else if (removeBlock != (filter(t->visibleFiles.at(visibleIndex)) == FilterState::HIDDEN)) {
if (removeBlock) {
beginRemoveRows(index, startOfBlock, visibleIndex - 1);
beginRemoveRows(idx, startOfBlock, visibleIndex - 1);
for (int i=startOfBlock; i < visibleIndex; ++i)
t->visibleFiles[i]->checked = Qt::Unchecked;
t->visibleFiles.erase(t->visibleFiles.begin() + startOfBlock,
@@ -442,7 +442,7 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
}
}
if (removeBlock) {
beginRemoveRows(index, startOfBlock, visibleEnd - 1);
beginRemoveRows(idx, startOfBlock, visibleEnd - 1);
for (int i=startOfBlock; i < visibleEnd; ++i)
t->visibleFiles[i]->checked = Qt::Unchecked;
t->visibleFiles.erase(t->visibleFiles.begin() + startOfBlock,
@@ -476,7 +476,7 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
++newIndex;
}
// end of block = newIndex
beginInsertRows(index, visibleIndex, visibleIndex + newIndex - startOfBlock - 1);
beginInsertRows(idx, visibleIndex, visibleIndex + newIndex - startOfBlock - 1);
for (int i= newIndex - 1; i >= startOfBlock; --i)
t->visibleFiles.insert(visibleIndex, newRows.at(i));
endInsertRows();
@@ -486,7 +486,7 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
break;
}
if (newIndex != newEnd) {
beginInsertRows(index, visibleIndex, visibleIndex + newEnd - newIndex - 1);
beginInsertRows(idx, visibleIndex, visibleIndex + newEnd - newIndex - 1);
for (int i = newEnd - 1; i >= newIndex; --i)
t->visibleFiles.insert(visibleIndex, newRows.at(i));
endInsertRows();
@@ -508,7 +508,7 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
newState = Qt::Unchecked;
if (t->checked != newState) {
t->checked = newState;
emit dataChanged(index, index);
emit dataChanged(idx, idx);
}
return newState;
@@ -705,13 +705,14 @@ void SelectableFilesWidget::parsingFinished()
enableWidgets(true);
}
void SelectableFilesWidget::smartExpand(const QModelIndex &index)
void SelectableFilesWidget::smartExpand(const QModelIndex &idx)
{
if (m_view->model()->data(index, Qt::CheckStateRole) == Qt::PartiallyChecked) {
m_view->expand(index);
int rows = m_view->model()->rowCount(index);
QAbstractItemModel *model = m_view->model();
if (model->data(idx, Qt::CheckStateRole) == Qt::PartiallyChecked) {
m_view->expand(idx);
int rows = model->rowCount(idx);
for (int i = 0; i < rows; ++i)
smartExpand(index.child(i, 0));
smartExpand(model->index(i, 0, idx));
}
}

View File

@@ -132,11 +132,11 @@ signals:
protected:
void propagateUp(const QModelIndex &index);
void propagateDown(const QModelIndex &index);
void propagateDown(const QModelIndex &idx);
private:
QList<Glob> parseFilter(const QString &filter);
Qt::CheckState applyFilter(const QModelIndex &index);
Qt::CheckState applyFilter(const QModelIndex &idx);
void collectFiles(Tree *root, Utils::FileNameList *result) const;
void collectPaths(Tree *root, Utils::FileNameList *result) const;
void selectAllFiles(Tree *root);
@@ -214,7 +214,7 @@ private:
void parsingProgress(const Utils::FileName &fileName);
void parsingFinished();
void smartExpand(const QModelIndex &index);
void smartExpand(const QModelIndex &idx);
SelectableFilesFromDirModel *m_model = nullptr;

View File

@@ -111,7 +111,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
const Core::Context projectContext(::QbsProjectManager::Constants::PROJECT_ID);
Core::FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_QT, "qbs");
Core::HelpManager::registerDocumentation({Core::ICore::documentationPath() + "/qbs.qch"});
Core::HelpManager::registerDocumentation({Core::HelpManager::documentationPath() + "/qbs.qch"});
ProjectManager::registerProjectType<QbsProject>(QmlJSTools::Constants::QBS_MIMETYPE);
KitManager::registerKitInformation<QbsKitInformation>();

View File

@@ -309,7 +309,7 @@ QmlJS::AST::UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(QmlJS::AS
else if (auto objectBinding = QmlJS::AST::cast<QmlJS::AST::UiObjectBinding*>(member))
orderedMembers[toString(objectBinding->qualifiedId)] = iter;
else if (QmlJS::AST::cast<QmlJS::AST::UiObjectDefinition*>(member))
orderedMembers[QString::null] = iter;
orderedMembers[QString()] = iter;
else if (auto scriptBinding = QmlJS::AST::cast<QmlJS::AST::UiScriptBinding*>(member))
orderedMembers[toString(scriptBinding->qualifiedId)] = iter;
else if (QmlJS::AST::cast<QmlJS::AST::UiPublicMember*>(member))

View File

@@ -96,7 +96,7 @@ QuickToolBar::QuickToolBar()
<< QLatin1String("font.italic")
<< QLatin1String("font.underline")
<< QLatin1String("font.strikeout")
<< QString::null
<< QString()
<< QLatin1String("states")
<< QLatin1String("transitions")
;

View File

@@ -24,148 +24,64 @@
****************************************************************************/
#include "remotelinuxcustomcommanddeploymentstep.h"
#include "remotelinuxcustomcommanddeployservice.h"
#include <QString>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
#include <projectexplorer/runconfigurationaspects.h>
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
namespace {
const char CommandLineKey[] = "RemoteLinuxCustomCommandDeploymentStep.CommandLine";
class ConfigWidget : public SimpleBuildStepConfigWidget
{
Q_OBJECT
public:
ConfigWidget(AbstractRemoteLinuxCustomCommandDeploymentStep *step)
: SimpleBuildStepConfigWidget(step)
{
QVBoxLayout * const mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0);
QHBoxLayout * const commandLineLayout = new QHBoxLayout;
mainLayout->addLayout(commandLineLayout);
QLabel * const commandLineLabel = new QLabel(tr("Command line:"));
commandLineLayout->addWidget(commandLineLabel);
m_commandLineEdit.setText(step->commandLine());
commandLineLayout->addWidget(&m_commandLineEdit);
connect(&m_commandLineEdit, &QLineEdit::textEdited,
this, &ConfigWidget::handleCommandLineEdited);
}
bool showWidget() const { return true; }
private:
void handleCommandLineEdited() {
AbstractRemoteLinuxCustomCommandDeploymentStep *step =
qobject_cast<AbstractRemoteLinuxCustomCommandDeploymentStep *>(this->step());
step->setCommandLine(m_commandLineEdit.text().trimmed());
}
QLineEdit m_commandLineEdit;
};
} // anonymous namespace
class AbstractRemoteLinuxCustomCommandDeploymentStepPrivate
{
public:
QString commandLine;
};
class GenericRemoteLinuxCustomCommandDeploymentStepPrivate
class RemoteLinuxCustomCommandDeploymentStepPrivate
{
public:
BaseStringAspect *commandLineAspect;
RemoteLinuxCustomCommandDeployService service;
};
} // namespace Internal
using namespace Internal;
AbstractRemoteLinuxCustomCommandDeploymentStep::AbstractRemoteLinuxCustomCommandDeploymentStep
(BuildStepList *bsl, Core::Id id)
: AbstractRemoteLinuxDeployStep(bsl, id)
RemoteLinuxCustomCommandDeploymentStep::RemoteLinuxCustomCommandDeploymentStep(BuildStepList *bsl)
: AbstractRemoteLinuxDeployStep(bsl, stepId())
{
d = new AbstractRemoteLinuxCustomCommandDeploymentStepPrivate;
}
AbstractRemoteLinuxCustomCommandDeploymentStep::~AbstractRemoteLinuxCustomCommandDeploymentStep()
{
delete d;
}
bool AbstractRemoteLinuxCustomCommandDeploymentStep::fromMap(const QVariantMap &map)
{
if (!AbstractRemoteLinuxDeployStep::fromMap(map))
return false;
d->commandLine = map.value(QLatin1String(CommandLineKey)).toString();
return true;
}
QVariantMap AbstractRemoteLinuxCustomCommandDeploymentStep::toMap() const
{
QVariantMap map = AbstractRemoteLinuxDeployStep::toMap();
map.insert(QLatin1String(CommandLineKey), d->commandLine);
return map;
}
void AbstractRemoteLinuxCustomCommandDeploymentStep::setCommandLine(const QString &commandLine)
{
d->commandLine = commandLine;
}
QString AbstractRemoteLinuxCustomCommandDeploymentStep::commandLine() const
{
return d->commandLine;
}
bool AbstractRemoteLinuxCustomCommandDeploymentStep::initInternal(QString *error)
{
deployService()->setCommandLine(d->commandLine);
return deployService()->isDeploymentPossible(error);
}
BuildStepConfigWidget *AbstractRemoteLinuxCustomCommandDeploymentStep::createConfigWidget()
{
return new ConfigWidget(this);
}
GenericRemoteLinuxCustomCommandDeploymentStep::GenericRemoteLinuxCustomCommandDeploymentStep(BuildStepList *bsl)
: AbstractRemoteLinuxCustomCommandDeploymentStep(bsl, stepId())
{
d = new GenericRemoteLinuxCustomCommandDeploymentStepPrivate;
d = new Internal::RemoteLinuxCustomCommandDeploymentStepPrivate;
d->commandLineAspect = addAspect<BaseStringAspect>();
d->commandLineAspect->setSettingsKey("RemoteLinuxCustomCommandDeploymentStep.CommandLine");
d->commandLineAspect->setLabelText(tr("Command line:"));
d->commandLineAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
setDefaultDisplayName(displayName());
}
GenericRemoteLinuxCustomCommandDeploymentStep::~GenericRemoteLinuxCustomCommandDeploymentStep()
RemoteLinuxCustomCommandDeploymentStep::~RemoteLinuxCustomCommandDeploymentStep()
{
delete d;
}
RemoteLinuxCustomCommandDeployService *GenericRemoteLinuxCustomCommandDeploymentStep::deployService() const
bool RemoteLinuxCustomCommandDeploymentStep::initInternal(QString *error)
{
d->service.setCommandLine(d->commandLineAspect->value().trimmed());
return d->service.isDeploymentPossible(error);
}
BuildStepConfigWidget *RemoteLinuxCustomCommandDeploymentStep::createConfigWidget()
{
return BuildStep::createConfigWidget();
}
AbstractRemoteLinuxDeployService *RemoteLinuxCustomCommandDeploymentStep::deployService() const
{
return &d->service;
}
Core::Id GenericRemoteLinuxCustomCommandDeploymentStep::stepId()
Core::Id RemoteLinuxCustomCommandDeploymentStep::stepId()
{
return "RemoteLinux.GenericRemoteLinuxCustomCommandDeploymentStep";
}
QString GenericRemoteLinuxCustomCommandDeploymentStep::displayName()
QString RemoteLinuxCustomCommandDeploymentStep::displayName()
{
return tr("Run custom remote command");
}
} // namespace RemoteLinux
#include "remotelinuxcustomcommanddeploymentstep.moc"

View File

@@ -26,56 +26,27 @@
#pragma once
#include "abstractremotelinuxdeploystep.h"
#include "remotelinuxcustomcommanddeployservice.h"
namespace RemoteLinux {
namespace Internal {
class AbstractRemoteLinuxCustomCommandDeploymentStepPrivate;
class GenericRemoteLinuxCustomCommandDeploymentStepPrivate;
} // namespace Internal
namespace Internal { class RemoteLinuxCustomCommandDeploymentStepPrivate; }
class REMOTELINUX_EXPORT AbstractRemoteLinuxCustomCommandDeploymentStep
class REMOTELINUX_EXPORT RemoteLinuxCustomCommandDeploymentStep
: public AbstractRemoteLinuxDeployStep
{
Q_OBJECT
public:
~AbstractRemoteLinuxCustomCommandDeploymentStep() override;
bool fromMap(const QVariantMap &map) override;
QVariantMap toMap() const override;
void setCommandLine(const QString &commandLine);
QString commandLine() const;
protected:
AbstractRemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
bool initInternal(QString *error = 0) override;
private:
RemoteLinuxCustomCommandDeployService *deployService() const override = 0;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
Internal::AbstractRemoteLinuxCustomCommandDeploymentStepPrivate *d;
};
class REMOTELINUX_EXPORT GenericRemoteLinuxCustomCommandDeploymentStep
: public AbstractRemoteLinuxCustomCommandDeploymentStep
{
Q_OBJECT
public:
explicit GenericRemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl);
~GenericRemoteLinuxCustomCommandDeploymentStep() override;
explicit RemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl);
~RemoteLinuxCustomCommandDeploymentStep() override;
static Core::Id stepId();
static QString displayName();
private:
RemoteLinuxCustomCommandDeployService *deployService() const override;
bool initInternal(QString *error) override;
AbstractRemoteLinuxDeployService *deployService() const override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
Internal::GenericRemoteLinuxCustomCommandDeploymentStepPrivate *d;
Internal::RemoteLinuxCustomCommandDeploymentStepPrivate *d;
};
} // namespace RemoteLinux

View File

@@ -43,11 +43,6 @@ RemoteLinuxKillAppStep::RemoteLinuxKillAppStep(BuildStepList *bsl, Core::Id id)
setDefaultDisplayName(displayName());
}
BuildStepConfigWidget *RemoteLinuxKillAppStep::createConfigWidget()
{
return new SimpleBuildStepConfigWidget(this);
}
bool RemoteLinuxKillAppStep::initInternal(QString *error)
{
Q_UNUSED(error);

View File

@@ -41,8 +41,6 @@ public:
static QString displayName();
private:
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool initInternal(QString *error) override;
AbstractRemoteLinuxDeployService *deployService() const override;

View File

@@ -73,7 +73,7 @@ public:
GenericDeployStepFactory<TarPackageCreationStep> tarPackageCreationStepFactory;
GenericDeployStepFactory<UploadAndInstallTarPackageStep> uploadAndInstallTarPackageStepFactory;
GenericDeployStepFactory<GenericDirectUploadStep> genericDirectUploadStepFactory;
GenericDeployStepFactory<GenericRemoteLinuxCustomCommandDeploymentStep>
GenericDeployStepFactory<RemoteLinuxCustomCommandDeploymentStep>
customCommandDeploymentStepFactory;
GenericDeployStepFactory<RemoteLinuxCheckForFreeDiskSpaceStep>
checkForFreeDiskSpaceStepFactory;

View File

@@ -56,6 +56,8 @@ class CreateTarStepWidget : public SimpleBuildStepConfigWidget
public:
CreateTarStepWidget(TarPackageCreationStep *step) : SimpleBuildStepConfigWidget(step)
{
setShowWidget(true);
m_ignoreMissingFilesCheckBox.setText(tr("Ignore missing files"));
m_incrementalDeploymentCheckBox.setText(tr("Package modified files only"));
@@ -88,8 +90,6 @@ public:
+ step->packageFilePath();
}
bool showWidget() const { return true; }
private:
void handleIgnoreMissingFilesChanged(bool ignoreMissingFiles) {
TarPackageCreationStep *step = qobject_cast<TarPackageCreationStep *>(this->step());

View File

@@ -64,6 +64,7 @@ const char *nameForStyle(TextStyle style)
case C_PRIMITIVE_TYPE: return "PrimitiveType";
case C_OPERATOR: return "Operator";
case C_OVERLOADED_OPERATOR: return "Overloaded Operator";
case C_PUNCTUATION: return "Punctuation";
case C_PREPROCESSOR: return "Preprocessor";
case C_LABEL: return "Label";
case C_COMMENT: return "Comment";

View File

@@ -35,6 +35,7 @@
#include <QTextStream>
#include <QFileInfo>
#include <QByteArray>
#include <QSysInfo>
#include <QString>
#include <QDir>
#include <QTime>
@@ -138,6 +139,26 @@ static bool parseArguments(const QStringList &args, QString *errorMessage)
return true;
}
static bool readDebugger(const wchar_t *key, QString *debugger,
QString *errorMessage)
{
bool success = false;
HKEY handle;
const RegistryAccess::AccessMode accessMode = optIsWow
#ifdef Q_OS_WIN64
? RegistryAccess::Registry32Mode
#else
? RegistryAccess::Registry64Mode
#endif
: RegistryAccess::DefaultAccessMode;
if (openRegistryKey(HKEY_LOCAL_MACHINE, debuggerRegistryKeyC, false, &handle, accessMode, errorMessage)) {
success = registryReadStringKey(handle, key, debugger, errorMessage);
RegCloseKey(handle);
}
return success;
}
static void usage(const QString &binary, const QString &message = QString())
{
QString msg;
@@ -170,10 +191,16 @@ static void usage(const QString &binary, const QString &message = QString())
<< "<p>On 64-bit systems, do the same for the key <i>HKEY_LOCAL_MACHINE\\" << wCharToQString(debuggerWow32RegistryKeyC) << "</i>, "
<< "setting the new value to <pre>\"" << QDir::toNativeSeparators(binary) << "\" -wow %ld %ld</pre></p>"
<< "<p>How to run a command with administrative privileges:</p>"
<< "<pre>runas /env /noprofile /user:Administrator \"command arguments\"</pre>"
<< "</body></html>";
<< "<pre>runas /env /noprofile /user:Administrator \"command arguments\"</pre>";
QString currentDebugger;
QString errorMessage;
if (readDebugger(debuggerRegistryValueNameC, &currentDebugger, &errorMessage))
str << "<p>Currently registered debugger:</p><pre>" << currentDebugger << "</pre>";
str << "<p>Qt " << QT_VERSION_STR << ", " << QSysInfo::WordSize
<< "bit</p></body></html>";
QMessageBox msgBox(QMessageBox::Information, QLatin1String(titleC), msg, QMessageBox::Ok);
msgBox.setTextInteractionFlags(Qt::TextBrowserInteraction);
msgBox.exec();
}
@@ -321,22 +348,7 @@ bool startCreatorAsDebugger(bool asClient, QString *errorMessage)
bool readDefaultDebugger(QString *defaultDebugger,
QString *errorMessage)
{
bool success = false;
HKEY handle;
const RegistryAccess::AccessMode accessMode = optIsWow
#ifdef Q_OS_WIN64
? RegistryAccess::Registry32Mode
#else
? RegistryAccess::Registry64Mode
#endif
: RegistryAccess::DefaultAccessMode;
if (openRegistryKey(HKEY_LOCAL_MACHINE, debuggerRegistryKeyC, false, &handle, accessMode, errorMessage)) {
success = registryReadStringKey(handle, debuggerRegistryDefaultValueNameC,
defaultDebugger, errorMessage);
RegCloseKey(handle);
}
return success;
return readDebugger(debuggerRegistryDefaultValueNameC, defaultDebugger, errorMessage);
}
bool startDefaultDebugger(QString *errorMessage)