Rename namespace Core::Utils into Utils

Also move Designer::Internal::FormWindowEditor ->
Designer::FormWindowEditor.
This commit is contained in:
Friedemann Kleint
2009-10-05 11:06:05 +02:00
parent 406d35acd6
commit 5948e284bb
249 changed files with 619 additions and 773 deletions

View File

@@ -647,7 +647,7 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath,
const WizardPageList &extensionPages) const
{
Core::Utils::FileWizardDialog *standardWizardDialog = new Core::Utils::FileWizardDialog(parent);
Utils::FileWizardDialog *standardWizardDialog = new Utils::FileWizardDialog(parent);
standardWizardDialog->setWindowTitle(tr("New %1").arg(name()));
setupWizard(standardWizardDialog);
standardWizardDialog->setPath(defaultPath);
@@ -659,7 +659,7 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent,
GeneratedFiles StandardFileWizard::generateFiles(const QWizard *w,
QString *errorMessage) const
{
const Core::Utils::FileWizardDialog *standardWizardDialog = qobject_cast<const Core::Utils::FileWizardDialog *>(w);
const Utils::FileWizardDialog *standardWizardDialog = qobject_cast<const Utils::FileWizardDialog *>(w);
return generateFilesFromPath(standardWizardDialog->path(),
standardWizardDialog->name(),
errorMessage);

View File

@@ -199,7 +199,7 @@ private:
};
// StandardFileWizard convenience class for creating one file. It uses
// Core::Utils::FileWizardDialog and introduces a new virtual to generate the
// Utils::FileWizardDialog and introduces a new virtual to generate the
// files from path and name.
class CORE_EXPORT StandardFileWizard : public BaseFileWizard
@@ -210,7 +210,7 @@ class CORE_EXPORT StandardFileWizard : public BaseFileWizard
protected:
explicit StandardFileWizard(const BaseFileWizardParameters &parameters, QObject *parent = 0);
// Implemented to create a Core::Utils::FileWizardDialog
// Implemented to create a Utils::FileWizardDialog
virtual QWizard *createWizardDialog(QWidget *parent,
const QString &defaultPath,
const WizardPageList &extensionPages) const;

View File

@@ -113,7 +113,7 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
this, SLOT(commandChanged(QTreeWidgetItem *)));
connect(m_page->shortcutEdit, SIGNAL(textChanged(QString)), this, SLOT(keyChanged()));
new Core::Utils::TreeWidgetColumnStretcher(m_page->commandList, 1);
new Utils::TreeWidgetColumnStretcher(m_page->commandList, 1);
commandChanged(0);

View File

@@ -78,7 +78,7 @@ Q_DECLARE_METATYPE(Core::IEditor*)
using namespace Core;
using namespace Core::Internal;
using namespace Core::Utils;
using namespace Utils;
enum { debugEditorManager=0 };

View File

@@ -137,7 +137,7 @@ EditorView::EditorView(OpenEditorsModel *model, QWidget *parent) :
toplayout->addWidget(m_lockButton);
toplayout->addWidget(m_closeButton);
Core::Utils::StyledBar *top = new Core::Utils::StyledBar;
Utils::StyledBar *top = new Utils::StyledBar;
top->setLayout(toplayout);
tl->addWidget(top);

View File

@@ -76,7 +76,7 @@ FancyTabBar::~FancyTabBar()
QSize FancyTabBar::tabSizeHint(bool minimum) const
{
QFont boldFont(font());
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
boldFont.setBold(true);
QFontMetrics fm(boldFont);
int spacing = 6;
@@ -245,13 +245,13 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
QRect tabTextRect(tabRect(tabIndex));
QRect tabIconRect(tabTextRect);
QFont boldFont(painter->font());
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
boldFont.setBold(true);
painter->setFont(boldFont);
painter->setPen(selected ? StyleHelper::panelTextColor() : QColor(30, 30, 30, 80));
painter->setPen(selected ? Utils::StyleHelper::panelTextColor() : QColor(30, 30, 30, 80));
int textFlags = Qt::AlignCenter | Qt::AlignBottom | Qt::ElideRight | Qt::TextWordWrap;
painter->drawText(tabTextRect, textFlags, tabText);
painter->setPen(selected ? QColor(60, 60, 60) : StyleHelper::panelTextColor());
painter->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor());
int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height();
tabIconRect.adjust(0, 4, 0, -textHeight);
int iconSize = qMin(tabIconRect.width(), tabIconRect.height());
@@ -285,7 +285,7 @@ public:
void mousePressEvent(QMouseEvent *ev)
{
if (ev->modifiers() & Qt::ShiftModifier)
StyleHelper::setBaseColor(QColorDialog::getColor(StyleHelper::baseColor(), m_parent));
Utils::StyleHelper::setBaseColor(QColorDialog::getColor(Utils::StyleHelper::baseColor(), m_parent));
}
private:
QWidget *m_parent;
@@ -305,7 +305,7 @@ FancyTabWidget::FancyTabWidget(QWidget *parent)
selectionLayout->setSpacing(0);
selectionLayout->setMargin(0);
Core::Utils::StyledBar *bar = new Core::Utils::StyledBar;
Utils::StyledBar *bar = new Utils::StyledBar;
QHBoxLayout *layout = new QHBoxLayout(bar);
layout->setMargin(0);
layout->setSpacing(0);
@@ -377,8 +377,8 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
rect = style()->visualRect(layoutDirection(), geometry(), rect);
StyleHelper::verticalGradient(&p, rect, rect);
p.setPen(StyleHelper::borderColor());
Utils::StyleHelper::verticalGradient(&p, rect, rect);
p.setPen(Utils::StyleHelper::borderColor());
p.drawLine(rect.topRight(), rect.bottomRight());
}

View File

@@ -38,7 +38,7 @@
#include "ui_generalsettings.h"
using namespace Core::Utils;
using namespace Utils;
using namespace Core::Internal;
GeneralSettings::GeneralSettings():

View File

@@ -46,7 +46,7 @@
</spacer>
</item>
<item>
<widget class="Core::Utils::QtColorButton" name="colorButton">
<widget class="Utils::QtColorButton" name="colorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -228,7 +228,7 @@
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::QtColorButton</class>
<class>Utils::QtColorButton</class>
<extends>QToolButton</extends>
<header location="global">utils/qtcolorbutton.h</header>
</customwidget>

View File

@@ -863,7 +863,7 @@ QStringList MainWindow::showNewItemDialog(const QString &title,
if (defaultDir.isEmpty() && !m_coreImpl->fileManager()->currentFile().isEmpty())
defaultDir = QFileInfo(m_coreImpl->fileManager()->currentFile()).absolutePath();
if (defaultDir.isEmpty())
defaultDir = Core::Utils::PathChooser::homePath();
defaultDir = Utils::PathChooser::homePath();
// Scan for wizards matching the filter and pick one. Don't show
// dialog if there is only one.
@@ -1101,7 +1101,7 @@ void MainWindow::readSettings()
{
m_settings->beginGroup(QLatin1String(settingsGroup));
StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value<QColor>());
Utils::StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value<QColor>());
const QVariant geom = m_settings->value(QLatin1String(geometryKey));
if (geom.isValid()) {
@@ -1124,7 +1124,7 @@ void MainWindow::writeSettings()
{
m_settings->beginGroup(QLatin1String(settingsGroup));
m_settings->setValue(QLatin1String(colorKey), StyleHelper::baseColor());
m_settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::baseColor());
if (windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) {
m_settings->setValue(QLatin1String(maxKey), (bool) (windowState() & Qt::WindowMaximized));

View File

@@ -35,11 +35,6 @@
#include "eventfilteringmainwindow.h"
#include <QtCore/QMap>
#include <QtCore/QList>
#include <QtCore/QSet>
#include <QtCore/QPointer>
#include <QtGui/QPrinter>
#include <QtGui/QToolButton>
QT_BEGIN_NAMESPACE
class QSettings;

View File

@@ -287,7 +287,7 @@ void ManhattanStyle::unpolish(QApplication *app)
QPalette panelPalette(const QPalette &oldPalette)
{
QColor color = StyleHelper::panelTextColor();
QColor color = Utils::StyleHelper::panelTextColor();
QPalette pal = oldPalette;
pal.setBrush(QPalette::All, QPalette::WindowText, color);
pal.setBrush(QPalette::All, QPalette::ButtonText, color);
@@ -312,20 +312,20 @@ void ManhattanStyle::polish(QWidget *widget)
widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
if (qobject_cast<QToolButton*>(widget)) {
widget->setAttribute(Qt::WA_Hover);
widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
}
else if (qobject_cast<QLineEdit*>(widget)) {
widget->setAttribute(Qt::WA_Hover);
widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
}
else if (qobject_cast<QLabel*>(widget))
widget->setPalette(panelPalette(widget->palette()));
else if (qobject_cast<QToolBar*>(widget) || widget->property("panelwidget_singlerow").toBool())
widget->setFixedHeight(StyleHelper::navigationWidgetHeight());
widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight());
else if (qobject_cast<QStatusBar*>(widget))
widget->setFixedHeight(StyleHelper::navigationWidgetHeight() + 2);
widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight() + 2);
else if (qobject_cast<QComboBox*>(widget)) {
widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
widget->setAttribute(Qt::WA_Hover);
}
}
@@ -486,7 +486,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
drawCornerImage(d->lineeditImage_disabled, painter, option->rect, 2, 2, 2, 2);
if (option->state & State_HasFocus || option->state & State_MouseOver) {
QColor hover = StyleHelper::baseColor();
QColor hover = Utils::StyleHelper::baseColor();
if (state & State_HasFocus)
hover.setAlpha(100);
else
@@ -533,15 +533,15 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
{
painter->save();
QLinearGradient grad(option->rect.topLeft(), QPoint(rect.center().x(), rect.bottom()));
QColor startColor = StyleHelper::shadowColor().darker(164);
QColor endColor = StyleHelper::baseColor().darker(130);
QColor startColor = Utils::StyleHelper::shadowColor().darker(164);
QColor endColor = Utils::StyleHelper::baseColor().darker(130);
grad.setColorAt(0, startColor);
grad.setColorAt(1, endColor);
painter->fillRect(option->rect, grad);
painter->setPen(QColor(255, 255, 255, 60));
painter->drawLine(rect.topLeft() + QPoint(0,1),
rect.topRight()+ QPoint(0,1));
painter->setPen(StyleHelper::borderColor().darker(110));
painter->setPen(Utils::StyleHelper::borderColor().darker(110));
painter->drawLine(rect.topLeft(), rect.topRight());
painter->restore();
}
@@ -549,7 +549,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
case PE_IndicatorToolBarSeparator:
{
QColor separatorColor = StyleHelper::borderColor();
QColor separatorColor = Utils::StyleHelper::borderColor();
separatorColor.setAlpha(100);
painter->setPen(separatorColor);
const int margin = 6;
@@ -593,10 +593,10 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
}
painter->setPen(Qt::NoPen);
QColor dark = StyleHelper::borderColor();
QColor dark = Utils::StyleHelper::borderColor();
dark.setAlphaF(0.4);
QColor light = StyleHelper::baseColor();
QColor light = Utils::StyleHelper::baseColor();
light.setAlphaF(0.4);
painter->fillPath(path, light);
@@ -709,10 +709,10 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
case CE_MenuBarItem:
painter->save();
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
QColor highlightOutline = StyleHelper::borderColor().lighter(120);
QColor highlightOutline = Utils::StyleHelper::borderColor().lighter(120);
bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
bool dis = !(mbi->state & State_Enabled);
StyleHelper::menuGradient(painter, option->rect, option->rect);
Utils::StyleHelper::menuGradient(painter, option->rect, option->rect);
QStyleOptionMenuItem item = *mbi;
item.rect = mbi->rect;
QPalette pal = mbi->palette;
@@ -723,7 +723,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
if (act) {
// Fill|
QColor baseColor = StyleHelper::baseColor();
QColor baseColor = Utils::StyleHelper::baseColor();
QLinearGradient grad(option->rect.topLeft(), option->rect.bottomLeft());
grad.setColorAt(0, baseColor.lighter(120));
grad.setColorAt(1, baseColor.lighter(130));
@@ -786,7 +786,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
drawItemText(painter, editRect.translated(0, 1),
visualAlignment(option->direction, Qt::AlignLeft | Qt::AlignVCenter),
customPal, cb->state & State_Enabled, text, QPalette::ButtonText);
customPal.setBrush(QPalette::All, QPalette::ButtonText, StyleHelper::panelTextColor());
customPal.setBrush(QPalette::All, QPalette::ButtonText, Utils::StyleHelper::panelTextColor());
drawItemText(painter, editRect,
visualAlignment(option->direction, Qt::AlignLeft | Qt::AlignVCenter),
customPal, cb->state & State_Enabled, text, QPalette::ButtonText);
@@ -830,9 +830,9 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
break;
case CE_MenuBarEmptyArea: {
StyleHelper::menuGradient(painter, option->rect, option->rect);
Utils::StyleHelper::menuGradient(painter, option->rect, option->rect);
painter->save();
painter->setPen(StyleHelper::borderColor());
painter->setPen(Utils::StyleHelper::borderColor());
painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
painter->restore();
}
@@ -841,12 +841,12 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
case CE_ToolBar:
{
QString key;
key.sprintf("mh_toolbar %d %d %d", option->rect.width(), option->rect.height(), StyleHelper::baseColor().rgb());;
key.sprintf("mh_toolbar %d %d %d", option->rect.width(), option->rect.height(), Utils::StyleHelper::baseColor().rgb());;
QPixmap pixmap;
QPainter *p = painter;
QRect rect = option->rect;
if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) {
if (Utils::StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) {
pixmap = QPixmap(option->rect.size());
p = new QPainter(&pixmap);
rect = QRect(0, 0, option->rect.width(), option->rect.height());
@@ -861,11 +861,11 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
gradientSpan = QRect(offset, widget->window()->size());
}
if (horizontal)
StyleHelper::horizontalGradient(p, gradientSpan, rect);
Utils::StyleHelper::horizontalGradient(p, gradientSpan, rect);
else
StyleHelper::verticalGradient(p, gradientSpan, rect);
Utils::StyleHelper::verticalGradient(p, gradientSpan, rect);
painter->setPen(StyleHelper::borderColor());
painter->setPen(Utils::StyleHelper::borderColor());
if (horizontal) {
// Note: This is a hack to determine if the
@@ -886,7 +886,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
p->drawLine(rect.topRight(), rect.bottomRight());
}
if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) {
if (Utils::StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) {
painter->drawPixmap(rect.topLeft(), pixmap);
p->end();
delete p;
@@ -946,7 +946,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
toolbutton, widget), 0);
QPen oldPen = painter->pen();
QColor focusColor = StyleHelper::panelTextColor();
QColor focusColor = Utils::StyleHelper::panelTextColor();
focusColor.setAlpha(120);
QPen outline(focusColor, 1);
outline.setStyle(Qt::DotLine);

View File

@@ -71,7 +71,7 @@ void MiniSplitterHandle::resizeEvent(QResizeEvent *event)
void MiniSplitterHandle::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.fillRect(event->rect(), StyleHelper::borderColor());
painter.fillRect(event->rect(), Utils::StyleHelper::borderColor());
}
QSplitterHandle *MiniSplitter::createHandle()

View File

@@ -369,7 +369,7 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget)
m_navigationComboBox->setMinimumContentsLength(0);
m_navigationWidget = 0;
m_toolBar = new Core::Utils::StyledBar(this);
m_toolBar = new Utils::StyledBar(this);
QHBoxLayout *toolBarLayout = new QHBoxLayout;
toolBarLayout->setMargin(0);
toolBarLayout->setSpacing(0);

View File

@@ -40,10 +40,11 @@ class QShortcut;
class QToolButton;
QT_END_NAMESPACE
namespace Core {
namespace Utils {
class StyledBar;
}
namespace Core {
class INavigationWidgetFactory;
class IMode;
class Command;
@@ -147,7 +148,7 @@ private:
NavigationWidget *m_parentWidget;
QComboBox *m_navigationComboBox;
QWidget *m_navigationWidget;
Core::Utils::StyledBar *m_toolBar;
Utils::StyledBar *m_toolBar;
QList<QToolButton *> m_additionalToolBarWidgets;
};

View File

@@ -193,7 +193,7 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) :
QVBoxLayout *mainlayout = new QVBoxLayout;
mainlayout->setSpacing(0);
mainlayout->setMargin(0);
m_toolBar = new Core::Utils::StyledBar;
m_toolBar = new Utils::StyledBar;
QHBoxLayout *toolLayout = new QHBoxLayout(m_toolBar);
toolLayout->setMargin(0);
toolLayout->setSpacing(0);

View File

@@ -125,8 +125,8 @@ void ProgressBar::mouseMoveEvent(QMouseEvent *)
void ProgressBar::paintEvent(QPaintEvent *)
{
// TODO move font into stylehelper
// TODO use stylehelper white
// TODO move font into Utils::StyleHelper
// TODO use Utils::StyleHelper white
double range = maximum() - minimum();
double percent = 0.50;
@@ -139,7 +139,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
QPainter p(this);
QFont boldFont(p.font());
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
boldFont.setBold(true);
p.setFont(boldFont);
QFontMetrics fm(boldFont);
@@ -158,7 +158,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
p.setPen(QColor(30, 30, 30, 80));
p.drawText(textRect, Qt::AlignHCenter | Qt::AlignBottom, m_title);
p.translate(0, -1);
p.setPen(StyleHelper::panelTextColor());
p.setPen(Utils::StyleHelper::panelTextColor());
p.drawText(textRect, Qt::AlignHCenter | Qt::AlignBottom, m_title);
p.translate(0, 1);
@@ -166,11 +166,11 @@ void ProgressBar::paintEvent(QPaintEvent *)
m_progressHeight += ((m_progressHeight % 2) + 1) % 2; // make odd
// draw outer rect
QRect rect(INDENT - 1, h+6, size().width()-2*INDENT, m_progressHeight-1);
p.setPen(StyleHelper::panelTextColor());
p.setPen(Utils::StyleHelper::panelTextColor());
p.drawRect(rect);
// draw inner rect
QColor c = StyleHelper::panelTextColor();
QColor c = Utils::StyleHelper::panelTextColor();
c.setAlpha(180);
p.setPen(Qt::NoPen);
@@ -196,7 +196,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
p.drawRect(inner);
if (value() < maximum() && !m_error) {
QColor cancelOutline = StyleHelper::panelTextColor();
QColor cancelOutline = Utils::StyleHelper::panelTextColor();
p.setPen(cancelOutline);
QRect cancelRect(rect.right() - m_progressHeight + 2, rect.top(), m_progressHeight-1, rect.height());
if (cancelRect.contains(mapFromGlobal(QCursor::pos())))
@@ -210,7 +210,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
p.drawLine(cancelRect.center()+QPoint(-1,-1), cancelRect.center()+QPoint(+3,+3));
p.drawLine(cancelRect.center()+QPoint(+3,-1), cancelRect.center()+QPoint(-1,+3));
p.setPen(StyleHelper::panelTextColor());
p.setPen(Utils::StyleHelper::panelTextColor());
p.drawLine(cancelRect.center()+QPoint(-1,-1), cancelRect.center()+QPoint(+3,+3));
p.drawLine(cancelRect.center()+QPoint(+3,-1), cancelRect.center()+QPoint(-1,+3));
}