From f4a7e3d45d9ef5a5e49639871bb99ab423b7faf3 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Mon, 23 Apr 2012 20:10:38 +0200 Subject: use Q_OS instead of Q_WS defines Change-Id: I2bbc5b97b8aa9d3dbe77a3334c0182158c2db9c5 Reviewed-by: Karsten Heimrich --- src/libs/installer/createshortcutoperation.cpp | 4 ++-- src/libs/installer/environmentvariablesoperation.cpp | 10 +++++----- src/libs/installer/extractarchiveoperation_p.h | 2 +- .../installer/fakestopprocessforupdateoperation.cpp | 2 +- src/libs/installer/fileutils.cpp | 6 +++--- src/libs/installer/fsengineserver.cpp | 4 ++-- src/libs/installer/messageboxhandler.cpp | 2 +- src/libs/installer/packagemanagercore.cpp | 8 ++++---- src/libs/installer/packagemanagercore_p.cpp | 20 ++++++++++++-------- src/libs/installer/packagemanagergui.cpp | 12 ++++++------ src/libs/installer/registerfiletypeoperation.cpp | 4 ++-- src/libs/kdtools/kdupdaterupdatefinder.cpp | 4 ++-- src/libs/kdtools/kdupdaterupdateoperations.cpp | 10 +++++----- src/sdk/installerbasecommons.cpp | 2 +- 14 files changed, 47 insertions(+), 43 deletions(-) diff --git a/src/libs/installer/createshortcutoperation.cpp b/src/libs/installer/createshortcutoperation.cpp index bd0608233..a88b63fb6 100644 --- a/src/libs/installer/createshortcutoperation.cpp +++ b/src/libs/installer/createshortcutoperation.cpp @@ -44,7 +44,7 @@ #include #include -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # include # include #endif @@ -53,7 +53,7 @@ using namespace QInstaller; static bool createLink(QString fileName, QString linkName, QString workingDir, QString arguments = QString()) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN bool ret = false; fileName = QDir::toNativeSeparators(fileName); linkName = QDir::toNativeSeparators(linkName); diff --git a/src/libs/installer/environmentvariablesoperation.cpp b/src/libs/installer/environmentvariablesoperation.cpp index c71a250c9..68693d455 100644 --- a/src/libs/installer/environmentvariablesoperation.cpp +++ b/src/libs/installer/environmentvariablesoperation.cpp @@ -37,7 +37,7 @@ #include "environment.h" -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # include #endif @@ -57,7 +57,7 @@ void EnvironmentVariableOperation::backup() { } -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN static bool broadcastChange() { // Use SendMessageTimeout to Broadcast a message to the whole system to update settings of all // running applications. This is needed to activate the changes done above without logout+login. @@ -138,7 +138,7 @@ bool EnvironmentVariableOperation::performOperation() const QString value = arguments().at(1); bool isPersistent = false; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN isPersistent = arguments().count() >= 3 ? arguments().at(2) == QLatin1String("true") : true; const bool isSystemWide = arguments().count() >= 4 ? arguments().at(3) == QLatin1String("true") : false; QString oldvalue; @@ -183,7 +183,7 @@ bool EnvironmentVariableOperation::undoOperation() const QString value = arguments().at(1); const QString oldvalue = this->value(QLatin1String("oldvalue")).toString(); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const bool isPersistent = arguments().count() >= 3 ? arguments().at(2) == QLatin1String("true") : true; #else const bool isPersistent = false; @@ -197,7 +197,7 @@ bool EnvironmentVariableOperation::undoOperation() return doUndo; } -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const bool isSystemWide = arguments().count() >= 4 ? arguments().at(3) == QLatin1String("true") : false; const QString regPath = isSystemWide ? QLatin1String("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\" diff --git a/src/libs/installer/extractarchiveoperation_p.h b/src/libs/installer/extractarchiveoperation_p.h index 25c38e61e..43e62dec0 100644 --- a/src/libs/installer/extractarchiveoperation_p.h +++ b/src/libs/installer/extractarchiveoperation_p.h @@ -181,7 +181,7 @@ public: Lib7z::extractArchive(&archive, targetDir, callback); emit finished(true, QString()); } catch (const Lib7z::SevenZipException& e) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN emit finished(false, tr("Error while extracting %1: %2. (Maybe the target dir(%3) is blocked by " "another process.)").arg(archivePath, e.message(), targetDir)); #else diff --git a/src/libs/installer/fakestopprocessforupdateoperation.cpp b/src/libs/installer/fakestopprocessforupdateoperation.cpp index 9bfd6f35e..91ee6bda1 100644 --- a/src/libs/installer/fakestopprocessforupdateoperation.cpp +++ b/src/libs/installer/fakestopprocessforupdateoperation.cpp @@ -49,7 +49,7 @@ static bool isProcessRunning(const QString &name, const QList &proc if (it->name.isEmpty()) continue; -#ifndef Q_WS_WIN +#ifndef Q_OS_WIN if (it->name == name) return true; const QFileInfo fi(it->name); diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp index 29baf4765..7c8714cb2 100644 --- a/src/libs/installer/fileutils.cpp +++ b/src/libs/installer/fileutils.cpp @@ -327,9 +327,9 @@ void QInstaller::removeSystemGeneratedFiles(const QString &path) { if (path.isEmpty()) return; -#if defined Q_WS_MAC +#if defined Q_OS_MAC QFile::remove(path + QLatin1String("/.DS_Store")); -#elif defined Q_WS_WIN +#elif defined Q_OS_WIN QFile::remove(path + QLatin1String("/Thumbs.db")); #endif } @@ -442,7 +442,7 @@ QString QInstaller::createTemporaryDirectory(const QString &templ) return path; } -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #include #pragma pack(push) diff --git a/src/libs/installer/fsengineserver.cpp b/src/libs/installer/fsengineserver.cpp index 19539334c..2b2556c3d 100644 --- a/src/libs/installer/fsengineserver.cpp +++ b/src/libs/installer/fsengineserver.cpp @@ -44,14 +44,14 @@ typedef int descriptor_t; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # include #endif bool startDetached(const QString &program, const QStringList &args, const QString &workingDirectory, qint64 *pid) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN PROCESS_INFORMATION pinfo; STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), 0, 0, 0, static_cast(CW_USEDEFAULT), static_cast(CW_USEDEFAULT), diff --git a/src/libs/installer/messageboxhandler.cpp b/src/libs/installer/messageboxhandler.cpp index a50590382..30b21a0ec 100644 --- a/src/libs/installer/messageboxhandler.cpp +++ b/src/libs/installer/messageboxhandler.cpp @@ -260,7 +260,7 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, QMessageBo msgBox.setDefaultButton(button); } } -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) msgBox.setWindowModality(Qt::WindowModal); #endif if (msgBox.exec() == -1) diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index d30d0087a..41515a428 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -1114,7 +1114,7 @@ bool PackageManagerCore::executeDetached(const QString &program, const QStringLi */ QString PackageManagerCore::environmentVariable(const QString &name) const { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const LPCWSTR n = (LPCWSTR) name.utf16(); LPTSTR buff = (LPTSTR) malloc(4096 * sizeof(TCHAR)); DWORD getenvret = GetEnvironmentVariable(n, buff, 4096); @@ -1192,7 +1192,7 @@ bool PackageManagerCore::versionMatches(const QString &version, const QString &r QString PackageManagerCore::findLibrary(const QString &name, const QStringList &paths) { QStringList findPaths = paths; -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) return findPath(QString::fromLatin1("%1.lib").arg(name), findPaths); #else if (findPaths.isEmpty()) { @@ -1201,7 +1201,7 @@ QString PackageManagerCore::findLibrary(const QString &name, const QStringList & findPaths.push_back(QLatin1String("/usr/local/lib")); findPaths.push_back(QLatin1String("/opt/local/lib")); } -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) const QString dynamic = findPath(QString::fromLatin1("lib%1.dylib").arg(name), findPaths); #else const QString dynamic = findPath(QString::fromLatin1("lib%1.so*").arg(name), findPaths); @@ -1246,7 +1246,7 @@ void PackageManagerCore::setInstallerBaseBinary(const QString &path) */ QString PackageManagerCore::value(const QString &key, const QString &defaultValue) const { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN if (!d->m_vars.contains(key)) { static const QRegExp regex(QLatin1String("\\\\|/")); const QString filename = key.section(regex, 0, -2); diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index f6e7d4443..da0e4adac 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -63,6 +63,10 @@ #include +#ifdef Q_OS_WIN +#include +#endif + namespace QInstaller { static bool runOperation(Operation *op, PackageManagerCorePrivate::OperationType type) @@ -224,7 +228,7 @@ bool PackageManagerCorePrivate::isProcessRunning(const QString &name, if (it->name.isEmpty()) continue; -#ifndef Q_WS_WIN +#ifndef Q_OS_WIN if (it->name == name) return true; const QFileInfo fi(it->name); @@ -514,13 +518,13 @@ void PackageManagerCorePrivate::initialize() m_vars.insert(QLatin1String("homeDir"), QDir::homePath()); m_vars.insert(scTargetConfigurationFile, QLatin1String("components.xml")); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN m_vars.insert(QLatin1String("os"), QLatin1String("win")); -#elif defined(Q_WS_MAC) +#elif defined(Q_OS_MAC) m_vars.insert(QLatin1String("os"), QLatin1String("mac")); #elif defined(Q_WS_X11) m_vars.insert(QLatin1String("os"), QLatin1String("x11")); -#elif defined(Q_WS_QWS) +#elif defined(Q_OS_QWS) m_vars.insert(QLatin1String("os"), QLatin1String("Qtopia")); #else // TODO: add more platforms as needed... @@ -576,7 +580,7 @@ void PackageManagerCorePrivate::initialize() } if (!m_core->isInstaller()) { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC readMaintenanceConfigFiles(QCoreApplication::applicationDirPath() + QLatin1String("/../../..")); #else readMaintenanceConfigFiles(QCoreApplication::applicationDirPath()); @@ -733,7 +737,7 @@ Operation *PackageManagerCorePrivate::takeOwnedOperation(Operation *operation) QString PackageManagerCorePrivate::uninstallerName() const { QString filename = m_settings.uninstallerName(); -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) if (QFileInfo(QCoreApplication::applicationDirPath() + QLatin1String("/../..")).isBundle()) filename += QLatin1String(".app/Contents/MacOS/") + filename; #elif defined(Q_OS_WIN) @@ -1124,7 +1128,7 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio writeMaintenanceConfigFiles(); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC // if it is a bundle, we need some stuff in it... const QString sourceAppDirPath = QCoreApplication::applicationDirPath(); if (isInstaller() && QFileInfo(sourceAppDirPath + QLatin1String("/../..")).isBundle()) { @@ -1904,7 +1908,7 @@ void PackageManagerCorePrivate::deleteUninstaller() // every other platform has no problem if we just delete ourselves now QFile uninstaller(QFileInfo(installerBinaryPath()).absoluteFilePath()); uninstaller.remove(); -# ifdef Q_WS_MAC +# ifdef Q_OS_MAC const QLatin1String cdUp("/../../.."); if (QFileInfo(QFileInfo(installerBinaryPath() + cdUp).absoluteFilePath()).isBundle()) { removeDirectoryThreaded(QFileInfo(installerBinaryPath() + cdUp).absoluteFilePath()); diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index f38a8d0a2..367e16363 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -215,7 +215,7 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent) else setWindowTitle(tr("Maintain %1").arg(m_core->value(scTitle))); -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC setWindowIcon(QIcon(m_core->settings().icon())); #else setPixmap(QWizard::BackgroundPixmap, m_core->settings().background()); @@ -263,7 +263,7 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent) for (int i = QWizard::BackButton; i < QWizard::CustomButton1; ++i) d->m_defaultButtonText.insert(i, buttonText(QWizard::WizardButton(i))); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC resize(sizeHint() * 1.25); #else resize(sizeHint()); @@ -879,7 +879,7 @@ LicenseAgreementPage::LicenseAgreementPage(PackageManagerCore *core) rejectLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); rejectLabel->setText(hash.value(QLatin1String("RejectLicenseLabel"), tr("I do not accept the licenses.")).toString()); -#if defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) || defined(Q_OS_MAC) QFont labelFont(font()); labelFont.setPixelSize(9); acceptLabel->setFont(labelFont); @@ -1840,7 +1840,7 @@ FinishedPage::FinishedPage(PackageManagerCore *core) m_msgLabel->setObjectName(QLatin1String("MessageLabel")); const QVariantHash hash = elementsForPage(QLatin1String("FinishedPage")); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC m_msgLabel->setText(hash.value(QLatin1String("MessageLabel"), tr("Click Done to exit the %1 " "Wizard.")).toString().arg(productName())); #else @@ -1867,7 +1867,7 @@ void FinishedPage::entering() setCommitPage(true); if (packageManagerCore()->isUpdater() || packageManagerCore()->isPackageManager()) { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC gui()->setOption(QWizard::NoCancelButton, false); #endif if (QAbstractButton *cancel = gui()->button(QWizard::CancelButton)) { @@ -1915,7 +1915,7 @@ void FinishedPage::entering() void FinishedPage::leaving() { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC gui()->setOption(QWizard::NoCancelButton, true); #endif diff --git a/src/libs/installer/registerfiletypeoperation.cpp b/src/libs/installer/registerfiletypeoperation.cpp index 5de90733f..ff72b97fd 100644 --- a/src/libs/installer/registerfiletypeoperation.cpp +++ b/src/libs/installer/registerfiletypeoperation.cpp @@ -52,7 +52,7 @@ bool RegisterFileTypeOperation::performOperation() // (description) // (content type) // (icon) -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const QStringList args = arguments(); if (args.count() < 2 || args.count() > 5) { setError(InvalidArguments); @@ -114,7 +114,7 @@ bool RegisterFileTypeOperation::undoOperation() // (description) // (content type) // (icon) -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN const QStringList args = arguments(); if (args.count() < 2 || args.count() > 5) { setErrorString(tr("Register File Type: Invalid arguments")); diff --git a/src/libs/kdtools/kdupdaterupdatefinder.cpp b/src/libs/kdtools/kdupdaterupdatefinder.cpp index 63631a8e5..41c72cd87 100644 --- a/src/libs/kdtools/kdupdaterupdatefinder.cpp +++ b/src/libs/kdtools/kdupdaterupdatefinder.cpp @@ -596,10 +596,10 @@ bool UpdateFinder::Private::checkForUpdatePriority(const UpdateSourceInfo &sourc int UpdateFinder::Private::pickUpdateFileInfo(const QList &updateFiles) { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC QString os = QLatin1String( "MacOSX" ); #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN QString os = QLatin1String( "Windows" ); #endif #ifdef Q_WS_X11 diff --git a/src/libs/kdtools/kdupdaterupdateoperations.cpp b/src/libs/kdtools/kdupdaterupdateoperations.cpp index 681631542..9e2f5eb21 100644 --- a/src/libs/kdtools/kdupdaterupdateoperations.cpp +++ b/src/libs/kdtools/kdupdaterupdateoperations.cpp @@ -39,7 +39,7 @@ #define SUPPORT_DETACHED_PROCESS_EXECUTION #ifdef SUPPORT_DETACHED_PROCESS_EXECUTION -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #include #endif #endif @@ -477,9 +477,9 @@ bool MkdirOperation::undoOperation() return removeDirectory(createdDir.path(), &errorString); // even remove some hidden, OS-created files in there -#if defined Q_WS_MAC +#if defined Q_OS_MAC QFile::remove(createdDir.path() + QLatin1String("/.DS_Store")); -#elif defined Q_WS_WIN +#elif defined Q_OS_WIN QFile::remove(createdDir.path() + QLatin1String("/Thumbs.db")); #endif @@ -798,7 +798,7 @@ void ExecuteOperation::backup() // this is not possible, since the process can do whatever... } -#if defined(SUPPORT_DETACHED_PROCESS_EXECUTION) && defined(Q_WS_WIN) +#if defined(SUPPORT_DETACHED_PROCESS_EXECUTION) && defined(Q_OS_WIN) // stolen from qprocess_win.cpp static QString qt_create_commandline(const QString &program, const QStringList &arguments) { @@ -866,7 +866,7 @@ bool ExecuteOperation::performOperation() // unix style: when there's an ampersand after the command, it's started detached if (args.count() >= 2 && args.last() == QLatin1String("&")) { args.pop_back(); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN QString arguments = qt_create_commandline(args.front(), args.mid(1)); PROCESS_INFORMATION pinfo; diff --git a/src/sdk/installerbasecommons.cpp b/src/sdk/installerbasecommons.cpp index 5c22d9926..62453929d 100644 --- a/src/sdk/installerbasecommons.cpp +++ b/src/sdk/installerbasecommons.cpp @@ -422,7 +422,7 @@ bool TargetDirectoryPageImpl::validatePage() } QString fileName = packageManagerCore()->settings().uninstallerName(); -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) if (QFileInfo(QCoreApplication::applicationDirPath() + QLatin1String("/../..")).isBundle()) fileName += QLatin1String(".app/Contents/MacOS/") + fileName; #elif defined(Q_OS_WIN) -- cgit v1.2.3