forked from qt-creator/qt-creator
Utils: Replace macro usages with HostOsInfo
Change-Id: Iddec811b4b57a2a898ebdf319a3e2ec875febd6c Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
5305a58a51
commit
ed68bda40d
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "fileinprojectfinder.h"
|
#include "fileinprojectfinder.h"
|
||||||
#include "fileutils.h"
|
#include "fileutils.h"
|
||||||
|
#include "hostosinfo.h"
|
||||||
#include "qtcassert.h"
|
#include "qtcassert.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -141,25 +142,23 @@ QString FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) const
|
|||||||
int prefixToIgnore = -1;
|
int prefixToIgnore = -1;
|
||||||
const QChar separator = QLatin1Char('/');
|
const QChar separator = QLatin1Char('/');
|
||||||
if (originalPath.startsWith(m_projectDir + separator)) {
|
if (originalPath.startsWith(m_projectDir + separator)) {
|
||||||
|
if (Utils::HostOsInfo::isMacHost()) {
|
||||||
#ifdef Q_OS_MAC
|
// starting with the project path is not sufficient if the file was
|
||||||
// starting with the project path is not sufficient if the file was
|
// copied in an insource build, e.g. into MyApp.app/Contents/Resources
|
||||||
// copied in an insource build, e.g. into MyApp.app/Contents/Resources
|
static const QString appResourcePath = QString::fromLatin1(".app/Contents/Resources");
|
||||||
static const QString appResourcePath = QString::fromLatin1(".app/Contents/Resources");
|
if (originalPath.contains(appResourcePath)) {
|
||||||
if (originalPath.contains(appResourcePath)) {
|
// the path is inside the project, but most probably as a resource of an insource build
|
||||||
// the path is inside the project, but most probably as a resource of an insource build
|
// so ignore that path
|
||||||
// so ignore that path
|
prefixToIgnore = originalPath.indexOf(appResourcePath) + appResourcePath.length();
|
||||||
prefixToIgnore = originalPath.indexOf(appResourcePath) + appResourcePath.length();
|
}
|
||||||
} else {
|
}
|
||||||
#endif
|
if (prefixToIgnore == -1) {
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "FileInProjectFinder: found" << originalPath << "in project directory";
|
qDebug() << "FileInProjectFinder: found" << originalPath << "in project directory";
|
||||||
if (success)
|
if (success)
|
||||||
*success = true;
|
*success = true;
|
||||||
return originalPath;
|
return originalPath;
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cache.contains(originalPath)) {
|
if (m_cache.contains(originalPath)) {
|
||||||
|
|||||||
@@ -28,10 +28,6 @@
|
|||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
#include <QKeyEvent>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Utils::NavigationTreeView
|
\class Utils::NavigationTreeView
|
||||||
|
|
||||||
|
|||||||
@@ -304,18 +304,17 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
case QEvent::KeyRelease: {
|
case QEvent::KeyRelease:
|
||||||
int key = static_cast<QKeyEvent *>(event)->key();
|
if (HostOsInfo::isMacHost()) {
|
||||||
Qt::KeyboardModifiers mody = static_cast<QKeyEvent *>(event)->modifiers();
|
int key = static_cast<QKeyEvent *>(event)->key();
|
||||||
if (!(mody & Qt::KeyboardModifierMask)
|
Qt::KeyboardModifiers mody = static_cast<QKeyEvent *>(event)->modifiers();
|
||||||
&& key != Qt::Key_Shift && key != Qt::Key_Control
|
if (!(mody & Qt::KeyboardModifierMask)
|
||||||
&& key != Qt::Key_Alt && key != Qt::Key_Meta)
|
&& key != Qt::Key_Shift && key != Qt::Key_Control
|
||||||
hideTipWithDelay();
|
&& key != Qt::Key_Alt && key != Qt::Key_Meta)
|
||||||
|
hideTipWithDelay();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
#endif
|
|
||||||
case QEvent::Leave:
|
case QEvent::Leave:
|
||||||
if (o == m_tip && !m_tip->isAncestorOf(qApp->focusWidget()))
|
if (o == m_tip && !m_tip->isAncestorOf(qApp->focusWidget()))
|
||||||
hideTipWithDelay();
|
hideTipWithDelay();
|
||||||
|
|||||||
Reference in New Issue
Block a user