mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 04:24:23 +00:00
- COSMETIC: Make use of libnotify if available for system notifications (Now default on Ubuntu) instead of the Qt notification system
This commit is contained in:
parent
b80843c602
commit
91efa0e2d4
@ -47,6 +47,7 @@
|
|||||||
- COSMETIC: Improved status bar layout spacing
|
- COSMETIC: Improved status bar layout spacing
|
||||||
- COSMETIC: Display speeds with more user friendly units instead of always using KiB/s
|
- COSMETIC: Display speeds with more user friendly units instead of always using KiB/s
|
||||||
- COSMETIC: New torrent status icons by Mateusz Tolola
|
- COSMETIC: New torrent status icons by Mateusz Tolola
|
||||||
|
- COSMETIC: Make use of libnotify if available for system notifications (Ubuntu, ...)
|
||||||
|
|
||||||
* Thu Sep 3 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.0
|
* Thu Sep 3 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.0
|
||||||
- FEATURE: Added Magnet URI support
|
- FEATURE: Added Magnet URI support
|
||||||
|
53
configure
vendored
53
configure
vendored
@ -19,6 +19,7 @@ Main options:
|
|||||||
|
|
||||||
Dependency options:
|
Dependency options:
|
||||||
--with-libboost-inc=[path] Path to libboost include files
|
--with-libboost-inc=[path] Path to libboost include files
|
||||||
|
--disable-libnotify Disable use of libnotify
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
}
|
}
|
||||||
@ -140,6 +141,11 @@ while [ $# -gt 0 ]; do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--disable-libnotify)
|
||||||
|
QC_DISABLE_libnotify="Y"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
--verbose)
|
--verbose)
|
||||||
QC_VERBOSE="Y"
|
QC_VERBOSE="Y"
|
||||||
shift
|
shift
|
||||||
@ -162,6 +168,7 @@ echo BINDIR=$BINDIR
|
|||||||
echo DATADIR=$DATADIR
|
echo DATADIR=$DATADIR
|
||||||
echo EX_QTDIR=$EX_QTDIR
|
echo EX_QTDIR=$EX_QTDIR
|
||||||
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
||||||
|
echo QC_DISABLE_libnotify=$QC_DISABLE_libnotify
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -370,6 +377,48 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#line 1 "libnotify.qcm"
|
||||||
|
/*
|
||||||
|
-----BEGIN QCMOD-----
|
||||||
|
name: libnotify
|
||||||
|
-----END QCMOD-----
|
||||||
|
*/
|
||||||
|
// see Conf::findPkgConfig
|
||||||
|
class qc_libnotify : public ConfObj
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
qc_libnotify(Conf *c) : ConfObj(c) {}
|
||||||
|
QString name() const { return "libnotify >= 0.4.2 (optional)"; }
|
||||||
|
QString shortname() const { return "libnotify"; }
|
||||||
|
bool exec(){
|
||||||
|
QStringList incs;
|
||||||
|
QString req_ver = "0.4.2";
|
||||||
|
QString version, libs, other;
|
||||||
|
VersionMode mode = VersionMin;
|
||||||
|
if(conf->findPkgConfig("libnotify", mode, req_ver, &version, &incs, &libs, &other)) {
|
||||||
|
conf->addDefine("WITH_LIBNOTIFY");
|
||||||
|
for(int n = 0; n < incs.count(); ++n)
|
||||||
|
conf->addIncludePath(incs[n]);
|
||||||
|
if(!libs.isEmpty())
|
||||||
|
conf->addLib(libs);
|
||||||
|
QStringList incs2;
|
||||||
|
QString req_ver2 = "2.0";
|
||||||
|
QString version2, libs2, other2;
|
||||||
|
if(conf->findPkgConfig("glib-2.0", mode, req_ver2, &version2, &incs2, &libs2, &other2)) {
|
||||||
|
for(int n = 0; n < incs2.count(); ++n)
|
||||||
|
conf->addIncludePath(incs2[n]);
|
||||||
|
if(!libs2.isEmpty())
|
||||||
|
conf->addLib(libs2);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
cat >$1/modules_new.cpp <<EOT
|
cat >$1/modules_new.cpp <<EOT
|
||||||
@ -382,6 +431,9 @@ cat >$1/modules_new.cpp <<EOT
|
|||||||
o = new qc_libboost(conf);
|
o = new qc_libboost(conf);
|
||||||
o->required = true;
|
o->required = true;
|
||||||
o->disabled = false;
|
o->disabled = false;
|
||||||
|
o = new qc_libnotify(conf);
|
||||||
|
o->required = false;
|
||||||
|
o->disabled = false;
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
cat >$1/conf4.h <<EOT
|
cat >$1/conf4.h <<EOT
|
||||||
@ -1328,6 +1380,7 @@ export BINDIR
|
|||||||
export DATADIR
|
export DATADIR
|
||||||
export EX_QTDIR
|
export EX_QTDIR
|
||||||
export QC_WITH_LIBBOOST_INC
|
export QC_WITH_LIBBOOST_INC
|
||||||
|
export QC_DISABLE_libnotify
|
||||||
export QC_VERBOSE
|
export QC_VERBOSE
|
||||||
rm -rf .qconftemp
|
rm -rf .qconftemp
|
||||||
(
|
(
|
||||||
|
@ -12,4 +12,6 @@
|
|||||||
<dep type='libboost'>
|
<dep type='libboost'>
|
||||||
<required/>
|
<required/>
|
||||||
</dep>
|
</dep>
|
||||||
|
<dep type='libnotify'>
|
||||||
|
</dep>
|
||||||
</qconf>
|
</qconf>
|
||||||
|
41
qcm/libnotify.qcm
Normal file
41
qcm/libnotify.qcm
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
-----BEGIN QCMOD-----
|
||||||
|
name: libnotify
|
||||||
|
-----END QCMOD-----
|
||||||
|
*/
|
||||||
|
// see Conf::findPkgConfig
|
||||||
|
class qc_libnotify : public ConfObj
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
qc_libnotify(Conf *c) : ConfObj(c) {}
|
||||||
|
QString name() const { return "libnotify >= 0.4.2 (optional)"; }
|
||||||
|
QString shortname() const { return "libnotify"; }
|
||||||
|
bool exec(){
|
||||||
|
QStringList incs;
|
||||||
|
QString req_ver = "0.4.2";
|
||||||
|
QString version, libs, other;
|
||||||
|
VersionMode mode = VersionMin;
|
||||||
|
if(conf->findPkgConfig("libnotify", mode, req_ver, &version, &incs, &libs, &other)) {
|
||||||
|
conf->addDefine("WITH_LIBNOTIFY");
|
||||||
|
for(int n = 0; n < incs.count(); ++n)
|
||||||
|
conf->addIncludePath(incs[n]);
|
||||||
|
if(!libs.isEmpty())
|
||||||
|
conf->addLib(libs);
|
||||||
|
QStringList incs2;
|
||||||
|
QString req_ver2 = "2.0";
|
||||||
|
QString version2, libs2, other2;
|
||||||
|
if(conf->findPkgConfig("glib-2.0", mode, req_ver2, &version2, &incs2, &libs2, &other2)) {
|
||||||
|
for(int n = 0; n < incs2.count(); ++n)
|
||||||
|
conf->addIncludePath(incs2[n]);
|
||||||
|
if(!libs2.isEmpty())
|
||||||
|
conf->addLib(libs2);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
18
src/GUI.cpp
18
src/GUI.cpp
@ -27,6 +27,12 @@
|
|||||||
*
|
*
|
||||||
* Contact : chris@qbittorrent.org
|
* Contact : chris@qbittorrent.org
|
||||||
*/
|
*/
|
||||||
|
#ifdef WITH_LIBNOTIFY
|
||||||
|
#include <glib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <libnotify/notify.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
@ -798,7 +804,19 @@ void GUI::updateGUI() {
|
|||||||
void GUI::showNotificationBaloon(QString title, QString msg) const {
|
void GUI::showNotificationBaloon(QString title, QString msg) const {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool()) {
|
if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool()) {
|
||||||
|
#ifdef WITH_LIBNOTIFY
|
||||||
|
if (notify_init ("summary-body")) {
|
||||||
|
NotifyNotification* notification;
|
||||||
|
notification = notify_notification_new (title.toLocal8Bit().data(), msg.toLocal8Bit().data(), 0, 0);
|
||||||
|
GError* error = 0;
|
||||||
|
gboolean success = notify_notification_show (notification, &error);
|
||||||
|
notify_uninit ();
|
||||||
|
if(success)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
|
systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user