diff --git a/src/libs/timeline/qml/ButtonsBar.qml b/src/libs/timeline/qml/ButtonsBar.qml index 2da1f4e2b85..f1512e06a1d 100644 --- a/src/libs/timeline/qml/ButtonsBar.qml +++ b/src/libs/timeline/qml/ButtonsBar.qml @@ -30,7 +30,6 @@ import QtQuick.Controls.Styles 1.2 ToolBar { id: buttons - readonly property int buttonWidth: 30 signal jumpToPrev() signal jumpToNext() @@ -63,7 +62,7 @@ ToolBar { } background: Rectangle { anchors.fill: parent - color: "#9B9B9B" + color: creatorTheme.PanelStatusBarBackgroundColor } } @@ -71,62 +70,56 @@ ToolBar { spacing: 0 anchors.fill: parent - ToolButton { + ImageToolButton { id: jumpToPrevButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: "qrc:/timeline/ico_prev.png" + imageSource: "image://icons/prev" tooltip: qsTr("Jump to previous event.") onClicked: buttons.jumpToPrev() } - ToolButton { + ImageToolButton { id: jumpToNextButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: "qrc:/timeline/ico_next.png" + imageSource: "image://icons/next" tooltip: qsTr("Jump to next event.") onClicked: buttons.jumpToNext() } - ToolButton { + ImageToolButton { id: zoomControlButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: "qrc:/timeline/ico_zoom.png" + imageSource: "image://icons/zoom" tooltip: qsTr("Show zoom slider.") checkable: true checked: false onCheckedChanged: buttons.zoomControlChanged() } - ToolButton { + ImageToolButton { id: rangeButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: checked ? "qrc:/timeline/ico_rangeselected.png" : - "qrc:/timeline/ico_rangeselection.png" + imageSource: "image://icons/" + (checked ? "rangeselected" : "rangeselection"); tooltip: qsTr("Select range.") checkable: true checked: false onCheckedChanged: buttons.rangeSelectChanged() } - ToolButton { + ImageToolButton { id: lockButton anchors.top: parent.top anchors.bottom: parent.bottom - implicitWidth: buttonWidth - iconSource: "qrc:/timeline/ico_selectionmode.png" + imageSource: "image://icons/selectionmode" tooltip: qsTr("View event information on mouseover.") checkable: true checked: false diff --git a/src/libs/timeline/qml/ImageToolButton.qml b/src/libs/timeline/qml/ImageToolButton.qml new file mode 100644 index 00000000000..8c0163785ca --- /dev/null +++ b/src/libs/timeline/qml/ImageToolButton.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** 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 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Styles 1.2 + +ToolButton { + implicitWidth: 30 + + property string imageSource + + Image { + source: parent.enabled ? parent.imageSource : parent.imageSource + "/disabled" + width: 16 + height: 16 + anchors.centerIn: parent + } + + style: ButtonStyle { + background: Rectangle { + color: (control.checked || control.pressed) + ? creatorTheme.FancyToolButtonSelectedColor + : control.hovered + ? creatorTheme.FancyToolButtonHoverColor + : "#00000000" + } + } +} diff --git a/src/libs/timeline/qml/ico_next.png b/src/libs/timeline/qml/ico_next.png deleted file mode 100644 index c8a3374fd73..00000000000 Binary files a/src/libs/timeline/qml/ico_next.png and /dev/null differ diff --git a/src/libs/timeline/qml/ico_prev.png b/src/libs/timeline/qml/ico_prev.png deleted file mode 100644 index 0adf50462be..00000000000 Binary files a/src/libs/timeline/qml/ico_prev.png and /dev/null differ diff --git a/src/libs/timeline/qml/ico_rangeselected.png b/src/libs/timeline/qml/ico_rangeselected.png index b1a9031843e..1d4e0284f9a 100644 Binary files a/src/libs/timeline/qml/ico_rangeselected.png and b/src/libs/timeline/qml/ico_rangeselected.png differ diff --git a/src/libs/timeline/qml/ico_rangeselected@2x.png b/src/libs/timeline/qml/ico_rangeselected@2x.png new file mode 100644 index 00000000000..d108be37e0a Binary files /dev/null and b/src/libs/timeline/qml/ico_rangeselected@2x.png differ diff --git a/src/libs/timeline/qml/ico_rangeselection.png b/src/libs/timeline/qml/ico_rangeselection.png index dbe47a94720..546bf8beccd 100644 Binary files a/src/libs/timeline/qml/ico_rangeselection.png and b/src/libs/timeline/qml/ico_rangeselection.png differ diff --git a/src/libs/timeline/qml/ico_rangeselection@2x.png b/src/libs/timeline/qml/ico_rangeselection@2x.png new file mode 100644 index 00000000000..9f200fe43a8 Binary files /dev/null and b/src/libs/timeline/qml/ico_rangeselection@2x.png differ diff --git a/src/libs/timeline/qml/ico_selectionmode.png b/src/libs/timeline/qml/ico_selectionmode.png index 41493905c28..fcf28531d0c 100644 Binary files a/src/libs/timeline/qml/ico_selectionmode.png and b/src/libs/timeline/qml/ico_selectionmode.png differ diff --git a/src/libs/timeline/qml/ico_selectionmode@2x.png b/src/libs/timeline/qml/ico_selectionmode@2x.png new file mode 100644 index 00000000000..b34991e0790 Binary files /dev/null and b/src/libs/timeline/qml/ico_selectionmode@2x.png differ diff --git a/src/libs/timeline/qml/ico_zoom.png b/src/libs/timeline/qml/ico_zoom.png deleted file mode 100644 index d33b5ea0f9d..00000000000 Binary files a/src/libs/timeline/qml/ico_zoom.png and /dev/null differ diff --git a/src/libs/timeline/qml/timeline.qrc b/src/libs/timeline/qml/timeline.qrc index 92b6eaf10df..5bd2e1b20f6 100644 --- a/src/libs/timeline/qml/timeline.qrc +++ b/src/libs/timeline/qml/timeline.qrc @@ -17,11 +17,11 @@ arrow_right.png range_handle.png ico_selectionmode.png - ico_zoom.png - ico_prev.png - ico_next.png + ico_selectionmode@2x.png ico_rangeselection.png + ico_rangeselection@2x.png ico_rangeselected.png + ico_rangeselected@2x.png ico_note.png ButtonsBar.qml timelineitems.vert @@ -33,5 +33,6 @@ RowLabel.qml SynchronousReloader.qml TimelineText.qml + ImageToolButton.qml diff --git a/src/libs/timeline/timeline.pro b/src/libs/timeline/timeline.pro index 4b556057588..39fa4f3124d 100644 --- a/src/libs/timeline/timeline.pro +++ b/src/libs/timeline/timeline.pro @@ -15,7 +15,8 @@ SOURCES += \ $$PWD/timelinerenderstate.cpp \ $$PWD/timelinenotesmodel.cpp \ $$PWD/timelineabstractrenderer.cpp \ - $$PWD/timelineoverviewrenderer.cpp + $$PWD/timelineoverviewrenderer.cpp \ + $$PWD/timelinetheme.cpp HEADERS += \ @@ -37,7 +38,8 @@ HEADERS += \ $$PWD/timelineabstractrenderer.h \ $$PWD/timelineabstractrenderer_p.h \ $$PWD/timelineoverviewrenderer_p.h \ - $$PWD/timelineoverviewrenderer.h + $$PWD/timelineoverviewrenderer.h \ + $$PWD/timelinetheme.h RESOURCES += \ $$PWD/qml/timeline.qrc diff --git a/src/libs/timeline/timelinetheme.cpp b/src/libs/timeline/timelinetheme.cpp new file mode 100644 index 00000000000..8731f2b5acc --- /dev/null +++ b/src/libs/timeline/timelinetheme.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** 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 "timelinetheme.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace Timeline { + +class TimelineImageIconProvider : public QQuickImageProvider +{ +public: + TimelineImageIconProvider() + : QQuickImageProvider(Pixmap) + { + } + + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override + { + Q_UNUSED(requestedSize) + + const QStringList idElements = id.split(QLatin1Char('/')); + + QTC_ASSERT(!idElements.isEmpty(), return QPixmap()); + const QString &iconName = idElements.first(); + const QIcon::Mode iconMode = (idElements.count() > 1 + && idElements.at(1) == QLatin1String("disabled")) + ? QIcon::Disabled : QIcon::Normal; + + Utils::Icon icon; + if (iconName == QLatin1String("prev")) + icon = Utils::Icons::PREV_TOOLBAR; + else if (iconName == QLatin1String("next")) + icon = Utils::Icons::NEXT_TOOLBAR; + else if (iconName == QLatin1String("zoom")) + icon = Utils::Icons::ZOOM_TOOLBAR; + else if (iconName == QLatin1String("rangeselection")) + icon = Utils::Icon({{QLatin1String(":/timeline/ico_rangeselection.png"), + Utils::Theme::IconsBaseColor}}); + else if (iconName == QLatin1String("rangeselected")) + icon = Utils::Icon({{QLatin1String(":/timeline/ico_rangeselected.png"), + Utils::Theme::IconsBaseColor}}); + else if (iconName == QLatin1String("selectionmode")) + icon = Utils::Icon({{QLatin1String(":/timeline/ico_selectionmode.png"), + Utils::Theme::IconsBaseColor}}); + + const QSize iconSize(16, 16); + const QPixmap result = icon.icon().pixmap(iconSize, iconMode); + + if (size) + *size = result.size(); + return result; + } +}; + +void TimelineTheme::setupTheme(QQmlEngine *engine) +{ + QQmlPropertyMap *themePropertyMap = new QQmlPropertyMap(engine); + const QVariantHash creatorTheme = Utils::creatorTheme()->values(); + for (auto it = creatorTheme.constBegin(); it != creatorTheme.constEnd(); ++it) + themePropertyMap->insert(it.key(), it.value()); + + engine->rootContext()->setContextProperty(QLatin1String("creatorTheme"), themePropertyMap); + + engine->addImageProvider(QLatin1String("icons"), new TimelineImageIconProvider); +} + +} // namespace Timeline diff --git a/src/libs/timeline/timelinetheme.h b/src/libs/timeline/timelinetheme.h new file mode 100644 index 00000000000..eb292ffc2f7 --- /dev/null +++ b/src/libs/timeline/timelinetheme.h @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** 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 "timeline_global.h" + +class QQmlEngine; + +namespace Timeline { + +class TIMELINE_EXPORT TimelineTheme { +public: + static void setupTheme(QQmlEngine* engine); +}; + +} // namespace Timeline diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index 7a90886cc56..e50c4d82947 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -46,6 +46,7 @@ #include "timeline/timelinemodelaggregator.h" #include "timeline/timelinerenderer.h" #include "timeline/timelineoverviewrenderer.h" +#include "timeline/timelinetheme.h" #include // Needed for the load&save actions in the context menu @@ -143,6 +144,8 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin setMinimumHeight(170); + Timeline::TimelineTheme::setupTheme(d->m_mainView->engine()); + d->m_mainView->rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"), d->m_modelProxy); d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"), diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index 91940b62aad..c8d9ee940d0 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -661,6 +661,17 @@ offset="1" id="stop5101" /> + + + + id="selectArrow" + transform="translate(4,0)" + inkscape:label="#g5932"> + + + + + + + + + + + + + + + + + + + + +