diff --git a/src/plugins/coreplugin/stylehelper.cpp b/src/libs/utils/stylehelper.cpp similarity index 100% rename from src/plugins/coreplugin/stylehelper.cpp rename to src/libs/utils/stylehelper.cpp diff --git a/src/plugins/coreplugin/stylehelper.h b/src/libs/utils/stylehelper.h similarity index 97% rename from src/plugins/coreplugin/stylehelper.h rename to src/libs/utils/stylehelper.h index 4c29af0253c9425f33fb9da94265652d7ce89d6b..e42ab67bcd7aa0db12b3cecf0e12a58d99b3d32d 100644 --- a/src/plugins/coreplugin/stylehelper.h +++ b/src/libs/utils/stylehelper.h @@ -30,7 +30,7 @@ #ifndef STYLEHELPER_H #define STYLEHELPER_H -#include "core_global.h" +#include "utils_global.h" #include <QtCore/QRect> #include <QtGui/QPainter> @@ -40,7 +40,7 @@ // Helper class holding all custom color values -class CORE_EXPORT StyleHelper +class QTCREATOR_UTILS_EXPORT StyleHelper { public: // Height of the project explorer navigation bar diff --git a/src/libs/utils/utils.pro b/src/libs/utils/utils.pro index 0a90231f4affd4223a5e0787a64d027944b9e5a5..4efe18705bc2fc5ccb554ab39da891f11535bcc7 100644 --- a/src/libs/utils/utils.pro +++ b/src/libs/utils/utils.pro @@ -30,7 +30,8 @@ SOURCES += reloadpromptutils.cpp \ parameteraction.cpp \ treewidgetcolumnstretcher.cpp \ checkablemessagebox.cpp \ - styledbar.cpp + styledbar.cpp \ + stylehelper.cpp win32 { SOURCES += abstractprocess_win.cpp \ @@ -69,7 +70,8 @@ HEADERS += utils_global.h \ treewidgetcolumnstretcher.h \ checkablemessagebox.h \ qtcassert.h \ - styledbar.h + styledbar.h \ + stylehelper.h FORMS += filewizardpage.ui \ projectintropage.ui \ diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index ae1874438fa0ed1959e58e21837d687834d467b5..fbe1d6cc6427830d0b05c12eece5d0a9b1598600 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -65,7 +65,6 @@ SOURCES += mainwindow.cpp \ coreimpl.cpp \ basefilewizard.cpp \ plugindialog.cpp \ - stylehelper.cpp \ inavigationwidgetfactory.cpp \ navigationwidget.cpp \ manhattanstyle.cpp \ @@ -150,7 +149,6 @@ HEADERS += mainwindow.h \ coreimpl.h \ basefilewizard.h \ plugindialog.h \ - stylehelper.h \ inavigationwidgetfactory.h \ navigationwidget.h \ manhattanstyle.h \ diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index cbd669d0239c859bfb9c56b5f0b42026fe7a62a7..1767b88febf5553362c36c7a1e1256a67a241301 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -28,7 +28,7 @@ **************************************************************************/ #include "fancytabwidget.h" -#include "stylehelper.h" +#include <utils/stylehelper.h> #include <QDebug> diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 5a75f4f9dfd4f6f99fbb171890f4a52507f48580..eb250422b3f1b8b14b9edfe28b79bc4eae70d09a 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -29,8 +29,8 @@ #include "generalsettings.h" -#include "stylehelper.h" -#include "utils/qtcolorbutton.h" +#include <utils/stylehelper.h> +#include <utils/qtcolorbutton.h> #include <utils/consoleprocess.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/icore.h> diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index b9c3f2046498817048c9f0bb109efbf2eb1901c3..e84147941095c9e97b239856d81b2458a33376ec 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -51,7 +51,6 @@ #include "scriptmanager_p.h" #include "settingsdialog.h" -#include "stylehelper.h" #include "variablemanager.h" #include "versiondialog.h" #include "viewmanager.h" @@ -68,6 +67,7 @@ #include <coreplugin/findplaceholder.h> #include <coreplugin/settingsdatabase.h> #include <utils/pathchooser.h> +#include <utils/stylehelper.h> #include <extensionsystem/pluginmanager.h> #include <QtCore/QDebug> diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 171dac813f2449b1bfc9b664fbafddc2f7736d1c..fda4e51bab2076815d8feef09e7efef42ffb4b9b 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -29,12 +29,14 @@ #include "manhattanstyle.h" -#include "stylehelper.h" #include "styleanimator.h" #include <QtCore/QDebug> #include <QtCore/QLibrary> +#include <utils/qtcassert.h> +#include <utils/stylehelper.h> + #include <QtGui/QApplication> #include <QtGui/QComboBox> #include <QtGui/QDialog> @@ -56,8 +58,6 @@ #include <QtGui/QToolBar> #include <QtGui/QToolButton> -#include <utils/qtcassert.h> - // We define a currently unused state for indicating animations #define State_Animating 0x00000040 diff --git a/src/plugins/coreplugin/minisplitter.cpp b/src/plugins/coreplugin/minisplitter.cpp index bd1551cb7e79c789852c22663c1ae367e79dd7b5..2961dec153f806f572a6d919fdbc89d6968ec044 100644 --- a/src/plugins/coreplugin/minisplitter.cpp +++ b/src/plugins/coreplugin/minisplitter.cpp @@ -28,7 +28,8 @@ **************************************************************************/ #include "minisplitter.h" -#include "stylehelper.h" + +#include <utils/stylehelper.h> #include <QtGui/QPaintEvent> #include <QtGui/QPainter> diff --git a/src/plugins/coreplugin/progressmanager/progresspie.cpp b/src/plugins/coreplugin/progressmanager/progresspie.cpp index 4f8ffa645febe5e580c1a50c6ad7bd018dc0caed..d4a16a525c63682a586b5cfa50c429b142fbe24c 100644 --- a/src/plugins/coreplugin/progressmanager/progresspie.cpp +++ b/src/plugins/coreplugin/progressmanager/progresspie.cpp @@ -28,7 +28,8 @@ **************************************************************************/ #include "progresspie.h" -#include "stylehelper.h" + +#include <utils/stylehelper.h> #include <QtGui/QPainter> #include <QtGui/QFont> diff --git a/src/plugins/find/find_dependencies.pri b/src/plugins/find/find_dependencies.pri index a64caedc103f51644196d974398ebb44fc4c5f88..7f369f6326a6ff535481cd53aaa6c99e57e4adc9 100644 --- a/src/plugins/find/find_dependencies.pri +++ b/src/plugins/find/find_dependencies.pri @@ -1 +1,2 @@ include(../../plugins/coreplugin/coreplugin.pri) +include(../../libs/utils/utils.pri) diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 0ddd2d259e65943a75e6c50a354a0ca874f69702..4e19745403aaed8845c963c6d74e540def97261c 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -32,15 +32,13 @@ #include "textfindconstants.h" #include <coreplugin/coreconstants.h> -#include <coreplugin/stylehelper.h> #include <coreplugin/findplaceholder.h> #include <coreplugin/icore.h> -#include <coreplugin/stylehelper.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/command.h> - #include <extensionsystem/pluginmanager.h> +#include <utils/stylehelper.h> #include <QtCore/QDebug> #include <QtCore/QSettings> @@ -76,7 +74,6 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen { //setup ui m_ui.setupUi(this); - setProperty("panelwidget", true); setFocusProxy(m_ui.findEdit); setProperty("topBorder", true); m_ui.findEdit->setAttribute(Qt::WA_MacShowFocusRect, false); @@ -230,56 +227,6 @@ FindToolBar::~FindToolBar() { } -void FindToolBar::paintEvent(QPaintEvent *event) -{ - // Currently from the style - // Goal should be to migrate that into a Utils::StyledWidget class - Q_UNUSED(event) - QPainter painter(this); - - QRect selfRect = rect(); - QString key; - key.sprintf("mh_toolbar %d %d %d", selfRect.width(), selfRect.height(), StyleHelper::baseColor().rgb());; - - QPixmap pixmap; - QPainter *p = &painter; - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { - pixmap = QPixmap(selfRect.size()); - p = new QPainter(&pixmap); - selfRect = QRect(0, 0, selfRect.width(), selfRect.height()); - } - - // Map offset for global window gradient - QPoint offset = window()->mapToGlobal(selfRect.topLeft()) - - mapToGlobal(selfRect.topLeft()); - QRect gradientSpan; - gradientSpan = QRect(offset, window()->size()); - StyleHelper::horizontalGradient(p, gradientSpan, selfRect); - - p->setPen(StyleHelper::borderColor()); - - // Note: This is a hack to determine if the - // toolbar should draw the top or bottom outline - // (needed for the find toolbar for instance) - QColor lighter(255, 255, 255, 40); - if (property("topBorder").toBool()) { - p->drawLine(selfRect.topLeft(), selfRect.topRight()); - p->setPen(lighter); - p->drawLine(selfRect.topLeft() + QPoint(0, 1), selfRect.topRight() + QPoint(0, 1)); - } else { - p->drawLine(selfRect.bottomLeft(), selfRect.bottomRight()); - p->setPen(lighter); - p->drawLine(selfRect.topLeft(), selfRect.topRight()); - } - - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { - painter.drawPixmap(selfRect.topLeft(), pixmap); - p->end(); - delete p; - QPixmapCache::insert(key, pixmap); - } -} - bool FindToolBar::eventFilter(QObject *obj, QEvent *event) { if ((obj == m_ui.findEdit || obj == m_findCompleter->popup()) @@ -320,7 +267,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event) m_currentDocumentFind->clearFindScope(); } } - return QWidget::eventFilter(obj, event); + return Core::Utils::StyledBar::eventFilter(obj, event); } void FindToolBar::updateActions() @@ -596,7 +543,7 @@ bool FindToolBar::focusNextPrevChild(bool next) else if (!next && m_ui.findEdit->hasFocus()) m_ui.replaceAllButton->setFocus(Qt::TabFocusReason); else - return QWidget::focusNextPrevChild(next); + return Core::Utils::StyledBar::focusNextPrevChild(next); return true; } diff --git a/src/plugins/find/findtoolbar.h b/src/plugins/find/findtoolbar.h index ca1b1ba5268996826923e2838af11970f03c38f9..f1cab5e314f636e003b290bed95528f855cf6c56 100644 --- a/src/plugins/find/findtoolbar.h +++ b/src/plugins/find/findtoolbar.h @@ -34,6 +34,8 @@ #include "ifindfilter.h" #include "currentdocumentfind.h" +#include <utils/styledbar.h> + #include <QtGui/QStringListModel> #include <QtGui/QWidget> #include <QtGui/QToolBar> @@ -44,14 +46,13 @@ namespace Internal { class FindPlugin; -class FindToolBar : public QWidget +class FindToolBar : public Core::Utils::StyledBar { Q_OBJECT public: FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind); ~FindToolBar(); - void paintEvent(QPaintEvent *event); void readSettings(); void writeSettings(); diff --git a/src/plugins/projectexplorer/buildprogress.cpp b/src/plugins/projectexplorer/buildprogress.cpp index a91c4afff66fbdee51f2567fcfe5ca3db2d61348..582419431be982327ad938a169a4d06100be078b 100644 --- a/src/plugins/projectexplorer/buildprogress.cpp +++ b/src/plugins/projectexplorer/buildprogress.cpp @@ -29,7 +29,7 @@ #include "buildprogress.h" -#include <coreplugin/stylehelper.h> +#include <utils/stylehelper.h> #include <QtGui/QVBoxLayout> #include <QtGui/QHBoxLayout> diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index f94f6b789c105e0906c123cf96bae26078bdadb1..c43918dfd0b4047003c7fbda670da1dabcfd3249 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -30,12 +30,12 @@ #include "basefilefind.h" #include <coreplugin/icore.h> -#include <coreplugin/stylehelper.h> #include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/editormanager/editormanager.h> #include <find/textfindconstants.h> #include <texteditor/itexteditor.h> #include <texteditor/basetexteditor.h> +#include <utils/stylehelper.h> #include <QtCore/QDebug> #include <QtCore/QDirIterator> diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 4fcd94e2afa650da8beac46e03ae49d6b9dee6f7..63507ae16371a48afacb96bf0c52d7d976482595 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -39,14 +39,14 @@ #include "codecselector.h" #ifndef TEXTEDITOR_STANDALONE +#include <aggregation/aggregate.h> #include <coreplugin/coreconstants.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/manhattanstyle.h> -#include <coreplugin/stylehelper.h> #include <extensionsystem/pluginmanager.h> #include <find/basetextfind.h> +#include <utils/stylehelper.h> -#include <aggregation/aggregate.h> #endif #include <utils/linecolumnlabel.h> #include <utils/qtcassert.h>