Merge remote-tracking branch 'origin/2.8'

Conflicts:
	src/plugins/cpptools/cppcompletion_test.cpp
	src/plugins/cpptools/cpptoolsplugin.h
	src/plugins/projectexplorer/customtoolchain.cpp
	src/plugins/vcsbase/command.cpp

Change-Id: Ie7b3c9e136c0748b41320227c757471259339b48
This commit is contained in:
Oswald Buddenhagen
2013-08-21 14:39:18 +02:00
92 changed files with 5811 additions and 1686 deletions

View File

@@ -398,6 +398,9 @@ QAbstractItemModel *AndroidPackageCreationStep::keystoreCertificates()
if (!m_keystorePasswd.length())
return 0;
params << m_keystorePasswd;
Utils::Environment env = Utils::Environment::systemEnvironment();
env.set(QLatin1String("LANG"), QLatin1String("C"));
keytoolProc.setProcessEnvironment(env.toProcessEnvironment());
keytoolProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params);
if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
QMessageBox::critical(0, tr("Error"),

View File

@@ -162,6 +162,7 @@ private slots:
void test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitionExists();
void test_quickfix_InsertDefFromDecl_notTriggeringStatement();
void test_quickfix_InsertDefFromDecl_findRightImplementationFile();
void test_quickfix_InsertDefFromDecl_ignoreSurroundingGeneratedDeclarations();
void test_quickfix_InsertDefFromDecl_respectWsInOperatorNames1();
void test_quickfix_InsertDefFromDecl_respectWsInOperatorNames2();

View File

@@ -1161,6 +1161,63 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_findRightImplementationFil
data.run(&factory);
}
/// Ignore generated functions declarations when looking at the surrounding
/// functions declarations in order to find the right implementation file.
void CppEditorPlugin::test_quickfix_InsertDefFromDecl_ignoreSurroundingGeneratedDeclarations()
{
QList<TestDocumentPtr> testFiles;
QByteArray original;
QByteArray expected;
// Header File
original =
"#define DECLARE_HIDDEN_FUNCTION void hidden();\n"
"struct Foo\n"
"{\n"
" void a();\n"
" DECLARE_HIDDEN_FUNCTION\n"
" void b@();\n"
"};\n"
"}\n";
expected = original + '\n';
testFiles << TestDocument::create(original, expected, QLatin1String("file.h"));
// Source File #1
original =
"#include \"file.h\"\n"
"\n"
"void Foo::a()\n"
"{\n\n"
"}\n";
expected =
"#include \"file.h\"\n"
"\n"
"void Foo::a()\n"
"{\n\n"
"}\n"
"\n"
"void Foo::b()\n"
"{\n\n"
"}\n"
"\n";
testFiles << TestDocument::create(original, expected, QLatin1String("file.cpp"));
// Source File #2
original =
"#include \"file.h\"\n"
"\n"
"void Foo::hidden()\n"
"{\n\n"
"}\n";
expected = original + '\n';
testFiles << TestDocument::create(original, expected, QLatin1String("file2.cpp"));
InsertDefFromDecl factory;
TestCase data(testFiles);
data.run(&factory);
}
/// Check if whitespace is respected for operator functions
void CppEditorPlugin::test_quickfix_InsertDefFromDecl_respectWsInOperatorNames1()
{

File diff suppressed because it is too large Load Diff

View File

@@ -476,8 +476,10 @@ private:
void CppAssistProposal::makeCorrection(BaseTextEditor *editor)
{
const int oldPosition = editor->position();
editor->setCursorPosition(basePosition() - 1);
editor->replace(1, QLatin1String("->"));
editor->setCursorPosition(oldPosition + 1);
moveBasePosition(1);
}
@@ -604,6 +606,24 @@ Function *asFunctionOrTemplateFunctionType(FullySpecifiedType ty)
return 0;
}
bool isQPrivateSignal(const Symbol *symbol)
{
if (!symbol)
return false;
static Identifier qPrivateSignalIdentifier("QPrivateSignal", 14);
if (FullySpecifiedType type = symbol->type()) {
if (NamedType *namedType = type->asNamedType()) {
if (const Name *name = namedType->name()) {
if (name->isEqualTo(&qPrivateSignalIdentifier))
return true;
}
}
}
return false;
}
} // Anonymous
// ----------------------------
@@ -1639,6 +1659,8 @@ bool CppCompletionAssistProcessor::completeQtMethod(const QList<CPlusPlus::Looku
signature += QLatin1Char('(');
for (unsigned i = 0; i < count; ++i) {
Symbol *arg = fun->argumentAt(i);
if (isQPrivateSignal(arg))
continue;
if (i != 0)
signature += QLatin1Char(',');
signature += o.prettyType(arg->type());

View File

@@ -176,6 +176,8 @@ private slots:
void test_completion_local_type_and_member_5();
void test_completion_local_type_and_member_6();
void test_completion_signals_hide_QPrivateSignal();
void test_format_pointerdeclaration_in_simpledeclarations();
void test_format_pointerdeclaration_in_simpledeclarations_data();
void test_format_pointerdeclaration_in_controlflowstatements();

View File

@@ -498,8 +498,7 @@ static InsertionLocation nextToSurroundingDefinitions(Symbol *declaration,
Declaration *surroundingFunctionDecl = 0;
for (int i = declIndex - 1; i >= 0; --i) {
Symbol *s = klass->memberAt(i);
surroundingFunctionDecl = isNonVirtualFunctionDeclaration(s);
if (!surroundingFunctionDecl)
if (s->isGenerated() || !(surroundingFunctionDecl = isNonVirtualFunctionDeclaration(s)))
continue;
if ((definitionFunction = symbolFinder.findMatchingDefinition(surroundingFunctionDecl,
changes.snapshot())))

View File

@@ -1156,19 +1156,20 @@ void CdbEngine::interruptInferior()
if (debug)
qDebug() << "CdbEngine::interruptInferior()" << stateName(state());
bool ok = false;
if (!canInterruptInferior())
if (!canInterruptInferior()) {
// Restore running state if inferior can't be stoped.
showMessage(tr("Interrupting is not possible in remote sessions."), LogError);
else
ok = doInterruptInferior(NoSpecialStop);
// Restore running state if stop failed.
if (!ok) {
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk")
notifyInferiorStopOk();
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
notifyInferiorRunRequested();
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunOk")
notifyInferiorRunOk();
return;
}
if (!doInterruptInferior(NoSpecialStop)) {
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopFailed")
notifyInferiorStopFailed();
}
}

View File

@@ -325,14 +325,14 @@ DebuggerKitInformation::DebuggerItem DebuggerKitInformation::variantToItem(const
break;
}
}
result.binary = Utils::FileName::fromString(binary);
result.binary = Utils::FileName::fromUserInput(binary);
return result;
}
QVariant DebuggerKitInformation::itemToVariant(const DebuggerItem &i)
{
QVariantMap vmap;
vmap.insert(QLatin1String(binaryKeyC), QVariant(i.binary.toUserOutput()));
vmap.insert(QLatin1String(binaryKeyC), QVariant(i.binary.toString()));
vmap.insert(QLatin1String(engineTypeKeyC), QVariant(int(i.engineType)));
return QVariant(vmap);
}

View File

@@ -2664,6 +2664,7 @@ void DebuggerPluginPrivate::runControlFinished(DebuggerEngine *engine)
m_snapshotHandler->activateSnapshot(0);
}
action(OperateByInstruction)->setValue(QVariant(false));
m_logWindow->clearUndoRedoStacks();
}
void DebuggerPluginPrivate::remoteCommand(const QStringList &options,

View File

@@ -114,7 +114,6 @@ public:
QString remoteChannel;
QString symbolFileName;
QString serverStartScript;
QString searchPath; // Gdb "set solib-search-path"
QString debugInfoLocation; // Gdb "set-debug-file-directory".
QStringList debugSourceLocation; // Gdb "directory"
QByteArray remoteSourcesDir;

View File

@@ -1829,7 +1829,7 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
postCommand("set detach-on-fork off", ConsoleCommand);
//postCommand("set build-id-verbose 2", ConsoleCommand);
postCommand("python print 43", ConsoleCommand, CB(handleHasPython));
postCommand("python print(sys.version)", ConsoleCommand, CB(handleHasPython));
}
}

View File

@@ -200,6 +200,13 @@ public:
appendPlainText(text);
}
void clearUndoRedoStacks()
{
if (!isUndoRedoEnabled())
return;
setUndoRedoEnabled(false);
setUndoRedoEnabled(true);
}
private slots:
void saveContents();
@@ -551,6 +558,12 @@ QString LogWindow::inputContents() const
return m_inputText->toPlainText();
}
void LogWindow::clearUndoRedoStacks()
{
m_inputText->clearUndoRedoStacks();
m_combinedText->clearUndoRedoStacks();
}
QString LogWindow::logTimeStamp()
{
// Cache the last log time entry by ms. If time progresses,

View File

@@ -61,6 +61,8 @@ public:
QString combinedContents() const;
QString inputContents() const;
void clearUndoRedoStacks();
static QString logTimeStamp();
static bool writeLogContents(const QPlainTextEdit *editor, QWidget *parent = 0);

View File

@@ -761,9 +761,6 @@ void QmlCppEngine::slaveEngineStateChanged
QTC_ASSERT(state() == InferiorRunRequested, qDebug() << state());
notifyInferiorRunOk();
}
} else if (newState == EngineRunFailed) {
if (d->m_cppEngine->targetState() != DebuggerFinished)
d->m_cppEngine->quitDebugger();
}
}
}

View File

@@ -965,9 +965,10 @@ bool WatchTreeView::event(QEvent *ev)
return BaseTreeView::event(ev);
}
void WatchTreeView::currentChanged(const QModelIndex &current, const QModelIndex &)
void WatchTreeView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
emit currentIndexChanged(current);
BaseTreeView::currentChanged(current, previous);
}
void WatchTreeView::editItem(const QModelIndex &idx)

View File

@@ -1026,7 +1026,6 @@ FakeVimPluginPrivate::~FakeVimPluginPrivate()
q->removeObject(m_fakeVimOptionsPage);
delete m_fakeVimOptionsPage;
m_fakeVimOptionsPage = 0;
delete theFakeVimSettings();
q->removeObject(m_fakeVimExCommandsPage);
delete m_fakeVimExCommandsPage;
@@ -1035,6 +1034,8 @@ FakeVimPluginPrivate::~FakeVimPluginPrivate()
q->removeObject(m_fakeVimUserCommandsPage);
delete m_fakeVimUserCommandsPage;
m_fakeVimUserCommandsPage = 0;
theFakeVimSettings()->deleteLater();
}
void FakeVimPluginPrivate::onCoreAboutToClose()

View File

@@ -203,8 +203,8 @@ void BranchDialog::checkout()
} else if (branchCheckoutDialog.exec() == QDialog::Accepted && m_model) {
if (branchCheckoutDialog.makeStashOfCurrentBranch()) {
if (!gitClient->executeSynchronousStash(m_repository,
currentBranch + QLatin1String("-AutoStash"))) {
if (gitClient->synchronousStash(m_repository,
currentBranch + QLatin1String("-AutoStash")).isEmpty()) {
return;
}
} else if (branchCheckoutDialog.moveLocalChangesToNextBranch()) {

View File

@@ -697,12 +697,16 @@ public:
~ConflictHandler()
{
GitClient *client = GitPlugin::instance()->gitClient();
if (m_commit.isEmpty() && m_files.isEmpty()) {
if (client->checkCommandInProgress(m_workingDirectory) == GitClient::NoCommand)
client->endStashScope(m_workingDirectory);
} else {
client->handleMergeConflicts(m_workingDirectory, m_commit, m_files, m_command);
// If interactive rebase editor window is closed, plugin is terminated
// but referenced here when the command ends
if (GitPlugin *plugin = GitPlugin::instance()) {
GitClient *client = plugin->gitClient();
if (m_commit.isEmpty() && m_files.isEmpty()) {
if (client->checkCommandInProgress(m_workingDirectory) == GitClient::NoCommand)
client->endStashScope(m_workingDirectory);
} else {
client->handleMergeConflicts(m_workingDirectory, m_commit, m_files, m_command);
}
}
}

View File

@@ -278,7 +278,9 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env,
// if Creator is launched within a session set up by setenv.cmd.
env.unset(QLatin1String("ORIGINALPATH"));
run.setEnvironment(env);
const QString cmdPath = QString::fromLocal8Bit(qgetenv("COMSPEC"));
QString cmdPath = QString::fromLocal8Bit(qgetenv("COMSPEC"));
if (cmdPath.isEmpty())
cmdPath = env.searchInPath(QLatin1String("cmd.exe"));
// Windows SDK setup scripts require command line switches for environment expansion.
QString cmdArguments = QLatin1String(" /E:ON /V:ON /c \"");
cmdArguments += QDir::toNativeSeparators(saver.fileName());

View File

@@ -519,9 +519,13 @@ CustomToolChainConfigWidget::CustomToolChainConfigWidget(CustomToolChain *tc) :
m_predefinedDetails->updateSummaryText();
m_headerDetails->updateSummaryText();
connect(m_compilerCommand, SIGNAL(changed(QString)), this, SIGNAL(dirty()));
connect(m_makeCommand, SIGNAL(changed(QString)), this, SIGNAL(dirty()));
connect(m_abiWidget, SIGNAL(abiChanged()), this, SIGNAL(dirty()));
connect(m_predefinedMacros, SIGNAL(textChanged()), this, SLOT(updateSummaries()));
connect(m_headerPaths, SIGNAL(textChanged()), this, SLOT(updateSummaries()));
connect(m_cxx11Flags, SIGNAL(textChanged(QString)), this, SIGNAL(dirty()));
connect(m_mkspecs, SIGNAL(textChanged(QString)), this, SIGNAL(dirty()));
connect(m_errorParserComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(errorParserChanged(int)));
connect(m_customParserSettingsButton, SIGNAL(clicked()),
@@ -535,6 +539,7 @@ void CustomToolChainConfigWidget::updateSummaries()
m_predefinedDetails->updateSummaryText();
else
m_headerDetails->updateSummaryText();
emit dirty();
}
void CustomToolChainConfigWidget::errorParserChanged(int index)

View File

@@ -935,6 +935,8 @@ void GccToolChainConfigWidget::makeReadOnlyImpl()
{
m_compilerCommand->setEnabled(false);
m_abiWidget->setEnabled(false);
m_platformCodeGenFlagsLineEdit->setEnabled(false);
m_platformLinkerFlagsLineEdit->setEnabled(false);
m_isReadOnly = true;
}

View File

@@ -48,6 +48,7 @@
#include <texteditor/icodestylepreferencesfactory.h>
#include <texteditor/normalindenter.h>
#include <texteditor/tabsettings.h>
#include <texteditor/storagesettings.h>
#include <projectexplorer/project.h>
#include <projectexplorer/editorconfiguration.h>
@@ -571,13 +572,19 @@ void ProjectFileWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const
TextEditor::ICodeStylePreferences *codeStylePrefs = codeStylePreferences(baseProject, languageId);
indenter->setCodeStylePreferences(codeStylePrefs);
QTextDocument doc(file->contents());
QTextCursor cursor(&doc);
cursor.select(QTextCursor::Document);
indenter->indent(&doc, cursor, QChar::Null, codeStylePrefs->currentTabSettings());
file->setContents(doc.toPlainText());
delete indenter;
if (TextEditor::TextEditorSettings::instance()->storageSettings().m_cleanWhitespace) {
QTextBlock block = doc.firstBlock();
while (block.isValid()) {
codeStylePrefs->currentTabSettings().removeTrailingWhitespace(cursor, block);
block = block.next();
}
}
file->setContents(doc.toPlainText());
}
QStringList ProjectFileWizardExtension::getProjectChoices() const

View File

@@ -577,6 +577,8 @@ QVariantMap mergeSharedSettings(const QVariantMap &userMap, const QVariantMap &s
QVariantMap result = userMap;
if (sharedMap.isEmpty())
return result;
if (userMap.isEmpty())
return sharedMap;
QSet<QString> stickyKeys;
const QVariant stickyList = result.take(QLatin1String(USER_STICKY_KEYS_KEY)).toList();
@@ -897,19 +899,23 @@ SettingsAccessor::SettingsData SettingsAccessor::mergeSettings(const SettingsAcc
{
SettingsData newUser = user;
SettingsData newShared = shared;
SettingsData result;
if (shared.isValid() && user.isValid()) {
while (newUser.version() < newShared.version())
incrementVersion(newUser);
while (newShared.version() < newUser.version())
incrementVersion(newShared);
result = newUser;
result.m_map = mergeSharedSettings(newUser.m_map, newShared.m_map);
} else if (shared.isValid()) {
result = shared;
} else if (user.isValid()) {
result = user;
}
m_project->setProperty(SHARED_SETTINGS, newShared.m_map);
SettingsData result = newUser;
result.m_map = mergeSharedSettings(newUser.m_map, newShared.m_map);
if (!result.isValid())
return result;

View File

@@ -85,11 +85,9 @@ bool Exception::shouldAssert()
}
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro, \a function uses
the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
Exception::Exception(int line,
const QString &function,

View File

@@ -40,11 +40,9 @@ argument.
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs the exception for \a argument. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
InvalidArgumentException::InvalidArgumentException(int line,
const QString &function,

View File

@@ -39,11 +39,9 @@ info.
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
InvalidMetaInfoException::InvalidMetaInfoException(int line,
const QString &function,

View File

@@ -39,11 +39,9 @@ model node.
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
InvalidModelNodeException::InvalidModelNodeException(int line,
const QString &function,

View File

@@ -40,11 +40,9 @@ invalid model state.
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
InvalidModelStateException::InvalidModelStateException(int line,
const QString &function,

View File

@@ -38,11 +38,9 @@ property.
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
InvalidPropertyException::InvalidPropertyException(int line,
const QString &function,

View File

@@ -38,12 +38,9 @@ source code.
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
\param qmlSource qml source string
Constructs an exception for \qmlSource. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
InvalidQmlSourceException::InvalidQmlSourceException(int line,
const QString &function,

View File

@@ -38,11 +38,9 @@
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
InvalidReparentingException::InvalidReparentingException(int line,
const QString &function,

View File

@@ -39,11 +39,8 @@ index for a slide.
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
*/
InvalidSlideIndexException::InvalidSlideIndexException(int line,
const QString &function,

View File

@@ -38,11 +38,9 @@ modification group.
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
ModificationGroupException::ModificationGroupException(int line,
const QString &function,

View File

@@ -39,11 +39,9 @@
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
Constructs an exception. \a line uses the __LINE__ macro,
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
the __FILE__ macro.
*/
RemoveBaseStateException::RemoveBaseStateException(int line,
const QString &function,

View File

@@ -91,12 +91,12 @@ For this purpose this view can be rendered offscreen.
namespace QmlDesigner {
/*! \brief Constructor
/*!
Constructs a node instance view object as a child of \a parent. If \a parent
is destructed, this instance is destructed, too.
The class will be rendered offscreen if not set otherwise.
\param Parent of this object. If this parent is d this instance is
d too.
\see ~NodeInstanceView setRenderOffScreen
*/

View File

@@ -245,7 +245,7 @@ ModelManager::ModelManager(QObject *parent):
connect(m_updateCppQmlTypesTimer, SIGNAL(timeout()), SLOT(startCppQmlTypeUpdate()));
m_asyncResetTimer = new QTimer(this);
m_asyncResetTimer->setInterval(1000);
m_asyncResetTimer->setInterval(15000);
m_asyncResetTimer->setSingleShot(true);
connect(m_asyncResetTimer, SIGNAL(timeout()), SLOT(resetCodeModel()));

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2013 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2013 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.

View File

@@ -14,6 +14,7 @@ QtcPlugin {
Depends { name: "Qt4ProjectManager" }
Depends { name: "RemoteLinux" }
Depends { name: "TextEditor" }
Depends { name: "QmlDebug" }
Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] }
cpp.includePaths: base.concat("../../shared")

View File

@@ -95,7 +95,7 @@ void QmakeKitInformation::setup(ProjectExplorer::Kit *k)
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
if (!tc || !tc->suggestedMkspecList().contains(spec)) {
if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) {
QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains();
ProjectExplorer::ToolChain *possibleTc = 0;
foreach (ProjectExplorer::ToolChain *current, tcList) {

View File

@@ -466,11 +466,7 @@ void BaseTextDocument::cleanWhitespace(QTextCursor &cursor, bool cleanIndentatio
if (inEntireDocument || block.revision() != documentLayout->lastSaveRevision) {
QString blockText = block.text();
if (int trailing = d->m_tabSettings.trailingWhitespaces(blockText)) {
cursor.setPosition(block.position() + block.length() - 1);
cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor, trailing);
cursor.removeSelectedText();
}
d->m_tabSettings.removeTrailingWhitespace(cursor, block);
if (cleanIndentation && !d->m_tabSettings.isIndentationClean(block)) {
cursor.setPosition(block.position());
int firstNonSpace = d->m_tabSettings.firstNonSpace(blockText);

View File

@@ -152,6 +152,15 @@ int TabSettings::trailingWhitespaces(const QString &text) const
return i;
}
void TabSettings::removeTrailingWhitespace(QTextCursor cursor, QTextBlock &block) const
{
if (const int trailing = trailingWhitespaces(block.text())) {
cursor.setPosition(block.position() + block.length() - 1);
cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor, trailing);
cursor.removeSelectedText();
}
}
bool TabSettings::isIndentationClean(const QTextBlock &block) const
{
int i = 0;

View File

@@ -85,6 +85,7 @@ public:
void reindentLine(QTextBlock block, int delta) const;
int trailingWhitespaces(const QString &text) const;
void removeTrailingWhitespace(QTextCursor cursor, QTextBlock &block) const;
bool isIndentationClean(const QTextBlock &block) const;
bool guessSpacesForTabs(const QTextBlock &block) const;

View File

@@ -322,19 +322,21 @@ void TextEditorPlugin::updateVariable(const QByteArray &variable)
void TextEditorPlugin::updateCurrentSelection(const QString &text)
{
Core::IEditor *iface = Core::EditorManager::currentEditor();
ITextEditor *editor = qobject_cast<ITextEditor *>(iface);
if (editor) {
int pos = editor->position();
if (ITextEditor *editor = qobject_cast<ITextEditor *>(Core::EditorManager::currentEditor())) {
const int pos = editor->position();
int anchor = editor->position(ITextEditor::Anchor);
if (anchor < 0) // no selection
anchor = pos;
int selectionLength = anchor-pos;
if (selectionLength < 0)
int selectionLength = pos - anchor;
const bool selectionInTextDirection = selectionLength >= 0;
if (!selectionInTextDirection)
selectionLength = -selectionLength;
int start = qMin(pos, anchor);
const int start = qMin(pos, anchor);
editor->setCursorPosition(start);
editor->replace(selectionLength, text);
const int replacementEnd = editor->position();
editor->setCursorPosition(selectionInTextDirection ? start : replacementEnd);
editor->select(selectionInTextDirection ? replacementEnd : start);
}
}

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2013 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2013 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.

View File

@@ -34,6 +34,7 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/vcsmanager.h>
#include <utils/synchronousprocess.h>
#include <utils/runextensions.h>
#include <QDebug>
#include <QProcess>
@@ -184,7 +185,7 @@ void Command::execute()
return;
// For some reason QtConcurrent::run() only works on this
QFuture<void> task = QtConcurrent::run(this, &Command::run);
QFuture<void> task = QtConcurrent::run(&Command::run, this);
QString binary = QFileInfo(d->m_binaryPath).baseName();
if (!binary.isEmpty())
binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter
@@ -203,7 +204,7 @@ int Command::lastExecutionExitCode() const
return d->m_lastExecExitCode;
}
void Command::run()
void Command::run(QFutureInterface<void> &future)
{
// Check that the binary path is not empty
if (binaryPath().trimmed().isEmpty()) {
@@ -233,13 +234,15 @@ void Command::run()
break;
}
emit output(stdOut);
if (!stdErr.isEmpty())
emit errorText(stdErr);
if (!future.isCanceled()) {
emit output(stdOut);
if (!stdErr.isEmpty())
emit errorText(stdErr);
emit finished(d->m_lastExecSuccess, d->m_lastExecExitCode, cookie());
if (d->m_lastExecSuccess)
emit success(cookie());
emit finished(d->m_lastExecSuccess, d->m_lastExecExitCode, cookie());
if (d->m_lastExecSuccess)
emit success(cookie());
}
// As it is used asynchronously, we need to delete ourselves
this->deleteLater();

View File

@@ -34,9 +34,13 @@
#include <QObject>
QT_FORWARD_DECLARE_CLASS(QStringList)
QT_FORWARD_DECLARE_CLASS(QVariant)
QT_FORWARD_DECLARE_CLASS(QProcessEnvironment)
QT_BEGIN_NAMESPACE
class QStringList;
class QVariant;
class QProcessEnvironment;
template <typename T>
class QFutureInterface;
QT_END_NAMESPACE
namespace VcsBase {
@@ -79,7 +83,7 @@ public:
void setCodec(QTextCodec *codec);
private:
void run();
void run(QFutureInterface<void> &future);
signals:
void output(const QString &);

View File

@@ -117,6 +117,7 @@ OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
m_messageFormat(m_defaultFormat)
{
setReadOnly(true);
setUndoRedoEnabled(false);
setFrameStyle(QFrame::NoFrame);
m_errorFormat.setForeground(Qt::red);
m_warningFormat.setForeground(Qt::darkYellow);