diff options
208 files changed, 2306 insertions, 2236 deletions
diff --git a/README.md b/README.md index 1eda6a3c466..5a07dc05249 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ Windows XP SP3 or later (K)Ubuntu Linux 11.10 (32-bit and 64-bit) or later Mac OS X 10.7 or later -Building the sources requires Qt 5.4.0 or later. +Building the sources requires Qt 5.5.0 or later. ## Compiling Qt Creator Prerequisites: -* Qt 5.4.0 or later +* Qt 5.5.0 or later * On Windows: * ActiveState Active Perl * MinGW with g++ 4.7 or Visual Studio 2013 Update 2 or later @@ -58,7 +58,7 @@ For detailed information on the supported compilers, see for example, `c:\work`. If you plan to use MinGW and Microsoft Visual Studio simultaneously or mix different Qt versions, we recommend creating a directory structure which reflects that. For example: - `C:\work\qt5.4.1-vs12, C:\work\qt5.4.1-mingw`. + `C:\work\qt5.5.1-vs12, C:\work\qt5.5.1-mingw`. 4. Download and install Perl from <https://www.activestate.com/activeperl> and check that perl.exe is added to the path. Run `perl -v` to verify diff --git a/qbs/imports/QtcPlugin.qbs b/qbs/imports/QtcPlugin.qbs index 8433566589d..3999a939c2d 100644 --- a/qbs/imports/QtcPlugin.qbs +++ b/qbs/imports/QtcPlugin.qbs @@ -10,7 +10,7 @@ QtcProduct { property var pluginRecommends: [] property var pluginTestDepends: [] - property string minimumQtVersion: "5.4.0" + property string minimumQtVersion: "5.5.0" condition: QtcFunctions.versionIsAtLeast(Qt.core.version, minimumQtVersion) targetName: QtcFunctions.qtLibraryName(qbs, name) diff --git a/qtcreator.pro b/qtcreator.pro index 941b517ed64..f124bfdc373 100644 --- a/qtcreator.pro +++ b/qtcreator.pro @@ -1,9 +1,9 @@ include(qtcreator.pri) #version check qt -!minQtVersion(5, 4, 0) { +!minQtVersion(5, 5, 0) { message("Cannot build Qt Creator with Qt version $${QT_VERSION}.") - error("Use at least Qt 5.4.0.") + error("Use at least Qt 5.5.0.") } include(doc/doc.pri) diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index 65fac46b43e..b2b0ffd4eb3 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -2152,15 +2152,23 @@ def qdump__QVariant(d, value): data = value["d"]["data"] ns = d.qtNamespace() inner = ns + innert - if d.isLldb: - # Looking up typedefs is problematic. + innerType = d.lookupType(inner) + + if innerType is None: + # Looking up typedefs is problematic with LLDB, and can also + # happen with GDB e.g. in the QVariant2 dumper test on x86 + # unless further use of the empty QVariantHash is added. if innert == "QVariantMap": inner = "%sQMap<%sQString, %sQVariant>" % (ns, ns, ns) elif innert == "QVariantHash": inner = "%sQHash<%sQString, %sQVariant>" % (ns, ns, ns) elif innert == "QVariantList": inner = "%sQList<%sQVariant>" % (ns, ns) - innerType = d.lookupType(inner) + innerType = d.lookupType(inner) + + if innerType is None: + self.putSpecialValue("notaccessible") + return innert if toInteger(value["d"]["is_shared"]): val = data["ptr"].cast(innerType.pointer().pointer()).dereference().dereference() diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/designercustomobjectdata.cpp b/share/qtcreator/qml/qmlpuppet/qmlprivategate/designercustomobjectdata.cpp index 47fb109293e..2623661c332 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/designercustomobjectdata.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/designercustomobjectdata.cpp @@ -121,7 +121,7 @@ void DesignerCustomObjectData::populateResetHashes() PropertyNameList propertyNameList = QmlPrivateGate::propertyNameListForWritableProperties(object()); foreach (const PropertyName &propertyName, propertyNameList) { - QQmlProperty property(object(), propertyName, QQmlEngine::contextForObject(object())); + QQmlProperty property(object(), QString::fromUtf8(propertyName), QQmlEngine::contextForObject(object())); #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) QQmlAbstractBinding::Ptr binding = QQmlAbstractBinding::Ptr(QQmlPropertyPrivate::binding(property)); @@ -154,7 +154,7 @@ QVariant DesignerCustomObjectData::getResetValue(const PropertyName &propertyNam void DesignerCustomObjectData::doResetProperty(QQmlContext *context, const PropertyName &propertyName) { - QQmlProperty property(object(), propertyName, context); + QQmlProperty property(object(), QString::fromUtf8(propertyName), context); if (!property.isValid()) return; @@ -230,7 +230,7 @@ bool DesignerCustomObjectData::hasBindingForProperty(QQmlContext *context, const if (QmlPrivateGate::isPropertyBlackListed(propertyName)) return false; - QQmlProperty property(object(), propertyName, context); + QQmlProperty property(object(), QString::fromUtf8(propertyName), context); bool hasBinding = QQmlPropertyPrivate::binding(property); @@ -245,7 +245,7 @@ bool DesignerCustomObjectData::hasBindingForProperty(QQmlContext *context, const void DesignerCustomObjectData::setPropertyBinding(QQmlContext *context, const PropertyName &propertyName, const QString &expression) { - QQmlProperty property(object(), propertyName, context); + QQmlProperty property(object(), QString::fromUtf8(propertyName), context); if (!property.isValid()) return; @@ -281,7 +281,7 @@ void DesignerCustomObjectData::keepBindingFromGettingDeleted(QQmlContext *contex Q_UNUSED(context) Q_UNUSED(propertyName) #else - QQmlProperty property(object(), propertyName, context); + QQmlProperty property(object(), QString::fromUtf8(propertyName), context); QQmlPropertyPrivate::setBinding(property, 0, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding); #endif diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp index 7fe7d70991f..2762f111e61 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp @@ -199,7 +199,7 @@ static void allSubObject(QObject *object, QObjectList &objectList) if (metaProperty.isReadable() && metaProperty.isWritable() && QQmlMetaType::isQObject(metaProperty.userType())) { - if (metaProperty.name() != QLatin1String("parent")) { + if (metaProperty.name() != "parent") { QObject *propertyObject = QQmlMetaType::toQObject(metaProperty.read(object)); allSubObject(propertyObject, objectList); } @@ -242,7 +242,7 @@ static void fixResourcePathsForObject(QObject *object) PropertyNameList propertyNameList = propertyNameListForWritableProperties(object); foreach (const PropertyName &propertyName, propertyNameList) { - QQmlProperty property(object, propertyName, QQmlEngine::contextForObject(object)); + QQmlProperty property(object, QString::fromUtf8(propertyName), QQmlEngine::contextForObject(object)); const QVariant value = property.read(); const QVariant fixedValue = fixResourcePaths(value); @@ -289,7 +289,7 @@ static bool isWindow(QObject *object) { static QQmlType *getQmlType(const QString &typeName, int majorNumber, int minorNumber) { - return QQmlMetaType::qmlType(typeName.toUtf8(), majorNumber, minorNumber); + return QQmlMetaType::qmlType(typeName, majorNumber, minorNumber); } static bool isCrashingType(QQmlType *type) @@ -380,7 +380,7 @@ QVariant fixResourcePaths(const QVariant &value) const QUrl url = value.toUrl(); if (url.scheme() == QLatin1String("qrc")) { const QString path = QLatin1String("qrc:") + url.path(); - QString qrcSearchPath = qgetenv("QMLDESIGNER_RC_PATHS"); + QString qrcSearchPath = QString::fromLocal8Bit(qgetenv("QMLDESIGNER_RC_PATHS")); if (!qrcSearchPath.isEmpty()) { const QStringList searchPaths = qrcSearchPath.split(QLatin1Char(';')); foreach (const QString &qrcPath, searchPaths) { @@ -401,7 +401,7 @@ QVariant fixResourcePaths(const QVariant &value) if (value.type() == QVariant::String) { const QString str = value.toString(); if (str.contains(QLatin1String("qrc:"))) { - QString qrcSearchPath = qgetenv("QMLDESIGNER_RC_PATHS"); + QString qrcSearchPath = QString::fromLocal8Bit(qgetenv("QMLDESIGNER_RC_PATHS")); if (!qrcSearchPath.isEmpty()) { const QStringList searchPaths = qrcSearchPath.split(QLatin1Char(';')); foreach (const QString &qrcPath, searchPaths) { @@ -695,7 +695,7 @@ void removeProperty(QObject *propertyChanges, const PropertyName &propertyName) if (!propertyChange) return; - propertyChange->removeProperty(propertyName); + propertyChange->removeProperty(QString::fromUtf8(propertyName)); } QVariant getProperty(QObject *propertyChanges, const PropertyName &propertyName) @@ -705,7 +705,7 @@ QVariant getProperty(QObject *propertyChanges, const PropertyName &propertyName) if (!propertyChange) return QVariant(); - return propertyChange->property(propertyName); + return propertyChange->property(QString::fromUtf8(propertyName)); } void changeValue(QObject *propertyChanges, const PropertyName &propertyName, const QVariant &value) @@ -715,7 +715,7 @@ void changeValue(QObject *propertyChanges, const PropertyName &propertyName, con if (!propertyChange) return; - propertyChange->changeValue(propertyName, value); + propertyChange->changeValue(QString::fromUtf8(propertyName), value); } void changeExpression(QObject *propertyChanges, const PropertyName &propertyName, const QString &expression) @@ -725,7 +725,7 @@ void changeExpression(QObject *propertyChanges, const PropertyName &propertyName if (!propertyChange) return; - propertyChange->changeExpression(propertyName, expression); + propertyChange->changeExpression(QString::fromUtf8(propertyName), expression); } QObject *stateObject(QObject *propertyChanges) diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json index 379d1d821f7..781b6471424 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json +++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json @@ -34,7 +34,7 @@ "trDisplayName": "Class name:", "mandatory": true, "type": "LineEdit", - "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" } + "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)" } }, { "name": "BaseCB", diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json b/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json index 97be3ba2e19..7ebea4c3b07 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json +++ b/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json @@ -31,7 +31,7 @@ "trDisplayName": "Class name:", "mandatory": true, "type": "LineEdit", - "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" } + "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)" } }, { "name": "Base", diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index 04274145772..2aeeabb8e35 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -1,5 +1,5 @@ [General] -ThemeName=dark +ThemeName=Dark PreferredStyles=Fusion DefaultTextEditorColorScheme=dark.xml @@ -7,8 +7,8 @@ DefaultTextEditorColorScheme=dark.xml shadowBackground=ff232323 text=ffe7e7e7 textDisabled=7fffffff -hoverBackground=ff515151 -selectedBackground=ff151515 +hoverBackground=18ffffff +selectedBackground=46ffffff normalBackground=ff333333 alternateBackground=ff515151 error=ffff0000 @@ -19,7 +19,7 @@ BackgroundColorDark=shadowBackground BackgroundColorHover=hoverBackground BackgroundColorNormal=normalBackground BackgroundColorDisabled=ff444444 -BackgroundColorSelected=ff909090 +BackgroundColorSelected=selectedBackground BadgeLabelBackgroundColorChecked=normalBackground BadgeLabelBackgroundColorUnchecked=selectedBackground BadgeLabelTextColorChecked=text @@ -47,7 +47,7 @@ FancyTabWidgetDisabledUnselectedTextColor=textDisabled FancyTabWidgetEnabledSelectedTextColor=text FancyTabWidgetEnabledUnselectedTextColor=text FancyToolButtonHoverColor=35ffffff -FancyToolButtonSelectedColor=7effffff +FancyToolButtonSelectedColor=selectedBackground FutureProgressBackgroundColor=shadowBackground IconsBaseColor=ffdcdcdc IconsDisabledColor=textDisabled @@ -83,7 +83,6 @@ MiniProjectTargetSelectorBackgroundColor=shadowBackground MiniProjectTargetSelectorBorderColor=shadowBackground MiniProjectTargetSelectorSummaryBackgroundColor=shadowBackground MiniProjectTargetSelectorTextColor=text -PanelButtonToolBackgroundColorHover=hoverBackground PanelStatusBarBackgroundColor=shadowBackground PanelsWidgetSeparatorLineColor=0 PanelTextColorDark=text @@ -93,6 +92,7 @@ ProgressBarColorError=error ProgressBarColorFinished=ff5aaa3c ProgressBarColorNormal=ff808080 ProgressBarTitleColor=text +ProgressBarBackgroundColor=normalBackground SplitterColor=ff313131 TextColorDisabled=textDisabled TextColorError=ffff4040 @@ -113,6 +113,14 @@ OutputPanes_NormalMessageTextColor=text OutputPanes_StdErrTextColor=ffff6666 OutputPanes_StdOutTextColor=text OutputPanes_WarningMessageTextColor=fff3c300 +OutputPanes_TestPassTextColor=ff00b400 +OutputPanes_TestFailTextColor=ffc82828 +OutputPanes_TestXFailTextColor=ff28dc28 +OutputPanes_TestXPassTextColor=ffdc2828 +OutputPanes_TestSkipTextColor=ff828282 +OutputPanes_TestWarnTextColor=ffc8c800 +OutputPanes_TestFatalTextColor=ffb42828 +OutputPanes_TestDebugTextColor=ff329696 OutputPaneButtonFlashColor=error OutputPaneToggleButtonTextColorChecked=text OutputPaneToggleButtonTextColorUnchecked=text @@ -127,25 +135,14 @@ Debugger_WatchItem_ValueChanged=ffbf0303 Debugger_Breakpoint_TextMarkColor=ffff4040 -Welcome_BackgroundColorNormal=normalBackground -Welcome_Button_BorderColorNormal=0 -Welcome_Button_BorderColorPressed=0 -Welcome_Button_TextColorNormal=ffe7e7e7 -Welcome_Button_TextColorPressed=ffffffff -Welcome_Caption_TextColorNormal=ff4acb47 -Welcome_DividerColor=ff232323 -Welcome_Link_BackgroundColor=ff333333 -Welcome_Link_TextColorActive=fff0f0f0 -Welcome_Link_TextColorNormal=text -Welcome_ProjectItem_BackgroundColorHover=0 -Welcome_ProjectItem_TextColorFilepath=textDisabled -Welcome_SessionItemExpanded_BackgroundColorHover=hoverBackground -Welcome_SessionItemExpanded_BackgroundColorNormal=selectedBackground -Welcome_SessionItem_BackgroundColorHover=hoverBackground -Welcome_SessionItem_BackgroundColorNormal=0 -Welcome_SideBar_BackgroundColor=ff434343 -Welcome_TextColorHeading=text -Welcome_TextColorNormal=text +Welcome_TextColor=text +Welcome_ForegroundPrimaryColor=ff999999 +Welcome_ForegroundSecondaryColor=ff808080 +Welcome_BackgroundColor=normalBackground +Welcome_ButtonBackgroundColor=normalBackground +Welcome_DividerColor=ff555555 +Welcome_HoverColor=ff444444 +Welcome_LinkColor=ff5caa15 VcsBase_FileStatusUnknown_TextColor=text VcsBase_FileAdded_TextColor=ff00ff00 diff --git a/share/qtcreator/themes/default.creatortheme b/share/qtcreator/themes/default.creatortheme index 9b7cf024ab1..5aa64a4bdc8 100644 --- a/share/qtcreator/themes/default.creatortheme +++ b/share/qtcreator/themes/default.creatortheme @@ -1,5 +1,5 @@ [General] -ThemeName=default +ThemeName=Default PreferredStyles= [Palette] @@ -34,7 +34,7 @@ DoubleTabWidget2ndTabActiveTextColor=ffffffff DoubleTabWidget2ndTabBackgroundColor=ffff0000 DoubleTabWidget2ndTabInactiveTextColor=ff000000 EditorPlaceholderColor=ffe0dcd8 -FancyToolBarSeparatorColor=ff000000 +FancyToolBarSeparatorColor=60ffffff FancyTabBarBackgroundColor=ffff0000 FancyTabWidgetDisabledSelectedTextColor=textDisabled FancyTabWidgetDisabledUnselectedTextColor=textDisabled @@ -77,8 +77,7 @@ MiniProjectTargetSelectorBackgroundColor=ffa0a0a0 MiniProjectTargetSelectorBorderColor=ff000000 MiniProjectTargetSelectorSummaryBackgroundColor=ff464646 MiniProjectTargetSelectorTextColor=a0ffffff -PanelButtonToolBackgroundColorHover=25ffffff -PanelStatusBarBackgroundColor=ffff0000 +PanelStatusBarBackgroundColor=ff626262 PanelsWidgetSeparatorLineColor=ffbfbcb8 PanelTextColorDark=darkText PanelTextColorMid=ff909090 @@ -87,6 +86,7 @@ ProgressBarColorError=d2ff3c00 ProgressBarColorFinished=ff5aaa3c ProgressBarColorNormal=b4ffffff ProgressBarTitleColor=ffffffff +ProgressBarBackgroundColor=18ffffff SplitterColor=ff151515 TextColorDisabled=ff000000 TextColorError=ffff0000 @@ -107,6 +107,14 @@ OutputPanes_NormalMessageTextColor=ff0000aa OutputPanes_StdErrTextColor=ffaa0000 OutputPanes_StdOutTextColor=ff000000 OutputPanes_WarningMessageTextColor=ff808000 +OutputPanes_TestPassTextColor=ff009900 +OutputPanes_TestFailTextColor=ffa00000 +OutputPanes_TestXFailTextColor=ff28f028 +OutputPanes_TestXPassTextColor=fff02828 +OutputPanes_TestSkipTextColor=ff787878 +OutputPanes_TestWarnTextColor=ffd0bb00 +OutputPanes_TestFatalTextColor=ff640000 +OutputPanes_TestDebugTextColor=ff329696 OutputPaneButtonFlashColor=ffff0000 OutputPaneToggleButtonTextColorChecked=ffffffff OutputPaneToggleButtonTextColorUnchecked=ff000000 @@ -121,25 +129,14 @@ Debugger_WatchItem_ValueChanged=ffc80000 Debugger_Breakpoint_TextMarkColor=ffff4040 -Welcome_BackgroundColorNormal=ffffffff -Welcome_Button_BorderColorNormal=ff737373 -Welcome_Button_BorderColorPressed=ff333333 -Welcome_Button_TextColorNormal=ff000000 -Welcome_Button_TextColorPressed=ffc0c0c0 -Welcome_Caption_TextColorNormal=ff328930 -Welcome_DividerColor=ff737373 -Welcome_Link_BackgroundColor=ff909090 -Welcome_Link_TextColorActive=fff0f0f0 -Welcome_Link_TextColorNormal=ff328930 -Welcome_ProjectItem_BackgroundColorHover=fff9f9f9 -Welcome_ProjectItem_TextColorFilepath=ff6b6b6b -Welcome_SessionItemExpanded_BackgroundColorHover=ffe9e9e9 -Welcome_SessionItemExpanded_BackgroundColorNormal=fff1f1f1 -Welcome_SessionItem_BackgroundColorHover=fff9f9f9 -Welcome_SessionItem_BackgroundColorNormal=19f9f9f9 -Welcome_SideBar_BackgroundColor=ffebebeb -Welcome_TextColorHeading=ff535353 -Welcome_TextColorNormal=ff000000 +Welcome_TextColor=ff000000 +Welcome_ForegroundPrimaryColor=ff555759 +Welcome_ForegroundSecondaryColor=ff727476 +Welcome_BackgroundColor=fff8f8f8 +Welcome_ButtonBackgroundColor=ffdfdfdf +Welcome_DividerColor=ffd6d6d6 +Welcome_HoverColor=ffe8e8e8 +Welcome_LinkColor=ff5caa15 VcsBase_FileStatusUnknown_TextColor=ff000000 VcsBase_FileAdded_TextColor=ff00aa00 diff --git a/share/qtcreator/themes/darkframe.creatortheme b/share/qtcreator/themes/defaultflat.creatortheme index 6362ee8389e..a3899aed899 100644 --- a/share/qtcreator/themes/darkframe.creatortheme +++ b/share/qtcreator/themes/defaultflat.creatortheme @@ -1,5 +1,5 @@ [General] -ThemeName=Dark Frame +ThemeName=Default Flat PreferredStyles= [Palette] @@ -7,9 +7,9 @@ shadowBackground=ff404244 text=ff000000 textDisabled=55000000 toolBarItem=b6fbfdff -toolBarItemDisabled=88a4a6a8 -hoverBackground=ff515151 -selectedBackground=ff151515 +toolBarItemDisabled=60a4a6a8 +hoverBackground=22ffffff +selectedBackground=66000000 normalBackground=ffffffff alternateBackground=ff515151 error=ffe41e25 @@ -21,7 +21,7 @@ BackgroundColorDark=shadowBackground BackgroundColorHover=hoverBackground BackgroundColorNormal=normalBackground BackgroundColorDisabled=ff444444 -BackgroundColorSelected=ff909090 +BackgroundColorSelected=selectedBackground BadgeLabelBackgroundColorChecked=ffe0e0e0 BadgeLabelBackgroundColorUnchecked=ff808080 BadgeLabelTextColorChecked=ff606060 @@ -48,8 +48,8 @@ FancyTabWidgetDisabledSelectedTextColor=toolBarItemDisabled FancyTabWidgetDisabledUnselectedTextColor=toolBarItemDisabled FancyTabWidgetEnabledSelectedTextColor=toolBarItem FancyTabWidgetEnabledUnselectedTextColor=toolBarItem -FancyToolButtonHoverColor=35ffffff -FancyToolButtonSelectedColor=66000000 +FancyToolButtonHoverColor=hoverBackground +FancyToolButtonSelectedColor=selectedBackground FutureProgressBackgroundColor=shadowBackground IconsBaseColor=toolBarItem IconsDisabledColor=toolBarItemDisabled @@ -85,7 +85,6 @@ MiniProjectTargetSelectorBackgroundColor=shadowBackground MiniProjectTargetSelectorBorderColor=shadowBackground MiniProjectTargetSelectorSummaryBackgroundColor=shadowBackground MiniProjectTargetSelectorTextColor=text -PanelButtonToolBackgroundColorHover=hoverBackground PanelStatusBarBackgroundColor=shadowBackground PanelsWidgetSeparatorLineColor=0 PanelTextColorDark=text @@ -95,6 +94,7 @@ ProgressBarColorError=ffdb6f71 ProgressBarColorFinished=dda4d576 ProgressBarColorNormal=ff999999 ProgressBarTitleColor=toolBarItem +ProgressBarBackgroundColor=a0606060 SplitterColor=splitter TextColorDisabled=textDisabled TextColorError=ffff4040 @@ -115,6 +115,14 @@ OutputPanes_NormalMessageTextColor=ff0000aa OutputPanes_StdErrTextColor=ffaa0000 OutputPanes_StdOutTextColor=ff000000 OutputPanes_WarningMessageTextColor=ff808000 +OutputPanes_TestPassTextColor=ff009900 +OutputPanes_TestFailTextColor=ffa00000 +OutputPanes_TestXFailTextColor=ff28f028 +OutputPanes_TestXPassTextColor=fff02828 +OutputPanes_TestSkipTextColor=ff787878 +OutputPanes_TestWarnTextColor=ffd0bb00 +OutputPanes_TestFatalTextColor=ff640000 +OutputPanes_TestDebugTextColor=ff329696 OutputPaneButtonFlashColor=ffff0000 OutputPaneToggleButtonTextColorChecked=toolBarItem OutputPaneToggleButtonTextColorUnchecked=toolBarItem @@ -129,25 +137,14 @@ Debugger_WatchItem_ValueChanged=ffbf0303 Debugger_Breakpoint_TextMarkColor=ffff4040 -Welcome_BackgroundColorNormal=normalBackground -Welcome_Button_BorderColorNormal=ff727476 -Welcome_Button_BorderColorPressed=ff727476 -Welcome_Button_TextColorNormal=text -Welcome_Button_TextColorPressed=text -Welcome_Caption_TextColorNormal=text +Welcome_TextColor=ff000000 +Welcome_ForegroundPrimaryColor=ff404244 +Welcome_ForegroundSecondaryColor=ff727476 +Welcome_BackgroundColor=normalBackground +Welcome_ButtonBackgroundColor=normalBackground Welcome_DividerColor=ffd6d6d6 -Welcome_Link_BackgroundColor=normalBackground -Welcome_Link_TextColorActive=text -Welcome_Link_TextColorNormal=text -Welcome_ProjectItem_BackgroundColorHover=ffd2d4d6 -Welcome_ProjectItem_TextColorFilepath=textDisabled -Welcome_SessionItemExpanded_BackgroundColorHover=hoverBackground -Welcome_SessionItemExpanded_BackgroundColorNormal=selectedBackground -Welcome_SessionItem_BackgroundColorHover=hoverBackground -Welcome_SessionItem_BackgroundColorNormal=normalBackground -Welcome_SideBar_BackgroundColor=normalBackground -Welcome_TextColorHeading=text -Welcome_TextColorNormal=text +Welcome_HoverColor=fff6f6f6 +Welcome_LinkColor=ff5caa15 VcsBase_FileStatusUnknown_TextColor=ff000000 VcsBase_FileAdded_TextColor=ff00aa00 diff --git a/share/qtcreator/welcomescreen/develop.qml b/share/qtcreator/welcomescreen/develop.qml index e865fc8c17d..a226b83f855 100644 --- a/share/qtcreator/welcomescreen/develop.qml +++ b/share/qtcreator/welcomescreen/develop.qml @@ -25,12 +25,14 @@ import QtQuick 2.1 import widgets 1.0 -import QtQuick.Controls 1.2 as Controls +import QtQuick.Controls 1.0 as Controls Controls.ScrollView { id: rectangle1 + readonly property int buttonWidth: 190 + readonly property int titleY: 50 Item { id: canvas @@ -40,90 +42,68 @@ Controls.ScrollView { Button { y: screenDependHeightDistance + width: buttonWidth text: qsTr("New Project") anchors.left: sessionsTitle.left onClicked: projectWelcomePage.newProject(); - iconSource: "widgets/images/new.png" - + iconSource: "image://icons/new/" + + ((checked || pressed) + ? "Welcome_DividerColor" + : "Welcome_ForegroundSecondaryColor") } Button { y: screenDependHeightDistance + width: buttonWidth text: qsTr("Open Project") anchors.left: recentProjectsTitle.left onClicked: projectWelcomePage.openProject(); - iconSource: "widgets/images/open.png" + iconSource: "image://icons/open/" + + ((checked || pressed) + ? "Welcome_DividerColor" + : "Welcome_ForegroundSecondaryColor") } NativeText { id: sessionsTitle x: 32 - y: screenDependHeightDistance + 77 + y: screenDependHeightDistance + titleY - color: creatorTheme.Welcome_TextColorHeading + color: creatorTheme.Welcome_TextColor text: qsTr("Sessions") font.pixelSize: 16 font.family: "Helvetica" - font.bold: true } NativeText { id: recentProjectsTitle x: 406 - y: screenDependHeightDistance + 77 - color: creatorTheme.Welcome_TextColorHeading + y: screenDependHeightDistance + titleY + color: creatorTheme.Welcome_TextColor text: qsTr("Recent Projects") anchors.left: sessionsTitle.right anchors.leftMargin: 280 - font.bold: true font.family: "Helvetica" font.pixelSize: 16 } - RecentProjects { - x: screenDependLeftMargin - - id: recentProjects - - anchors.leftMargin: 12 - anchors.left: recentProjectsTitle.left - - anchors.top: recentProjectsTitle.bottom - anchors.topMargin: 20 - - model: projectList - } - - Item { - id: actions - x: pageCaption.x + pageCaption.textOffset - - y: screenDependHeightDistance + 244 - width: 140 - height: 70 - - anchors.topMargin: 42 - anchors.top: sessions.bottom - } - - Sessions { - id: sessions - - x: 96 - y: 144 - width: 274 - - anchors.leftMargin: 12 anchors.left: sessionsTitle.left anchors.right: recentProjectsTitle.left - anchors.rightMargin: 40 anchors.top: sessionsTitle.bottom anchors.topMargin: 20 model: sessionList } + + RecentProjects { + anchors.left: recentProjectsTitle.left + anchors.top: recentProjectsTitle.bottom + anchors.topMargin: 20 + + model: projectList + } } } diff --git a/share/qtcreator/welcomescreen/examples.qml b/share/qtcreator/welcomescreen/examples.qml index 643f3727a54..063a1f5a49b 100644 --- a/share/qtcreator/welcomescreen/examples.qml +++ b/share/qtcreator/welcomescreen/examples.qml @@ -41,7 +41,6 @@ Item { model: exampleSetModel textRole: "text" - onCurrentIndexChanged: { if (comboBox.model === undefined) return; diff --git a/share/qtcreator/welcomescreen/welcomescreen.qml b/share/qtcreator/welcomescreen/welcomescreen.qml index 1f42f24a98b..62f3ccee547 100644 --- a/share/qtcreator/welcomescreen/welcomescreen.qml +++ b/share/qtcreator/welcomescreen/welcomescreen.qml @@ -62,6 +62,6 @@ Item { anchors.right: parent.right anchors.bottom: parent.bottom - color: creatorTheme.BackgroundColorNormal + color: creatorTheme.Welcome_BackgroundColor } } diff --git a/share/qtcreator/welcomescreen/widgets/Button.qml b/share/qtcreator/welcomescreen/widgets/Button.qml index c7be8574e04..75dca22d359 100644 --- a/share/qtcreator/welcomescreen/widgets/Button.qml +++ b/share/qtcreator/welcomescreen/widgets/Button.qml @@ -38,93 +38,48 @@ Button { padding.right: 14 background: Item { anchors.fill: parent + implicitWidth: 160 + implicitHeight: 30 Image { id: icon + x: 11 + y: 8 z: 1 - x: 4 - y: -6 - width: 32 - height: 32 + height: 16 + width: 16 source: button.iconSource visible: button.iconSource != "" } - implicitWidth: 160 - implicitHeight: 30 - Rectangle { + id: rectangle anchors.fill: parent - antialiasing: true - radius: (creatorTheme.WidgetStyle === 'StyleFlat') ? 0 : 3 - - visible: !(button.pressed || button.checked) - - gradient: Gradient { - GradientStop { - position: 0 - color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#232323" : "#f9f9f9" - } - - GradientStop { - position: 0.49 - color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#232323" : "#f9f9f9" - } - - GradientStop { - position: 0.5 - color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#232323" : "#eeeeee" - } - - GradientStop { - position: 1 - color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#232323" : "#eeeeee" - } - } - border.color: creatorTheme.Welcome_Button_BorderColorNormal - } - - Rectangle { - anchors.fill: parent - antialiasing: true - radius: (creatorTheme.WidgetStyle === 'StyleFlat') ? 0 : 3 - - visible: button.pressed || button.checked - - gradient: Gradient { - GradientStop { - position: 0.00; - color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#151515" : "#4c4c4c" - } - GradientStop { - position: 0.49; - color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#151515" : "#4c4c4c" - } - GradientStop { - position: 0.50; - color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#151515" : "#424242" - } - GradientStop { - position: 1.00; - color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#151515" : "#424242" - } - } - border.color: creatorTheme.Welcome_Button_BorderColorPressed - + color: (button.checked || button.pressed) + ? creatorTheme.Welcome_ForegroundPrimaryColor + : (button.hovered + ? creatorTheme.Welcome_HoverColor + : creatorTheme.Welcome_ButtonBackgroundColor) + border.width: 1 + border.color: (button.checked || button.pressed) + ? creatorTheme.Welcome_ForegroundPrimaryColor + : creatorTheme.Welcome_ForegroundSecondaryColor + radius: (creatorTheme.WidgetStyle === 'StyleFlat') ? 0 : 4 } } label: Text { - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter - text: button.text - color: button.pressed || button.checked - ? creatorTheme.Welcome_Button_TextColorPressed - : creatorTheme.Welcome_Button_TextColorNormal - font.pixelSize: 15 - font.bold: false - smooth: true - } + id: text + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + text: button.text + color: (button.checked || button.pressed) + ? creatorTheme.Welcome_BackgroundColor + : creatorTheme.Welcome_TextColor + font.pixelSize: 15 + font.bold: false + smooth: true + } } } } diff --git a/share/qtcreator/welcomescreen/widgets/Delegate.qml b/share/qtcreator/welcomescreen/widgets/Delegate.qml index 9cf1d28586c..f3ce5b5b657 100644 --- a/share/qtcreator/welcomescreen/widgets/Delegate.qml +++ b/share/qtcreator/welcomescreen/widgets/Delegate.qml @@ -29,7 +29,7 @@ Rectangle { id: delegate height: 240 width: 216 - color: creatorTheme.Welcome_BackgroundColorNormal + color: creatorTheme.Welcome_BackgroundColor property alias caption: captionItem.text property alias imageSource: imageItem.source @@ -102,7 +102,7 @@ Rectangle { y: 161 width: 200 height: 69 - color: creatorTheme.Welcome_BackgroundColorNormal + color: creatorTheme.Welcome_BackgroundColor anchors.bottom: parent.bottom anchors.right: parent.right anchors.left: parent.left @@ -112,7 +112,7 @@ Rectangle { id: captionItem x: 16 y: 170 - color: creatorTheme.Welcome_Caption_TextColorNormal + color: creatorTheme.Welcome_TextColor text: qsTr("2D PAINTING EXAMPLE long description") elide: Text.ElideRight anchors.right: parent.right @@ -127,7 +127,7 @@ Rectangle { NativeText { id: descriptionItem height: 43 - color: "#7e7e7e" + color: creatorTheme.Welcome_ForegroundPrimaryColor text: qsTr("The 2D Painting example shows how QPainter and QGLWidget work together.") anchors.top: captionItem.bottom anchors.topMargin: 10 @@ -159,7 +159,7 @@ Rectangle { x: 16 y: 198 text: qsTr("Tags:") - color: creatorTheme.Welcome_TextColorNormal + color: creatorTheme.Welcome_ForegroundSecondaryColor smooth: true font.italic: false font.pixelSize: 11 @@ -187,7 +187,7 @@ Rectangle { Rectangle { id: border color: "#00000000" - radius: 6 + radius: creatorTheme.WidgetStyle === 'StyleFlat' ? 0 : 6 anchors.rightMargin: 4 anchors.leftMargin: 4 anchors.bottomMargin: 4 @@ -268,11 +268,6 @@ Rectangle { target: border visible: true } - - PropertyChanges { - target: highlight - opacity: 0 - } } ] @@ -339,25 +334,26 @@ Rectangle { Repeater { id: repeater model: mockupTags - LinkedText { + NativeText { id: text4 - color: "#777777" text: modelData smooth: true font.pixelSize: 11 height: 12 font.family: "Helvetica" //setting the pixelSize will set the family back to the default + font.underline: tagMouseArea.containsMouse + color: creatorTheme.Welcome_LinkColor wrapMode: Text.WordWrap - onEntered: { - delegate.state="hover" - } - onExited: { - delegate.state="" - } - onClicked: appendTag(modelData) property bool hugeTag: (text.length > 12) && index > 1 property bool isExampleTag: text === "example" visible: !hugeTag && !isExampleTag && index < 8 && y < 32 + MouseArea { + id: tagMouseArea + anchors.fill: parent + onClicked: appendTag(modelData) + // hoverEnabled: true + cursorShape: Qt.PointingHandCursor + } } } } @@ -372,6 +368,5 @@ Rectangle { ListElement { modelData: "OpenGl" } - } } diff --git a/share/qtcreator/welcomescreen/widgets/IconAndLink.qml b/share/qtcreator/welcomescreen/widgets/IconAndLink.qml index 0fab78d9b70..003867b9680 100644 --- a/share/qtcreator/welcomescreen/widgets/IconAndLink.qml +++ b/share/qtcreator/welcomescreen/widgets/IconAndLink.qml @@ -25,21 +25,39 @@ import QtQuick 2.1 -Row { +Rectangle { property string iconSource property string title: "title" property string openUrl property string openHelpUrl - spacing: 7 + height: 30 + width: 231 + + color: mouseArea.containsMouse + ? creatorTheme.Welcome_HoverColor + : creatorTheme.Welcome_BackgroundColor + Image { + id: image width: 16 height: 16 + x: 34 source: iconSource + anchors.verticalCenter: parent.verticalCenter } - LinkedText { + NativeText { text: title + anchors.verticalCenter: parent.verticalCenter + anchors.left: image.right + anchors.leftMargin: 8 + color: creatorTheme.Welcome_TextColor font.pixelSize: 11 - color: creatorTheme.Welcome_TextColorNormal // 'Qt Account' .. 'User Guide' on lower left + font.underline: mouseArea.containsMouse + } + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true onClicked: { if (openUrl) gettingStarted.openUrl(openUrl); @@ -48,3 +66,4 @@ Row { } } } + diff --git a/share/qtcreator/welcomescreen/widgets/LeftSideBar.qml b/share/qtcreator/welcomescreen/widgets/LeftSideBar.qml deleted file mode 100644 index 823d8a19405..00000000000 --- a/share/qtcreator/welcomescreen/widgets/LeftSideBar.qml +++ /dev/null @@ -1,51 +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. -** -****************************************************************************/ - -import QtQuick 2.1 - -Row { - id: customTab - property alias model: repeater.model - spacing: 24 - - signal itemChanged - property int currentIndex: 0 - - onCurrentIndexChanged: welcomeMode.activePlugin = currentIndex - Component.onCompleted: currentIndex = welcomeMode.activePlugin - - Repeater { - id: repeater - - LinkedText { - text: title - active: customTab.currentIndex === index - - onClicked: { - customTab.currentIndex = index - } - } - } -} diff --git a/share/qtcreator/welcomescreen/widgets/LinkedText.qml b/share/qtcreator/welcomescreen/widgets/LinkedText.qml deleted file mode 100644 index 525c3c477cf..00000000000 --- a/share/qtcreator/welcomescreen/widgets/LinkedText.qml +++ /dev/null @@ -1,106 +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. -** -****************************************************************************/ - -import QtQuick 2.1 - -NativeText { - id: root - height: 16 - color: active ? creatorTheme.Welcome_Link_TextColorActive - : creatorTheme.Welcome_Link_TextColorNormal - verticalAlignment: Text.AlignVCenter - - font: fonts.linkFont - - signal clicked - signal entered - signal exited - - property bool active: false - - property bool hovered: mouseArea.state === "hovered" - onActiveChanged: { - if (active) - mouseArea.state = "" - } - - property bool enlargeMouseArea: true - - Rectangle { - color: "#909090" // FIXME: theming: Where is this ever visible? - radius: 6 - opacity: root.active - z: -1 - anchors.rightMargin: -6 - anchors.leftMargin: -6 - anchors.bottomMargin: -4 - anchors.topMargin: -4 - anchors.fill: parent - } - - Rectangle { - color: "#909090" // FIXME: theming: Where is this ever visible? - opacity: root.active - z: -1 - anchors.rightMargin: -6 - anchors.leftMargin: -6 - anchors.bottomMargin: -4 - anchors.topMargin: 10 - anchors.fill: parent - } - - MouseArea { - id: mouseArea - anchors.fill: parent - anchors.margins: enlargeMouseArea ? -8 : 0 - hoverEnabled: true - - cursorShape: Qt.PointingHandCursor - onEntered: { - if (!root.active) - mouseArea.state = "hovered" - root.entered(); - } - onExited: { - mouseArea.state = "" - root.exited(); - } - onClicked: { - root.focus = true; - root.clicked(); - } - - states: [ - State { - name: "hovered" - PropertyChanges { - target: root - font.underline: true - } - } - ] - } - Accessible.role: Accessible.Link -} diff --git a/share/qtcreator/welcomescreen/widgets/LinksBar.qml b/share/qtcreator/welcomescreen/widgets/LinksBar.qml deleted file mode 100644 index 6ef8b1632b3..00000000000 --- a/share/qtcreator/welcomescreen/widgets/LinksBar.qml +++ /dev/null @@ -1,146 +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. -** -****************************************************************************/ - -import QtQuick 2.1 - -Item { - id: tabBar - - height: 60 - width: parent.width - - property alias model: tabs.model - - Rectangle { - id: row - width: 100 - height: 26 - anchors.top: parent.top - anchors.left: parent.left - gradient: Gradient { - GradientStop { position: 0; color: "#f7f7f7" } - GradientStop { position: 1; color: "#e4e4e4" } - } - NativeText { - id: text - horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter - anchors.fill: parent - text: qsTr("Qt Creator") - } - } - - Item { - anchors.top: parent.top - anchors.left: row.right - anchors.right: parent.right - anchors.bottom: row.bottom - - Rectangle { - id: left1 - anchors.top: parent.top - anchors.left: parent.left - anchors.bottom: parent.bottom - width: 1 - gradient: Gradient { - GradientStop { position: 0; color: "#fcfcfc" } - GradientStop { position: 1; color: "#f7f7f7" } - } - } - - Rectangle { - id: left2 - anchors.top: parent.top - anchors.left: left1.right - anchors.bottom: parent.bottom - width: 1 - color: "#313131" - } - - Rectangle { - id: bottom1 - height: 1 - anchors.left: left1.right - anchors.right: parent.right - anchors.bottom: parent.bottom - color: "#fbfbfb" - } - - Rectangle { - id: bottom2 - height: 1 - anchors.left: left2.right - anchors.right: parent.right - anchors.bottom: bottom1.top - width: 1 - color: "#313131" - } - - Rectangle { - anchors.top: parent.top - anchors.left: left2.right - anchors.right: parent.right - anchors.bottom: bottom2.top - gradient: Gradient { - GradientStop { position: 0.00; color: "#8e8e8e" } - GradientStop { position: 0.07; color: "#8e8e8e" } - GradientStop { position: 0.08; color: "#757575" } - GradientStop { position: 0.40; color: "#666666" } - GradientStop { position: 0.41; color: "#585858" } - GradientStop { position: 1.00; color: "#404040" } - } - } - } - - Rectangle { - id: background - anchors.bottom: parent.bottom - width: parent.width - anchors.top: row.bottom - gradient: Gradient { - GradientStop { position: 0; color: "#e4e4e4" } - GradientStop { position: 1; color: "#cecece" } - } - Rectangle { - color: "black" - height: 1 - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - } - } - - Row { - height: background.height - anchors.top: row.bottom - anchors.topMargin: 6 - width: parent.width - Repeater { - id: tabs - height: parent.height - model: tabBar.model - delegate: SingleTab { } - } - } -} diff --git a/share/qtcreator/welcomescreen/widgets/PageCaption.qml b/share/qtcreator/welcomescreen/widgets/PageCaption.qml deleted file mode 100644 index 66772a1e4e0..00000000000 --- a/share/qtcreator/welcomescreen/widgets/PageCaption.qml +++ /dev/null @@ -1,54 +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. -** -****************************************************************************/ - -import QtQuick 2.1 - -Item { - id: pageCaption - width: 960 - height: 40 - - property int textOffset: captionText.x + captionText.width - property alias caption: captionText.text - - NativeText { - id: captionText - y: 9 - color: "#515153" - anchors.left: parent.left - anchors.leftMargin: 8 - font.pixelSize: 18 - font.bold: false - font.family: "Helvetica" - } - Rectangle { - height: 1 - color: "#a0a0a0" - anchors.bottomMargin: 8 - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - } -} diff --git a/share/qtcreator/welcomescreen/widgets/PageLoader.qml b/share/qtcreator/welcomescreen/widgets/PageLoader.qml index 75d8422b34e..18d01cd2781 100644 --- a/share/qtcreator/welcomescreen/widgets/PageLoader.qml +++ b/share/qtcreator/welcomescreen/widgets/PageLoader.qml @@ -31,7 +31,6 @@ Rectangle { property alias model: repeater.model property int currentIndex: 0 - Repeater { id: repeater anchors.fill: parent diff --git a/share/qtcreator/welcomescreen/widgets/ProjectItem.qml b/share/qtcreator/welcomescreen/widgets/ProjectItem.qml index 87cc0a6986f..eb831d54519 100644 --- a/share/qtcreator/welcomescreen/widgets/ProjectItem.qml +++ b/share/qtcreator/welcomescreen/widgets/ProjectItem.qml @@ -25,54 +25,48 @@ import QtQuick 2.1 -Item { +Rectangle { id: projectItem - width: row.width + 8 - height: text.height + width: Math.max(projectNameText.width, pathText.width) + projectNameText.x + 11 + height: 48 - Rectangle { // background shown on hover over project item - anchors.fill: parent - color: creatorTheme.Welcome_ProjectItem_BackgroundColorHover - visible: mouseArea.containsMouse - } + color: mouseArea.containsMouse + ? creatorTheme.Welcome_HoverColor + : creatorTheme.Welcome_BackgroundColor property alias projectName: projectNameText.text property alias projectPath: pathText.text - Row { - id: row - spacing: 5 - - Image { - y: 3 - source: "images/project.png" - } + Image { + id: icon + x: 11 + y: 6 + source: "image://icons/project/Welcome_ForegroundSecondaryColor" + } - Column { - id: text + NativeText { + x: 38 + id: projectNameText + font.pixelSize: fonts.linkFont.pixelSize + font.family: fonts.linkFont.family + font.underline: mouseArea.containsMouse + color: creatorTheme.Welcome_LinkColor + anchors.verticalCenter: icon.verticalCenter + } - LinkedText { - id: projectNameText - height: 20 - font.underline: mouseArea.containsMouse - font.pixelSize: fonts.linkFont.pixelSize - font.family: fonts.linkFont.family - enlargeMouseArea: false - } - NativeText { - id: pathText - height: 20 - color: creatorTheme.Welcome_ProjectItem_TextColorFilepath - font: fonts.smallPath - } - } + NativeText { + id: pathText + anchors.left: projectNameText.left + anchors.bottom: projectItem.bottom + anchors.bottomMargin: 6 + color: creatorTheme.Welcome_ForegroundPrimaryColor + font: fonts.smallPath } MouseArea { id: mouseArea anchors.fill: parent hoverEnabled: true - cursorShape: Qt.PointingHandCursor onClicked: projectWelcomePage.requestProject(filePath); } } diff --git a/share/qtcreator/welcomescreen/widgets/RecentProjects.qml b/share/qtcreator/welcomescreen/widgets/RecentProjects.qml index 9474f927af2..3bde97484e8 100644 --- a/share/qtcreator/welcomescreen/widgets/RecentProjects.qml +++ b/share/qtcreator/welcomescreen/widgets/RecentProjects.qml @@ -30,16 +30,9 @@ Rectangle { id: projectList height: column.height + 200 width: column.width - color: creatorTheme.Welcome_BackgroundColorNormal + color: creatorTheme.Welcome_BackgroundColor property alias model: repeater.model -// Behavior on verticalScrollBar.opacity { -// PropertyAnimation { - -// } -// } - -// frameVisible: false Column { id: column diff --git a/share/qtcreator/welcomescreen/widgets/SearchBar.qml b/share/qtcreator/welcomescreen/widgets/SearchBar.qml index 974f3782c9a..e7bd007a01b 100644 --- a/share/qtcreator/welcomescreen/widgets/SearchBar.qml +++ b/share/qtcreator/welcomescreen/widgets/SearchBar.qml @@ -31,10 +31,9 @@ Rectangle { id: searchBar width: 930 - height: 27 - color: creatorTheme.Welcome_BackgroundColorNormal - radius: 6 - border.color: "#cccccc" // FIXME: make themable + height: 30 + color: creatorTheme.Welcome_BackgroundColor + border.color: creatorTheme.Welcome_ForegroundSecondaryColor property alias placeholderText: lineEdit.placeholderText property alias text: lineEdit.text @@ -51,8 +50,8 @@ Rectangle { font.pixelSize: 14 placeholderText: qsTr("Search...") style: TextFieldStyle { - placeholderTextColor: creatorTheme.Welcome_TextColorNormal - textColor: creatorTheme.Welcome_TextColorNormal + placeholderTextColor: creatorTheme.Welcome_ForegroundSecondaryColor + textColor: creatorTheme.Welcome_TextColor background: Item { } } diff --git a/share/qtcreator/welcomescreen/widgets/Logo.qml b/share/qtcreator/welcomescreen/widgets/SessionActionLabel.qml index a94707ba1ff..75e44875d69 100644 --- a/share/qtcreator/welcomescreen/widgets/Logo.qml +++ b/share/qtcreator/welcomescreen/widgets/SessionActionLabel.qml @@ -25,19 +25,18 @@ import QtQuick 2.1 -Image { - id: logo - source: "images/qtcreator.png" - NativeText { - y: 21 - color: "#424242" - text: "Qt Creator" - font.bold: true - anchors.left: parent.left - anchors.leftMargin: 52 - anchors.bottom: parent.bottom - anchors.bottomMargin: 6 - font.pixelSize: 16 - font.family: "Helvetica" +NativeText { + id: root + signal clicked() + text: qsTr("Clone") + font.pixelSize: 13 + font.underline: area.containsMouse + color: creatorTheme.Welcome_LinkColor + MouseArea { + id: area + anchors.fill: parent + hoverEnabled: true + onClicked: root.clicked() + anchors.margins: -6 } } diff --git a/share/qtcreator/welcomescreen/widgets/SessionItem.qml b/share/qtcreator/welcomescreen/widgets/SessionItem.qml index c9f14de21b9..f617dfeedc3 100644 --- a/share/qtcreator/welcomescreen/widgets/SessionItem.qml +++ b/share/qtcreator/welcomescreen/widgets/SessionItem.qml @@ -26,49 +26,49 @@ import QtQuick 2.1 Item { - x: 5 id: delegate property bool expanded: false height: columns.height width: columns.width - property alias name: text.text + property alias name: titleText.text Column { id: columns - Row { - id: row1 - height: text.height + Rectangle { + id: rectangle + height: 30 + width: 260 - spacing: 7 + color: (titleArea.containsMouse || collapseArea.containsMouse || delegate.expanded) + ? creatorTheme.Welcome_HoverColor + : creatorTheme.Welcome_BackgroundColor Image { - source: "images/sessions.png" - anchors.verticalCenter: text.verticalCenter - width: 16 - height: 16 + id: sessionIcon + source: "image://icons/session/Welcome_ForegroundSecondaryColor" + x: 11 + anchors.verticalCenter: parent.verticalCenter } - LinkedText { - id: text - - onClicked: projectWelcomePage.requestSession(sessionName); - - width: delegate.ListView.view.width - 80 - height: 28 + NativeText { + id: titleText + anchors.fill: parent + anchors.leftMargin: 38 elide: Text.ElideRight + color: creatorTheme.Welcome_LinkColor + verticalAlignment: Text.AlignVCenter + font.pixelSize: fonts.linkFont.pixelSize + font.family: fonts.linkFont.family + font.underline: titleArea.containsMouse + } - enlargeMouseArea: false - - Rectangle { - z: -4 - // background of session item - color: creatorTheme.Welcome_SessionItem_BackgroundColorHover - anchors.fill: parent - visible: iArea.containsMouse || text.hovered - anchors.topMargin: 1 - anchors.bottomMargin: 1 - anchors.leftMargin: -row1.spacing / 2 + MouseArea { + id: titleArea + hoverEnabled: true + anchors.fill: parent + onClicked: { + projectWelcomePage.requestSession(sessionName); } } } @@ -76,10 +76,9 @@ Item { z: -1 property int margin: 6 id: details - height: expanded ? innerColumn.height + margin * 2 : 0 - width: delegate.ListView.view.width - 8 - margin * 2 - color: "#f1f1f1" - radius: 4 + height: expanded ? innerColumn.height + margin + 16 : 0 + width: titleArea.width + collapseArea.width + color: creatorTheme.Welcome_HoverColor clip: true visible: false @@ -89,7 +88,7 @@ Item { script: if (expanded) details.visible = true; } NumberAnimation { - duration: 200 + duration: 180 easing.type: Easing.InOutQuad } ScriptAction { @@ -99,45 +98,27 @@ Item { } Column { - x: parent.margin + 8 + x: titleText.x y: parent.margin id: innerColumn spacing: 12 - width: parent.width - 16 Repeater { model: projectsPath delegate: Column { + spacing: 4 NativeText { text: projectsName[index] - font: fonts.boldDescription - color: creatorTheme.Welcome_TextColorNormal + font: fonts.smallPath + color: creatorTheme.Welcome_TextColor + width: titleText.width } NativeText { - x: 4 - function multiLinePath(path) { - if (path.length < 42) - return path; - var index = 0; - var oldIndex = 0; - while (index != -1 && index < 40) { - oldIndex = index; - index = path.indexOf("/", oldIndex + 1); - if (index == -1) - index = path.indexOf("\\", oldIndex + 1); - } - var newPath = path.substr(0, oldIndex + 1) + "\n" - + path.substr(oldIndex + 1, path.length - oldIndex - 1); - return newPath; - } - text: multiLinePath(modelData) + text: modelData font: fonts.smallPath - wrapMode: Text.WrapAnywhere - maximumLineCount: 2 elide: Text.ElideRight - height: lineCount == 2 ? font.pixelSize * 2 + 4 : font.pixelSize + 2 - color: creatorTheme.Welcome_ProjectItem_TextColorFilepath - width: delegate.ListView.view.width - 48 + color: creatorTheme.Welcome_ForegroundPrimaryColor + width: titleText.width MouseArea { anchors.fill: parent hoverEnabled: true @@ -147,7 +128,6 @@ Item { onExited: { toolTip.hide() } - } ToolTip { x: 10 @@ -160,51 +140,39 @@ Item { } Flow { - x: parent.margin width: parent.width - 2 * parent.margin height: 18 - spacing: 4 + spacing: 6 - Image { source: "images/icons/clone.png" } - LinkedText { + SessionActionLabel { text: qsTr("Clone") - onClicked: { - root.model.cloneSession(sessionName); - } + onClicked: root.model.cloneSession(sessionName) } - Item { + Rectangle { visible: !defaultSession - width: 16; - height: 10; + width: 1; + height: 13; + color: creatorTheme.Welcome_ForegroundSecondaryColor } - Image { - visible: !defaultSession - source: "images/icons/rename.png" - } - LinkedText { + + SessionActionLabel { visible: !defaultSession text: qsTr("Rename") - onClicked: { - root.model.renameSession(sessionName); - } + onClicked: root.model.renameSession(sessionName) } - Item { + Rectangle { visible: y === 0 && !defaultSession - width: 16; - height: 10; + width: 1; + height: 13; + color: creatorTheme.Welcome_ForegroundSecondaryColor } - Image { - visible: !defaultSession - source: "images/icons/delete.png" - } - LinkedText { + + SessionActionLabel { visible: !defaultSession text: qsTr("Delete") - onClicked: { - root.model.deleteSession(sessionName); - } + onClicked: root.model.deleteSession(sessionName) } } } @@ -212,47 +180,27 @@ Item { } Item { - x: delegate.ListView.view.width - 65 - width: 38 - height: text.height - Item { + x: rectangle.width + width: 28 + height: titleArea.height + Rectangle { id: collapseButton - visible: text.hovered || iArea.containsMouse || delegate.expanded - - property color color: iArea.containsMouse ? creatorTheme.Welcome_SessionItemExpanded_BackgroundColorHover - : creatorTheme.Welcome_SessionItemExpanded_BackgroundColorNormal - anchors.fill: parent + color: (collapseArea.containsMouse || delegate.expanded) + ? creatorTheme.Welcome_HoverColor + : creatorTheme.Welcome_BackgroundColor + Image { - x: 4 - y: 7 - source: "images/info.png" - } - Image { - x: 20 + x: 6 y: 7 - source: delegate.expanded ? "images/arrow_up.png" : "images/arrow_down.png" - } - Rectangle { - color: collapseButton.color - z: -1 - radius: creatorTheme.WidgetStyle === 'StyleFlat' ? 0 : 6 - anchors.fill: parent - anchors.topMargin: 1 - anchors.bottomMargin: 1 - } - - Rectangle { - color: collapseButton.color - z: -1 - anchors.fill: parent - anchors.topMargin: 6 - visible: details.visible + visible: (collapseArea.containsMouse || delegate.expanded || titleArea.containsMouse) + source: "image://icons/expandarrow/Welcome_ForegroundSecondaryColor" + rotation: delegate.expanded ? 180 : 0 } } MouseArea { - id: iArea + id: collapseArea anchors.fill: parent hoverEnabled: true onClicked: { diff --git a/share/qtcreator/welcomescreen/widgets/Sessions.qml b/share/qtcreator/welcomescreen/widgets/Sessions.qml index e99e39ca6c6..bee7e3b4fc6 100644 --- a/share/qtcreator/welcomescreen/widgets/Sessions.qml +++ b/share/qtcreator/welcomescreen/widgets/Sessions.qml @@ -26,18 +26,17 @@ import QtQuick 2.1 import widgets 1.0 -Item { +Rectangle { id: root property var model - property int topMargin: 6 height: content.contentHeight + 200 + color: creatorTheme.Welcome_BackgroundColor ListView { id: content model: root.model anchors.fill: parent - anchors.topMargin: topMargin snapMode: ListView.SnapToItem clip: true interactive: false diff --git a/share/qtcreator/welcomescreen/widgets/SideBar.qml b/share/qtcreator/welcomescreen/widgets/SideBar.qml index 31495f759eb..2c74b638aff 100644 --- a/share/qtcreator/welcomescreen/widgets/SideBar.qml +++ b/share/qtcreator/welcomescreen/widgets/SideBar.qml @@ -35,115 +35,70 @@ ColumnLayout { property alias currentIndex: tabs.currentIndex property alias model: tabs.model + readonly property int lrPadding: 34 + Item { id: modeArea z: 1 Layout.fillWidth: true - Layout.preferredWidth: tabs.width + 16 * 2 + Layout.preferredWidth: tabs.width + lrPadding * 2 Layout.preferredHeight: tabs.height + screenDependHeightDistance * 2 - Component { - id: imageBackground - Image { - fillMode: Image.Tile - source: "images/background.png" - anchors.fill: parent - } - } - Component { - id: flatBackground - Rectangle { - color: creatorTheme.Welcome_SideBar_BackgroundColor - } - } - Loader { - id: topLeftLoader + Rectangle { + color: creatorTheme.Welcome_BackgroundColor anchors.fill: parent - sourceComponent: creatorTheme.WidgetStyle === 'StyleFlat' ? flatBackground : imageBackground; } Tabs { anchors.verticalCenter: parent.verticalCenter - x: 16 - width: Math.max(modeArea.width - 16 * 2, implicitWidth) + x: lrPadding + width: Math.max(modeArea.width - lrPadding * 2, implicitWidth) id: tabs spacing: Math.round((screenDependHeightDistance / count) + 10) } - - Rectangle { - color: creatorTheme.WidgetStyle === 'StyleFlat' ? - creatorTheme.Welcome_SideBar_BackgroundColor : creatorTheme.Welcome_DividerColor - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - height: 1 - } - - Rectangle { - color: creatorTheme.WidgetStyle === 'StyleFlat' ? - creatorTheme.Welcome_SideBar_BackgroundColor : creatorTheme.Welcome_DividerColor - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.bottomMargin: -1 - height: 1 - opacity: 0.6 - } - - Rectangle { - color: creatorTheme.WidgetStyle === 'StyleFlat' ? - creatorTheme.Welcome_SideBar_BackgroundColor : creatorTheme.Welcome_DividerColor - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.bottomMargin: -2 - height: 1 - opacity: 0.2 - } } Rectangle { - color: creatorTheme.Welcome_SideBar_BackgroundColor + color: creatorTheme.Welcome_BackgroundColor Layout.fillWidth: true - Layout.preferredWidth: innerColumn.width + 20 + Layout.preferredWidth: upperColumn.width + 20 Layout.fillHeight: true ColumnLayout { - id: innerColumn + id: upperColumn - x: 12 + x: lrPadding - spacing: 4 + spacing: 8 - property int spacerHeight: screenDependHeightDistance - 14 + property int spacerHeight: screenDependHeightDistance Item { - Layout.preferredHeight: innerColumn.spacerHeight + Layout.preferredHeight: upperColumn.spacerHeight } NativeText { text: qsTr("New to Qt?") - color: creatorTheme.Welcome_TextColorNormal + color: creatorTheme.Welcome_TextColor font.pixelSize: 18 } NativeText { id: gettingStartedText - Layout.preferredWidth: innerColumn.width + Layout.preferredWidth: upperColumn.width text: qsTr("Learn how to develop your own applications and explore Qt Creator.") - color: creatorTheme.Welcome_TextColorNormal + color: creatorTheme.Welcome_ForegroundPrimaryColor font.pixelSize: 12 wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Item { - Layout.preferredHeight: innerColumn.spacerHeight + Layout.preferredHeight: 4 } Button { @@ -156,37 +111,33 @@ ColumnLayout { } Item { - Layout.preferredHeight: innerColumn.spacerHeight + Layout.preferredHeight: upperColumn.spacerHeight * 2 } + } - ColumnLayout { - spacing: 16 - - IconAndLink { - iconSource: "images/icons/qt_account.png" - title: qsTr("Qt Account") - openUrl: "https://account.qt.io" - } - IconAndLink { - iconSource: "images/icons/qt_cloud.png" - title: qsTr("Qt Cloud Services") - openUrl: "https://developer.qtcloudservices.com" - } - IconAndLink { - iconSource: "images/icons/onlineCommunity.png" - title: qsTr("Online Community") - openUrl: "http://forum.qt.io" - } - IconAndLink { - iconSource: "images/icons/blogs.png" - title: qsTr("Blogs") - openUrl: "http://planet.qt.io" - } - IconAndLink { - iconSource: "images/icons/userGuide.png" - title: qsTr("User Guide") - openHelpUrl: "qthelp://org.qt-project.qtcreator/doc/index.html" - } + ColumnLayout { + anchors.top: upperColumn.bottom + anchors.topMargin: 8 + + IconAndLink { + iconSource: "image://icons/qtaccount" + title: qsTr("Qt Account") + openUrl: "https://account.qt.io" + } + IconAndLink { + iconSource: "image://icons/community" + title: qsTr("Online Community") + openUrl: "http://forum.qt.io" + } + IconAndLink { + iconSource: "image://icons/blogs" + title: qsTr("Blogs") + openUrl: "http://planet.qt.io" + } + IconAndLink { + iconSource: "image://icons/userguide" + title: qsTr("User Guide") + openHelpUrl: "qthelp://org.qt-project.qtcreator/doc/index.html" } } } diff --git a/share/qtcreator/welcomescreen/widgets/ToolTip.qml b/share/qtcreator/welcomescreen/widgets/ToolTip.qml index e7d1c49d265..ff3b4deb7b9 100644 --- a/share/qtcreator/welcomescreen/widgets/ToolTip.qml +++ b/share/qtcreator/welcomescreen/widgets/ToolTip.qml @@ -78,25 +78,15 @@ Item { Rectangle { anchors.fill: parent - + color: creatorTheme.Welcome_BackgroundColor border.width: 1 - smooth: true - radius: 2 - gradient: Gradient { - GradientStop { - position: 0.00; - color: "#ffffff"; - } - GradientStop { - position: 1.00; - color: "#e4e5f0"; - } - } + border.color: creatorTheme.Welcome_ForegroundSecondaryColor } NativeText { x: toolTip.margin y: toolTip.margin id: text + color: creatorTheme.Welcome_TextColor } } diff --git a/share/qtcreator/welcomescreen/widgets/images/arrowBig.png b/share/qtcreator/welcomescreen/widgets/images/arrowBig.png Binary files differdeleted file mode 100644 index 02618066cb8..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/arrowBig.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/arrow_down.png b/share/qtcreator/welcomescreen/widgets/images/arrow_down.png Binary files differdeleted file mode 100644 index 722f70fb563..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/arrow_down.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/arrow_down@2x.png b/share/qtcreator/welcomescreen/widgets/images/arrow_down@2x.png Binary files differdeleted file mode 100644 index 34421b66bf5..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/arrow_down@2x.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/arrow_up.png b/share/qtcreator/welcomescreen/widgets/images/arrow_up.png Binary files differdeleted file mode 100644 index c589c349e95..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/arrow_up.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/arrow_up@2x.png b/share/qtcreator/welcomescreen/widgets/images/arrow_up@2x.png Binary files differdeleted file mode 100644 index 7d48c05be7b..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/arrow_up@2x.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/background.png b/share/qtcreator/welcomescreen/widgets/images/background.png Binary files differdeleted file mode 100644 index 33ddf9ed55c..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/background.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/bullet.png b/share/qtcreator/welcomescreen/widgets/images/bullet.png Binary files differdeleted file mode 100644 index c05341e4829..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/bullet.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/blogs.png b/share/qtcreator/welcomescreen/widgets/images/icons/blogs.png Binary files differdeleted file mode 100644 index c10b4a6f404..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/blogs.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/clone.png b/share/qtcreator/welcomescreen/widgets/images/icons/clone.png Binary files differdeleted file mode 100644 index 462c8c0e041..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/clone.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/clone@2x.png b/share/qtcreator/welcomescreen/widgets/images/icons/clone@2x.png Binary files differdeleted file mode 100644 index bdb5cc142e6..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/clone@2x.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/delete.png b/share/qtcreator/welcomescreen/widgets/images/icons/delete.png Binary files differdeleted file mode 100644 index 8b64fec5cbb..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/delete.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/delete@2x.png b/share/qtcreator/welcomescreen/widgets/images/icons/delete@2x.png Binary files differdeleted file mode 100644 index eb2705644c4..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/delete@2x.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/onlineCommunity.png b/share/qtcreator/welcomescreen/widgets/images/icons/onlineCommunity.png Binary files differdeleted file mode 100644 index 37101a045a6..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/onlineCommunity.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/qt_account.png b/share/qtcreator/welcomescreen/widgets/images/icons/qt_account.png Binary files differdeleted file mode 100644 index cbf592fcd69..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/qt_account.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/qt_cloud.png b/share/qtcreator/welcomescreen/widgets/images/icons/qt_cloud.png Binary files differdeleted file mode 100644 index ba3f283935c..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/qt_cloud.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/rename.png b/share/qtcreator/welcomescreen/widgets/images/icons/rename.png Binary files differdeleted file mode 100644 index 80116d1fead..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/rename.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/rename@2x.png b/share/qtcreator/welcomescreen/widgets/images/icons/rename@2x.png Binary files differdeleted file mode 100644 index 381e6a9e40e..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/rename@2x.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/icons/userGuide.png b/share/qtcreator/welcomescreen/widgets/images/icons/userGuide.png Binary files differdeleted file mode 100644 index c00db7ad65c..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/icons/userGuide.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/info.png b/share/qtcreator/welcomescreen/widgets/images/info.png Binary files differdeleted file mode 100644 index e595b5fe72b..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/info.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/info@2x.png b/share/qtcreator/welcomescreen/widgets/images/info@2x.png Binary files differdeleted file mode 100644 index 2d2b95204a7..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/info@2x.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/more.png b/share/qtcreator/welcomescreen/widgets/images/more.png Binary files differdeleted file mode 100644 index 28ce4d5f6af..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/more.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/new.png b/share/qtcreator/welcomescreen/widgets/images/new.png Binary files differdeleted file mode 100644 index c4dbb15d649..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/new.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/open.png b/share/qtcreator/welcomescreen/widgets/images/open.png Binary files differdeleted file mode 100644 index bfa1089ccd0..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/open.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/project.png b/share/qtcreator/welcomescreen/widgets/images/project.png Binary files differdeleted file mode 100644 index 7a0f8b3089b..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/project.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/project@2x.png b/share/qtcreator/welcomescreen/widgets/images/project@2x.png Binary files differdeleted file mode 100644 index 1cb309c8965..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/project@2x.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/qtcreator.png b/share/qtcreator/welcomescreen/widgets/images/qtcreator.png Binary files differdeleted file mode 100644 index 775e1bd83b2..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/qtcreator.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/sessions.png b/share/qtcreator/welcomescreen/widgets/images/sessions.png Binary files differdeleted file mode 100644 index 31c5de120a0..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/sessions.png +++ /dev/null diff --git a/share/qtcreator/welcomescreen/widgets/images/tab.png b/share/qtcreator/welcomescreen/widgets/images/tab.png Binary files differdeleted file mode 100644 index a3acdd851fe..00000000000 --- a/share/qtcreator/welcomescreen/widgets/images/tab.png +++ /dev/null diff --git a/src/libs/timeline/timelinemodel.cpp b/src/libs/timeline/timelinemodel.cpp index e5d16ecb247..c28ca789639 100644 --- a/src/libs/timeline/timelinemodel.cpp +++ b/src/libs/timeline/timelinemodel.cpp @@ -151,8 +151,8 @@ int TimelineModel::row(int index) const return expanded() ? expandedRow(index) : collapsedRow(index); } -TimelineModel::TimelineModelPrivate::TimelineModelPrivate(int modelId, const QString &displayName) : - modelId(modelId), displayName(displayName), expanded(false), hidden(false), +TimelineModel::TimelineModelPrivate::TimelineModelPrivate(int modelId) : + modelId(modelId), expanded(false), hidden(false), expandedRowCount(1), collapsedRowCount(1), q_ptr(0) { } @@ -163,8 +163,8 @@ TimelineModel::TimelineModel(TimelineModelPrivate &dd, QObject *parent) : d_ptr->q_ptr = this; } -TimelineModel::TimelineModel(int modelId, const QString &displayName, QObject *parent) : - QObject(parent), d_ptr(new TimelineModelPrivate(modelId, displayName)) +TimelineModel::TimelineModel(int modelId, QObject *parent) : + QObject(parent), d_ptr(new TimelineModelPrivate(modelId)) { d_ptr->q_ptr = this; } @@ -512,6 +512,15 @@ void TimelineModel::setHidden(bool hidden) } } +void TimelineModel::setDisplayName(const QString &displayName) +{ + Q_D(TimelineModel); + if (d->displayName != displayName) { + d->displayName = displayName; + emit displayNameChanged(); + } +} + QString TimelineModel::displayName() const { Q_D(const TimelineModel); diff --git a/src/libs/timeline/timelinemodel.h b/src/libs/timeline/timelinemodel.h index 48d60add481..83ad4012ccb 100644 --- a/src/libs/timeline/timelinemodel.h +++ b/src/libs/timeline/timelinemodel.h @@ -37,7 +37,7 @@ class TIMELINE_EXPORT TimelineModel : public QObject { Q_OBJECT Q_PROPERTY(int modelId READ modelId CONSTANT) - Q_PROPERTY(QString displayName READ displayName CONSTANT) + Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged) Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged) Q_PROPERTY(bool hidden READ hidden WRITE setHidden NOTIFY hiddenChanged) Q_PROPERTY(bool expanded READ expanded WRITE setExpanded NOTIFY expandedChanged) @@ -52,7 +52,7 @@ class TIMELINE_EXPORT TimelineModel : public QObject public: class TimelineModelPrivate; - TimelineModel(int modelId, const QString &displayName, QObject *parent = 0); + TimelineModel(int modelId, QObject *parent = 0); ~TimelineModel(); // Methods implemented by the abstract model itself @@ -82,6 +82,7 @@ public: bool hidden() const; void setExpanded(bool expanded); void setHidden(bool hidden); + void setDisplayName(const QString &displayName); QString displayName() const; int expandedRowCount() const; int collapsedRowCount() const; @@ -123,6 +124,7 @@ signals: void collapsedRowCountChanged(); void rowCountChanged(); void labelsChanged(); + void displayNameChanged(); protected: QColor colorBySelectionId(int index) const; diff --git a/src/libs/timeline/timelinemodel_p.h b/src/libs/timeline/timelinemodel_p.h index 20cc11f2e65..0d775e9edab 100644 --- a/src/libs/timeline/timelinemodel_p.h +++ b/src/libs/timeline/timelinemodel_p.h @@ -64,7 +64,7 @@ public: inline qint64 timestamp() const {return end;} }; - TimelineModelPrivate(int modelId, const QString &displayName); + TimelineModelPrivate(int modelId); void init(TimelineModel *q); int firstIndexNoParents(qint64 startTime) const; @@ -131,7 +131,7 @@ public: QVector<int> rowOffsets; const int modelId; - const QString displayName; + QString displayName; bool expanded; bool hidden; diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 9431cbe18d8..8de43c24bb3 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -25,6 +25,7 @@ #include "stylehelper.h" +#include "theme/theme.h" #include "hostosinfo.h" #include <QPixmapCache> @@ -108,11 +109,6 @@ QColor StyleHelper::baseColor(bool lightColored) return m_baseColor.lighter(230); } -bool StyleHelper::isBaseColorDefault() -{ - return m_requestedBaseColor == DEFAULT_BASE_COLOR; -} - QColor StyleHelper::highlightColor(bool lightColored) { QColor result = baseColor(lightColored); @@ -152,10 +148,20 @@ void StyleHelper::setBaseColor(const QColor &newcolor) { m_requestedBaseColor = newcolor; + const QColor themeBaseColor = creatorTheme()->color(Theme::PanelStatusBarBackgroundColor); + const QColor defaultBaseColor = QColor(DEFAULT_BASE_COLOR); QColor color; - color.setHsv(newcolor.hue(), - newcolor.saturation() * 0.7, - 64 + newcolor.value() / 3); + + if (defaultBaseColor == newcolor) { + color = themeBaseColor; + } else { + const int valueDelta = (newcolor.value() - defaultBaseColor.value()) / 3; + const int value = qBound(0, themeBaseColor.value() + valueDelta, 255); + + color.setHsv(newcolor.hue(), + newcolor.saturation() * 0.7, + value); + } if (color.isValid() && color != m_baseColor) { m_baseColor = color; diff --git a/src/libs/utils/stylehelper.h b/src/libs/utils/stylehelper.h index 5ac91df433e..7e483c43f1d 100644 --- a/src/libs/utils/stylehelper.h +++ b/src/libs/utils/stylehelper.h @@ -56,7 +56,6 @@ public: // This is our color table, all colors derive from baseColor static QColor requestedBaseColor() { return m_requestedBaseColor; } static QColor baseColor(bool lightColored = false); - static bool isBaseColorDefault(); static QColor panelTextColor(bool lightColored = false); static QColor highlightColor(bool lightColored = false); static QColor shadowColor(bool lightColored = false); diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index d5a006dc2c4..884b76104fc 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -103,7 +103,6 @@ public: OutputPaneButtonFlashColor, OutputPaneToggleButtonTextColorChecked, OutputPaneToggleButtonTextColorUnchecked, - PanelButtonToolBackgroundColorHover, PanelStatusBarBackgroundColor, PanelsWidgetSeparatorLineColor, PanelTextColorDark, @@ -113,6 +112,7 @@ public: ProgressBarColorFinished, ProgressBarColorNormal, ProgressBarTitleColor, + ProgressBarBackgroundColor, SplitterColor, TextColorDisabled, TextColorError, @@ -160,6 +160,14 @@ public: OutputPanes_StdErrTextColor, OutputPanes_StdOutTextColor, OutputPanes_WarningMessageTextColor, + OutputPanes_TestPassTextColor, + OutputPanes_TestFailTextColor, + OutputPanes_TestXFailTextColor, + OutputPanes_TestXPassTextColor, + OutputPanes_TestSkipTextColor, + OutputPanes_TestWarnTextColor, + OutputPanes_TestFatalTextColor, + OutputPanes_TestDebugTextColor, /* Debugger Log Window */ @@ -175,27 +183,14 @@ public: /* Welcome Plugin */ - Welcome_TextColorNormal, - Welcome_TextColorHeading, // #535353 // Sessions, Recent Projects - Welcome_BackgroundColorNormal, // #ffffff - Welcome_DividerColor, // #737373 - Welcome_Button_BorderColorNormal, - Welcome_Button_BorderColorPressed, - Welcome_Button_TextColorNormal, - Welcome_Button_TextColorPressed, - Welcome_Link_TextColorNormal, - Welcome_Link_TextColorActive, - Welcome_Link_BackgroundColor, - Welcome_Caption_TextColorNormal, - Welcome_SideBar_BackgroundColor, - - Welcome_ProjectItem_TextColorFilepath, - Welcome_ProjectItem_BackgroundColorHover, - - Welcome_SessionItem_BackgroundColorNormal, - Welcome_SessionItem_BackgroundColorHover, - Welcome_SessionItemExpanded_BackgroundColorNormal, - Welcome_SessionItemExpanded_BackgroundColorHover, + Welcome_TextColor, + Welcome_ForegroundPrimaryColor, + Welcome_ForegroundSecondaryColor, + Welcome_BackgroundColor, + Welcome_ButtonBackgroundColor, + Welcome_DividerColor, + Welcome_LinkColor, + Welcome_HoverColor, /* VcsBase Plugin */ VcsBase_FileStatusUnknown_TextColor, diff --git a/src/libs/utils/utilsicons.h b/src/libs/utils/utilsicons.h index 0f2d8a49b8a..51da2999c4d 100644 --- a/src/libs/utils/utilsicons.h +++ b/src/libs/utils/utilsicons.h @@ -32,7 +32,7 @@ namespace Utils { namespace Icons { const Utils::Icon EDIT_CLEAR({ - {QLatin1String(":/core/images/editclear.png"), Utils::Theme::BackgroundColorHover}}, Utils::Icon::Tint); + {QLatin1String(":/core/images/editclear.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint); } // namespace Icons } // namespace Utils diff --git a/src/plugins/autotest/testcodeparser.h b/src/plugins/autotest/testcodeparser.h index e9254221142..2755d33dd67 100644 --- a/src/plugins/autotest/testcodeparser.h +++ b/src/plugins/autotest/testcodeparser.h @@ -62,6 +62,7 @@ public: virtual ~TestCodeParser(); void setState(State state); State state() const { return m_parserState; } + bool isParsing() const { return m_parserState == PartialParse || m_parserState == FullParse; } void setDirty() { m_dirty = true; } #ifdef WITH_TESTS bool furtherParsingExpected() const diff --git a/src/plugins/autotest/testresult.cpp b/src/plugins/autotest/testresult.cpp index a7f3cc34638..baf262b250c 100644 --- a/src/plugins/autotest/testresult.cpp +++ b/src/plugins/autotest/testresult.cpp @@ -25,6 +25,8 @@ #include "testresult.h" +#include <utils/theme/theme.h> + namespace Autotest { namespace Internal { @@ -119,29 +121,28 @@ QColor TestResult::colorForType(const Result::Type type) if (type >= Result::INTERNAL_MESSAGES_BEGIN && type <= Result::INTERNAL_MESSAGES_END) return QColor("transparent"); + Utils::Theme *creatorTheme = Utils::creatorTheme(); switch (type) { case Result::Pass: - return QColor("#009900"); + return creatorTheme->color(Utils::Theme::OutputPanes_TestPassTextColor); case Result::Fail: - return QColor("#a00000"); + return creatorTheme->color(Utils::Theme::OutputPanes_TestFailTextColor); case Result::ExpectedFail: - return QColor("#00ff00"); + return creatorTheme->color(Utils::Theme::OutputPanes_TestXFailTextColor); case Result::UnexpectedPass: - return QColor("#ff0000"); + return creatorTheme->color(Utils::Theme::OutputPanes_TestXPassTextColor); case Result::Skip: - return QColor("#787878"); - case Result::BlacklistedPass: - return QColor(0, 0, 0); - case Result::BlacklistedFail: - return QColor(0, 0, 0); + return creatorTheme->color(Utils::Theme::OutputPanes_TestSkipTextColor); case Result::MessageDebug: - return QColor("#329696"); + return creatorTheme->color(Utils::Theme::OutputPanes_TestDebugTextColor); case Result::MessageWarn: - return QColor("#d0bb00"); + return creatorTheme->color(Utils::Theme::OutputPanes_TestWarnTextColor); case Result::MessageFatal: - return QColor("#640000"); + return creatorTheme->color(Utils::Theme::OutputPanes_TestFatalTextColor); + case Result::BlacklistedPass: + case Result::BlacklistedFail: default: - return QColor("#000000"); + return creatorTheme->color(Utils::Theme::OutputPanes_StdOutTextColor); } } diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 9192c75916d..9559ce5be70 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -31,6 +31,7 @@ #include "testrunner.h" #include "testsettings.h" #include "testtreemodel.h" +#include "testcodeparser.h" #include <coreplugin/coreconstants.h> #include <coreplugin/coreicons.h> @@ -517,7 +518,8 @@ void TestResultsPane::onScrollBarRangeChanged(int, int max) void TestResultsPane::updateRunActions() { QString whyNot; - const bool enable = TestTreeModel::instance()->hasTests() + TestTreeModel *model = TestTreeModel::instance(); + const bool enable = !model->parser()->isParsing() && model->hasTests() && ProjectExplorer::ProjectExplorerPlugin::canRunStartupProject( ProjectExplorer::Constants::NORMAL_RUN_MODE, &whyNot); m_runAll->setEnabled(enable); diff --git a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/quickauto.qbs b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/quickauto.qbs index 3350943ee77..d6f50c2e664 100644 --- a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/quickauto.qbs +++ b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto/quickauto.qbs @@ -6,14 +6,10 @@ CppApplication { Depends { name: "cpp" } Depends { name: "Qt.core" } - Depends { - condition: Qt.core.versionMajor > 4 - name: "Qt.qmltest" - } + Depends { name: "Qt.qmltest" } Group { name: "main application" - condition: Qt.core.versionMajor > 4 files: [ "main.cpp" ] } diff --git a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.qbs b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.qbs index 63a97fb7b7c..18c0d2bba24 100644 --- a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.qbs +++ b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/quickauto2/quickauto2.qbs @@ -6,14 +6,11 @@ CppApplication { Depends { name: "cpp" } Depends { name: "Qt.core" } - Depends { - condition: Qt.core.versionMajor > 4 - name: "Qt.qmltest" - } + Depends { name: "Qt.qmltest" } Group { - condition: Qt.core.versionMajor > 4 name: "main application" + files: [ "main.cpp" ] } diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp index 385c7c7e7de..096ed7301a2 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp @@ -29,8 +29,8 @@ #include "autotoolsproject.h" #include "autotoolsprojectconstants.h" -using namespace AutotoolsProjectManager; -using namespace AutotoolsProjectManager::Internal; +namespace AutotoolsProjectManager { +namespace Internal { AutotoolsProjectFile::AutotoolsProjectFile(const QString &fileName) { @@ -39,30 +39,5 @@ AutotoolsProjectFile::AutotoolsProjectFile(const QString &fileName) setFilePath(Utils::FileName::fromString(fileName)); } -bool AutotoolsProjectFile::save(QString *errorString, const QString &fileName, bool autoSave) -{ - Q_UNUSED(errorString); - Q_UNUSED(fileName); - Q_UNUSED(autoSave); - - return false; -} - -bool AutotoolsProjectFile::isModified() const -{ - return false; -} - -bool AutotoolsProjectFile::isSaveAsAllowed() const -{ - return false; -} - -bool AutotoolsProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type) -{ - Q_UNUSED(errorString); - Q_UNUSED(flag); - Q_UNUSED(type); - - return false; -} +} // namespace Internal +} // namespace AutotoolsProjectManager diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h index b4c6187d676..58cdfa08c98 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h @@ -32,8 +32,6 @@ namespace AutotoolsProjectManager { namespace Internal { -class AutotoolsProject; - /** * @brief Implementation of the Core::IDocument interface. * @@ -47,14 +45,8 @@ class AutotoolsProject; class AutotoolsProjectFile : public Core::IDocument { Q_OBJECT - public: AutotoolsProjectFile(const QString &fileName); - - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - bool isModified() const override; - bool isSaveAsAllowed() const override; - bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; }; } // namespace Internal diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.cpp b/src/plugins/cmakeprojectmanager/builddirmanager.cpp index 7f742228c7b..181ca556a7c 100644 --- a/src/plugins/cmakeprojectmanager/builddirmanager.cpp +++ b/src/plugins/cmakeprojectmanager/builddirmanager.cpp @@ -60,8 +60,8 @@ namespace CMakeProjectManager { namespace Internal { -static QStringList toArguments(const CMakeConfig &config) { - return Utils::transform(config, [](const CMakeConfigItem &i) -> QString { +static QStringList toArguments(const CMakeConfig &config, const ProjectExplorer::Kit *k) { + return Utils::transform(config, [k](const CMakeConfigItem &i) -> QString { QString a = QString::fromLatin1("-D"); a.append(QString::fromUtf8(i.key)); switch (i.type) { @@ -81,7 +81,7 @@ static QStringList toArguments(const CMakeConfig &config) { a.append(QLatin1String(":INTERNAL=")); break; } - a.append(QString::fromUtf8(i.value)); + a.append(QString::fromUtf8(k->macroExpander()->expand(i.value))); return a; }); @@ -110,6 +110,7 @@ BuildDirManager::BuildDirManager(const CMakeBuildConfiguration *bc) : BuildDirManager::~BuildDirManager() { + stopProcess(); resetData(); delete m_tempDir; } @@ -153,6 +154,9 @@ bool BuildDirManager::isParsing() const void BuildDirManager::forceReparse() { + if (m_buildConfiguration->target()->activeBuildConfiguration() != m_buildConfiguration) + return; + stopProcess(); CMakeTool *tool = CMakeKitInformation::cmakeTool(kit()); @@ -424,11 +428,11 @@ void BuildDirManager::startCMake(CMakeTool *tool, const QString &generator, Utils::QtcProcess::addArg(&args, srcDir); if (!generator.isEmpty()) Utils::QtcProcess::addArg(&args, QString::fromLatin1("-G%1").arg(generator)); - Utils::QtcProcess::addArgs(&args, toArguments(config)); + Utils::QtcProcess::addArgs(&args, toArguments(config, kit())); ProjectExplorer::TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM); - Core::MessageManager::write(tr("Running '%1 %2' in %3.") + Core::MessageManager::write(tr("Running \"%1 %2\" in %3.") .arg(tool->cmakeExecutable().toUserOutput()) .arg(args) .arg(workDirectory().toUserOutput())); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index e273e974fb0..6d32868a9f1 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -266,12 +266,14 @@ bool CMakeBuildStep::immutable() const void CMakeBuildStep::stdOutput(const QString &line) { if (m_percentProgress.indexIn(line) != -1) { + AbstractProcessStep::stdOutput(line); bool ok = false; int percent = m_percentProgress.cap(1).toInt(&ok); if (ok) futureInterface()->setProgressValue(percent); return; } else if (m_ninjaProgress.indexIn(line) != -1) { + AbstractProcessStep::stdOutput(line); m_useNinja = true; bool ok = false; int done = m_ninjaProgress.cap(1).toInt(&ok); diff --git a/src/plugins/cmakeprojectmanager/cmakefile.cpp b/src/plugins/cmakeprojectmanager/cmakefile.cpp index ec0bcb48187..0d338840166 100644 --- a/src/plugins/cmakeprojectmanager/cmakefile.cpp +++ b/src/plugins/cmakeprojectmanager/cmakefile.cpp @@ -41,26 +41,6 @@ CMakeFile::CMakeFile(const FileName &fileName) setFilePath(fileName); } -bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave) -{ - // Once we have an texteditor open for this file, we probably do - // need to implement this, don't we. - Q_UNUSED(errorString) - Q_UNUSED(fileName) - Q_UNUSED(autoSave) - return false; -} - -bool CMakeFile::isModified() const -{ - return false; -} - -bool CMakeFile::isSaveAsAllowed() const -{ - return false; -} - Core::IDocument::ReloadBehavior CMakeFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { Q_UNUSED(state) @@ -68,12 +48,5 @@ Core::IDocument::ReloadBehavior CMakeFile::reloadBehavior(ChangeTrigger state, C return BehaviorSilent; } -bool CMakeFile::reload(QString *errorString, ReloadFlag flag, ChangeType type) -{ - Q_UNUSED(errorString) - Q_UNUSED(flag) - Q_UNUSED(type) - return true; -} } // namespace Internal } // namespace CMakeProjectManager diff --git a/src/plugins/cmakeprojectmanager/cmakefile.h b/src/plugins/cmakeprojectmanager/cmakefile.h index 675c3c9d989..0b5d0992c4b 100644 --- a/src/plugins/cmakeprojectmanager/cmakefile.h +++ b/src/plugins/cmakeprojectmanager/cmakefile.h @@ -38,13 +38,7 @@ class CMakeFile : public Core::IDocument public: CMakeFile(const Utils::FileName &fileName); - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; - ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; - bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; }; } // namespace Internal diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index e0d5f786810..d303c232871 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -325,14 +325,12 @@ void CMakeConfigurationKitInformation::fromStringList(Kit *k, const QStringList QVariant CMakeConfigurationKitInformation::defaultValue(const Kit *k) const { + Q_UNUSED(k); + // FIXME: Convert preload scripts CMakeConfig config; - const QtSupport::BaseQtVersion *const version = QtSupport::QtKitInformation::qtVersion(k); - if (version && version->isValid()) - config << CMakeConfigItem(CMAKE_QMAKE_KEY, version->qmakeCommand().toString().toUtf8()); - const ToolChain *const tc = ToolChainKitInformation::toolChain(k); - if (tc && tc->isValid()) - config << CMakeConfigItem(CMAKE_TOOLCHAIN_KEY, tc->compilerCommand().toString().toUtf8()); + config << CMakeConfigItem(CMAKE_QMAKE_KEY, "%{Qt:qmakeExecutable}"); + config << CMakeConfigItem(CMAKE_TOOLCHAIN_KEY, "%{Compiler:Executable}"); const QStringList tmp = Utils::transform(config, [](const CMakeConfigItem &i) { return i.toString(); }); @@ -348,10 +346,12 @@ QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const QByteArray qmakePath; QByteArray tcPath; foreach (const CMakeConfigItem &i, config) { + // Do not use expand(QByteArray) as we can not be sure the input is latin1 + const QByteArray expandedValue = k->macroExpander()->expand(QString::fromUtf8(i.value)).toUtf8(); if (i.key == CMAKE_QMAKE_KEY) - qmakePath = i.value; + qmakePath = expandedValue; else if (i.key == CMAKE_TOOLCHAIN_KEY) - tcPath = i.value; + tcPath = expandedValue; } QList<Task> result; @@ -406,31 +406,7 @@ void CMakeConfigurationKitInformation::setup(Kit *k) void CMakeConfigurationKitInformation::fix(Kit *k) { - const QtSupport::BaseQtVersion *const version = QtSupport::QtKitInformation::qtVersion(k); - const QByteArray qmakePath - = (version && version->isValid()) ? version->qmakeCommand().toString().toUtf8() : QByteArray(); - const ToolChain *const tc = ToolChainKitInformation::toolChain(k); - const QByteArray tcPath - = (tc && tc->isValid()) ? tc->compilerCommand().toString().toUtf8() : QByteArray(); - - CMakeConfig result; - bool haveQmake = false; - bool haveToolChain = false; - - foreach (const CMakeConfigItem &i, configuration(k)) { - if (i.key == CMAKE_QMAKE_KEY) - haveQmake = true; - else if (i.key == CMAKE_TOOLCHAIN_KEY) - haveToolChain = true; - result << i; - } - - if (!haveQmake && !qmakePath.isEmpty()) - result << CMakeConfigItem(CMAKE_QMAKE_KEY, qmakePath); - if (!haveToolChain && !tcPath.isEmpty()) - result << CMakeConfigItem(CMAKE_TOOLCHAIN_KEY, tcPath); - - setConfiguration(k, result); + Q_UNUSED(k); } KitInformation::ItemList CMakeConfigurationKitInformation::toUserOutput(const Kit *k) const diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 2a2376f1487..7181db157bc 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -117,7 +117,6 @@ void CMakeManager::clearCMakeCache(Project *project) if (!bc) return; - bc->setCMakeConfiguration(CMakeConfigurationKitInformation::configuration(bc->target()->kit())); bc->buildDirManager()->clearCache(); } diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index d54e1f34185..77052130fdb 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -198,6 +198,7 @@ const char SETTINGS_ID_MIMETYPES[] = "E.MimeTypes"; const char SETTINGS_DEFAULTTEXTENCODING[] = "General/DefaultFileEncoding"; const char SETTINGS_THEME[] = "Core/CreatorTheme"; +const char DEFAULT_THEME[] = "default"; const char ALL_FILES_FILTER[] = QT_TRANSLATE_NOOP("Core", "All Files (*)"); diff --git a/src/plugins/coreplugin/coreicons.cpp b/src/plugins/coreplugin/coreicons.cpp index 1cf5243bfb5..4432a3c7040 100644 --- a/src/plugins/coreplugin/coreicons.cpp +++ b/src/plugins/coreplugin/coreicons.cpp @@ -84,7 +84,7 @@ const Icon NEXT({ const Icon PREV({ {QLatin1String(":/core/images/prev.png"), Theme::IconsNavigationArrowsColor}}); const Icon MAGNIFIER({ - {QLatin1String(":/core/images/magnifier.png"), Theme::BackgroundColorHover}}, Icon::Tint); + {QLatin1String(":/core/images/magnifier.png"), Theme::PanelTextColorMid}}, Icon::Tint); const Icon CLEAN_PANE({ {QLatin1String(":/core/images/clean_pane_small.png"), Theme::IconsBaseColor}}); const Icon RELOAD({ diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index 7f750b36734..a170e4f487c 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -96,7 +96,7 @@ CorePlugin::~CorePlugin() void CorePlugin::parseArguments(const QStringList &arguments) { const Id settingsThemeId = Id::fromSetting(ICore::settings()->value( - QLatin1String(Constants::SETTINGS_THEME), QLatin1String("default"))); + QLatin1String(Constants::SETTINGS_THEME), QLatin1String(Constants::DEFAULT_THEME))); Id themeId = settingsThemeId; QColor overrideColor; bool presentationMode = false; diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp index 6f84a4bd5ed..9b62f7375e0 100644 --- a/src/plugins/coreplugin/editormanager/documentmodel.cpp +++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp @@ -109,15 +109,6 @@ private: QHash<QString, DocumentModel::Entry *> m_entryByFixedPath; }; -class SuspendedDocument : public IDocument -{ -public: - bool save(QString *, const QString &, bool) override { return false; } - bool isModified() const override { return false; } - bool isSaveAsAllowed() const override { return false; } - bool reload(QString *, ReloadFlag, ChangeType) override { return true; } -}; - DocumentModelPrivate::DocumentModelPrivate() : m_lockedIcon(Icons::LOCKED.icon()), m_unlockedIcon(Icons::UNLOCKED.icon()) @@ -226,7 +217,7 @@ void DocumentModel::addEditor(IEditor *editor, bool *isNewDocument) void DocumentModel::addSuspendedDocument(const QString &fileName, const QString &displayName, Id id) { Entry *entry = new Entry; - entry->document = new SuspendedDocument; + entry->document = new IDocument; entry->document->setFilePath(Utils::FileName::fromString(fileName)); entry->document->setPreferredDisplayName(displayName); entry->document->setId(id); diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index 1f3badca6c4..5a40de718a9 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -272,9 +272,7 @@ void FancyActionBar::paintEvent(QPaintEvent *event) if (creatorTheme()->widgetStyle () == Theme::StyleFlat) { // this paints the background of the bottom portion of the // left tab bar - painter.fillRect(event->rect(), StyleHelper::isBaseColorDefault() - ? creatorTheme()->color(Theme::FancyTabBarBackgroundColor) - : StyleHelper::baseColor()); + painter.fillRect(event->rect(), StyleHelper::baseColor()); painter.setPen(creatorTheme()->color(Theme::FancyToolBarSeparatorColor)); painter.drawLine(borderRect.topLeft(), borderRect.topRight()); } else { diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index c74212312b3..bd3fe6114b6 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -33,7 +33,6 @@ #include <QDebug> -#include <QColorDialog> #include <QHBoxLayout> #include <QVBoxLayout> #include <QMouseEvent> @@ -119,9 +118,7 @@ void FancyTabBar::paintEvent(QPaintEvent *event) if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { // draw background of upper part of left tab widget // (Welcome, ... Help) - p.fillRect(event->rect(), StyleHelper::isBaseColorDefault() - ? creatorTheme()->color(Theme::FancyTabBarBackgroundColor) - : StyleHelper::baseColor()); + p.fillRect(event->rect(), StyleHelper::baseColor()); } for (int i = 0; i < count(); ++i) @@ -329,7 +326,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const painter->restore(); } - if (!enabled) + if (!enabled && creatorTheme()->widgetStyle() == Theme::StyleDefault) painter->setOpacity(0.7); if (drawIcon) { @@ -393,23 +390,22 @@ bool FancyTabBar::isTabEnabled(int index) const class FancyColorButton : public QWidget { + Q_OBJECT + public: - FancyColorButton(QWidget *parent) - : m_parent(parent) + explicit FancyColorButton(QWidget *parent = 0) + : QWidget(parent) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); } void mousePressEvent(QMouseEvent *ev) { - if (ev->modifiers() & Qt::ShiftModifier) { - QColor color = QColorDialog::getColor(StyleHelper::requestedBaseColor(), m_parent); - if (color.isValid()) - StyleHelper::setBaseColor(color); - } + emit clicked(ev->button(), ev->modifiers()); } -private: - QWidget *m_parent; + +signals: + void clicked(Qt::MouseButton button, Qt::KeyboardModifiers modifiers); }; ////// @@ -430,7 +426,9 @@ FancyTabWidget::FancyTabWidget(QWidget *parent) QHBoxLayout *layout = new QHBoxLayout(bar); layout->setMargin(0); layout->setSpacing(0); - layout->addWidget(new FancyColorButton(this)); + auto fancyButton = new FancyColorButton(this); + connect(fancyButton, &FancyColorButton::clicked, this, &FancyTabWidget::topAreaClicked); + layout->addWidget(fancyButton); selectionLayout->addWidget(bar); selectionLayout->addWidget(m_tabBar, 1); @@ -571,3 +569,5 @@ bool FancyTabWidget::isTabEnabled(int index) const { return m_tabBar->isTabEnabled(index); } + +#include "fancytabwidget.moc" diff --git a/src/plugins/coreplugin/fancytabwidget.h b/src/plugins/coreplugin/fancytabwidget.h index cb14adf4afe..b871af08c6e 100644 --- a/src/plugins/coreplugin/fancytabwidget.h +++ b/src/plugins/coreplugin/fancytabwidget.h @@ -162,6 +162,7 @@ public: signals: void currentAboutToShow(int index); void currentChanged(int index); + void topAreaClicked(Qt::MouseButton button, Qt::KeyboardModifiers modifiers); public slots: void setCurrentIndex(int index); diff --git a/src/plugins/coreplugin/idocument.cpp b/src/plugins/coreplugin/idocument.cpp index 92114a8f3c7..3a282a45d65 100644 --- a/src/plugins/coreplugin/idocument.cpp +++ b/src/plugins/coreplugin/idocument.cpp @@ -145,6 +145,14 @@ IDocument::OpenResult IDocument::open(QString *errorString, const QString &fileN return OpenResult::CannotHandle; } +bool IDocument::save(QString *errorString, const QString &fileName, bool autoSave) +{ + Q_UNUSED(errorString) + Q_UNUSED(fileName) + Q_UNUSED(autoSave) + return false; +} + /*! * Returns the current contents of the document. The base implementation returns an empty * QByteArray. @@ -180,6 +188,14 @@ IDocument::ReloadBehavior IDocument::reloadBehavior(ChangeTrigger state, ChangeT return BehaviorAsk; } +bool IDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type) +{ + Q_UNUSED(errorString) + Q_UNUSED(flag) + Q_UNUSED(type) + return true; +} + void IDocument::checkPermissions() { } @@ -189,6 +205,16 @@ bool IDocument::shouldAutoSave() const return false; } +bool IDocument::isModified() const +{ + return false; +} + +bool IDocument::isSaveAsAllowed() const +{ + return false; +} + bool IDocument::isFileReadOnly() const { if (filePath().isEmpty()) diff --git a/src/plugins/coreplugin/idocument.h b/src/plugins/coreplugin/idocument.h index 21b64ef31a7..72a3dd43337 100644 --- a/src/plugins/coreplugin/idocument.h +++ b/src/plugins/coreplugin/idocument.h @@ -89,7 +89,7 @@ public: // required to be re-implemented for documents of IEditors virtual OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName); - virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false) = 0; + virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false); virtual QByteArray contents() const; virtual bool setContents(const QByteArray &contents); @@ -112,11 +112,11 @@ public: void setMimeType(const QString &mimeType); virtual bool shouldAutoSave() const; - virtual bool isModified() const = 0; - virtual bool isSaveAsAllowed() const = 0; + virtual bool isModified() const; + virtual bool isSaveAsAllowed() const; virtual ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; - virtual bool reload(QString *errorString, ReloadFlag flag, ChangeType type) = 0; + virtual bool reload(QString *errorString, ReloadFlag flag, ChangeType type); virtual void checkPermissions(); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 1da372d3a12..374cb87da1f 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -79,6 +79,7 @@ #include <QApplication> #include <QCloseEvent> +#include <QColorDialog> #include <QDebug> #include <QDir> #include <QFileInfo> @@ -175,6 +176,13 @@ MainWindow::MainWindow() : setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea); m_modeManager = new ModeManager(this, m_modeStack); + connect(m_modeStack, &FancyTabWidget::topAreaClicked, this, [](Qt::MouseButton, Qt::KeyboardModifiers modifiers) { + if (modifiers & Qt::ShiftModifier) { + QColor color = QColorDialog::getColor(StyleHelper::requestedBaseColor(), ICore::dialogParent()); + if (color.isValid()) + StyleHelper::setBaseColor(color); + } + }); registerDefaultContainers(); registerDefaultActions(); diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index d3583fab311..735eb9e83e3 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -488,15 +488,14 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption QColor shadow(0, 0, 0, 30); painter->setPen(shadow); if (pressed) { - QColor shade = option->palette.base().color(); - shade.setHsv(shade.hue(), shade.saturation(), 255 - shade.value(), 40); + const QColor shade = creatorTheme()->color(Theme::FancyToolButtonSelectedColor); painter->fillRect(rect, shade); 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::PanelButtonToolBackgroundColorHover)); + painter->fillRect(rect, creatorTheme()->color(Theme::FancyToolButtonHoverColor)); } else if (widget && widget->property("highlightWidget").toBool()) { QColor shade(0, 0, 0, 128); painter->fillRect(rect, shade); @@ -529,7 +528,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption painter->drawLine(borderRect.topLeft(), borderRect.topRight()); painter->restore(); } else { - painter->fillRect(rect, creatorTheme()->color(Theme::PanelStatusBarBackgroundColor)); + painter->fillRect(rect, StyleHelper::baseColor()); } } break; @@ -652,9 +651,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt const bool dis = !(mbi->state & State_Enabled); if (creatorTheme()->flag(Theme::FlatMenuBar)) - painter->fillRect(option->rect, StyleHelper::isBaseColorDefault() - ? creatorTheme()->color(Theme::MenuBarItemBackgroundColor) - : StyleHelper::baseColor()); + painter->fillRect(option->rect, StyleHelper::baseColor()); else StyleHelper::menuGradient(painter, option->rect, option->rect); @@ -792,9 +789,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt option->rect.bottomRight() + QPointF(0.5, 0.5)); painter->restore(); } else { - painter->fillRect(option->rect, StyleHelper::isBaseColorDefault() - ? creatorTheme()->color(Theme::MenuBarEmptyAreaBackgroundColor) - : StyleHelper::baseColor()); + painter->fillRect(option->rect, StyleHelper::baseColor()); } } break; @@ -816,9 +811,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt bool drawLightColored = lightColored(widget); // draws the background of the 'Type hierarchy', 'Projects' headers if (creatorTheme()->widgetStyle() == Theme::StyleFlat) - painter->fillRect(rect, StyleHelper::isBaseColorDefault() - ? creatorTheme()->color(Theme::ToolBarBackgroundColor) - : StyleHelper::baseColor(drawLightColored)); + painter->fillRect(rect, StyleHelper::baseColor(drawLightColored)); else if (horizontal) StyleHelper::horizontalGradient(painter, gradientSpan, rect, drawLightColored); else diff --git a/src/plugins/coreplugin/minisplitter.cpp b/src/plugins/coreplugin/minisplitter.cpp index c00a31fd51d..d32d0bdf321 100644 --- a/src/plugins/coreplugin/minisplitter.cpp +++ b/src/plugins/coreplugin/minisplitter.cpp @@ -72,9 +72,9 @@ void MiniSplitterHandle::resizeEvent(QResizeEvent *event) void MiniSplitterHandle::paintEvent(QPaintEvent *event) { QPainter painter(this); - const QColor color = m_lightColored - ? Utils::StyleHelper::borderColor(m_lightColored) - : Utils::creatorTheme()->color(Utils::Theme::SplitterColor); + const QColor color = Utils::creatorTheme()->color( + m_lightColored ? Utils::Theme::FancyToolBarSeparatorColor + : Utils::Theme::SplitterColor); painter.fillRect(event->rect(), color); } diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 231ea7509ca..eeb14f596e9 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -686,17 +686,15 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent*) if (image) StyleHelper::drawCornerImage(*image, &p, rect(), numberAreaWidth, buttonBorderWidth, buttonBorderWidth, buttonBorderWidth); } else { - QColor c; - if (isChecked()) { - c = creatorTheme()->color(hovered ? Theme::BackgroundColorHover - : Theme::BackgroundColorSelected); - } else if (isDown()) { - c = creatorTheme()->color(Theme::BackgroundColorSelected); - } else { - c = creatorTheme()->color(hovered ? Theme::BackgroundColorHover - : Theme::BackgroundColorDark); - } - p.fillRect(rect(), c); + Theme::Color c = Theme::BackgroundColorDark; + + if (hovered) + c = Theme::BackgroundColorHover; + else if (isDown() || isChecked()) + c = Theme::BackgroundColorSelected; + + if (c != Theme::BackgroundColorDark) + p.fillRect(rect(), creatorTheme()->color(c)); } if (m_flashTimer->state() == QTimeLine::Running) diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.cpp b/src/plugins/coreplugin/progressmanager/futureprogress.cpp index e06451eac60..dd1a9bf59f7 100644 --- a/src/plugins/coreplugin/progressmanager/futureprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/futureprogress.cpp @@ -296,7 +296,7 @@ void FutureProgress::paintEvent(QPaintEvent *) { QPainter p(this); if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { - p.fillRect(rect(), creatorTheme()->color(Theme::FutureProgressBackgroundColor)); + p.fillRect(rect(), StyleHelper::baseColor()); } else { QLinearGradient grad = StyleHelper::statusBarGradient(rect()); p.fillRect(rect(), grad); diff --git a/src/plugins/coreplugin/progressmanager/progressbar.cpp b/src/plugins/coreplugin/progressmanager/progressbar.cpp index 97c98bc4956..a1c3fcbd919 100644 --- a/src/plugins/coreplugin/progressmanager/progressbar.cpp +++ b/src/plugins/coreplugin/progressmanager/progressbar.cpp @@ -229,11 +229,7 @@ void ProgressBar::paintEvent(QPaintEvent *) double range = maximum() - minimum(); double percent = 0.; if (!qFuzzyIsNull(range)) - percent = (value() - minimum()) / range; - if (percent > 1) - percent = 1; - else if (percent < 0) - percent = 0; + percent = qBound(0., (value() - minimum()) / range, 1.); if (finished()) percent = 1; @@ -285,22 +281,20 @@ void ProgressBar::paintEvent(QPaintEvent *) QRectF inner = rect.adjusted(2, 2, -2, -2); inner.adjust(0, 0, qRound((percent - 1) * inner.width()), 0); - QColor c; - if (m_error) { - c = creatorTheme()->color(Theme::ProgressBarColorError); - // avoid too small red bar - if (inner.width() < 10) - inner.adjust(0, 0, 10 - inner.width(), 0); - } else if (m_finished) { - c = creatorTheme()->color(Theme::ProgressBarColorFinished); - } else { - c = creatorTheme()->color(Theme::ProgressBarColorNormal); - } + // Show at least a hint of progress. Non-flat needs more pixels due to the borders. + inner.setWidth(qMax(qMin(3.0, qreal(rect.width())), inner.width())); + + Theme::Color themeColor = Theme::ProgressBarColorNormal; + if (m_error) + themeColor = Theme::ProgressBarColorError; + else if (m_finished) + themeColor = Theme::ProgressBarColorFinished; + const QColor c = creatorTheme()->color(themeColor); //draw the progress bar if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { p.fillRect(rect.adjusted(2, 2, -2, -2), - creatorTheme()->color(Theme::FancyToolButtonHoverColor)); + creatorTheme()->color(Theme::ProgressBarBackgroundColor)); p.fillRect(inner, c); } else { const static QImage bar(StyleHelper::dpiSpecificImageFile( diff --git a/src/plugins/coreplugin/themechooser.cpp b/src/plugins/coreplugin/themechooser.cpp index ffb94438be8..82fc65ece49 100644 --- a/src/plugins/coreplugin/themechooser.cpp +++ b/src/plugins/coreplugin/themechooser.cpp @@ -172,7 +172,7 @@ void ThemeChooser::apply() const QString themeId = d->m_themeListModel->themeAt(index).id().toString(); QSettings *settings = ICore::settings(); const QString currentThemeId = settings->value(QLatin1String(Constants::SETTINGS_THEME), - QLatin1String("default")).toString(); + QLatin1String(Constants::DEFAULT_THEME)).toString(); if (currentThemeId != themeId) { QMessageBox::information(ICore::mainWindow(), tr("Restart Required"), tr("The theme change will take effect after a restart of Qt Creator.")); @@ -206,7 +206,7 @@ QList<ThemeEntry> ThemeEntry::availableThemes() qWarning() << "Warning: No themes found in installation: " << QDir::toNativeSeparators(installThemeDir); // move default theme to front - int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, Id("default"))); + int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, Id(Constants::DEFAULT_THEME))); if (defaultIndex > 0) { // == exists and not at front ThemeEntry defaultEntry = themes.takeAt(defaultIndex); themes.prepend(defaultEntry); diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index f631fcd884a..4c064583e47 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -235,8 +235,6 @@ CdbEngine::CdbEngine(const DebuggerRunParameters &sp) : m_extensionCommandPrefixBA("!" QT_CREATOR_CDB_EXT "."), m_operateByInstructionPending(true), m_operateByInstruction(true), // Default CDB setting - m_verboseLogPending(true), - m_verboseLog(false), // Default CDB setting m_hasDebuggee(false), m_wow64State(wow64Uninitialized), m_elapsedLogTime(0), @@ -249,8 +247,6 @@ CdbEngine::CdbEngine(const DebuggerRunParameters &sp) : connect(action(OperateByInstruction), &QAction::triggered, this, &CdbEngine::operateByInstructionTriggered); - connect(action(VerboseLog), &QAction::triggered, - this, &CdbEngine::verboseLogTriggered); connect(action(CreateFullBacktrace), &QAction::triggered, this, &CdbEngine::createFullBacktrace); connect(&m_process, static_cast<void(QProcess::*)(int)>(&QProcess::finished), @@ -272,9 +268,7 @@ void CdbEngine::init() m_nextCommandToken = 0; m_currentBuiltinResponseToken = -1; m_operateByInstructionPending = action(OperateByInstruction)->isChecked(); - m_verboseLogPending = boolSetting(VerboseLog); m_operateByInstruction = true; // Default CDB setting - m_verboseLog = false; // Default CDB setting m_hasDebuggee = false; m_sourceStepInto = false; m_watchPointX = m_watchPointY = 0; @@ -321,13 +315,6 @@ void CdbEngine::operateByInstructionTriggered(bool operateByInstruction) syncOperateByInstruction(operateByInstruction); } -void CdbEngine::verboseLogTriggered(bool verboseLog) -{ - m_verboseLogPending = verboseLog; - if (state() == InferiorStopOk) - syncVerboseLog(verboseLog); -} - void CdbEngine::syncOperateByInstruction(bool operateByInstruction) { if (debug) @@ -340,15 +327,6 @@ void CdbEngine::syncOperateByInstruction(bool operateByInstruction) runCommand({m_operateByInstruction ? "l-s" : "l+s", NoFlags}); } -void CdbEngine::syncVerboseLog(bool verboseLog) -{ - if (m_verboseLog == verboseLog) - return; - QTC_ASSERT(m_accessible, return); - m_verboseLog = verboseLog; - runCommand({m_verboseLog ? "!sym noisy" : "!sym quiet", NoFlags}); -} - bool CdbEngine::canHandleToolTip(const DebuggerToolTipContext &context) const { Q_UNUSED(context); @@ -566,9 +544,6 @@ bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage if (boolSetting(IgnoreFirstChanceAccessViolation)) arguments << QLatin1String("-x"); - const QStringList &symbolPaths = stringListSetting(CdbSymbolPaths); - if (!symbolPaths.isEmpty()) - arguments << QLatin1String("-y") << symbolPaths.join(QLatin1Char(';')); const QStringList &sourcePaths = stringListSetting(CdbSourcePaths); if (!sourcePaths.isEmpty()) arguments << QLatin1String("-srcpath") << sourcePaths.join(QLatin1Char(';')); @@ -664,6 +639,19 @@ void CdbEngine::setupInferior() runCommand({cdbAddBreakpointCommand(bp, m_sourcePathMappings, id, true), BuiltinCommand, [this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); }}); } + + // setting up symbol search path + QStringList symbolPaths = stringListSetting(CdbSymbolPaths); + const QProcessEnvironment &env = m_process.processEnvironment(); + QString symbolPath = env.value(QLatin1String("_NT_ALT_SYMBOL_PATH")); + if (!symbolPath.isEmpty()) + symbolPaths += symbolPath; + symbolPath = env.value(QLatin1String("_NT_SYMBOL_PATH")); + if (!symbolPath.isEmpty()) + symbolPaths += symbolPath; + runCommand({".sympath \"" + symbolPaths.join(QLatin1Char(';')).toLatin1() + '"', NoFlags}); + + runCommand({"!sym noisy", NoFlags}); // Show symbol load information. runCommand({"sxn 0x4000001f", NoFlags}); // Do not break on WowX86 exceptions. runCommand({"sxn ibp", NoFlags}); // Do not break on initial breakpoints. runCommand({".asm source_line", NoFlags}); // Source line in assembly @@ -1261,8 +1249,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters) } } } - if (boolSetting(VerboseLog)) - str << blankSeparator << "-v"; + str << blankSeparator << "-v"; if (boolSetting(UseDebuggingHelpers)) str << blankSeparator << "-c"; if (boolSetting(SortStructMembers)) @@ -1668,8 +1655,7 @@ void CdbEngine::handleRegistersExt(const DebuggerResponse &response) void CdbEngine::handleLocals(const DebuggerResponse &response, bool partialUpdate) { if (response.resultClass == ResultDone) { - if (boolSetting(VerboseLog)) - showMessage(QLatin1String(response.data.toString()), LogDebug); + showMessage(QLatin1String(response.data.toString()), LogDebug); GdbMi partial; partial.m_name = "partial"; @@ -1887,8 +1873,6 @@ void CdbEngine::handleSessionIdle(const QByteArray &messageBA) elapsedLogTime(), messageBA.constData(), stateName(state()), m_specialStopMode); - syncVerboseLog(m_verboseLogPending); - // Switch source level debugging syncOperateByInstruction(m_operateByInstructionPending); @@ -2392,8 +2376,7 @@ void CdbEngine::parseOutputLine(QByteArray line) command.function.data(), m_currentBuiltinResponseToken, m_currentBuiltinResponse.count('\n'), m_commandForToken.size() - 1); QTC_ASSERT(token == m_currentBuiltinResponseToken, return); - if (boolSetting(VerboseLog)) - showMessage(QLatin1String(m_currentBuiltinResponse), LogMisc); + showMessage(QLatin1String(m_currentBuiltinResponse), LogMisc); if (command.callback) { DebuggerResponse response; response.token = token; diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index 2d06c3ec497..536157f9ced 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -124,7 +124,6 @@ private slots: void processFinished(); void runCommand(const DebuggerCommand &cmd) override; void operateByInstructionTriggered(bool); - void verboseLogTriggered(bool); void consoleStubError(const QString &); void consoleStubProcessStarted(); @@ -184,7 +183,6 @@ private: inline bool isCdbProcessRunning() const { return m_process.state() != QProcess::NotRunning; } bool canInterruptInferior() const; void syncOperateByInstruction(bool operateByInstruction); - void syncVerboseLog(bool verboseLog); void postWidgetAtCommand(); void handleCustomSpecialStop(const QVariant &v); void postFetchMemory(const MemoryViewCookie &c); @@ -240,8 +238,6 @@ private: const QByteArray m_extensionCommandPrefixBA; //!< Library name used as prefix bool m_operateByInstructionPending; //!< Creator operate by instruction action changed. bool m_operateByInstruction; - bool m_verboseLogPending; //!< Creator verbose log action changed. - bool m_verboseLog; bool m_hasDebuggee; enum Wow64State { wow64Uninitialized, diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index c1617434ea0..d97a9df0b39 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -211,7 +211,6 @@ CommonOptionsPageWidget::CommonOptionsPageWidget m_group->insert(action(ShowQObjectNames), 0); m_group->insert(action(SortStructMembers), 0); m_group->insert(action(LogTimeStamps), 0); - m_group->insert(action(VerboseLog), 0); m_group->insert(action(BreakOnThrow), 0); m_group->insert(action(BreakOnCatch), 0); if (Utils::HostOsInfo::isWindowsHost()) { diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 8b9fb0dc06e..08d0e25fd82 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -141,6 +141,11 @@ SOURCES += registerpostmortemaction.cpp LIBS *= -lole32 \ -lshell32 } + +equals(TEST, 1) { + RESOURCES += debuggerunittests.qrc +} + include(cdb/cdb.pri) include(gdb/gdb.pri) include(pdb/pdb.pri) diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index df08a58de4d..a4c8834568f 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -18,6 +18,16 @@ QtcPlugin { Depends { name: "QtSupport" } Depends { name: "TextEditor" } + + Depends { + name: "Qt.test" + condition: project.testsEnabled + } + + pluginTestDepends: [ + "QmakeProjectManager" + ] + cpp.includePaths: base.concat([project.sharedSourcesDir + "/registryaccess"]) pluginRecommends: [ @@ -253,6 +263,21 @@ QtcPlugin { ] } + Group { + name: "Unit tests" + condition: project.testsEnabled + files: [ + "debuggerunittests.qrc", + ] + } + + Group { + name: "Unit test resources" + prefix: "unit-tests/" + fileTags: [] + files: ["**/*"] + } + Export { Depends { name: "QtcSsh" } Depends { name: "CPlusPlus" } diff --git a/src/plugins/debugger/debugger_dependencies.pri b/src/plugins/debugger/debugger_dependencies.pri index 259d30c6b1c..7c0f4911167 100644 --- a/src/plugins/debugger/debugger_dependencies.pri +++ b/src/plugins/debugger/debugger_dependencies.pri @@ -16,3 +16,6 @@ QTC_PLUGIN_DEPENDS += \ texteditor QTC_PLUGIN_RECOMMENDS += \ cppeditor +QTC_TEST_DEPENDS += \ + qmakeprojectmanager + diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index c43eb30b21d..5c225aed955 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -162,13 +162,6 @@ DebuggerSettings::DebuggerSettings() insertItem(LogTimeStamps, item); item = new SavedAction(this); - item->setText(tr("Verbose Log")); - item->setSettingsKey(debugModeGroup, QLatin1String("VerboseLog")); - item->setCheckable(true); - item->setDefaultValue(false); - insertItem(VerboseLog, item); - - item = new SavedAction(this); item->setText(tr("Operate by Instruction")); item->setCheckable(true); item->setDefaultValue(false); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index bb86f6bd722..6c1a7100e38 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -92,7 +92,6 @@ enum DebuggerActionCode AutoQuit, LockView, LogTimeStamps, - VerboseLog, OperateByInstruction, CloseSourceBuffersOnExit, CloseMemoryBuffersOnExit, diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h index 2ac5a48ce29..80e1f9b88a1 100644 --- a/src/plugins/debugger/debuggercore.h +++ b/src/plugins/debugger/debuggercore.h @@ -76,6 +76,7 @@ void runControlFinished(DebuggerEngine *engine); void displayDebugger(DebuggerEngine *engine, bool updateEngine); void synchronizeBreakpoints(); +void saveModeToRestore(); QWidget *mainWindow(); bool isRegistersWindowVisible(); bool isModulesWindowVisible(); @@ -93,6 +94,8 @@ void setSessionValue(const QByteArray &name, const QVariant &value); QVariant configValue(const QByteArray &name); void setConfigValue(const QByteArray &name, const QVariant &value); +bool isTestRun(); + Utils::SavedAction *action(int code); bool boolSetting(int code); QString stringSetting(int code); diff --git a/src/plugins/debugger/debuggeritem.cpp b/src/plugins/debugger/debuggeritem.cpp index ffa8c520369..ec6ac3d7995 100644 --- a/src/plugins/debugger/debuggeritem.cpp +++ b/src/plugins/debugger/debuggeritem.cpp @@ -363,114 +363,4 @@ bool DebuggerItem::isValid() const return !m_id.isNull(); } -#ifdef WITH_TESTS - -namespace Internal { - -void DebuggerPlugin::testDebuggerMatching_data() -{ - QTest::addColumn<QStringList>("debugger"); - QTest::addColumn<QString>("target"); - QTest::addColumn<int>("result"); - - QTest::newRow("Invalid data") - << QStringList() - << QString() - << int(DebuggerItem::DoesNotMatch); - QTest::newRow("Invalid debugger") - << QStringList() - << QString::fromLatin1("x86-linux-generic-elf-32bit") - << int(DebuggerItem::DoesNotMatch); - QTest::newRow("Invalid target") - << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) - << QString() - << int(DebuggerItem::DoesNotMatch); - - QTest::newRow("Fuzzy match 1") - << (QStringList() << QLatin1String("unknown-unknown-unknown-unknown-0bit")) - << QString::fromLatin1("x86-linux-generic-elf-32bit") - << int(DebuggerItem::MatchesWell); // Is this the expected behavior? - QTest::newRow("Fuzzy match 2") - << (QStringList() << QLatin1String("unknown-unknown-unknown-unknown-0bit")) - << QString::fromLatin1("arm-windows-msys-pe-64bit") - << int(DebuggerItem::MatchesWell); // Is this the expected behavior? - - QTest::newRow("Architecture mismatch") - << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) - << QString::fromLatin1("arm-linux-generic-elf-32bit") - << int(DebuggerItem::DoesNotMatch); - QTest::newRow("OS mismatch") - << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) - << QString::fromLatin1("x86-macosx-generic-elf-32bit") - << int(DebuggerItem::DoesNotMatch); - QTest::newRow("Format mismatch") - << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) - << QString::fromLatin1("x86-linux-generic-pe-32bit") - << int(DebuggerItem::DoesNotMatch); - - QTest::newRow("Linux perfect match") - << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) - << QString::fromLatin1("x86-linux-generic-elf-32bit") - << int(DebuggerItem::MatchesWell); - QTest::newRow("Linux match") - << (QStringList() << QLatin1String("x86-linux-generic-elf-64bit")) - << QString::fromLatin1("x86-linux-generic-elf-32bit") - << int(DebuggerItem::MatchesSomewhat); - - QTest::newRow("Windows perfect match 1") - << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) - << QString::fromLatin1("x86-windows-msvc2013-pe-64bit") - << int(DebuggerItem::MatchesWell); - QTest::newRow("Windows perfect match 2") - << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) - << QString::fromLatin1("x86-windows-msvc2012-pe-64bit") - << int(DebuggerItem::MatchesWell); - QTest::newRow("Windows match 1") - << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) - << QString::fromLatin1("x86-windows-msvc2013-pe-32bit") - << int(DebuggerItem::MatchesSomewhat); - QTest::newRow("Windows match 2") - << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) - << QString::fromLatin1("x86-windows-msvc2012-pe-32bit") - << int(DebuggerItem::MatchesSomewhat); - QTest::newRow("Windows mismatch on word size") - << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-32bit")) - << QString::fromLatin1("x86-windows-msvc2013-pe-64bit") - << int(DebuggerItem::DoesNotMatch); - QTest::newRow("Windows mismatch on osflavor 1") - << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-32bit")) - << QString::fromLatin1("x86-windows-msys-pe-64bit") - << int(DebuggerItem::DoesNotMatch); - QTest::newRow("Windows mismatch on osflavor 2") - << (QStringList() << QLatin1String("x86-windows-msys-pe-32bit")) - << QString::fromLatin1("x86-windows-msvc2010-pe-64bit") - << int(DebuggerItem::DoesNotMatch); -} - -void DebuggerPlugin::testDebuggerMatching() -{ - QFETCH(QStringList, debugger); - QFETCH(QString, target); - QFETCH(int, result); - - DebuggerItem::MatchLevel expectedLevel = static_cast<DebuggerItem::MatchLevel>(result); - - QList<Abi> debuggerAbis; - foreach (const QString &abi, debugger) - debuggerAbis << Abi(abi); - - DebuggerItem item; - item.setAbis(debuggerAbis); - - DebuggerItem::MatchLevel level = item.matchTarget(Abi(target)); - if (level == DebuggerItem::MatchesPerfectly) - level = DebuggerItem::MatchesWell; - - QCOMPARE(expectedLevel, level); -} - -} // namespace Internal - -#endif - } // namespace Debugger; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 65025a9b008..267821535fc 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -34,6 +34,7 @@ #include "debuggerdialogs.h" #include "debuggerengine.h" #include "debuggericons.h" +#include "debuggeritem.h" #include "debuggeritemmanager.h" #include "debuggermainwindow.h" #include "debuggerrunconfigurationaspect.h" @@ -84,7 +85,6 @@ #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> @@ -98,8 +98,6 @@ #include <cppeditor/cppeditorconstants.h> #include <cpptools/cppmodelmanager.h> -#include <extensionsystem/invoker.h> - #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildmanager.h> #include <projectexplorer/devicesupport/deviceprocessesdialog.h> @@ -160,14 +158,11 @@ #include <QVariant> #include <QtPlugin> -using namespace Core; -using namespace Utils; -using namespace Core::Constants; -using namespace ProjectExplorer; -using namespace Debugger; -using namespace Debugger::Internal; - #ifdef WITH_TESTS + +#include <cpptools/cpptoolstestcase.h> +#include <cpptools/projectinfo.h> + #include <QTest> #include <QSignalSpy> #include <QTestEventLoop> @@ -414,6 +409,7 @@ sg1: } \endcode */ using namespace Core; +using namespace Core::Constants; using namespace Debugger::Constants; using namespace Debugger::Internal; using namespace ExtensionSystem; @@ -427,16 +423,6 @@ namespace PE = ProjectExplorer::Constants; namespace Debugger { namespace Internal { -struct TestCallBack -{ - TestCallBack() : receiver(0), slot(0) {} - TestCallBack(QObject *ob, const char *s) : receiver(ob), slot(s) {} - - QObject *receiver; - const char *slot; - QVariant cookie; -}; - void addCdbOptionPages(QList<IOptionsPage*> *opts); void addGdbOptionPages(QList<IOptionsPage*> *opts); QObject *createDebuggerRunControlFactory(QObject *parent); @@ -718,7 +704,7 @@ public: void attachToRunningApplication(); void attachToUnstartedApplicationDialog(); void attachToQmlPort(); - Q_SLOT void runScheduled(); + void runScheduled(); void attachCore(); void enableReverseDebuggingTriggered(const QVariant &value); @@ -745,31 +731,6 @@ public: void coreShutdown(); -#ifdef WITH_TESTS -public slots: - void testLoadProject(const QString &proFile, const TestCallBack &cb); - void testProjectLoaded(Project *project); - void testProjectEvaluated(); - void testProjectBuilt(bool success); - void testUnloadProject(); - void testFinished(); - - void testRunProject(const DebuggerRunParameters &sp, const TestCallBack &cb); - void testRunControlFinished(); - -// void testStateMachine1(); -// void testStateMachine2(); -// void testStateMachine3(); - - void testBenchmark1(); - -public: - Project *m_testProject; - bool m_testSuccess; - QList<TestCallBack> m_testCallbacks; - -#endif - public: void updateDebugActions(); @@ -973,7 +934,7 @@ public: QHash<DebuggerLanguage, Core::Context> m_contextsForLanguage; Project *m_previousProject = 0; - Target *m_previousTarget = 0; + QPointer<Target> m_previousTarget; QPointer<RunConfiguration> m_previousRunConfiguration; Id m_previousMode; @@ -1227,7 +1188,7 @@ void DebuggerPluginPrivate::parseCommandLineArguments() MessageManager::write(errorMessage); } if (!m_scheduledStarts.isEmpty()) - QTimer::singleShot(0, this, SLOT(runScheduled())); + QTimer::singleShot(0, this, &DebuggerPluginPrivate::runScheduled); } bool DebuggerPluginPrivate::initialize(const QStringList &arguments, @@ -1238,7 +1199,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, m_arguments = arguments; if (!m_arguments.isEmpty()) - connect(KitManager::instance(), &KitManager::kitsLoaded, + connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::finishedInitialization, this, &DebuggerPluginPrivate::parseCommandLineArguments); m_mainWindow = new DebuggerMainWindow; @@ -2562,7 +2523,6 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) setProxyAction(m_visibleStartAction, Id(Constants::INTERRUPT)); m_hiddenStopAction->setAction(m_interruptAction); m_localsAndExpressionsWindow->setShowLocals(false); - activateDebugMode(); } else if (state == DebuggerFinished) { const bool canRun = ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE); // We don't want to do anything anymore. @@ -2587,7 +2547,6 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) m_hiddenStopAction->setAction(m_exitAction); // show locals in core dumps m_localsAndExpressionsWindow->setShowLocals(true); - activateDebugMode(); } else { // Everything else is "undisturbable". m_interruptAction->setEnabled(false); @@ -2730,7 +2689,6 @@ void DebuggerPluginPrivate::activateDebugMode() { m_reverseDirectionAction->setChecked(false); m_reverseDirectionAction->setEnabled(false); - m_previousMode = ModeManager::currentMode()->id(); ModeManager::activateMode(MODE_DEBUG); } @@ -3254,7 +3212,7 @@ void DebuggerPluginPrivate::updateUiForProject(Project *project) void DebuggerPluginPrivate::updateUiForTarget(Target *target) { if (m_previousTarget) { - disconnect(m_previousTarget, &Target::activeRunConfigurationChanged, + disconnect(m_previousTarget.data(), &Target::activeRunConfigurationChanged, this, &DebuggerPluginPrivate::updateUiForRunConfiguration); } @@ -3354,6 +3312,11 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode) } } +void saveModeToRestore() +{ + dd->m_previousMode = ModeManager::currentMode()->id(); +} + } // namespace Internal bool ActionDescription::isRunnable(QString *reason) const @@ -3583,146 +3546,93 @@ bool operator==(const AnalyzerConnection &c1, const AnalyzerConnection &c2) && c1.analyzerPort == c2.analyzerPort; } -#ifdef WITH_TESTS -void DebuggerPluginPrivate::testLoadProject(const QString &proFile, const TestCallBack &cb) -{ - connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged, - this, &DebuggerPluginPrivate::testProjectLoaded); - - m_testCallbacks.append(cb); - ProjectExplorerPlugin::OpenProjectResult result = ProjectExplorerPlugin::openProject(proFile); - if (result) { - // Will end up in callback below due to the connections to - // signal currentProjectChanged(). - return; - } +namespace Internal { - // Project opening failed. Eat the unused callback. - qWarning("Cannot open %s: %s", qPrintable(proFile), qPrintable(result.errorMessage())); - QVERIFY(false); - m_testCallbacks.pop_back(); -} +static bool s_testRun = false; +bool isTestRun() { return s_testRun; } -void DebuggerPluginPrivate::testProjectLoaded(Project *project) -{ - if (!project) { - qWarning("Changed to null project."); - return; - } - m_testProject = project; - connect(project, SIGNAL(proFilesEvaluated()), SLOT(testProjectEvaluated())); - project->configureAsExampleProject({ }); -} +#ifdef WITH_TESTS -void DebuggerPluginPrivate::testProjectEvaluated() +class DebuggerUnitTests : public QObject { - QString fileName = m_testProject->projectFilePath().toUserOutput(); - QVERIFY(!fileName.isEmpty()); - qWarning("Project %s loaded", qPrintable(fileName)); - connect(BuildManager::instance(), SIGNAL(buildQueueFinished(bool)), - this, SLOT(testProjectBuilt(bool))); - ProjectExplorerPlugin::buildProject(m_testProject); -} + Q_OBJECT -void DebuggerPluginPrivate::testProjectBuilt(bool success) -{ - QVERIFY(success); - QVERIFY(!m_testCallbacks.isEmpty()); - TestCallBack cb = m_testCallbacks.takeLast(); - invoke<void>(cb.receiver, cb.slot); -} +public: + DebuggerUnitTests() {} -void DebuggerPluginPrivate::testUnloadProject() -{ - ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); - invoke<void>(pe, "unloadProject"); -} +private slots: + void initTestCase(); + void cleanupTestCase(); -//static Target *activeTarget() -//{ -// Project *project = ProjectExplorerPlugin::instance()->currentProject(); -// return project->activeTarget(); -//} + void testDebuggerMatching_data(); + void testDebuggerMatching(); -//static Kit *currentKit() -//{ -// Target *t = activeTarget(); -// if (!t || !t->isEnabled()) -// return 0; -// return t->kit(); -//} + void testBenchmark(); + void testStateMachine(); -//static LocalApplicationRunConfiguration *activeLocalRunConfiguration() -//{ -// Target *t = activeTarget(); -// return t ? qobject_cast<LocalApplicationRunConfiguration *>(t->activeRunConfiguration()) : 0; -//} +private: + CppTools::Tests::TemporaryCopiedDir *m_tmpDir = 0; +}; -void DebuggerPluginPrivate::testRunProject(const DebuggerRunParameters &rp, const TestCallBack &cb) +void DebuggerUnitTests::initTestCase() { - m_testCallbacks.append(cb); - RunControl *rc = createAndScheduleRun(rp, 0); - connect(rc, &RunControl::finished, this, &DebuggerPluginPrivate::testRunControlFinished); -} +// const QList<Kit *> allKits = KitManager::kits(); +// if (allKits.count() != 1) +// QSKIP("This test requires exactly one kit to be present"); +// const ToolChain * const toolchain = ToolChainKitInformation::toolChain(allKits.first()); +// if (!toolchain) +// QSKIP("This test requires that there is a kit with a toolchain."); +// bool hasClangExecutable; +// clangExecutableFromSettings(toolchain->typeId(), &hasClangExecutable); +// if (!hasClangExecutable) +// QSKIP("No clang suitable for analyzing found"); -void DebuggerPluginPrivate::testRunControlFinished() -{ - QVERIFY(!m_testCallbacks.isEmpty()); - TestCallBack cb = m_testCallbacks.takeLast(); - ExtensionSystem::invoke<void>(cb.receiver, cb.slot); + s_testRun = true; + m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(QLatin1String(":/unit-tests")); + QVERIFY(m_tmpDir->isValid()); } -void DebuggerPluginPrivate::testFinished() +void DebuggerUnitTests::cleanupTestCase() { - QTestEventLoop::instance().exitLoop(); - QVERIFY(m_testSuccess); + delete m_tmpDir; } -/////////////////////////////////////////////////////////////////////////// - -//void DebuggerPlugin::testStateMachine() -//{ -// dd->testStateMachine1(); -//} - -//void DebuggerPluginPrivate::testStateMachine1() -//{ -// m_testSuccess = true; -// QString proFile = ICore::resourcePath(); -// if (Utils::HostOsInfo::isMacHost()) -// proFile += QLatin1String("/../.."); -// proFile += QLatin1String("/../../tests/manual/debugger/simple/simple.pro"); -// testLoadProject(proFile, TestCallBack(this, "testStateMachine2")); -// QVERIFY(m_testSuccess); -// QTestEventLoop::instance().enterLoop(20); -//} - -//void DebuggerPluginPrivate::testStateMachine2() -//{ -// DebuggerRunParameters sp; -// fillParameters(&sp, currentKit()); -// sp.executable = activeLocalRunConfiguration()->executable(); -// sp.testCase = TestNoBoundsOfCurrentFunction; -// testRunProject(sp, TestCallBack(this, "testStateMachine3")); -//} +void DebuggerUnitTests::testStateMachine() +{ + QString proFile = m_tmpDir->absolutePath("simple/simple.pro"); -//void DebuggerPluginPrivate::testStateMachine3() -//{ -// testUnloadProject(); -// testFinished(); -//} + CppTools::Tests::ProjectOpenerAndCloser projectManager; + const CppTools::ProjectInfo projectInfo = projectManager.open(proFile, true); + QVERIFY(projectInfo.isValid()); + QEventLoop loop; + connect(BuildManager::instance(), &BuildManager::buildQueueFinished, + &loop, &QEventLoop::quit); + ProjectExplorerPlugin::buildProject(SessionManager::startupProject()); + loop.exec(); -/////////////////////////////////////////////////////////////////////////// + DebuggerRunParameters rp; + Target *t = SessionManager::startupProject()->activeTarget(); + QVERIFY(t); + Kit *kit = t->kit(); + QVERIFY(kit); + RunConfiguration *rc = t->activeRunConfiguration(); + QVERIFY(rc); + rp.inferior = rc->runnable().as<StandardRunnable>(); + rp.testCase = TestNoBoundsOfCurrentFunction; + DebuggerRunControl *runControl = createAndScheduleRun(rp, kit); + + connect(runControl, &RunControl::finished, this, [this] { + QTestEventLoop::instance().exitLoop(); + }); -void DebuggerPlugin::testBenchmark() -{ - dd->testBenchmark1(); +// QTestEventLoop::instance().enterLoop(20); } + enum FakeEnum { FakeDebuggerCommonSettingsId }; -void DebuggerPluginPrivate::testBenchmark1() +void DebuggerUnitTests::testBenchmark() { #ifdef WITH_BENCHMARK CALLGRIND_START_INSTRUMENTATION; @@ -3737,9 +3647,124 @@ void DebuggerPluginPrivate::testBenchmark1() #endif } +void DebuggerUnitTests::testDebuggerMatching_data() +{ + QTest::addColumn<QStringList>("debugger"); + QTest::addColumn<QString>("target"); + QTest::addColumn<int>("result"); + + QTest::newRow("Invalid data") + << QStringList() + << QString() + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Invalid debugger") + << QStringList() + << QString::fromLatin1("x86-linux-generic-elf-32bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Invalid target") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString() + << int(DebuggerItem::DoesNotMatch); + + QTest::newRow("Fuzzy match 1") + << (QStringList() << QLatin1String("unknown-unknown-unknown-unknown-0bit")) + << QString::fromLatin1("x86-linux-generic-elf-32bit") + << int(DebuggerItem::MatchesWell); // Is this the expected behavior? + QTest::newRow("Fuzzy match 2") + << (QStringList() << QLatin1String("unknown-unknown-unknown-unknown-0bit")) + << QString::fromLatin1("arm-windows-msys-pe-64bit") + << int(DebuggerItem::MatchesWell); // Is this the expected behavior? + + QTest::newRow("Architecture mismatch") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString::fromLatin1("arm-linux-generic-elf-32bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("OS mismatch") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString::fromLatin1("x86-macosx-generic-elf-32bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Format mismatch") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString::fromLatin1("x86-linux-generic-pe-32bit") + << int(DebuggerItem::DoesNotMatch); + + QTest::newRow("Linux perfect match") + << (QStringList() << QLatin1String("x86-linux-generic-elf-32bit")) + << QString::fromLatin1("x86-linux-generic-elf-32bit") + << int(DebuggerItem::MatchesWell); + QTest::newRow("Linux match") + << (QStringList() << QLatin1String("x86-linux-generic-elf-64bit")) + << QString::fromLatin1("x86-linux-generic-elf-32bit") + << int(DebuggerItem::MatchesSomewhat); + + QTest::newRow("Windows perfect match 1") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) + << QString::fromLatin1("x86-windows-msvc2013-pe-64bit") + << int(DebuggerItem::MatchesWell); + QTest::newRow("Windows perfect match 2") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) + << QString::fromLatin1("x86-windows-msvc2012-pe-64bit") + << int(DebuggerItem::MatchesWell); + QTest::newRow("Windows match 1") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) + << QString::fromLatin1("x86-windows-msvc2013-pe-32bit") + << int(DebuggerItem::MatchesSomewhat); + QTest::newRow("Windows match 2") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-64bit")) + << QString::fromLatin1("x86-windows-msvc2012-pe-32bit") + << int(DebuggerItem::MatchesSomewhat); + QTest::newRow("Windows mismatch on word size") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-32bit")) + << QString::fromLatin1("x86-windows-msvc2013-pe-64bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Windows mismatch on osflavor 1") + << (QStringList() << QLatin1String("x86-windows-msvc2013-pe-32bit")) + << QString::fromLatin1("x86-windows-msys-pe-64bit") + << int(DebuggerItem::DoesNotMatch); + QTest::newRow("Windows mismatch on osflavor 2") + << (QStringList() << QLatin1String("x86-windows-msys-pe-32bit")) + << QString::fromLatin1("x86-windows-msvc2010-pe-64bit") + << int(DebuggerItem::DoesNotMatch); +} + +void DebuggerUnitTests::testDebuggerMatching() +{ + QFETCH(QStringList, debugger); + QFETCH(QString, target); + QFETCH(int, result); + + DebuggerItem::MatchLevel expectedLevel = static_cast<DebuggerItem::MatchLevel>(result); + + QList<Abi> debuggerAbis; + foreach (const QString &abi, debugger) + debuggerAbis << Abi(abi); + + DebuggerItem item; + item.setAbis(debuggerAbis); + + DebuggerItem::MatchLevel level = item.matchTarget(Abi(target)); + if (level == DebuggerItem::MatchesPerfectly) + level = DebuggerItem::MatchesWell; + + QCOMPARE(expectedLevel, level); +} + + +QList<QObject *> DebuggerPlugin::createTestObjects() const +{ + return { new DebuggerUnitTests }; +} + +#else // ^-- if WITH_TESTS else --v + +QList<QObject *> DebuggerPlugin::createTestObjects() const +{ + return {}; +} #endif // if WITH_TESTS +} // namespace Internal } // namespace Debugger #include "debuggerplugin.moc" diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 32ef71d1c61..1d682b610de 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -57,14 +57,7 @@ private: // Called from AppOutputPane::attachToRunControl(). Q_SLOT void attachExternalApplication(ProjectExplorer::RunControl *rc); -#ifdef WITH_TESTS -private slots: - void testDebuggerMatching_data(); - void testDebuggerMatching(); - - void testBenchmark(); -// void testStateMachine(); -#endif + QList<QObject *> createTestObjects() const override; }; } // namespace Internal diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index f676fbfe9bc..d9858712e53 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -141,6 +141,7 @@ QString DebuggerRunControl::displayName() const void DebuggerRunControl::start() { + Debugger::Internal::saveModeToRestore(); Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId); TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO); TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME); @@ -339,14 +340,16 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const if (!m_kit && m_target) m_kit = m_target->kit(); + // Make sure we have something sensible to start with. + m_rp.inferior.runMode == ApplicationLauncher::Console; + m_rp.useTerminal = false; + // Extract as much as possible from available RunConfiguration. if (m_runConfig && m_runConfig->runnable().is<StandardRunnable>()) { - auto runnable = m_runConfig->runnable().as<StandardRunnable>(); - m_rp.inferior.executable = runnable.executable; - m_rp.inferior.commandLineArguments = runnable.commandLineArguments; - m_rp.useTerminal = runnable.runMode == ApplicationLauncher::Console; + m_rp.inferior = m_runConfig->runnable().as<StandardRunnable>(); + m_rp.useTerminal = m_rp.inferior.runMode == ApplicationLauncher::Console; // Normalize to work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch'...) - m_rp.inferior.workingDirectory = FileUtils::normalizePathName(runnable.workingDirectory); + m_rp.inferior.workingDirectory = FileUtils::normalizePathName(m_rp.inferior.workingDirectory); } // We might get an executable from a local PID. @@ -474,6 +477,7 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const if (m_debuggerAspect) { m_rp.multiProcess = m_debuggerAspect->useMultiProcess(); + m_rp.languages = NoLanguage; if (m_debuggerAspect->useCppDebugger()) m_rp.languages |= CppLanguage; diff --git a/src/plugins/debugger/debuggerunittests.qrc b/src/plugins/debugger/debuggerunittests.qrc new file mode 100644 index 00000000000..42d52705a8f --- /dev/null +++ b/src/plugins/debugger/debuggerunittests.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>unit-tests/simple/main.cpp</file> + <file>unit-tests/simple/simple.pro</file> + </qresource> +</RCC> diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 33c3ba259fe..5ada3761651 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4274,7 +4274,7 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, Id settingsIdHint) { CHECK_STATE(EngineSetupOk); showMessage(_("ADAPTER START FAILED")); - if (!msg.isEmpty()) { + if (!msg.isEmpty() && !Internal::isTestRun()) { const QString title = tr("Adapter start failed"); if (!settingsIdHint.isValid()) { ICore::showWarningWithOptions(title, msg); diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index 5b6fa219947..59defbeab97 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -175,7 +175,6 @@ public: menu->addAction(m_clearContentsAction); menu->addAction(m_saveContentsAction); // X11 clipboard is unreliable for long texts menu->addAction(action(LogTimeStamps)); - menu->addAction(action(VerboseLog)); menu->addAction(m_reloadDebuggingHelpersAction); menu->addSeparator(); menu->addAction(action(SettingsDialog)); diff --git a/src/plugins/debugger/unit-tests/simple/main.cpp b/src/plugins/debugger/unit-tests/simple/main.cpp new file mode 100644 index 00000000000..af917a3a332 --- /dev/null +++ b/src/plugins/debugger/unit-tests/simple/main.cpp @@ -0,0 +1,5 @@ +int main() +{ + int *i = 0; + *i = 42; +} diff --git a/src/plugins/debugger/unit-tests/simple/simple.pro b/src/plugins/debugger/unit-tests/simple/simple.pro new file mode 100644 index 00000000000..fb560c2af61 --- /dev/null +++ b/src/plugins/debugger/unit-tests/simple/simple.pro @@ -0,0 +1,3 @@ +CONFIG -= QT + +SOURCES = main.cpp diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index 3eb90c54d51..96421d1bcf7 100644 --- a/src/plugins/debugger/watchdata.cpp +++ b/src/plugins/debugger/watchdata.cpp @@ -213,7 +213,7 @@ void WatchItem::setType(const QByteArray &str, bool guessChildrenFromType) else if (type.startsWith("class ")) type = type.mid(6); else if (type.startsWith("struct ")) - type = type.mid(6); + type = type.mid(7); else if (type.startsWith(' ')) type = type.mid(1); else diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index fca94a5a5e2..880798fcdaa 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -442,21 +442,6 @@ GenericProjectFile::GenericProjectFile(GenericProject *parent, QString fileName, setFilePath(Utils::FileName::fromString(fileName)); } -bool GenericProjectFile::save(QString *, const QString &, bool) -{ - return false; -} - -bool GenericProjectFile::isModified() const -{ - return false; -} - -bool GenericProjectFile::isSaveAsAllowed() const -{ - return false; -} - IDocument::ReloadBehavior GenericProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { Q_UNUSED(state); diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h index 044dddb7ad9..2ecd8ddd8de 100644 --- a/src/plugins/genericprojectmanager/genericproject.h +++ b/src/plugins/genericprojectmanager/genericproject.h @@ -108,15 +108,9 @@ private: class GenericProjectFile : public Core::IDocument { Q_OBJECT - public: GenericProjectFile(GenericProject *parent, QString fileName, GenericProject::RefreshOptions options); - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; - ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; diff --git a/src/plugins/help/help.pro b/src/plugins/help/help.pro index 6ca91900c70..a6079647982 100644 --- a/src/plugins/help/help.pro +++ b/src/plugins/help/help.pro @@ -63,6 +63,13 @@ FORMS += docsettingspage.ui \ generalsettingspage.ui \ remotehelpfilter.ui +!isEmpty(QT.webenginewidgets.name):minQtVersion(5, 6, 0) { + QT += webenginewidgets + HEADERS += webenginehelpviewer.h + SOURCES += webenginehelpviewer.cpp + DEFINES += QTC_WEBENGINE_HELPVIEWER +} + osx { DEFINES += QTC_MAC_NATIVE_HELPVIEWER QT += macextras diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index d78cbaa2b85..b3c728e19a4 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -47,6 +47,9 @@ #ifdef QTC_MAC_NATIVE_HELPVIEWER #include "macwebkithelpviewer.h" #endif +#ifdef QTC_WEBENGINE_HELPVIEWER +#include "webenginehelpviewer.h" +#endif #include <bookmarkmanager.h> #include <contentwindow.h> @@ -69,6 +72,7 @@ #include <extensionsystem/pluginmanager.h> #include <coreplugin/find/findplugin.h> #include <texteditor/texteditorconstants.h> +#include <utils/algorithm.h> #include <utils/hostosinfo.h> #include <utils/qtcassert.h> #include <utils/styledbar.h> @@ -362,48 +366,43 @@ HelpViewer *HelpPlugin::createHelpViewer(qreal zoom) { // check for backends typedef std::function<HelpViewer *()> ViewerFactory; - QHash<QString, ViewerFactory> factories; // id -> factory + typedef QPair<QByteArray, ViewerFactory> ViewerFactoryItem; // id -> factory + QVector<ViewerFactoryItem> factories; +#ifndef QT_NO_WEBKIT + factories.append(qMakePair(QByteArray("qtwebkit"), []() { return new QtWebKitHelpViewer(); })); +#endif +#ifdef QTC_WEBENGINE_HELPVIEWER + factories.append(qMakePair(QByteArray("qtwebengine"), []() { return new WebEngineHelpViewer(); })); +#endif + factories.append(qMakePair(QByteArray("textbrowser"), []() { return new TextBrowserHelpViewer(); })); + #ifdef QTC_MAC_NATIVE_HELPVIEWER - factories.insert(QLatin1String("native"), []() { return new MacWebKitHelpViewer(); }); + // default setting +#ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT + factories.prepend(qMakePair(QByteArray("native"), []() { return new MacWebKitHelpViewer(); })); +#else + factories.append(qMakePair(QByteArray("native"), []() { return new MacWebKitHelpViewer(); })); #endif -#ifndef QT_NO_WEBKIT - factories.insert(QLatin1String("qtwebkit"), []() { return new QtWebKitHelpViewer(); }); #endif - factories.insert(QLatin1String("textbrowser"), []() { return new TextBrowserHelpViewer(); }); - ViewerFactory factory; - // TODO: Visual Studio < 2013 has a bug in std::function's operator bool, which in this case - // leads to succeeding boolean checks on factory which should not succeed. - // So we may not check against "if (!factory)" - bool factoryFound = false; + HelpViewer *viewer = nullptr; // check requested backend - const QString backend = QLatin1String(qgetenv("QTC_HELPVIEWER_BACKEND")); + const QByteArray backend = qgetenv("QTC_HELPVIEWER_BACKEND"); if (!backend.isEmpty()) { - if (!factories.contains(backend)) { - qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend)); + const int pos = Utils::indexOf(factories, [backend](const ViewerFactoryItem &item) { + return backend == item.first; + }); + if (pos == -1) { + qWarning("Help viewer backend \"%s\" not found, using default.", backend.constData()); } else { - factory = factories.value(backend); - factoryFound = true; + viewer = factories.at(pos).second(); } } - // default setting -#ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT - if (!factoryFound && factories.contains(QLatin1String("native"))) { - factory = factories.value(QLatin1String("native")); - factoryFound = true; - } -#endif - if (!factoryFound && factories.contains(QLatin1String("qtwebkit"))) { - factory = factories.value(QLatin1String("qtwebkit")); - factoryFound = true; - } - if (!factoryFound && factories.contains(QLatin1String("textbrowser"))) { - factory = factories.value(QLatin1String("textbrowser")); - factoryFound = true; - } - QTC_ASSERT(factoryFound, return 0); - HelpViewer *viewer = factory(); + + if (!viewer) + viewer = factories.first().second(); + QTC_ASSERT(viewer, return nullptr); // initialize font viewer->setViewerFont(LocalHelpManager::fallbackFont()); diff --git a/src/plugins/help/localhelpmanager.cpp b/src/plugins/help/localhelpmanager.cpp index fb9a76d9279..2c4eb9f08b2 100644 --- a/src/plugins/help/localhelpmanager.cpp +++ b/src/plugins/help/localhelpmanager.cpp @@ -32,6 +32,7 @@ #include <app/app_version.h> #include <coreplugin/icore.h> #include <utils/algorithm.h> +#include <utils/hostosinfo.h> #include <utils/qtcassert.h> #include <QMutexLocker> @@ -56,7 +57,10 @@ QString LocalHelpManager::m_currentFilter = QString(); int LocalHelpManager::m_currentFilterIndex = -1; static const char kHelpHomePageKey[] = "Help/HomePage"; -static const char kFontKey[] = "Help/Font"; +static const char kFontFamilyKey[] = "Help/FallbackFontFamily"; +static const char kFontStyleKey[] = "Help/FallbackFontStyle"; +static const char kFontWeightKey[] = "Help/FallbackFontWeight"; +static const char kFontSizeKey[] = "Help/FallbackFontSize"; static const char kStartOptionKey[] = "Help/StartOption"; static const char kContextHelpOptionKey[] = "Help/ContextHelpOption"; static const char kReturnOnCloseKey[] = "Help/ReturnOnClose"; @@ -64,6 +68,29 @@ static const char kLastShownPagesKey[] = "Help/LastShownPages"; static const char kLastShownPagesZoomKey[] = "Help/LastShownPagesZoom"; static const char kLastSelectedTabKey[] = "Help/LastSelectedTab"; +static const QFont::Style kDefaultFallbackFontStyle = QFont::StyleNormal; +static const int kDefaultFallbackFontWeight = QFont::Normal; +static const int kDefaultFallbackFontSize = 14; + +static QString defaultFallbackFontFamily() +{ + if (Utils::HostOsInfo::isMacHost()) + return QLatin1String("Helvetica"); + if (Utils::HostOsInfo::isAnyUnixHost()) + return QLatin1String("sans-serif"); + return QLatin1String("Arial"); +} + +template <typename T> +static void setOrRemoveSetting(const char *key, const T &value, const T &defaultValue) +{ + QSettings *settings = Core::ICore::settings(); + if (value == defaultValue) + settings->remove(QLatin1String(key)); + else + settings->setValue(QLatin1String(key), value); +} + // TODO remove some time after Qt Creator 3.5 static QVariant getSettingWithFallback(const QString &settingsKey, const QString &fallbackSettingsKey, @@ -123,14 +150,22 @@ void LocalHelpManager::setHomePage(const QString &page) QFont LocalHelpManager::fallbackFont() { - const QVariant value = getSettingWithFallback(QLatin1String(kFontKey), - QLatin1String("font"), QVariant()); - return value.value<QFont>(); + QSettings *settings = Core::ICore::settings(); + const QString family = settings->value(QLatin1String(kFontFamilyKey), defaultFallbackFontFamily()).toString(); + const QFont::Style style = QFont::Style(settings->value(QLatin1String(kFontStyleKey), kDefaultFallbackFontStyle).toInt()); + const int weight = settings->value(QLatin1String(kFontWeightKey), kDefaultFallbackFontWeight).toInt(); + const int size = settings->value(QLatin1String(kFontSizeKey), kDefaultFallbackFontSize).toInt(); + QFont font(family, size, weight); + font.setStyle(style); + return font; } void LocalHelpManager::setFallbackFont(const QFont &font) { - Core::ICore::settings()->setValue(QLatin1String(kFontKey), font); + setOrRemoveSetting(kFontFamilyKey, font.family(), defaultFallbackFontFamily()); + setOrRemoveSetting(kFontStyleKey, font.style(), kDefaultFallbackFontStyle); + setOrRemoveSetting(kFontWeightKey, font.weight(), kDefaultFallbackFontWeight); + setOrRemoveSetting(kFontSizeKey, font.pointSize(), kDefaultFallbackFontSize); emit m_instance->fallbackFontChanged(font); } diff --git a/src/plugins/help/webenginehelpviewer.cpp b/src/plugins/help/webenginehelpviewer.cpp new file mode 100644 index 00000000000..5d2e2d2f356 --- /dev/null +++ b/src/plugins/help/webenginehelpviewer.cpp @@ -0,0 +1,312 @@ +/**************************************************************************** +** +** 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 "webenginehelpviewer.h" + +#include "localhelpmanager.h" +#include "openpagesmanager.h" + +#include <utils/qtcassert.h> + +#include <QBuffer> +#include <QContextMenuEvent> +#include <QCoreApplication> +#include <QVBoxLayout> +#include <QWebEngineHistory> +#include <QWebEngineProfile> +#include <QWebEngineSettings> +#include <QWebEngineUrlRequestJob> + +using namespace Help; +using namespace Help::Internal; + +HelpUrlSchemeHandler::HelpUrlSchemeHandler(QObject *parent) : + QWebEngineUrlSchemeHandler(parent) +{ +} + +void HelpUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) +{ + const QUrl url = job->requestUrl(); + if (!HelpViewer::isLocalUrl(url)) { + job->fail(QWebEngineUrlRequestJob::RequestDenied); + return; + } + LocalHelpManager::HelpData data = LocalHelpManager::helpData(url); + + auto buffer = new QBuffer(job); + buffer->setData(data.data); + job->reply(data.mimeType.toUtf8(), buffer); +} + +static HelpUrlSchemeHandler *helpUrlSchemeHandler() +{ + static HelpUrlSchemeHandler *schemeHandler = nullptr; + if (!schemeHandler) + schemeHandler = new HelpUrlSchemeHandler(LocalHelpManager::instance()); + return schemeHandler; +} + +WebEngineHelpViewer::WebEngineHelpViewer(QWidget *parent) : + HelpViewer(parent), + m_widget(new WebView(this)) +{ + m_widget->setPage(new HelpPage(this)); + auto layout = new QVBoxLayout; + setLayout(layout); + layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(m_widget, 10); + + QPalette p = palette(); + p.setColor(QPalette::Base, Qt::white); + p.setColor(QPalette::Text, Qt::black); + setPalette(p); + + connect(m_widget, &QWebEngineView::urlChanged, this, &WebEngineHelpViewer::sourceChanged); + connect(m_widget, &QWebEngineView::loadStarted, this, &WebEngineHelpViewer::slotLoadStarted); + connect(m_widget, &QWebEngineView::loadFinished, this, &WebEngineHelpViewer::slotLoadFinished); + connect(m_widget, &QWebEngineView::titleChanged, this, &WebEngineHelpViewer::titleChanged); + connect(m_widget->page(), &QWebEnginePage::linkHovered, this, &WebEngineHelpViewer::setToolTip); + connect(m_widget->pageAction(QWebEnginePage::Back), &QAction::changed, this, [this]() { + emit backwardAvailable(isBackwardAvailable()); + }); + connect(m_widget->pageAction(QWebEnginePage::Forward), &QAction::changed, this, [this]() { + emit forwardAvailable(isForwardAvailable()); + }); + + QAction* action = m_widget->pageAction(QWebEnginePage::OpenLinkInNewTab); + action->setText(QCoreApplication::translate("HelpViewer", + "Open Link as New Page")); + + QWebEnginePage *viewPage = m_widget->page(); + QTC_ASSERT(viewPage, return); + QWebEngineProfile *viewProfile = viewPage->profile(); + QTC_ASSERT(viewProfile, return); + if (!viewProfile->urlSchemeHandler("qthelp")) + viewProfile->installUrlSchemeHandler("qthelp", helpUrlSchemeHandler()); +} + +QFont WebEngineHelpViewer::viewerFont() const +{ + QWebEngineSettings *webSettings = m_widget->settings(); + return QFont(webSettings->fontFamily(QWebEngineSettings::StandardFont), + webSettings->fontSize(QWebEngineSettings::DefaultFontSize)); +} + +void WebEngineHelpViewer::setViewerFont(const QFont &font) +{ + QWebEngineSettings *webSettings = m_widget->settings(); + webSettings->setFontFamily(QWebEngineSettings::StandardFont, font.family()); + webSettings->setFontSize(QWebEngineSettings::DefaultFontSize, font.pointSize()); +} + +qreal WebEngineHelpViewer::scale() const +{ + return m_widget->zoomFactor(); +} + +void WebEngineHelpViewer::setScale(qreal scale) +{ + m_widget->setZoomFactor(scale); +} + +QString WebEngineHelpViewer::title() const +{ + return m_widget->title(); +} + +QUrl WebEngineHelpViewer::source() const +{ + return m_widget->url(); +} + +void WebEngineHelpViewer::setSource(const QUrl &url) +{ + m_widget->setUrl(url); +} + +void WebEngineHelpViewer::setHtml(const QString &html) +{ + m_widget->setHtml(html); +} + +QString WebEngineHelpViewer::selectedText() const +{ + return m_widget->selectedText(); +} + +bool WebEngineHelpViewer::isForwardAvailable() const +{ + // m_view->history()->canGoForward() + return m_widget->pageAction(QWebEnginePage::Forward)->isEnabled(); +} + +bool WebEngineHelpViewer::isBackwardAvailable() const +{ + return m_widget->pageAction(QWebEnginePage::Back)->isEnabled(); +} + +void WebEngineHelpViewer::addBackHistoryItems(QMenu *backMenu) +{ + if (QWebEngineHistory *history = m_widget->history()) { + QList<QWebEngineHistoryItem> items = history->backItems(history->count()); + for (int i = items.count() - 1; i >= 0; --i) { + QWebEngineHistoryItem item = items.at(i); + auto action = new QAction(backMenu); + action->setText(item.title()); + connect(action, &QAction::triggered, this, [this,item]() { + if (QWebEngineHistory *history = m_widget->history()) + history->goToItem(item); + }); + backMenu->addAction(action); + } + } +} + +void WebEngineHelpViewer::addForwardHistoryItems(QMenu *forwardMenu) +{ + if (QWebEngineHistory *history = m_widget->history()) { + QList<QWebEngineHistoryItem> items = history->forwardItems(history->count()); + for (int i = 0; i < items.count(); ++i) { + QWebEngineHistoryItem item = items.at(i); + auto action = new QAction(forwardMenu); + action->setText(item.title()); + connect(action, &QAction::triggered, this, [this,item]() { + if (QWebEngineHistory *history = m_widget->history()) + history->goToItem(item); + }); + forwardMenu->addAction(action); + } + } +} + +void WebEngineHelpViewer::setOpenInNewPageActionVisible(bool visible) +{ + m_widget->setOpenInNewPageActionVisible(visible); +} + +bool WebEngineHelpViewer::findText(const QString &text, Core::FindFlags flags, bool incremental, + bool fromSearch, bool *wrapped) +{ + Q_UNUSED(incremental) + Q_UNUSED(fromSearch) + if (wrapped) + *wrapped = false; // missing feature in QWebEngine + QWebEnginePage::FindFlags webEngineFlags = 0; + if (flags & Core::FindBackward) + webEngineFlags |= QWebEnginePage::FindBackward; + if (flags & Core::FindCaseSensitively) + webEngineFlags |= QWebEnginePage::FindCaseSensitively; + // QWebEngineView's findText is asynchronous, and the variant taking a callback runs the + // callback on the main thread, so blocking here becomes ugly too + // So we just claim that the search succeeded + m_widget->findText(text, webEngineFlags); + return true; +} + +HelpPage *WebEngineHelpViewer::page() const +{ + return static_cast<HelpPage *>(m_widget->page()); +} + +void WebEngineHelpViewer::scaleUp() +{ + m_widget->setZoomFactor(m_widget->zoomFactor() + 0.1); +} + +void WebEngineHelpViewer::scaleDown() +{ + m_widget->setZoomFactor(qMax(qreal(0.1), m_widget->zoomFactor() - qreal(0.1))); +} + +void WebEngineHelpViewer::resetScale() +{ + m_widget->setZoomFactor(1.0); +} + +void WebEngineHelpViewer::copy() +{ + m_widget->triggerPageAction(QWebEnginePage::Copy); +} + +void WebEngineHelpViewer::stop() +{ + m_widget->triggerPageAction(QWebEnginePage::Stop); +} + +void WebEngineHelpViewer::forward() +{ + m_widget->triggerPageAction(QWebEnginePage::Forward); +} + +void WebEngineHelpViewer::backward() +{ + m_widget->triggerPageAction(QWebEnginePage::Back); +} + +void WebEngineHelpViewer::print(QPrinter *printer) +{ + Q_UNUSED(printer) +} + +HelpPage::HelpPage(QObject *parent) + : QWebEnginePage(parent) +{ +} + +QWebEnginePage *HelpPage::createWindow(QWebEnginePage::WebWindowType) +{ + auto viewer = static_cast<WebEngineHelpViewer *>(OpenPagesManager::instance().createPage()); + return viewer->page(); +} + +WebView::WebView(QWidget *parent) + : QWebEngineView(parent) +{ +} + +void WebView::setOpenInNewPageActionVisible(bool visible) +{ + m_openInNewPageActionVisible = visible; +} + +void WebView::contextMenuEvent(QContextMenuEvent *event) +{ + QMenu *menu = page()->createStandardContextMenu(); + if (m_openInNewPageActionVisible) { + // insert Open In New Tab if OpenLinkInThisWindow is also there + const QList<QAction*> actions = menu->actions(); + auto it = std::find(actions.cbegin(), actions.cend(), page()->action(QWebEnginePage::OpenLinkInThisWindow)); + if (it != actions.cend()) { + // insert after + ++it; + QAction *before = (it == actions.cend() ? 0 : *it); + menu->insertAction(before, page()->action(QWebEnginePage::OpenLinkInNewTab)); + } + } + + connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); + menu->popup(event->globalPos()); +} diff --git a/src/plugins/help/webenginehelpviewer.h b/src/plugins/help/webenginehelpviewer.h new file mode 100644 index 00000000000..7d777ab4875 --- /dev/null +++ b/src/plugins/help/webenginehelpviewer.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** 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 "helpviewer.h" + +#include <QWebEngineUrlSchemeHandler> +#include <QWebEngineView> + +namespace Help { +namespace Internal { + +class HelpUrlSchemeHandler : public QWebEngineUrlSchemeHandler +{ +public: + explicit HelpUrlSchemeHandler(QObject *parent = 0); + void requestStarted(QWebEngineUrlRequestJob *job) override; +}; + +class HelpPage : public QWebEnginePage +{ +public: + explicit HelpPage(QObject *parent = 0); + QWebEnginePage *createWindow(QWebEnginePage::WebWindowType) override; +}; + +class WebView : public QWebEngineView +{ +public: + explicit WebView(QWidget *parent = 0); + + void setOpenInNewPageActionVisible(bool visible); + +protected: + void contextMenuEvent(QContextMenuEvent *event) override; + +private: + bool m_openInNewPageActionVisible = true; +}; + +class WebEngineHelpViewer : public HelpViewer +{ + Q_OBJECT +public: + explicit WebEngineHelpViewer(QWidget *parent = 0); + + QFont viewerFont() const override; + void setViewerFont(const QFont &font) override; + qreal scale() const override; + void setScale(qreal scale) override; + QString title() const override; + QUrl source() const override; + void setSource(const QUrl &url) override; + void setHtml(const QString &html) override; + QString selectedText() const override; + bool isForwardAvailable() const override; + bool isBackwardAvailable() const override; + void addBackHistoryItems(QMenu *backMenu) override; + void addForwardHistoryItems(QMenu *forwardMenu) override; + void setOpenInNewPageActionVisible(bool visible) override; + bool findText(const QString &text, Core::FindFlags flags, bool incremental, bool fromSearch, bool *wrapped) override; + + HelpPage *page() const; + +public slots: + void scaleUp() override; + void scaleDown() override; + void resetScale() override; + void copy() override; + void stop() override; + void forward() override; + void backward() override; + void print(QPrinter *printer) override; + +private: + WebView *m_widget; +}; + +} // namespace Internal +} // namespace Help diff --git a/src/plugins/imageviewer/exportdialog.cpp b/src/plugins/imageviewer/exportdialog.cpp new file mode 100644 index 00000000000..b46b3da2398 --- /dev/null +++ b/src/plugins/imageviewer/exportdialog.cpp @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** 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 "exportdialog.h" + +#include <coreplugin/coreicons.h> + +#include <utils/pathchooser.h> + +#include <QApplication> +#include <QDesktopWidget> +#include <QDialogButtonBox> +#include <QFileDialog> +#include <QFormLayout> +#include <QHBoxLayout> +#include <QMessageBox> +#include <QLabel> +#include <QLineEdit> +#include <QPushButton> +#include <QSpinBox> +#include <QToolButton> +#include <QVBoxLayout> + +#include <QImageWriter> + +#include <QDebug> +#include <QDir> +#include <QFileInfo> +#include <QMimeDatabase> +#include <QMimeType> + +namespace ImageViewer { +namespace Internal { + +enum { exportMinimumSize = 1, exportMaximumSize = 2000 }; + +static QString imageNameFilterString() +{ + static QString result; + if (result.isEmpty()) { + QMimeDatabase mimeDatabase; + const QString separator = QStringLiteral(";;"); + foreach (const QByteArray &mimeType, QImageWriter::supportedMimeTypes()) { + const QString filter = mimeDatabase.mimeTypeForName(QLatin1String(mimeType)).filterString(); + if (!filter.isEmpty()) { + if (mimeType == QByteArrayLiteral("image/png")) { + if (!result.isEmpty()) + result.prepend(separator); + result.prepend(filter); + } else { + if (!result.isEmpty()) + result.append(separator); + result.append(filter); + } + } + } + } + return result; +} + +ExportDialog::ExportDialog(QWidget *parent) + : QDialog(parent) + , m_pathChooser(new Utils::PathChooser(this)) + , m_widthSpinBox(new QSpinBox(this)) + , m_heightSpinBox(new QSpinBox(this)) + , m_aspectRatio(1) +{ + typedef void (QSpinBox::*QSpinBoxIntSignal)(int); + + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + + QFormLayout *formLayout = new QFormLayout(this); + + m_pathChooser->setMinimumWidth(QApplication::desktop()->availableGeometry(this).width() / 5); + m_pathChooser->setExpectedKind(Utils::PathChooser::SaveFile); + m_pathChooser->setPromptDialogFilter(imageNameFilterString()); + formLayout->addRow(tr("File:"), m_pathChooser); + + QHBoxLayout *sizeLayout = new QHBoxLayout; + m_widthSpinBox->setMinimum(exportMinimumSize); + m_widthSpinBox->setMaximum(exportMaximumSize); + connect(m_widthSpinBox, static_cast<QSpinBoxIntSignal>(&QSpinBox::valueChanged), + this, &ExportDialog::exportWidthChanged); + sizeLayout->addWidget(m_widthSpinBox); + //: Multiplication, as in 32x32 + sizeLayout->addWidget(new QLabel(tr("x"))); + m_heightSpinBox->setMinimum(exportMinimumSize); + m_heightSpinBox->setMaximum(exportMaximumSize); + connect(m_heightSpinBox, static_cast<QSpinBoxIntSignal>(&QSpinBox::valueChanged), + this, &ExportDialog::exportHeightChanged); + sizeLayout->addWidget(m_heightSpinBox); + QToolButton *resetButton = new QToolButton(this); + resetButton->setIcon(QIcon(QStringLiteral(":/qt-project.org/styles/commonstyle/images/refresh-32.png"))); + sizeLayout->addWidget(resetButton); + sizeLayout->addStretch(); + connect(resetButton, &QAbstractButton::clicked, this, &ExportDialog::resetExportSize); + formLayout->addRow(tr("Size:"), sizeLayout); + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + formLayout->addRow(buttonBox); +} + +void ExportDialog::accept() +{ + if (!m_pathChooser->isValid()) { + QMessageBox::warning(this, windowTitle(), m_pathChooser->errorMessage()); + return; + } + const QString fileName = exportFileName(); + if (QFileInfo::exists(fileName)) { + const QString question = tr("%1 already exists.\nWould you like to overwrite it?") + .arg(QDir::toNativeSeparators(fileName)); + if (QMessageBox::question(this, windowTitle(), question, QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) + return; + } + QDialog::accept(); +} + +QSize ExportDialog::exportSize() const +{ + return QSize(m_widthSpinBox->value(), m_heightSpinBox->value()); +} + +void ExportDialog::setExportSize(const QSize &size) +{ + m_defaultSize = size; + const QSizeF defaultSizeF(m_defaultSize); + m_aspectRatio = defaultSizeF.width() / defaultSizeF.height(); + setExportWidthBlocked(size.width()); + setExportHeightBlocked(size.height()); +} + +void ExportDialog::resetExportSize() +{ + setExportWidthBlocked(m_defaultSize.width()); + setExportHeightBlocked(m_defaultSize.height()); +} + +void ExportDialog::setExportWidthBlocked(int width) +{ + if (m_widthSpinBox->value() != width) { + const bool blockSignals = m_widthSpinBox->blockSignals(true); + m_widthSpinBox->setValue(width); + m_widthSpinBox->blockSignals(blockSignals); + } +} + +void ExportDialog::setExportHeightBlocked(int height) +{ + if (m_heightSpinBox->value() != height) { + const bool blockSignals = m_heightSpinBox->blockSignals(true); + m_heightSpinBox->setValue(height); + m_heightSpinBox->blockSignals(blockSignals); + } +} + +void ExportDialog::exportWidthChanged(int width) +{ + const bool square = m_defaultSize.width() == m_defaultSize.height(); + setExportHeightBlocked(square ? width : qRound(qreal(width) / m_aspectRatio)); +} + +void ExportDialog::exportHeightChanged(int height) +{ + const bool square = m_defaultSize.width() == m_defaultSize.height(); + setExportWidthBlocked(square ? height : qRound(qreal(height) * m_aspectRatio)); +} + +QString ExportDialog::exportFileName() const +{ + return m_pathChooser->fileName().toString(); +} + +void ExportDialog::setExportFileName(const QString &f) +{ + m_pathChooser->setFileName(Utils::FileName::fromString(f)); +} + +} // namespace Internal +} // namespace ImageViewer diff --git a/share/qtcreator/welcomescreen/widgets/CustomTab.qml b/src/plugins/imageviewer/exportdialog.h index 823d8a19405..2c929bf4688 100644 --- a/share/qtcreator/welcomescreen/widgets/CustomTab.qml +++ b/src/plugins/imageviewer/exportdialog.h @@ -23,29 +23,49 @@ ** ****************************************************************************/ -import QtQuick 2.1 +#ifndef EXPORTDIALOG_H +#define EXPORTDIALOG_H -Row { - id: customTab - property alias model: repeater.model - spacing: 24 +#include <QDialog> - signal itemChanged - property int currentIndex: 0 +QT_FORWARD_DECLARE_CLASS(QSpinBox) - onCurrentIndexChanged: welcomeMode.activePlugin = currentIndex - Component.onCompleted: currentIndex = welcomeMode.activePlugin +namespace Utils { class PathChooser; } - Repeater { - id: repeater +namespace ImageViewer { +namespace Internal { - LinkedText { - text: title - active: customTab.currentIndex === index +class ExportDialog : public QDialog +{ + Q_OBJECT +public: + explicit ExportDialog(QWidget *parent = nullptr); - onClicked: { - customTab.currentIndex = index - } - } - } -} + QSize exportSize() const; + void setExportSize(const QSize &); + + QString exportFileName() const; + void setExportFileName(const QString &); + + void accept() override; + +private slots: + void resetExportSize(); + void exportWidthChanged(int width); + void exportHeightChanged(int height); + +private: + void setExportWidthBlocked(int width); + void setExportHeightBlocked(int height); + + Utils::PathChooser *m_pathChooser; + QSpinBox *m_widthSpinBox; + QSpinBox *m_heightSpinBox; + QSize m_defaultSize; + qreal m_aspectRatio; +}; + +} // namespace Internal +} // namespace ImageViewer + +#endif // EXPORTDIALOG_H diff --git a/src/plugins/imageviewer/imageview.cpp b/src/plugins/imageviewer/imageview.cpp index 707625ca70e..db7869cd2e3 100644 --- a/src/plugins/imageviewer/imageview.cpp +++ b/src/plugins/imageviewer/imageview.cpp @@ -50,14 +50,33 @@ #include "imageview.h" +#include "exportdialog.h" #include "imageviewerfile.h" +#include <coreplugin/messagemanager.h> + +#include <utils/fileutils.h> +#include <utils/qtcassert.h> + +#include <QMessageBox> +#include <QGraphicsRectItem> + #include <QWheelEvent> #include <QMouseEvent> -#include <QGraphicsRectItem> +#include <QImage> +#include <QPainter> #include <QPixmap> + +#include <QDir> +#include <QFileInfo> + #include <qmath.h> +#ifndef QT_NO_SVG +#include <QGraphicsSvgItem> +#include <QSvgRenderer> +#endif + namespace ImageViewer { namespace Constants { const qreal DEFAULT_SCALE_FACTOR = 1.2; @@ -137,6 +156,48 @@ void ImageView::drawBackground(QPainter *p, const QRectF &) p->restore(); } +void ImageView::exportImage() +{ +#ifndef QT_NO_SVG + QGraphicsSvgItem *svgItem = qgraphicsitem_cast<QGraphicsSvgItem *>(m_imageItem); + QTC_ASSERT(svgItem, return); + + const QFileInfo origFi = m_file->filePath().toFileInfo(); + const QString suggestedFileName = origFi.absolutePath() + QLatin1Char('/') + + origFi.baseName() + QStringLiteral(".png"); + + ExportDialog exportDialog(this); + exportDialog.setWindowTitle(tr("Export %1").arg(origFi.fileName())); + exportDialog.setExportSize(svgItem->boundingRect().size().toSize()); + exportDialog.setExportFileName(suggestedFileName); + + while (true) { + if (exportDialog.exec() != QDialog::Accepted) + break; + + const QSize imageSize = exportDialog.exportSize(); + QImage image(imageSize, QImage::Format_ARGB32); + image.fill(Qt::transparent); + QPainter painter; + painter.begin(&image); + svgItem->renderer()->render(&painter, QRectF(QPointF(), QSizeF(imageSize))); + painter.end(); + + const QString fileName = exportDialog.exportFileName(); + if (image.save(fileName)) { + const QString message = tr("Exported \"%1\", %2x%3, %4 bytes") + .arg(QDir::toNativeSeparators(fileName)).arg(imageSize.width()).arg(imageSize.height()) + .arg(QFileInfo(fileName).size()); + Core::MessageManager::write(message); + break; + } else { + QMessageBox::critical(this, tr("Export Image"), + tr("Could not write file \"%1\".").arg(QDir::toNativeSeparators(fileName))); + } + } +#endif // !QT_NO_SVG +} + void ImageView::setViewBackground(bool enable) { m_showBackground = enable; diff --git a/src/plugins/imageviewer/imageview.h b/src/plugins/imageviewer/imageview.h index 46bf3d66b02..b120dac26d0 100644 --- a/src/plugins/imageviewer/imageview.h +++ b/src/plugins/imageviewer/imageview.h @@ -74,6 +74,7 @@ signals: void imageSizeChanged(const QSize &size); public slots: + void exportImage(); void setViewBackground(bool enable); void setViewOutline(bool enable); void zoomIn(); diff --git a/src/plugins/imageviewer/imageviewer.cpp b/src/plugins/imageviewer/imageviewer.cpp index c979c93fd4b..44f86c44b90 100644 --- a/src/plugins/imageviewer/imageviewer.cpp +++ b/src/plugins/imageviewer/imageviewer.cpp @@ -26,7 +26,6 @@ #include "imageviewer.h" #include "imageviewerfile.h" -#include "imagevieweractionhandler.h" #include "imageviewerconstants.h" #include "imageview.h" #include "ui_imageviewertoolbar.h" @@ -101,10 +100,11 @@ void ImageViewer::ctor() // toolbar d->toolbar = new QWidget(); d->ui_toolbar.setupUi(d->toolbar); + d->ui_toolbar.toolButtonExportImage->setIcon(QIcon::fromTheme(QLatin1String("document-save"), + Core::Icons::SAVEFILE.icon())); d->ui_toolbar.toolButtonZoomIn->setIcon(Core::Icons::PLUS.icon()); d->ui_toolbar.toolButtonZoomOut->setIcon(Core::Icons::MINUS.icon()); d->ui_toolbar.toolButtonFitToScreen->setIcon(Core::Icons::ZOOM.icon()); - // icons update - try to use system theme updateButtonIconByTheme(d->ui_toolbar.toolButtonZoomIn, QLatin1String("zoom-in")); updateButtonIconByTheme(d->ui_toolbar.toolButtonZoomOut, QLatin1String("zoom-out")); @@ -116,6 +116,7 @@ void ImageViewer::ctor() // (photograph has outline - piece of paper) updateButtonIconByTheme(d->ui_toolbar.toolButtonOutline, QLatin1String("emblem-photos")); + d->ui_toolbar.toolButtonExportImage->setCommandId(Constants::ACTION_EXPORT_IMAGE); d->ui_toolbar.toolButtonZoomIn->setCommandId(Constants::ACTION_ZOOM_IN); d->ui_toolbar.toolButtonZoomOut->setCommandId(Constants::ACTION_ZOOM_OUT); d->ui_toolbar.toolButtonOriginalSize->setCommandId(Constants::ACTION_ORIGINAL_SIZE); @@ -125,6 +126,8 @@ void ImageViewer::ctor() d->ui_toolbar.toolButtonPlayPause->setCommandId(Constants::ACTION_TOGGLE_ANIMATION); // connections + connect(d->ui_toolbar.toolButtonExportImage, &QAbstractButton::clicked, + d->imageView, &ImageView::exportImage); connect(d->ui_toolbar.toolButtonZoomIn, &QAbstractButton::clicked, d->imageView, &ImageView::zoomIn); connect(d->ui_toolbar.toolButtonZoomOut, &QAbstractButton::clicked, @@ -151,6 +154,12 @@ void ImageViewer::ctor() this, &ImageViewer::updatePauseAction); connect(d->imageView, &ImageView::scaleFactorChanged, this, &ImageViewer::scaleFactorUpdate); + + connect(d->file.data(), &ImageViewerFile::openFinished, + this, [this](bool success) + { + d->ui_toolbar.toolButtonExportImage->setEnabled(success && d->file->type() == ImageViewerFile::TypeSvg); + }); } ImageViewer::~ImageViewer() @@ -177,6 +186,12 @@ Core::IEditor *ImageViewer::duplicate() return other; } +void ImageViewer::exportImage() +{ + if (d->file->type() == ImageViewerFile::TypeSvg) + d->ui_toolbar.toolButtonExportImage->click(); +} + void ImageViewer::imageSizeUpdated(const QSize &size) { QString imageSizeText; diff --git a/src/plugins/imageviewer/imageviewer.h b/src/plugins/imageviewer/imageviewer.h index 1e6ea4b2489..5d65c6760ac 100644 --- a/src/plugins/imageviewer/imageviewer.h +++ b/src/plugins/imageviewer/imageviewer.h @@ -56,6 +56,7 @@ public: IEditor *duplicate() override; public slots: + void exportImage(); void imageSizeUpdated(const QSize &size); void scaleFactorUpdate(qreal factor); diff --git a/src/plugins/imageviewer/imageviewer.pro b/src/plugins/imageviewer/imageviewer.pro index 6855222ba2e..651fda1fb6a 100644 --- a/src/plugins/imageviewer/imageviewer.pro +++ b/src/plugins/imageviewer/imageviewer.pro @@ -1,21 +1,21 @@ include(../../qtcreatorplugin.pri) HEADERS += \ + exportdialog.h \ imageviewerplugin.h \ imageviewerfactory.h \ imageviewerfile.h \ imageviewer.h \ imageview.h \ - imageviewerconstants.h \ - imagevieweractionhandler.h + imageviewerconstants.h SOURCES += \ + exportdialog.cpp \ imageviewerplugin.cpp \ imageviewerfactory.cpp \ imageviewerfile.cpp \ imageviewer.cpp \ - imageview.cpp \ - imagevieweractionhandler.cpp + imageview.cpp RESOURCES += \ imageviewer.qrc diff --git a/src/plugins/imageviewer/imagevieweractionhandler.cpp b/src/plugins/imageviewer/imagevieweractionhandler.cpp deleted file mode 100644 index b183335f5bd..00000000000 --- a/src/plugins/imageviewer/imagevieweractionhandler.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Denis Mingulov. -** 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 "imagevieweractionhandler.h" -#include "imageviewer.h" -#include "imageviewerconstants.h" - -#include <coreplugin/icore.h> -#include <coreplugin/actionmanager/actionmanager.h> -#include <coreplugin/actionmanager/command.h> -#include <coreplugin/editormanager/editormanager.h> -#include <coreplugin/id.h> - -#include <QAction> -#include <QList> -#include <QSignalMapper> - -namespace ImageViewer { -namespace Internal { - -enum SupportedActions { - ZoomIn = 0, - ZoomOut, - OriginalSize, - FitToScreen, - Background, - Outline, - ToggleAnimation -}; - -ImageViewerActionHandler::ImageViewerActionHandler(QObject *parent) : - QObject(parent), m_signalMapper(new QSignalMapper(this)) -{ - connect(m_signalMapper, SIGNAL(mapped(int)), SLOT(actionTriggered(int))); -} - -void ImageViewerActionHandler::actionTriggered(int supportedAction) -{ - Core::IEditor *editor = Core::EditorManager::currentEditor(); - ImageViewer *viewer = qobject_cast<ImageViewer *>(editor); - if (!viewer) - return; - - SupportedActions action = static_cast<SupportedActions>(supportedAction); - switch (action) { - case ZoomIn: - viewer->zoomIn(); - break; - case ZoomOut: - viewer->zoomOut(); - break; - case OriginalSize: - viewer->resetToOriginalSize(); - break; - case FitToScreen: - viewer->fitToScreen(); - break; - case Background: - viewer->switchViewBackground(); - break; - case Outline: - viewer->switchViewOutline(); - break; - case ToggleAnimation: - viewer->togglePlay(); - break; - default: - break; - } -} - -void ImageViewerActionHandler::createActions() -{ - registerNewAction(ZoomIn, Constants::ACTION_ZOOM_IN, tr("Zoom In"), - QKeySequence(tr("Ctrl++"))); - registerNewAction(ZoomOut, Constants::ACTION_ZOOM_OUT, tr("Zoom Out"), - QKeySequence(tr("Ctrl+-"))); - registerNewAction(OriginalSize, Constants::ACTION_ORIGINAL_SIZE, tr("Original Size"), - QKeySequence(Core::UseMacShortcuts ? tr("Meta+0") : tr("Ctrl+0"))); - registerNewAction(FitToScreen, Constants::ACTION_FIT_TO_SCREEN, tr("Fit To Screen"), - QKeySequence(tr("Ctrl+="))); - registerNewAction(Background, Constants::ACTION_BACKGROUND, tr("Switch Background"), - QKeySequence(tr("Ctrl+["))); - registerNewAction(Outline, Constants::ACTION_OUTLINE, tr("Switch Outline"), - QKeySequence(tr("Ctrl+]"))); - registerNewAction(ToggleAnimation, Constants::ACTION_TOGGLE_ANIMATION, tr("Toggle Animation"), - QKeySequence()); -} - -/*! - Creates a new action with the internal id \a actionId, command id \a id, - and keyboard shortcut \a key, and registers it in the action manager. -*/ - -void ImageViewerActionHandler::registerNewAction(int actionId, Core::Id id, - const QString &title, const QKeySequence &key) -{ - Core::Context context(Constants::IMAGEVIEWER_ID); - QAction *action = new QAction(title, this); - Core::Command *command = Core::ActionManager::registerAction(action, id, context); - command->setDefaultKeySequence(key); - connect(action, SIGNAL(triggered()), m_signalMapper, SLOT(map())); - m_signalMapper->setMapping(action, actionId); -} - -} // namespace Internal -} // namespace ImageViewer diff --git a/src/plugins/imageviewer/imageviewerconstants.h b/src/plugins/imageviewer/imageviewerconstants.h index fd3c75e2c84..3152295dd39 100644 --- a/src/plugins/imageviewer/imageviewerconstants.h +++ b/src/plugins/imageviewer/imageviewerconstants.h @@ -33,6 +33,7 @@ namespace Constants { const char IMAGEVIEWER_ID[] = "Editors.ImageViewer"; const char IMAGEVIEWER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "Image Viewer"); +const char ACTION_EXPORT_IMAGE[] = "ImageViewer.ExportImage"; const char ACTION_ZOOM_IN[] = "ImageViewer.ZoomIn"; const char ACTION_ZOOM_OUT[] = "ImageViewer.ZoomOut"; const char ACTION_ORIGINAL_SIZE[] = "ImageViewer.OriginalSize"; diff --git a/src/plugins/imageviewer/imageviewerfactory.cpp b/src/plugins/imageviewer/imageviewerfactory.cpp index 048625ec4d8..d3419369679 100644 --- a/src/plugins/imageviewer/imageviewerfactory.cpp +++ b/src/plugins/imageviewer/imageviewerfactory.cpp @@ -57,10 +57,5 @@ Core::IEditor *ImageViewerFactory::createEditor() return new ImageViewer(); } -void ImageViewerFactory::extensionsInitialized() -{ - m_actionHandler.createActions(); -} - } // namespace Internal } // namespace ImageViewer diff --git a/src/plugins/imageviewer/imageviewerfactory.h b/src/plugins/imageviewer/imageviewerfactory.h index 73d1a407e67..d288ddaf4b7 100644 --- a/src/plugins/imageviewer/imageviewerfactory.h +++ b/src/plugins/imageviewer/imageviewerfactory.h @@ -27,8 +27,6 @@ #ifndef IMAGEVIEWERFACTORY_H #define IMAGEVIEWERFACTORY_H -#include "imagevieweractionhandler.h" - #include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditor.h> #include <coreplugin/idocument.h> @@ -36,8 +34,6 @@ namespace ImageViewer { namespace Internal { -class ImageViewerActionHandler; - class ImageViewerFactory : public Core::IEditorFactory { Q_OBJECT @@ -45,11 +41,6 @@ public: explicit ImageViewerFactory(QObject *parent = 0); Core::IEditor *createEditor(); - - void extensionsInitialized(); - -private: - ImageViewerActionHandler m_actionHandler; }; } // namespace Internal diff --git a/src/plugins/imageviewer/imageviewerfile.cpp b/src/plugins/imageviewer/imageviewerfile.cpp index 64cd09a7d65..f5192db521c 100644 --- a/src/plugins/imageviewer/imageviewerfile.cpp +++ b/src/plugins/imageviewer/imageviewerfile.cpp @@ -249,23 +249,5 @@ void ImageViewerFile::cleanUp() m_type = TypeInvalid; } -bool ImageViewerFile::save(QString *errorString, const QString &fileName, bool autoSave) -{ - Q_UNUSED(errorString) - Q_UNUSED(fileName); - Q_UNUSED(autoSave) - return false; -} - -bool ImageViewerFile::isModified() const -{ - return false; -} - -bool ImageViewerFile::isSaveAsAllowed() const -{ - return false; -} - } // namespace Internal } // namespace ImageViewer diff --git a/src/plugins/imageviewer/imageviewerfile.h b/src/plugins/imageviewer/imageviewerfile.h index 1e5c3739807..772dc42955f 100644 --- a/src/plugins/imageviewer/imageviewerfile.h +++ b/src/plugins/imageviewer/imageviewerfile.h @@ -62,10 +62,6 @@ public: OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName) override; - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; diff --git a/src/plugins/imageviewer/imageviewerplugin.cpp b/src/plugins/imageviewer/imageviewerplugin.cpp index a3cb9b193bf..12d0f865245 100644 --- a/src/plugins/imageviewer/imageviewerplugin.cpp +++ b/src/plugins/imageviewer/imageviewerplugin.cpp @@ -25,12 +25,18 @@ ****************************************************************************/ #include "imageviewerplugin.h" +#include "imageviewer.h" #include "imageviewerfactory.h" #include "imageviewerconstants.h" +#include <QAction> +#include <QCoreApplication> #include <QDebug> #include <coreplugin/icore.h> +#include <coreplugin/actionmanager/actionmanager.h> +#include <coreplugin/actionmanager/command.h> +#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/id.h> #include <extensionsystem/pluginmanager.h> #include <utils/mimetypes/mimedatabase.h> @@ -52,9 +58,78 @@ bool ImageViewerPlugin::initialize(const QStringList &arguments, QString *errorM return true; } +static inline ImageViewer *currentImageViewer() +{ + return qobject_cast<ImageViewer *>(Core::EditorManager::currentEditor()); +} + void ImageViewerPlugin::extensionsInitialized() { - m_factory->extensionsInitialized(); + QAction *a = registerNewAction(Constants::ACTION_ZOOM_IN, tr("Zoom In"), + QKeySequence(tr("Ctrl++"))); + connect(a, &QAction::triggered, this, [this]() { + if (ImageViewer *iv = currentImageViewer()) + iv->zoomIn(); + }); + + a = registerNewAction(Constants::ACTION_ZOOM_OUT, tr("Zoom Out"), + QKeySequence(tr("Ctrl+-"))); + connect(a, &QAction::triggered, this, [this]() { + if (ImageViewer *iv = currentImageViewer()) + iv->zoomOut(); + }); + + a = registerNewAction(Constants::ACTION_ORIGINAL_SIZE, tr("Original Size"), + QKeySequence(Core::UseMacShortcuts ? tr("Meta+0") : tr("Ctrl+0"))); + connect(a, &QAction::triggered, this, [this]() { + if (ImageViewer *iv = currentImageViewer()) + iv->resetToOriginalSize(); + }); + + a = registerNewAction(Constants::ACTION_FIT_TO_SCREEN, tr("Fit To Screen"), + QKeySequence(tr("Ctrl+="))); + connect(a, &QAction::triggered, this, [this]() { + if (ImageViewer *iv = currentImageViewer()) + iv->fitToScreen(); + }); + + a = registerNewAction(Constants::ACTION_BACKGROUND, tr("Switch Background"), + QKeySequence(tr("Ctrl+["))); + connect(a, &QAction::triggered, this, [this]() { + if (ImageViewer *iv = currentImageViewer()) + iv->switchViewBackground(); + }); + + a = registerNewAction(Constants::ACTION_OUTLINE, tr("Switch Outline"), + QKeySequence(tr("Ctrl+]"))); + connect(a, &QAction::triggered, this, [this]() { + if (ImageViewer *iv = currentImageViewer()) + iv->switchViewOutline(); + }); + + a = registerNewAction(Constants::ACTION_TOGGLE_ANIMATION, tr("Toggle Animation"), + QKeySequence()); + connect(a, &QAction::triggered, this, [this]() { + if (ImageViewer *iv = currentImageViewer()) + iv->togglePlay(); + }); + + a = registerNewAction(Constants::ACTION_EXPORT_IMAGE, tr("Export Image"), + QKeySequence()); + connect(a, &QAction::triggered, this, [this]() { + if (ImageViewer *iv = currentImageViewer()) + iv->exportImage(); + }); +} + +QAction *ImageViewerPlugin::registerNewAction(Core::Id id, + const QString &title, const QKeySequence &key) +{ + Core::Context context(Constants::IMAGEVIEWER_ID); + QAction *action = new QAction(title, this); + Core::Command *command = Core::ActionManager::registerAction(action, id, context); + command->setDefaultKeySequence(key); + return action; } } // namespace Internal diff --git a/src/plugins/imageviewer/imageviewerplugin.h b/src/plugins/imageviewer/imageviewerplugin.h index 24a06391b78..841295dd88b 100644 --- a/src/plugins/imageviewer/imageviewerplugin.h +++ b/src/plugins/imageviewer/imageviewerplugin.h @@ -32,6 +32,13 @@ #include <QPointer> #include <QtPlugin> +QT_BEGIN_NAMESPACE +class QAction; +class QKeySequence; +QT_END_NAMESPACE + +namespace Core { class Id; } + namespace ImageViewer { namespace Internal { @@ -49,6 +56,8 @@ public: void extensionsInitialized(); private: + QAction *registerNewAction(Core::Id id, const QString &title, const QKeySequence &key); + QPointer<ImageViewerFactory> m_factory; }; diff --git a/src/plugins/imageviewer/imageviewertoolbar.ui b/src/plugins/imageviewer/imageviewertoolbar.ui index 3c673fb871b..0c86a3e5852 100644 --- a/src/plugins/imageviewer/imageviewertoolbar.ui +++ b/src/plugins/imageviewer/imageviewertoolbar.ui @@ -18,6 +18,13 @@ <number>0</number> </property> <item> + <widget class="Core::CommandButton" name="toolButtonExportImage"> + <property name="toolTipBase"> + <string>Export as Image</string> + </property> + </widget> + </item> + <item> <widget class="Core::CommandButton" name="toolButtonBackground"> <property name="toolTipBase"> <string>Show Background</string> diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 4ce5498fe8d..919b1ffa6d8 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -340,6 +340,15 @@ void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev) const bool hasCurrentItem = current.isValid(); QAction *actionOpen = menu.addAction(actionOpenText(m_fileSystemModel, current)); actionOpen->setEnabled(hasCurrentItem); + + // we need dummy DocumentModel::Entry with absolute file path in it + // to get EditorManager::addNativeDirAndOpenWithActions() working + Core::DocumentModel::Entry fakeEntry; + Core::IDocument document; + document.setFilePath(Utils::FileName::fromString(m_fileSystemModel->filePath(current))); + fakeEntry.document = &document; + Core::EditorManager::addNativeDirAndOpenWithActions(&menu, &fakeEntry); + const bool isDirectory = hasCurrentItem && m_fileSystemModel->isDir(current); QAction *actionOpenDirectoryAsProject = 0; if (isDirectory && m_fileSystemModel->fileName(current) != QLatin1String("..")) { @@ -347,20 +356,6 @@ void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(tr("Open Project in \"%1\"") .arg(m_fileSystemModel->fileName(current))); } - // Explorer & teminal - QAction *actionExplorer = menu.addAction(Core::FileUtils::msgGraphicalShellAction()); - actionExplorer->setEnabled(hasCurrentItem); - QAction *actionTerminal = menu.addAction(Core::FileUtils::msgTerminalAction()); - actionTerminal->setEnabled(hasCurrentItem); - - QAction *actionFind = menu.addAction(Core::FileUtils::msgFindInDirectory()); - actionFind->setEnabled(hasCurrentItem); - // open with... - if (hasCurrentItem && !isDirectory) { - QMenu *openWith = menu.addMenu(tr("Open With")); - Core::EditorManager::populateOpenWithMenu(openWith, - m_fileSystemModel->filePath(current)); - } // Open file dialog to choose a path starting from current QAction *actionChooseFolder = menu.addAction(tr("Choose Folder...")); @@ -372,29 +367,12 @@ void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev) ev->accept(); if (action == actionOpen) { // Handle open file. openItem(current); - return; - } - if (action == actionOpenDirectoryAsProject) { + } else if (action == actionOpenDirectoryAsProject) { openItem(current, true); - return; - } - if (action == actionChooseFolder) { // Open file dialog + } else if (action == actionChooseFolder) { // Open file dialog const QString newPath = QFileDialog::getExistingDirectory(this, tr("Choose Folder"), currentDirectory()); if (!newPath.isEmpty()) setCurrentDirectory(newPath); - return; - } - if (action == actionTerminal) { - Core::FileUtils::openTerminal(m_fileSystemModel->filePath(current)); - return; - } - if (action == actionExplorer) { - Core::FileUtils::showInGraphicalShell(this, m_fileSystemModel->filePath(current)); - return; - } - if (action == actionFind) { - TextEditor::FindInFiles::findOnFileSystem(m_fileSystemModel->filePath(current)); - return; } } diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index fb0bf15e8b0..d2d9fece2e2 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -212,6 +212,12 @@ void ToolChainKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander const ToolChain *tc = toolChain(kit); return tc ? tc->displayName() : tr("None"); }); + + expander->registerVariable("Compiler:Executable", tr("Path to the compiler executable"), + [this, kit]() -> QString { + const ToolChain *tc = toolChain(kit); + return tc ? tc->compilerCommand().toString() : QString(); + }); } diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index fec7d9938ce..2c399e9955a 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1889,7 +1889,11 @@ void ProjectExplorerPluginPrivate::restoreSession() connect(dd->m_welcomePage, &ProjectWelcomePage::requestProject, m_instance, &ProjectExplorerPlugin::openProjectWelcomePage); dd->m_arguments = arguments; - QTimer::singleShot(0, m_instance, &ProjectExplorerPlugin::restoreSession2); + // delay opening projects from the command line even more + QTimer::singleShot(0, m_instance, []() { + ICore::openFiles(dd->m_arguments, ICore::OpenFilesFlags(ICore::CanContainLineAndColumnNumbers | ICore::SwitchMode)); + m_instance->finishedInitialization(); + }); updateActions(); } @@ -1898,12 +1902,6 @@ void ProjectExplorerPluginPrivate::loadSession(const QString &session) SessionManager::loadSession(session); } -void ProjectExplorerPlugin::restoreSession2() -{ - QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); - ICore::openFiles(dd->m_arguments, ICore::OpenFilesFlags(ICore::CanContainLineAndColumnNumbers | ICore::SwitchMode)); -} - void ProjectExplorerPluginPrivate::buildStateChanged(Project * pro) { Q_UNUSED(pro) diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index aee6d28f738..64e8882e887 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -161,6 +161,7 @@ public: static void openOpenProjectDialog(); signals: + void finishedInitialization(); void runControlStarted(ProjectExplorer::RunControl *rc); void runControlFinished(ProjectExplorer::RunControl *rc); @@ -177,7 +178,6 @@ signals: private: static bool coreAboutToClose(); - static void restoreSession2(); #ifdef WITH_TESTS private slots: diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 1ca95da8e4e..2b5d24c904e 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -153,19 +153,24 @@ WorkingDirectoryAspect *WorkingDirectoryAspect::clone(RunConfiguration *runConfi void WorkingDirectoryAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout) { QTC_CHECK(!m_chooser); + m_resetButton = new QToolButton(parent); + m_resetButton->setToolTip(tr("Reset to Default")); + m_resetButton->setIcon(Core::Icons::RESET.icon()); + connect(m_resetButton.data(), &QAbstractButton::clicked, this, &WorkingDirectoryAspect::resetPath); + m_chooser = new PathChooser(parent); m_chooser->setHistoryCompleter(m_key); m_chooser->setExpectedKind(Utils::PathChooser::Directory); m_chooser->setPromptDialogTitle(tr("Select Working Directory")); - m_chooser->lineEdit()->setPlaceholderText(m_defaultWorkingDirectory.toUserOutput()); - m_chooser->setFileName(m_workingDirectory); + m_chooser->setBaseFileName(m_defaultWorkingDirectory); + m_chooser->setFileName(m_workingDirectory.isEmpty() ? m_defaultWorkingDirectory : m_workingDirectory); connect(m_chooser.data(), &PathChooser::pathChanged, this, - [this]() { m_workingDirectory = m_chooser->rawFileName(); }); + [this]() { + m_workingDirectory = m_chooser->rawFileName(); + m_resetButton->setEnabled(m_workingDirectory != m_defaultWorkingDirectory); + }); - auto resetButton = new QToolButton(parent); - resetButton->setToolTip(tr("Reset to Default")); - resetButton->setIcon(Core::Icons::RESET.icon()); - connect(resetButton, &QAbstractButton::clicked, this, &WorkingDirectoryAspect::resetPath); + m_resetButton->setEnabled(m_workingDirectory != m_defaultWorkingDirectory); if (auto envAspect = runConfiguration()->extraAspect<EnvironmentAspect>()) { connect(envAspect, &EnvironmentAspect::environmentChanged, m_chooser.data(), [this, envAspect] { @@ -176,7 +181,7 @@ void WorkingDirectoryAspect::addToMainConfigurationWidget(QWidget *parent, QForm auto hbox = new QHBoxLayout; hbox->addWidget(m_chooser); - hbox->addWidget(resetButton); + hbox->addWidget(m_resetButton); layout->addRow(tr("Working directory:"), hbox); } @@ -187,29 +192,30 @@ QString WorkingDirectoryAspect::keyForDefaultWd() const void WorkingDirectoryAspect::resetPath() { - m_chooser->setPath(QString()); + m_chooser->setFileName(m_defaultWorkingDirectory); } void WorkingDirectoryAspect::fromMap(const QVariantMap &map) { m_workingDirectory = FileName::fromString(map.value(m_key).toString()); m_defaultWorkingDirectory = FileName::fromString(map.value(keyForDefaultWd()).toString()); + + if (m_workingDirectory.isEmpty()) + m_workingDirectory = m_defaultWorkingDirectory; } void WorkingDirectoryAspect::toMap(QVariantMap &data) const { - data.insert(m_key, m_workingDirectory.toString()); + const QString wd + = (m_workingDirectory == m_defaultWorkingDirectory) ? QString() : m_workingDirectory.toString(); + data.insert(m_key, wd); data.insert(keyForDefaultWd(), m_defaultWorkingDirectory.toString()); } FileName WorkingDirectoryAspect::workingDirectory() const { - if (m_workingDirectory.isEmpty()) - return m_defaultWorkingDirectory; - if (m_chooser) { - return FileName::fromString( - runConfiguration()->macroExpander()->expandProcessArgs(m_chooser->path())); + return m_chooser->fileName(); } else { auto envAspect = runConfiguration()->extraAspect<EnvironmentAspect>(); const Utils::Environment env = envAspect ? envAspect->environment() @@ -232,9 +238,18 @@ FileName WorkingDirectoryAspect::unexpandedWorkingDirectory() const void WorkingDirectoryAspect::setDefaultWorkingDirectory(const FileName &defaultWorkingDir) { + if (defaultWorkingDir == m_defaultWorkingDirectory) + return; + + Utils::FileName oldDefaultDir = m_defaultWorkingDirectory; m_defaultWorkingDirectory = defaultWorkingDir; - if (m_chooser) - m_chooser->lineEdit()->setPlaceholderText(m_defaultWorkingDirectory.toUserOutput()); + if (m_chooser) { + if (m_chooser->fileName() == oldDefaultDir) + m_chooser->setFileName(m_defaultWorkingDirectory); + m_chooser->setBaseFileName(m_defaultWorkingDirectory); + } + if (m_workingDirectory.isEmpty() || m_workingDirectory == oldDefaultDir) + m_workingDirectory = defaultWorkingDir; } PathChooser *WorkingDirectoryAspect::pathChooser() const diff --git a/src/plugins/projectexplorer/runconfigurationaspects.h b/src/plugins/projectexplorer/runconfigurationaspects.h index b5e0281e3ae..e08f76c4e26 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.h +++ b/src/plugins/projectexplorer/runconfigurationaspects.h @@ -34,6 +34,7 @@ QT_BEGIN_NAMESPACE class QCheckBox; class QFormLayout; class QLineEdit; +class QToolButton; QT_END_NAMESPACE namespace Utils { @@ -105,6 +106,7 @@ private: Utils::FileName m_workingDirectory; Utils::FileName m_defaultWorkingDirectory; QPointer<Utils::PathChooser> m_chooser; + QPointer<QToolButton> m_resetButton; QString m_key; }; diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index fdeb8e2134e..92648cdad3a 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -281,17 +281,6 @@ public: setFilePath(FileName::fromString(fileName)); } - bool save(QString *errorString, const QString &fileName, bool autoSave) override - { - Q_UNUSED(errorString) - Q_UNUSED(fileName) - Q_UNUSED(autoSave) - return false; - } - - bool isModified() const override { return false; } - bool isSaveAsAllowed() const override { return false; } - ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override { Q_UNUSED(state) diff --git a/src/plugins/qbsprojectmanager/qbsprojectfile.cpp b/src/plugins/qbsprojectmanager/qbsprojectfile.cpp index e7b74c7d41d..21455d7e4a2 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectfile.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectfile.cpp @@ -39,21 +39,6 @@ QbsProjectFile::QbsProjectFile(QbsProject *parent, QString fileName) : Core::IDo setFilePath(Utils::FileName::fromString(fileName)); } -bool QbsProjectFile::save(QString *, const QString &, bool) -{ - return false; -} - -bool QbsProjectFile::isModified() const -{ - return false; -} - -bool QbsProjectFile::isSaveAsAllowed() const -{ - return false; -} - Core::IDocument::ReloadBehavior QbsProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { Q_UNUSED(state); diff --git a/src/plugins/qbsprojectmanager/qbsprojectfile.h b/src/plugins/qbsprojectmanager/qbsprojectfile.h index 13aa2ac037b..b57fcbcd33f 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectfile.h +++ b/src/plugins/qbsprojectmanager/qbsprojectfile.h @@ -36,15 +36,9 @@ class QbsProject; class QbsProjectFile : public Core::IDocument { Q_OBJECT - public: QbsProjectFile(QbsProject *parent, QString fileName); - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; - ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 6b5834db09a..65611128b0a 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -268,24 +268,6 @@ QmakePriFile::QmakePriFile(QmakeProjectManager::QmakePriFileNode *qmakePriFile) setFilePath(m_priFile->filePath()); } -bool QmakePriFile::save(QString *errorString, const QString &fileName, bool autoSave) -{ - Q_UNUSED(errorString); - Q_UNUSED(fileName); - Q_UNUSED(autoSave); - return false; -} - -bool QmakePriFile::isModified() const -{ - return false; -} - -bool QmakePriFile::isSaveAsAllowed() const -{ - return false; -} - Core::IDocument::ReloadBehavior QmakePriFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { Q_UNUSED(state) diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h index 3705c99703f..ca565a45157 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.h +++ b/src/plugins/qmakeprojectmanager/qmakenodes.h @@ -241,10 +241,6 @@ class QmakePriFile : public Core::IDocument Q_OBJECT public: QmakePriFile(QmakePriFileNode *qmakePriFile); - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 6f8c2f90b41..8ae36a74bd1 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -95,15 +95,9 @@ namespace Internal { class QmakeProjectFile : public Core::IDocument { Q_OBJECT - public: QmakeProjectFile(const QString &filePath); - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; - ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; }; @@ -254,22 +248,6 @@ QmakeProjectFile::QmakeProjectFile(const QString &filePath) setFilePath(FileName::fromString(filePath)); } -bool QmakeProjectFile::save(QString *, const QString &, bool) -{ - // This is never used - return false; -} - -bool QmakeProjectFile::isModified() const -{ - return false; // we save after changing anyway -} - -bool QmakeProjectFile::isSaveAsAllowed() const -{ - return false; -} - Core::IDocument::ReloadBehavior QmakeProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { Q_UNUSED(state) diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp index 8917555b076..aed04da5230 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp @@ -26,8 +26,11 @@ #include "formeditorgraphicsview.h" #include <QWheelEvent> -#include <QDebug> #include <QScrollBar> +#include <QGraphicsItem> +#include <QGraphicsWidget> +#include <QGraphicsProxyWidget> +#include <QCoreApplication> namespace QmlDesigner { @@ -40,8 +43,8 @@ FormEditorGraphicsView::FormEditorGraphicsView(QWidget *parent) : setCacheMode(QGraphicsView::CacheNone); setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); setOptimizationFlags(QGraphicsView::DontSavePainterState); -// setViewportUpdateMode(QGraphicsView::NoViewportUpdate); setRenderHint(QPainter::Antialiasing, false); + setRenderHint(QPainter::SmoothPixmapTransform, true); setFrameShape(QFrame::NoFrame); @@ -50,7 +53,32 @@ FormEditorGraphicsView::FormEditorGraphicsView(QWidget *parent) : activateCheckboardBackground(); - viewport()->setMouseTracking(true); + // as mousetracking only works for mouse key it is better to handle it in the + // eventFilter method so it works also for the space scrolling case as expected + QCoreApplication::instance()->installEventFilter(this); +} + +bool FormEditorGraphicsView::eventFilter(QObject *watched, QEvent *event) +{ + if (m_isPanning != Panning::NotStarted) { + if (event->type() == QEvent::Leave && m_isPanning == Panning::SpaceKeyStarted) { + // there is no way to keep the cursor so we stop panning here + stopPanning(event); + } + if (event->type() == QEvent::MouseMove) { + QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event); + if (!m_panningStartPosition.isNull()) { + horizontalScrollBar()->setValue(horizontalScrollBar()->value() - + (mouseEvent->x() - m_panningStartPosition.x())); + verticalScrollBar()->setValue(verticalScrollBar()->value() - + (mouseEvent->y() - m_panningStartPosition.y())); + } + m_panningStartPosition = mouseEvent->pos(); + event->accept(); + return true; + } + } + return QGraphicsView::eventFilter(watched, event); } void FormEditorGraphicsView::wheelEvent(QWheelEvent *event) @@ -63,50 +91,55 @@ void FormEditorGraphicsView::wheelEvent(QWheelEvent *event) void FormEditorGraphicsView::mousePressEvent(QMouseEvent *event) { - if (event->buttons().testFlag(Qt::MiddleButton) && m_isPanning == Panning::NotStarted) - startPanning(event); - else - QGraphicsView::mousePressEvent(event); -} - -void FormEditorGraphicsView::mouseMoveEvent(QMouseEvent *event) -{ - if (m_isPanning != Panning::NotStarted) { - if (!m_panningStartPosition.isNull()) { - horizontalScrollBar()->setValue(horizontalScrollBar()->value() - - (event->x() - m_panningStartPosition.x())); - verticalScrollBar()->setValue(verticalScrollBar()->value() - - (event->y() - m_panningStartPosition.y())); - } - m_panningStartPosition = event->pos(); - event->accept(); - }else { - QGraphicsView::mouseMoveEvent(event); + if (m_isPanning == Panning::NotStarted) { + if (event->buttons().testFlag(Qt::MiddleButton)) + startPanning(event); + else + QGraphicsView::mousePressEvent(event); } } void FormEditorGraphicsView::mouseReleaseEvent(QMouseEvent *event) { - if (m_isPanning == Panning::MouseWheelStarted) + // not sure why buttons() are empty here, but we have that information from the enum + if (/*event->buttons().testFlag(Qt::MiddleButton) && */m_isPanning == Panning::MouseWheelStarted) stopPanning(event); else QGraphicsView::mouseReleaseEvent(event); } +bool isTextInputItem(QGraphicsItem* item) +{ + if (item && item->isWidget()) { + QGraphicsWidget *graphicsWidget = static_cast<QGraphicsWidget *>(item); + QGraphicsProxyWidget * textInputProxyWidget = qobject_cast<QGraphicsProxyWidget *>(graphicsWidget); + if (textInputProxyWidget && textInputProxyWidget->widget() && ( + strcmp(textInputProxyWidget->widget()->metaObject()->className(), "QLineEdit") == 0 || + strcmp(textInputProxyWidget->widget()->metaObject()->className(), "QTextEdit") == 0)) { + return true; + } + + } + return false; +} + void FormEditorGraphicsView::keyPressEvent(QKeyEvent *event) { - if (event->key() == Qt::Key_Space && m_isPanning == Panning::NotStarted) + // check for autorepeat to avoid a stoped space panning by leave event to be restarted + if (!event->isAutoRepeat() && m_isPanning == Panning::NotStarted && event->key() == Qt::Key_Space && + !isTextInputItem(scene()->focusItem())) { startPanning(event); - else - QGraphicsView::keyPressEvent(event); + return; + } + QGraphicsView::keyPressEvent(event); } void FormEditorGraphicsView::keyReleaseEvent(QKeyEvent *event) { - if (event->key() == Qt::Key_Space && !event->isAutoRepeat()) + if (event->key() == Qt::Key_Space && !event->isAutoRepeat() && m_isPanning == Panning::SpaceKeyStarted) stopPanning(event); - else - QGraphicsView::keyReleaseEvent(event); + + QGraphicsView::keyReleaseEvent(event); } void FormEditorGraphicsView::startPanning(QEvent *event) @@ -115,7 +148,7 @@ void FormEditorGraphicsView::startPanning(QEvent *event) m_isPanning = Panning::SpaceKeyStarted; else m_isPanning = Panning::MouseWheelStarted; - setCursor(Qt::ClosedHandCursor); + viewport()->setCursor(Qt::ClosedHandCursor); event->accept(); } @@ -123,7 +156,7 @@ void FormEditorGraphicsView::stopPanning(QEvent *event) { m_isPanning = Panning::NotStarted; m_panningStartPosition = QPoint(); - setCursor(Qt::ArrowCursor); + viewport()->unsetCursor(); event->accept(); } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h index a22227b55b5..35b0142a217 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h @@ -41,10 +41,10 @@ public: void activateColoredBackground(const QColor &color); protected: + bool eventFilter(QObject *watched, QEvent *event) override; void drawBackground(QPainter *painter, const QRectF &rect) override; void wheelEvent(QWheelEvent *event) override; void mousePressEvent(QMouseEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void keyPressEvent(QKeyEvent *event) override; void keyReleaseEvent(QKeyEvent *event) override; diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 5f13e7a357b..38d474626c6 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -84,7 +84,10 @@ DocumentWarningWidget::DocumentWarningWidget(DesignModeWidget *parent) : m_errorMessage->setForegroundRole(QPalette::ToolTipText); m_goToError->setText(tr("<a href=\"goToError\">Go to error</a>")); m_goToError->setForegroundRole(QPalette::Link); - connect(m_goToError, &QLabel::linkActivated, this, &DocumentWarningWidget::goToError); + connect(m_goToError, &QLabel::linkActivated, this, [=]() { + m_designModeWidget->textEditor()->gotoLine(m_error.line(), m_error.column() - 1); + Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); + }); QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(20); @@ -163,12 +166,6 @@ QList<QToolButton *> DesignerSideBarItem::createToolBarWidgets() return QList<QToolButton *>(); } -void DocumentWarningWidget::goToError() -{ - m_designModeWidget->textEditor()->gotoLine(m_error.line(), m_error.column() - 1); - Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); -} - // ---------- DesignModeWidget DesignModeWidget::DesignModeWidget(QWidget *parent) : QWidget(parent), diff --git a/src/plugins/qmldesigner/designmodewidget.h b/src/plugins/qmldesigner/designmodewidget.h index 70a4e6987a6..41d9af758be 100644 --- a/src/plugins/qmldesigner/designmodewidget.h +++ b/src/plugins/qmldesigner/designmodewidget.h @@ -70,9 +70,6 @@ public: void setError(const RewriterError &error); -private slots: - void goToError(); - private: QLabel *m_errorMessage; QLabel *m_goToError; diff --git a/src/plugins/qmldesigner/documentmanager.cpp b/src/plugins/qmldesigner/documentmanager.cpp index 85ed6d3bfb5..baa8d6a4416 100644 --- a/src/plugins/qmldesigner/documentmanager.cpp +++ b/src/plugins/qmldesigner/documentmanager.cpp @@ -283,7 +283,7 @@ void DocumentManager::setCurrentDesignDocument(Core::IEditor *editor) m_designDocumentHash.insert(editor, m_currentDesignDocument); m_currentDesignDocument->setEditor(editor); } - } else { + } else if (!m_currentDesignDocument.isNull()) { m_currentDesignDocument->resetToDocumentModel(); m_currentDesignDocument.clear(); } diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.cpp b/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.cpp index 108019c5f10..38f62bfb646 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.cpp @@ -26,31 +26,22 @@ #include "textedititem.h" #include <formeditorscene.h> -#include <QTextEdit> -#include <QLineEdit> #include <nodemetainfo.h> +#include <QLineEdit> +#include <QTextEdit> namespace QmlDesigner { TextEditItem::TextEditItem(FormEditorScene* scene) - : QGraphicsProxyWidget(), - m_lineEdit(new QLineEdit), - m_textEdit(new QTextEdit), - m_formEditorItem(0) + : TextEditItemWidget(scene) + , m_formEditorItem(0) { - scene->addItem(this); - setFlag(QGraphicsItem::ItemIsMovable, false); - - setWidget(m_lineEdit.data()); - m_lineEdit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); - m_lineEdit->setFocus(); - connect(m_lineEdit.data(), &QLineEdit::returnPressed, this, &TextEditItem::returnPressed); + connect(lineEdit(), &QLineEdit::returnPressed, this, &TextEditItem::returnPressed); } TextEditItem::~TextEditItem() { - setWidget(0); m_formEditorItem = 0; } @@ -66,28 +57,20 @@ void TextEditItem::writeTextToProperty() } } -QString TextEditItem::text() const -{ - if (widget() == m_lineEdit.data()) - return m_lineEdit->text(); - else if (widget() == m_textEdit.data()) - return m_textEdit->toPlainText(); - return QString(); -} - void TextEditItem::setFormEditorItem(FormEditorItem *formEditorItem) { m_formEditorItem = formEditorItem; QRectF rect = formEditorItem->qmlItemNode().instancePaintedBoundingRect().united(formEditorItem->qmlItemNode().instanceBoundingRect()).adjusted(-12, -4, 12 ,4); setGeometry(rect); - m_textEdit->setMaximumSize(rect.size().toSize()); NodeMetaInfo metaInfo = m_formEditorItem->qmlItemNode().modelNode().metaInfo(); if (metaInfo.isValid() && (metaInfo.isSubclassOf("QtQuick.TextEdit", -1, -1) || metaInfo.isSubclassOf("QtQuick.Controls.TextArea", -1, -1))) { - setWidget(m_textEdit.data()); - m_textEdit->setFocus(); + QSize maximumSize = rect.size().toSize(); + activateTextEdit(maximumSize); + } else { + activateLineEdit(); } setTransform(formEditorItem->sceneTransform()); @@ -102,15 +85,8 @@ FormEditorItem *TextEditItem::formEditorItem() const void TextEditItem::updateText() { if (formEditorItem()) { - if (widget() == m_lineEdit.data()) { - m_lineEdit->setText(formEditorItem()->qmlItemNode().stripedTranslatableText("text")); - m_lineEdit->selectAll(); - } else if (widget() == m_textEdit.data()) { - m_textEdit->setText(formEditorItem()->qmlItemNode().stripedTranslatableText("text")); - m_textEdit->selectAll(); - } + TextEditItemWidget::updateText(formEditorItem()->qmlItemNode(). + stripedTranslatableText("text")); } } - - -} +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.h b/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.h index 2baaa4e98c9..4213de98229 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.h +++ b/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.h @@ -22,32 +22,19 @@ ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ +#pragma once -#ifndef TEXTEDITITEM_H -#define TEXTEDITITEM_H - -#include <QGraphicsProxyWidget> -#include <QWeakPointer> -#include <QScopedPointer> - -QT_BEGIN_NAMESPACE -class QTextEdit; -class QLineEdit; -QT_END_NAMESPACE +#include "textedititemwidget.h" namespace QmlDesigner { class FormEditorScene; class FormEditorItem; -class TextEditItem : public QGraphicsProxyWidget +class TextEditItem : public TextEditItemWidget { Q_OBJECT public: - enum - { - Type = 0xEAAB - }; TextEditItem(FormEditorScene* scene); ~TextEditItem(); int type() const; @@ -55,27 +42,17 @@ public: void setFormEditorItem(FormEditorItem *formEditorItem); FormEditorItem *formEditorItem() const; - QList<QGraphicsItem*> findAllChildItems() const; - void updateText(); void writeTextToProperty(); signals: - void textChanged(const QString &text); void returnPressed(); - private: - QString text() const; - - QScopedPointer<QLineEdit> m_lineEdit; - QScopedPointer<QTextEdit> m_textEdit; FormEditorItem *m_formEditorItem; }; inline int TextEditItem::type() const { - return Type; -} + return 0xEAAB; } - -#endif // TEXTEDITITEM_H +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.cpp b/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.cpp new file mode 100644 index 00000000000..65741d05331 --- /dev/null +++ b/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** 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 "textedititemwidget.h" + +#include <QTextEdit> +#include <QLineEdit> +#include <QGraphicsScene> + +namespace QmlDesigner { + +TextEditItemWidget::TextEditItemWidget(QGraphicsScene* scene) + : QGraphicsProxyWidget() +{ + scene->addItem(this); + setFlag(QGraphicsItem::ItemIsMovable, false); + activateLineEdit(); +} + +TextEditItemWidget::~TextEditItemWidget() +{ + setWidget(0); +} + +QLineEdit* TextEditItemWidget::lineEdit() const +{ + if (m_lineEdit.isNull()) { + m_lineEdit.reset(new QLineEdit); + m_lineEdit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); + } + return m_lineEdit.data(); +} + +QTextEdit* TextEditItemWidget::textEdit() const +{ + if (m_textEdit.isNull()) + m_textEdit.reset(new QTextEdit); + return m_textEdit.data(); +} + +void TextEditItemWidget::activateTextEdit(const QSize &maximumSize) +{ + textEdit()->setMaximumSize(maximumSize); + textEdit()->setFocus(); + setWidget(textEdit()); +} + +void TextEditItemWidget::activateLineEdit() +{ + lineEdit()->setFocus(); + setWidget(lineEdit()); +} + +QString TextEditItemWidget::text() const +{ + if (widget() == m_lineEdit.data()) + return m_lineEdit->text(); + else if (widget() == m_textEdit.data()) + return m_textEdit->toPlainText(); + return QString(); +} + +void TextEditItemWidget::updateText(const QString &text) +{ + if (widget() == m_lineEdit.data()) { + m_lineEdit->setText(text); + m_lineEdit->selectAll(); + } else if (widget() == m_textEdit.data()) { + m_textEdit->setText(text); + m_textEdit->selectAll(); + } +} +} // namespace QmlDesigner diff --git a/src/plugins/imageviewer/imagevieweractionhandler.h b/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.h index a6074bed78f..ca006e4fbc4 100644 --- a/src/plugins/imageviewer/imagevieweractionhandler.h +++ b/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.h @@ -1,6 +1,5 @@ /**************************************************************************** ** -** Copyright (C) 2016 Denis Mingulov. ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** @@ -23,43 +22,37 @@ ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ +#pragma once -#ifndef IMAGEVIEWERACTIONHANDLER_H -#define IMAGEVIEWERACTIONHANDLER_H - -#include <coreplugin/id.h> - -#include <QObject> +#include <QGraphicsProxyWidget> +#include <QScopedPointer> QT_BEGIN_NAMESPACE -class QKeySequence; -class QSignalMapper; +class QTextEdit; +class QLineEdit; +class QGraphicsScene; QT_END_NAMESPACE -namespace ImageViewer { -namespace Internal { +namespace QmlDesigner { -class ImageViewerActionHandler : public QObject +class TextEditItemWidget : public QGraphicsProxyWidget { Q_OBJECT - public: - explicit ImageViewerActionHandler(QObject *parent = 0); - void createActions(); + TextEditItemWidget(QGraphicsScene *scene); + ~TextEditItemWidget(); -public slots: - void actionTriggered(int supportedAction); + void activateTextEdit(const QSize &maximumSize); + void activateLineEdit(); + void updateText(const QString &text); protected: + QLineEdit* lineEdit() const; + QTextEdit* textEdit() const; - void registerNewAction(int actionId, Core::Id id, const QString &title, - const QKeySequence &key); - + QString text() const; private: - QSignalMapper *m_signalMapper; + mutable QScopedPointer<QLineEdit> m_lineEdit; + mutable QScopedPointer<QTextEdit> m_textEdit; }; - -} // namespace Internal -} // namespace ImageViewer - -#endif // IMAGEVIEWERACTIONHANDLER_H +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.pri b/src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.pri index fdeff7da29c..0cfdfb76294 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.pri +++ b/src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.pri @@ -1,5 +1,7 @@ HEADERS += $$PWD/texttool.h HEADERS += $$PWD/textedititem.h +HEADERS += $$PWD/textedititemwidget.h SOURCES += $$PWD/texttool.cpp SOURCES += $$PWD/textedititem.cpp +SOURCES += $$PWD/textedititemwidget.cpp diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp index 96cbc529c5f..8c1a87b3a6b 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp @@ -32,11 +32,11 @@ QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *mode QmlDebug::RangeType rangeType, QmlDebug::ProfileFeature mainFeature, QObject *parent) : - TimelineModel(modelManager->registerModelProxy(), - tr(QmlProfilerModelManager::featureName(mainFeature)), parent), + TimelineModel(modelManager->registerModelProxy(), parent), m_message(message), m_rangeType(rangeType), m_mainFeature(mainFeature), m_modelManager(modelManager) { + setDisplayName(tr(QmlProfilerModelManager::featureName(mainFeature))); connect(modelManager, &QmlProfilerModelManager::stateChanged, this, &QmlProfilerTimelineModel::dataChanged); connect(modelManager, &QmlProfilerModelManager::visibleFeaturesChanged, diff --git a/src/plugins/qmlprojectmanager/qmlprojectfile.cpp b/src/plugins/qmlprojectmanager/qmlprojectfile.cpp index c97820a5c47..3794f1d11a9 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectfile.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectfile.cpp @@ -41,21 +41,6 @@ QmlProjectFile::QmlProjectFile(QmlProject *parent, const Utils::FileName &fileNa setFilePath(fileName); } -bool QmlProjectFile::save(QString *, const QString &, bool) -{ - return false; -} - -bool QmlProjectFile::isModified() const -{ - return false; -} - -bool QmlProjectFile::isSaveAsAllowed() const -{ - return false; -} - Core::IDocument::ReloadBehavior QmlProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { Q_UNUSED(state) diff --git a/src/plugins/qmlprojectmanager/qmlprojectfile.h b/src/plugins/qmlprojectmanager/qmlprojectfile.h index 73dc4ace989..bd9077397e0 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectfile.h +++ b/src/plugins/qmlprojectmanager/qmlprojectfile.h @@ -37,15 +37,9 @@ namespace Internal { class QmlProjectFile : public Core::IDocument { Q_OBJECT - public: QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName); - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; - ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index f0683f06edb..2c5bd05f73b 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -146,6 +146,11 @@ void QtKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) con BaseQtVersion *version = qtVersion(kit); return version ? version->displayName() : tr("unknown"); }); + expander->registerVariable("Qt:qmakeExecutable", tr("Path to the qmake executable"), + [this, kit]() -> QString { + BaseQtVersion *version = qtVersion(kit); + return version ? version->qmakeCommand().toString() : QString(); + }); } Core::Id QtKitInformation::id() diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp index e2f8ca16caf..c77c2632b78 100644 --- a/src/plugins/resourceeditor/resourcenode.cpp +++ b/src/plugins/resourceeditor/resourcenode.cpp @@ -552,24 +552,6 @@ ResourceFileWatcher::ResourceFileWatcher(ResourceTopLevelNode *node) setFilePath(node->filePath()); } -bool ResourceFileWatcher::save(QString *errorString, const QString &fileName, bool autoSave) -{ - Q_UNUSED(errorString); - Q_UNUSED(fileName); - Q_UNUSED(autoSave); - return false; -} - -bool ResourceFileWatcher::isModified() const -{ - return false; -} - -bool ResourceFileWatcher::isSaveAsAllowed() const -{ - return false; -} - Core::IDocument::ReloadBehavior ResourceFileWatcher::reloadBehavior(ChangeTrigger state, ChangeType type) const { Q_UNUSED(state) diff --git a/src/plugins/resourceeditor/resourcenode.h b/src/plugins/resourceeditor/resourcenode.h index d006d8225a9..7d1fce7ebf2 100644 --- a/src/plugins/resourceeditor/resourcenode.h +++ b/src/plugins/resourceeditor/resourcenode.h @@ -168,10 +168,6 @@ class ResourceFileWatcher : public Core::IDocument Q_OBJECT public: ResourceFileWatcher(ResourceTopLevelNode *node); - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; diff --git a/src/plugins/tasklist/taskfile.cpp b/src/plugins/tasklist/taskfile.cpp index ddf1077b115..36206164383 100644 --- a/src/plugins/tasklist/taskfile.cpp +++ b/src/plugins/tasklist/taskfile.cpp @@ -41,24 +41,6 @@ TaskFile::TaskFile(QObject *parent) : Core::IDocument(parent) setId("TaskList.TaskFile"); } -bool TaskFile::save(QString *errorString, const QString &fileName, bool autoSave) -{ - Q_UNUSED(errorString) - Q_UNUSED(fileName); - Q_UNUSED(autoSave) - return false; -} - -bool TaskFile::isModified() const -{ - return false; -} - -bool TaskFile::isSaveAsAllowed() const -{ - return false; -} - Core::IDocument::ReloadBehavior TaskFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { Q_UNUSED(state); diff --git a/src/plugins/tasklist/taskfile.h b/src/plugins/tasklist/taskfile.h index bfe98f35734..11bfce115bb 100644 --- a/src/plugins/tasklist/taskfile.h +++ b/src/plugins/tasklist/taskfile.h @@ -38,11 +38,6 @@ class TaskFile : public Core::IDocument public: TaskFile(QObject *parent); - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - - bool isModified() const override; - bool isSaveAsAllowed() const override; - ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp index 318dedcf80a..45f78324b8e 100644 --- a/src/plugins/texteditor/codeassist/codeassistant.cpp +++ b/src/plugins/texteditor/codeassist/codeassistant.cpp @@ -197,7 +197,8 @@ void CodeAssistantPrivate::process() } } - startAutomaticProposalTimer(); + if (!isDisplayingProposal()) + startAutomaticProposalTimer(); } else { m_assistKind = TextEditor::Completion; } @@ -431,8 +432,6 @@ void CodeAssistantPrivate::notifyChange() m_proposalWidget->updateProposal( m_editorWidget->textAt(m_proposal->basePosition(), m_editorWidget->position() - m_proposal->basePosition())); - if (m_proposal->isFragile()) - startAutomaticProposalTimer(); } } } @@ -464,7 +463,7 @@ void CodeAssistantPrivate::startAutomaticProposalTimer() void CodeAssistantPrivate::automaticProposalTimeout() { - if (isWaitingForProposal() || (isDisplayingProposal() && !m_proposal->isFragile())) + if (isWaitingForProposal() || isDisplayingProposal()) return; requestProposal(IdleEditor, Completion); diff --git a/src/plugins/texteditor/textdocument.cpp b/src/plugins/texteditor/textdocument.cpp index 6df2b7e35c0..1d1a47a8456 100644 --- a/src/plugins/texteditor/textdocument.cpp +++ b/src/plugins/texteditor/textdocument.cpp @@ -126,7 +126,8 @@ QTextCursor TextDocumentPrivate::indentOrUnindent(const QTextCursor &textCursor, QTextBlock startBlock = m_document.findBlock(start); QTextBlock endBlock = m_document.findBlock(blockSelection ? end : end - 1).next(); - + const bool cursorAtBlockStart = (textCursor.position() == startBlock.position()); + const bool anchorAtBlockStart = (textCursor.anchor() == startBlock.position()); const bool oneLinePartial = (startBlock.next() == endBlock) && (start > startBlock.position() || end < endBlock.position() - 1); @@ -146,6 +147,17 @@ QTextCursor TextDocumentPrivate::indentOrUnindent(const QTextCursor &textCursor, cursor.setPosition(block.position()); cursor.setPosition(block.position() + indentPosition, QTextCursor::KeepAnchor); cursor.removeSelectedText(); + } + // make sure that selection that begins in first column stays at first column + // even if we insert text at first column + if (cursorAtBlockStart) { + cursor = textCursor; + cursor.setPosition(startBlock.position(), QTextCursor::KeepAnchor); + } else if (anchorAtBlockStart) { + cursor = textCursor; + cursor.setPosition(startBlock.position(), QTextCursor::MoveAnchor); + cursor.setPosition(textCursor.position(), QTextCursor::KeepAnchor); + } else { modified = false; } } else if (cursor.hasSelection() && !blockSelection && oneLinePartial) { diff --git a/src/plugins/vcsbase/submiteditorfile.cpp b/src/plugins/vcsbase/submiteditorfile.cpp index 44bf91a884f..9136118bf7e 100644 --- a/src/plugins/vcsbase/submiteditorfile.cpp +++ b/src/plugins/vcsbase/submiteditorfile.cpp @@ -115,11 +115,3 @@ Core::IDocument::ReloadBehavior SubmitEditorFile::reloadBehavior(ChangeTrigger s Q_UNUSED(type) return BehaviorSilent; } - -bool SubmitEditorFile::reload(QString *errorString, ReloadFlag flag, ChangeType type) -{ - Q_UNUSED(errorString) - Q_UNUSED(flag) - Q_UNUSED(type) - return true; -} diff --git a/src/plugins/vcsbase/submiteditorfile.h b/src/plugins/vcsbase/submiteditorfile.h index 9fe7fa2238e..3961eecdda9 100644 --- a/src/plugins/vcsbase/submiteditorfile.h +++ b/src/plugins/vcsbase/submiteditorfile.h @@ -47,10 +47,8 @@ public: bool setContents(const QByteArray &contents) override; bool isModified() const override { return m_modified; } - bool isSaveAsAllowed() const override { return false; } bool save(QString *errorString, const QString &fileName, bool autoSave) override; ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override; - bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; void setModified(bool modified = true); diff --git a/src/plugins/welcome/images/blogs.png b/src/plugins/welcome/images/blogs.png Binary files differnew file mode 100644 index 00000000000..4e0bf112f32 --- /dev/null +++ b/src/plugins/welcome/images/blogs.png diff --git a/src/plugins/welcome/images/blogs@2x.png b/src/plugins/welcome/images/blogs@2x.png Binary files differnew file mode 100644 index 00000000000..48c93a9253f --- /dev/null +++ b/src/plugins/welcome/images/blogs@2x.png diff --git a/src/plugins/welcome/images/community.png b/src/plugins/welcome/images/community.png Binary files differnew file mode 100644 index 00000000000..865a21a7ce4 --- /dev/null +++ b/src/plugins/welcome/images/community.png diff --git a/src/plugins/welcome/images/community@2x.png b/src/plugins/welcome/images/community@2x.png Binary files differnew file mode 100644 index 00000000000..f632f3b9cba --- /dev/null +++ b/src/plugins/welcome/images/community@2x.png diff --git a/src/plugins/welcome/images/expandarrow.png b/src/plugins/welcome/images/expandarrow.png Binary files differnew file mode 100644 index 00000000000..1c80e4eaac4 --- /dev/null +++ b/src/plugins/welcome/images/expandarrow.png diff --git a/src/plugins/welcome/images/expandarrow@2x.png b/src/plugins/welcome/images/expandarrow@2x.png Binary files differnew file mode 100644 index 00000000000..30b7d23aed7 --- /dev/null +++ b/src/plugins/welcome/images/expandarrow@2x.png diff --git a/src/plugins/welcome/images/new.png b/src/plugins/welcome/images/new.png Binary files differnew file mode 100644 index 00000000000..80ccee5d7b0 --- /dev/null +++ b/src/plugins/welcome/images/new.png diff --git a/src/plugins/welcome/images/new@2x.png b/src/plugins/welcome/images/new@2x.png Binary files differnew file mode 100644 index 00000000000..3fca87e14c7 --- /dev/null +++ b/src/plugins/welcome/images/new@2x.png diff --git a/src/plugins/welcome/images/open.png b/src/plugins/welcome/images/open.png Binary files differnew file mode 100644 index 00000000000..938f1a33321 --- /dev/null +++ b/src/plugins/welcome/images/open.png diff --git a/src/plugins/welcome/images/open@2x.png b/src/plugins/welcome/images/open@2x.png Binary files differnew file mode 100644 index 00000000000..d0cfd255591 --- /dev/null +++ b/src/plugins/welcome/images/open@2x.png diff --git a/src/plugins/welcome/images/project.png b/src/plugins/welcome/images/project.png Binary files differnew file mode 100644 index 00000000000..1fd5370e7e5 --- /dev/null +++ b/src/plugins/welcome/images/project.png diff --git a/src/plugins/welcome/images/project@2x.png b/src/plugins/welcome/images/project@2x.png Binary files differnew file mode 100644 index 00000000000..df357dfa95f --- /dev/null +++ b/src/plugins/welcome/images/project@2x.png diff --git a/src/plugins/welcome/images/qtaccount.png b/src/plugins/welcome/images/qtaccount.png Binary files differnew file mode 100644 index 00000000000..40eb4a5f104 --- /dev/null +++ b/src/plugins/welcome/images/qtaccount.png diff --git a/src/plugins/welcome/images/qtaccount@2x.png b/src/plugins/welcome/images/qtaccount@2x.png Binary files differnew file mode 100644 index 00000000000..96693c81953 --- /dev/null +++ b/src/plugins/welcome/images/qtaccount@2x.png diff --git a/src/plugins/welcome/images/session.png b/src/plugins/welcome/images/session.png Binary files differnew file mode 100644 index 00000000000..7a1e2c51d25 --- /dev/null +++ b/src/plugins/welcome/images/session.png diff --git a/src/plugins/welcome/images/session@2x.png b/src/plugins/welcome/images/session@2x.png Binary files differnew file mode 100644 index 00000000000..d146a1a3e9c --- /dev/null +++ b/src/plugins/welcome/images/session@2x.png diff --git a/src/plugins/welcome/images/userguide.png b/src/plugins/welcome/images/userguide.png Binary files differnew file mode 100644 index 00000000000..e23a4c89189 --- /dev/null +++ b/src/plugins/welcome/images/userguide.png diff --git a/src/plugins/welcome/images/userguide@2x.png b/src/plugins/welcome/images/userguide@2x.png Binary files differnew file mode 100644 index 00000000000..709e79d5a1f --- /dev/null +++ b/src/plugins/welcome/images/userguide@2x.png diff --git a/src/plugins/welcome/welcome.qrc b/src/plugins/welcome/welcome.qrc index 3d8bff335f2..5321c6ebd46 100644 --- a/src/plugins/welcome/welcome.qrc +++ b/src/plugins/welcome/welcome.qrc @@ -4,5 +4,24 @@ <file>images/mode_welcome@2x.png</file> <file>images/mode_welcome_mask.png</file> <file>images/mode_welcome_mask@2x.png</file> + <file>images/blogs.png</file> + <file>images/blogs@2x.png</file> + <file>images/community.png</file> + <file>images/community@2x.png</file> + <file>images/mode_edit_mask.png</file> + <file>images/open.png</file> + <file>images/open@2x.png</file> + <file>images/project.png</file> + <file>images/project@2x.png</file> + <file>images/qtaccount.png</file> + <file>images/qtaccount@2x.png</file> + <file>images/session.png</file> + <file>images/session@2x.png</file> + <file>images/userguide.png</file> + <file>images/userguide@2x.png</file> + <file>images/new.png</file> + <file>images/new@2x.png</file> + <file>images/expandarrow.png</file> + <file>images/expandarrow@2x.png</file> </qresource> </RCC> diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 3fd58e08cd7..43f3df93527 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -48,6 +48,7 @@ #include <QDir> #include <QQmlPropertyMap> +#include <QQuickImageProvider> #ifdef USE_QUICK_WIDGET #include <QtQuickWidgets/QQuickWidget> @@ -82,6 +83,44 @@ static QString resourcePath() return FileUtils::normalizePathName(ICore::resourcePath()); } +class WelcomeImageIconProvider : public QQuickImageProvider +{ +public: + WelcomeImageIconProvider() + : QQuickImageProvider(Pixmap) + { + } + + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override + { + Q_UNUSED(requestedSize) + + QString maskFile; + Theme::Color themeColor = Theme::Welcome_ForegroundPrimaryColor; + + const QStringList elements = id.split(QLatin1Char('/')); + + if (!elements.empty()) + maskFile = elements.first(); + + if (elements.count() >= 2) { + const static QMetaObject &m = Theme::staticMetaObject; + const static QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color")); + bool success = false; + int value = e.keyToValue(elements.at(1).toLatin1(), &success); + if (success) + themeColor = Theme::Color(value); + } + + const QString fileName = QString::fromLatin1(":/welcome/images/%1.png").arg(maskFile); + const Icon icon({{fileName, themeColor}}, Icon::Tint); + const QPixmap result = icon.pixmap(); + if (size) + *size = result.size(); + return result; + } +}; + class WelcomeMode : public IMode { Q_OBJECT @@ -202,6 +241,7 @@ void WelcomeMode::facilitateQml(QQmlEngine *engine) QStringList importPathList = engine->importPathList(); importPathList << resourcePath() + QLatin1String("/welcomescreen"); engine->setImportPathList(importPathList); + engine->addImageProvider(QLatin1String("icons"), new WelcomeImageIconProvider); if (!debug) engine->setOutputWarningsToStandardError(false); diff --git a/src/plugins/winrt/winrtdebugsupport.cpp b/src/plugins/winrt/winrtdebugsupport.cpp index 8c7ed9ec80d..338e711cdb8 100644 --- a/src/plugins/winrt/winrtdebugsupport.cpp +++ b/src/plugins/winrt/winrtdebugsupport.cpp @@ -108,7 +108,7 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC quint16 qmlDebugPort = 0; if (!getFreePort(qmlDebugPort, errorMessage)) return 0; - params.qmlServerAddress = QHostAddress::LocalHost; + params.qmlServerAddress = QHostAddress(QHostAddress::LocalHost).toString(); params.qmlServerPort = qmlDebugPort; } diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index b76bade9283..3d8f28d721f 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -855,7 +855,8 @@ id="layer1" style="display:inline"> <g - id="src/plugins/coreplugin/images/dir"> + id="src/plugins/coreplugin/images/dir" + transform="translate(102,0)"> <path sodipodi:nodetypes="ccccccccc" inkscape:connector-curvature="0" @@ -883,7 +884,8 @@ y="584" /> </g> <g - id="src/plugins/coreplugin/images/progressbar"> + id="src/plugins/coreplugin/images/progressbar" + transform="translate(96,0)"> <rect ry="1" y="588.5" @@ -937,118 +939,6 @@ style="fill:none" /> </g> <g - id="share/qtcreator/welcomescreen/widgets/images/info"> - <circle - r="7" - cy="592" - cx="193" - id="path4146" - style="opacity:1;fill:#4a64b8;fill-opacity:1;stroke:none;stroke-width:14.46399975;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <path - sodipodi:nodetypes="ccccccccccccccc" - inkscape:connector-curvature="0" - d="m 191,591 3,0 0,4 0.5,0 0,1 -3,0 0,-1 0.5,0 0,-3 -1,0 m 1,-4 2,0 0,2 -2,0 z" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" - id="path4177" /> - <rect - id="rect5013" - width="16" - height="16" - x="185" - y="584" - style="fill:none" /> - </g> - <g - id="share/qtcreator/welcomescreen/widgets/images/icons/rename"> - <circle - style="opacity:1;fill:#e0a714;fill-opacity:1;stroke:none;stroke-width:14.46399975;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - id="circle4169" - cx="209" - cy="592" - r="7" /> - <path - d="m 209.5,587 0,7.5 2.5,0 c 0.98613,-0.46967 1.03033,-3.46404 0,-4 l -2,0 m -3,2 -2,0 c -0.5,0.5 -0.5,1.5 0,2 l 2.5,0 0,-3 c -0.0352,-0.46696 -0.43419,-0.98656 -1,-1 l -2,0" - style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="path4991" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccccccc" /> - <rect - style="fill:none" - y="584" - x="201" - height="16" - width="16" - id="rect5018" /> - </g> - <g - id="share/qtcreator/welcomescreen/widgets/images/icons/delete"> - <circle - r="7" - cy="592" - cx="225" - id="circle4171" - style="opacity:1;fill:#ed471a;fill-opacity:1;stroke:none;stroke-width:14.46399975;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <path - d="m 222,589 1.5,0 1,-1 1,0 1,1 1.5,0 0,1 -6,0 z m 0.5,2 5,0 -0.5,5 -4,0 -0.5,-5" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="path4983" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccccccccc" /> - <rect - id="rect5020" - width="16" - height="16" - x="217" - y="584" - style="fill:none" /> - </g> - <g - id="share/qtcreator/welcomescreen/widgets/images/icons/clone"> - <circle - style="opacity:1;fill:#329ace;fill-opacity:1;stroke:none;stroke-width:14.46399975;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - id="circle4173" - cx="241" - cy="592" - r="7" /> - <path - d="m 243.5,591 0,5 m -2.5,-2.5 5,0 m -10,-3 5,0 m -2.5,-2.5 0,5" - style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="path5000" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccccc" /> - <rect - style="fill:none" - y="584" - x="233" - height="16" - width="16" - id="rect5022" /> - </g> - <g - id="share/qtcreator/welcomescreen/widgets/images/arrow_down"> - <path - sodipodi:nodetypes="ccc" - inkscape:connector-curvature="0" - id="path5074" - d="m 251.75,589.75 5.25,5.25 5.25,-5.25" - style="fill:none;fill-rule:evenodd;stroke:#666666;stroke-width:1.40999997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <rect - style="fill:none" - y="584" - x="249" - height="16" - width="16" - id="rect5076" /> - </g> - <use - x="0" - y="0" - xlink:href="#share/qtcreator/welcomescreen/widgets/images/arrow_down" - id="share/qtcreator/welcomescreen/widgets/images/arrow_up" - transform="matrix(1,0,0,-1,16,1184)" - width="100%" - height="100%" /> - <g id="src/libs/utils/images/progressindicator_small" clip-path="url(#clipPath4556)" transform="matrix(-1,0,0,1,578,0)"> @@ -3268,6 +3158,173 @@ d="m 52,564 c 8,-8 8,-8 8,-8" style="fill:none;stroke:#000000;stroke-width:1.42;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1.0;stroke-dasharray:none" /> </g> + <g + transform="translate(-34,374)" + id="src/plugins/welcome/images/new"> + <rect + id="rect4886-1-4" + height="16" + width="16" + y="209.99899" + x="50" + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" /> + <rect + id="rect4922-3" + height="16" + width="2" + y="210" + x="57" + style="fill:#000000;fill-opacity:1" /> + <rect + id="rect4924-6" + height="2" + width="16" + y="217" + x="50" + style="fill:#000000;fill-opacity:1" /> + </g> + <g + transform="translate(-68,374)" + id="src/plugins/welcome/images/open"> + <rect + id="rect4886-1-5" + height="16" + width="16" + y="210" + x="100" + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" /> + <polygon + id="polygon4927-6" + points="102,220 102,215 114.637,215 115,213 108,213 106,211 100,211 100,220 100,224 101,224 102,224 104,224 113,224 116,217 104,217 102.715,220 " + style="fill:#000000;fill-opacity:1" /> + </g> + <g + transform="translate(-202,374)" + id="src/plugins/welcome/images/session"> + <rect + id="rect4886-1-1" + height="16" + width="16" + y="210" + x="250" + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" /> + <path + id="path4942-1" + d="m 252,212 0,12 12,0 0,-12 -12,0 z m 4,10 0,-8 5,3.999 -5,4.001 z" + inkscape:connector-curvature="0" + style="fill:#000000;fill-opacity:1" /> + </g> + <g + transform="translate(-86,374)" + id="src/plugins/welcome/images/expandarrow"> + <rect + id="rect4961-9" + height="16" + width="16" + y="210" + x="150" + style="fill:#ffffff;fill-opacity:1" /> + <polygon + id="polygon4959-0" + points="162,215 158,220 154,215 " + style="fill:#000000;fill-opacity:1" + transform="translate(0,1)" /> + </g> + <g + transform="translate(-220,374)" + id="src/plugins/welcome/images/project"> + <rect + id="rect4950-8" + height="16" + width="16" + y="210" + x="300" + style="fill:#ffffff;fill-opacity:1" /> + <polygon + id="polygon4948-6" + points="308,215 314,215 314,223 302,223 302,213 306,213 " + style="fill:#000000;fill-opacity:1" /> + </g> + <g + transform="translate(46,324)" + id="src/plugins/welcome/images/qtaccount"> + <rect + id="rect4886-1" + height="16" + width="16" + y="260" + x="50" + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" /> + <path + sodipodi:nodetypes="csscsccscccsc" + style="fill:#000000;fill-opacity:1" + inkscape:connector-curvature="0" + d="m 60.447,269.795 c -0.207,-0.04 -0.431,-0.726 0,-1.363 0.521,-0.77 1.225,-2.879 1.225,-4.146 0,-2.366 -1.645,-4.284 -3.672,-4.285 -2.027,0.001 -3.672,1.919 -3.672,4.285 0,1.268 0.701,3.377 1.225,4.146 0.43,0.638 0.206,1.323 0,1.363 -3.284,0.648 -5.053,1.389 -5.053,3.408 l 0,1.798 7.5,0 7.5,0 0,-1.798 c 0,-2.019 -1.77,-2.76 -5.053,-3.408 z" + id="path4884-6" /> + </g> + <g + transform="translate(-38,324)" + id="src/plugins/welcome/images/blogs"> + <rect + id="rect4904-3" + height="16" + width="16" + y="260" + x="150" + style="fill:#ffffff;fill-opacity:1" /> + <ellipse + style="fill:#000000;fill-opacity:1" + cx="151.74353" + cy="274.25867" + id="circle4896-4" + rx="1.7435256" + ry="1.7418367" /> + <path + id="path4900-5" + d="m 150.00001,260.001 0,3.65466 c 7.11422,0.007 12.3428,5.23401 12.3428,12.34434 l 3.6572,10e-4 c 0,-8.83117 -7.16227,-15.993 -16,-16 z" + inkscape:connector-curvature="0" + style="fill:#000000;fill-opacity:1" + sodipodi:nodetypes="ccccc" /> + <path + id="path4902-7" + d="m 150.5665,266.32241 c -0.18916,0 -0.37933,0.008 -0.56649,0.02 l 0,3.38368 c 0.18616,-0.017 0.37532,-0.027 0.56649,-0.027 3.3119,0 5.72701,2.41277 5.72701,5.72146 0,0.19599 -0.011,0.38897 -0.028,0.57995 l 3.38696,0 c 0.012,-0.19198 0.02,-0.38496 0.02,-0.57995 0,-5.02452 -4.07657,-9.09814 -9.10597,-9.09814 z" + inkscape:connector-curvature="0" + style="fill:#000000;fill-opacity:1" /> + </g> + <g + transform="translate(-72,324)" + id="src/plugins/welcome/images/community"> + <rect + id="rect4909-9" + height="16" + width="16" + y="260" + x="200" + style="fill:#ffffff;fill-opacity:1" /> + <path + id="path4907-4" + d="m 211.523,260 -11.523,0 0,13 6,0 0,3 4.537,-3 5.463,0 0,-7.331 C 216,262.563 214.5,260 211.523,260 Z" + inkscape:connector-curvature="0" + style="fill:#000000;fill-opacity:1" + sodipodi:nodetypes="sccccccss" /> + </g> + <g + id="src/plugins/welcome/images/userguide" + transform="translate(16,0)"> + <rect + style="fill:#ffffff;fill-opacity:1" + x="128" + y="584" + width="16" + height="16" + id="rect4909-9-8" /> + <path + sodipodi:nodetypes="ssssscssccscsssccscccccsccssscccscsccccscsscccc" + inkscape:connector-curvature="0" + d="m 136,584 c -4.4176,0 -8,3.5824 -8,8 0,4.4176 3.5824,8 8,8 4.4176,0 8,-3.5824 8,-8 0,-4.4176 -3.5824,-8 -8,-8 z m 0.76817,12.9456 c -0.2192,0.2152 -0.4832,0.3216 -0.7912,0.3216 -0.1496,0 -0.2912,-0.028 -0.4264,-0.084 -0.1352,-0.056 -0.2544,-0.1304 -0.3568,-0.224 -0.1032,-0.0936 -0.184,-0.2056 -0.2456,-0.336 -0.0608,-0.1304 -0.0904,-0.2704 -0.0904,-0.42 0,-0.2984 0.1096,-0.5552 0.3288,-0.7696 0.2184,-0.2144 0.4824,-0.3216 0.7904,-0.3216 0.2992,0 0.56,0.1024 0.784,0.308 0.224,0.2056 0.336,0.4576 0.336,0.756 0,0.2976 -0.1104,0.5544 -0.3288,0.7696 z m 2.1904,-6.384 c -0.0832,0.2336 -0.196,0.448 -0.336,0.644 -0.14,0.196 -0.3008,0.3832 -0.4832,0.56 -0.1824,0.1776 -0.376,0.364 -0.5816,0.56 -0.1304,0.1208 -0.2424,0.2288 -0.336,0.3216 -0.0928,0.0936 -0.1704,0.1888 -0.2304,0.2872 -0.0608,0.0976 -0.1056,0.2096 -0.1336,0.336 -0.0272,0.1256 -0.0416,0.2776 -0.0416,0.4552 l 0,0.27418 -1.6808,0 0,-0.51178 c 0,-0.2048 0.012,-0.38 0.0352,-0.5248 0.0232,-0.1448 0.0648,-0.2752 0.1256,-0.392 0.0608,-0.1168 0.14,-0.2288 0.2384,-0.336 0.0976,-0.1072 0.2168,-0.236 0.3568,-0.3848 l 1.0784,-1.092 c 0.2328,-0.2336 0.3504,-0.536 0.3504,-0.9096 0,-0.364 -0.1192,-0.66 -0.3568,-0.8888 -0.2384,-0.2288 -0.5392,-0.3432 -0.9032,-0.3432 -0.392,0 -0.7144,0.1328 -0.9664,0.3992 -0.2512,0.2664 -0.396,0.5904 -0.4336,0.9728 l -1.792,-0.14 c 0.056,-0.448 0.1728,-0.8472 0.3504,-1.1968 0.1776,-0.3504 0.4088,-0.6464 0.6928,-0.8888 0.284,-0.2424 0.6144,-0.4272 0.9872,-0.5528 0.3728,-0.1264 0.7832,-0.1888 1.232,-0.1888 0.4192,0 0.8096,0.0608 1.1688,0.1824 0.3592,0.1216 0.672,0.2968 0.9376,0.5248 0.2664,0.2288 0.4744,0.5136 0.6232,0.8536 0.1488,0.3408 0.224,0.7304 0.224,1.1688 8e-4,0.3056 -0.0416,0.5768 -0.1256,0.8104 z" + id="path5457-0-5" + style="display:inline" /> + </g> </g> <g inkscape:groupmode="layer" diff --git a/tests/auto/debugger/offsets.pro b/tests/auto/debugger/offsets.pro index b021596f0e4..f3eef5c31a0 100644 --- a/tests/auto/debugger/offsets.pro +++ b/tests/auto/debugger/offsets.pro @@ -3,8 +3,6 @@ include(../qttest.pri) QT += core-private -CONFIG -= c++11 # Fails to build with boost (due to #define private public) - exists(/usr/include/boost/unordered/unordered_set.hpp) { DEFINES += HAS_BOOST } diff --git a/tests/auto/debugger/tst_offsets.cpp b/tests/auto/debugger/tst_offsets.cpp index 5542712f210..545a7df5a7d 100644 --- a/tests/auto/debugger/tst_offsets.cpp +++ b/tests/auto/debugger/tst_offsets.cpp @@ -25,6 +25,18 @@ #include <QtTest> +#ifdef HAS_BOOST +#include <boost/version.hpp> +#if BOOST_VERSION >= (1 * 100000 + 54 * 100) +#ifdef Q_CC_CLANG +#pragma clang diagnostic ignored "-Wunused-local-typedef" +#endif +#include <boost/unordered/unordered_set.hpp> +#else +#undef HAS_BOOST +#endif +#endif + // Don't do this at home. This is test code, not production. #define protected public #define private public @@ -35,8 +47,26 @@ #include <private/qobject_p.h> #ifdef HAS_BOOST -#include <boost/version.hpp> -#include <boost/unordered/unordered_set.hpp> +namespace { +// Based on http://bloglitb.blogspot.com/2011/12/access-to-private-members-safer.html +template<typename Tag, typename Tag::type M> +struct Rob { + friend typename Tag::type get(Tag) { + return M; + } +}; + +typedef boost::unordered_set<int> uset; +typedef boost::unordered::detail::set<uset::allocator_type, uset::key_type, + uset::hasher, uset::key_equal> uset_types; + +struct Table { + typedef uset_types::table uset::*type; + friend type get(Table); +}; + +template struct Rob<Table, &uset::table_>; +} // anon namespace #endif class tst_offsets : public QObject @@ -219,19 +249,18 @@ void tst_offsets::offsets_data() } #ifdef HAS_BOOST -#if BOOST_VERSION >= (1 * 100000 + 54 * 100) { boost::unordered::unordered_set<int> *p = 0; + auto &table = p->*get(Table()); QTest::newRow("boost::unordered::unordered_set::size") - << int((char *)&p->table_.size_ - (char *)p) << 8 << 16; + << int((char *)&table.size_ - (char *)p) << 8 << 16; QTest::newRow("boost::unordered::unordered_set::bucket_count") - << int((char *)&p->table_.bucket_count_ - (char *)p) << 4 << 8; + << int((char *)&table.bucket_count_ - (char *)p) << 4 << 8; QTest::newRow("boost::unordered::unordered_set::buckets_") - << int((char *)&p->table_.buckets_ - (char *)p) << 20 << 40; + << int((char *)&table.buckets_ - (char *)p) << 20 << 40; } #endif -#endif } diff --git a/tests/auto/timeline/timelineabstractrenderer/tst_timelineabstractrenderer.cpp b/tests/auto/timeline/timelineabstractrenderer/tst_timelineabstractrenderer.cpp index c1d66f9f3fa..10453ffcffe 100644 --- a/tests/auto/timeline/timelineabstractrenderer/tst_timelineabstractrenderer.cpp +++ b/tests/auto/timeline/timelineabstractrenderer/tst_timelineabstractrenderer.cpp @@ -85,7 +85,7 @@ void tst_TimelineAbstractRenderer::model() QSignalSpy spy(&renderer, SIGNAL(modelChanged(TimelineModel*))); QVERIFY(!renderer.modelDirty()); QCOMPARE(spy.count(), 0); - TimelineModel model(0, QLatin1String("model")); + TimelineModel model(0); QCOMPARE(renderer.model(), static_cast<TimelineModel *>(0)); renderer.setModel(&model); QVERIFY(renderer.modelDirty()); diff --git a/tests/auto/timeline/timelineitemsrenderpass/timelineitemsrenderpass.qbs b/tests/auto/timeline/timelineitemsrenderpass/timelineitemsrenderpass.qbs index 3a70ab857cd..3e2eef8e29f 100644 --- a/tests/auto/timeline/timelineitemsrenderpass/timelineitemsrenderpass.qbs +++ b/tests/auto/timeline/timelineitemsrenderpass/timelineitemsrenderpass.qbs @@ -3,7 +3,6 @@ import QtcFunctions import "../timelineautotest.qbs" as TimelineAutotest TimelineAutotest { - condition: QtcFunctions.versionIsAtLeast(Qt.core.version, "5.4") name: "TimelineItemsRenderPass autotest" Group { name: "Test sources" diff --git a/tests/auto/timeline/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp b/tests/auto/timeline/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp index 9051161fbca..609d2e95b4f 100644 --- a/tests/auto/timeline/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp +++ b/tests/auto/timeline/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp @@ -49,7 +49,7 @@ private slots: void update(); }; -DummyModel::DummyModel() : TimelineModel(12, QLatin1String("dings")) +DummyModel::DummyModel() : TimelineModel(12) { } diff --git a/tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp b/tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp index 892e59aaef8..49a56e6a83c 100644 --- a/tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp +++ b/tests/auto/timeline/timelinemodel/tst_timelinemodel.cpp @@ -33,8 +33,7 @@ static const qint64 ItemSpacing = 1 << 20; class DummyModelPrivate : public Timeline::TimelineModel::TimelineModelPrivate { public: - DummyModelPrivate(int modelId) : - Timeline::TimelineModel::TimelineModelPrivate(modelId, QLatin1String("horst")) + DummyModelPrivate(int modelId) : Timeline::TimelineModel::TimelineModelPrivate(modelId) {} }; @@ -92,8 +91,9 @@ DummyModel::DummyModel(int modelId) : } DummyModel::DummyModel(QString displayName, QObject *parent) : - TimelineModel(12, displayName, parent) + TimelineModel(12, parent) { + setDisplayName(displayName); } void DummyModel::loadData() @@ -353,12 +353,21 @@ void tst_TimelineModel::displayName() { QLatin1String name("testest"); DummyModel dummy(name); + QSignalSpy spy(&dummy, SIGNAL(displayNameChanged())); QCOMPARE(dummy.displayName(), name); + QCOMPARE(spy.count(), 0); + dummy.setDisplayName(name); + QCOMPARE(dummy.displayName(), name); + QCOMPARE(spy.count(), 0); + name = QLatin1String("testerei"); + dummy.setDisplayName(name); + QCOMPARE(dummy.displayName(), name); + QCOMPARE(spy.count(), 1); } void tst_TimelineModel::defaultValues() { - Timeline::TimelineModel dummy(12, QLatin1String("dings")); + Timeline::TimelineModel dummy(12); QCOMPARE(dummy.location(0), QVariantMap()); QCOMPARE(dummy.handlesTypeId(0), false); QCOMPARE(dummy.selectionIdForLocation(QString(), 0, 0), -1); diff --git a/tests/auto/timeline/timelinemodelaggregator/tst_timelinemodelaggregator.cpp b/tests/auto/timeline/timelinemodelaggregator/tst_timelinemodelaggregator.cpp index 2d8babe7d54..5776e387522 100644 --- a/tests/auto/timeline/timelinemodelaggregator/tst_timelinemodelaggregator.cpp +++ b/tests/auto/timeline/timelinemodelaggregator/tst_timelinemodelaggregator.cpp @@ -38,7 +38,7 @@ private slots: class HeightTestModel : public Timeline::TimelineModel { public: - HeightTestModel() : TimelineModel(2, QString()) + HeightTestModel() : TimelineModel(2) { insert(0, 1, 1); } @@ -50,7 +50,7 @@ void tst_TimelineModelAggregator::height() QCOMPARE(aggregator.height(), 0); QSignalSpy heightSpy(&aggregator, SIGNAL(heightChanged())); - Timeline::TimelineModel *model = new Timeline::TimelineModel(25, QString()); + Timeline::TimelineModel *model = new Timeline::TimelineModel(25); aggregator.addModel(model); QCOMPARE(aggregator.height(), 0); QCOMPARE(heightSpy.count(), 0); @@ -70,8 +70,8 @@ void tst_TimelineModelAggregator::addRemoveModel() QCOMPARE(aggregator.notes(), ¬es); - Timeline::TimelineModel *model1 = new Timeline::TimelineModel(25, QString()); - Timeline::TimelineModel *model2 = new Timeline::TimelineModel(26, QString()); + Timeline::TimelineModel *model1 = new Timeline::TimelineModel(25); + Timeline::TimelineModel *model2 = new Timeline::TimelineModel(26); aggregator.addModel(model1); QCOMPARE(spy.count(), 1); QCOMPARE(aggregator.modelCount(), 1); @@ -99,7 +99,7 @@ void tst_TimelineModelAggregator::addRemoveModel() class PrevNextTestModel : public Timeline::TimelineModel { public: - PrevNextTestModel(int x) : TimelineModel(x, QString()) + PrevNextTestModel(int x) : TimelineModel(x) { for (int i = 0; i < 20; ++i) insert(i + x, i * x, x); @@ -114,7 +114,7 @@ void tst_TimelineModelAggregator::prevNext() aggregator.addModel(new PrevNextTestModel(3)); // Add an empty model to trigger the special code paths that skip it - aggregator.addModel(new Timeline::TimelineModel(4, QString())); + aggregator.addModel(new Timeline::TimelineModel(4)); QLatin1String item("item"); QLatin1String model("model"); QVariantMap result; diff --git a/tests/auto/timeline/timelinenotesmodel/tst_timelinenotesmodel.cpp b/tests/auto/timeline/timelinenotesmodel/tst_timelinenotesmodel.cpp index 27cf3c1ddcd..df0f977cdee 100644 --- a/tests/auto/timeline/timelinenotesmodel/tst_timelinenotesmodel.cpp +++ b/tests/auto/timeline/timelinenotesmodel/tst_timelinenotesmodel.cpp @@ -41,7 +41,7 @@ private slots: class TestModel : public Timeline::TimelineModel { public: - TestModel(int modelId = 10) : TimelineModel(modelId, QString()) + TestModel(int modelId = 10) : TimelineModel(modelId) { insert(0, 10, 10); } diff --git a/tests/auto/timeline/timelinenotesrenderpass/timelinenotesrenderpass.qbs b/tests/auto/timeline/timelinenotesrenderpass/timelinenotesrenderpass.qbs index 2e8d34c9a3e..4f3c25e758f 100644 --- a/tests/auto/timeline/timelinenotesrenderpass/timelinenotesrenderpass.qbs +++ b/tests/auto/timeline/timelinenotesrenderpass/timelinenotesrenderpass.qbs @@ -3,7 +3,6 @@ import QtcFunctions import "../timelineautotest.qbs" as TimelineAutotest TimelineAutotest { - condition: QtcFunctions.versionIsAtLeast(Qt.core.version, "5.4") name: "TimelineNotesRenderPass autotest" Group { name: "Test sources" diff --git a/tests/auto/timeline/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp b/tests/auto/timeline/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp index db46cff7967..e7b56b52346 100644 --- a/tests/auto/timeline/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp +++ b/tests/auto/timeline/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp @@ -49,7 +49,7 @@ private slots: void update(); }; -DummyModel::DummyModel(int id) : TimelineModel(id, QLatin1String("dings")) +DummyModel::DummyModel(int id) : TimelineModel(id) { } diff --git a/tests/auto/timeline/timelineoverviewrenderer/tst_timelineoverviewrenderer.cpp b/tests/auto/timeline/timelineoverviewrenderer/tst_timelineoverviewrenderer.cpp index 72d1c12427e..2e0484bcb9c 100644 --- a/tests/auto/timeline/timelineoverviewrenderer/tst_timelineoverviewrenderer.cpp +++ b/tests/auto/timeline/timelineoverviewrenderer/tst_timelineoverviewrenderer.cpp @@ -34,7 +34,7 @@ class DummyRenderer : public TimelineOverviewRenderer { class DummyModel : public TimelineModel { public: - DummyModel() : TimelineModel(0, QLatin1String("x")) {} + DummyModel() : TimelineModel(0) {} void loadData() { diff --git a/tests/auto/timeline/timelinerenderer/tst_timelinerenderer.cpp b/tests/auto/timeline/timelinerenderer/tst_timelinerenderer.cpp index 5904887b89f..6087483fec3 100644 --- a/tests/auto/timeline/timelinerenderer/tst_timelinerenderer.cpp +++ b/tests/auto/timeline/timelinerenderer/tst_timelinerenderer.cpp @@ -34,7 +34,7 @@ class DummyRenderer : public TimelineRenderer { class DummyModel : public TimelineModel { public: - DummyModel() : TimelineModel(0, QLatin1String("x")) {} + DummyModel() : TimelineModel(0) {} void loadData() { diff --git a/tests/auto/timeline/timelinerenderstate/tst_timelinerenderstate.cpp b/tests/auto/timeline/timelinerenderstate/tst_timelinerenderstate.cpp index c87faf9b464..647c7f32e42 100644 --- a/tests/auto/timeline/timelinerenderstate/tst_timelinerenderstate.cpp +++ b/tests/auto/timeline/timelinerenderstate/tst_timelinerenderstate.cpp @@ -140,7 +140,7 @@ void tst_TimelineRenderState::emptyRoots() void tst_TimelineRenderState::assembleNodeTree() { - TimelineModel model(3, QString()); + TimelineModel model(3); TimelineRenderState state1(1, 2, 0.5, 3); state1.assembleNodeTree(&model, 30, 30); QSGTransformNode *node = state1.finalize(0, true, QMatrix4x4()); diff --git a/tests/auto/timeline/timelineselectionrenderpass/timelineselectionrenderpass.qbs b/tests/auto/timeline/timelineselectionrenderpass/timelineselectionrenderpass.qbs index 25561801dd6..d600da3b2ca 100644 --- a/tests/auto/timeline/timelineselectionrenderpass/timelineselectionrenderpass.qbs +++ b/tests/auto/timeline/timelineselectionrenderpass/timelineselectionrenderpass.qbs @@ -3,7 +3,6 @@ import QtcFunctions import "../timelineautotest.qbs" as TimelineAutotest TimelineAutotest { - condition: QtcFunctions.versionIsAtLeast(Qt.core.version, "5.4") name: "TimelineSelectionRenderPass autotest" Group { name: "Test sources" diff --git a/tests/auto/timeline/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp b/tests/auto/timeline/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp index 78c0a1a9f40..4acb2ec7656 100644 --- a/tests/auto/timeline/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp +++ b/tests/auto/timeline/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp @@ -52,7 +52,7 @@ private slots: void update(); }; -DummyModel::DummyModel(int id) : TimelineModel(id, QLatin1String("dings")) +DummyModel::DummyModel(int id) : TimelineModel(id) { } diff --git a/tests/system/suite_tools/tst_git_clone/test.py b/tests/system/suite_tools/tst_git_clone/test.py index bb941c473f0..21ce9ba6bbb 100644 --- a/tests/system/suite_tools/tst_git_clone/test.py +++ b/tests/system/suite_tools/tst_git_clone/test.py @@ -76,7 +76,7 @@ def verifyVersionControlView(targetDir, canceled): def verifyFiles(targetDir): for file in [".gitignore", "CMakeLists.txt", "jom.pro", - os.path.join("bin", "ibjom.cmd"), + os.path.join("bin", "ibjom.bat"), os.path.join("src", "app", "main.cpp")]: test.verify(os.path.exists(os.path.join(targetDir, cloneDir, file)), "Verify the existence of %s" % file) |