Set qBittorrent as default torrent app in Mac OS

This commit is contained in:
Dmitry Victorov 2015-12-27 07:02:31 +03:00
parent 76c16e0994
commit a564b96ccf
3 changed files with 88 additions and 1 deletions

View file

@ -123,6 +123,9 @@ options_imp::options_imp(QWidget *parent)
#ifndef Q_OS_WIN
checkStartup->setVisible(false);
#endif
#if !(defined(Q_OS_WIN) || defined(Q_OS_MAC))
groupFileAssociation->setVisible(false);
#endif
@ -149,7 +152,7 @@ options_imp::options_imp(QWidget *parent)
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && !defined(QT_DBUS_LIB)
checkPreventFromSuspend->setDisabled(true);
#endif
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
connect(checkAssociateTorrents, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkAssociateMagnetLinks, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
#endif
@ -402,6 +405,18 @@ void options_imp::saveOptions()
// Windows: file association settings
Preferences::setTorrentFileAssoc(checkAssociateTorrents->isChecked());
Preferences::setMagnetLinkAssoc(checkAssociateMagnetLinks->isChecked());
#endif
#ifdef Q_OS_MAC
if (checkAssociateTorrents->isChecked()) {
Preferences::setTorrentFileAssoc();
checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
checkAssociateTorrents->setEnabled(!checkAssociateTorrents->isChecked());
}
if (checkAssociateMagnetLinks->isChecked()) {
Preferences::setMagnetLinkAssoc();
checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
checkAssociateMagnetLinks->setEnabled(!checkAssociateMagnetLinks->isChecked());
}
#endif
// End General preferences
@ -573,6 +588,12 @@ void options_imp::loadOptions()
checkStartup->setChecked(pref->WinStartup());
checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
#endif
#ifdef Q_OS_MAC
checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
checkAssociateTorrents->setEnabled(!checkAssociateTorrents->isChecked());
checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
checkAssociateMagnetLinks->setEnabled(!checkAssociateMagnetLinks->isChecked());
#endif
// End General preferences