1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Qt5: Fixed Q_WS_X11 macro usage

This commit is contained in:
nowrep 2012-12-22 12:47:45 +01:00
parent ef7203d205
commit 44693080cb
16 changed files with 37 additions and 87 deletions

View File

@ -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) {

View File

@ -17,7 +17,7 @@
* ============================================================ */
#include "processinfo.h"
#ifdef Q_WS_X11
#ifdef QZ_WS_X11
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
@ -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++) {

View File

@ -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;

View File

@ -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.

View File

@ -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);

View File

@ -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);

View File

@ -81,15 +81,14 @@
#include <QWebHistory>
#include <QMessageBox>
#ifdef Q_WS_X11
#if QT_VERSION < 0x050000
#include "qwebkitversion.h"
#ifdef QZ_WS_X11
#include <QX11Info>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#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();

View File

@ -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

View File

@ -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"

View File

@ -23,7 +23,7 @@
#include <QFile>
#include <QDir>
#if defined(Q_WS_X11) && !defined(DISABLE_DBUS)
#if defined(QZ_WS_X11) && !defined(DISABLE_DBUS)
#include <QDBusInterface>
#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());

View File

@ -393,7 +393,7 @@ QString QupZillaSchemeReply::configPage()
#if defined(Q_OS_WIN) && defined(W7API)
w7APIEnabled = tr("<b>Enabled</b>");
#endif
#if defined(Q_WS_X11) && defined(KDE)
#if defined(QZ_WS_X11) && defined(KDE)
KDEIntegration = tr("<b>Enabled</b>");
#endif
#ifdef PORTABLE_BUILD

View File

@ -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

View File

@ -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;

View File

@ -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()) {

View File

@ -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

View File

@ -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