diff options
author | Christian Kandeler <christian.kandeler@nokia.com> | 2012-08-23 15:53:58 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-08-27 17:00:03 +0200 |
commit | e669f054069c3a1214a31c4c1d7d9269659c31c4 (patch) | |
tree | d611e865215dc8ee705a640fdf3e35660542632f /src/plugins/projectexplorer/buildstepspage.cpp | |
parent | b674b59b3d652fa9c5d74dc4e16380e3a5d23882 (diff) | |
download | qt-creator-e669f054069c3a1214a31c4c1d7d9269659c31c4.tar.gz |
Utils: Introduce HostOsInfo class.
The class' member functions are intended to be used
instead of the Q_OS_* macros in all contexts where
the latter are not syntactically required.
This lowers the likelihood of changes made on one
platform breaking the build on another, e.g. due to
the code model missing symbols in #ifdef'ed out code
when refactoring.
Change-Id: I4a54788591b4c8f8d589b8368a6c683d4155c9fa
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/projectexplorer/buildstepspage.cpp')
-rw-r--r-- | src/plugins/projectexplorer/buildstepspage.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index e0f3d96d4f..c8b9f45a14 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -39,6 +39,7 @@ #include <extensionsystem/pluginmanager.h> #include <utils/qtcassert.h> #include <utils/detailswidget.h> +#include <utils/hostosinfo.h> #include <QSignalMapper> @@ -54,6 +55,7 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; +using namespace Utils; ToolWidget::ToolWidget(QWidget *parent) : Utils::FadingPanel(parent), m_buildStepEnabled(true) @@ -68,11 +70,7 @@ ToolWidget::ToolWidget(QWidget *parent) hbox->setContentsMargins(0, 0, 0, 0); hbox->setSpacing(0); m_firstWidget->setLayout(hbox); -#ifdef Q_OS_MAC - QSize buttonSize(20, 20); -#else - QSize buttonSize(20, 26); -#endif + QSize buttonSize(20, HostOsInfo::isMacHost() ? 20 : 26); m_disableButton = new QToolButton(m_firstWidget); m_disableButton->setAutoRaise(true); @@ -139,17 +137,15 @@ void ToolWidget::setBuildStepEnabled(bool b) { m_buildStepEnabled = b; if (m_buildStepEnabled) { -#ifdef Q_OS_MAC - m_firstWidget->setOpacity(m_targetOpacity); -#else - m_firstWidget->fadeTo(m_targetOpacity); -#endif + if (HostOsInfo::isMacHost()) + m_firstWidget->setOpacity(m_targetOpacity); + else + m_firstWidget->fadeTo(m_targetOpacity); } else { -#ifdef Q_OS_MAC - m_firstWidget->setOpacity(1.0); -#else - m_firstWidget->fadeTo(1.0); -#endif + if (HostOsInfo::isMacHost()) + m_firstWidget->setOpacity(1.0); + else + m_firstWidget->fadeTo(1.0); } m_disableButton->setChecked(!b); } @@ -462,9 +458,8 @@ void BuildStepListWidget::setupUi() hboxLayout->addStretch(10); -#ifdef Q_OS_MAC - m_addButton->setAttribute(Qt::WA_MacSmallSize); -#endif + if (HostOsInfo::isMacHost()) + m_addButton->setAttribute(Qt::WA_MacSmallSize); m_vbox->addLayout(hboxLayout); |