diff --git a/src/defines.pri b/src/defines.pri index ef1d35f6f..d82dfc48a 100644 --- a/src/defines.pri +++ b/src/defines.pri @@ -66,9 +66,12 @@ equals(d_disable_dbus, "true") { DEFINES *= DISABLE_DBUS } DEFINES *= USE_DATADIR=\\\"""$$data_folder/"\\\"" - #Git revision + # Git revision rev = $$system(cd ../ && sh $$PWD/../scripts/getrevision.sh) !equals(rev, ""): DEFINES *= GIT_REVISION=\\\"""$$rev"\\\"" + + # Define QZ_WS_X11 even with Qt5 + DEFINES *= QZ_WS_X11 } isEmpty(QMAKE_LRELEASE) { diff --git a/src/lib/3rdparty/processinfo.cpp b/src/lib/3rdparty/processinfo.cpp index 452367314..add045962 100644 --- a/src/lib/3rdparty/processinfo.cpp +++ b/src/lib/3rdparty/processinfo.cpp @@ -17,7 +17,7 @@ * ============================================================ */ #include "processinfo.h" -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 #include #include #include @@ -37,7 +37,7 @@ ProcessInfo::ProcessInfo(const QString &name) bool ProcessInfo::isRunning() const { -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 pid_t pid = GetPIDbyName(qPrintable(m_name)); // -1 = process not found // -2 = /proc fs access error @@ -47,7 +47,7 @@ bool ProcessInfo::isRunning() const #endif } -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 bool ProcessInfo::IsNumeric(const char* ccharptr_CharacterList) const { for (; *ccharptr_CharacterList; ccharptr_CharacterList++) { diff --git a/src/lib/3rdparty/processinfo.h b/src/lib/3rdparty/processinfo.h index 6becda2d5..2f1843fbe 100644 --- a/src/lib/3rdparty/processinfo.h +++ b/src/lib/3rdparty/processinfo.h @@ -35,7 +35,7 @@ public: bool isRunning() const; private: -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 bool IsNumeric(const char* ccharptr_CharacterList) const; pid_t GetPIDbyName(const char* cchrptr_ProcessName) const; diff --git a/src/lib/3rdparty/qtsingleapplication.cpp b/src/lib/3rdparty/qtsingleapplication.cpp index 6aa38cd94..4e26c451f 100644 --- a/src/lib/3rdparty/qtsingleapplication.cpp +++ b/src/lib/3rdparty/qtsingleapplication.cpp @@ -179,53 +179,6 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char** sysInit(appId); } -#if defined(Q_WS_X11) -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be QCoreApplication::applicationFilePath(). \a dpy, \a visual, - and \a cmap are passed on to the QApplication constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, visual, cmap) - , peer(0) - , actWin(0) -{ - sysInit(); -} - -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be QCoreApplication::applicationFilePath(). \a dpy, \a argc, \a - argv, \a visual, and \a cmap are passed on to the QApplication - constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, int &argc, char** argv, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, argc, argv, visual, cmap) - , peer(0) - , actWin(0) -{ - sysInit(); -} - -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be \a appId. \a dpy, \a argc, \a - argv, \a visual, and \a cmap are passed on to the QApplication - constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char** argv, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, argc, argv, visual, cmap) - , peer(0) - , actWin(0) -{ - sysInit(appId); -} -#endif - - /*! Returns true if another instance of this application is running; otherwise false. diff --git a/src/lib/3rdparty/qtsingleapplication.h b/src/lib/3rdparty/qtsingleapplication.h index 0532656c1..b7936a4fc 100644 --- a/src/lib/3rdparty/qtsingleapplication.h +++ b/src/lib/3rdparty/qtsingleapplication.h @@ -72,11 +72,6 @@ class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication public: QtSingleApplication(int &argc, char** argv, bool GUIenabled = true); QtSingleApplication(const QString &id, int &argc, char** argv); -#if defined(Q_WS_X11) - QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); - QtSingleApplication(Display* dpy, int &argc, char** argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0); - QtSingleApplication(Display* dpy, const QString &appId, int argc, char** argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); -#endif bool isRunning(); void setAppId(const QString &id); diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 2e01f1393..015b61524 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -96,7 +96,7 @@ MainApplication::MainApplication(int &argc, char** argv) , m_databaseConnected(false) , m_registerQAppAssociation(0) { -#if defined(Q_WS_X11) && !defined(NO_SYSTEM_DATAPATH) +#if defined(QZ_WS_X11) && !defined(NO_SYSTEM_DATAPATH) DATADIR = USE_DATADIR; #else DATADIR = qApp->applicationDirPath() + "/"; @@ -309,7 +309,7 @@ void MainApplication::loadSettings() cssFile.open(QFile::ReadOnly); QString css = cssFile.readAll(); cssFile.close(); -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 if (QFile(m_activeThemePath + "linux.css").exists()) { cssFile.setFileName(m_activeThemePath + "linux.css"); cssFile.open(QFile::ReadOnly); diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index e505a1a32..3e58ec50d 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -81,15 +81,14 @@ #include #include -#ifdef Q_WS_X11 +#if QT_VERSION < 0x050000 +#include "qwebkitversion.h" +#ifdef QZ_WS_X11 #include #include #include -#endif - -#if QT_VERSION < 0x050000 -#include "qwebkitversion.h" -#endif +#endif // QZ_WS_X11 +#endif // QT_VERSION const QString QupZilla::VERSION = "1.3.5"; const QString QupZilla::BUILDTIME = __DATE__" "__TIME__; @@ -126,7 +125,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl) m_isStarting = true; -#ifndef Q_WS_X11 +#ifndef QZ_WS_X11 setUpdatesEnabled(false); #endif @@ -139,7 +138,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl) void QupZilla::postLaunch() { -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 setUpdatesEnabled(false); #endif @@ -314,7 +313,7 @@ void QupZilla::setupMenu() m_actionQuit = new QAction(QIcon::fromTheme("application-exit"), tr("Quit"), 0); m_actionQuit->setMenuRole(QAction::QuitRole); QKeySequence quitSequence = QKeySequence(QKeySequence::Quit); -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 // QKeySequence::Quit returns a non-empty sequence on X11 only when running Gnome or Kde if (quitSequence.isEmpty()) { quitSequence = QKeySequence(Qt::CTRL + Qt::Key_Q); @@ -364,7 +363,7 @@ void QupZilla::setupMenu() m_menuEdit->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &All"), this, SLOT(editSelectAll()))->setShortcut(QKeySequence("Ctrl+A")); m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("&Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F")); m_menuEdit->addSeparator(); -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 m_menuEdit->addAction(m_actionPreferences); #endif connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu())); @@ -485,7 +484,7 @@ void QupZilla::setupMenu() connect(m_actionPrivateBrowsing, SIGNAL(triggered(bool)), mApp, SLOT(startPrivateBrowsing())); m_menuTools->addAction(m_actionPrivateBrowsing); m_menuTools->addSeparator(); -#if !defined(Q_WS_X11) && !defined(Q_OS_MAC) +#if !defined(QZ_WS_X11) && !defined(Q_OS_MAC) m_menuTools->addAction(m_actionPreferences); #endif @@ -633,7 +632,7 @@ void QupZilla::loadSettings() return; } //Opacity -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_NoSystemBackground, false); QPalette pal = palette(); @@ -1887,7 +1886,7 @@ bool QupZilla::quitApp() QByteArray QupZilla::saveState(int version) const { -#ifdef Q_WS_X11 +#if defined(QZ_WS_X11) && QT_VERSION < 0x050000 QByteArray data; QDataStream stream(&data, QIODevice::WriteOnly); @@ -1902,7 +1901,7 @@ QByteArray QupZilla::saveState(int version) const bool QupZilla::restoreState(const QByteArray &state, int version) { -#ifdef Q_WS_X11 +#if defined(QZ_WS_X11) && QT_VERSION < 0x050000 QByteArray windowState; int desktopId = -1; @@ -1918,7 +1917,7 @@ bool QupZilla::restoreState(const QByteArray &state, int version) #endif } -#ifdef Q_WS_X11 +#if defined(QZ_WS_X11) && QT_VERSION < 0x050000 int QupZilla::getCurrentVirtualDesktop() const { Display* display = QX11Info::display(); diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h index b997a92d8..3a96c750e 100644 --- a/src/lib/app/qupzilla.h +++ b/src/lib/app/qupzilla.h @@ -210,7 +210,7 @@ private: bool eventFilter(QObject* object, QEvent* event); #endif -#ifdef Q_WS_X11 +#if defined(QZ_WS_X11) && QT_VERSION < 0x050000 int getCurrentVirtualDesktop() const; void moveToVirtualDesktop(int desktopId); #endif diff --git a/src/lib/app/qz_namespace.h b/src/lib/app/qz_namespace.h index 10acecec3..42f36634d 100644 --- a/src/lib/app/qz_namespace.h +++ b/src/lib/app/qz_namespace.h @@ -90,7 +90,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qz::NewTabPositionFlags) #ifdef Q_OS_WIN #define DEFAULT_THEME_NAME "windows" -#elif defined(Q_WS_X11) +#elif defined(QZ_WS_X11) #define DEFAULT_THEME_NAME "linux" #elif defined(Q_OS_MAC) #define DEFAULT_THEME_NAME "mac" diff --git a/src/lib/desktopnotifications/desktopnotificationsfactory.cpp b/src/lib/desktopnotifications/desktopnotificationsfactory.cpp index 9cff4a01e..0bc620b76 100644 --- a/src/lib/desktopnotifications/desktopnotificationsfactory.cpp +++ b/src/lib/desktopnotifications/desktopnotificationsfactory.cpp @@ -23,7 +23,7 @@ #include #include -#if defined(Q_WS_X11) && !defined(DISABLE_DBUS) +#if defined(QZ_WS_X11) && !defined(DISABLE_DBUS) #include #endif @@ -40,7 +40,7 @@ void DesktopNotificationsFactory::loadSettings() settings.beginGroup("Notifications"); m_enabled = settings.value("Enabled", true).toBool(); m_timeout = settings.value("Timeout", 6000).toInt(); -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 m_notifType = settings.value("UseNativeDesktop", true).toBool() ? DesktopNative : PopupWidget; #else m_notifType = PopupWidget; @@ -51,7 +51,7 @@ void DesktopNotificationsFactory::loadSettings() bool DesktopNotificationsFactory::supportsNativeNotifications() const { -#if defined(Q_WS_X11) && !defined(DISABLE_DBUS) +#if defined(QZ_WS_X11) && !defined(DISABLE_DBUS) return true; #else return false; @@ -77,7 +77,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS m_desktopNotif.data()->show(); break; case DesktopNative: -#if defined(Q_WS_X11) && !defined(DISABLE_DBUS) +#if defined(QZ_WS_X11) && !defined(DISABLE_DBUS) QFile tmp(mApp->tempPath() + "/qupzilla_notif.png"); tmp.open(QFile::WriteOnly); icon.save(tmp.fileName()); @@ -104,7 +104,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS void DesktopNotificationsFactory::nativeNotificationPreview() { -#if defined(Q_WS_X11) && !defined(DISABLE_DBUS) +#if defined(QZ_WS_X11) && !defined(DISABLE_DBUS) QFile tmp(mApp->tempPath() + "/qupzilla_notif.png"); tmp.open(QFile::WriteOnly); QPixmap(":icons/preferences/dialog-question.png").save(tmp.fileName()); diff --git a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp index eb5b0c4f9..81d948621 100644 --- a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp +++ b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp @@ -393,7 +393,7 @@ QString QupZillaSchemeReply::configPage() #if defined(Q_OS_WIN) && defined(W7API) w7APIEnabled = tr("Enabled"); #endif -#if defined(Q_WS_X11) && defined(KDE) +#if defined(QZ_WS_X11) && defined(KDE) KDEIntegration = tr("Enabled"); #endif #ifdef PORTABLE_BUILD diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index efb6365eb..c751df9ce 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -163,7 +163,7 @@ void Plugins::loadAvailablePlugins() QStringList dirs; dirs << mApp->DATADIR + "plugins/" -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 #ifdef USE_LIBPATH << USE_LIBPATH "qupzilla/" #else diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index cd8824fc1..90c146997 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -364,7 +364,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) DesktopNotificationsFactory::Type notifyType; settings.beginGroup("Notifications"); ui->notificationTimeout->setValue(settings.value("Timeout", 6000).toInt() / 1000); -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 notifyType = settings.value("UseNativeDesktop", true).toBool() ? DesktopNotificationsFactory::DesktopNative : DesktopNotificationsFactory::PopupWidget; #else notifyType = DesktopNotificationsFactory::PopupWidget; diff --git a/src/lib/rss/rssnotification.cpp b/src/lib/rss/rssnotification.cpp index 0bd65f8b7..e7b9f7974 100644 --- a/src/lib/rss/rssnotification.cpp +++ b/src/lib/rss/rssnotification.cpp @@ -61,7 +61,7 @@ RSSNotification::RSSNotification(const QString &title, const QUrl &url, WebView* << RssApp("Netvibes", "http://www.netvibes.com/subscribe.php?url=", QIcon(":/icons/sites/netvibes.png")) << RssApp("Yahoo!", "http://add.my.yahoo.com/rss?url=", QIcon(":/icons/sites/yahoo.png")); -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 // TODO: Not really clever solution. // It should look in PATH if (QFile("/usr/bin/akregator").exists()) { diff --git a/src/lib/tools/iconprovider.cpp b/src/lib/tools/iconprovider.cpp index 41e9f65da..ef1e59069 100644 --- a/src/lib/tools/iconprovider.cpp +++ b/src/lib/tools/iconprovider.cpp @@ -158,7 +158,7 @@ QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon) case QStyle::SP_MessageBoxWarning: return QIcon::fromTheme("dialog-warning", mApp->style()->standardIcon(QStyle::SP_MessageBoxWarning)); -#ifdef Q_WS_X11 +#ifdef QZ_WS_X11 default: return mApp->style()->standardIcon(icon); #else diff --git a/src/main/main.cpp b/src/main/main.cpp index 69f539d97..0f2f595c3 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -117,7 +117,7 @@ int main(int argc, char* argv[]) { QT_REQUIRE_VERSION(argc, argv, "4.7.0"); -#ifdef Q_WS_X11 +#if defined(QZ_WS_X11) && QT_VERSION < 0x050000 QApplication::setGraphicsSystem("raster"); // Better overall performance on X11 #endif