From 99678e189313b168c410fa15cd10cb673b73c8a2 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Mon, 24 Mar 2014 21:43:45 +0100 Subject: [PATCH] Change Q_WS_* to Q_OS_* The Q_WS_{WIN,MAC} macros have been deprecated since Qt 4.3 or so, and replaces by the corresponding Q_OS_* macros. Since Qt5 does not support them anymore at all, let's globally change those to the "new" version. Also change Q_OS_WIN32 to just Q_OS_WIN; while the former is supposed to be defined on all supported Windows platforms including Win64, it's still a bit confusing. --- src/common/identity.cpp | 8 +++--- src/common/quassel.cpp | 26 +++++++++---------- src/common/settings.cpp | 2 +- src/common/settings.h | 2 +- src/core/core.cpp | 24 ++++++++--------- src/qtui/coreconfigwizard.cpp | 2 +- src/qtui/legacysystemtray.cpp | 4 +-- src/qtui/mainwin.cpp | 12 ++++----- src/qtui/mainwin.h | 2 +- src/qtui/qtuiapplication.cpp | 8 +++--- .../settingspages/appearancesettingspage.cpp | 2 +- src/qtui/settingspages/keysequencewidget.cpp | 4 +-- src/qtui/taskbarnotificationbackend.cpp | 2 +- src/uisupport/graphicalui.cpp | 8 +++--- src/uisupport/graphicalui.h | 4 +-- src/uisupport/multilineedit.cpp | 4 +-- 16 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/common/identity.cpp b/src/common/identity.cpp index e31735a3..5fe2d070 100644 --- a/src/common/identity.cpp +++ b/src/common/identity.cpp @@ -35,7 +35,7 @@ # include #endif -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN # include # include # define SECURITY_WIN32 @@ -78,7 +78,7 @@ Identity::Identity(const Identity &other, QObject *parent) } -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #ifdef UNICODE QString tcharToQString(TCHAR *tchar) { @@ -120,7 +120,7 @@ QString Identity::defaultNick() if (!userName.isEmpty()) nick = userName; -#elif defined(Q_OS_WIN32) +#elif defined(Q_OS_WIN) TCHAR infoBuf[128]; DWORD bufCharCount = 128; //if(GetUserNameEx(/* NameSamCompatible */ 1, infoBuf, &bufCharCount)) @@ -159,7 +159,7 @@ QString Identity::defaultRealName() else return generalDefault; -#elif defined(Q_OS_WIN32) +#elif defined(Q_OS_WIN) TCHAR infoBuf[128]; DWORD bufCharCount = 128; if (GetUserName(infoBuf, &bufCharCount)) diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 6490eb9b..f5954c0d 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -22,7 +22,7 @@ #include #include -#if !defined Q_OS_WIN32 && !defined Q_OS_MAC +#if !defined Q_OS_WIN && !defined Q_OS_MAC # include # include # include @@ -91,22 +91,22 @@ bool Quassel::init() if (_handleCrashes) { // we have crashhandler for win32 and unix (based on execinfo). -#if defined(Q_OS_WIN32) || defined(HAVE_EXECINFO) -# ifndef Q_OS_WIN32 +#if defined(Q_OS_WIN) || defined(HAVE_EXECINFO) +# ifndef Q_OS_WIN // we only handle crashes ourselves if coredumps are disabled struct rlimit *limit = (rlimit *)malloc(sizeof(struct rlimit)); int rc = getrlimit(RLIMIT_CORE, limit); if (rc == -1 || !((long)limit->rlim_cur > 0 || limit->rlim_cur == RLIM_INFINITY)) { -# endif /* Q_OS_WIN32 */ +# endif /* Q_OS_WIN */ signal(SIGABRT, handleSignal); signal(SIGSEGV, handleSignal); -# ifndef Q_OS_WIN32 +# ifndef Q_OS_WIN signal(SIGBUS, handleSignal); } free(limit); -# endif /* Q_OS_WIN32 */ -#endif /* Q_OS_WIN32 || HAVE_EXECINFO */ +# endif /* Q_OS_WIN */ +#endif /* Q_OS_WIN || HAVE_EXECINFO */ } _initialized = true; @@ -287,7 +287,7 @@ void Quassel::handleSignal(int sig) break; case SIGABRT: case SIGSEGV: -#ifndef Q_OS_WIN32 +#ifndef Q_OS_WIN case SIGBUS: #endif logBacktrace(coreDumpFileName()); @@ -355,12 +355,12 @@ QString Quassel::configDirPath() _configDirPath = Quassel::optionValue("configdir"); } else { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC // On Mac, the path is always the same _configDirPath = QDir::homePath() + "/Library/Application Support/Quassel/"; #else // We abuse QSettings to find us a sensible path on the other platforms -# ifdef Q_WS_WIN +# ifdef Q_OS_WIN // don't use the registry QSettings::Format format = QSettings::IniFormat; # else @@ -369,7 +369,7 @@ QString Quassel::configDirPath() QSettings s(format, QSettings::UserScope, QCoreApplication::organizationDomain(), buildInfo().applicationName); QFileInfo fileInfo(s.fileName()); _configDirPath = fileInfo.dir().absolutePath(); -#endif /* Q_WS_MAC */ +#endif /* Q_OS_MAC */ } if (!_configDirPath.endsWith(QDir::separator()) && !_configDirPath.endsWith('/')) @@ -403,12 +403,12 @@ QStringList Quassel::findDataDirPaths() const } else { // Provide a fallback -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN dataDirNames << qgetenv("APPDATA") + QCoreApplication::organizationDomain() + "/share/apps/quassel/" << qgetenv("APPDATA") + QCoreApplication::organizationDomain() << QCoreApplication::applicationDirPath(); } -#elif defined Q_WS_MAC +#elif defined Q_OS_MAC dataDirNames << QDir::homePath() + "/Library/Application Support/Quassel/" << QCoreApplication::applicationDirPath(); } diff --git a/src/common/settings.cpp b/src/common/settings.cpp index eda4c622..d89b8500 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -27,7 +27,7 @@ const int VERSION = 1; QHash Settings::settingsCache; QHash Settings::settingsChangeNotifier; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC # define create_qsettings QSettings s(QCoreApplication::organizationDomain(), appName) #else # define create_qsettings QSettings s(fileName(), format()) diff --git a/src/common/settings.h b/src/common/settings.h index 1a9235fb..4f556d79 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -76,7 +76,7 @@ protected: private: inline QSettings::Format format() { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN return QSettings::IniFormat; #else return QSettings::NativeFormat; diff --git a/src/core/core.cpp b/src/core/core.cpp index 1d8098dd..008c5b0a 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -34,12 +34,12 @@ // migration related #include -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN # include #else # include # include -#endif /* Q_OS_WIN32 */ +#endif /* Q_OS_WIN */ #ifdef HAVE_UMASK # include @@ -94,11 +94,11 @@ Core::Core() // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location // Move settings, note this does not delete the old files -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC QSettings newSettings("quassel-irc.org", "quasselcore"); #else -# ifdef Q_WS_WIN +# ifdef Q_OS_WIN QSettings::Format format = QSettings::IniFormat; # else QSettings::Format format = QSettings::NativeFormat; @@ -106,10 +106,10 @@ Core::Core() QString newFilePath = Quassel::configDirPath() + "quasselcore" + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini")); QSettings newSettings(newFilePath, format); -#endif /* Q_WS_MAC */ +#endif /* Q_OS_MAC */ if (newSettings.value("Config/Version").toUInt() == 0) { -# ifdef Q_WS_MAC +# ifdef Q_OS_MAC QString org = "quassel-irc.org"; # else QString org = "Quassel Project"; @@ -122,10 +122,10 @@ Core::Core() newSettings.setValue("Config/Version", 1); qWarning() << "* Your core settings have been migrated to" << newSettings.fileName(); -#ifndef Q_WS_MAC /* we don't need to move the db and cert for mac */ -#ifdef Q_OS_WIN32 +#ifndef Q_OS_MAC /* we don't need to move the db and cert for mac */ +#ifdef Q_OS_WIN QString quasselDir = qgetenv("APPDATA") + "/quassel/"; -#elif defined Q_WS_MAC +#elif defined Q_OS_MAC QString quasselDir = QDir::homePath() + "/Library/Application Support/Quassel/"; #else QString quasselDir = QDir::homePath() + "/.quassel/"; @@ -153,7 +153,7 @@ Core::Core() else qWarning() << "!!! Moving your certificate has failed. Please move it manually into" << Quassel::configDirPath(); } -#endif /* !Q_WS_MAC */ +#endif /* !Q_OS_MAC */ qWarning() << "*** Migration completed.\n\n"; } } @@ -935,7 +935,7 @@ QVariantMap Core::promptForSettings(const Storage *storage) } -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN void Core::stdInEcho(bool on) { HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE); @@ -962,4 +962,4 @@ void Core::stdInEcho(bool on) } -#endif /* Q_OS_WIN32 */ +#endif /* Q_OS_WIN */ diff --git a/src/qtui/coreconfigwizard.cpp b/src/qtui/coreconfigwizard.cpp index d10ca755..e1d74fee 100644 --- a/src/qtui/coreconfigwizard.cpp +++ b/src/qtui/coreconfigwizard.cpp @@ -52,7 +52,7 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QListsetIcon(stateIcon()); -#if defined Q_WS_MAC || defined Q_WS_WIN +#if defined Q_OS_MAC || defined Q_OS_WIN QString tooltip = QString("%1").arg(toolTipTitle()); if (!toolTipSubTitle().isEmpty()) tooltip += QString("\n%1").arg(toolTipSubTitle()); diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 1399113c..2a1ce6f4 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -337,7 +337,7 @@ void MainWin::restoreStateFromSettings(UiSettings &s) void MainWin::updateIcon() { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC const int size = 128; #else const int size = 48; @@ -402,7 +402,7 @@ void MainWin::setupActions() configureShortcutsAct->setMenuRole(QAction::NoRole); coll->addAction("ConfigureShortcuts", configureShortcutsAct); - #ifdef Q_WS_MAC + #ifdef Q_OS_MAC QAction *configureQuasselAct = new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll, this, SLOT(showSettingsDlg())); configureQuasselAct->setMenuRole(QAction::PreferencesRole); @@ -445,7 +445,7 @@ void MainWin::setupActions() this, SLOT(on_jumpHotBuffer_triggered()), QKeySequence(Qt::META + Qt::Key_A))); // Jump keys -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC const int bindModifier = Qt::ControlModifier | Qt::AltModifier; const int jumpModifier = Qt::ControlModifier; #else @@ -1000,7 +1000,7 @@ void MainWin::setupToolBars() connect(_nickListWidget, SIGNAL(nickSelectionChanged(QModelIndexList)), QtUi::toolBarActionProvider(), SLOT(nickSelectionChanged(QModelIndexList))); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC setUnifiedTitleAndToolBarOnMac(true); #endif @@ -1016,7 +1016,7 @@ void MainWin::setupToolBars() QtUi::toolBarActionProvider()->addActions(_mainToolBar, ToolBarActionProvider::MainToolBar); _toolbarMenu->addAction(_mainToolBar->toggleViewAction()); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC QtUiSettings uiSettings; bool visible = uiSettings.value("ShowMainToolBar", QVariant(true)).toBool(); @@ -1025,7 +1025,7 @@ void MainWin::setupToolBars() #endif } -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC void MainWin::saveMainToolBarStatus(bool enabled) { QtUiSettings uiSettings; diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 49e4cef4..ad16889c 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -154,7 +154,7 @@ private slots: void saveMenuBarStatus(bool enabled); void saveStatusBarStatus(bool enabled); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC void saveMainToolBarStatus(bool enabled); #endif diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp index d4e70038..cf421bc9 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -71,11 +71,11 @@ bool QtUiApplication::init() if (Quassel::init()) { // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location // Move settings, note this does not delete the old files -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC QSettings newSettings("quassel-irc.org", "quasselclient"); #else -# ifdef Q_WS_WIN +# ifdef Q_OS_WIN QSettings::Format format = QSettings::IniFormat; # else QSettings::Format format = QSettings::NativeFormat; @@ -84,10 +84,10 @@ bool QtUiApplication::init() QString newFilePath = Quassel::configDirPath() + "quasselclient" + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini")); QSettings newSettings(newFilePath, format); -#endif /* Q_WS_MAC */ +#endif /* Q_OS_MAC */ if (newSettings.value("Config/Version").toUInt() == 0) { -# ifdef Q_WS_MAC +# ifdef Q_OS_MAC QString org = "quassel-irc.org"; # else QString org = "Quassel Project"; diff --git a/src/qtui/settingspages/appearancesettingspage.cpp b/src/qtui/settingspages/appearancesettingspage.cpp index 4ba3f89b..2935feb9 100644 --- a/src/qtui/settingspages/appearancesettingspage.cpp +++ b/src/qtui/settingspages/appearancesettingspage.cpp @@ -36,7 +36,7 @@ AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent) { ui.setupUi(this); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC ui.minimizeOnClose->hide(); #endif #ifdef QT_NO_SYSTEMTRAYICON diff --git a/src/qtui/settingspages/keysequencewidget.cpp b/src/qtui/settingspages/keysequencewidget.cpp index aaf0ed3a..9f75c754 100644 --- a/src/qtui/settingspages/keysequencewidget.cpp +++ b/src/qtui/settingspages/keysequencewidget.cpp @@ -33,7 +33,7 @@ #include // This defines the unicode symbols for special keys (kCommandUnicode and friends) -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC # include #endif @@ -265,7 +265,7 @@ void KeySequenceWidget::updateShortcutDisplay() if (_isRecording) { if (_modifierKeys) { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (_modifierKeys & Qt::META) s += QChar(kControlUnicode); if (_modifierKeys & Qt::ALT) s += QChar(kOptionUnicode); if (_modifierKeys & Qt::SHIFT) s += QChar(kShiftUnicode); diff --git a/src/qtui/taskbarnotificationbackend.cpp b/src/qtui/taskbarnotificationbackend.cpp index ed7c05fe..a689c132 100644 --- a/src/qtui/taskbarnotificationbackend.cpp +++ b/src/qtui/taskbarnotificationbackend.cpp @@ -79,7 +79,7 @@ SettingsPage *TaskbarNotificationBackend::createConfigWidget() const TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "TaskbarNotification", parent) { QHBoxLayout *layout = new QHBoxLayout(this); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC layout->addWidget(enabledBox = new QCheckBox(tr("Activate dock entry, timeout:"), this)); #else layout->addWidget(enabledBox = new QCheckBox(tr("Mark taskbar entry, timeout:"), this)); diff --git a/src/uisupport/graphicalui.cpp b/src/uisupport/graphicalui.cpp index 9bcdfcd7..1c17a5e8 100644 --- a/src/uisupport/graphicalui.cpp +++ b/src/uisupport/graphicalui.cpp @@ -49,7 +49,7 @@ GraphicalUi::GraphicalUi(QObject *parent) : AbstractUi(parent) Q_ASSERT(!_instance); _instance = this; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN _dwTickCount = 0; #endif } @@ -57,7 +57,7 @@ GraphicalUi::GraphicalUi(QObject *parent) : AbstractUi(parent) void GraphicalUi::init() { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN mainWidget()->installEventFilter(this); #endif } @@ -137,7 +137,7 @@ void GraphicalUi::disconnectedFromCore() bool GraphicalUi::eventFilter(QObject *obj, QEvent *event) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN if (obj == mainWidget() && event->type() == QEvent::ActivationChange) { _dwTickCount = GetTickCount(); } @@ -150,7 +150,7 @@ bool GraphicalUi::eventFilter(QObject *obj, QEvent *event) bool GraphicalUi::checkMainWidgetVisibility(bool perform) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN // the problem is that we lose focus when the systray icon is activated // and we don't know the former active window // therefore we watch for activation event and use our stopwatch :) diff --git a/src/uisupport/graphicalui.h b/src/uisupport/graphicalui.h index df94be40..59d06583 100644 --- a/src/uisupport/graphicalui.h +++ b/src/uisupport/graphicalui.h @@ -28,7 +28,7 @@ class ContextMenuActionProvider; class ToolBarActionProvider; class UiStyle; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # include #endif @@ -116,7 +116,7 @@ private: static UiStyle *_uiStyle; static bool _onAllDesktops; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN DWORD _dwTickCount; #endif }; diff --git a/src/uisupport/multilineedit.cpp b/src/uisupport/multilineedit.cpp index 54558b50..c56b03cd 100644 --- a/src/uisupport/multilineedit.cpp +++ b/src/uisupport/multilineedit.cpp @@ -301,7 +301,7 @@ void MultiLineEdit::keyPressEvent(QKeyEvent *event) if (event == QKeySequence::InsertLineSeparator) { #else -# ifdef Q_WS_MAC +# ifdef Q_OS_MAC if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::META) { # else if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::SHIFT) { @@ -726,7 +726,7 @@ void MultiLineEdit::on_textChanged() msg += "...

"; QMessageBox question(QMessageBox::NoIcon, tr("Paste Protection"), msg, QMessageBox::Yes|QMessageBox::No); question.setDefaultButton(QMessageBox::No); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC question.setWindowFlags(question.windowFlags() | Qt::Sheet); #endif if (question.exec() != QMessageBox::Yes) -- 2.20.1