Merge remote-tracking branch 'origin/4.0'

Conflicts:
	src/libs/utils/tcpportsgatherer.h

Change-Id: I495f3e05789f09efb8b1e84827893423a5b5b60c
This commit is contained in:
Eike Ziller
2016-04-05 14:11:47 +02:00
45 changed files with 165 additions and 590 deletions

1
.gitignore vendored
View File

@@ -229,7 +229,6 @@ tmp/
/tests/manual/ssh/sftpfsmodel/sftpfsmodel
/tests/manual/ssh/shell/shell
/tests/manual/ssh/tunnel/tunnel
/tests/manual/utils/tcpportsgatherer/tst_tcpportsgatherer
/tests/tools/qml-ast2dot/qml-ast2dot
/tests/valgrind/memcheck/modeldemo
/tests/valgrind/memcheck/parsertests

View File

@@ -6,8 +6,8 @@ Qt Creator is a cross-platform IDE for development with the Qt framework.
The standalone binary packages support the following platforms:
Windows XP SP3 or later
(K)Ubuntu Linux 11.10 (32-bit and 64-bit) or later
Windows 7 or later
(K)Ubuntu Linux 14.04 (64-bit) or later
Mac OS X 10.7 or later
Building the sources requires Qt 5.5.0 or later.

View File

@@ -217,7 +217,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
if (object == 0)
object = new QQuickItem;
} else {
object = new QObject;
object = Internal::ObjectNodeInstance::createPrimitive("QtQml/QtObject", 2, 0, nodeInstanceServer->context());
}
}

View File

@@ -52,7 +52,7 @@ IconsWarningToolBarColor=fff2d76e
IconsErrorColor=ffdf4f4f
IconsErrorToolBarColor=ffdb6f71
IconsRunColor=ffa4d576
IconsStopColor=ffdb6f71
IconsStopColor=ffff8c8c
IconsDebugColor=ffdcdcdc
IconsInterruptColor=ff8f9dda
IconsNavigationArrowsColor=ffebc322

View File

@@ -42,7 +42,7 @@ DoubleTabWidget2ndTabActiveTextColor=ffffffff
DoubleTabWidget2ndTabBackgroundColor=ffff0000
DoubleTabWidget2ndTabInactiveTextColor=ff000000
EditorPlaceholderColor=ffdddddd
FancyToolBarSeparatorColor=43ffffff
FancyToolBarSeparatorColor=toolBarItemDisabled
FancyTabBarBackgroundColor=shadowBackground
FancyTabWidgetDisabledSelectedTextColor=toolBarItemDisabled
FancyTabWidgetDisabledUnselectedTextColor=toolBarItemDisabled

View File

@@ -406,8 +406,10 @@ void QrcParserPrivate::collectResourceFilesForSourceFile(const QString &sourceFi
QStringList *results,
const QLocale *locale) const
{
QTC_CHECK(sourceFile.startsWith(QLatin1Char('/')));
QTC_CHECK(!sourceFile.endsWith(QLatin1Char('/')));
// TODO: use FileName from fileutils for file pathes
QTC_CHECK(QFileInfo(sourceFile).isFile());
QTC_CHECK(QFileInfo(sourceFile).isAbsolute());
QStringList langs = allUiLanguages(locale);
SMap::const_iterator file = m_files.find(sourceFile);
if (file == m_files.end())

View File

@@ -37,6 +37,24 @@
#include <functional>
// hasCallOperator & Co must be outside of any namespace
// because of internal compiler error with MSVC2015 Update 2
using testCallOperatorYes = char;
using testCallOperatorNo = struct { char foo[2]; };
template<typename C>
static testCallOperatorYes testCallOperator(decltype(&C::operator()));
template<typename>
static testCallOperatorNo testCallOperator(...);
template<typename T>
struct hasCallOperator
{
static const bool value = (sizeof(testCallOperator<T>(0)) == sizeof(testCallOperatorYes));
};
namespace Utils {
namespace Internal {
@@ -53,21 +71,6 @@ namespace Internal {
a QFutureInterface& as its first parameter and returns void.
*/
template<typename T>
struct hasCallOperator
{
using yes = char;
using no = struct { char foo[2]; };
template<typename C>
static yes test(decltype(&C::operator()));
template<typename C>
static no test(...);
static const bool value = (sizeof(test<T>(0)) == sizeof(yes));
};
template <typename Function>
struct resultType;

View File

@@ -1,298 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 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 "tcpportsgatherer.h"
#include "qtcassert.h"
#include <utils/hostosinfo.h>
#include <QDebug>
#include <QFile>
#include <QProcess>
#ifdef Q_OS_WIN
#include <QLibrary>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#endif
#if defined(Q_OS_WIN) && defined(Q_CC_MINGW)
// Missing declarations for MinGW 32.
#if __GNUC__ == 4 && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 2)
typedef enum { } MIB_TCP_STATE;
#endif
typedef struct _MIB_TCP6ROW {
MIB_TCP_STATE State;
IN6_ADDR LocalAddr;
DWORD dwLocalScopeId;
DWORD dwLocalPort;
IN6_ADDR RemoteAddr;
DWORD dwRemoteScopeId;
DWORD dwRemotePort;
} MIB_TCP6ROW, *PMIB_TCP6ROW;
typedef struct _MIB_TCP6TABLE {
DWORD dwNumEntries;
MIB_TCP6ROW table[ANY_SIZE];
} MIB_TCP6TABLE, *PMIB_TCP6TABLE;
#endif // defined(Q_OS_WIN) && defined(Q_CC_MINGW)
namespace Utils {
namespace Internal {
class TcpPortsGathererPrivate
{
public:
TcpPortsGathererPrivate()
: protocol(QAbstractSocket::UnknownNetworkLayerProtocol) {}
QAbstractSocket::NetworkLayerProtocol protocol;
QSet<int> usedPorts;
void updateWin();
void updateLinux();
void updateNetstat();
};
#ifdef Q_OS_WIN
template <typename Table >
QSet<int> usedTcpPorts(ULONG (__stdcall *Func)(Table*, PULONG, BOOL))
{
Table *table = static_cast<Table*>(malloc(sizeof(Table)));
DWORD dwSize = sizeof(Table);
// get the necessary size into the dwSize variable
DWORD dwRetVal = Func(table, &dwSize, false);
if (dwRetVal == ERROR_INSUFFICIENT_BUFFER) {
free(table);
table = static_cast<Table*>(malloc(dwSize));
}
// get the actual data
QSet<int> result;
dwRetVal = Func(table, &dwSize, false);
if (dwRetVal == NO_ERROR) {
for (quint32 i = 0; i < table->dwNumEntries; i++) {
quint16 port = ntohs(table->table[i].dwLocalPort);
if (!result.contains(port))
result.insert(port);
}
} else {
qWarning() << "TcpPortsGatherer: GetTcpTable failed with" << dwRetVal;
}
free(table);
return result;
}
#endif
void TcpPortsGathererPrivate::updateWin()
{
#ifdef Q_OS_WIN
QSet<int> ports;
if (protocol == QAbstractSocket::IPv4Protocol) {
ports.unite(usedTcpPorts<MIB_TCPTABLE>(GetTcpTable));
} else {
//Dynamically load symbol for GetTcp6Table for systems that dont have support for IPV6,
//eg Windows XP
typedef ULONG (__stdcall *GetTcp6TablePtr)(PMIB_TCP6TABLE, PULONG, BOOL);
static GetTcp6TablePtr getTcp6TablePtr = 0;
if (!getTcp6TablePtr)
getTcp6TablePtr = (GetTcp6TablePtr)QLibrary::resolve(QLatin1String("Iphlpapi.dll"),
"GetTcp6Table");
if (getTcp6TablePtr && (protocol == QAbstractSocket::IPv6Protocol)) {
ports.unite(usedTcpPorts<MIB_TCP6TABLE>(getTcp6TablePtr));
} else if (protocol == QAbstractSocket::UnknownNetworkLayerProtocol) {
ports.unite(usedTcpPorts<MIB_TCPTABLE>(GetTcpTable));
if (getTcp6TablePtr)
ports.unite(usedTcpPorts<MIB_TCP6TABLE>(getTcp6TablePtr));
}
}
foreach (int port, ports)
usedPorts.insert(port);
#endif
Q_UNUSED(protocol);
}
void TcpPortsGathererPrivate::updateLinux()
{
QStringList filePaths;
const QString tcpFile = QLatin1String("/proc/net/tcp");
const QString tcp6File = QLatin1String("/proc/net/tcp6");
if (protocol == QAbstractSocket::IPv4Protocol)
filePaths << tcpFile;
else if (protocol == QAbstractSocket::IPv6Protocol)
filePaths << tcp6File;
else
filePaths << tcpFile << tcp6File;
foreach (const QString &filePath, filePaths) {
QFile file(filePath);
if (!file.open(QFile::ReadOnly | QFile::Text)) {
qWarning() << "TcpPortsGatherer: Cannot open file"
<< filePath << ":" << file.errorString();
continue;
}
if (file.atEnd()) // read first line describing the output
file.readLine();
static QRegExp pattern(QLatin1String("^\\s*" // start of line, whitespace
"\\d+:\\s*" // integer, colon, space
"[0-9A-Fa-f]+:" // hexadecimal number (ip), colon
"([0-9A-Fa-f]+)" // hexadecimal number (port!)
));
while (!file.atEnd()) {
QByteArray line = file.readLine();
if (pattern.indexIn(QLatin1String(line)) != -1) {
bool isNumber;
quint16 port = pattern.cap(1).toUShort(&isNumber, 16);
QTC_ASSERT(isNumber, continue);
usedPorts.insert(port);
} else {
qWarning() << "TcpPortsGatherer: File" << filePath << "has unexpected format.";
continue;
}
}
}
}
// Only works with FreeBSD version of netstat like we have on Mac OS X
void TcpPortsGathererPrivate::updateNetstat()
{
QStringList netstatArgs;
netstatArgs.append(QLatin1String("-a")); // show also sockets of server processes
netstatArgs.append(QLatin1String("-n")); // show network addresses as numbers
netstatArgs.append(QLatin1String("-p"));
netstatArgs.append(QLatin1String("tcp"));
if (protocol != QAbstractSocket::UnknownNetworkLayerProtocol) {
netstatArgs.append(QLatin1String("-f")); // limit to address family
if (protocol == QAbstractSocket::IPv4Protocol)
netstatArgs.append(QLatin1String("inet"));
else
netstatArgs.append(QLatin1String("inet6"));
}
QProcess netstatProcess;
netstatProcess.start(QLatin1String("netstat"), netstatArgs);
if (!netstatProcess.waitForFinished(30000)) {
qWarning() << "TcpPortsGatherer: netstat did not return in time.";
return;
}
QList<QByteArray> output = netstatProcess.readAllStandardOutput().split('\n');
foreach (const QByteArray &line, output) {
static QRegExp pattern(QLatin1String("^tcp[46]+" // "tcp", followed by "4", "6", "46"
"\\s+\\d+" // whitespace, number (Recv-Q)
"\\s+\\d+" // whitespace, number (Send-Q)
"\\s+(\\S+)")); // whitespace, Local Address
if (pattern.indexIn(QLatin1String(line)) != -1) {
QString localAddress = pattern.cap(1);
// Examples of local addresses:
// '*.56501' , '*.*' 'fe80::1%lo0.123'
int portDelimiterPos = localAddress.lastIndexOf(QLatin1Char('.'));
if (portDelimiterPos == -1)
continue;
localAddress = localAddress.mid(portDelimiterPos + 1);
bool isNumber;
quint16 port = localAddress.toUShort(&isNumber);
if (!isNumber)
continue;
usedPorts.insert(port);
}
}
}
} // namespace Internal
/*!
\class Utils::TcpPortsGatherer
\brief The TcpPortsGatherer class gathers the list of local TCP ports
already in use.
Queries the system for the list of local TCP ports already in use. This
information can be used
to select a port for use in a range.
*/
TcpPortsGatherer::TcpPortsGatherer()
: d(new Internal::TcpPortsGathererPrivate())
{
}
TcpPortsGatherer::~TcpPortsGatherer()
{
delete d;
}
void TcpPortsGatherer::update(QAbstractSocket::NetworkLayerProtocol protocol)
{
d->protocol = protocol;
d->usedPorts.clear();
if (HostOsInfo::isWindowsHost())
d->updateWin();
else if (HostOsInfo::isLinuxHost())
d->updateLinux();
else
d->updateNetstat();
}
QList<int> TcpPortsGatherer::usedPorts() const
{
return d->usedPorts.values();
}
/*!
Selects a port out of \a freePorts that is not yet used.
Returns the port, or -1 if no free port is available.
*/
int TcpPortsGatherer::getNextFreePort(PortList *freePorts) const
{
QTC_ASSERT(freePorts, return -1);
while (freePorts->hasMore()) {
const int port = freePorts->getNext();
if (!d->usedPorts.contains(port))
return port;
}
return -1;
}
} // namespace Utils

View File

@@ -1,50 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 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 "portlist.h"
#include <QAbstractSocket>
namespace Utils {
namespace Internal { class TcpPortsGathererPrivate; }
class QTCREATOR_UTILS_EXPORT TcpPortsGatherer
{
public:
TcpPortsGatherer();
~TcpPortsGatherer();
void update(QAbstractSocket::NetworkLayerProtocol protocol);
QList<int> usedPorts() const;
int getNextFreePort(PortList *port) const;
private:
Internal::TcpPortsGathererPrivate *d;
};
} // namespace Utils

View File

@@ -70,7 +70,6 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/completingtextedit.cpp \
$$PWD/json.cpp \
$$PWD/portlist.cpp \
$$PWD/tcpportsgatherer.cpp \
$$PWD/appmainwindow.cpp \
$$PWD/sleep.cpp \
$$PWD/basetreeview.cpp \
@@ -170,7 +169,6 @@ HEADERS += \
$$PWD/json.h \
$$PWD/runextensions.h \
$$PWD/portlist.h \
$$PWD/tcpportsgatherer.h \
$$PWD/appmainwindow.h \
$$PWD/sleep.h \
$$PWD/basetreeview.h \

View File

@@ -200,8 +200,6 @@ QtcLibrary {
"stylehelper.h",
"synchronousprocess.cpp",
"synchronousprocess.h",
"tcpportsgatherer.cpp",
"tcpportsgatherer.h",
"templateengine.cpp",
"templateengine.h",
"textfieldcheckbox.cpp",

View File

@@ -144,7 +144,7 @@ static QString createExplainingStepToolTipString(const ExplainingStep &step)
}
if (!step.extendedMessage.isEmpty()) {
lines << qMakePair(
QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended Message:"),
QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended message:"),
step.extendedMessage.toHtmlEscaped());
}

View File

@@ -44,7 +44,7 @@ namespace Internal {
ClangStaticAnalyzerDiagnosticView::ClangStaticAnalyzerDiagnosticView(QWidget *parent)
: Debugger::DetailedErrorView(parent)
{
m_suppressAction = new QAction(tr("Suppress this diagnostic"), this);
m_suppressAction = new QAction(tr("Suppress This Diagnostic"), this);
connect(m_suppressAction, &QAction::triggered, [this](bool) { suppressCurrentDiagnostic(); });
}

View File

@@ -19,7 +19,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Suppressed Diagnostics:</string>
<string>Suppressed diagnostics:</string>
</property>
</widget>
</item>

View File

@@ -39,12 +39,12 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.clangstaticanalyzer.runner")
static QString generalProcessError()
{
return QObject::tr("An error occurred with the clang static analyzer process.");
return QObject::tr("An error occurred with the Clang Static Analyzer process.");
}
static QString finishedDueToCrash()
{
return QObject::tr("Clang static analyzer crashed.");
return QObject::tr("Clang Static Analyzer crashed.");
}
static QStringList constructCommandLineArguments(const QString &filePath,
@@ -66,7 +66,7 @@ namespace Internal {
QString finishedWithBadExitCode(int exitCode)
{
return QObject::tr("Clang static analyzer finished with exit code: %1.").arg(exitCode);
return QObject::tr("Clang Static Analyzer finished with exit code: %1.").arg(exitCode);
}
ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecutable,

View File

@@ -120,7 +120,7 @@ ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent)
connect(action, &QAction::triggered, m_diagnosticView, &DetailedErrorView::goNext);
m_goNext = action;
const QString toolTip = tr("Clang Static Analyzer uses the analyzer from the clang project "
const QString toolTip = tr("Clang Static Analyzer uses the analyzer from the Clang project "
"to find bugs.");
Debugger::registerPerspective(ClangStaticAnalyzerPerspectiveId, {
@@ -311,7 +311,7 @@ void ClangStaticAnalyzerTool::handleStateUpdate()
m_goBack->setEnabled(issuesVisible > 1);
m_goNext->setEnabled(issuesVisible > 1);
QString message = m_running ? tr("Clang Static Analyzer running.")
QString message = m_running ? tr("Clang Static Analyzer is running.")
: tr("Clang Static Analyzer finished.");
message += QLatin1Char(' ');
if (issuesFound == 0) {

View File

@@ -91,7 +91,7 @@ bool isClangExecutableUsable(const QString &filePath, QString *errorMessage)
if (errorMessage) {
*errorMessage = QCoreApplication::translate("ClangStaticAnalyzer",
"The chosen file \"%1\" seems to point to an icecc binary not suitable "
"for analyzing.\nPlease set a real clang executable.")
"for analyzing.\nPlease set a real Clang executable.")
.arg(filePath);
}
return false;

View File

@@ -52,10 +52,12 @@ const Icon RESET(
QLatin1String(":/core/images/reset.png"));
const Icon DARK_CLOSE(
QLatin1String(":/core/images/darkclose.png"));
const Icon LOCKED(
QLatin1String(":/core/images/locked.png"));
const Icon UNLOCKED(
QLatin1String(":/core/images/unlocked.png"));
const Icon LOCKED_TOOLBAR({
{QLatin1String(":/core/images/locked.png"), Theme::IconsBaseColor}});
const Icon LOCKED({
{QLatin1String(":/core/images/locked.png"), Theme::PanelTextColorDark}}, Icon::Tint);
const Icon UNLOCKED_TOOLBAR({
{QLatin1String(":/core/images/unlocked.png"), Theme::IconsBaseColor}});
const Icon FIND_CASE_INSENSITIVELY(
QLatin1String(":/find/images/casesensitively.png"));
const Icon FIND_WHOLE_WORD(

View File

@@ -43,8 +43,9 @@ CORE_EXPORT extern const Utils::Icon CUT;
CORE_EXPORT extern const Utils::Icon DIR;
CORE_EXPORT extern const Utils::Icon RESET;
CORE_EXPORT extern const Utils::Icon DARK_CLOSE;
CORE_EXPORT extern const Utils::Icon LOCKED_TOOLBAR;
CORE_EXPORT extern const Utils::Icon LOCKED;
CORE_EXPORT extern const Utils::Icon UNLOCKED;
CORE_EXPORT extern const Utils::Icon UNLOCKED_TOOLBAR;
CORE_EXPORT extern const Utils::Icon FIND_CASE_INSENSITIVELY;
CORE_EXPORT extern const Utils::Icon FIND_WHOLE_WORD;
CORE_EXPORT extern const Utils::Icon FIND_REGEXP;

View File

@@ -48,7 +48,6 @@ class DocumentModelPrivate : public QAbstractItemModel
Q_OBJECT
public:
DocumentModelPrivate();
~DocumentModelPrivate();
int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -70,6 +69,8 @@ public:
bool disambiguateDisplayNames(DocumentModel::Entry *entry);
static QIcon lockedIcon();
private:
friend class DocumentModel;
void itemChanged();
@@ -101,20 +102,11 @@ private:
}
};
const QIcon m_lockedIcon;
const QIcon m_unlockedIcon;
QList<DocumentModel::Entry *> m_entries;
QMap<IDocument *, QList<IEditor *> > m_editors;
QHash<QString, DocumentModel::Entry *> m_entryByFixedPath;
};
DocumentModelPrivate::DocumentModelPrivate() :
m_lockedIcon(Icons::LOCKED.icon()),
m_unlockedIcon(Icons::UNLOCKED.icon())
{
}
DocumentModelPrivate::~DocumentModelPrivate()
{
qDeleteAll(m_entries);
@@ -150,12 +142,7 @@ void DocumentModel::destroy()
QIcon DocumentModel::lockedIcon()
{
return d->m_lockedIcon;
}
QIcon DocumentModel::unlockedIcon()
{
return d->m_unlockedIcon;
return DocumentModelPrivate::lockedIcon();
}
QAbstractItemModel *DocumentModel::model()
@@ -340,6 +327,12 @@ bool DocumentModelPrivate::disambiguateDisplayNames(DocumentModel::Entry *entry)
return true;
}
QIcon DocumentModelPrivate::lockedIcon()
{
const static QIcon icon = Icons::LOCKED.icon();
return icon;
}
int DocumentModelPrivate::indexOfFilePath(const Utils::FileName &filePath) const
{
if (filePath.isEmpty())
@@ -535,7 +528,7 @@ QVariant DocumentModelPrivate::data(const QModelIndex &index, int role) const
return name;
}
case Qt::DecorationRole:
return e->document->isFileReadOnly() ? m_lockedIcon : QIcon();
return e->document->isFileReadOnly() ? lockedIcon() : QIcon();
case Qt::ToolTipRole:
return e->fileName().isEmpty() ? e->displayName() : e->fileName().toUserOutput();
default:

View File

@@ -47,8 +47,6 @@ public:
static void destroy();
static QIcon lockedIcon();
static QIcon unlockedIcon();
static QAbstractItemModel *model();
struct CORE_EXPORT Entry {

View File

@@ -413,11 +413,13 @@ void EditorToolBar::updateDocumentStatus(IDocument *document)
d->m_lockButton->setEnabled(false);
d->m_lockButton->setToolTip(QString());
} else if (document->isFileReadOnly()) {
d->m_lockButton->setIcon(DocumentModel::lockedIcon());
const static QIcon locked = Icons::LOCKED_TOOLBAR.icon();
d->m_lockButton->setIcon(locked);
d->m_lockButton->setEnabled(true);
d->m_lockButton->setToolTip(tr("Make Writable"));
} else {
d->m_lockButton->setIcon(DocumentModel::unlockedIcon());
const static QIcon unlocked = Icons::UNLOCKED_TOOLBAR.icon();
d->m_lockButton->setIcon(unlocked);
d->m_lockButton->setEnabled(false);
d->m_lockButton->setToolTip(tr("File is writable"));
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 189 B

View File

@@ -485,15 +485,16 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
anim->paint(painter, option);
} else {
bool pressed = option->state & State_Sunken || option->state & State_On;
QColor shadow(0, 0, 0, 30);
painter->setPen(shadow);
painter->setPen(StyleHelper::sidebarShadow());
if (pressed) {
const QColor shade = creatorTheme()->color(Theme::FancyToolButtonSelectedColor);
painter->fillRect(rect, shade);
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) {
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
painter->drawLine(borderRect.topLeft() + QPointF(1, 0), borderRect.topRight() - QPointF(1, 0));
painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft());
painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
}
} else if (option->state & State_Enabled && option->state & State_MouseOver) {
painter->fillRect(rect, creatorTheme()->color(Theme::FancyToolButtonHoverColor));
} else if (widget && widget->property("highlightWidget").toBool()) {

View File

@@ -78,6 +78,7 @@ OutputPanePlaceHolder::~OutputPanePlaceHolder()
om->setParent(0);
om->hide();
}
OutputPanePlaceHolderPrivate::m_current = nullptr;
}
delete d;
}

View File

@@ -244,11 +244,14 @@ void ProgressBar::paintEvent(QPaintEvent *)
// Draw separator
int separatorHeight = m_separatorVisible ? SEPARATOR_HEIGHT : 0;
if (m_separatorVisible) {
QRectF innerRect = QRectF(this->rect()).adjusted(0.5, 0.5, -0.5, -0.5);
p.setPen(StyleHelper::sidebarShadow());
p.drawLine(0,0, size().width(), 0);
p.drawLine(innerRect.topLeft(), innerRect.topRight());
if (creatorTheme()->flag(Theme::DrawToolBarHighlights)) {
p.setPen(StyleHelper::sidebarHighlight());
p.drawLine(1, 1, size().width(), 1);
p.drawLine(innerRect.topLeft() + QPointF(1, 1), innerRect.topRight() + QPointF(0, 1));
}
}
if (m_titleVisible) {

View File

@@ -2502,6 +2502,8 @@ void DebuggerPluginPrivate::setInitialState()
void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
{
if (m_shuttingDown)
return;
QTC_ASSERT(engine, return);
QTC_ASSERT(m_watchersView->model(), return);
QTC_ASSERT(m_returnView->model(), return);
@@ -2647,6 +2649,8 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
void DebuggerPluginPrivate::updateDebugActions()
{
if (m_shuttingDown)
return;
//if we're currently debugging the actions are controlled by engine
if (m_currentEngine->state() != DebuggerNotReady)
return;
@@ -2775,6 +2779,8 @@ QTreeView *inspectorView()
void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int timeout)
{
if (m_shuttingDown)
return;
//qDebug() << "PLUGIN OUTPUT: " << channel << msg;
QTC_ASSERT(m_logWindow, return);
switch (channel) {

View File

@@ -232,8 +232,11 @@ bool DebuggerRunControl::promptToStop(bool *optionalPrompt) const
"Terminating the session in the current"
" state can leave the target in an inconsistent state."
" Would you still like to terminate it?");
return showPromptToStopDialog(tr("Close Debugging Session"), question,
bool result = showPromptToStopDialog(tr("Close Debugging Session"), question,
QString(), QString(), optionalPrompt);
if (result)
disconnect(this);
return result;
}
RunControl::StopResult DebuggerRunControl::stop()

View File

@@ -137,7 +137,7 @@ void IosProbe::setupDefaultToolchains(const QString &devPath, const QString &xco
if (name != QLatin1String("macosx") && name != QLatin1String("iphoneos")
&& name != QLatin1String("iphonesimulator"))
{
qCWarning(probeLog) << indent << QString::fromLatin1("Skipping unknown platform %1").arg(name);
qCDebug(probeLog) << indent << QString::fromLatin1("Skipping unknown platform %1").arg(name);
continue;
}

View File

@@ -99,7 +99,7 @@ static const FileTypeDataStorage fileTypeDataStorage[] = {
":/qmakeprojectmanager/images/sources.png", "*.c; *.cc; *.cpp; *.cp; *.cxx; *.c++;" },
{ FormType, Theme::ProjectExplorerForm, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "Forms"),
":/qtsupport/images/forms.png", "*.ui;" },
{ StateChartType, Theme::ProjectExplorerForm, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "StateCharts"),
{ StateChartType, Theme::ProjectExplorerForm, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "State charts"),
":/qtsupport/images/statecharts.png", "*.scxml;" },
{ ResourceType, Theme::ProjectExplorerResource, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "Resources"),
":/qtsupport/images/qt_qrc.png", "*.qrc;" },
@@ -2107,9 +2107,7 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
// we are changing what is executed in that case
if (result->state == EvalResult::EvalFail || m_project->wasEvaluateCanceled()) {
m_validParse = false;
m_project->destroyProFileReader(m_readerExact);
m_project->destroyProFileReader(m_readerCumulative);
m_readerExact = m_readerCumulative = 0;
cleanupProFileReaders();
setValidParseRecursive(false);
setParseInProgressRecursive(false);
@@ -2305,8 +2303,8 @@ void QmakeProFileNode::cleanupProFileReaders()
m_project->destroyProFileReader(m_readerExact);
m_project->destroyProFileReader(m_readerCumulative);
m_readerExact = 0;
m_readerCumulative = 0;
m_readerExact = nullptr;
m_readerCumulative = nullptr;
}
QStringList QmakeProFileNode::fileListForVar(QtSupport::ProFileReader *readerExact, QtSupport::ProFileReader *readerCumulative,

View File

@@ -299,6 +299,10 @@ QmakeProject::~QmakeProject()
{
m_codeModelFuture.cancel();
m_asyncUpdateState = ShuttingDown;
// Make sure root node (and associated readers) are shut hown before proceeding
setRootProjectNode(nullptr);
projectManager()->unregisterProject(this);
delete m_projectFiles;
m_cancelEvaluate = true;
@@ -392,7 +396,7 @@ void QmakeProject::updateCppCodeModel()
typedef CppTools::ProjectPart ProjectPart;
typedef CppTools::ProjectFile ProjectFile;
Kit *k = 0;
Kit *k = nullptr;
if (Target *target = activeTarget())
k = target->kit();
else
@@ -729,7 +733,7 @@ void QmakeProject::decrementPendingEvaluateFutures()
m_asyncUpdateFutureInterface->reportFinished();
delete m_asyncUpdateFutureInterface;
m_asyncUpdateFutureInterface = 0;
m_asyncUpdateFutureInterface = nullptr;
m_cancelEvaluate = false;
// TODO clear the profile cache ?
@@ -940,7 +944,7 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFileNo
}
++m_qmakeGlobalsRefCnt;
QtSupport::ProFileReader *reader = new QtSupport::ProFileReader(m_qmakeGlobals, m_qmakeVfs);
auto reader = new QtSupport::ProFileReader(m_qmakeGlobals, m_qmakeVfs);
reader->setOutputDir(qmakeProFileNode->buildDir());
@@ -968,7 +972,7 @@ void QmakeProject::destroyProFileReader(QtSupport::ProFileReader *reader)
QtSupport::ProFileCacheManager::instance()->decRefCount();
delete m_qmakeGlobals;
m_qmakeGlobals = 0;
m_qmakeGlobals = nullptr;
}
}

View File

@@ -295,10 +295,10 @@ void QmlProfilerTool::updateRunActions()
{
if (d->m_toolBusy) {
d->m_startAction->setEnabled(false);
d->m_startAction->setToolTip(tr("A Qml Profiler analysis is still in progress."));
d->m_startAction->setToolTip(tr("A QML Profiler analysis is still in progress."));
d->m_stopAction->setEnabled(true);
} else {
QString whyNot = tr("Start Qml Profiler analysis.");
QString whyNot = tr("Start QML Profiler analysis.");
bool canRun = ProjectExplorerPlugin::canRunStartupProject
(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, &whyNot);
d->m_startAction->setToolTip(whyNot);
@@ -429,7 +429,7 @@ void QmlProfilerTool::recordingButtonChanged(bool recording)
void QmlProfilerTool::setRecording(bool recording)
{
// update display
d->m_recordButton->setToolTip( recording ? tr("Disable profiling") : tr("Enable profiling"));
d->m_recordButton->setToolTip( recording ? tr("Disable Profiling") : tr("Enable Profiling"));
d->m_recordButton->setIcon(QIcon(recording ? QLatin1String(":/qmlprofiler/recordOn.png") :
QLatin1String(":/qmlprofiler/recordOff.png")));

View File

@@ -248,35 +248,16 @@ bool Manager::isBuildingDefinition(const QString &id) const
return m_isBuildingDefinition.contains(id);
}
class ManagerProcessor
{
public:
ManagerProcessor();
// TODO: make move-only when we can require MSVC2015
static const int kMaxProgress = 200;
void operator()(QFutureInterface<Manager::RegisterData> &future);
QStringList m_definitionsPaths;
static const int kMaxProgress;
};
const int ManagerProcessor::kMaxProgress = 200;
ManagerProcessor::ManagerProcessor()
{
const HighlighterSettings &settings = TextEditorSettings::highlighterSettings();
m_definitionsPaths.append(settings.definitionFilesPath());
if (settings.useFallbackLocation())
m_definitionsPaths.append(settings.fallbackDefinitionFilesPath());
}
void ManagerProcessor::operator()(QFutureInterface<Manager::RegisterData> &future)
static void processHighlightingFiles(QFutureInterface<Manager::RegisterData> &future,
QStringList definitionPaths)
{
future.setProgressRange(0, kMaxProgress);
Manager::RegisterData data;
// iterate through paths in order, high priority > low priority
foreach (const QString &path, m_definitionsPaths) {
foreach (const QString &path, definitionPaths) {
if (path.isEmpty())
continue;
@@ -322,7 +303,13 @@ void Manager::registerHighlightingFiles()
if (!m_registeringWatcher.isRunning()) {
clear();
QFuture<RegisterData> future = Utils::runAsync(ManagerProcessor());
QStringList definitionsPaths;
const HighlighterSettings &settings = TextEditorSettings::highlighterSettings();
definitionsPaths.append(settings.definitionFilesPath());
if (settings.useFallbackLocation())
definitionsPaths.append(settings.fallbackDefinitionFilesPath());
QFuture<RegisterData> future = Utils::runAsync(processHighlightingFiles, definitionsPaths);
m_registeringWatcher.setFuture(future);
} else {
m_hasQueuedRegistration = true;
@@ -408,7 +395,7 @@ QList<DefinitionMetaDataPtr> Manager::parseAvailableDefinitionsList(QIODevice *d
void Manager::downloadAvailableDefinitionsMetaData()
{
QUrl url(QLatin1String("http://www.kate-editor.org/syntax/update-5.17.xml"));
QUrl url(QLatin1String("https://www.kate-editor.org/syntax/update-5.17.xml"));
QNetworkRequest request(url);
// Currently this takes a couple of seconds on Windows 7: QTBUG-10106.
QNetworkReply *reply = Utils::NetworkAccessManager::instance()->get(request);

View File

@@ -79,6 +79,12 @@ public:
static DefinitionMetaDataPtr parseMetadata(const QFileInfo &fileInfo);
struct RegisterData
{
QHash<QString, QString> m_idByName;
QHash<QString, QString> m_idByMimeType;
QHash<QString, DefinitionMetaDataPtr> m_definitionsMetaData;
};
private:
void registerHighlightingFilesFinished();
void downloadAvailableDefinitionsListFinished();
@@ -99,12 +105,6 @@ private:
QHash<QString, QSharedPointer<HighlightDefinition> > m_definitions;
QHash<QString, DefinitionMetaDataPtr> m_availableDefinitions;
struct RegisterData
{
QHash<QString, QString> m_idByName;
QHash<QString, QString> m_idByMimeType;
QHash<QString, DefinitionMetaDataPtr> m_definitionsMetaData;
};
RegisterData m_register;
bool m_hasQueuedRegistration;
QFutureWatcher<RegisterData> m_registeringWatcher;

View File

@@ -1964,71 +1964,54 @@
style="" />
</g>
<g
style="display:inline"
id="src/plugins/coreplugin/images/locked"
transform="translate(-300,-16)">
transform="translate(0,16)">
<rect
y="584"
x="597"
id="rect5031-6"
height="16"
width="16"
id="rect3958"
style="fill:none;stroke:none" />
<g
id="g4285"
style="opacity:0.4">
<rect
ry="2"
transform="translate(300,16)"
y="574"
x="299"
height="9"
width="12"
id="rect3511"
style="fill:#ffffff;fill-opacity:1;stroke:none" />
y="552"
x="297"
style="fill:#ffffff;fill-opacity:1" />
<path
style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 601.5,591.5 0,-1.5 c 0,-3 2,-3.5 3.5,-3.5 1.5,0 3.5,0.5 3.5,3.5 l 0,1.5"
id="path4283"
style="fill:#000000;fill-opacity:1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cszsc" />
</g>
d="m 304.999,554 c -1.656,0 -2.999,1.343 -2.999,3 l 0,3 1,0 0,-3 c 0,-1.103 0.896,-2 1.999,-2 1.103,0 2.001,0.897 2.001,2 l 0,3 1,0 0,-3 c 0,-1.657 -1.343,-3 -3.001,-3 z"
id="lockbow" />
<path
style="fill:#585858;fill-opacity:1;stroke:none"
d="m 601,591 c -0.554,0 -1,0.446 -1,1 l 0,5 c 0,0.554 0.446,1 1,1 l 8,0 c 0.554,0 1,-0.446 1,-1 l 0,-5 c 0,-0.554 -0.446,-1 -1,-1 l -8,0 z m 4.15625,2 c 0.5,0 1.39285,1.12164 -0.125,1.5 0,0.74317 1,0.47785 1,1.46875 -1.02256,0.0161 -2.04255,-0.4686 -2.03125,-1.71875 0.008,-0.93759 0.65625,-1.25 1.15625,-1.25 z"
id="lock_body"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#585858;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 601.5,591.5 0,-1.5 c 0,-3 2,-3.5 3.5,-3.5 1.5,0 3.5,0.5 3.5,3.5 l 0,1.5"
id="path3184"
style="fill:#000000;fill-opacity:1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cszsc" />
d="m 301,559 0,7 8,0 0,-7 -8,0 z m 4.5,3.847 0,1.153 -1,0 0,-1.153 c -0.293,-0.175 -0.5,-0.48 -0.5,-0.847 0,-0.553 0.448,-1 1,-1 0.552,0 1,0.447 1,1 0,0.366 -0.207,0.672 -0.5,0.847 z"
id="lockbody" />
</g>
<g
style="display:inline"
transform="translate(-284,-16)"
id="src/plugins/coreplugin/images/unlocked">
id="src/plugins/coreplugin/images/unlocked"
transform="translate(-16,16)">
<rect
y="584"
x="597"
id="rect5041-1"
height="16"
width="16"
id="rect3958-7"
style="fill:none;stroke:none" />
<path
style="fill:none;stroke:#585858;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 612.5,590 0,-2.5 c 0,-2 -2,-2 -2.5,-2 -0.5,0 -2.5,-3e-5 -2.5,2.5 l 0,3"
id="path3184-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cszsc" />
y="552"
x="329"
style="fill:#ffffff;fill-opacity:1" />
<use
transform="translate(36,0)"
style="display:inline"
x="0"
y="0"
xlink:href="#lock_body"
id="use3213"
width="800"
height="600" />
xlink:href="#lockbow"
id="use6038"
width="100%"
height="100%" />
<use
transform="translate(31,0)"
style="display:inline"
x="0"
y="0"
xlink:href="#lockbody"
id="use6055"
width="100%"
height="100%" />
</g>
<g
id="src/plugins/diffeditor/images/unifieddiff"

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 142 KiB

View File

@@ -4,7 +4,6 @@ SUBDIRS= \
fakevim \
debugger \
subdir_proparser \
utils \
shootout
unix {

View File

@@ -1,37 +0,0 @@
#include <QCoreApplication>
#include <utils/tcpportsgatherer.h>
#include <QDebug>
#include <QStringList>
using namespace Utils;
int main()
{
qDebug() << "Used TCP Ports (IP4):";
TcpPortsGatherer portsGatherer;
portsGatherer.update(QAbstractSocket::IPv4Protocol);
qDebug() << portsGatherer.usedPorts();
qDebug() << "Used TCP Ports (IP6):";
portsGatherer.update(QAbstractSocket::IPv6Protocol);
qDebug() << portsGatherer.usedPorts();
qDebug() << "All Used TCP Ports:";
portsGatherer.update(QAbstractSocket::UnknownNetworkLayerProtocol);
qDebug() << portsGatherer.usedPorts();
qDebug() << "Getting a few ports ...";
PortList portList = PortList::fromString(QLatin1String("10000-10100"));
QStringList ports;
for (int i = 0; i < 10; ++i) {
quint16 port = portsGatherer.getNextFreePort(&portList);
Q_ASSERT(!portsGatherer.usedPorts().contains(port));
Q_ASSERT(port >= 10000);
Q_ASSERT(port < 10100);
QString portStr = QString::number(port);
Q_ASSERT(!ports.contains(portStr));
ports.append(QString::number(port));
}
qDebug() << ports.join(QLatin1String(", "));
return 0;
}

View File

@@ -1,8 +0,0 @@
QTC_LIB_DEPENDS += utils
include(../../../auto/qttest.pri)
QT += network
CONFIG += console
CONFIG -= app_bundle
SOURCES += main.cpp

View File

@@ -1,24 +0,0 @@
import qbs 1.0
Application {
name: "tcpportsgatherer"
files: [
"main.cpp",
"../../../../src/libs/utils/portlist.cpp",
"../../../../src/libs/utils/portlist.h",
"../../../../src/libs/utils/tcpportsgatherer.cpp",
"../../../../src/libs/utils/tcpportsgatherer.h"
]
cpp.includePaths: [ "../../../../src/libs" ]
cpp.defines: [ "QTCREATOR_UTILS_STATIC_LIB" ]
Properties {
condition: qbs.targetOS == "windows"
cpp.dynamicLibraries: [ "iphlpapi.lib", "ws2_32.lib" ]
}
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["widgets"] }
}

View File

@@ -1,3 +0,0 @@
TEMPLATE = subdirs
SUBDIRS = tcpportsgatherer

View File

@@ -33,6 +33,7 @@ import subprocess;
import sys
import errno;
from datetime import datetime,timedelta;
import __builtin__
srcPath = ''
SettingsPath = ''
@@ -116,6 +117,16 @@ def waitForCleanShutdown(timeOut=10):
shutdownDone=True
if not shutdownDone and datetime.utcnow() > endtime:
break
if platform.system() == 'Linux' and JIRA.isBugStillOpen(15749):
pgrepOutput = getOutputFromCmdline('pgrep -f qtcreator_process_stub')
pids = pgrepOutput.splitlines()
if len(pids):
print("Killing %d qtcreator_process_stub instances" % len(pids))
for pid in pids:
try:
os.kill(__builtin__.int(pid), 9)
except OSError: # we might kill the parent before the current pid
pass
def checkForStillRunningQmlExecutable(possibleNames):
for qmlHelper in possibleNames:

View File

@@ -110,6 +110,9 @@ def testLoggingFeatures():
clickButton(":*Qt Creator.Clear_QToolButton")
def main():
test.warning("This test must be rewritten (QTCREATORBUG-15831)") # QmlJS Console has changed
return
projName = "simpleQuickUI2.qmlproject"
projFolder = os.path.dirname(findFile("testdata", "simpleQuickUI2/%s" % projName))
if not neededFilePresent(os.path.join(projFolder, projName)):