Browse Source

Make QtDBus dependency optional

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
b6c3189fe3
  1. 1
      Changelog
  2. 43
      configure
  3. 2
      qbittorrent.qc
  4. 31
      qcm/qt-dbus.qcm
  5. 8
      src/mainwindow.cpp
  6. 4
      src/misc.cpp
  7. 8
      src/powermanagement/powermanagement.cpp
  8. 4
      src/powermanagement/powermanagement.h
  9. 2
      src/powermanagement/powermanagement.pri
  10. 3
      src/preferences/options_imp.cpp
  11. 2
      unixconf.pri

1
Changelog

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
- FEATURE: Added option to disable program exit confirmation
- FEATURE: Added per-torrent ratio limiting (Christian Kandeler)
- BUGFIX: Fix compilation with namespaced Qt (Christian Kandeler)
- OTHER: Make QtDBus dependency optional (X11)
* Sun Jan 9 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.6.0
- FEATURE: Use system icons (Linux, Qt >= 4.6)

43
configure vendored

@ -22,6 +22,7 @@ Dependency options: @@ -22,6 +22,7 @@ Dependency options:
--disable-gui Disable qBittorrent
Graphical user interface for
headless running
--disable-qt-dbus Disable use of qt-dbus
--with-libboost-inc=[path] Path to libboost include
files
--with-libboost-lib=[path] Path to libboost library
@ -162,6 +163,11 @@ while [ $# -gt 0 ]; do @@ -162,6 +163,11 @@ while [ $# -gt 0 ]; do
shift
;;
--disable-qt-dbus)
QC_DISABLE_qt_dbus="Y"
shift
;;
--with-libboost-inc=*)
QC_WITH_LIBBOOST_INC=$optarg
shift
@ -215,6 +221,7 @@ echo DATADIR=$DATADIR @@ -215,6 +221,7 @@ echo DATADIR=$DATADIR
echo EX_QTDIR=$EX_QTDIR
echo QC_ENABLE_DEBUG=$QC_ENABLE_DEBUG
echo QC_DISABLE_GUI=$QC_DISABLE_GUI
echo QC_DISABLE_qt_dbus=$QC_DISABLE_qt_dbus
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
echo QC_WITH_LIBBOOST_LIB=$QC_WITH_LIBBOOST_LIB
echo QC_DISABLE_libnotify=$QC_DISABLE_libnotify
@ -355,6 +362,38 @@ public: @@ -355,6 +362,38 @@ public:
return(QT_VERSION >= 0x040500);
}
};
#line 1 "qt-dbus.qcm"
/*
-----BEGIN QCMOD-----
name: qt-dbus
-----END QCMOD-----
*/
// see Conf::findPkgConfig
class qc_qt_dbus : public ConfObj
{
public:
qc_qt_dbus(Conf *c) : ConfObj(c) {}
QString name() const { return "QtDBus >= 4.5"; }
QString shortname() const { return "qt-dbus"; }
QString checkString() const {
if(!conf->getenv("QC_DISABLE_qt_dbus").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
return "";
return ConfObj::checkString();
}
bool exec(){
if(!conf->getenv("QC_DISABLE_qt_dbus").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
return false;
QStringList incs;
QString req_ver = "4.5.0";
QString version, libs, other;
VersionMode mode = VersionMin;
if(conf->findPkgConfig("QtDBus", mode, req_ver, &version, &incs, &libs, &other)) {
conf->addExtra("CONFIG += dbus");
return true;
}
return false;
}
};
#line 1 "pkg-config.qcm"
/*
-----BEGIN QCMOD-----
@ -645,6 +684,9 @@ cat >$1/modules_new.cpp <<EOT @@ -645,6 +684,9 @@ cat >$1/modules_new.cpp <<EOT
o = new qc_qt4(conf);
o->required = true;
o->disabled = false;
o = new qc_qt_dbus(conf);
o->required = false;
o->disabled = false;
o = new qc_pkg_config(conf);
o->required = true;
o->disabled = false;
@ -1610,6 +1652,7 @@ export DATADIR @@ -1610,6 +1652,7 @@ export DATADIR
export EX_QTDIR
export QC_ENABLE_DEBUG
export QC_DISABLE_GUI
export QC_DISABLE_qt_dbus
export QC_WITH_LIBBOOST_INC
export QC_WITH_LIBBOOST_LIB
export QC_DISABLE_libnotify

2
qbittorrent.qc

@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
<dep type='qt4'>
<required/>
</dep>
<dep type='qt-dbus'>
</dep>
<dep type='pkg-config'>
<required/>
</dep>

31
qcm/qt-dbus.qcm

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
/*
-----BEGIN QCMOD-----
name: qt-dbus
-----END QCMOD-----
*/
// see Conf::findPkgConfig
class qc_qt_dbus : public ConfObj
{
public:
qc_qt_dbus(Conf *c) : ConfObj(c) {}
QString name() const { return "QtDBus >= 4.5"; }
QString shortname() const { return "qt-dbus"; }
QString checkString() const {
if(!conf->getenv("QC_DISABLE_qt_dbus").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
return "";
return ConfObj::checkString();
}
bool exec(){
if(!conf->getenv("QC_DISABLE_qt_dbus").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
return false;
QStringList incs;
QString req_ver = "4.5.0";
QString version, libs, other;
VersionMode mode = VersionMin;
if(conf->findPkgConfig("QtDBus", mode, req_ver, &version, &incs, &libs, &other)) {
conf->addExtra("CONFIG += dbus");
return true;
}
return false;
}
};

8
src/mainwindow.cpp

@ -43,9 +43,6 @@ @@ -43,9 +43,6 @@
#include <QCloseEvent>
#include <QShortcut>
#include <QScrollBar>
#ifdef Q_WS_X11
#include <QDBusInterface>
#endif
#include "mainwindow.h"
#include "transferlistwidget.h"
@ -235,11 +232,14 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo @@ -235,11 +232,14 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
autoShutdownGroup->setExclusive(true);
autoShutdownGroup->addAction(actionAutoShutdown_Disabled);
autoShutdownGroup->addAction(actionAutoExit_qBittorrent);
#if !defined(Q_WS_X11) || defined(QT_DBUS_LIB)
autoShutdownGroup->addAction(actionAutoShutdown_system);
autoShutdownGroup->addAction(actionAutoSuspend_system);
actionAutoExit_qBittorrent->setChecked(pref.shutdownqBTWhenDownloadsComplete());
actionAutoShutdown_system->setChecked(pref.shutdownWhenDownloadsComplete());
actionAutoSuspend_system->setChecked(pref.suspendWhenDownloadsComplete());
#endif
actionAutoExit_qBittorrent->setChecked(pref.shutdownqBTWhenDownloadsComplete());
if(!autoShutdownGroup->checkedAction())
actionAutoShutdown_Disabled->setChecked(true);

4
src/misc.cpp

@ -71,7 +71,7 @@ const int UNLEN = 256; @@ -71,7 +71,7 @@ const int UNLEN = 256;
#endif
#ifndef DISABLE_GUI
#ifdef Q_WS_X11
#if defined(Q_WS_X11) && defined(QT_DBUS_LIB)
#include <QDBusInterface>
#include <QDBusMessage>
#endif
@ -206,7 +206,7 @@ long long misc::freeDiskSpaceOnPath(QString path) { @@ -206,7 +206,7 @@ long long misc::freeDiskSpaceOnPath(QString path) {
#ifndef DISABLE_GUI
void misc::shutdownComputer(bool sleep) {
#ifdef Q_WS_X11
#if defined(Q_WS_X11) && defined(QT_DBUS_LIB)
// Use dbus to power off the system
// dbus-send --print-reply --system --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown
QDBusInterface computer("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device.SystemPowerManagement", QDBusConnection::systemBus());

8
src/powermanagement/powermanagement.cpp

@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
#include <QtGlobal>
#ifdef Q_WS_X11
#if defined(Q_WS_X11) && defined(QT_DBUS_LIB)
#include "powermanagement_x11.h"
#endif
#include "powermanagement.h"
@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
PowerManagement::PowerManagement(QObject *parent) : QObject(parent), m_busy(false)
{
#ifdef Q_WS_X11
#if defined(Q_WS_X11) && defined(QT_DBUS_LIB)
m_inhibitor = new PowerManagementInhibitor(this);
#endif
}
@ -67,7 +67,7 @@ void PowerManagement::setBusy() @@ -67,7 +67,7 @@ void PowerManagement::setBusy()
#ifdef Q_WS_WIN
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
#elif defined(Q_WS_X11)
#elif defined(Q_WS_X11) && defined(QT_DBUS_LIB)
m_inhibitor->RequestBusy();
#elif defined(Q_WS_MAC)
IOReturn success = IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &m_assertionID);
@ -82,7 +82,7 @@ void PowerManagement::setIdle() @@ -82,7 +82,7 @@ void PowerManagement::setIdle()
#ifdef Q_WS_WIN
SetThreadExecutionState(ES_CONTINUOUS);
#elif defined(Q_WS_X11)
#elif defined(Q_WS_X11) && defined(QT_DBUS_LIB)
m_inhibitor->RequestIdle();
#elif defined(Q_WS_MAC)
IOPMAssertionRelease(m_assertionID);

4
src/powermanagement/powermanagement.h

@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
#include <IOKit/pwr_mgt/IOPMLib.h>
#endif
#ifdef Q_WS_X11
#if defined(Q_WS_X11) && defined(QT_DBUS_LIB)
// Require DBus
class PowerManagementInhibitor;
#endif
@ -59,7 +59,7 @@ private: @@ -59,7 +59,7 @@ private:
void setBusy();
void setIdle();
#ifdef Q_WS_X11
#if defined(Q_WS_X11) && defined(QT_DBUS_LIB)
PowerManagementInhibitor *m_inhibitor;
#endif
#ifdef Q_WS_MAC

2
src/powermanagement/powermanagement.pri

@ -3,7 +3,7 @@ INCLUDEPATH += $$PWD @@ -3,7 +3,7 @@ INCLUDEPATH += $$PWD
HEADERS += $$PWD/powermanagement.h
SOURCES += $$PWD/powermanagement.cpp
unix:!macx {
unix:!macx:dbus {
HEADERS += $$PWD/powermanagement_x11.h
SOURCES += $$PWD/powermanagement_x11.cpp
}

3
src/preferences/options_imp.cpp

@ -132,6 +132,9 @@ options_imp::options_imp(QWidget *parent): @@ -132,6 +132,9 @@ options_imp::options_imp(QWidget *parent):
connect(checkShowSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkProgramExitConfirm, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkPreventFromSuspend, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
#if defined(Q_WS_X11) && !defined(QT_DBUS_LIB)
checkPreventFromSuspend->setDisabled(true);
#endif
// Downloads tab
connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(textTempPath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));

2
unixconf.pri

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
include(conf.pri)
# COMPILATION SPECIFIC
!nox {
!nox:dbus {
QT += dbus
}
QMAKE_LFLAGS_APP += -rdynamic

Loading…
Cancel
Save