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>
This commit is contained in:
Christian Kandeler
2012-08-23 15:53:58 +02:00
committed by hjk
parent b674b59b3d
commit e669f05406
109 changed files with 1281 additions and 1249 deletions
+23 -21
View File
@@ -29,6 +29,9 @@
**************************************************************************/ **************************************************************************/
#include "contextpanewidget.h" #include "contextpanewidget.h"
#include <utils/hostosinfo.h>
#include <QToolButton> #include <QToolButton>
#include <QFontComboBox> #include <QFontComboBox>
#include <QComboBox> #include <QComboBox>
@@ -49,6 +52,8 @@
#include "customcolordialog.h" #include "customcolordialog.h"
#include "colorbutton.h" #include "colorbutton.h"
using namespace Utils;
namespace QmlEditorWidgets { namespace QmlEditorWidgets {
/* XPM */ /* XPM */
@@ -102,12 +107,12 @@ DragWidget::DragWidget(QWidget *parent) : QFrame(parent)
// TODO: The following code should be enabled for OSX // TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed // when QTBUG-23205 is fixed
#ifndef Q_OS_MAC if (!HostOsInfo::isMacHost()) {
m_dropShadowEffect = new QGraphicsDropShadowEffect; m_dropShadowEffect = new QGraphicsDropShadowEffect;
m_dropShadowEffect->setBlurRadius(6); m_dropShadowEffect->setBlurRadius(6);
m_dropShadowEffect->setOffset(2, 2); m_dropShadowEffect->setOffset(2, 2);
setGraphicsEffect(m_dropShadowEffect); setGraphicsEffect(m_dropShadowEffect);
#endif }
} }
void DragWidget::mousePressEvent(QMouseEvent * event) void DragWidget::mousePressEvent(QMouseEvent * event)
@@ -127,12 +132,12 @@ void DragWidget::mouseReleaseEvent(QMouseEvent *event)
m_startPos = QPoint(-1, -1); m_startPos = QPoint(-1, -1);
// TODO: The following code should be enabled for OSX // TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed // when QTBUG-23205 is fixed
#ifndef Q_OS_MAC if (!HostOsInfo::isMacHost()) {
m_dropShadowEffect = new QGraphicsDropShadowEffect; m_dropShadowEffect = new QGraphicsDropShadowEffect;
m_dropShadowEffect->setBlurRadius(6); m_dropShadowEffect->setBlurRadius(6);
m_dropShadowEffect->setOffset(2, 2); m_dropShadowEffect->setOffset(2, 2);
setGraphicsEffect(m_dropShadowEffect); setGraphicsEffect(m_dropShadowEffect);
#endif }
} }
QFrame::mouseReleaseEvent(event); QFrame::mouseReleaseEvent(event);
} }
@@ -177,16 +182,14 @@ void DragWidget::protectedMoved()
void DragWidget::leaveEvent(QEvent *) void DragWidget::leaveEvent(QEvent *)
{ {
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
unsetCursor(); unsetCursor();
#endif
} }
void DragWidget::enterEvent(QEvent *) void DragWidget::enterEvent(QEvent *)
{ {
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
#endif
} }
ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_currentWidget(0) ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_currentWidget(0)
@@ -232,9 +235,8 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_cu
m_disableAction->setCheckable(true); m_disableAction->setCheckable(true);
connect(m_disableAction.data(), SIGNAL(toggled(bool)), this, SLOT(onDisable(bool))); connect(m_disableAction.data(), SIGNAL(toggled(bool)), this, SLOT(onDisable(bool)));
m_pinned = false; m_pinned = false;
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
#endif
} }
ContextPaneWidget::~ContextPaneWidget() ContextPaneWidget::~ContextPaneWidget()
@@ -29,6 +29,9 @@
**************************************************************************/ **************************************************************************/
#include "contextpanewidgetimage.h" #include "contextpanewidgetimage.h"
#include <utils/hostosinfo.h>
#include "ui_contextpanewidgetimage.h" #include "ui_contextpanewidgetimage.h"
#include "ui_contextpanewidgetborderimage.h" #include "ui_contextpanewidgetborderimage.h"
#include <qmljs/qmljspropertyreader.h> #include <qmljs/qmljspropertyreader.h>
@@ -611,12 +614,12 @@ PreviewLabel::PreviewLabel(QWidget *parent)
// TODO: The following code should be enabled for OSX // TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed // when QTBUG-23205 is fixed
#ifndef Q_OS_MAC if (!Utils::HostOsInfo::isMacHost()) {
QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect; QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
dropShadowEffect->setBlurRadius(4); dropShadowEffect->setBlurRadius(4);
dropShadowEffect->setOffset(2, 2); dropShadowEffect->setOffset(2, 2);
m_hooverInfo->setGraphicsEffect(dropShadowEffect); m_hooverInfo->setGraphicsEffect(dropShadowEffect);
#endif }
m_hooverInfo->setAutoFillBackground(true); m_hooverInfo->setAutoFillBackground(true);
m_hooverInfo->raise(); m_hooverInfo->raise();
} }
+14 -12
View File
@@ -32,6 +32,8 @@
#include "huecontrol.h" #include "huecontrol.h"
#include "colorbox.h" #include "colorbox.h"
#include <utils/hostosinfo.h>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QPainter> #include <QPainter>
@@ -41,6 +43,8 @@
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QGraphicsEffect> #include <QGraphicsEffect>
using namespace Utils;
namespace QmlEditorWidgets { namespace QmlEditorWidgets {
CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent ) CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
@@ -52,12 +56,12 @@ CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
// TODO: The following code should be enabled for OSX // TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed // when QTBUG-23205 is fixed
#ifndef Q_OS_MAC if (!HostOsInfo::isMacHost()) {
QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect; QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
dropShadowEffect->setBlurRadius(6); dropShadowEffect->setBlurRadius(6);
dropShadowEffect->setOffset(2, 2); dropShadowEffect->setOffset(2, 2);
setGraphicsEffect(dropShadowEffect); setGraphicsEffect(dropShadowEffect);
#endif }
setAutoFillBackground(true); setAutoFillBackground(true);
m_hueControl = new HueControl(this); m_hueControl = new HueControl(this);
@@ -184,16 +188,14 @@ void CustomColorDialog::setupWidgets()
void CustomColorDialog::leaveEvent(QEvent *) void CustomColorDialog::leaveEvent(QEvent *)
{ {
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
unsetCursor(); unsetCursor();
#endif
} }
void CustomColorDialog::enterEvent(QEvent *) void CustomColorDialog::enterEvent(QEvent *)
{ {
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
#endif
} }
@@ -7,5 +7,6 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
include(../../qtcreatorlibrary.pri) include(../../qtcreatorlibrary.pri)
include(../qmljs/qmljs.pri) include(../qmljs/qmljs.pri)
include(../utils/utils.pri)
include(qmleditorwidgets-lib.pri) include(qmleditorwidgets-lib.pri)
@@ -19,6 +19,7 @@ QtcLibrary {
Depends { name: "cpp" } Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["widgets", "quick1", "script"] } Depends { name: "Qt"; submodules: ["widgets", "quick1", "script"] }
Depends { name: "QmlJS" } Depends { name: "QmlJS" }
Depends { name: "Utils" }
files: [ files: [
"resources.qrc", "resources.qrc",
+5 -5
View File
@@ -38,8 +38,9 @@
#include <QDateTime> #include <QDateTime>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/synchronousprocess.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h>
#include <QDesktopServices> #include <QDesktopServices>
#include <QDebug> #include <QDebug>
@@ -121,14 +122,13 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool
QStringList BuildableHelperLibrary::possibleQMakeCommands() QStringList BuildableHelperLibrary::possibleQMakeCommands()
{ {
// On windows no one has renamed qmake, right? // On windows no one has renamed qmake, right?
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost())
return QStringList(QLatin1String("qmake.exe")); return QStringList(QLatin1String("qmake.exe"));
#else
// On unix some distributions renamed qmake to avoid clashes // On unix some distributions renamed qmake to avoid clashes
QStringList result; QStringList result;
result << QLatin1String("qmake-qt4") << QLatin1String("qmake4") << QLatin1String("qmake"); result << QLatin1String("qmake-qt4") << QLatin1String("qmake4") << QLatin1String("qmake");
return result; return result;
#endif
} }
// Copy helper source files to a target directory, replacing older files. // Copy helper source files to a target directory, replacing older files.
+11 -9
View File
@@ -33,6 +33,8 @@
#include "environment.h" #include "environment.h"
#include "qtcprocess.h" #include "qtcprocess.h"
#include <utils/hostosinfo.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QSettings> #include <QSettings>
@@ -134,12 +136,14 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
} }
} }
if (Utils::HostOsInfo::isMacHost()) {
xtermArgs << (QCoreApplication::applicationDirPath()
+ QLatin1String("/../Resources/qtcreator_process_stub"));
} else {
xtermArgs << (QCoreApplication::applicationDirPath()
+ QLatin1String("/qtcreator_process_stub"));
}
xtermArgs xtermArgs
#ifdef Q_OS_MAC
<< (QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/qtcreator_process_stub"))
#else
<< (QCoreApplication::applicationDirPath() + QLatin1String("/qtcreator_process_stub"))
#endif
<< modeOption(d->m_mode) << modeOption(d->m_mode)
<< d->m_stubServer.fullServerName() << d->m_stubServer.fullServerName()
<< msgPromptToClose() << msgPromptToClose()
@@ -279,11 +283,9 @@ void ConsoleProcess::stubExited()
QString ConsoleProcess::defaultTerminalEmulator() QString ConsoleProcess::defaultTerminalEmulator()
{ {
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
return QLatin1String("/usr/X11/bin/xterm"); return QLatin1String("/usr/X11/bin/xterm");
#else
return QLatin1String("xterm"); return QLatin1String("xterm");
#endif
} }
QString ConsoleProcess::terminalEmulator(const QSettings *settings) QString ConsoleProcess::terminalEmulator(const QSettings *settings)
+5 -7
View File
@@ -30,6 +30,7 @@
#include "detailsbutton.h" #include "detailsbutton.h"
#include <utils/hostosinfo.h>
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
#include <QPropertyAnimation> #include <QPropertyAnimation>
@@ -83,11 +84,9 @@ QSize DetailsButton::sizeHint() const
{ {
// TODO: Adjust this when icons become available! // TODO: Adjust this when icons become available!
const int w = fontMetrics().width(text()) + 32; const int w = fontMetrics().width(text()) + 32;
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
return QSize(w, 34); return QSize(w, 34);
#else
return QSize(w, 22); return QSize(w, 22);
#endif
} }
bool DetailsButton::event(QEvent *e) bool DetailsButton::event(QEvent *e)
@@ -120,11 +119,10 @@ void DetailsButton::paintEvent(QPaintEvent *e)
QWidget::paintEvent(e); QWidget::paintEvent(e);
QPainter p(this); QPainter p(this);
#ifndef Q_OS_MAC
// draw hover animation // draw hover animation
if (!isDown() && m_fader > 0) if (!HostOsInfo::isMacHost() && !isDown() && m_fader > 0)
p.fillRect(rect().adjusted(1, 1, -2, -2), QColor(255, 255, 255, int(m_fader*180))); p.fillRect(rect().adjusted(1, 1, -2, -2), QColor(255, 255, 255, int(m_fader*180)));
#endif
if (isChecked()) { if (isChecked()) {
if (m_checkedPixmap.isNull() || m_checkedPixmap.size() != contentsRect().size()) if (m_checkedPixmap.isNull() || m_checkedPixmap.size() != contentsRect().size())
+11 -12
View File
@@ -30,6 +30,7 @@
#include "detailswidget.h" #include "detailswidget.h"
#include "detailsbutton.h" #include "detailsbutton.h"
#include "hostosinfo.h"
#include <QStack> #include <QStack>
#include <QPropertyAnimation> #include <QPropertyAnimation>
@@ -143,10 +144,10 @@ QPixmap DetailsWidgetPrivate::cacheBackground(const QSize &size)
QRect topRect(0, 0, size.width(), topHeight); QRect topRect(0, 0, size.width(), topHeight);
QRect fullRect(0, 0, size.width(), size.height()); QRect fullRect(0, 0, size.width(), size.height());
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
p.fillRect(fullRect, qApp->palette().window().color()); p.fillRect(fullRect, qApp->palette().window().color());
#endif else
p.fillRect(fullRect, QColor(255, 255, 255, 40)); p.fillRect(fullRect, QColor(255, 255, 255, 40));
QLinearGradient lg(topRect.topLeft(), topRect.bottomLeft()); QLinearGradient lg(topRect.topLeft(), topRect.bottomLeft());
lg.setColorAt(0, QColor(255, 255, 255, 130)); lg.setColorAt(0, QColor(255, 255, 255, 130));
@@ -188,11 +189,10 @@ void DetailsWidgetPrivate::changeHoverState(bool hovered)
{ {
if (!m_toolWidget) if (!m_toolWidget)
return; return;
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
m_toolWidget->setOpacity(hovered ? 1.0 : 0); m_toolWidget->setOpacity(hovered ? 1.0 : 0);
#else else
m_toolWidget->fadeTo(hovered ? 1.0 : 0); m_toolWidget->fadeTo(hovered ? 1.0 : 0);
#endif
m_hovered = hovered; m_hovered = hovered;
} }
@@ -381,9 +381,8 @@ void DetailsWidget::setToolWidget(Utils::FadingPanel *widget)
d->m_toolWidget->adjustSize(); d->m_toolWidget->adjustSize();
d->m_grid->addWidget(d->m_toolWidget, 0, 1, 1, 1, Qt::AlignRight); d->m_grid->addWidget(d->m_toolWidget, 0, 1, 1, 1, Qt::AlignRight);
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
d->m_toolWidget->setOpacity(1.0); d->m_toolWidget->setOpacity(1.0);
#endif
d->changeHoverState(d->m_hovered); d->changeHoverState(d->m_hovered);
} }
+107 -128
View File
@@ -30,6 +30,8 @@
#include "environment.h" #include "environment.h"
#include "hostosinfo.h"
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>
#include <QString> #include <QString>
@@ -41,18 +43,18 @@ public:
SystemEnvironment() SystemEnvironment()
: Environment(QProcess::systemEnvironment()) : Environment(QProcess::systemEnvironment())
{ {
#ifdef Q_OS_LINUX if (Utils::HostOsInfo::isLinuxHost()) {
QString ldLibraryPath = value(QLatin1String("LD_LIBRARY_PATH")); QString ldLibraryPath = value(QLatin1String("LD_LIBRARY_PATH"));
QDir lib(QCoreApplication::applicationDirPath()); QDir lib(QCoreApplication::applicationDirPath());
lib.cd("../lib"); lib.cd("../lib");
QString toReplace = lib.path(); QString toReplace = lib.path();
lib.cd("qtcreator"); lib.cd("qtcreator");
toReplace.append(QLatin1String(":")); toReplace.append(QLatin1String(":"));
toReplace.append(lib.path()); toReplace.append(lib.path());
if (ldLibraryPath.startsWith(toReplace)) if (ldLibraryPath.startsWith(toReplace))
set(QLatin1String("LD_LIBRARY_PATH"), ldLibraryPath.remove(0, toReplace.length())); set(QLatin1String("LD_LIBRARY_PATH"), ldLibraryPath.remove(0, toReplace.length()));
#endif }
} }
}; };
@@ -60,6 +62,11 @@ Q_GLOBAL_STATIC(SystemEnvironment, staticSystemEnvironment)
namespace Utils { namespace Utils {
static QChar varSeparator()
{
return HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
}
static bool sortEnvironmentItem(const EnvironmentItem &a, const EnvironmentItem &b) static bool sortEnvironmentItem(const EnvironmentItem &a, const EnvironmentItem &b)
{ {
return a.name < b.name; return a.name < b.name;
@@ -104,11 +111,10 @@ Environment::Environment(const QStringList &env)
foreach (const QString &s, env) { foreach (const QString &s, env) {
int i = s.indexOf(QLatin1Char('=')); int i = s.indexOf(QLatin1Char('='));
if (i >= 0) { if (i >= 0) {
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost())
m_values.insert(s.left(i).toUpper(), s.mid(i+1)); m_values.insert(s.left(i).toUpper(), s.mid(i+1));
#else else
m_values.insert(s.left(i), s.mid(i+1)); m_values.insert(s.left(i), s.mid(i+1));
#endif
} }
} }
} }
@@ -128,32 +134,18 @@ QStringList Environment::toStringList() const
void Environment::set(const QString &key, const QString &value) void Environment::set(const QString &key, const QString &value)
{ {
#ifdef Q_OS_WIN m_values.insert(HostOsInfo::isWindowsHost() ? key.toUpper() : key, value);
QString _key = key.toUpper();
#else
const QString &_key = key;
#endif
m_values.insert(_key, value);
} }
void Environment::unset(const QString &key) void Environment::unset(const QString &key)
{ {
#ifdef Q_OS_WIN m_values.remove(HostOsInfo::isWindowsHost() ? key.toUpper() : key);
QString _key = key.toUpper();
#else
const QString &_key = key;
#endif
m_values.remove(_key);
} }
void Environment::appendOrSet(const QString &key, const QString &value, const QString &sep) void Environment::appendOrSet(const QString &key, const QString &value, const QString &sep)
{ {
#ifdef Q_OS_WIN const QString &_key = HostOsInfo::isWindowsHost() ? key.toUpper() : key;
QString _key = key.toUpper(); QMap<QString, QString>::iterator it = m_values.find(_key);
#else
const QString &_key = key;
#endif
QMap<QString, QString>::iterator it = m_values.find(key);
if (it == m_values.end()) { if (it == m_values.end()) {
m_values.insert(_key, value); m_values.insert(_key, value);
} else { } else {
@@ -166,12 +158,8 @@ void Environment::appendOrSet(const QString &key, const QString &value, const QS
void Environment::prependOrSet(const QString&key, const QString &value, const QString &sep) void Environment::prependOrSet(const QString&key, const QString &value, const QString &sep)
{ {
#ifdef Q_OS_WIN const QString &_key = HostOsInfo::isWindowsHost() ? key.toUpper() : key;
QString _key = key.toUpper(); QMap<QString, QString>::iterator it = m_values.find(_key);
#else
const QString &_key = key;
#endif
QMap<QString, QString>::iterator it = m_values.find(key);
if (it == m_values.end()) { if (it == m_values.end()) {
m_values.insert(_key, value); m_values.insert(_key, value);
} else { } else {
@@ -184,38 +172,33 @@ void Environment::prependOrSet(const QString&key, const QString &value, const QS
void Environment::appendOrSetPath(const QString &value) void Environment::appendOrSetPath(const QString &value)
{ {
#ifdef Q_OS_WIN appendOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(varSeparator()));
const QChar sep = QLatin1Char(';');
#else
const QChar sep = QLatin1Char(':');
#endif
appendOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(sep));
} }
void Environment::prependOrSetPath(const QString &value) void Environment::prependOrSetPath(const QString &value)
{ {
#ifdef Q_OS_WIN prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(varSeparator()));
const QChar sep = QLatin1Char(';');
#else
const QChar sep = QLatin1Char(':');
#endif
prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(sep));
} }
void Environment::prependOrSetLibrarySearchPath(const QString &value) void Environment::prependOrSetLibrarySearchPath(const QString &value)
{ {
#ifdef Q_OS_MAC switch (HostOsInfo::hostOs()) {
Q_UNUSED(value); case HostOsInfo::HostOsWindows: {
// we could set DYLD_LIBRARY_PATH on Mac but it is unnecessary in practice const QChar sep = QLatin1Char(';');
#elif defined(Q_OS_WIN) const QLatin1String path("PATH");
const QChar sep = QLatin1Char(';'); prependOrSet(path, QDir::toNativeSeparators(value), QString(sep));
const QLatin1String path("PATH"); break;
prependOrSet(path, QDir::toNativeSeparators(value), QString(sep)); }
#elif defined(Q_OS_UNIX) case HostOsInfo::HostOsLinux:
const QChar sep = QLatin1Char(':'); case HostOsInfo::HostOsOtherUnix: {
const QLatin1String path("LD_LIBRARY_PATH"); const QChar sep = QLatin1Char(':');
prependOrSet(path, QDir::toNativeSeparators(value), QString(sep)); const QLatin1String path("LD_LIBRARY_PATH");
#endif prependOrSet(path, QDir::toNativeSeparators(value), QString(sep));
break;
}
default: // we could set DYLD_LIBRARY_PATH on Mac but it is unnecessary in practice
break;
}
} }
Environment Environment::systemEnvironment() Environment Environment::systemEnvironment()
@@ -233,14 +216,15 @@ QString Environment::searchInPath(const QString &executable,
{ {
QStringList execs; QStringList execs;
execs << executable; execs << executable;
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost()) {
// Check all the executable extensions on windows: // Check all the executable extensions on windows:
QStringList extensions = value(QLatin1String("PATHEXT")).split(QLatin1Char(';')); QStringList extensions = value(QLatin1String("PATHEXT")).split(QLatin1Char(';'));
// .exe.bat is legal (and run when starting new.exe), so always go through the complete list once: // .exe.bat is legal (and run when starting new.exe), so always go through the
foreach (const QString &ext, extensions) // complete list once:
execs << executable + ext.toLower(); foreach (const QString &ext, extensions)
#endif execs << executable + ext.toLower();
}
return searchInPath(execs, additionalDirs); return searchInPath(execs, additionalDirs);
} }
@@ -287,12 +271,7 @@ QString Environment::searchInPath(const QStringList &executables,
QStringList Environment::path() const QStringList Environment::path() const
{ {
#ifdef Q_OS_WIN return m_values.value(QLatin1String("PATH")).split(varSeparator(), QString::SkipEmptyParts);
const QChar sep = QLatin1Char(';');
#else
const QChar sep = QLatin1Char(':');
#endif
return m_values.value(QLatin1String("PATH")).split(sep, QString::SkipEmptyParts);
} }
QString Environment::value(const QString &key) const QString Environment::value(const QString &key) const
@@ -425,68 +404,68 @@ QString Environment::expandVariables(const QString &input) const
{ {
QString result = input; QString result = input;
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost()) {
for (int vStart = -1, i = 0; i < result.length(); ) { for (int vStart = -1, i = 0; i < result.length(); ) {
if (result.at(i++) == QLatin1Char('%')) { if (result.at(i++) == QLatin1Char('%')) {
if (vStart > 0) { if (vStart > 0) {
const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1).toUpper()); const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1).toUpper());
if (it != m_values.constEnd()) { if (it != m_values.constEnd()) {
result.replace(vStart - 1, i - vStart + 1, *it); result.replace(vStart - 1, i - vStart + 1, *it);
i = vStart - 1 + it->length(); i = vStart - 1 + it->length();
vStart = -1; vStart = -1;
} else {
vStart = i;
}
} else { } else {
vStart = i; vStart = i;
} }
} else {
vStart = i;
} }
} }
} } else {
#else enum { BASE, OPTIONALVARIABLEBRACE, VARIABLE, BRACEDVARIABLE } state = BASE;
enum { BASE, OPTIONALVARIABLEBRACE, VARIABLE, BRACEDVARIABLE } state = BASE; int vStart = -1;
int vStart = -1;
for (int i = 0; i < result.length();) { for (int i = 0; i < result.length();) {
QChar c = result.at(i++); QChar c = result.at(i++);
if (state == BASE) { if (state == BASE) {
if (c == QLatin1Char('$')) if (c == QLatin1Char('$'))
state = OPTIONALVARIABLEBRACE; state = OPTIONALVARIABLEBRACE;
} else if (state == OPTIONALVARIABLEBRACE) { } else if (state == OPTIONALVARIABLEBRACE) {
if (c == QLatin1Char('{')) { if (c == QLatin1Char('{')) {
state = BRACEDVARIABLE; state = BRACEDVARIABLE;
vStart = i; vStart = i;
} else if (c.isLetterOrNumber() || c == QLatin1Char('_')) { } else if (c.isLetterOrNumber() || c == QLatin1Char('_')) {
state = VARIABLE; state = VARIABLE;
vStart = i - 1; vStart = i - 1;
} else { } else {
state = BASE; state = BASE;
}
} else if (state == BRACEDVARIABLE) {
if (c == QLatin1Char('}')) {
const_iterator it = m_values.constFind(result.mid(vStart, i - 1 - vStart));
if (it != constEnd()) {
result.replace(vStart - 2, i - vStart + 2, *it);
i = vStart - 2 + it->length();
} }
state = BASE; } else if (state == BRACEDVARIABLE) {
} if (c == QLatin1Char('}')) {
} else if (state == VARIABLE) { const_iterator it = m_values.constFind(result.mid(vStart, i - 1 - vStart));
if (!c.isLetterOrNumber() && c != QLatin1Char('_')) { if (it != constEnd()) {
const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1)); result.replace(vStart - 2, i - vStart + 2, *it);
if (it != constEnd()) { i = vStart - 2 + it->length();
result.replace(vStart - 1, i - vStart, *it); }
i = vStart - 1 + it->length(); state = BASE;
}
} else if (state == VARIABLE) {
if (!c.isLetterOrNumber() && c != QLatin1Char('_')) {
const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1));
if (it != constEnd()) {
result.replace(vStart - 1, i - vStart, *it);
i = vStart - 1 + it->length();
}
state = BASE;
} }
state = BASE;
} }
} }
if (state == VARIABLE) {
const_iterator it = m_values.constFind(result.mid(vStart));
if (it != constEnd())
result.replace(vStart - 1, result.length() - vStart + 1, *it);
}
} }
if (state == VARIABLE) {
const_iterator it = m_values.constFind(result.mid(vStart));
if (it != constEnd())
result.replace(vStart - 1, result.length() - vStart + 1, *it);
}
#endif
return result; return result;
} }
+3 -5
View File
@@ -31,6 +31,7 @@
#include "environmentmodel.h" #include "environmentmodel.h"
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <QFont> #include <QFont>
@@ -202,11 +203,8 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
if (index.column() == 0) { if (index.column() == 0) {
//fail if a variable with the same name already exists //fail if a variable with the same name already exists
#if defined(Q_OS_WIN) const QString &newName = HostOsInfo::isWindowsHost()
const QString &newName = value.toString().toUpper(); ? value.toString().toUpper() : value.toString();
#else
const QString &newName = value.toString();
#endif
// Does the new name exist already? // Does the new name exist already?
if (d->m_resultEnvironment.hasKey(newName) || newName.isEmpty()) if (d->m_resultEnvironment.hasKey(newName) || newName.isEmpty())
return false; return false;
+5 -10
View File
@@ -31,6 +31,7 @@
#include "fileutils.h" #include "fileutils.h"
#include "savefile.h" #include "savefile.h"
#include "hostosinfo.h"
#include "qtcassert.h" #include "qtcassert.h"
#include <QDir> #include <QDir>
@@ -412,12 +413,8 @@ TempFileSaver::~TempFileSaver()
On windows filenames are compared case insensitively. On windows filenames are compared case insensitively.
*/ */
const Qt::CaseSensitivity FileName::cs
#ifdef Q_OS_WIN = HostOsInfo::isWindowsHost() ? Qt::CaseInsensitive : Qt::CaseSensitive;
Qt::CaseSensitivity FileName::cs = Qt::CaseInsensitive;
#else
Qt::CaseSensitivity FileName::cs = Qt::CaseSensitive;
#endif
FileName::FileName() FileName::FileName()
: QString() : QString()
@@ -581,10 +578,8 @@ FileName &FileName::append(QChar str)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
uint qHash(const Utils::FileName &a) uint qHash(const Utils::FileName &a)
{ {
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost())
return qHash(a.toString().toUpper()); return qHash(a.toString().toUpper());
#else
return qHash(a.toString()); return qHash(a.toString());
#endif
} }
QT_END_NAMESPACE QT_END_NAMESPACE
+1 -1
View File
@@ -175,7 +175,7 @@ public:
using QString::isNull; using QString::isNull;
using QString::clear; using QString::clear;
private: private:
static Qt::CaseSensitivity cs; static const Qt::CaseSensitivity cs;
FileName(const QString &string); FileName(const QString &string);
}; };
+11 -9
View File
@@ -31,6 +31,8 @@
#include "filewizarddialog.h" #include "filewizarddialog.h"
#include "filewizardpage.h" #include "filewizardpage.h"
#include "hostosinfo.h"
#include <QAbstractButton> #include <QAbstractButton>
/*! /*!
@@ -49,15 +51,15 @@ FileWizardDialog::FileWizardDialog(QWidget *parent) :
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setOption(QWizard::NoCancelButton, false); setOption(QWizard::NoCancelButton, false);
setOption(QWizard::NoDefaultButton, false); setOption(QWizard::NoDefaultButton, false);
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost()) {
setButtonLayout(QList<QWizard::WizardButton>() setButtonLayout(QList<QWizard::WizardButton>()
<< QWizard::CancelButton << QWizard::CancelButton
<< QWizard::Stretch << QWizard::Stretch
<< QWizard::BackButton << QWizard::BackButton
<< QWizard::NextButton << QWizard::NextButton
<< QWizard::CommitButton << QWizard::CommitButton
<< QWizard::FinishButton); << QWizard::FinishButton);
#endif }
const int filePageId = addPage(m_filePage); const int filePageId = addPage(m_filePage);
wizardProgress()->item(filePageId)->setTitle(tr("Location")); wizardProgress()->item(filePageId)->setTitle(tr("Location"));
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick())); connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
+58
View File
@@ -0,0 +1,58 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include "hostosinfo.h"
namespace Utils {
HostOsInfo::HostOs HostOsInfo::hostOs()
{
#if defined(Q_OS_WIN)
return HostOsWindows;
#elif defined(Q_OS_LINUX)
return HostOsLinux;
#elif defined(Q_OS_MAC)
return HostOsMac;
#elif defined(Q_OS_UNIX)
return HostOsOtherUnix;
#else
return HostOsOther;
#endif
}
bool HostOsInfo::isAnyUnixHost()
{
#ifdef Q_OS_UNIX
return true;
#else
return false;
#endif
}
} // namespace Utils
+53
View File
@@ -0,0 +1,53 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#ifndef HOSTOSINFO_H
#define HOSTOSINFO_H
#include "utils_global.h"
namespace Utils {
class QTCREATOR_UTILS_EXPORT HostOsInfo
{
public:
// Add more as needed.
enum HostOs { HostOsWindows, HostOsLinux, HostOsMac, HostOsOtherUnix, HostOsOther };
static HostOs hostOs();
static bool isWindowsHost() { return hostOs() == HostOsWindows; }
static bool isLinuxHost() { return hostOs() == HostOsLinux; }
static bool isMacHost() { return hostOs() == HostOsMac; }
static bool isAnyUnixHost();
};
} // namespace Utils
#endif // HOSTOSINFO_H
+3 -6
View File
@@ -30,6 +30,8 @@
#include "pathlisteditor.h" #include "pathlisteditor.h"
#include "hostosinfo.h"
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QPlainTextEdit> #include <QPlainTextEdit>
@@ -254,12 +256,7 @@ void PathListEditor::slotInsert()
QChar PathListEditor::separator() QChar PathListEditor::separator()
{ {
#ifdef Q_OS_WIN return HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
static const QChar rc(QLatin1Char(';'));
#else
static const QChar rc(QLatin1Char(':'));
#endif
return rc;
} }
// Add a button "Import from 'Path'" // Add a button "Import from 'Path'"
+6 -7
View File
@@ -30,6 +30,8 @@
#include "stringutils.h" #include "stringutils.h"
#include "hostosinfo.h"
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QFileInfo> #include <QFileInfo>
@@ -95,19 +97,17 @@ QTCREATOR_UTILS_EXPORT QString commonPath(const QStringList &files)
lastSeparatorPos = common.lastIndexOf(QLatin1Char('\\')); lastSeparatorPos = common.lastIndexOf(QLatin1Char('\\'));
if (lastSeparatorPos == -1) if (lastSeparatorPos == -1)
return QString(); return QString();
#ifdef Q_OS_UNIX if (HostOsInfo::isAnyUnixHost() && lastSeparatorPos == 0) // Unix: "/a", "/b" -> '/'
if (lastSeparatorPos == 0) // Unix: "/a", "/b" -> '/'
lastSeparatorPos = 1; lastSeparatorPos = 1;
#endif
common.truncate(lastSeparatorPos); common.truncate(lastSeparatorPos);
return common; return common;
} }
QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path) QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path)
{ {
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost())
QString outPath = path; return path;
#else
static const QString homePath = QDir::homePath(); static const QString homePath = QDir::homePath();
QFileInfo fi(QDir::cleanPath(path)); QFileInfo fi(QDir::cleanPath(path));
@@ -116,7 +116,6 @@ QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path)
outPath = QLatin1Char('~') + outPath.mid(homePath.size()); outPath = QLatin1Char('~') + outPath.mid(homePath.size());
else else
outPath = path; outPath = path;
#endif
return outPath; return outPath;
} }
+3 -5
View File
@@ -30,6 +30,8 @@
#include "stylehelper.h" #include "stylehelper.h"
#include "hostosinfo.h"
#include <QPixmapCache> #include <QPixmapCache>
#include <QWidget> #include <QWidget>
#include <QRect> #include <QRect>
@@ -69,11 +71,7 @@ QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int
qreal StyleHelper::sidebarFontSize() qreal StyleHelper::sidebarFontSize()
{ {
#if defined(Q_OS_MAC) return HostOsInfo::isMacHost() ? 10 : 7.5;
return 10;
#else
return 7.5;
#endif
} }
QPalette StyleHelper::sidebarFontPalette(const QPalette &original) QPalette StyleHelper::sidebarFontPalette(const QPalette &original)
+11 -21
View File
@@ -29,6 +29,8 @@
**************************************************************************/ **************************************************************************/
#include "synchronousprocess.h" #include "synchronousprocess.h"
#include "hostosinfo.h"
#include <qtcassert.h> #include <qtcassert.h>
#include <QDebug> #include <QDebug>
@@ -599,18 +601,6 @@ bool SynchronousProcess::stopProcess(QProcess &p)
// Path utilities // Path utilities
enum OS_Type { OS_Mac, OS_Windows, OS_Unix };
#ifdef Q_OS_WIN
static const OS_Type pathOS = OS_Windows;
#else
# ifdef Q_OS_MAC
static const OS_Type pathOS = OS_Mac;
# else
static const OS_Type pathOS = OS_Unix;
# endif
#endif
// Locate a binary in a directory, applying all kinds of // Locate a binary in a directory, applying all kinds of
// extensions the operating system supports. // extensions the operating system supports.
static QString checkBinary(const QDir &dir, const QString &binary) static QString checkBinary(const QDir &dir, const QString &binary)
@@ -622,16 +612,18 @@ static QString checkBinary(const QDir &dir, const QString &binary)
// Does the OS have some weird extension concept or does the // Does the OS have some weird extension concept or does the
// binary have a 3 letter extension? // binary have a 3 letter extension?
if (pathOS == OS_Unix) if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost())
return QString(); return QString();
const int dotIndex = binary.lastIndexOf(QLatin1Char('.')); const int dotIndex = binary.lastIndexOf(QLatin1Char('.'));
if (dotIndex != -1 && dotIndex == binary.size() - 4) if (dotIndex != -1 && dotIndex == binary.size() - 4)
return QString(); return QString();
switch (pathOS) { switch (HostOsInfo::hostOs()) {
case OS_Unix: case HostOsInfo::HostOsLinux:
case HostOsInfo::HostOsOtherUnix:
case HostOsInfo::HostOsOther:
break; break;
case OS_Windows: { case HostOsInfo::HostOsWindows: {
static const char *windowsExtensions[] = {".cmd", ".bat", ".exe", ".com" }; static const char *windowsExtensions[] = {".cmd", ".bat", ".exe", ".com" };
// Check the Windows extensions using the order // Check the Windows extensions using the order
const int windowsExtensionCount = sizeof(windowsExtensions)/sizeof(const char*); const int windowsExtensionCount = sizeof(windowsExtensions)/sizeof(const char*);
@@ -642,7 +634,7 @@ static QString checkBinary(const QDir &dir, const QString &binary)
} }
} }
break; break;
case OS_Mac: { case HostOsInfo::HostOsMac: {
// Check for Mac app folders // Check for Mac app folders
const QFileInfo appFolder(dir.filePath(binary + QLatin1String(".app"))); const QFileInfo appFolder(dir.filePath(binary + QLatin1String(".app")));
if (appFolder.isDir()) { if (appFolder.isDir()) {
@@ -667,7 +659,7 @@ QString SynchronousProcess::locateBinary(const QString &path, const QString &bin
return checkBinary(absInfo.dir(), absInfo.fileName()); return checkBinary(absInfo.dir(), absInfo.fileName());
// Windows finds binaries in the current directory // Windows finds binaries in the current directory
if (pathOS == OS_Windows) { if (HostOsInfo::isWindowsHost()) {
const QString currentDirBinary = checkBinary(QDir::current(), binary); const QString currentDirBinary = checkBinary(QDir::current(), binary);
if (!currentDirBinary.isEmpty()) if (!currentDirBinary.isEmpty())
return currentDirBinary; return currentDirBinary;
@@ -694,9 +686,7 @@ QString SynchronousProcess::locateBinary(const QString &binary)
QChar SynchronousProcess::pathSeparator() QChar SynchronousProcess::pathSeparator()
{ {
if (pathOS == OS_Windows) return HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
return QLatin1Char(';');
return QLatin1Char(':');
} }
} // namespace Utils } // namespace Utils
+4 -2
View File
@@ -13,10 +13,12 @@ lessThan(QT_MAJOR_VERSION, 5) {
} }
HEADERS += \ HEADERS += \
proxyaction.h proxyaction.h \
hostosinfo.h
SOURCES += \ SOURCES += \
proxyaction.cpp proxyaction.cpp \
hostosinfo.cpp
win32: LIBS += -lUser32 win32: LIBS += -lUser32
# PortsGatherer # PortsGatherer
+2
View File
@@ -154,6 +154,8 @@ QtcLibrary {
"utils_global.h", "utils_global.h",
"wizard.cpp", "wizard.cpp",
"wizard.h", "wizard.h",
"hostosinfo.cpp",
"hostosinfo.h",
"persistentsettings.h", "persistentsettings.h",
"settingsselector.h", "settingsselector.h",
"buildablehelperlibrary.cpp", "buildablehelperlibrary.cpp",
+14 -13
View File
@@ -33,6 +33,7 @@
#include "ui_addnewavddialog.h" #include "ui_addnewavddialog.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/hostosinfo.h>
#include <utils/persistentsettings.h> #include <utils/persistentsettings.h>
#include <QDateTime> #include <QDateTime>
@@ -268,19 +269,19 @@ FileName AndroidConfigurations::adbToolPath() const
FileName AndroidConfigurations::androidToolPath() const FileName AndroidConfigurations::androidToolPath() const
{ {
#ifdef Q_OS_WIN32 if (HostOsInfo::isWindowsHost()) {
// I want to switch from using android.bat to using an executable. All it really does is call // I want to switch from using android.bat to using an executable. All it really does is call
// Java and I've made some progress on it. So if android.exe exists, return that instead. // Java and I've made some progress on it. So if android.exe exists, return that instead.
FileName path = m_config.sdkLocation; FileName path = m_config.sdkLocation;
path.appendPath(QLatin1String("tools/android"ANDROID_EXE_SUFFIX)); path.appendPath(QLatin1String("tools/android"ANDROID_EXE_SUFFIX));
if (path.toFileInfo().exists()) if (path.toFileInfo().exists())
return path; return path;
path = m_config.sdkLocation; path = m_config.sdkLocation;
return path.appendPath(QLatin1String("tools/android"ANDROID_BAT_SUFFIX)); return path.appendPath(QLatin1String("tools/android"ANDROID_BAT_SUFFIX));
#else } else {
FileName path = m_config.sdkLocation; FileName path = m_config.sdkLocation;
return path.appendPath(QLatin1String("tools/android")); return path.appendPath(QLatin1String("tools/android"));
#endif }
} }
FileName AndroidConfigurations::antToolPath() const FileName AndroidConfigurations::antToolPath() const
+11 -10
View File
@@ -36,6 +36,8 @@
#include "androidconstants.h" #include "androidconstants.h"
#include <utils/hostosinfo.h>
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
#include <QProcess> #include <QProcess>
@@ -336,16 +338,15 @@ void AndroidSettingsWidget::browseNDKLocation()
void AndroidSettingsWidget::browseAntLocation() void AndroidSettingsWidget::browseAntLocation()
{ {
QString dir = QDir::homePath(); QString dir;
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC) QString antApp;
dir = QLatin1String("/usr/bin/ant"); if (Utils::HostOsInfo::isWindowsHost()) {
QLatin1String antApp("ant"); dir = QDir::homePath();
#elif defined(Q_OS_WIN) antApp = QLatin1String("ant.bat");
QLatin1String antApp("ant.bat"); } else {
#elif defined(Q_OS_DARWIN) dir = QLatin1String("/usr/bin/ant");
dir = QLatin1String("/opt/local/bin/ant"); antApp = QLatin1String("ant");
QLatin1String antApp("ant"); }
#endif
const QString file = const QString file =
QFileDialog::getOpenFileName(this, tr("Select ant Script"), dir, antApp); QFileDialog::getOpenFileName(this, tr("Select ant Script"), dir, antApp);
if (!file.length()) if (!file.length())
+21 -18
View File
@@ -42,6 +42,7 @@
#include <qtsupport/qtversionmanager.h> #include <qtsupport/qtversionmanager.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <QDir> #include <QDir>
#include <QFormLayout> #include <QFormLayout>
@@ -53,6 +54,7 @@ namespace Internal {
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
using namespace Utils;
static const char ANDROID_QT_VERSION_KEY[] = "Qt4ProjectManager.Android.QtVersion"; static const char ANDROID_QT_VERSION_KEY[] = "Qt4ProjectManager.Android.QtVersion";
@@ -85,7 +87,7 @@ bool AndroidToolChain::isValid() const
return GccToolChain::isValid() && m_qtVersionId >= 0 && targetAbi().isValid(); return GccToolChain::isValid() && m_qtVersionId >= 0 && targetAbi().isValid();
} }
void AndroidToolChain::addToEnvironment(Utils::Environment &env) const void AndroidToolChain::addToEnvironment(Environment &env) const
{ {
// TODO this vars should be configurable in projects -> build tab // TODO this vars should be configurable in projects -> build tab
@@ -96,18 +98,23 @@ void AndroidToolChain::addToEnvironment(Utils::Environment &env) const
|| QtSupport::QtProfileInformation::qtVersion(qt4pro->activeTarget()->profile())->type() != QLatin1String(Constants::ANDROIDQT)) || QtSupport::QtProfileInformation::qtVersion(qt4pro->activeTarget()->profile())->type() != QLatin1String(Constants::ANDROIDQT))
return; return;
QString ndk_host = QLatin1String( QString ndkHost;
#if defined(Q_OS_LINUX) switch (HostOsInfo::hostOs()) {
"linux-x86" case HostOsInfo::HostOsLinux:
#elif defined(Q_OS_WIN) ndkHost = QLatin1String("linux-x86");
"windows" break;
#elif defined(Q_OS_MAC) case HostOsInfo::HostOsWindows:
"darwin-x86" ndkHost = QLatin1String("windows");
#endif break;
); case HostOsInfo::HostOsMac:
ndkHost = QLatin1String("darwin-x86");
break;
default:
break;
}
// this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info) // this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info)
env.set(QLatin1String("ANDROID_NDK_HOST"), ndk_host); env.set(QLatin1String("ANDROID_NDK_HOST"), ndkHost);
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::instance().config().ndkLocation.toUserOutput()); env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::instance().config().ndkLocation.toUserOutput());
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture())); env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture()));
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture())); env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture()));
@@ -147,18 +154,14 @@ bool AndroidToolChain::fromMap(const QVariantMap &data)
return isValid(); return isValid();
} }
QList<Utils::FileName> AndroidToolChain::suggestedMkspecList() const QList<FileName> AndroidToolChain::suggestedMkspecList() const
{ {
return QList<Utils::FileName>()<< Utils::FileName::fromString(QLatin1String("android-g++")); return QList<FileName>()<< FileName::fromString(QLatin1String("android-g++"));
} }
QString AndroidToolChain::makeCommand() const QString AndroidToolChain::makeCommand() const
{ {
#if defined(Q_OS_WIN) return HostOsInfo::isWindowsHost() ? QLatin1String("ma-make.exe") : QLatin1String("make");
return QLatin1String("ma-make.exe");
#else
return QLatin1String("make");
#endif
} }
void AndroidToolChain::setQtVersionId(int id) void AndroidToolChain::setQtVersionId(int id)
+4 -4
View File
@@ -59,6 +59,7 @@
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/runextensions.h> #include <utils/runextensions.h>
#include <vcsbase/basevcseditorfactory.h> #include <vcsbase/basevcseditorfactory.h>
@@ -681,11 +682,10 @@ bool ClearCasePlugin::vcsUndoHijack(const QString &workingDir, const QString &fi
QStringList args(QLatin1String("update")); QStringList args(QLatin1String("update"));
args << QLatin1String(keep ? "-rename" : "-overwrite"); args << QLatin1String(keep ? "-rename" : "-overwrite");
args << QLatin1String("-log"); args << QLatin1String("-log");
#ifdef Q_OS_WIN32 if (Utils::HostOsInfo::isWindowsHost())
args << QLatin1String("NUL"); args << QLatin1String("NUL");
#else else
args << QLatin1String("/dev/null"); args << QLatin1String("/dev/null");
#endif
args << QDir::toNativeSeparators(fileName); args << QDir::toNativeSeparators(fileName);
const ClearCaseResponse response = const ClearCaseResponse response =
+3 -3
View File
@@ -33,6 +33,7 @@
#include "clearcasesettings.h" #include "clearcasesettings.h"
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <QSettings> #include <QSettings>
@@ -58,9 +59,8 @@ enum { defaultTimeOutS = 30, defaultHistoryCount = 50 };
static QString defaultCommand() static QString defaultCommand()
{ {
QString rc(QLatin1String("cleartool")); QString rc(QLatin1String("cleartool"));
#if defined(Q_OS_WIN32) if (Utils::HostOsInfo::isWindowsHost())
rc.append(QLatin1String(".exe")); rc.append(QLatin1String(".exe"));
#endif
return rc; return rc;
} }
@@ -34,6 +34,8 @@
#include "icontext.h" #include "icontext.h"
#include "id.h" #include "id.h"
#include <utils/hostosinfo.h>
#include <QDebug> #include <QDebug>
#include <QTextStream> #include <QTextStream>
@@ -438,9 +440,8 @@ static QString msgActionWarning(QAction *newAction, int k, QAction *oldAction)
void Action::addOverrideAction(QAction *action, const Core::Context &context, bool scriptable) void Action::addOverrideAction(QAction *action, const Core::Context &context, bool scriptable)
{ {
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
action->setIconVisibleInMenu(false); action->setIconVisibleInMenu(false);
#endif
if (isEmpty()) if (isEmpty())
m_action->initialize(action); m_action->initialize(action);
if (context.isEmpty()) { if (context.isEmpty()) {
@@ -37,6 +37,7 @@
#include "icore.h" #include "icore.h"
#include "id.h" #include "id.h"
#include <utils/hostosinfo.h>
#include <utils/treewidgetcolumnstretcher.h> #include <utils/treewidgetcolumnstretcher.h>
#include <QKeyEvent> #include <QKeyEvent>
@@ -166,18 +167,18 @@ bool CommandMappings::filter(const QString &filterString, QTreeWidgetItem *item)
int columnCount = item->columnCount(); int columnCount = item->columnCount();
for (int i = 0; !visible && i < columnCount; ++i) { for (int i = 0; !visible && i < columnCount; ++i) {
QString text = item->text(i); QString text = item->text(i);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
// accept e.g. Cmd+E in the filter. the text shows special fancy characters for Cmd // accept e.g. Cmd+E in the filter. the text shows special fancy characters for Cmd
if (i == columnCount - 1) { if (i == columnCount - 1) {
QKeySequence key = QKeySequence::fromString(text, QKeySequence::NativeText); QKeySequence key = QKeySequence::fromString(text, QKeySequence::NativeText);
if (!key.isEmpty()) { if (!key.isEmpty()) {
text = key.toString(QKeySequence::PortableText); text = key.toString(QKeySequence::PortableText);
text.replace(QLatin1String("Ctrl"), QLatin1String("Cmd")); text.replace(QLatin1String("Ctrl"), QLatin1String("Cmd"));
text.replace(QLatin1String("Meta"), QLatin1String("Ctrl")); text.replace(QLatin1String("Meta"), QLatin1String("Ctrl"));
text.replace(QLatin1String("Alt"), QLatin1String("Opt")); text.replace(QLatin1String("Alt"), QLatin1String("Opt"));
}
} }
} }
#endif
visible |= (bool)text.contains(filterString, Qt::CaseInsensitive); visible |= (bool)text.contains(filterString, Qt::CaseInsensitive);
} }
+10 -9
View File
@@ -41,6 +41,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
@@ -604,15 +605,15 @@ void BaseFileWizard::setupWizard(QWizard *w)
w->setOption(QWizard::NoBackButtonOnStartPage, true); w->setOption(QWizard::NoBackButtonOnStartPage, true);
w->setWindowFlags(w->windowFlags() & ~Qt::WindowContextHelpButtonHint); w->setWindowFlags(w->windowFlags() & ~Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
w->setButtonLayout(QList<QWizard::WizardButton>() w->setButtonLayout(QList<QWizard::WizardButton>()
<< QWizard::CancelButton << QWizard::CancelButton
<< QWizard::Stretch << QWizard::Stretch
<< QWizard::BackButton << QWizard::BackButton
<< QWizard::NextButton << QWizard::NextButton
<< QWizard::CommitButton << QWizard::CommitButton
<< QWizard::FinishButton); << QWizard::FinishButton);
#endif }
} }
/*! /*!
@@ -31,6 +31,7 @@
#include "externaltoolconfig.h" #include "externaltoolconfig.h"
#include "ui_externaltoolconfig.h" #include "ui_externaltoolconfig.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
@@ -351,13 +352,13 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
tool->setDescription(tr("This tool prints a line of useful text")); tool->setDescription(tr("This tool prints a line of useful text"));
//: Sample external tool text //: Sample external tool text
const QString text = tr("Useful text"); const QString text = tr("Useful text");
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
tool->setExecutables(QStringList(QLatin1String("cmd"))); tool->setExecutables(QStringList(QLatin1String("cmd")));
tool->setArguments(QLatin1String("/c echo ") + text); tool->setArguments(QLatin1String("/c echo ") + text);
#else } else {
tool->setExecutables(QStringList(QLatin1String("echo"))); tool->setExecutables(QStringList(QLatin1String("echo")));
tool->setArguments(text); tool->setArguments(text);
#endif }
int pos; int pos;
QModelIndex parent; QModelIndex parent;
@@ -34,6 +34,7 @@
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <utils/hostosinfo.h>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@@ -54,12 +55,10 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_MAC
// QDialogButtonBox's behavior for "destructive" is wrong, the "do not save" should be left-aligned // QDialogButtonBox's behavior for "destructive" is wrong, the "do not save" should be left-aligned
QDialogButtonBox::ButtonRole discardButtonRole = QDialogButtonBox::ResetRole; const QDialogButtonBox::ButtonRole discardButtonRole = Utils::HostOsInfo::isMacHost()
#else ? QDialogButtonBox::ResetRole : QDialogButtonBox::DestructiveRole;
QDialogButtonBox::ButtonRole discardButtonRole = QDialogButtonBox::DestructiveRole;
#endif
QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Do not Save"), discardButtonRole); QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Do not Save"), discardButtonRole);
m_ui.buttonBox->button(QDialogButtonBox::Save)->setDefault(true); m_ui.buttonBox->button(QDialogButtonBox::Save)->setDefault(true);
m_ui.treeWidget->setFocus(); m_ui.treeWidget->setFocus();
@@ -86,9 +85,8 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
m_ui.treeWidget->resizeColumnToContents(0); m_ui.treeWidget->resizeColumnToContents(0);
m_ui.treeWidget->selectAll(); m_ui.treeWidget->selectAll();
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
m_ui.treeWidget->setAlternatingRowColors(true); m_ui.treeWidget->setAlternatingRowColors(true);
#endif
adjustButtonWidths(); adjustButtonWidths();
updateSaveButton(); updateSaveButton();
@@ -135,13 +133,13 @@ void SaveItemsDialog::adjustButtonWidths()
if (hint > maxTextWidth) if (hint > maxTextWidth)
maxTextWidth = hint; maxTextWidth = hint;
} }
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
QPushButton *cancelButton = m_ui.buttonBox->button(QDialogButtonBox::Cancel); QPushButton *cancelButton = m_ui.buttonBox->button(QDialogButtonBox::Cancel);
int cancelButtonWidth = cancelButton->sizeHint().width(); int cancelButtonWidth = cancelButton->sizeHint().width();
if (cancelButtonWidth > maxTextWidth) if (cancelButtonWidth > maxTextWidth)
maxTextWidth = cancelButtonWidth; maxTextWidth = cancelButtonWidth;
cancelButton->setMinimumWidth(maxTextWidth); cancelButton->setMinimumWidth(maxTextWidth);
#endif }
saveButton->setMinimumWidth(maxTextWidth); saveButton->setMinimumWidth(maxTextWidth);
} }
@@ -33,6 +33,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include "icore.h" #include "icore.h"
#include <utils/hostosinfo.h>
#include <utils/filterlineedit.h> #include <utils/filterlineedit.h>
#include <QSettings> #include <QSettings>
@@ -295,11 +296,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
createGui(); createGui();
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
setWindowTitle(tr("Preferences")); setWindowTitle(tr("Preferences"));
#else else
setWindowTitle(tr("Options")); setWindowTitle(tr("Options"));
#endif
m_model->setPages(m_pages, m_model->setPages(m_pages,
ExtensionSystem::PluginManager::getObjects<IOptionsPageProvider>()); ExtensionSystem::PluginManager::getObjects<IOptionsPageProvider>());
+13 -17
View File
@@ -42,6 +42,7 @@
#include "vcsmanager.h" #include "vcsmanager.h"
#include "coreconstants.h" #include "coreconstants.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/reloadpromptutils.h> #include <utils/reloadpromptutils.h>
@@ -178,17 +179,17 @@ QFileSystemWatcher *DocumentManagerPrivate::fileWatcher()
QFileSystemWatcher *DocumentManagerPrivate::linkWatcher() QFileSystemWatcher *DocumentManagerPrivate::linkWatcher()
{ {
#ifdef Q_OS_UNIX if (Utils::HostOsInfo::isAnyUnixHost()) {
if (!m_linkWatcher) { if (!m_linkWatcher) {
m_linkWatcher = new QFileSystemWatcher(m_instance); m_linkWatcher = new QFileSystemWatcher(m_instance);
m_linkWatcher->setObjectName(QLatin1String("_qt_autotest_force_engine_poller")); m_linkWatcher->setObjectName(QLatin1String("_qt_autotest_force_engine_poller"));
QObject::connect(m_linkWatcher, SIGNAL(fileChanged(QString)), QObject::connect(m_linkWatcher, SIGNAL(fileChanged(QString)),
m_instance, SLOT(changedFile(QString))); m_instance, SLOT(changedFile(QString)));
}
return m_linkWatcher;
} }
return m_linkWatcher;
#else
return fileWatcher(); return fileWatcher();
#endif
} }
DocumentManagerPrivate::DocumentManagerPrivate(QMainWindow *mw) : DocumentManagerPrivate::DocumentManagerPrivate(QMainWindow *mw) :
@@ -197,11 +198,7 @@ DocumentManagerPrivate::DocumentManagerPrivate(QMainWindow *mw) :
m_linkWatcher(0), m_linkWatcher(0),
m_blockActivated(false), m_blockActivated(false),
m_lastVisitedDirectory(QDir::currentPath()), m_lastVisitedDirectory(QDir::currentPath()),
#ifdef Q_OS_MAC // Creator is in bizarre places when launched via finder. m_useProjectsDirectory(Utils::HostOsInfo::isMacHost()), // Creator is in bizarre places when launched via finder.
m_useProjectsDirectory(true),
#else
m_useProjectsDirectory(false),
#endif
m_blockedIDocument(0) m_blockedIDocument(0)
{ {
} }
@@ -489,9 +486,8 @@ QString DocumentManager::fixFileName(const QString &fileName, FixMode fixmode)
s = QDir::cleanPath(s); s = QDir::cleanPath(s);
} }
s = QDir::toNativeSeparators(s); s = QDir::toNativeSeparators(s);
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost())
s = s.toLower(); s = s.toLower();
#endif
return s; return s;
} }
@@ -61,6 +61,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/consoleprocess.h> #include <utils/consoleprocess.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDateTime> #include <QDateTime>
@@ -1700,9 +1701,8 @@ void EditorManager::updateActions()
fName = curEditor->displayName(); fName = curEditor->displayName();
} }
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
window()->setWindowModified(curEditor->document()->isModified()); window()->setWindowModified(curEditor->document()->isModified());
#endif
bool ww = curEditor->document()->isModified() && curEditor->document()->isFileReadOnly(); bool ww = curEditor->document()->isModified() && curEditor->document()->isFileReadOnly();
if (ww != curEditor->document()->hasWriteWarning()) { if (ww != curEditor->document()->hasWriteWarning()) {
curEditor->document()->setWriteWarning(ww); curEditor->document()->setWriteWarning(ww);
@@ -1739,10 +1739,8 @@ void EditorManager::updateActions()
curEditor->document()->infoBar()->removeInfo(QLatin1String("Core.EditorManager.MakeWritable")); curEditor->document()->infoBar()->removeInfo(QLatin1String("Core.EditorManager.MakeWritable"));
} }
} }
#ifdef Q_OS_MAC } else /* curEditor */ if (HostOsInfo::isMacHost()) {
} else { // curEditor
window()->setWindowModified(false); window()->setWindowModified(false);
#endif
} }
setCloseSplitEnabled(d->m_splitter, d->m_splitter->isSplitter()); setCloseSplitEnabled(d->m_splitter, d->m_splitter->isSplitter());
@@ -34,6 +34,7 @@
#include "editorview.h" #include "editorview.h"
#include "idocument.h" #include "idocument.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QFocusEvent> #include <QFocusEvent>
@@ -61,16 +62,14 @@ OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) :
m_editorList->setIndentation(0); m_editorList->setIndentation(0);
m_editorList->setSelectionMode(QAbstractItemView::SingleSelection); m_editorList->setSelectionMode(QAbstractItemView::SingleSelection);
m_editorList->setTextElideMode(Qt::ElideMiddle); m_editorList->setTextElideMode(Qt::ElideMiddle);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
m_editorList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); m_editorList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
#endif
m_editorList->installEventFilter(this); m_editorList->installEventFilter(this);
// We disable the frame on this list view and use a QFrame around it instead. // We disable the frame on this list view and use a QFrame around it instead.
// This improves the look with QGTKStyle. // This improves the look with QGTKStyle.
#ifndef Q_OS_MAC if (!Utils::HostOsInfo::isMacHost())
setFrameStyle(m_editorList->frameStyle()); setFrameStyle(m_editorList->frameStyle());
#endif
m_editorList->setFrameStyle(QFrame::NoFrame); m_editorList->setFrameStyle(QFrame::NoFrame);
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);
+5 -4
View File
@@ -44,6 +44,7 @@
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h> #include <coreplugin/actionmanager/command.h>
#include <utils/hostosinfo.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
@@ -152,10 +153,10 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
d->m_forwardButton= new QToolButton(this); d->m_forwardButton= new QToolButton(this);
d->m_forwardButton->setDefaultAction(d->m_goForwardAction); d->m_forwardButton->setDefaultAction(d->m_goForwardAction);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
d->m_horizontalSplitAction->setIconVisibleInMenu(false); d->m_horizontalSplitAction->setIconVisibleInMenu(false);
d->m_verticalSplitAction->setIconVisibleInMenu(false); d->m_verticalSplitAction->setIconVisibleInMenu(false);
#endif }
d->m_splitButton->setIcon(QIcon(QLatin1String(Constants::ICON_SPLIT_HORIZONTAL))); d->m_splitButton->setIcon(QIcon(QLatin1String(Constants::ICON_SPLIT_HORIZONTAL)));
d->m_splitButton->setToolTip(tr("Split")); d->m_splitButton->setToolTip(tr("Split"));
+2 -3
View File
@@ -29,6 +29,7 @@
**************************************************************************/ **************************************************************************/
#include "fancytabwidget.h" #include "fancytabwidget.h"
#include <utils/hostosinfo.h>
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
@@ -289,8 +290,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
} else { } else {
painter->setPen(selected ? Utils::StyleHelper::panelTextColor() : QColor(255, 255, 255, 120)); painter->setPen(selected ? Utils::StyleHelper::panelTextColor() : QColor(255, 255, 255, 120));
} }
#ifndef Q_OS_MAC if (!Utils::HostOsInfo::isMacHost() && !selected && enabled) {
if (!selected && enabled) {
painter->save(); painter->save();
int fader = int(m_tabs[tabIndex]->fader()); int fader = int(m_tabs[tabIndex]->fader());
QLinearGradient grad(rect.topLeft(), rect.topRight()); QLinearGradient grad(rect.topLeft(), rect.topRight());
@@ -303,7 +303,6 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
painter->drawLine(rect.bottomLeft(), rect.bottomRight()); painter->drawLine(rect.bottomLeft(), rect.bottomRight());
painter->restore(); painter->restore();
} }
#endif
if (!enabled) if (!enabled)
painter->setOpacity(0.7); painter->setOpacity(0.7);
+6 -4
View File
@@ -31,6 +31,7 @@
#include "fileiconprovider.h" #include "fileiconprovider.h"
#include "mimedatabase.h" #include "mimedatabase.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QApplication> #include <QApplication>
@@ -44,6 +45,8 @@
#include <QIcon> #include <QIcon>
#include <QStyle> #include <QStyle>
using namespace Utils;
/*! /*!
\class Core::FileIconProvider \class Core::FileIconProvider
@@ -139,14 +142,13 @@ QIcon FileIconProvider::icon(const QFileInfo &fileInfo) const
} }
} }
// Get icon from OS. // Get icon from OS.
#if defined(Q_WS_WIN) || defined(Q_OS_MAC) if (HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost())
return QFileIconProvider::icon(fileInfo); return QFileIconProvider::icon(fileInfo);
#else
// File icons are unknown on linux systems. // File icons are unknown on linux systems.
return (fileInfo.isDir()) ? return (fileInfo.isDir()) ?
QFileIconProvider::icon(fileInfo) : QFileIconProvider::icon(fileInfo) :
d->m_unknownFileIcon; d->m_unknownFileIcon;
#endif
} }
/*! /*!
+2 -5
View File
@@ -48,6 +48,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/hostosinfo.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -198,11 +199,7 @@ QWidget *OutputPaneManager::buttonsWidget()
// Return shortcut as Ctrl+<number> // Return shortcut as Ctrl+<number>
static inline int paneShortCut(int number) static inline int paneShortCut(int number)
{ {
#ifdef Q_OS_MAC const int modifier = Utils::HostOsInfo::isMacHost() ? Qt::CTRL : Qt::ALT;
int modifier = Qt::CTRL;
#else
int modifier = Qt::ALT;
#endif
return modifier | (Qt::Key_0 + number); return modifier | (Qt::Key_0 + number);
} }
+4 -6
View File
@@ -38,6 +38,7 @@
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/messageoutputwindow.h> #include <coreplugin/messageoutputwindow.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QListWidget> #include <QListWidget>
@@ -77,12 +78,9 @@ bool CodePasterProtocol::checkConfiguration(QString *errorMessage)
const QString hostName = m_page->hostName(); const QString hostName = m_page->hostName();
if (hostName.isEmpty()) { if (hostName.isEmpty()) {
if (errorMessage) { if (errorMessage) {
*errorMessage = *errorMessage = Utils::HostOsInfo::isMacHost()
#ifdef Q_OS_MAC ? tr("No Server defined in the CodePaster preferences.")
tr("No Server defined in the CodePaster preferences."); : tr("No Server defined in the CodePaster options.");
#else
tr("No Server defined in the CodePaster options.");
#endif
} }
return false; return false;
} }
+3 -3
View File
@@ -31,6 +31,7 @@
#include "pasteselectdialog.h" #include "pasteselectdialog.h"
#include "protocol.h" #include "protocol.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDebug> #include <QDebug>
@@ -56,9 +57,8 @@ PasteSelectDialog::PasteSelectDialog(const QList<Protocol*> &protocols,
connect(m_refreshButton, SIGNAL(clicked()), this, SLOT(list())); connect(m_refreshButton, SIGNAL(clicked()), this, SLOT(list()));
m_ui.listWidget->setSelectionMode(QAbstractItemView::SingleSelection); m_ui.listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
#ifndef Q_OS_MACX if (!Utils::HostOsInfo::isMacHost())
m_ui.listWidget->setFrameStyle(QFrame::NoFrame); m_ui.listWidget->setFrameStyle(QFrame::NoFrame);
#endif // Q_OS_MACX
// Proportional formatting of columns for CodePaster // Proportional formatting of columns for CodePaster
QFont listFont = m_ui.listWidget->font(); QFont listFont = m_ui.listWidget->font();
listFont.setFamily(QLatin1String("Courier")); listFont.setFamily(QLatin1String("Courier"));
+4 -5
View File
@@ -31,6 +31,8 @@
#include "settings.h" #include "settings.h"
#include "pastebindotcomprotocol.h" #include "pastebindotcomprotocol.h"
#include <utils/hostosinfo.h>
#include <QVariant> #include <QVariant>
#include <QSettings> #include <QSettings>
@@ -65,11 +67,8 @@ void Settings::toSettings(QSettings *settings) const
void Settings::fromSettings(const QSettings *settings) void Settings::fromSettings(const QSettings *settings)
{ {
const QString rootKey = QLatin1String(groupC) + QLatin1Char('/'); const QString rootKey = QLatin1String(groupC) + QLatin1Char('/');
#ifdef Q_OS_WIN const char * const envKey = Utils::HostOsInfo::isWindowsHost() ? "USERNAME" : "USER";
const QString defaultUser = QString::fromLocal8Bit(qgetenv("USERNAME")); const QString defaultUser = QString::fromLocal8Bit(qgetenv(envKey));
#else
const QString defaultUser = QString::fromLocal8Bit(qgetenv("USER"));
#endif
username = settings->value(rootKey + QLatin1String(userNameKeyC), defaultUser).toString(); username = settings->value(rootKey + QLatin1String(userNameKeyC), defaultUser).toString();
protocol = settings->value(rootKey + QLatin1String(defaultProtocolKeyC), PasteBinDotComProtocol::protocolName()).toString(); protocol = settings->value(rootKey + QLatin1String(defaultProtocolKeyC), PasteBinDotComProtocol::protocolName()).toString();
copyToClipboard = settings->value(rootKey + QLatin1String(copyToClipboardKeyC), true).toBool(); copyToClipboard = settings->value(rootKey + QLatin1String(copyToClipboardKeyC), true).toBool();
+11 -10
View File
@@ -55,6 +55,7 @@
#include <texteditor/texteditorplugin.h> #include <texteditor/texteditorplugin.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <utils/hostosinfo.h>
#include <cpptools/ModelManagerInterface.h> #include <cpptools/ModelManagerInterface.h>
#include <cpptools/cpptoolsconstants.h> #include <cpptools/cpptoolsconstants.h>
#include <cpptools/cpptoolssettings.h> #include <cpptools/cpptoolssettings.h>
@@ -84,16 +85,16 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
<< QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE) << QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)
<< QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE); << QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE);
#if !defined(Q_OS_MAC) && !defined(Q_WS_WIN) if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance(); Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase(); Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase();
iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_cpp.png")), iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_cpp.png")),
mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE))); mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)));
iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_c.png")), iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_c.png")),
mimeDatabase->findByType(QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE))); mimeDatabase->findByType(QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)));
iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_h.png")), iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_h.png")),
mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE))); mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE)));
#endif }
} }
Core::Id CppEditorFactory::id() const Core::Id CppEditorFactory::id() const
+3 -5
View File
@@ -39,6 +39,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/hostosinfo.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <QSettings> #include <QSettings>
@@ -150,11 +151,8 @@ static bool keyWordReplacement(const QString &keyWord,
return true; return true;
} }
if (keyWord == QLatin1String("%USER%")) { if (keyWord == QLatin1String("%USER%")) {
#ifdef Q_OS_WIN const char * const envKey = Utils::HostOsInfo::isWindowsHost() ? "USERNAME" : "USER";
*value = QString::fromLocal8Bit(qgetenv("USERNAME")); *value = QString::fromLocal8Bit(qgetenv(envKey));
#else
*value = QString::fromLocal8Bit(qgetenv("USER"));
#endif
return true; return true;
} }
// Environment variables (for example '%$EMAIL%'). // Environment variables (for example '%$EMAIL%').
+15 -14
View File
@@ -62,6 +62,7 @@
# include <QDir> # include <QDir>
#endif #endif
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <TranslationUnit.h> #include <TranslationUnit.h>
@@ -235,23 +236,23 @@ void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
for (int i = 0; i < includePaths.size(); ++i) { for (int i = 0; i < includePaths.size(); ++i) {
const QString &path = includePaths.at(i); const QString &path = includePaths.at(i);
#ifdef Q_OS_DARWIN if (Utils::HostOsInfo::isMacHost()) {
if (i + 1 < includePaths.size() && path.endsWith(QLatin1String(".framework/Headers"))) { if (i + 1 < includePaths.size() && path.endsWith(QLatin1String(".framework/Headers"))) {
const QFileInfo pathInfo(path); const QFileInfo pathInfo(path);
const QFileInfo frameworkFileInfo(pathInfo.path()); const QFileInfo frameworkFileInfo(pathInfo.path());
const QString frameworkName = frameworkFileInfo.baseName(); const QString frameworkName = frameworkFileInfo.baseName();
const QFileInfo nextIncludePath = includePaths.at(i + 1); const QFileInfo nextIncludePath = includePaths.at(i + 1);
if (nextIncludePath.fileName() == frameworkName) { if (nextIncludePath.fileName() == frameworkName) {
// We got a QtXXX.framework/Headers followed by $QTDIR/include/QtXXX. // We got a QtXXX.framework/Headers followed by $QTDIR/include/QtXXX.
// In this case we prefer to include files from $QTDIR/include/QtXXX. // In this case we prefer to include files from $QTDIR/include/QtXXX.
continue; continue;
}
} }
m_includePaths.append(path);
} else {
m_includePaths.append(path);
} }
m_includePaths.append(path);
#else
m_includePaths.append(path);
#endif
} }
} }
+3 -3
View File
@@ -31,6 +31,7 @@
#include "cvssettings.h" #include "cvssettings.h"
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <QSettings> #include <QSettings>
#include <QTextStream> #include <QTextStream>
@@ -50,9 +51,8 @@ static QString defaultCommand()
{ {
QString rc; QString rc;
rc = QLatin1String("cvs"); rc = QLatin1String("cvs");
#if defined(Q_OS_WIN32) if (Utils::HostOsInfo::isWindowsHost())
rc.append(QLatin1String(".exe")); rc.append(QLatin1String(".exe"));
#endif
return rc; return rc;
} }
+3 -4
View File
@@ -38,6 +38,7 @@
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "stackframe.h" #include "stackframe.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#if USE_BREAK_MODEL_TEST #if USE_BREAK_MODEL_TEST
@@ -181,11 +182,9 @@ QIcon BreakHandler::emptyIcon()
static inline bool fileNameMatch(const QString &f1, const QString &f2) static inline bool fileNameMatch(const QString &f1, const QString &f2)
{ {
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost())
return f1.compare(f2, Qt::CaseInsensitive) == 0; return f1.compare(f2, Qt::CaseInsensitive) == 0;
#else
return f1 == f2; return f1 == f2;
#endif
} }
static bool isSimilarTo(const BreakpointParameters &data, const BreakpointResponse &needle) static bool isSimilarTo(const BreakpointParameters &data, const BreakpointResponse &needle)
+24 -24
View File
@@ -37,6 +37,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/manhattanstyle.h> #include <coreplugin/manhattanstyle.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
@@ -98,36 +99,35 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
m_group->insert(dc->action(VerboseLog), 0); m_group->insert(dc->action(VerboseLog), 0);
m_group->insert(dc->action(BreakOnThrow), 0); m_group->insert(dc->action(BreakOnThrow), 0);
m_group->insert(dc->action(BreakOnCatch), 0); m_group->insert(dc->action(BreakOnCatch), 0);
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
Utils::SavedAction *registerAction = dc->action(RegisterForPostMortem); Utils::SavedAction *registerAction = dc->action(RegisterForPostMortem);
m_group->insert(registerAction, m_group->insert(registerAction,
m_ui.checkBoxRegisterForPostMortem); m_ui.checkBoxRegisterForPostMortem);
connect(registerAction, SIGNAL(toggled(bool)), connect(registerAction, SIGNAL(toggled(bool)),
m_ui.checkBoxRegisterForPostMortem, SLOT(setChecked(bool))); m_ui.checkBoxRegisterForPostMortem, SLOT(setChecked(bool)));
#else } else {
m_ui.checkBoxRegisterForPostMortem->setVisible(false); m_ui.checkBoxRegisterForPostMortem->setVisible(false);
#endif }
} }
QString CommonOptionsPageWidget::searchKeyWords() const QString CommonOptionsPageWidget::searchKeyWords() const
{ {
QString rc; QString rc;
const QLatin1Char sep(' '); const QLatin1Char sep(' ');
QTextStream(&rc) QTextStream stream(&rc);
<< sep << m_ui.checkBoxUseAlternatingRowColors->text() stream << sep << m_ui.checkBoxUseAlternatingRowColors->text()
<< sep << m_ui.checkBoxFontSizeFollowsEditor->text() << sep << m_ui.checkBoxFontSizeFollowsEditor->text()
<< sep << m_ui.checkBoxUseToolTipsInMainEditor->text() << sep << m_ui.checkBoxUseToolTipsInMainEditor->text()
<< sep << m_ui.checkBoxListSourceFiles->text() << sep << m_ui.checkBoxListSourceFiles->text()
<< sep << m_ui.checkBoxBreakpointsFullPath->text() << sep << m_ui.checkBoxBreakpointsFullPath->text()
#ifdef Q_OS_WIN << sep << m_ui.checkBoxCloseBuffersOnExit->text()
<< sep << m_ui.checkBoxRegisterForPostMortem->text() << sep << m_ui.checkBoxSwitchModeOnExit->text()
#endif << sep << m_ui.labelMaximalStackDepth->text()
<< sep << m_ui.checkBoxCloseBuffersOnExit->text() << sep << m_ui.checkBoxBringToForegroundOnInterrrupt->text()
<< sep << m_ui.checkBoxSwitchModeOnExit->text() << sep << m_ui.checkBoxShowQmlObjectTree->text();
<< sep << m_ui.labelMaximalStackDepth->text() if (Utils::HostOsInfo::isWindowsHost())
<< sep << m_ui.checkBoxBringToForegroundOnInterrrupt->text() stream << sep << m_ui.checkBoxRegisterForPostMortem->text();
<< sep << m_ui.checkBoxShowQmlObjectTree->text()
;
rc.remove(QLatin1Char('&')); rc.remove(QLatin1Char('&'));
return rc; return rc;
} }
+6 -5
View File
@@ -115,6 +115,7 @@
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
@@ -2898,11 +2899,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
act->setText(tr("Attach to QML Port...")); act->setText(tr("Attach to QML Port..."));
connect(act, SIGNAL(triggered()), SLOT(attachToQmlPort())); connect(act, SIGNAL(triggered()), SLOT(attachToQmlPort()));
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost()) {
m_startRemoteCdbAction = new QAction(tr("Attach to Remote CDB Session..."), this); m_startRemoteCdbAction = new QAction(tr("Attach to Remote CDB Session..."), this);
connect(m_startRemoteCdbAction, SIGNAL(triggered()), connect(m_startRemoteCdbAction, SIGNAL(triggered()),
SLOT(startRemoteCdbSession())); SLOT(startRemoteCdbSession()));
#endif }
act = m_detachAction = new QAction(this); act = m_detachAction = new QAction(this);
act->setText(tr("Detach Debugger")); act->setText(tr("Detach Debugger"));
+2 -5
View File
@@ -76,6 +76,7 @@
#include <projectexplorer/itaskhandler.h> #include <projectexplorer/itaskhandler.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <utils/elfreader.h> #include <utils/elfreader.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
@@ -4980,11 +4981,7 @@ void GdbEngine::finishInferiorSetup()
void GdbEngine::handleDebugInfoLocation(const GdbResponse &response) void GdbEngine::handleDebugInfoLocation(const GdbResponse &response)
{ {
#ifdef Q_OS_WIN const char pathSep = HostOsInfo::isWindowsHost() ? ';' : ':';
const char pathSep = ';';
#else
const char pathSep = ':';
#endif
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
const QByteArray debugInfoLocation = startParameters().debugInfoLocation.toLocal8Bit(); const QByteArray debugInfoLocation = startParameters().debugInfoLocation.toLocal8Bit();
if (QFile::exists(QString::fromLocal8Bit(debugInfoLocation))) { if (QFile::exists(QString::fromLocal8Bit(debugInfoLocation))) {
@@ -38,6 +38,7 @@
#include <projectexplorer/abi.h> #include <projectexplorer/abi.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QFileInfo> #include <QFileInfo>
@@ -62,11 +63,8 @@ GdbLocalPlainEngine::GdbLocalPlainEngine(const DebuggerStartParameters &startPar
GdbEngine::DumperHandling GdbLocalPlainEngine::dumperHandling() const GdbEngine::DumperHandling GdbLocalPlainEngine::dumperHandling() const
{ {
// LD_PRELOAD fails for System-Qt on Mac. // LD_PRELOAD fails for System-Qt on Mac.
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) return Utils::HostOsInfo::isWindowsHost() || Utils::HostOsInfo::isMacHost()
return DumperLoadedByGdb; ? DumperLoadedByGdb : DumperLoadedByGdbPreload;
#else
return DumperLoadedByGdbPreload;
#endif
} }
void GdbLocalPlainEngine::setupEngine() void GdbLocalPlainEngine::setupEngine()
+4 -5
View File
@@ -38,6 +38,7 @@
#include "debuggercore.h" #include "debuggercore.h"
#include "shared/hostutils.h" #include "shared/hostutils.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -80,11 +81,9 @@ GdbTermEngine::~GdbTermEngine()
GdbEngine::DumperHandling GdbTermEngine::dumperHandling() const GdbEngine::DumperHandling GdbTermEngine::dumperHandling() const
{ {
// LD_PRELOAD fails for System-Qt on Mac. // LD_PRELOAD fails for System-Qt on Mac.
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) return Utils::HostOsInfo::isWindowsHost() || Utils::HostOsInfo::isMacHost()
return DumperLoadedByGdb; ? DumperLoadedByGdb
#else : DumperLoadedByAdapter; // Handles loading itself via LD_PRELOAD
return DumperLoadedByAdapter; // Handles loading itself via LD_PRELOAD
#endif
} }
void GdbTermEngine::setupEngine() void GdbTermEngine::setupEngine()
+4 -4
View File
@@ -35,6 +35,7 @@
#include "debuggercore.h" #include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
@@ -133,10 +134,9 @@ void ModulesTreeView::contextMenuEvent(QContextMenuEvent *ev)
actShowModuleSymbols->setEnabled(engine->hasCapability(ShowModuleSymbolsCapability)); actShowModuleSymbols->setEnabled(engine->hasCapability(ShowModuleSymbolsCapability));
actShowDependencies = new QAction(tr("Show Dependencies of \"%1\"").arg(name), &menu); actShowDependencies = new QAction(tr("Show Dependencies of \"%1\"").arg(name), &menu);
actShowDependencies->setEnabled(!fileName.isEmpty()); actShowDependencies->setEnabled(!fileName.isEmpty());
#ifndef Q_OS_WIN if (!Utils::HostOsInfo::isWindowsHost())
// FIXME: Dependencies only available on Windows, when "depends" is installed. // FIXME: Dependencies only available on Windows, when "depends" is installed.
actShowDependencies->setEnabled(false); actShowDependencies->setEnabled(false);
#endif
} }
menu.addAction(actUpdateModuleList); menu.addAction(actUpdateModuleList);
+3 -3
View File
@@ -60,6 +60,7 @@
#include "fakevimhandler.h" #include "fakevimhandler.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDebug> #include <QDebug>
@@ -3870,9 +3871,8 @@ bool FakeVimHandler::Private::handleExBangCommand(const ExCommand &cmd) // :!
QProcess proc; QProcess proc;
proc.start(command); proc.start(command);
proc.waitForStarted(); proc.waitForStarted();
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost())
text.replace(_("\n"), _("\r\n")); text.replace(_("\n"), _("\r\n"));
#endif
proc.write(text.toUtf8()); proc.write(text.toUtf8());
proc.closeWriteChannel(); proc.closeWriteChannel();
proc.waitForFinished(); proc.waitForFinished();
+5 -10
View File
@@ -44,6 +44,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/hostosinfo.h>
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
#include <utils/flowlayout.h> #include <utils/flowlayout.h>
@@ -285,14 +286,12 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
} }
} }
const Qt::KeyboardModifier modifier = Utils::HostOsInfo::isMacHost()
? Qt::ControlModifier : Qt::MetaModifier;
if ((obj == m_ui.findEdit || obj == m_findCompleter->popup()) if ((obj == m_ui.findEdit || obj == m_findCompleter->popup())
&& event->type() == QEvent::KeyPress) { && event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event); QKeyEvent *ke = static_cast<QKeyEvent *>(event);
#ifdef Q_OS_MAC if (ke->key() == Qt::Key_Space && (ke->modifiers() & modifier)) {
if (ke->key() == Qt::Key_Space && (ke->modifiers() & Qt::MetaModifier)) {
#else
if (ke->key() == Qt::Key_Space && (ke->modifiers() & Qt::ControlModifier)) {
#endif
QString completedText = m_currentDocumentFind->completedFindString(); QString completedText = m_currentDocumentFind->completedFindString();
if (!completedText.isEmpty()) { if (!completedText.isEmpty()) {
setFindText(completedText); setFindText(completedText);
@@ -309,11 +308,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
event->accept(); event->accept();
return true; return true;
} }
#ifdef Q_OS_MAC } else if (ke->key() == Qt::Key_Space && (ke->modifiers() & modifier)) {
} else if (ke->key() == Qt::Key_Space && (ke->modifiers() & Qt::MetaModifier)) {
#else
} else if (ke->key() == Qt::Key_Space && (ke->modifiers() & Qt::ControlModifier)) {
#endif
event->accept(); event->accept();
return true; return true;
} }
+10 -9
View File
@@ -36,6 +36,7 @@
#else #else
# include <utils/environment.h> # include <utils/environment.h>
#endif #endif
#include <utils/hostosinfo.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <QDebug> #include <QDebug>
#include <QFileInfo> #include <QFileInfo>
@@ -72,16 +73,16 @@ static inline QString detectSsh()
#endif #endif
if (!ssh.isEmpty()) if (!ssh.isEmpty())
return ssh; return ssh;
#ifdef Q_OS_WIN // Windows: Use ssh.exe from git if it cannot be found. if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found.
const QString git = GerritPlugin::gitBinary(); const QString git = GerritPlugin::gitBinary();
if (!git.isEmpty()) { if (!git.isEmpty()) {
// Is 'git\cmd' in the path (folder containing .bats)? // Is 'git\cmd' in the path (folder containing .bats)?
QString path = QFileInfo(git).absolutePath(); QString path = QFileInfo(git).absolutePath();
if (path.endsWith(QLatin1String("cmd"), Qt::CaseInsensitive)) if (path.endsWith(QLatin1String("cmd"), Qt::CaseInsensitive))
path.replace(path.size() - 3, 3, QLatin1String("bin")); path.replace(path.size() - 3, 3, QLatin1String("bin"));
ssh = path + QLatin1Char('/') + QLatin1String(defaultSshC); ssh = path + QLatin1Char('/') + QLatin1String(defaultSshC);
}
} }
#endif
return ssh; return ssh;
} }
+13 -12
View File
@@ -52,6 +52,7 @@
#include <coreplugin/variablemanager.h> #include <coreplugin/variablemanager.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
@@ -1441,7 +1442,6 @@ VcsBase::Command *GitClient::executeGit(const QString &workingDirectory,
QProcessEnvironment GitClient::processEnvironment() const QProcessEnvironment GitClient::processEnvironment() const
{ {
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString gitPath = settings()->stringValue(GitSettings::pathKey); QString gitPath = settings()->stringValue(GitSettings::pathKey);
if (!gitPath.isEmpty()) { if (!gitPath.isEmpty()) {
@@ -1449,10 +1449,10 @@ QProcessEnvironment GitClient::processEnvironment() const
gitPath += environment.value(QLatin1String("PATH")); gitPath += environment.value(QLatin1String("PATH"));
environment.insert(QLatin1String("PATH"), gitPath); environment.insert(QLatin1String("PATH"), gitPath);
} }
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()
if (settings()->boolValue(GitSettings::winSetHomeEnvironmentKey)) && settings()->boolValue(GitSettings::winSetHomeEnvironmentKey)) {
environment.insert(QLatin1String("HOME"), QDir::toNativeSeparators(QDir::homePath())); environment.insert(QLatin1String("HOME"), QDir::toNativeSeparators(QDir::homePath()));
#endif // Q_OS_WIN }
// Set up SSH and C locale (required by git using perl). // Set up SSH and C locale (required by git using perl).
VcsBase::VcsBasePlugin::setProcessEnvironment(&environment, false); VcsBase::VcsBasePlugin::setProcessEnvironment(&environment, false);
return environment; return environment;
@@ -1659,15 +1659,16 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
const QString &gitBinDirectory, const QString &gitBinDirectory,
bool silent) bool silent)
{ {
#ifdef Q_OS_WIN QString binary;
// Launch 'wish' shell from git binary directory with the gitk located there
const QString binary = gitBinDirectory + QLatin1String("/wish");
QStringList arguments(gitBinDirectory + QLatin1String("/gitk"));
#else
// Simple: Run gitk from binary path
const QString binary = gitBinDirectory + QLatin1String("/gitk");
QStringList arguments; QStringList arguments;
#endif if (Utils::HostOsInfo::isWindowsHost()) {
// Launch 'wish' shell from git binary directory with the gitk located there
binary = gitBinDirectory + QLatin1String("/wish");
arguments << (gitBinDirectory + QLatin1String("/gitk"));
} else {
// Simple: Run gitk from binary path
binary = gitBinDirectory + QLatin1String("/gitk");
}
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance(); VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
const QString gitkOpts = settings()->stringValue(GitSettings::gitkOptionsKey); const QString gitkOpts = settings()->stringValue(GitSettings::gitkOptionsKey);
if (!gitkOpts.isEmpty()) if (!gitkOpts.isEmpty())
+2 -5
View File
@@ -30,6 +30,7 @@
#include "gitsettings.h" #include "gitsettings.h"
#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <QCoreApplication> #include <QCoreApplication>
@@ -54,11 +55,7 @@ GitSettings::GitSettings()
setSettingsGroup(QLatin1String("Git")); setSettingsGroup(QLatin1String("Git"));
declareKey(binaryPathKey, QLatin1String("git")); declareKey(binaryPathKey, QLatin1String("git"));
#ifdef Q_OS_WIN declareKey(timeoutKey, Utils::HostOsInfo::isWindowsHost() ? 60 : 30);
declareKey(timeoutKey, 60);
#else
declareKey(timeoutKey, 30);
#endif
declareKey(pathKey, QString()); declareKey(pathKey, QString());
declareKey(pullRebaseKey, false); declareKey(pullRebaseKey, false);
declareKey(omitAnnotationDateKey, false); declareKey(omitAnnotationDateKey, false);
+14 -13
View File
@@ -34,6 +34,7 @@
#include "gitclient.h" #include "gitclient.h"
#include <vcsbase/vcsbaseconstants.h> #include <vcsbase/vcsbaseconstants.h>
#include <utils/hostosinfo.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <QCoreApplication> #include <QCoreApplication>
@@ -51,19 +52,19 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
const QByteArray currentHome = qgetenv("HOME"); const QByteArray currentHome = qgetenv("HOME");
const QString toolTip const QString toolTip
= tr("Set the environment variable HOME to '%1'\n(%2).\n" = tr("Set the environment variable HOME to '%1'\n(%2).\n"
"This causes msysgit to look for the SSH-keys in that location\n" "This causes msysgit to look for the SSH-keys in that location\n"
"instead of its installation directory when run outside git bash."). "instead of its installation directory when run outside git bash.").
arg(QDir::homePath(), arg(QDir::homePath(),
currentHome.isEmpty() ? tr("not currently set") : currentHome.isEmpty() ? tr("not currently set") :
tr("currently set to '%1'").arg(QString::fromLocal8Bit(currentHome))); tr("currently set to '%1'").arg(QString::fromLocal8Bit(currentHome)));
m_ui.winHomeCheckBox->setToolTip(toolTip); m_ui.winHomeCheckBox->setToolTip(toolTip);
#else } else {
m_ui.winHomeCheckBox->setVisible(false); m_ui.winHomeCheckBox->setVisible(false);
#endif }
m_ui.repBrowserCommandPathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); m_ui.repBrowserCommandPathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui.repBrowserCommandPathChooser->setPromptDialogTitle(tr("Git Repository Browser Command")); m_ui.repBrowserCommandPathChooser->setPromptDialogTitle(tr("Git Repository Browser Command"));
} }
+12 -11
View File
@@ -36,6 +36,7 @@
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/hostosinfo.h>
#include <QAction> #include <QAction>
#include <QHBoxLayout> #include <QHBoxLayout>
@@ -143,17 +144,17 @@ ExternalHelpWindow::ExternalHelpWindow(QWidget *parent)
tr("Show Sidebar"), this); tr("Show Sidebar"), this);
connect(action, SIGNAL(triggered()), this, SIGNAL(showHideSidebar())); connect(action, SIGNAL(triggered()), this, SIGNAL(showHideSidebar()));
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
reset->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0)); reset->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0)); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
ctrlTab->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab)); ctrlTab->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab));
ctrlShiftTab->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab)); ctrlShiftTab->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab));
#else } else {
reset->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0)); reset->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0)); action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
ctrlTab->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab)); ctrlTab->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab));
ctrlShiftTab->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab)); ctrlShiftTab->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab));
#endif }
QToolButton *button = new QToolButton; QToolButton *button = new QToolButton;
button->setDefaultAction(action); button->setDefaultAction(action);
+13 -12
View File
@@ -67,6 +67,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <find/findplugin.h> #include <find/findplugin.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <utils/hostosinfo.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
#include <QDir> #include <QDir>
@@ -251,12 +252,12 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1)); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1));
connect(action, SIGNAL(triggered()), this, SLOT(activateContext())); connect(action, SIGNAL(triggered()), this, SLOT(activateContext()));
#ifndef Q_OS_MAC if (!Utils::HostOsInfo::isMacHost()) {
action = new QAction(this); action = new QAction(this);
action->setSeparator(true); action->setSeparator(true);
cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator"), globalcontext);
Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
#endif }
action = new QAction(tr("Technical Support"), this); action = new QAction(tr("Technical Support"), this);
cmd = Core::ActionManager::registerAction(action, Core::Id("Help.TechSupport"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.TechSupport"), globalcontext);
@@ -268,12 +269,12 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
connect(action, SIGNAL(triggered()), this, SLOT(slotReportBug())); connect(action, SIGNAL(triggered()), this, SLOT(slotReportBug()));
#ifndef Q_OS_MAC if (!Utils::HostOsInfo::isMacHost()) {
action = new QAction(this); action = new QAction(this);
action->setSeparator(true); action->setSeparator(true);
cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator2"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator2"), globalcontext);
Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
#endif }
action = new QAction(this); action = new QAction(this);
Core::ActionManager::registerAction(action, Core::Constants::PRINT, modecontext); Core::ActionManager::registerAction(action, Core::Constants::PRINT, modecontext);
+4 -6
View File
@@ -36,6 +36,8 @@
#include "helpviewer_p.h" #include "helpviewer_p.h"
#include "localhelpmanager.h" #include "localhelpmanager.h"
#include <utils/hostosinfo.h>
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QContextMenuEvent> #include <QContextMenuEvent>
@@ -286,19 +288,15 @@ void HelpViewer::wheelEvent(QWheelEvent *e)
void HelpViewer::mousePressEvent(QMouseEvent *e) void HelpViewer::mousePressEvent(QMouseEvent *e)
{ {
#ifdef Q_OS_LINUX if (Utils::HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
if (handleForwardBackwardMouseButtons(e))
return; return;
#endif
QTextBrowser::mousePressEvent(e); QTextBrowser::mousePressEvent(e);
} }
void HelpViewer::mouseReleaseEvent(QMouseEvent *e) void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
{ {
#ifndef Q_OS_LINUX if (!Utils::HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
if (handleForwardBackwardMouseButtons(e))
return; return;
#endif
bool controlPressed = e->modifiers() & Qt::ControlModifier; bool controlPressed = e->modifiers() & Qt::ControlModifier;
if ((controlPressed && d->hasAnchorAt(this, e->pos())) || if ((controlPressed && d->hasAnchorAt(this, e->pos())) ||
+4 -6
View File
@@ -37,6 +37,8 @@
#include "localhelpmanager.h" #include "localhelpmanager.h"
#include "openpagesmanager.h" #include "openpagesmanager.h"
#include <utils/hostosinfo.h>
#include <QDebug> #include <QDebug>
#include <QFileInfo> #include <QFileInfo>
#include <QString> #include <QString>
@@ -529,10 +531,8 @@ void HelpViewer::wheelEvent(QWheelEvent *event)
void HelpViewer::mousePressEvent(QMouseEvent *event) void HelpViewer::mousePressEvent(QMouseEvent *event)
{ {
#ifdef Q_OS_LINUX if (Utils::HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(event))
if (handleForwardBackwardMouseButtons(event))
return; return;
#endif
if (HelpPage *currentPage = static_cast<HelpPage*> (page())) { if (HelpPage *currentPage = static_cast<HelpPage*> (page())) {
currentPage->m_pressedButtons = event->buttons(); currentPage->m_pressedButtons = event->buttons();
@@ -544,10 +544,8 @@ void HelpViewer::mousePressEvent(QMouseEvent *event)
void HelpViewer::mouseReleaseEvent(QMouseEvent *event) void HelpViewer::mouseReleaseEvent(QMouseEvent *event)
{ {
#ifndef Q_OS_LINUX if (!Utils::HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(event))
if (handleForwardBackwardMouseButtons(event))
return; return;
#endif
QWebView::mouseReleaseEvent(event); QWebView::mouseReleaseEvent(event);
} }
+6 -8
View File
@@ -34,6 +34,8 @@
#include "openpagesmodel.h" #include "openpagesmodel.h"
#include "openpageswidget.h" #include "openpageswidget.h"
#include <utils/hostosinfo.h>
#include <QEvent> #include <QEvent>
#include <QKeyEvent> #include <QKeyEvent>
@@ -54,9 +56,8 @@ OpenPagesSwitcher::OpenPagesSwitcher(OpenPagesModel *model)
// We disable the frame on this list view and use a QFrame around it instead. // We disable the frame on this list view and use a QFrame around it instead.
// This improves the look with QGTKStyle. // This improves the look with QGTKStyle.
#ifndef Q_OS_MAC if (!Utils::HostOsInfo::isMacHost())
setFrameStyle(m_openPagesWidget->frameStyle()); setFrameStyle(m_openPagesWidget->frameStyle());
#endif
m_openPagesWidget->setFrameStyle(QFrame::NoFrame); m_openPagesWidget->setFrameStyle(QFrame::NoFrame);
m_openPagesWidget->allowContextMenu(false); m_openPagesWidget->allowContextMenu(false);
@@ -125,11 +126,8 @@ bool OpenPagesSwitcher::eventFilter(QObject *object, QEvent *event)
emit setCurrentPage(m_openPagesWidget->currentIndex()); emit setCurrentPage(m_openPagesWidget->currentIndex());
return true; return true;
} }
#ifdef Q_OS_MAC const Qt::KeyboardModifiers modifier = Utils::HostOsInfo::isMacHost()
const Qt::KeyboardModifier modifier = Qt::AltModifier; ? Qt::AltModifier : Qt::ControlModifier;
#else
const Qt::KeyboardModifier modifier = Qt::ControlModifier;
#endif
if (key == Qt::Key_Backtab if (key == Qt::Key_Backtab
&& (ke->modifiers() == (modifier | Qt::ShiftModifier))) && (ke->modifiers() == (modifier | Qt::ShiftModifier)))
gotoNextPage(); gotoNextPage();
+15 -11
View File
@@ -45,6 +45,7 @@
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <utils/filterlineedit.h> #include <utils/filterlineedit.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/runextensions.h> #include <utils/runextensions.h>
@@ -221,12 +222,12 @@ CompletionList::CompletionList(QWidget *parent)
// This is too slow when done on all results // This is too slow when done on all results
//header()->setResizeMode(QHeaderView::ResizeToContents); //header()->setResizeMode(QHeaderView::ResizeToContents);
setWindowFlags(Qt::ToolTip); setWindowFlags(Qt::ToolTip);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
if (horizontalScrollBar()) if (horizontalScrollBar())
horizontalScrollBar()->setAttribute(Qt::WA_MacMiniSize); horizontalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
if (verticalScrollBar()) if (verticalScrollBar())
verticalScrollBar()->setAttribute(Qt::WA_MacMiniSize); verticalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
#endif }
} }
void CompletionList::updatePreferredSize() void CompletionList::updatePreferredSize()
@@ -408,11 +409,14 @@ bool LocatorWidget::eventFilter(QObject *obj, QEvent *event)
} }
} }
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusOut) { } else if (obj == m_fileLineEdit && event->type() == QEvent::FocusOut) {
#if defined(Q_OS_WIN) bool hideList = true;
QFocusEvent *fev = static_cast<QFocusEvent*>(event); if (Utils::HostOsInfo::isWindowsHost()) {
if (fev->reason() != Qt::ActiveWindowFocusReason || QFocusEvent *fev = static_cast<QFocusEvent*>(event);
(fev->reason() == Qt::ActiveWindowFocusReason && !m_completionList->isActiveWindow())) if (fev->reason() == Qt::ActiveWindowFocusReason &&
#endif !(fev->reason() == Qt::ActiveWindowFocusReason && !m_completionList->isActiveWindow()))
hideList = false;
}
if (hideList)
m_completionList->hide(); m_completionList->hide();
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusIn) { } else if (obj == m_fileLineEdit && event->type() == QEvent::FocusIn) {
showPopupNow(); showPopupNow();
+24 -21
View File
@@ -45,6 +45,7 @@
#include <qtsupport/qtprofileinformation.h> #include <qtsupport/qtprofileinformation.h>
#include <remotelinux/abstractremotelinuxdeployservice.h> #include <remotelinux/abstractremotelinuxdeployservice.h>
#include <remotelinux/linuxdevice.h> #include <remotelinux/linuxdevice.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
@@ -345,29 +346,31 @@ bool MaemoMountAndCopyFilesService::isDeploymentNecessary() const
QList<MaemoMountSpecification> MaemoMountAndCopyFilesService::mountSpecifications() const QList<MaemoMountSpecification> MaemoMountAndCopyFilesService::mountSpecifications() const
{ {
QList<MaemoMountSpecification> mountSpecs; QList<MaemoMountSpecification> mountSpecs;
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
bool drivesToMount[26]; bool drivesToMount[26];
qFill(drivesToMount, drivesToMount + sizeof drivesToMount / sizeof drivesToMount[0], false); qFill(drivesToMount, drivesToMount + sizeof drivesToMount / sizeof drivesToMount[0], false);
for (int i = 0; i < m_filesToCopy.count(); ++i) { for (int i = 0; i < m_filesToCopy.count(); ++i) {
const QString localDir = m_filesToCopy.at(i).localFilePath().toFileInfo().canonicalPath(); const QString localDir
const char driveLetter = localDir.at(0).toLower().toLatin1(); = m_filesToCopy.at(i).localFilePath().toFileInfo().canonicalPath();
if (driveLetter < 'a' || driveLetter > 'z') { const char driveLetter = localDir.at(0).toLower().toLatin1();
qWarning("Weird: drive letter is '%c'.", driveLetter); if (driveLetter < 'a' || driveLetter > 'z') {
continue; qWarning("Weird: drive letter is '%c'.", driveLetter);
continue;
}
const int index = driveLetter - 'a';
if (drivesToMount[index])
continue;
const QString mountPoint = deployMountPoint() + QLatin1Char('/')
+ QLatin1Char(driveLetter);
const MaemoMountSpecification mountSpec(localDir.left(3), mountPoint);
mountSpecs << mountSpec;
drivesToMount[index] = true;
} }
} else {
const int index = driveLetter - 'a'; mountSpecs << MaemoMountSpecification(QLatin1String("/"), deployMountPoint());
if (drivesToMount[index])
continue;
const QString mountPoint = deployMountPoint() + QLatin1Char('/') + QLatin1Char(driveLetter);
const MaemoMountSpecification mountSpec(localDir.left(3), mountPoint);
mountSpecs << mountSpec;
drivesToMount[index] = true;
} }
#else
mountSpecs << MaemoMountSpecification(QLatin1String("/"), deployMountPoint());
#endif
return mountSpecs; return mountSpecs;
} }
+22 -29
View File
@@ -40,6 +40,7 @@
#include <qtsupport/qtprofileinformation.h> #include <qtsupport/qtprofileinformation.h>
#include <remotelinux/remotelinux_constants.h> #include <remotelinux/remotelinux_constants.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@@ -51,6 +52,7 @@ using namespace ProjectExplorer;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Constants; using namespace Qt4ProjectManager::Constants;
using namespace RemoteLinux; using namespace RemoteLinux;
using namespace Utils;
namespace Madde { namespace Madde {
namespace Internal { namespace Internal {
@@ -144,13 +146,13 @@ QString MaemoGlobal::remoteSourceProfilesCommand()
return QString::fromAscii(remoteCall); return QString::fromAscii(remoteCall);
} }
Utils::PortList MaemoGlobal::freePorts(const Profile *profile) PortList MaemoGlobal::freePorts(const Profile *profile)
{ {
IDevice::ConstPtr device = DeviceProfileInformation::device(profile); IDevice::ConstPtr device = DeviceProfileInformation::device(profile);
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(profile); QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(profile);
if (!device || !qtVersion) if (!device || !qtVersion)
return Utils::PortList(); return PortList();
if (device->machineType() == IDevice::Emulator) { if (device->machineType() == IDevice::Emulator) {
MaemoQemuRuntime rt; MaemoQemuRuntime rt;
const int id = qtVersion->uniqueId(); const int id = qtVersion->uniqueId();
@@ -167,18 +169,15 @@ QString MaemoGlobal::maddeRoot(const QString &qmakePath)
return dir.absolutePath(); return dir.absolutePath();
} }
Utils::FileName MaemoGlobal::maddeRoot(const Profile *profile) FileName MaemoGlobal::maddeRoot(const Profile *profile)
{ {
return SysRootProfileInformation::sysRoot(profile).parentDir().parentDir(); return SysRootProfileInformation::sysRoot(profile).parentDir().parentDir();
} }
QString MaemoGlobal::targetRoot(const QString &qmakePath) QString MaemoGlobal::targetRoot(const QString &qmakePath)
{ {
#ifdef Q_OS_WIN const Qt::CaseSensitivity cs = HostOsInfo::isWindowsHost()
Qt::CaseSensitivity cs = Qt::CaseInsensitive; ? Qt::CaseInsensitive : Qt::CaseSensitive;
#else
Qt::CaseSensitivity cs = Qt::CaseSensitive;
#endif
return QDir::cleanPath(qmakePath).remove(binQmake, cs); return QDir::cleanPath(qmakePath).remove(binQmake, cs);
} }
@@ -227,32 +226,26 @@ QString MaemoGlobal::architecture(const QString &qmakePath)
return arch; return arch;
} }
void MaemoGlobal::addMaddeEnvironment(Utils::Environment &env, const QString &qmakePath) void MaemoGlobal::addMaddeEnvironment(Environment &env, const QString &qmakePath)
{ {
Utils::Environment maddeEnv; Environment maddeEnv;
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost()) {
const QString root = maddeRoot(qmakePath); const QString root = maddeRoot(qmakePath);
env.prependOrSetPath(root + QLatin1String("/bin")); env.prependOrSetPath(root + QLatin1String("/bin"));
env.prependOrSet(QLatin1String("HOME"), env.prependOrSet(QLatin1String("HOME"),
QDesktopServices::storageLocation(QDesktopServices::HomeLocation)); QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
#else }
Q_UNUSED(qmakePath); for (Environment::const_iterator it = maddeEnv.constBegin(); it != maddeEnv.constEnd(); ++it)
#endif
for (Utils::Environment::const_iterator it = maddeEnv.constBegin(); it != maddeEnv.constEnd(); ++it)
env.prependOrSet(it.key(), it.value()); env.prependOrSet(it.key(), it.value());
} }
void MaemoGlobal::transformMaddeCall(QString &command, QStringList &args, const QString &qmakePath) void MaemoGlobal::transformMaddeCall(QString &command, QStringList &args, const QString &qmakePath)
{ {
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost()) {
const QString root = maddeRoot(qmakePath); const QString root = maddeRoot(qmakePath);
args.prepend(command); args.prepend(command);
command = root + QLatin1String("/bin/sh.exe"); command = root + QLatin1String("/bin/sh.exe");
#else }
Q_UNUSED(command);
Q_UNUSED(args);
Q_UNUSED(qmakePath);
#endif
} }
bool MaemoGlobal::callMad(QProcess &proc, const QStringList &args, bool MaemoGlobal::callMad(QProcess &proc, const QStringList &args,
@@ -277,7 +270,7 @@ bool MaemoGlobal::callMaddeShellScript(QProcess &proc,
return false; return false;
QString actualCommand = command; QString actualCommand = command;
QStringList actualArgs = targetArgs(qmakePath, useTarget) + args; QStringList actualArgs = targetArgs(qmakePath, useTarget) + args;
Utils::Environment env(proc.systemEnvironment()); Environment env(proc.systemEnvironment());
addMaddeEnvironment(env, qmakePath); addMaddeEnvironment(env, qmakePath);
proc.setEnvironment(env.toStringList()); proc.setEnvironment(env.toStringList());
transformMaddeCall(actualCommand, actualArgs, qmakePath); transformMaddeCall(actualCommand, actualArgs, qmakePath);
+12 -11
View File
@@ -42,6 +42,7 @@
#include <qtsupport/qtprofileinformation.h> #include <qtsupport/qtprofileinformation.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDateTime> #include <QDateTime>
@@ -57,6 +58,7 @@ using ProjectExplorer::BuildStepList;
using ProjectExplorer::BuildStepConfigWidget; using ProjectExplorer::BuildStepConfigWidget;
using ProjectExplorer::Task; using ProjectExplorer::Task;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
using namespace Utils;
namespace Madde { namespace Madde {
namespace Internal { namespace Internal {
@@ -225,7 +227,7 @@ bool AbstractMaemoPackageCreationStep::callPackagingCommand(QProcess *proc,
void AbstractMaemoPackageCreationStep::preparePackagingProcess(QProcess *proc, void AbstractMaemoPackageCreationStep::preparePackagingProcess(QProcess *proc,
const Qt4BuildConfiguration *bc, const QString &workingDir) const Qt4BuildConfiguration *bc, const QString &workingDir)
{ {
Utils::Environment env = bc->environment(); Environment env = bc->environment();
if (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild) { if (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild) {
env.appendOrSet(QLatin1String("DEB_BUILD_OPTIONS"), env.appendOrSet(QLatin1String("DEB_BUILD_OPTIONS"),
QLatin1String("nostrip"), QLatin1String(" ")); QLatin1String("nostrip"), QLatin1String(" "));
@@ -329,12 +331,12 @@ bool MaemoDebianPackageCreationStep::createPackage(QProcess *buildProc,
bool MaemoDebianPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const bool MaemoDebianPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const
{ {
const Utils::FileName debianPath = DebianManager::debianDirectory(target()); const FileName debianPath = DebianManager::debianDirectory(target());
if (packageDate <= debianPath.toFileInfo().lastModified()) if (packageDate <= debianPath.toFileInfo().lastModified())
return true; return true;
const QStringList debianFiles = DebianManager::debianFiles(debianPath); const QStringList debianFiles = DebianManager::debianFiles(debianPath);
foreach (const QString &debianFile, debianFiles) { foreach (const QString &debianFile, debianFiles) {
Utils::FileName absFilePath = debianPath; FileName absFilePath = debianPath;
absFilePath.appendPath(debianFile); absFilePath.appendPath(debianFile);
if (packageDate <= absFilePath.toFileInfo().lastModified()) if (packageDate <= absFilePath.toFileInfo().lastModified())
return true; return true;
@@ -351,7 +353,7 @@ void MaemoDebianPackageCreationStep::checkProjectName()
"Debian packages.\nThey must only use lower-case letters, " "Debian packages.\nThey must only use lower-case letters, "
"numbers, '-', '+' and '.'.\n""We will try to work around that, " "numbers, '-', '+' and '.'.\n""We will try to work around that, "
"but you may experience problems."), "but you may experience problems."),
Utils::FileName(), -1, Core::Id(TASK_CATEGORY_BUILDSYSTEM))); FileName(), -1, Core::Id(TASK_CATEGORY_BUILDSYSTEM)));
} }
} }
@@ -370,7 +372,7 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
return false; return false;
} }
QString error; QString error;
if (!Utils::FileUtils::removeRecursively(debianDirPath, &error)) { if (!FileUtils::removeRecursively(debianDirPath, &error)) {
raiseError(tr("Packaging failed: Could not remove directory '%1': %2") raiseError(tr("Packaging failed: Could not remove directory '%1': %2")
.arg(debianDirPath, error)); .arg(debianDirPath, error));
return false; return false;
@@ -396,7 +398,7 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
} }
if (newFileName == DebianManager::packageName(DebianManager::debianDirectory(target())) + QLatin1String(".aegis")) { if (newFileName == DebianManager::packageName(DebianManager::debianDirectory(target())) + QLatin1String(".aegis")) {
Utils::FileReader reader; FileReader reader;
if (!reader.fetch(srcFile)) { if (!reader.fetch(srcFile)) {
raiseError(tr("Could not read manifest file '%1': %2.") raiseError(tr("Could not read manifest file '%1': %2.")
.arg(QDir::toNativeSeparators(srcFile), reader.errorString())); .arg(QDir::toNativeSeparators(srcFile), reader.errorString()));
@@ -436,9 +438,8 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
QString MaemoDebianPackageCreationStep::packagingCommand(const QString &maddeRoot, const QString &commandName) QString MaemoDebianPackageCreationStep::packagingCommand(const QString &maddeRoot, const QString &commandName)
{ {
QString perl; QString perl;
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost())
perl = maddeRoot + QLatin1String("/bin/perl.exe "); perl = maddeRoot + QLatin1String("/bin/perl.exe ");
#endif
return perl + maddeRoot + QLatin1String("/madbin/") + commandName; return perl + maddeRoot + QLatin1String("/madbin/") + commandName;
} }
@@ -457,7 +458,7 @@ void MaemoDebianPackageCreationStep::ensureShlibdeps(QByteArray &rulesContent)
bool MaemoDebianPackageCreationStep::adaptRulesFile( bool MaemoDebianPackageCreationStep::adaptRulesFile(
const QString &templatePath, const QString &rulesFilePath) const QString &templatePath, const QString &rulesFilePath)
{ {
Utils::FileReader reader; FileReader reader;
if (!reader.fetch(templatePath)) { if (!reader.fetch(templatePath)) {
raiseError(reader.errorString()); raiseError(reader.errorString());
return false; return false;
@@ -467,7 +468,7 @@ bool MaemoDebianPackageCreationStep::adaptRulesFile(
if (!m_debugBuild) if (!m_debugBuild)
ensureShlibdeps(content); ensureShlibdeps(content);
Utils::FileSaver saver(rulesFilePath); FileSaver saver(rulesFilePath);
saver.write(content); saver.write(content);
if (!saver.finalize()) { if (!saver.finalize()) {
raiseError(saver.errorString()); raiseError(saver.errorString());
+23 -22
View File
@@ -33,6 +33,7 @@
#include "maemoqemusettings.h" #include "maemoqemusettings.h"
#include <qtsupport/baseqtversion.h> #include <qtsupport/baseqtversion.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDir> #include <QDir>
@@ -199,17 +200,17 @@ void MaemoQemuRuntimeParserV1::fillRuntimeInformation(MaemoQemuRuntime *runtime)
// This is complex because of extreme MADDE weirdness. // This is complex because of extreme MADDE weirdness.
const QString root = m_maddeRoot + QLatin1Char('/'); const QString root = m_maddeRoot + QLatin1Char('/');
const bool pathIsRelative = QFileInfo(runtime->m_bin).isRelative(); const bool pathIsRelative = QFileInfo(runtime->m_bin).isRelative();
runtime->m_bin = if (Utils::HostOsInfo::isWindowsHost()) {
#ifdef Q_OS_WIN runtime->m_bin =
root + (pathIsRelative root + (pathIsRelative
? QLatin1String("madlib/") + runtime->m_bin // Fremantle. ? QLatin1String("madlib/") + runtime->m_bin // Fremantle.
: runtime->m_bin) // Harmattan. : runtime->m_bin) // Harmattan.
+ QLatin1String(".exe"); + QLatin1String(".exe");
#else } else {
pathIsRelative runtime->m_bin = pathIsRelative
? root + QLatin1String("madlib/") + runtime->m_bin // Fremantle. ? root + QLatin1String("madlib/") + runtime->m_bin // Fremantle.
: runtime->m_bin; // Harmattan. : runtime->m_bin; // Harmattan.
#endif }
} }
} }
} }
@@ -336,17 +337,17 @@ void MaemoQemuRuntimeParserV2::handleEnvironmentTag(MaemoQemuRuntime &runtime)
while (m_madInfoReader.readNextStartElement()) while (m_madInfoReader.readNextStartElement())
handleVariableTag(runtime); handleVariableTag(runtime);
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
const QString root = QDir::toNativeSeparators(m_maddeRoot) const QString root = QDir::toNativeSeparators(m_maddeRoot)
+ QLatin1Char('/'); + QLatin1Char('/');
const QLatin1Char colon(';'); const QLatin1Char colon(';');
const QLatin1String key("PATH"); const QLatin1String key("PATH");
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
runtime.m_normalVars << MaemoQemuRuntime::Variable(key, runtime.m_normalVars << MaemoQemuRuntime::Variable(key,
root + QLatin1String("bin") + colon + env.value(key)); root + QLatin1String("bin") + colon + env.value(key));
runtime.m_normalVars << MaemoQemuRuntime::Variable(key, runtime.m_normalVars << MaemoQemuRuntime::Variable(key,
root + QLatin1String("madlib") + colon + env.value(key)); root + QLatin1String("madlib") + colon + env.value(key));
#endif }
} }
void MaemoQemuRuntimeParserV2::handleVariableTag(MaemoQemuRuntime &runtime) void MaemoQemuRuntimeParserV2::handleVariableTag(MaemoQemuRuntime &runtime)
+2 -4
View File
@@ -35,6 +35,7 @@
#include <projectexplorer/profileinformation.h> #include <projectexplorer/profileinformation.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h> #include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>
#include <utils/hostosinfo.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QFile> #include <QFile>
@@ -125,10 +126,7 @@ QString MaemoQtVersion::description() const
bool MaemoQtVersion::supportsShadowBuilds() const bool MaemoQtVersion::supportsShadowBuilds() const
{ {
#ifdef Q_OS_WIN return !Utils::HostOsInfo::isWindowsHost();
return false;
#endif
return true;
} }
Core::Id MaemoQtVersion::deviceType() const Core::Id MaemoQtVersion::deviceType() const
@@ -33,6 +33,7 @@
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
#include <ssh/sshremoteprocessrunner.h> #include <ssh/sshremoteprocessrunner.h>
#include <utils/hostosinfo.h>
#include <QDir> #include <QDir>
@@ -124,13 +125,13 @@ void MaemoRemoteCopyFacility::copyNextFile()
const DeployableFile &d = m_deployables.first(); const DeployableFile &d = m_deployables.first();
QString sourceFilePath = m_mountPoint; QString sourceFilePath = m_mountPoint;
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
const QString localFilePath = QDir::fromNativeSeparators(d.localFilePath().toString()); const QString localFilePath = QDir::fromNativeSeparators(d.localFilePath().toString());
sourceFilePath += QLatin1Char('/') + localFilePath.at(0).toLower() sourceFilePath += QLatin1Char('/') + localFilePath.at(0).toLower()
+ localFilePath.mid(2); + localFilePath.mid(2);
#else } else {
sourceFilePath += d.localFilePath().toString(); sourceFilePath += d.localFilePath().toString();
#endif }
QString command = QString::fromLatin1("%1 mkdir -p %3 && %1 cp -a %2 %3") QString command = QString::fromLatin1("%1 mkdir -p %3 && %1 cp -a %2 %3")
.arg(MaemoGlobal::remoteSudo(m_devConf->type(), m_devConf->sshParameters().userName), .arg(MaemoGlobal::remoteSudo(m_devConf->type(), m_devConf->sshParameters().userName),
+4 -5
View File
@@ -34,6 +34,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
@@ -57,11 +58,9 @@ enum { defaultTimeOutS = 30, defaultLogCount = 1000 };
static QString defaultCommand() static QString defaultCommand()
{ {
QString rc; QString rc = QLatin1String("p4");
rc = QLatin1String("p4"); if (Utils::HostOsInfo::isWindowsHost())
#if defined(Q_OS_WIN32) rc.append(QLatin1String(".exe"));
rc.append(QLatin1String(".exe"));
#endif
return rc; return rc;
} }
+13 -18
View File
@@ -39,6 +39,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/hostosinfo.h>
#include <QSignalMapper> #include <QSignalMapper>
@@ -54,6 +55,7 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal; using namespace ProjectExplorer::Internal;
using namespace Utils;
ToolWidget::ToolWidget(QWidget *parent) ToolWidget::ToolWidget(QWidget *parent)
: Utils::FadingPanel(parent), m_buildStepEnabled(true) : Utils::FadingPanel(parent), m_buildStepEnabled(true)
@@ -68,11 +70,7 @@ ToolWidget::ToolWidget(QWidget *parent)
hbox->setContentsMargins(0, 0, 0, 0); hbox->setContentsMargins(0, 0, 0, 0);
hbox->setSpacing(0); hbox->setSpacing(0);
m_firstWidget->setLayout(hbox); m_firstWidget->setLayout(hbox);
#ifdef Q_OS_MAC QSize buttonSize(20, HostOsInfo::isMacHost() ? 20 : 26);
QSize buttonSize(20, 20);
#else
QSize buttonSize(20, 26);
#endif
m_disableButton = new QToolButton(m_firstWidget); m_disableButton = new QToolButton(m_firstWidget);
m_disableButton->setAutoRaise(true); m_disableButton->setAutoRaise(true);
@@ -139,17 +137,15 @@ void ToolWidget::setBuildStepEnabled(bool b)
{ {
m_buildStepEnabled = b; m_buildStepEnabled = b;
if (m_buildStepEnabled) { if (m_buildStepEnabled) {
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
m_firstWidget->setOpacity(m_targetOpacity); m_firstWidget->setOpacity(m_targetOpacity);
#else else
m_firstWidget->fadeTo(m_targetOpacity); m_firstWidget->fadeTo(m_targetOpacity);
#endif
} else { } else {
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
m_firstWidget->setOpacity(1.0); m_firstWidget->setOpacity(1.0);
#else else
m_firstWidget->fadeTo(1.0); m_firstWidget->fadeTo(1.0);
#endif
} }
m_disableButton->setChecked(!b); m_disableButton->setChecked(!b);
} }
@@ -462,9 +458,8 @@ void BuildStepListWidget::setupUi()
hboxLayout->addStretch(10); hboxLayout->addStretch(10);
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost())
m_addButton->setAttribute(Qt::WA_MacSmallSize); m_addButton->setAttribute(Qt::WA_MacSmallSize);
#endif
m_vbox->addLayout(hboxLayout); m_vbox->addLayout(hboxLayout);
@@ -32,6 +32,7 @@
#include "customwizard.h" #include "customwizard.h"
#include "customwizardparameters.h" #include "customwizardparameters.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QProcess> #include <QProcess>
@@ -66,15 +67,16 @@ QStringList fixGeneratorScript(const QString &configFile, QString binary)
} }
} // not absolute } // not absolute
QStringList rc(binary); QStringList rc(binary);
#ifdef Q_OS_WIN // Windows: Cannot run scripts by QProcess, do 'cmd /c' if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Cannot run scripts by QProcess, do 'cmd /c'
const QString extension = binaryInfo.suffix(); const QString extension = binaryInfo.suffix();
if (!extension.isEmpty() && extension.compare(QLatin1String("exe"), Qt::CaseInsensitive) != 0) { if (!extension.isEmpty() && extension.compare(QLatin1String("exe"),
rc.push_front(QLatin1String("/C")); Qt::CaseInsensitive) != 0) {
rc.push_front(QString::fromLocal8Bit(qgetenv("COMSPEC"))); rc.push_front(QLatin1String("/C"));
if (rc.front().isEmpty()) rc.push_front(QString::fromLocal8Bit(qgetenv("COMSPEC")));
rc.front() = QLatin1String("cmd.exe"); if (rc.front().isEmpty())
rc.front() = QLatin1String("cmd.exe");
}
} }
#endif
return rc; return rc;
} }
@@ -31,6 +31,7 @@
#include "environmentitemswidget.h" #include "environmentitemswidget.h"
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <texteditor/snippets/snippeteditor.h> #include <texteditor/snippets/snippeteditor.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
@@ -54,9 +55,8 @@ QList<Utils::EnvironmentItem> EnvironmentItemsWidgetPrivate::cleanUp(
QSet<QString> uniqueSet; QSet<QString> uniqueSet;
for (int i = items.count() - 1; i >= 0; i--) { for (int i = items.count() - 1; i >= 0; i--) {
Utils::EnvironmentItem item = items.at(i); Utils::EnvironmentItem item = items.at(i);
#if defined(Q_OS_WIN) if (Utils::HostOsInfo::isWindowsHost())
item.name = item.name.toUpper(); item.name = item.name.toUpper();
#endif
const QString &itemName = item.name; const QString &itemName = item.name;
QString emptyName = itemName; QString emptyName = itemName;
emptyName.remove(QLatin1Char(' ')); emptyName.remove(QLatin1Char(' '));
+34 -38
View File
@@ -38,6 +38,7 @@
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
@@ -132,19 +133,19 @@ static QByteArray gccPredefinedMacros(const FileName &gcc, const QStringList &ar
arguments << QLatin1String("-"); arguments << QLatin1String("-");
QByteArray predefinedMacros = runGcc(gcc, arguments, env); QByteArray predefinedMacros = runGcc(gcc, arguments, env);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
// Turn off flag indicating Apple's blocks support // Turn off flag indicating Apple's blocks support
const QByteArray blocksDefine("#define __BLOCKS__ 1"); const QByteArray blocksDefine("#define __BLOCKS__ 1");
const QByteArray blocksUndefine("#undef __BLOCKS__"); const QByteArray blocksUndefine("#undef __BLOCKS__");
const int idx = predefinedMacros.indexOf(blocksDefine); const int idx = predefinedMacros.indexOf(blocksDefine);
if (idx != -1) { if (idx != -1) {
predefinedMacros.replace(idx, blocksDefine.length(), blocksUndefine); predefinedMacros.replace(idx, blocksDefine.length(), blocksUndefine);
} }
// Define __strong and __weak (used for Apple's GC extension of C) to be empty // Define __strong and __weak (used for Apple's GC extension of C) to be empty
predefinedMacros.append("#define __strong\n"); predefinedMacros.append("#define __strong\n");
predefinedMacros.append("#define __weak\n"); predefinedMacros.append("#define __weak\n");
#endif // Q_OS_MAC }
return predefinedMacros; return predefinedMacros;
} }
@@ -587,11 +588,11 @@ ToolChain *Internal::GccToolChainFactory::create()
QList<ToolChain *> Internal::GccToolChainFactory::autoDetect() QList<ToolChain *> Internal::GccToolChainFactory::autoDetect()
{ {
QList<ToolChain *> tcs; QList<ToolChain *> tcs;
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
// Old mac compilers needed to support macx-gccXY mkspecs: // Old mac compilers needed to support macx-gccXY mkspecs:
tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), Abi::hostAbi())); tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), Abi::hostAbi()));
tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), Abi::hostAbi())); tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), Abi::hostAbi()));
#endif }
tcs.append(autoDetectToolchains(QLatin1String("g++"), Abi::hostAbi())); tcs.append(autoDetectToolchains(QLatin1String("g++"), Abi::hostAbi()));
return tcs; return tcs;
@@ -764,11 +765,9 @@ QString ClangToolChain::typeDisplayName() const
QString ClangToolChain::makeCommand() const QString ClangToolChain::makeCommand() const
{ {
#if defined(Q_OS_WIN) if (Utils::HostOsInfo::isWindowsHost())
return QLatin1String("mingw32-make.exe"); return QLatin1String("mingw32-make.exe");
#else
return QLatin1String("make"); return QLatin1String("make");
#endif
} }
QList<FileName> ClangToolChain::suggestedMkspecList() const QList<FileName> ClangToolChain::suggestedMkspecList() const
@@ -865,29 +864,26 @@ QString MingwToolChain::typeDisplayName() const
QList<FileName> MingwToolChain::suggestedMkspecList() const QList<FileName> MingwToolChain::suggestedMkspecList() const
{ {
#if defined(Q_OS_WIN) if (Utils::HostOsInfo::isWindowsHost())
return QList<FileName>() << FileName::fromString(QLatin1String("win32-g++")); return QList<FileName>() << FileName::fromString(QLatin1String("win32-g++"));
#elif defined(Q_OS_LINUX) if (Utils::HostOsInfo::isLinuxHost()) {
if (version().startsWith("4.6.")) if (version().startsWith("4.6."))
return QList<FileName>() return QList<FileName>()
<< FileName::fromString(QLatin1String("win32-g++-4.6-cross")) << FileName::fromString(QLatin1String("win32-g++-4.6-cross"))
<< FileName::fromString(QLatin1String("unsupported/win32-g++-4.6-cross")); << FileName::fromString(QLatin1String("unsupported/win32-g++-4.6-cross"));
else else
return QList<FileName>() return QList<FileName>()
<< FileName::fromString(QLatin1String("win32-g++-cross")) << FileName::fromString(QLatin1String("win32-g++-cross"))
<< FileName::fromString(QLatin1String("unsupported/win32-g++-cross")); << FileName::fromString(QLatin1String("unsupported/win32-g++-cross"));
#else }
return QList<FileName>(); return QList<FileName>();
#endif
} }
QString MingwToolChain::makeCommand() const QString MingwToolChain::makeCommand() const
{ {
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost())
return QLatin1String("mingw32-make.exe"); return QLatin1String("mingw32-make.exe");
#else
return QLatin1String("make"); return QLatin1String("make");
#endif
} }
ToolChain *MingwToolChain::clone() const ToolChain *MingwToolChain::clone() const
@@ -35,6 +35,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <utils/hostosinfo.h>
#include <QLabel> #include <QLabel>
#include <QCoreApplication> #include <QCoreApplication>
@@ -48,9 +49,7 @@ ProjectExplorerSettingsWidget::ProjectExplorerSettingsWidget(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
#ifndef Q_OS_WIN setJomVisible(Utils::HostOsInfo::isWindowsHost());
setJomVisible(false);
#endif
m_ui.directoryButtonGroup->setId(m_ui.currentDirectoryRadioButton, UseCurrentDirectory); m_ui.directoryButtonGroup->setId(m_ui.currentDirectoryRadioButton, UseCurrentDirectory);
m_ui.directoryButtonGroup->setId(m_ui.directoryRadioButton, UseProjectDirectory); m_ui.directoryButtonGroup->setId(m_ui.directoryRadioButton, UseProjectDirectory);
connect(m_ui.directoryButtonGroup, SIGNAL(buttonClicked(int)), connect(m_ui.directoryButtonGroup, SIGNAL(buttonClicked(int)),
@@ -43,6 +43,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/persistentsettings.h> #include <utils/persistentsettings.h>
@@ -1894,7 +1895,6 @@ static const char * const lameArgListKeys[] = {
0 0
}; };
#ifdef Q_OS_UNIX
inline static bool isSpecialChar(ushort c) inline static bool isSpecialChar(ushort c)
{ {
// Chars that should be quoted (TM). This includes: // Chars that should be quoted (TM). This includes:
@@ -1913,27 +1913,26 @@ inline static bool hasSpecialChars(const QString &arg)
return true; return true;
return false; return false;
} }
#endif
// These were split according to sane (even if a bit arcane) rules // These were split according to sane (even if a bit arcane) rules
static QVariant version8ArgNodeHandler(const QVariant &var) static QVariant version8ArgNodeHandler(const QVariant &var)
{ {
QString ret; QString ret;
foreach (const QVariant &svar, var.toList()) { foreach (const QVariant &svar, var.toList()) {
#ifdef Q_OS_UNIX if (Utils::HostOsInfo::isAnyUnixHost()) {
// We don't just addArg, so we don't disarm existing env expansions. // We don't just addArg, so we don't disarm existing env expansions.
// This is a bit fuzzy logic ... // This is a bit fuzzy logic ...
QString s = svar.toString(); QString s = svar.toString();
s.replace(QLatin1Char('\\'), QLatin1String("\\\\")); s.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
s.replace(QLatin1Char('"'), QLatin1String("\\\"")); s.replace(QLatin1Char('"'), QLatin1String("\\\""));
s.replace(QLatin1Char('`'), QLatin1String("\\`")); s.replace(QLatin1Char('`'), QLatin1String("\\`"));
if (s != svar.toString() || hasSpecialChars(s)) if (s != svar.toString() || hasSpecialChars(s))
s.prepend(QLatin1Char('"')).append(QLatin1Char('"')); s.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
Utils::QtcProcess::addArgs(&ret, s); Utils::QtcProcess::addArgs(&ret, s);
#else } else {
// Under windows, env expansions cannot be quoted anyway. // Under windows, env expansions cannot be quoted anyway.
Utils::QtcProcess::addArg(&ret, svar.toString()); Utils::QtcProcess::addArg(&ret, svar.toString());
#endif }
} }
return QVariant(ret); return QVariant(ret);
} }
@@ -1988,13 +1987,13 @@ static const char * const envExpandedKeys[] = {
static QString version8NewVar(const QString &old) static QString version8NewVar(const QString &old)
{ {
QString ret = old; QString ret = old;
#ifdef Q_OS_UNIX if (Utils::HostOsInfo::isAnyUnixHost()) {
ret.prepend(QLatin1String("${")); ret.prepend(QLatin1String("${"));
ret.append(QLatin1Char('}')); ret.append(QLatin1Char('}'));
#else } else {
ret.prepend(QLatin1Char('%')); ret.prepend(QLatin1Char('%'));
ret.append(QLatin1Char('%')); ret.append(QLatin1Char('%'));
#endif }
return ret; return ret;
} }
@@ -2008,65 +2007,65 @@ static QVariant version8EnvNodeTransform(const QVariant &var)
QLatin1String("%{sourceDir}")); QLatin1String("%{sourceDir}"));
result.replace(QRegExp(QLatin1String("%BUILDDIR%|\\$(BUILDDIR\\b|\\{BUILDDIR\\})")), result.replace(QRegExp(QLatin1String("%BUILDDIR%|\\$(BUILDDIR\\b|\\{BUILDDIR\\})")),
QLatin1String("%{buildDir}")); QLatin1String("%{buildDir}"));
#ifdef Q_OS_UNIX if (Utils::HostOsInfo::isAnyUnixHost()) {
for (int vStart = -1, i = 0; i < result.length(); ) { for (int vStart = -1, i = 0; i < result.length(); ) {
QChar c = result.at(i++); QChar c = result.at(i++);
if (c == QLatin1Char('%')) { if (c == QLatin1Char('%')) {
if (vStart > 0 && vStart < i - 1) { if (vStart > 0 && vStart < i - 1) {
QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart)); QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
result.replace(vStart - 1, i - vStart + 1, nv); result.replace(vStart - 1, i - vStart + 1, nv);
i = vStart - 1 + nv.length(); i = vStart - 1 + nv.length();
vStart = -1; vStart = -1;
} else { } else {
vStart = i; vStart = i;
}
} else if (vStart > 0) {
// Sanity check so we don't catch too much garbage
if (!c.isLetterOrNumber() && c != QLatin1Char('_'))
vStart = -1;
} }
} else if (vStart > 0) {
// Sanity check so we don't catch too much garbage
if (!c.isLetterOrNumber() && c != QLatin1Char('_'))
vStart = -1;
} }
} } else {
#else enum { BASE, OPTIONALVARIABLEBRACE, VARIABLE, BRACEDVARIABLE } state = BASE;
enum { BASE, OPTIONALVARIABLEBRACE, VARIABLE, BRACEDVARIABLE } state = BASE; int vStart = -1;
int vStart = -1;
for (int i = 0; i < result.length();) { for (int i = 0; i < result.length();) {
QChar c = result.at(i++); QChar c = result.at(i++);
if (state == BASE) { if (state == BASE) {
if (c == QLatin1Char('$')) if (c == QLatin1Char('$'))
state = OPTIONALVARIABLEBRACE; state = OPTIONALVARIABLEBRACE;
} else if (state == OPTIONALVARIABLEBRACE) { } else if (state == OPTIONALVARIABLEBRACE) {
if (c == QLatin1Char('{')) { if (c == QLatin1Char('{')) {
state = BRACEDVARIABLE; state = BRACEDVARIABLE;
vStart = i; vStart = i;
} else if (c.isLetterOrNumber() || c == QLatin1Char('_')) { } else if (c.isLetterOrNumber() || c == QLatin1Char('_')) {
state = VARIABLE; state = VARIABLE;
vStart = i - 1; vStart = i - 1;
} else { } else {
state = BASE; state = BASE;
} }
} else if (state == BRACEDVARIABLE) { } else if (state == BRACEDVARIABLE) {
if (c == QLatin1Char('}')) { if (c == QLatin1Char('}')) {
QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart)); QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
result.replace(vStart - 2, i - vStart + 2, nv); result.replace(vStart - 2, i - vStart + 2, nv);
i = vStart + nv.length(); i = vStart + nv.length();
state = BASE; state = BASE;
} }
} else if (state == VARIABLE) { } else if (state == VARIABLE) {
if (!c.isLetterOrNumber() && c != QLatin1Char('_')) { if (!c.isLetterOrNumber() && c != QLatin1Char('_')) {
QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart)); QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
result.replace(vStart - 1, i - vStart, nv); result.replace(vStart - 1, i - vStart, nv);
i = vStart - 1 + nv.length(); // On the same char - could be next expansion. i = vStart - 1 + nv.length(); // On the same char - could be next expansion.
state = BASE; state = BASE;
}
} }
} }
if (state == VARIABLE) {
QString nv = version8NewVar(result.mid(vStart));
result.truncate(vStart - 1);
result += nv;
}
} }
if (state == VARIABLE) {
QString nv = version8NewVar(result.mid(vStart));
result.truncate(vStart - 1);
result += nv;
}
#endif
return QVariant(result); return QVariant(result);
} }
@@ -2522,13 +2521,15 @@ void Version11Handler::addRunConfigurations(Profile *p,
static QString targetRoot(const QString &qmakePath) static QString targetRoot(const QString &qmakePath)
{ {
#ifdef Q_OS_WIN Qt::CaseSensitivity cs;
Qt::CaseSensitivity cs = Qt::CaseInsensitive; QString binQmake;
const QString binQmake = "/bin/qmake.exe"; if (Utils::HostOsInfo::isWindowsHost()) {
#else cs = Qt::CaseInsensitive;
Qt::CaseSensitivity cs = Qt::CaseSensitive; binQmake = "/bin/qmake.exe";
const QString binQmake = "/bin/qmake"; } else {
#endif cs = Qt::CaseSensitive;
binQmake = "/bin/qmake";
}
return QDir::cleanPath(qmakePath).remove(binQmake, cs); return QDir::cleanPath(qmakePath).remove(binQmake, cs);
} }
@@ -28,6 +28,8 @@
** **
**************************************************************************/ **************************************************************************/
#include <utils/hostosinfo.h>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QObject> #include <QObject>
@@ -57,21 +59,21 @@ void XUIFileDialog::runSaveFileDialog(const QString& path, QWidget* parent, QObj
if (dir.isNull()) if (dir.isNull())
dir = XUIFileDialog::defaultFolder(); dir = XUIFileDialog::defaultFolder();
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
QFileDialog *dialog = new QFileDialog(parent, Qt::Sheet); QFileDialog *dialog = new QFileDialog(parent, Qt::Sheet);
dialog->setFileMode(QFileDialog::AnyFile); dialog->setFileMode(QFileDialog::AnyFile);
dialog->setAcceptMode(QFileDialog::AcceptSave); dialog->setAcceptMode(QFileDialog::AcceptSave);
dialog->setNameFilters(XUIFileDialog::fileNameFilters()); dialog->setNameFilters(XUIFileDialog::fileNameFilters());
dialog->setDirectory(dir); dialog->setDirectory(dir);
dialog->open(receiver, member); dialog->open(receiver, member);
#else // !Q_OS_MAC } else {
QString caption = QCoreApplication::translate("QmlDesigner::XUIFileDialog", "Save File"); QString caption = QCoreApplication::translate("QmlDesigner::XUIFileDialog", "Save File");
QString fileName = QFileDialog::getSaveFileName(parent, caption, dir, XUIFileDialog::fileNameFilters().join(";;")); QString fileName = QFileDialog::getSaveFileName(parent, caption, dir, XUIFileDialog::fileNameFilters().join(";;"));
QmlDesigner::Internal::SignalEmitter emitter; QmlDesigner::Internal::SignalEmitter emitter;
QObject::connect(&emitter, SIGNAL(fileNameSelected(QString)), receiver, member); QObject::connect(&emitter, SIGNAL(fileNameSelected(QString)), receiver, member);
emitter.emitFileNameSelected(fileName); emitter.emitFileNameSelected(fileName);
#endif // Q_OS_MAC }
} }
QStringList XUIFileDialog::fileNameFilters() QStringList XUIFileDialog::fileNameFilters()
@@ -70,6 +70,9 @@
#include "nodeinstanceview.h" #include "nodeinstanceview.h"
#include "import.h" #include "import.h"
#include <utils/hostosinfo.h>
#include <QMessageBox> #include <QMessageBox>
@@ -445,9 +448,8 @@ QString NodeInstanceServerProxy::qmlPuppetApplicationName() const
} else { } else {
appName = QLatin1String("qmlpuppet"); appName = QLatin1String("qmlpuppet");
} }
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost())
appName += QLatin1String(".exe"); appName += QLatin1String(".exe");
#endif
return appName; return appName;
} }
@@ -455,9 +457,8 @@ QString NodeInstanceServerProxy::qmlPuppetApplicationName() const
QString NodeInstanceServerProxy::macOSBundlePath(const QString &path) const QString NodeInstanceServerProxy::macOSBundlePath(const QString &path) const
{ {
QString applicationPath = path; QString applicationPath = path;
#ifdef Q_OS_MACX if (Utils::HostOsInfo::isMacHost())
applicationPath += QLatin1String("/qmlpuppet.app/Contents/MacOS"); applicationPath += QLatin1String("/qmlpuppet.app/Contents/MacOS");
#endif
return applicationPath; return applicationPath;
} }
@@ -32,6 +32,8 @@
#include "model.h" #include "model.h"
#include "metainfo.h" #include "metainfo.h"
#include <utils/hostosinfo.h>
#include <QDir> #include <QDir>
#include <QMetaType> #include <QMetaType>
#include <QUrl> #include <QUrl>
@@ -56,12 +58,8 @@ static inline QStringList importPaths() {
// env import paths // env import paths
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH"); QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
if (!envImportPath.isEmpty()) { if (!envImportPath.isEmpty()) {
#if defined(Q_OS_WIN) const QChar sep = Utils::HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
QLatin1Char pathSep(';'); paths = QString::fromLatin1(envImportPath).split(sep, QString::SkipEmptyParts);
#else
QLatin1Char pathSep(':');
#endif
paths = QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts);
} }
return paths; return paths;
+13 -16
View File
@@ -55,6 +55,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <integrationcore.h> #include <integrationcore.h>
@@ -128,13 +129,10 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error
m_designerCore = new QmlDesigner::IntegrationCore; m_designerCore = new QmlDesigner::IntegrationCore;
m_pluginInstance = this; m_pluginInstance = this;
#ifdef Q_OS_MAC const QString pluginPath = Utils::HostOsInfo::isMacHost()
const QString pluginPath = QCoreApplication::applicationDirPath() + "/../PlugIns/QmlDesigner"; ? QString(QCoreApplication::applicationDirPath() + "/../PlugIns/QmlDesigner")
#else : QString(QCoreApplication::applicationDirPath() + "/../"
const QString pluginPath = QCoreApplication::applicationDirPath() + "/../" + QLatin1String(IDE_LIBRARY_BASENAME) + "/qtcreator/qmldesigner");
+ QLatin1String(IDE_LIBRARY_BASENAME) + "/qtcreator/qmldesigner";
#endif
m_designerCore->pluginManager()->setPluginPaths(QStringList() << pluginPath); m_designerCore->pluginManager()->setPluginPaths(QStringList() << pluginPath);
createDesignModeWidget(); createDesignModeWidget();
@@ -260,15 +258,14 @@ void BauhausPlugin::createDesignModeWidget()
command = Core::ActionManager::registerAction(m_mainWidget->hideSidebarsAction(), command = Core::ActionManager::registerAction(m_mainWidget->hideSidebarsAction(),
Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext); Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext);
#ifdef Q_OS_MACX if (Utils::HostOsInfo::isMacHost()) {
// add second shortcut to trigger delete // add second shortcut to trigger delete
QAction *deleteAction = new QAction(m_mainWidget); QAction *deleteAction = new QAction(m_mainWidget);
deleteAction->setShortcut(QKeySequence(QLatin1String("Backspace"))); deleteAction->setShortcut(QKeySequence(QLatin1String("Backspace")));
connect(deleteAction, SIGNAL(triggered()), m_mainWidget->deleteAction(), connect(deleteAction, SIGNAL(triggered()), m_mainWidget->deleteAction(),
SIGNAL(triggered())); SIGNAL(triggered()));
m_mainWidget->addAction(deleteAction);
m_mainWidget->addAction(deleteAction); }
#endif // Q_OS_MACX
connect(m_editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)), connect(m_editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateEditor(Core::IEditor*))); this, SLOT(updateEditor(Core::IEditor*)));
+5 -8
View File
@@ -51,6 +51,7 @@
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <qtsupport/baseqtversion.h> #include <qtsupport/baseqtversion.h>
#include <utils/hostosinfo.h>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
@@ -465,9 +466,9 @@ static bool findNewQmlLibraryInPath(const QString &path,
return false; return false;
} }
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
// QTCREATORBUG-3402 - be case sensitive even here? // QTCREATORBUG-3402 - be case sensitive even here?
#endif }
// found a new library! // found a new library!
qmldirFile.open(QFile::ReadOnly); qmldirFile.open(QFile::ReadOnly);
@@ -654,11 +655,7 @@ static QStringList environmentImportPaths()
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH"); QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
#if defined(Q_OS_WIN) const QChar pathSep = Utils::HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
QLatin1Char pathSep(';');
#else
QLatin1Char pathSep(':');
#endif
foreach (const QString &path, QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts)) { foreach (const QString &path, QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts)) {
QString canonicalPath = QDir(path).canonicalPath(); QString canonicalPath = QDir(path).canonicalPath();
if (!canonicalPath.isEmpty() && !paths.contains(canonicalPath)) if (!canonicalPath.isEmpty() && !paths.contains(canonicalPath))
+8 -10
View File
@@ -35,6 +35,7 @@
#include "qnxconstants.h" #include "qnxconstants.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QTextStream> #include <QTextStream>
@@ -72,11 +73,8 @@ QMultiMap<QString, QString> parseEnvironmentFile(const QString &fileName)
QMapIterator<QString, QString> it(fileContent); QMapIterator<QString, QString> it(fileContent);
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
#if defined Q_OS_WIN const QChar sep = Utils::HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
QStringList values = it.value().split(QLatin1Char(';')); const QStringList values = it.value().split(sep);
#elif defined Q_OS_UNIX
QStringList values = it.value().split(QLatin1Char(':'));
#endif
QString key = it.key(); QString key = it.key();
foreach (const QString &value, values) { foreach (const QString &value, values) {
const QString ownKeyAsWindowsVar = QLatin1Char('%') + key + QLatin1Char('%'); const QString ownKeyAsWindowsVar = QLatin1Char('%') + key + QLatin1Char('%');
@@ -145,11 +143,11 @@ QMultiMap<QString, QString> BlackBerryQtVersion::environment() const
if (sdkPath().isEmpty()) if (sdkPath().isEmpty())
return QMultiMap<QString, QString>(); return QMultiMap<QString, QString>();
#if defined Q_OS_WIN QString envFile;
const QString envFile = sdkPath() + QLatin1String("/bbndk-env.bat"); if (Utils::HostOsInfo::isWindowsHost())
#elif defined Q_OS_UNIX envFile = sdkPath() + QLatin1String("/bbndk-env.bat");
const QString envFile = sdkPath() + QLatin1String("/bbndk-env.sh"); else if (Utils::HostOsInfo::isAnyUnixHost())
#endif envFile = sdkPath() + QLatin1String("/bbndk-env.sh");
return parseEnvironmentFile(envFile); return parseEnvironmentFile(envFile);
} }
+18 -16
View File
@@ -35,6 +35,8 @@
#include "qnxconstants.h" #include "qnxconstants.h"
#include <utils/hostosinfo.h>
using namespace Qnx; using namespace Qnx;
using namespace Qnx::Internal; using namespace Qnx::Internal;
@@ -96,26 +98,26 @@ QMultiMap<QString, QString> QnxQtVersion::environment() const
QMultiMap<QString, QString> environment; QMultiMap<QString, QString> environment;
#if defined Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
// TODO: // TODO:
//environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx")); //environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6")); environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6"));
environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/win32/x86")); environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/win32/x86"));
environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/win32/x86/usr/bin")); environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/win32/x86/usr/bin"));
// TODO: // TODO:
//environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin")); //environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
#elif defined Q_OS_UNIX } else if (Utils::HostOsInfo::isAnyUnixHost()) {
environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx")); environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6")); environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6"));
environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/linux/x86")); environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/linux/x86"));
environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/bin")); environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/bin"));
environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin")); environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
environment.insert(QLatin1String("LD_LIBRARY_PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/lib")); environment.insert(QLatin1String("LD_LIBRARY_PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/lib"));
#endif }
environment.insert(QLatin1String("QNX_JAVAHOME"), sdkPath() + QLatin1String("/_jvm")); environment.insert(QLatin1String("QNX_JAVAHOME"), sdkPath() + QLatin1String("/_jvm"));
environment.insert(QLatin1String("MAKEFLAGS"), QLatin1String("-I") + sdkPath() + QLatin1String("/target/qnx6/usr/include")); environment.insert(QLatin1String("MAKEFLAGS"), QLatin1String("-I") + sdkPath() + QLatin1String("/target/qnx6/usr/include"));
@@ -32,6 +32,8 @@
#include "ui_librarydetailswidget.h" #include "ui_librarydetailswidget.h"
#include "librarydetailscontroller.h" #include "librarydetailscontroller.h"
#include <utils/hostosinfo.h>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QRadioButton> #include <QRadioButton>
#include <QLabel> #include <QLabel>
@@ -176,10 +178,10 @@ LibraryTypePage::LibraryTypePage(AddLibraryWizard *parent)
packageLabel->setAttribute(Qt::WA_MacSmallSize, true); packageLabel->setAttribute(Qt::WA_MacSmallSize, true);
layout->addWidget(packageLabel); layout->addWidget(packageLabel);
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost()) {
m_packageRadio->setVisible(false); m_packageRadio->setVisible(false);
packageLabel->setVisible(false); packageLabel->setVisible(false);
#endif }
// select the default // select the default
m_internalRadio->setChecked(true); m_internalRadio->setChecked(true);
@@ -41,6 +41,7 @@
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <utils/hostosinfo.h>
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
@@ -67,27 +68,31 @@ LibraryDetailsController::LibraryDetailsController(
m_windowsGroupVisible(true), m_windowsGroupVisible(true),
m_libraryDetailsWidget(libraryDetails) m_libraryDetailsWidget(libraryDetails)
{ {
#ifdef Q_OS_MAC switch (Utils::HostOsInfo::hostOs()) {
m_creatorPlatform = CreatorMac; case Utils::HostOsInfo::HostOsMac:
#endif m_creatorPlatform = CreatorMac;
#ifdef Q_OS_LINUX break;
m_creatorPlatform = CreatorLinux; case Utils::HostOsInfo::HostOsLinux:
#endif
#ifdef Q_OS_WIN
m_creatorPlatform = CreatorWindows;
#endif
#ifndef Q_OS_LINUX
// project for which we are going to insert the snippet
const ProjectExplorer::Project *project =
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile);
// if its tool chain is maemo behave the same as we would be on linux
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(project->activeTarget()->profile());
if (tc
&& (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor
|| tc->targetAbi().osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor))
m_creatorPlatform = CreatorLinux; m_creatorPlatform = CreatorLinux;
#endif break;
case Utils::HostOsInfo::HostOsWindows:
m_creatorPlatform = CreatorWindows;
break;
default:
break;
}
if (!Utils::HostOsInfo::isLinuxHost()) {
// project for which we are going to insert the snippet
const ProjectExplorer::Project *project =
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile);
// if its tool chain is maemo behave the same as we would be on linux
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(project->activeTarget()->profile());
if (tc
&& (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor
|| tc->targetAbi().osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor))
m_creatorPlatform = CreatorLinux;
}
setPlatformsVisible(true); setPlatformsVisible(true);
setLinkageGroupVisible(true); setLinkageGroupVisible(true);
+16 -14
View File
@@ -54,6 +54,7 @@
#include <qtsupport/qtprofileinformation.h> #include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtversionmanager.h> #include <qtsupport/qtversionmanager.h>
#include <qtsupport/debugginghelperbuildtask.h> #include <qtsupport/debugginghelperbuildtask.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
@@ -66,6 +67,7 @@
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace { namespace {
const char * const QMAKE_BS_ID("QtProjectManager.QMakeBuildStep"); const char * const QMAKE_BS_ID("QtProjectManager.QMakeBuildStep");
@@ -137,7 +139,7 @@ QString QMakeStep::allArguments(bool shorted)
arguments << QLatin1String("-r"); arguments << QLatin1String("-r");
bool userProvidedMkspec = false; bool userProvidedMkspec = false;
for (Utils::QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) { for (QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) { if (ait.value() == QLatin1String("-spec")) {
if (ait.next()) { if (ait.next()) {
userProvidedMkspec = true; userProvidedMkspec = true;
@@ -145,7 +147,7 @@ QString QMakeStep::allArguments(bool shorted)
} }
} }
} }
Utils::FileName specArg = mkspec(); FileName specArg = mkspec();
if (!userProvidedMkspec && !specArg.isEmpty()) if (!userProvidedMkspec && !specArg.isEmpty())
arguments << QLatin1String("-spec") << specArg.toUserOutput(); arguments << QLatin1String("-spec") << specArg.toUserOutput();
@@ -154,12 +156,12 @@ QString QMakeStep::allArguments(bool shorted)
arguments << deducedArguments(); arguments << deducedArguments();
QString args = Utils::QtcProcess::joinArgs(arguments); QString args = QtcProcess::joinArgs(arguments);
// User arguments // User arguments
Utils::QtcProcess::addArgs(&args, m_userArgs); QtcProcess::addArgs(&args, m_userArgs);
// moreArgumentsAfter // moreArgumentsAfter
foreach (const QString &arg, deducedArgumentsAfter()) foreach (const QString &arg, deducedArgumentsAfter())
Utils::QtcProcess::addArg(&args, arg); QtcProcess::addArg(&args, arg);
return args; return args;
} }
@@ -175,11 +177,11 @@ QStringList QMakeStep::deducedArguments()
ProjectExplorer::Abi targetAbi; ProjectExplorer::Abi targetAbi;
if (tc) if (tc)
targetAbi = tc->targetAbi(); targetAbi = tc->targetAbi();
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) if ((HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost())
if ((targetAbi.osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor && (targetAbi.osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor
|| targetAbi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor)) || targetAbi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor)) {
arguments << QLatin1String("-unix"); arguments << QLatin1String("-unix");
#endif }
// explicitly add architecture to CONFIG // explicitly add architecture to CONFIG
if ((targetAbi.os() == ProjectExplorer::Abi::MacOS) if ((targetAbi.os() == ProjectExplorer::Abi::MacOS)
@@ -257,7 +259,7 @@ bool QMakeStep::init()
else else
workingDirectory = qt4bc->buildDirectory(); workingDirectory = qt4bc->buildDirectory();
Utils::FileName program = qtVersion->qmakeCommand(); FileName program = qtVersion->qmakeCommand();
QString makefile = workingDirectory; QString makefile = workingDirectory;
@@ -444,7 +446,7 @@ void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
QStringList QMakeStep::parserArguments() QStringList QMakeStep::parserArguments()
{ {
QStringList result; QStringList result;
for (Utils::QtcProcess::ConstArgIterator ait(allArguments()); ait.next(); ) for (QtcProcess::ConstArgIterator ait(allArguments()); ait.next(); )
if (ait.isSimple()) if (ait.isSimple())
result << ait.value(); result << ait.value();
return result; return result;
@@ -455,13 +457,13 @@ QString QMakeStep::userArguments()
return m_userArgs; return m_userArgs;
} }
Utils::FileName QMakeStep::mkspec() FileName QMakeStep::mkspec()
{ {
QString additionalArguments = m_userArgs; QString additionalArguments = m_userArgs;
for (Utils::QtcProcess::ArgIterator ait(&additionalArguments); ait.next(); ) { for (QtcProcess::ArgIterator ait(&additionalArguments); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) { if (ait.value() == QLatin1String("-spec")) {
if (ait.next()) if (ait.next())
return Utils::FileName::fromUserInput(ait.value()); return FileName::fromUserInput(ait.value());
} }
} }
@@ -59,6 +59,7 @@
#include <qtsupport/baseqtversion.h> #include <qtsupport/baseqtversion.h>
#include <qtsupport/profilereader.h> #include <qtsupport/profilereader.h>
#include <qtsupport/qtprofileinformation.h> #include <qtsupport/qtprofileinformation.h>
#include <utils/hostosinfo.h>
#include <QFormLayout> #include <QFormLayout>
#include <QInputDialog> #include <QInputDialog>
@@ -262,13 +263,13 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
toplayout->addRow(QString(), m_useTerminalCheck); toplayout->addRow(QString(), m_useTerminalCheck);
m_useTerminalCheck->setVisible(!m_qt4RunConfiguration->forcedGuiMode()); m_useTerminalCheck->setVisible(!m_qt4RunConfiguration->forcedGuiMode());
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost()) {
m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this); m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
m_usingDyldImageSuffix->setChecked(m_qt4RunConfiguration->isUsingDyldImageSuffix()); m_usingDyldImageSuffix->setChecked(m_qt4RunConfiguration->isUsingDyldImageSuffix());
toplayout->addRow(QString(), m_usingDyldImageSuffix); toplayout->addRow(QString(), m_usingDyldImageSuffix);
connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)), connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)),
this, SLOT(usingDyldImageSuffixToggled(bool))); this, SLOT(usingDyldImageSuffixToggled(bool)));
#endif }
QLabel *environmentLabel = new QLabel(this); QLabel *environmentLabel = new QLabel(this);
environmentLabel->setText(tr("Run Environment")); environmentLabel->setText(tr("Run Environment"));
+8 -16
View File
@@ -58,6 +58,7 @@
#include <qtsupport/qtprofileinformation.h> #include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
@@ -338,10 +339,8 @@ struct InternalNode
fileWithoutPrefix = file; fileWithoutPrefix = file;
} }
QStringList parts = fileWithoutPrefix.toString().split(separator, QString::SkipEmptyParts); QStringList parts = fileWithoutPrefix.toString().split(separator, QString::SkipEmptyParts);
#ifndef Q_OS_WIN if (!Utils::HostOsInfo::isWindowsHost() && !isRelative && parts.count() > 0)
if (!isRelative && parts.count() > 0)
parts[0].prepend(separator); parts[0].prepend(separator);
#endif
QStringListIterator it(parts); QStringListIterator it(parts);
InternalNode *currentNode = this; InternalNode *currentNode = this;
QString path = (isRelative ? (projectDirFileName.toString() + QLatin1Char('/')) : QString()); QString path = (isRelative ? (projectDirFileName.toString() + QLatin1Char('/')) : QString());
@@ -1397,13 +1396,8 @@ QString Qt4ProFileNode::makefile() const
QString Qt4ProFileNode::objectExtension() const QString Qt4ProFileNode::objectExtension() const
{ {
if (m_varValues[ObjectExt].isEmpty()) { if (m_varValues[ObjectExt].isEmpty())
#ifdef Q_OS_WIN return Utils::HostOsInfo::isWindowsHost() ? QLatin1String(".obj") : QLatin1String(".o");
return QLatin1String(".obj");
#else
return QLatin1String(".o");
#endif
}
return m_varValues[ObjectExt].first(); return m_varValues[ObjectExt].first();
} }
@@ -2248,13 +2242,12 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
if (result.target.isEmpty()) if (result.target.isEmpty())
result.target = QFileInfo(m_projectFilePath).baseName(); result.target = QFileInfo(m_projectFilePath).baseName();
#if defined (Q_OS_MAC) if (Utils::HostOsInfo::isMacHost()
if (reader->values(QLatin1String("CONFIG")).contains(QLatin1String("app_bundle"))) { && reader->values(QLatin1String("CONFIG")).contains(QLatin1String("app_bundle"))) {
result.workingDir += QLatin1Char('/') result.workingDir += QLatin1Char('/')
+ result.target + result.target
+ QLatin1String(".app/Contents/MacOS"); + QLatin1String(".app/Contents/MacOS");
} }
#endif
result.workingDir = QDir::cleanPath(result.workingDir); result.workingDir = QDir::cleanPath(result.workingDir);
@@ -2281,9 +2274,8 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
result.executable = QDir::cleanPath(wd + QLatin1Char('/') + result.target); result.executable = QDir::cleanPath(wd + QLatin1Char('/') + result.target);
//qDebug() << "##### updateTarget sets:" << result.workingDir << result.executable; //qDebug() << "##### updateTarget sets:" << result.workingDir << result.executable;
#if defined (Q_OS_WIN) if (Utils::HostOsInfo::isWindowsHost())
result.executable += QLatin1String(".exe"); result.executable += QLatin1String(".exe");
#endif
result.valid = true; result.valid = true;
return result; return result;
} }
@@ -78,6 +78,7 @@
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <utils/hostosinfo.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
#ifdef WITH_TESTS #ifdef WITH_TESTS
@@ -153,11 +154,10 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new Qt4BuildConfigurationFactory); addAutoReleasedObject(new Qt4BuildConfigurationFactory);
addAutoReleasedObject(new Qt4RunConfigurationFactory); addAutoReleasedObject(new Qt4RunConfigurationFactory);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
addAutoReleasedObject(new MacDesignerExternalEditor); addAutoReleasedObject(new MacDesignerExternalEditor);
#else else
addAutoReleasedObject(new DesignerExternalEditor); addAutoReleasedObject(new DesignerExternalEditor);
#endif
addAutoReleasedObject(new LinguistExternalEditor); addAutoReleasedObject(new LinguistExternalEditor);
addAutoReleasedObject(new DesktopQtVersionFactory); addAutoReleasedObject(new DesktopQtVersionFactory);
@@ -42,6 +42,7 @@
#include <utils/detailsbutton.h> #include <utils/detailsbutton.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/hostosinfo.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <QCheckBox> #include <QCheckBox>
@@ -93,9 +94,8 @@ Qt4TargetSetupWidget::Qt4TargetSetupWidget(ProjectExplorer::Profile *p,
QWidget *w = new QWidget; QWidget *w = new QWidget;
m_newBuildsLayout = new QGridLayout; m_newBuildsLayout = new QGridLayout;
m_newBuildsLayout->setMargin(0); m_newBuildsLayout->setMargin(0);
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
m_newBuildsLayout->setSpacing(0); m_newBuildsLayout->setSpacing(0);
#endif
w->setLayout(m_newBuildsLayout); w->setLayout(m_newBuildsLayout);
layout->addWidget(w); layout->addWidget(w);
+129 -125
View File
@@ -48,6 +48,7 @@
#include <utils/persistentsettings.h> #include <utils/persistentsettings.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <QDir> #include <QDir>
@@ -58,6 +59,7 @@
using namespace QtSupport; using namespace QtSupport;
using namespace QtSupport::Internal; using namespace QtSupport::Internal;
using namespace Utils;
static const char QTVERSIONID[] = "Id"; static const char QTVERSIONID[] = "Id";
static const char QTVERSIONNAME[] = "Name"; static const char QTVERSIONNAME[] = "Name";
@@ -164,7 +166,7 @@ int BaseQtVersion::getUniqueId()
return QtVersionManager::instance()->getUniqueId(); return QtVersionManager::instance()->getUniqueId();
} }
BaseQtVersion::BaseQtVersion(const Utils::FileName &qmakeCommand, bool isAutodetected, const QString &autodetectionSource) BaseQtVersion::BaseQtVersion(const FileName &qmakeCommand, bool isAutodetected, const QString &autodetectionSource)
: m_id(getUniqueId()), : m_id(getUniqueId()),
m_isAutodetected(isAutodetected), m_isAutodetected(isAutodetected),
m_autodetectionSource(autodetectionSource), m_autodetectionSource(autodetectionSource),
@@ -204,10 +206,10 @@ BaseQtVersion::BaseQtVersion()
m_hasDocumentation(false), m_hasDocumentation(false),
m_qmakeIsExecutable(true) m_qmakeIsExecutable(true)
{ {
ctor(Utils::FileName()); ctor(FileName());
} }
void BaseQtVersion::ctor(const Utils::FileName &qmakePath) void BaseQtVersion::ctor(const FileName &qmakePath)
{ {
m_qmakeCommand = qmakePath; m_qmakeCommand = qmakePath;
m_designerCommand.clear(); m_designerCommand.clear();
@@ -225,7 +227,7 @@ BaseQtVersion::~BaseQtVersion()
{ {
} }
QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Utils::FileName &qmakePath, QString BaseQtVersion::defaultDisplayName(const QString &versionString, const FileName &qmakePath,
bool fromPath) bool fromPath)
{ {
QString location; QString location;
@@ -303,7 +305,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::validateProfile(const ProjectExplore
if (!tc) if (!tc)
result << ProjectExplorer::Task(ProjectExplorer::Task::Error, result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
ProjectExplorer::ToolChainProfileInformation::msgNoToolChainInTarget(), ProjectExplorer::ToolChainProfileInformation::msgNoToolChainInTarget(),
Utils::FileName(), -1, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
@@ -322,7 +324,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::validateProfile(const ProjectExplore
version->displayName(), version->displayName(),
qtAbiString); qtAbiString);
result << ProjectExplorer::Task(ProjectExplorer::Task::Error, result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
message, Utils::FileName(), -1, message, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} // Abi mismatch } // Abi mismatch
return result; return result;
@@ -345,7 +347,7 @@ void BaseQtVersion::fromMap(const QVariantMap &map)
QString string = map.value(QLatin1String(QTVERSIONQMAKEPATH)).toString(); QString string = map.value(QLatin1String(QTVERSIONQMAKEPATH)).toString();
if (string.startsWith(QLatin1Char('~'))) if (string.startsWith(QLatin1Char('~')))
string.remove(0, 1).prepend(QDir::homePath()); string.remove(0, 1).prepend(QDir::homePath());
ctor(Utils::FileName::fromUserInput(string)); ctor(FileName::fromUserInput(string));
} }
QVariantMap BaseQtVersion::toMap() const QVariantMap BaseQtVersion::toMap() const
@@ -404,9 +406,9 @@ QStringList BaseQtVersion::warningReason() const
return ret; return ret;
} }
ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const Utils::FileName &ms) const ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const FileName &ms) const
{ {
const Utils::FileName spec = ms.isEmpty() ? mkspec() : ms; const FileName spec = ms.isEmpty() ? mkspec() : ms;
QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains(); QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains();
ProjectExplorer::ToolChain *possibleTc = 0; ProjectExplorer::ToolChain *possibleTc = 0;
foreach (ProjectExplorer::ToolChain *tc, tcList) { foreach (ProjectExplorer::ToolChain *tc, tcList) {
@@ -419,7 +421,7 @@ ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const Utils::FileN
return possibleTc; return possibleTc;
} }
Utils::FileName BaseQtVersion::qmakeCommand() const FileName BaseQtVersion::qmakeCommand() const
{ {
return m_qmakeCommand; return m_qmakeCommand;
} }
@@ -574,10 +576,10 @@ void BaseQtVersion::updateSourcePath() const
} }
} }
} }
m_sourcePath = Utils::FileName::fromUserInput(sourcePath); m_sourcePath = FileName::fromUserInput(sourcePath);
} }
Utils::FileName BaseQtVersion::sourcePath() const FileName BaseQtVersion::sourcePath() const
{ {
updateSourcePath(); updateSourcePath();
return m_sourcePath; return m_sourcePath;
@@ -654,46 +656,43 @@ QString BaseQtVersion::findQtBinary(Binaries binary) const
QStringList possibleCommands; QStringList possibleCommands;
switch (binary) { switch (binary) {
case QmlScene: { case QmlScene: {
#if defined(Q_OS_WIN) if (HostOsInfo::isWindowsHost())
possibleCommands << QLatin1String("qmlscene.exe"); possibleCommands << QLatin1String("qmlscene.exe");
#else else
possibleCommands << QLatin1String("qmlscene"); possibleCommands << QLatin1String("qmlscene");
#endif
} }
case QmlViewer: { case QmlViewer: {
#if defined(Q_OS_WIN) if (HostOsInfo::isWindowsHost())
possibleCommands << QLatin1String("qmlviewer.exe"); possibleCommands << QLatin1String("qmlviewer.exe");
#elif defined(Q_OS_MAC) else if (HostOsInfo::isMacHost())
possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer"); possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer");
#else else
possibleCommands << QLatin1String("qmlviewer"); possibleCommands << QLatin1String("qmlviewer");
#endif
} }
break; break;
case Designer: case Designer:
#if defined(Q_OS_WIN) if (HostOsInfo::isWindowsHost())
possibleCommands << QLatin1String("designer.exe"); possibleCommands << QLatin1String("designer.exe");
#elif defined(Q_OS_MAC) else if (HostOsInfo::isMacHost())
possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer"); possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer");
#else else
possibleCommands << QLatin1String("designer"); possibleCommands << QLatin1String("designer");
#endif
break; break;
case Linguist: case Linguist:
#if defined(Q_OS_WIN) if (HostOsInfo::isWindowsHost())
possibleCommands << QLatin1String("linguist.exe"); possibleCommands << QLatin1String("linguist.exe");
#elif defined(Q_OS_MAC) else if (HostOsInfo::isMacHost())
possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist"); possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist");
#else else
possibleCommands << QLatin1String("linguist"); possibleCommands << QLatin1String("linguist");
#endif
break; break;
case Uic: case Uic:
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost()) {
possibleCommands << QLatin1String("uic.exe"); possibleCommands << QLatin1String("uic.exe");
#else } else {
possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4") << QLatin1String("uic"); possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4")
#endif << QLatin1String("uic");
}
break; break;
default: default:
Q_ASSERT(false); Q_ASSERT(false);
@@ -728,13 +727,13 @@ void BaseQtVersion::updateMkspec() const
if (m_mkspecFullPath.isEmpty()) if (m_mkspecFullPath.isEmpty())
return; return;
Utils::FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo()); FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo());
if (m_mkspec.isChildOf(baseMkspecDir)) { if (m_mkspec.isChildOf(baseMkspecDir)) {
m_mkspec = m_mkspec.relativeChildPath(baseMkspecDir); m_mkspec = m_mkspec.relativeChildPath(baseMkspecDir);
// qDebug() << "Setting mkspec to"<<mkspec; // qDebug() << "Setting mkspec to"<<mkspec;
} else { } else {
Utils::FileName sourceMkSpecPath = sourcePath().appendPath(QLatin1String("mkspecs")); FileName sourceMkSpecPath = sourcePath().appendPath(QLatin1String("mkspecs"));
if (m_mkspec.isChildOf(sourceMkSpecPath)) { if (m_mkspec.isChildOf(sourceMkSpecPath)) {
m_mkspec = m_mkspec.relativeChildPath(sourceMkSpecPath); m_mkspec = m_mkspec.relativeChildPath(sourceMkSpecPath);
} else { } else {
@@ -786,19 +785,19 @@ void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
m_mkspecValues.insert(declarativeBins, evaluator->value(declarativeBins)); m_mkspecValues.insert(declarativeBins, evaluator->value(declarativeBins));
} }
Utils::FileName BaseQtVersion::mkspec() const FileName BaseQtVersion::mkspec() const
{ {
updateMkspec(); updateMkspec();
return m_mkspec; return m_mkspec;
} }
Utils::FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const
{ {
if (!tc) if (!tc)
return mkspec(); return mkspec();
const QList<Utils::FileName> tcSpecList = tc->suggestedMkspecList(); const QList<FileName> tcSpecList = tc->suggestedMkspecList();
foreach (const Utils::FileName &tcSpec, tcSpecList) { foreach (const FileName &tcSpec, tcSpecList) {
if (hasMkspec(tcSpec)) if (hasMkspec(tcSpec))
return tcSpec; return tcSpec;
} }
@@ -806,13 +805,13 @@ Utils::FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const
return mkspec(); return mkspec();
} }
Utils::FileName BaseQtVersion::mkspecPath() const FileName BaseQtVersion::mkspecPath() const
{ {
updateMkspec(); updateMkspec();
return m_mkspecFullPath; return m_mkspecFullPath;
} }
bool BaseQtVersion::hasMkspec(const Utils::FileName &spec) const bool BaseQtVersion::hasMkspec(const FileName &spec) const
{ {
updateVersionInfo(); updateVersionInfo();
QFileInfo fi; QFileInfo fi;
@@ -965,12 +964,11 @@ QString BaseQtVersion::demosPath() const
QString BaseQtVersion::frameworkInstallPath() const QString BaseQtVersion::frameworkInstallPath() const
{ {
#ifdef Q_OS_MAC if (HostOsInfo::isMacHost()) {
updateVersionInfo(); updateVersionInfo();
return m_versionInfo.value(QLatin1String("QT_INSTALL_LIBS")); return m_versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
#else }
return QString(); return QString();
#endif
} }
bool BaseQtVersion::hasExamples() const bool BaseQtVersion::hasExamples() const
@@ -993,7 +991,7 @@ QList<ProjectExplorer::HeaderPath> BaseQtVersion::systemHeaderPathes(const Proje
return result; return result;
} }
void BaseQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const void BaseQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Environment &env) const
{ {
Q_UNUSED(p); Q_UNUSED(p);
env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(qmakeProperty("QT_HOST_DATA"))); env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(qmakeProperty("QT_HOST_DATA")));
@@ -1037,10 +1035,10 @@ bool BaseQtVersion::hasQmlObserver() const
return m_hasQmlObserver; return m_hasQmlObserver;
} }
Utils::Environment BaseQtVersion::qmlToolsEnvironment() const Environment BaseQtVersion::qmlToolsEnvironment() const
{ {
// FIXME: This seems broken! // FIXME: This seems broken!
Utils::Environment environment = Utils::Environment::systemEnvironment(); Environment environment = Environment::systemEnvironment();
#if 0 // FIXME: Fix this! #if 0 // FIXME: Fix this!
addToEnvironment(environment); addToEnvironment(environment);
#endif #endif
@@ -1126,7 +1124,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF
if (!isValid()) { if (!isValid()) {
//: %1: Reason for being invalid //: %1: Reason for being invalid
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The Qt version is invalid: %1").arg(invalidReason()); const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The Qt version is invalid: %1").arg(invalidReason());
results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, Utils::FileName(), -1, results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
} }
@@ -1136,7 +1134,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF
//: %1: Path to qmake executable //: %1: Path to qmake executable
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
"The qmake command \"%1\" was not found or is not executable.").arg(qmakeCommand().toUserOutput()); "The qmake command \"%1\" was not found or is not executable.").arg(qmakeCommand().toUserOutput());
results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, Utils::FileName(), -1, results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
} }
@@ -1147,13 +1145,13 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF
if ((tmpBuildDir.startsWith(sourcePath)) && (tmpBuildDir != sourcePath)) { if ((tmpBuildDir.startsWith(sourcePath)) && (tmpBuildDir != sourcePath)) {
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
"Qmake does not support build directories below the source directory."); "Qmake does not support build directories below the source directory.");
results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, Utils::FileName(), -1, results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
} else if (tmpBuildDir.count(slash) != sourcePath.count(slash) && qtVersion() < QtVersionNumber(4,8, 0)) { } else if (tmpBuildDir.count(slash) != sourcePath.count(slash) && qtVersion() < QtVersionNumber(4,8, 0)) {
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
"The build directory needs to be at the same level as the source directory."); "The build directory needs to be at the same level as the source directory.");
results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, Utils::FileName(), -1, results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
} }
@@ -1178,13 +1176,13 @@ QtConfigWidget *BaseQtVersion::createConfigurationWidget() const
return 0; return 0;
} }
bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo) bool BaseQtVersion::queryQMakeVariables(const FileName &binary, QHash<QString, QString> *versionInfo)
{ {
bool qmakeIsExecutable; bool qmakeIsExecutable;
return BaseQtVersion::queryQMakeVariables(binary, versionInfo, &qmakeIsExecutable); return BaseQtVersion::queryQMakeVariables(binary, versionInfo, &qmakeIsExecutable);
} }
bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo, bool BaseQtVersion::queryQMakeVariables(const FileName &binary, QHash<QString, QString> *versionInfo,
bool *qmakeIsExecutable) bool *qmakeIsExecutable)
{ {
const int timeOutMS = 30000; // Might be slow on some machines. const int timeOutMS = 30000; // Might be slow on some machines.
@@ -1194,14 +1192,14 @@ bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QSt
return false; return false;
QProcess process; QProcess process;
Utils::Environment env = Utils::Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
#ifdef Q_OS_WIN if (HostOsInfo::isWindowsHost()) {
// Add tool chain environments. This is necessary for non-static qmakes e.g. using mingw on windows // Add tool chain environments. This is necessary for non-static qmakes e.g. using mingw on windows
QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains(); QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains();
foreach (ProjectExplorer::ToolChain *tc, tcList) foreach (ProjectExplorer::ToolChain *tc, tcList)
tc->addToEnvironment(env); tc->addToEnvironment(env);
#endif }
process.setEnvironment(env.toStringList()); process.setEnvironment(env.toStringList());
process.start(qmake.absoluteFilePath(), QStringList(QLatin1String("-query")), QIODevice::ReadOnly); process.start(qmake.absoluteFilePath(), QStringList(QLatin1String("-query")), QIODevice::ReadOnly);
@@ -1212,7 +1210,7 @@ bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QSt
return false; return false;
} }
if (!process.waitForFinished(timeOutMS)) { if (!process.waitForFinished(timeOutMS)) {
Utils::SynchronousProcess::stopProcess(process); SynchronousProcess::stopProcess(process);
qWarning("Timeout running '%s' (%dms).", qPrintable(binary.toUserOutput()), timeOutMS); qWarning("Timeout running '%s' (%dms).", qPrintable(binary.toUserOutput()), timeOutMS);
return false; return false;
} }
@@ -1252,73 +1250,79 @@ bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QSt
return true; return true;
} }
Utils::FileName BaseQtVersion::mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo) FileName BaseQtVersion::mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo)
{ {
QString dataDir = qmakeProperty(versionInfo, "QT_HOST_DATA"); QString dataDir = qmakeProperty(versionInfo, "QT_HOST_DATA");
if (dataDir.isEmpty()) if (dataDir.isEmpty())
return Utils::FileName(); return FileName();
return Utils::FileName::fromUserInput(dataDir + QLatin1String("/mkspecs")); return FileName::fromUserInput(dataDir + QLatin1String("/mkspecs"));
} }
Utils::FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo) FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo)
{ {
Utils::FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo); FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo);
if (baseMkspecDir.isEmpty()) if (baseMkspecDir.isEmpty())
return Utils::FileName(); return FileName();
Utils::FileName mkspecFullPath = Utils::FileName::fromString(baseMkspecDir.toString() + QLatin1String("/default")); FileName mkspecFullPath = FileName::fromString(baseMkspecDir.toString() + QLatin1String("/default"));
// qDebug() << "default mkspec is located at" << mkspecFullPath; // qDebug() << "default mkspec is located at" << mkspecFullPath;
#ifdef Q_OS_WIN switch (HostOsInfo::hostOs()) {
QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf")); case HostOsInfo::HostOsWindows: {
if (f2.exists() && f2.open(QIODevice::ReadOnly)) { QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
while (!f2.atEnd()) { if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
QByteArray line = f2.readLine(); while (!f2.atEnd()) {
if (line.startsWith("QMAKESPEC_ORIGINAL")) { QByteArray line = f2.readLine();
const QList<QByteArray> &temp = line.split('='); if (line.startsWith("QMAKESPEC_ORIGINAL")) {
if (temp.size() == 2) { const QList<QByteArray> &temp = line.split('=');
QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData()); if (temp.size() == 2) {
// We sometimes get a mix of different slash styles here... QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData());
possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/')); // We sometimes get a mix of different slash styles here...
if (QFileInfo(possibleFullPath).exists()) // Only if the path exists possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
mkspecFullPath = Utils::FileName::fromUserInput(possibleFullPath); if (QFileInfo(possibleFullPath).exists()) // Only if the path exists
} mkspecFullPath = FileName::fromUserInput(possibleFullPath);
break;
}
}
f2.close();
}
#elif defined(Q_OS_MAC)
QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
while (!f2.atEnd()) {
QByteArray line = f2.readLine();
if (line.startsWith("MAKEFILE_GENERATOR")) {
const QList<QByteArray> &temp = line.split('=');
if (temp.size() == 2) {
const QByteArray &value = temp.at(1);
if (value.contains("XCODE")) {
// we don't want to generate xcode projects...
// qDebug() << "default mkspec is xcode, falling back to g++";
mkspecFullPath = baseMkspecDir.appendPath(QLatin1String("macx-g++"));
} }
//resolve mkspec link break;
mkspecFullPath = Utils::FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
} }
break;
} }
f2.close();
} }
f2.close(); break;
}
case HostOsInfo::HostOsMac: {
QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
while (!f2.atEnd()) {
QByteArray line = f2.readLine();
if (line.startsWith("MAKEFILE_GENERATOR")) {
const QList<QByteArray> &temp = line.split('=');
if (temp.size() == 2) {
const QByteArray &value = temp.at(1);
if (value.contains("XCODE")) {
// we don't want to generate xcode projects...
// qDebug() << "default mkspec is xcode, falling back to g++";
mkspecFullPath = baseMkspecDir.appendPath(QLatin1String("macx-g++"));
}
//resolve mkspec link
mkspecFullPath = FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
}
break;
}
}
f2.close();
}
break;
}
default:
mkspecFullPath = FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
break;
} }
#else
mkspecFullPath = Utils::FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
#endif
return mkspecFullPath; return mkspecFullPath;
} }
Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString) FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)
{ {
QStringList dirs; QStringList dirs;
dirs << qmakeProperty(versionInfo, "QT_INSTALL_LIBS") dirs << qmakeProperty(versionInfo, "QT_INSTALL_LIBS")
@@ -1336,7 +1340,7 @@ Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionI
&& file.startsWith(QLatin1String("QtCore")) && file.startsWith(QLatin1String("QtCore"))
&& file.endsWith(QLatin1String(".framework"))) { && file.endsWith(QLatin1String(".framework"))) {
// handle Framework // handle Framework
Utils::FileName lib(info); FileName lib(info);
lib.appendPath(file.left(file.lastIndexOf(QLatin1Char('.')))); lib.appendPath(file.left(file.lastIndexOf(QLatin1Char('.'))));
return lib; return lib;
} }
@@ -1350,18 +1354,18 @@ Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionI
|| file.endsWith(QString::fromLatin1(".so.") + versionString) || file.endsWith(QString::fromLatin1(".so.") + versionString)
|| file.endsWith(QLatin1String(".so")) || file.endsWith(QLatin1String(".so"))
|| file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib"))) || file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib")))
return Utils::FileName(info); return FileName(info);
} }
} }
} }
} }
// Return path to first static library found: // Return path to first static library found:
if (!staticLibs.isEmpty()) if (!staticLibs.isEmpty())
return Utils::FileName(staticLibs.at(0)); return FileName(staticLibs.at(0));
return Utils::FileName(); return FileName();
} }
QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const Utils::FileName &coreLibrary) QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const FileName &coreLibrary)
{ {
return ProjectExplorer::Abi::abisOfBinary(coreLibrary); return ProjectExplorer::Abi::abisOfBinary(coreLibrary);
} }
+3 -3
View File
@@ -42,6 +42,7 @@
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
#include <utils/runextensions.h> #include <utils/runextensions.h>
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDesktopServices> #include <QDesktopServices>
#include <QCoreApplication> #include <QCoreApplication>
@@ -245,9 +246,8 @@ static QStringList sourceFileNames()
files << QLatin1String("main.cpp") << QLatin1String("qmldump.pro") files << QLatin1String("main.cpp") << QLatin1String("qmldump.pro")
<< QLatin1String("qmlstreamwriter.cpp") << QLatin1String("qmlstreamwriter.h") << QLatin1String("qmlstreamwriter.cpp") << QLatin1String("qmlstreamwriter.h")
<< QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT"); << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT");
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
files << QLatin1String("Info.plist"); files << QLatin1String("Info.plist");
#endif
return files; return files;
} }
+4 -4
View File
@@ -49,6 +49,7 @@
#include <projectexplorer/toolchainmanager.h> #include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/hostosinfo.h>
#include <utils/runextensions.h> #include <utils/runextensions.h>
#include <QDir> #include <QDir>
@@ -617,10 +618,9 @@ static QString filterForQmakeFileDialog()
for (int i = 0; i < commands.size(); ++i) { for (int i = 0; i < commands.size(); ++i) {
if (i) if (i)
filter += QLatin1Char(' '); filter += QLatin1Char(' ');
#ifdef Q_OS_MAC if (Utils::HostOsInfo::isMacHost())
// work around QTBUG-7739 that prohibits filters that don't start with * // work around QTBUG-7739 that prohibits filters that don't start with *
filter += QLatin1Char('*'); filter += QLatin1Char('*');
#endif
filter += commands.at(i); filter += commands.at(i);
} }
filter += QLatin1Char(')'); filter += QLatin1Char(')');
+6 -8
View File
@@ -46,6 +46,7 @@
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
@@ -173,10 +174,9 @@ StatusList parseStatusOutput(const QString &output)
static inline QStringList svnDirectories() static inline QStringList svnDirectories()
{ {
QStringList rc(QLatin1String(".svn")); QStringList rc(QLatin1String(".svn"));
#ifdef Q_OS_WIN if (Utils::HostOsInfo::isWindowsHost())
// Option on Windows systems to avoid hassle with some IDEs // Option on Windows systems to avoid hassle with some IDEs
rc.push_back(QLatin1String("_svn")); rc.push_back(QLatin1String("_svn"));
#endif
return rc; return rc;
} }
@@ -1192,11 +1192,9 @@ SubversionPlugin *SubversionPlugin::instance()
bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName) bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
{ {
#ifdef Q_OS_MAC // See below. if (Utils::HostOsInfo::isMacHost()) // See below.
return vcsAdd14(workingDir, rawFileName); return vcsAdd14(workingDir, rawFileName);
#else
return vcsAdd15(workingDir, rawFileName); return vcsAdd15(workingDir, rawFileName);
#endif
} }
// Post 1.4 add: Use "--parents" to add directories // Post 1.4 add: Use "--parents" to add directories
@@ -31,6 +31,7 @@
#include "subversionsettings.h" #include "subversionsettings.h"
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <QSettings> #include <QSettings>
@@ -49,11 +50,9 @@ enum { defaultTimeOutS = 30, defaultLogCount = 1000 };
static QString defaultCommand() static QString defaultCommand()
{ {
QString rc; QString rc = QLatin1String("svn");
rc = QLatin1String("svn"); if (Utils::HostOsInfo::isWindowsHost())
#if defined(Q_OS_WIN32) rc.append(QLatin1String(".exe"));
rc.append(QLatin1String(".exe"));
#endif
return rc; return rc;
} }
+11 -19
View File
@@ -68,6 +68,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <find/basetextfind.h> #include <find/basetextfind.h>
#include <utils/linecolumnlabel.h> #include <utils/linecolumnlabel.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
@@ -117,6 +118,7 @@
using namespace TextEditor; using namespace TextEditor;
using namespace TextEditor::Internal; using namespace TextEditor::Internal;
using namespace Utils;
namespace TextEditor { namespace TextEditor {
namespace Internal { namespace Internal {
@@ -1762,7 +1764,8 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
// fall through // fall through
case Qt::Key_Right: case Qt::Key_Right:
case Qt::Key_Left: case Qt::Key_Left:
#ifndef Q_OS_MAC if (HostOsInfo::isMacHost())
break;
if ((e->modifiers() if ((e->modifiers()
& (Qt::AltModifier | Qt::ShiftModifier)) == (Qt::AltModifier | Qt::ShiftModifier)) { & (Qt::AltModifier | Qt::ShiftModifier)) == (Qt::AltModifier | Qt::ShiftModifier)) {
int diff_row = 0; int diff_row = 0;
@@ -1786,7 +1789,6 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
viewport()->update(); viewport()->update();
} }
} }
#endif
break; break;
case Qt::Key_PageUp: case Qt::Key_PageUp:
case Qt::Key_PageDown: case Qt::Key_PageDown:
@@ -1821,6 +1823,9 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
break; break;
} }
const Qt::KeyboardModifiers modifiers
= HostOsInfo::isMacHost() ? Qt::MetaModifier : Qt::ControlModifier;
if (!ro && d->m_inBlockSelectionMode) { if (!ro && d->m_inBlockSelectionMode) {
QString text = e->text(); QString text = e->text();
if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) { if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) {
@@ -1829,13 +1834,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
} }
} }
if (e->key() == Qt::Key_H && e->modifiers() == if (e->key() == Qt::Key_H && e->modifiers() == modifiers) {
#ifdef Q_OS_DARWIN
Qt::MetaModifier
#else
Qt::ControlModifier
#endif
) {
universalHelper(); universalHelper();
e->accept(); e->accept();
return; return;
@@ -3390,11 +3389,8 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
cursor_pen = painter.pen(); cursor_pen = painter.pen();
} }
#ifndef Q_OS_MAC // no visible cursor on mac if (!HostOsInfo::isMacHost() && blockSelectionCursorRect.isValid())
if (blockSelectionCursorRect.isValid())
painter.fillRect(blockSelectionCursorRect, palette().text()); painter.fillRect(blockSelectionCursorRect, palette().text());
#endif
} }
offset.ry() += r.height(); offset.ry() += r.height();
@@ -4247,10 +4243,8 @@ void BaseTextEditorWidget::mousePressEvent(QMouseEvent *e)
} }
} }
#ifdef Q_OS_LINUX if (HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
if (handleForwardBackwardMouseButtons(e))
return; return;
#endif
QPlainTextEdit::mousePressEvent(e); QPlainTextEdit::mousePressEvent(e);
} }
@@ -4270,10 +4264,8 @@ void BaseTextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
} }
} }
#ifndef Q_OS_LINUX if (!HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
if (handleForwardBackwardMouseButtons(e))
return; return;
#endif
QPlainTextEdit::mouseReleaseEvent(e); QPlainTextEdit::mouseReleaseEvent(e);
} }
@@ -33,6 +33,7 @@
#include "codeassistant.h" #include "codeassistant.h"
#include <utils/faketooltip.h> #include <utils/faketooltip.h>
#include <utils/hostosinfo.h>
#include <QDebug> #include <QDebug>
#include <QApplication> #include <QApplication>
@@ -288,11 +289,9 @@ void FunctionHintProposalWidget::updateContent()
void FunctionHintProposalWidget::updatePosition() void FunctionHintProposalWidget::updatePosition()
{ {
const QDesktopWidget *desktop = QApplication::desktop(); const QDesktopWidget *desktop = QApplication::desktop();
#ifdef Q_OS_MAC const QRect &screen = Utils::HostOsInfo::isMacHost()
const QRect &screen = desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget)); ? desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget))
#else : desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget));
const QRect &screen = desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget));
#endif
d->m_pager->setFixedWidth(d->m_pager->minimumSizeHint().width()); d->m_pager->setFixedWidth(d->m_pager->minimumSizeHint().width());

Some files were not shown because too many files have changed in this diff Show More