Change Q_WS_* to Q_OS_*
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 24 Mar 2014 20:43:45 +0000 (21:43 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 24 Mar 2014 23:21:25 +0000 (00:21 +0100)
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.

16 files changed:
src/common/identity.cpp
src/common/quassel.cpp
src/common/settings.cpp
src/common/settings.h
src/core/core.cpp
src/qtui/coreconfigwizard.cpp
src/qtui/legacysystemtray.cpp
src/qtui/mainwin.cpp
src/qtui/mainwin.h
src/qtui/qtuiapplication.cpp
src/qtui/settingspages/appearancesettingspage.cpp
src/qtui/settingspages/keysequencewidget.cpp
src/qtui/taskbarnotificationbackend.cpp
src/uisupport/graphicalui.cpp
src/uisupport/graphicalui.h
src/uisupport/multilineedit.cpp

index e31735a..5fe2d07 100644 (file)
@@ -35,7 +35,7 @@
 #  include <unistd.h>
 #endif
 
-#ifdef Q_OS_WIN32
+#ifdef Q_OS_WIN
 #  include <windows.h>
 #  include <Winbase.h>
 #  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))
index 6490eb9..f5954c0 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <iostream>
 #include <signal.h>
-#if !defined Q_OS_WIN32 && !defined Q_OS_MAC
+#if !defined Q_OS_WIN && !defined Q_OS_MAC
 #  include <sys/types.h>
 #  include <sys/time.h>
 #  include <sys/resource.h>
@@ -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();
     }
index eda4c62..d89b850 100644 (file)
@@ -27,7 +27,7 @@ const int VERSION = 1;
 QHash<QString, QVariant> Settings::settingsCache;
 QHash<QString, SettingsChangeNotifier *> 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())
index 1a9235f..4f556d7 100644 (file)
@@ -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;
index 1d8098d..008c5b0 100644 (file)
 
 // migration related
 #include <QFile>
-#ifdef Q_OS_WIN32
+#ifdef Q_OS_WIN
 #  include <windows.h>
 #else
 #  include <unistd.h>
 #  include <termios.h>
-#endif /* Q_OS_WIN32 */
+#endif /* Q_OS_WIN */
 
 #ifdef HAVE_UMASK
 #  include <sys/types.h>
@@ -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 */
index d10ca75..e1d74fe 100644 (file)
@@ -52,7 +52,7 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QList<QVari
     setStartId(IntroPage);
     //setStartId(StorageSelectionPage);
 
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
     setWizardStyle(ModernStyle);
 #endif
 
index eedffb8..56139e3 100644 (file)
@@ -37,7 +37,7 @@ LegacySystemTray::LegacySystemTray(QWidget *parent)
     disconnect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
         _trayIcon, SLOT(activateOrHide(QSystemTrayIcon::ActivationReason)));
 #endif
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
     connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
         SLOT(on_activated(QSystemTrayIcon::ActivationReason)));
 #endif
@@ -67,7 +67,7 @@ void LegacySystemTray::syncLegacyIcon()
 {
     _trayIcon->setIcon(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());
index 1399113..2a1ce6f 100644 (file)
@@ -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;
index 49e4cef..ad16889 100644 (file)
@@ -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
 
index d4e7003..cf421bc 100644 (file)
@@ -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";
index 4ba3f89..2935feb 100644 (file)
@@ -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
index aaf0ed3..9f75c75 100644 (file)
@@ -33,7 +33,7 @@
 #include <QToolButton>
 
 // This defines the unicode symbols for special keys (kCommandUnicode and friends)
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 #  include <Carbon/Carbon.h>
 #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);
index ed7c05f..a689c13 100644 (file)
@@ -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));
index 9bcdfcd..1c17a5e 100644 (file)
@@ -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 :)
index df94be4..59d0658 100644 (file)
@@ -28,7 +28,7 @@ class ContextMenuActionProvider;
 class ToolBarActionProvider;
 class UiStyle;
 
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
 #  include <windows.h>
 #endif
 
@@ -116,7 +116,7 @@ private:
     static UiStyle *_uiStyle;
     static bool _onAllDesktops;
 
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
     DWORD _dwTickCount;
 #endif
 };
index 54558b5..c56b03c 100644 (file)
@@ -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 += "...</p>";
                 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)