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