From 015ffe2835af7819a981e7e489a4fb83fec00cb9 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 17 Feb 2010 17:09:00 +0100 Subject: [PATCH] Some polish for the actionbar * I have simplified and animated the tool buttons a bit. * The panel has been replaced by a very basic clean panel. * The tool buttons have been animated. --- src/libs/utils/stylehelper.cpp | 80 ++++++++++++ src/libs/utils/stylehelper.h | 4 + src/plugins/coreplugin/coreconstants.h | 2 +- src/plugins/coreplugin/fancyactionbar.cpp | 117 ++++++++++++------ src/plugins/coreplugin/fancyactionbar.h | 23 ++++ src/plugins/coreplugin/images/mode_Debug.png | Bin 1926 -> 1963 bytes src/plugins/coreplugin/manhattanstyle.cpp | 75 +---------- .../projectexplorer/projectexplorer.cpp | 4 +- 8 files changed, 191 insertions(+), 114 deletions(-) diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 44cc5bfe880..887b3f201ef 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -35,6 +35,8 @@ #include #include #include +#include +#include // Clamps float color values within (0, 255) static int clamp(float x) @@ -247,6 +249,84 @@ static void menuGradientHelper(QPainter *p, const QRect &spanRect, const QRect & p->fillRect(rect, grad); } +void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option) +{ + // From windowsstyle but modified to enable AA + if (option->rect.width() <= 1 || option->rect.height() <= 1) + return; + + QRect r = option->rect; + int size = qMin(r.height(), r.width()); + QPixmap pixmap; + QString pixmapName; + pixmapName.sprintf("arrow-%s-%d-%d-%d-%lld", + "$qt_ia", + uint(option->state), element, + size, option->palette.cacheKey()); + if (!QPixmapCache::find(pixmapName, pixmap)) { + int border = size/5; + int sqsize = 2*(size/2); + QImage image(sqsize, sqsize, QImage::Format_ARGB32); + image.fill(Qt::transparent); + QPainter imagePainter(&image); + imagePainter.setRenderHint(QPainter::Antialiasing, true); + imagePainter.translate(0.5, 0.5); + QPolygon a; + switch (element) { + case QStyle::PE_IndicatorArrowUp: + a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2); + break; + case QStyle::PE_IndicatorArrowDown: + a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2); + break; + case QStyle::PE_IndicatorArrowRight: + a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); + break; + case QStyle::PE_IndicatorArrowLeft: + a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); + break; + default: + break; + } + + int bsx = 0; + int bsy = 0; + + if (option->state & QStyle::State_Sunken) { + bsx = qApp->style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal); + bsy = qApp->style()->pixelMetric(QStyle::PM_ButtonShiftVertical); + } + + QRect bounds = a.boundingRect(); + int sx = sqsize / 2 - bounds.center().x() - 1; + int sy = sqsize / 2 - bounds.center().y() - 1; + imagePainter.translate(sx + bsx, sy + bsy); + + if (!(option->state & QStyle::State_Enabled)) { + QColor foreGround(150, 150, 150, 150); + imagePainter.setBrush(option->palette.mid().color()); + imagePainter.setPen(option->palette.mid().color()); + } else { + QColor shadow(0, 0, 0, 100); + imagePainter.translate(0, 1); + imagePainter.setPen(shadow); + imagePainter.setBrush(shadow); + QColor foreGround(255, 255, 255, 210); + imagePainter.drawPolygon(a); + imagePainter.translate(0, -1); + imagePainter.setPen(foreGround); + imagePainter.setBrush(foreGround); + } + imagePainter.drawPolygon(a); + imagePainter.end(); + pixmap = QPixmap::fromImage(image); + QPixmapCache::insert(pixmapName, pixmap); + } + int xOffset = r.x() + (r.width() - size)/2; + int yOffset = r.y() + (r.height() - size)/2; + painter->drawPixmap(xOffset, yOffset, pixmap); +} + void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) { if (StyleHelper::usePixmapCache()) { diff --git a/src/libs/utils/stylehelper.h b/src/libs/utils/stylehelper.h index aff3ca5554d..10b47c9cf9e 100644 --- a/src/libs/utils/stylehelper.h +++ b/src/libs/utils/stylehelper.h @@ -33,6 +33,7 @@ #include "utils_global.h" #include +#include QT_BEGIN_NAMESPACE class QPalette; @@ -63,6 +64,9 @@ public: // Sets the base color and makes sure all top level widgets are updated static void setBaseColor(const QColor &color); + // Draws a shaded anti-aliased arrow + static void drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option); + // Gradients used for panels static void horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false); static void verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false); diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index 0b95a671a83..be6f2231e3e 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -227,7 +227,7 @@ const char * const SETTINGS_CATEGORY_CORE = "A.Core"; const char * const SETTINGS_TR_CATEGORY_CORE = QT_TRANSLATE_NOOP("Core", "Environment"); const char * const SETTINGS_ID_ENVIRONMENT = "A.General"; -const int TARGET_ICON_SIZE = 32; +const int TARGET_ICON_SIZE = 24; } // namespace Constants } // namespace Core diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index 4643ff3d554..b1af053991e 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -43,6 +43,10 @@ #include #include #include +#include +#include +#include +#include using namespace Core; using namespace Internal; @@ -54,50 +58,84 @@ FancyToolButton::FancyToolButton(QWidget *parent) setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); } +void FancySeparator::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + QPainter painter(this); + painter.fillRect(rect(), Qt::red); +} + +bool FancyToolButton::event(QEvent *e) +{ + switch(e->type()) { + case QEvent::Enter: + { + QPropertyAnimation *animation = new QPropertyAnimation(this, "fader"); + animation->setDuration(250); + animation->setEndValue(1.0); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } + break; + case QEvent::Leave: + { + QPropertyAnimation *animation = new QPropertyAnimation(this, "fader"); + animation->setDuration(250); + animation->setEndValue(0.0); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } + break; + default: + return QToolButton::event(e); + } + return false; +} + void FancyToolButton::paintEvent(QPaintEvent *event) { Q_UNUSED(event) QPainter painter(this); // draw borders - QLayout *parentLayout = qobject_cast(parentWidget())->actionsLayout(); bool isTitledAction = defaultAction()->property("titledAction").toBool(); #ifndef Q_WS_MAC // Mac UIs usually don't hover - if (underMouse() && isEnabled() && !isDown()) { + if (m_fader > 0 && isEnabled() && !isDown()) { + painter.save(); QColor whiteOverlay(Qt::white); - whiteOverlay.setAlpha(20); - painter.fillRect(rect().adjusted(1, 1, -1, -1), whiteOverlay); + whiteOverlay.setAlpha(int(20 * m_fader)); + QRect roundRect = rect().adjusted(5, 3, -5, -3); + painter.translate(0.5, 0.5); + painter.setRenderHint(QPainter::Antialiasing); + painter.setBrush(whiteOverlay); + whiteOverlay.setAlpha(int(30*m_fader)); + painter.setPen(whiteOverlay); + painter.drawRoundedRect(roundRect, 3, 3); + painter.restore(); } #endif - if (isDown()) { + if (isDown() || isChecked()) { + painter.save(); QColor whiteOverlay(Qt::black); - whiteOverlay.setAlpha(20); - painter.fillRect(rect().adjusted(1, 1, -1, -1), whiteOverlay); + whiteOverlay.setAlpha(30); + QRect roundRect = rect().adjusted(5, 3, -5, -3); + painter.translate(0.5, 0.5); + painter.setRenderHint(QPainter::Antialiasing); + painter.setPen(QColor(255, 255, 255, 40)); + static int rounding = 3; + painter.drawRoundedRect(roundRect.adjusted(-1, -1, 1, 1), rounding, rounding); + painter.setPen(QColor(0, 0, 0, 40)); + painter.setBrush(QColor(0, 0, 0, 30)); + painter.drawRoundedRect(roundRect.adjusted(1, 1, 0, 0), rounding, rounding); + whiteOverlay.setAlpha(150); + painter.setPen(whiteOverlay); + painter.setBrush(Qt::NoBrush); + painter.drawRoundedRect(roundRect, 3, 3); + painter.restore(); } QPixmap borderPixmap; QMargins margins; - if (parentLayout && parentLayout->count() > 0 && - parentLayout->itemAt(parentLayout->count()-1)->widget() == this) { - margins = QMargins(3, 3, 2, 0); - borderPixmap = QPixmap( - QLatin1String(":/fancyactionbar/images/fancytoolbutton_bottom_outline.png")); - } else if (parentLayout && parentLayout->count() > 0 && - parentLayout->itemAt(0)->widget() == this) { - margins = QMargins(3, 3, 2, 3); - borderPixmap = QPixmap( - QLatin1String(":/fancyactionbar/images/fancytoolbutton_top_outline.png")); - } else { - margins = QMargins(3, 3, 2, 0); - borderPixmap = QPixmap( - QLatin1String(":/fancyactionbar/images/fancytoolbutton_normal_outline.png")); - } - - // draw pixmap - QRect drawRect = rect(); - qDrawBorderPixmap(&painter, drawRect, margins, borderPixmap); QPixmap pix = icon().pixmap(Core::Constants::TARGET_ICON_SIZE, Core::Constants::TARGET_ICON_SIZE, isEnabled() ? QIcon::Normal : QIcon::Disabled); QPoint center = rect().center(); @@ -149,17 +187,28 @@ void FancyToolButton::paintEvent(QPaintEvent *event) painter.setPen(penColor); } painter.drawText(r, textFlags, ellidedBuildConfiguration); + QStyleOption opt; + opt.initFrom(this); + opt.rect = rect().adjusted(rect().width() - 18, 0, -10, 0); + Utils::StyleHelper::drawArrow(QStyle::PE_IndicatorArrowRight, &painter, &opt); } - } void FancyActionBar::paintEvent(QPaintEvent *event) { + QPainter painter(this); Q_UNUSED(event) + QColor light = QColor(255, 255, 255, 40); + QColor dark = QColor(0, 0, 0, 60); + painter.setPen(dark); + painter.drawLine(rect().topLeft(), rect().topRight()); + painter.setPen(light); + painter.drawLine(rect().topLeft() + QPoint(0,1), rect().topRight() + QPoint(0,1)); } + QSize FancyToolButton::sizeHint() const { - QSizeF buttonSize = iconSize().expandedTo(QSize(64, 40)); + QSizeF buttonSize = iconSize().expandedTo(QSize(64, 36)); if (defaultAction()->property("titledAction").toBool()) { QFont boldFont(font()); boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); @@ -167,7 +216,6 @@ QSize FancyToolButton::sizeHint() const QFontMetrics fm(boldFont); qreal lineHeight = fm.height(); buttonSize += QSizeF(0, (lineHeight*3.5)); - } return buttonSize.toSize(); } @@ -189,21 +237,14 @@ FancyActionBar::FancyActionBar(QWidget *parent) : QWidget(parent) { m_actionsLayout = new QVBoxLayout; - QVBoxLayout *spacerLayout = new QVBoxLayout; spacerLayout->addLayout(m_actionsLayout); int sbh = ICore::instance()->statusBar()->height(); spacerLayout->addSpacing(sbh); spacerLayout->setMargin(0); spacerLayout->setSpacing(0); - - QHBoxLayout *orientRightLayout = new QHBoxLayout; - orientRightLayout->addStretch(); - orientRightLayout->setMargin(0); - orientRightLayout->setSpacing(0); - orientRightLayout->setContentsMargins(0, 0, 1, 0); - orientRightLayout->addLayout(spacerLayout); - setLayout(orientRightLayout); + setLayout(spacerLayout); + setContentsMargins(0,2,0,0); } void FancyActionBar::addProjectSelector(QAction *action) diff --git a/src/plugins/coreplugin/fancyactionbar.h b/src/plugins/coreplugin/fancyactionbar.h index 967947c275f..cf986c102b2 100644 --- a/src/plugins/coreplugin/fancyactionbar.h +++ b/src/plugins/coreplugin/fancyactionbar.h @@ -45,17 +45,40 @@ class FancyToolButton : public QToolButton { Q_OBJECT + Q_PROPERTY(float fader READ fader WRITE setFader) + public: FancyToolButton(QWidget *parent = 0); void paintEvent(QPaintEvent *event); + bool event(QEvent *e); QSize sizeHint() const; QSize minimumSizeHint() const; + float m_fader; + float fader() { return m_fader; } + void setFader(float value) { m_fader = value; update(); } + private slots: void actionChanged(); }; +class FancySeparator: public QWidget +{ + Q_OBJECT + +public: + FancySeparator(QWidget *parent = 0) : + QWidget(parent) + { + setMinimumHeight(2); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + } + void paintEvent(QPaintEvent *event); +}; + + + class FancyActionBar : public QWidget { Q_OBJECT diff --git a/src/plugins/coreplugin/images/mode_Debug.png b/src/plugins/coreplugin/images/mode_Debug.png index e6ab1e40e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bl2IB)Mh6OAFxqm^iQ)Yu#Da^!#{eLE%&L@eGKPM zJeclg_0UlF*o`As!gip59-Tz{)#bKWnn#=_uRQ_JEmXH*EWrO zq|G<|jpxd}h4;h+YQmDgw7k4H?TEx&JFg>evYcKnIi6tK@|+{2tHD*C(a7oK`pYl( z)mOjvdwN-S{hn62%l$jqKRj4CBfjFiZ|uJM_uo=qN`5{knf&OE#?%#0&#%vpY<%|d z%SQHZdGRV0vh{BBI^PC;II!NMN!Kdv)v0;!&RIlpp6W9Cvq5Fi_PUaW?|jCfQ3|Fu!n z^^<2DmI!Q+Z~eeK#qrY@^}O)Vd2>2%l?MlX=9<^~`f0nzpCc~p%r3__-)T$u;pjQB zF=%c^+)nc-o&T@5o_eP5_gY}XyoI~@djzLTte7GxWjk}>er^sqi$AaXPP&x5FXw)h zBvF%Yc;naYcOl#Qe^)OoFQ50MpkP|nq~of)7KHCq?9`ocK}C~6+<$7q+u(J!7apdo zZn@WYEIZ{6=Y?&V$2qM|D@B<_9NKueUP$T5t5S!rect.width() <= 1 || option->rect.height() <= 1) - break; - - QRect r = option->rect; - int size = qMin(r.height(), r.width()); - QPixmap pixmap; - QString pixmapName; - pixmapName.sprintf("%s-%s-%d-%d-%d-%lld", - "$qt_ia", metaObject()->className(), - uint(option->state), element, - size, option->palette.cacheKey()); - if (!QPixmapCache::find(pixmapName, pixmap)) { - int border = size/5; - int sqsize = 2*(size/2); - QImage image(sqsize, sqsize, QImage::Format_ARGB32); - image.fill(Qt::transparent); - QPainter imagePainter(&image); - imagePainter.setRenderHint(QPainter::Antialiasing, true); - imagePainter.translate(0.5, 0.5); - QPolygon a; - switch (element) { - case PE_IndicatorArrowUp: - a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2); - break; - case PE_IndicatorArrowDown: - a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2); - break; - case PE_IndicatorArrowRight: - a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); - break; - case PE_IndicatorArrowLeft: - a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); - break; - default: - break; - } - - int bsx = 0; - int bsy = 0; - - if (option->state & State_Sunken) { - bsx = pixelMetric(PM_ButtonShiftHorizontal); - bsy = pixelMetric(PM_ButtonShiftVertical); - } - - QRect bounds = a.boundingRect(); - int sx = sqsize / 2 - bounds.center().x() - 1; - int sy = sqsize / 2 - bounds.center().y() - 1; - imagePainter.translate(sx + bsx, sy + bsy); - - if (!(option->state & State_Enabled)) { - QColor foreGround(150, 150, 150, 150); - imagePainter.setBrush(option->palette.mid().color()); - imagePainter.setPen(option->palette.mid().color()); - } else { - QColor shadow(0, 0, 0, 100); - imagePainter.translate(0, 1); - imagePainter.setPen(shadow); - imagePainter.setBrush(shadow); - QColor foreGround(255, 255, 255, 210); - imagePainter.drawPolygon(a); - imagePainter.translate(0, -1); - imagePainter.setPen(foreGround); - imagePainter.setBrush(foreGround); - } - imagePainter.drawPolygon(a); - imagePainter.end(); - pixmap = QPixmap::fromImage(image); - QPixmapCache::insert(pixmapName, pixmap); - } - int xOffset = r.x() + (r.width() - size)/2; - int yOffset = r.y() + (r.height() - size)/2; - painter->drawPixmap(xOffset, yOffset, pixmap); + Utils::StyleHelper::drawArrow(element, painter, option); } break; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index a77803bf53e..051f5241a6e 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -698,7 +698,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_projectSelectorAction->setEnabled(false); QWidget *mainWindow = Core::ICore::instance()->mainWindow(); d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, mainWindow); - connect(d->m_projectSelectorAction, SIGNAL(triggered()), d->m_targetSelector, SLOT(show())); + d->m_projectSelectorAction->setCheckable(true); + connect(d->m_projectSelectorAction, SIGNAL(toggled(bool)), d->m_targetSelector, SLOT(setVisible(bool))); + modeManager->addProjectSelector(d->m_projectSelectorAction); cmd = am->registerAction(d->m_projectSelectorAction, ProjectExplorer::Constants::SELECTTARGET, globalcontext);