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

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
// 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
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);
}
connect(m_editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateEditor(Core::IEditor*)));