mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
Enable systray icon on Mac since it is supported by Qt
This commit is contained in:
parent
ccf0002c0f
commit
4013f9fefd
2 changed files with 1055 additions and 1070 deletions
10
src/GUI.cpp
10
src/GUI.cpp
|
@ -922,7 +922,6 @@ void GUI::optionsSaved() {
|
|||
// Load program preferences
|
||||
void GUI::loadPreferences(bool configure_session) {
|
||||
BTSession->addConsoleMessage(tr("Options were saved successfully."));
|
||||
#ifndef Q_WS_MAC
|
||||
const bool newSystrayIntegration = Preferences::systrayIntegration();
|
||||
actionLock_qBittorrent->setEnabled(newSystrayIntegration);
|
||||
if(newSystrayIntegration != (systrayIcon!=0)) {
|
||||
|
@ -947,7 +946,6 @@ void GUI::loadPreferences(bool configure_session) {
|
|||
delete myTrayIconMenu;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// General
|
||||
if(Preferences::isToolbarDisplayed()) {
|
||||
toolBar->setVisible(true);
|
||||
|
@ -1011,9 +1009,8 @@ void GUI::trackerAuthenticationRequired(QTorrentHandle& h) {
|
|||
// Check connection status and display right icon
|
||||
void GUI::updateGUI() {
|
||||
// update global informations
|
||||
#ifndef Q_WS_MAC
|
||||
if(systrayIcon) {
|
||||
#if defined(Q_WS_X11)
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||
QString html = "<div style='background-color: #678db2; color: #fff;height: 18px; font-weight: bold; margin-bottom: 5px;'>";
|
||||
html += tr("qBittorrent");
|
||||
html += "</div>";
|
||||
|
@ -1031,7 +1028,6 @@ void GUI::updateGUI() {
|
|||
#endif
|
||||
systrayIcon->setToolTip(html); // tray icon
|
||||
}
|
||||
#endif
|
||||
if(displaySpeedInTitle) {
|
||||
setWindowTitle(tr("qBittorrent %1 (Down: %2/s, Up: %3/s)", "%1 is qBittorrent version").arg(QString::fromUtf8(VERSION)).arg(misc::friendlyUnit(BTSession->getSessionStatus().payload_download_rate)).arg(misc::friendlyUnit(BTSession->getSessionStatus().payload_upload_rate)));
|
||||
}
|
||||
|
@ -1051,10 +1047,8 @@ void GUI::showNotificationBaloon(QString title, QString msg) const {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#ifndef Q_WS_MAC
|
||||
if(systrayIcon && QSystemTrayIcon::supportsMessages())
|
||||
systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
|
@ -1091,7 +1085,6 @@ void GUI::downloadFromURLList(const QStringList& url_list) {
|
|||
*****************************************************/
|
||||
|
||||
void GUI::createSystrayDelayed() {
|
||||
#ifndef Q_WS_MAC
|
||||
static int timeout = 20;
|
||||
if(QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||
// Ok, systray integration is now supported
|
||||
|
@ -1112,7 +1105,6 @@ void GUI::createSystrayDelayed() {
|
|||
Preferences::setSystrayIntegration(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GUI::updateAltSpeedsBtn(bool alternative) {
|
||||
|
|
|
@ -151,11 +151,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
// Load options
|
||||
loadOptions();
|
||||
// Disable systray integration if it is not supported by the system
|
||||
#ifdef Q_WS_MAC
|
||||
if(1){
|
||||
#else
|
||||
if(!QSystemTrayIcon::isSystemTrayAvailable()){
|
||||
#endif
|
||||
checkShowSystray->setChecked(false);
|
||||
checkShowSystray->setEnabled(false);
|
||||
}
|
||||
|
@ -278,28 +274,28 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
// Adapt size
|
||||
show();
|
||||
loadWindowState();
|
||||
}
|
||||
}
|
||||
|
||||
// Main destructor
|
||||
options_imp::~options_imp(){
|
||||
// Main destructor
|
||||
options_imp::~options_imp(){
|
||||
qDebug("-> destructing Options");
|
||||
foreach (const QString &path, addedScanDirs)
|
||||
ScanFoldersModel::instance()->removePath(path);
|
||||
delete scrollArea_advanced->layout();
|
||||
delete advancedSettings;
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous) {
|
||||
void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous) {
|
||||
if (!current)
|
||||
current = previous;
|
||||
tabOption->setCurrentIndex(tabSelection->row(current));
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::useStyle() {
|
||||
void options_imp::useStyle() {
|
||||
QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex())));
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::loadWindowState() {
|
||||
void options_imp::loadWindowState() {
|
||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
resize(settings.value(QString::fromUtf8("Preferences/State/size"), sizeFittingScreen()).toSize());
|
||||
QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint();
|
||||
|
@ -317,9 +313,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
sizes << hsplitter->width()-130;
|
||||
}
|
||||
hsplitter->setSizes(sizes);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::saveWindowState() const {
|
||||
void options_imp::saveWindowState() const {
|
||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
settings.setValue(QString::fromUtf8("Preferences/State/size"), size());
|
||||
settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos());
|
||||
|
@ -328,9 +324,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
sizes_str << QString::number(hsplitter->sizes().first());
|
||||
sizes_str << QString::number(hsplitter->sizes().last());
|
||||
settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str);
|
||||
}
|
||||
}
|
||||
|
||||
QSize options_imp::sizeFittingScreen() {
|
||||
QSize options_imp::sizeFittingScreen() {
|
||||
int scrn = 0;
|
||||
QWidget *w = this->topLevelWidget();
|
||||
|
||||
|
@ -347,9 +343,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
return QSize(desk.width(), desk.height());
|
||||
}
|
||||
return size();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::saveOptions(){
|
||||
void options_imp::saveOptions(){
|
||||
applyButton->setEnabled(false);
|
||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
||||
// Apply style
|
||||
|
@ -511,13 +507,13 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
|
||||
// Save advanced settings
|
||||
advancedSettings->saveAdvancedSettings();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isFilteringEnabled() const{
|
||||
bool options_imp::isFilteringEnabled() const{
|
||||
return checkIPFilter->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getPeerProxyType() const{
|
||||
int options_imp::getPeerProxyType() const{
|
||||
switch(comboProxyType->currentIndex()) {
|
||||
case 1:
|
||||
return SOCKS4;
|
||||
|
@ -535,9 +531,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getHTTPProxyType() const {
|
||||
int options_imp::getHTTPProxyType() const {
|
||||
switch(comboProxyType_http->currentIndex()) {
|
||||
case 1: {
|
||||
if(isHTTPProxyAuthEnabled()){
|
||||
|
@ -554,23 +550,23 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
default:
|
||||
return -1; // Disabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getStyle() const{
|
||||
QString options_imp::getStyle() const{
|
||||
return comboStyle->itemText(comboStyle->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::setStyle(QString style) {
|
||||
void options_imp::setStyle(QString style) {
|
||||
int index = comboStyle->findText(style, Qt::MatchFixedString);
|
||||
if(index > 0)
|
||||
comboStyle->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isHTTPProxyAuthEnabled() const{
|
||||
bool options_imp::isHTTPProxyAuthEnabled() const{
|
||||
return checkProxyAuth_http->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::loadOptions(){
|
||||
void options_imp::loadOptions(){
|
||||
int intValue;
|
||||
float floatValue;
|
||||
QString strValue;
|
||||
|
@ -797,68 +793,68 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
// End Web UI
|
||||
// Random stuff
|
||||
srand(time(0));
|
||||
}
|
||||
}
|
||||
|
||||
// return min & max ports
|
||||
// [min, max]
|
||||
int options_imp::getPort() const{
|
||||
// return min & max ports
|
||||
// [min, max]
|
||||
int options_imp::getPort() const{
|
||||
return spinPort->value();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_randomButton_clicked() {
|
||||
void options_imp::on_randomButton_clicked() {
|
||||
// Range [1024: 65535]
|
||||
spinPort->setValue(rand() % 64512 + 1024);
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getEncryptionSetting() const{
|
||||
int options_imp::getEncryptionSetting() const{
|
||||
return comboEncryption->currentIndex();
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getMaxActiveDownloads() const {
|
||||
int options_imp::getMaxActiveDownloads() const {
|
||||
return spinMaxActiveDownloads->value();
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getMaxActiveUploads() const {
|
||||
int options_imp::getMaxActiveUploads() const {
|
||||
return spinMaxActiveUploads->value();
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getMaxActiveTorrents() const {
|
||||
int options_imp::getMaxActiveTorrents() const {
|
||||
return spinMaxActiveTorrents->value();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::minimizeToTray() const{
|
||||
bool options_imp::minimizeToTray() const{
|
||||
if(!checkShowSystray->isChecked()) return false;
|
||||
return checkMinimizeToSysTray->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::closeToTray() const{
|
||||
bool options_imp::closeToTray() const{
|
||||
if(!checkShowSystray->isChecked()) return false;
|
||||
return checkCloseToSystray->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isQueueingSystemEnabled() const {
|
||||
bool options_imp::isQueueingSystemEnabled() const {
|
||||
return checkEnableQueueing->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isDHTEnabled() const{
|
||||
bool options_imp::isDHTEnabled() const{
|
||||
return checkDHT->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isLSDEnabled() const{
|
||||
bool options_imp::isLSDEnabled() const{
|
||||
return checkLSD->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isUPnPEnabled() const{
|
||||
bool options_imp::isUPnPEnabled() const{
|
||||
return checkUPnP->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isNATPMPEnabled() const{
|
||||
bool options_imp::isNATPMPEnabled() const{
|
||||
return checkNATPMP->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
// Return Download & Upload limits in kbps
|
||||
// [download,upload]
|
||||
QPair<int,int> options_imp::getGlobalBandwidthLimits() const{
|
||||
// Return Download & Upload limits in kbps
|
||||
// [download,upload]
|
||||
QPair<int,int> options_imp::getGlobalBandwidthLimits() const{
|
||||
int DL = -1, UP = -1;
|
||||
if(checkDownloadLimit->isChecked()){
|
||||
DL = spinDownloadLimit->value();
|
||||
|
@ -867,35 +863,32 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
UP = spinUploadLimit->value();
|
||||
}
|
||||
return qMakePair(DL, UP);
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::startMinimized() const {
|
||||
bool options_imp::startMinimized() const {
|
||||
if(checkStartMinimized->isChecked()) return true;
|
||||
return checkStartMinimized->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::systrayIntegration() const{
|
||||
#ifdef Q_WS_MAC
|
||||
return false;
|
||||
#endif
|
||||
bool options_imp::systrayIntegration() const{
|
||||
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
|
||||
return checkShowSystray->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getDHTPort() const {
|
||||
int options_imp::getDHTPort() const {
|
||||
return spinDHTPort->value();
|
||||
}
|
||||
}
|
||||
|
||||
// Return Share ratio
|
||||
float options_imp::getMaxRatio() const{
|
||||
// Return Share ratio
|
||||
float options_imp::getMaxRatio() const{
|
||||
if(checkMaxRatio->isChecked()){
|
||||
return spinMaxRatio->value();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Return Save Path
|
||||
QString options_imp::getSavePath() const{
|
||||
// Return Save Path
|
||||
QString options_imp::getSavePath() const{
|
||||
if(textSavePath->text().trimmed().isEmpty()){
|
||||
QString save_path = Preferences::getSavePath();
|
||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||
|
@ -904,42 +897,42 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
textSavePath->setText(save_path);
|
||||
}
|
||||
return misc::expandPath(textSavePath->text());
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getTempPath() const {
|
||||
QString options_imp::getTempPath() const {
|
||||
return misc::expandPath(textTempPath->text());
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isTempPathEnabled() const {
|
||||
bool options_imp::isTempPathEnabled() const {
|
||||
return checkTempFolder->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
// Return max connections number
|
||||
int options_imp::getMaxConnecs() const{
|
||||
// Return max connections number
|
||||
int options_imp::getMaxConnecs() const{
|
||||
if(!checkMaxConnecs->isChecked()){
|
||||
return -1;
|
||||
}else{
|
||||
return spinMaxConnec->value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getMaxConnecsPerTorrent() const{
|
||||
int options_imp::getMaxConnecsPerTorrent() const{
|
||||
if(!checkMaxConnecsPerTorrent->isChecked()){
|
||||
return -1;
|
||||
}else{
|
||||
return spinMaxConnecPerTorrent->value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getMaxUploadsPerTorrent() const{
|
||||
int options_imp::getMaxUploadsPerTorrent() const{
|
||||
if(!checkMaxUploadsPerTorrent->isChecked()){
|
||||
return -1;
|
||||
}else{
|
||||
return spinMaxUploadsPerTorrent->value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_buttonBox_accepted(){
|
||||
void options_imp::on_buttonBox_accepted(){
|
||||
if(applyButton->isEnabled()){
|
||||
saveOptions();
|
||||
applyButton->setEnabled(false);
|
||||
|
@ -948,85 +941,85 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
}
|
||||
saveWindowState();
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::applySettings(QAbstractButton* button) {
|
||||
void options_imp::applySettings(QAbstractButton* button) {
|
||||
if(button == applyButton){
|
||||
saveOptions();
|
||||
emit status_changed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::closeEvent(QCloseEvent *e){
|
||||
void options_imp::closeEvent(QCloseEvent *e){
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
e->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_buttonBox_rejected(){
|
||||
void options_imp::on_buttonBox_rejected(){
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
reject();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableDownloadLimit(bool checked){
|
||||
void options_imp::enableDownloadLimit(bool checked){
|
||||
if(checked){
|
||||
spinDownloadLimit->setEnabled(true);
|
||||
}else{
|
||||
spinDownloadLimit->setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::useAdditionDialog() const{
|
||||
bool options_imp::useAdditionDialog() const{
|
||||
return checkAdditionDialog->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableMaxConnecsLimit(bool checked){
|
||||
void options_imp::enableMaxConnecsLimit(bool checked){
|
||||
spinMaxConnec->setEnabled(checked);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){
|
||||
void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){
|
||||
spinMaxConnecPerTorrent->setEnabled(checked);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableSystrayOptions() {
|
||||
void options_imp::enableSystrayOptions() {
|
||||
checkCloseToSystray->setEnabled(true);
|
||||
checkMinimizeToSysTray->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::disableSystrayOptions() {
|
||||
void options_imp::disableSystrayOptions() {
|
||||
checkCloseToSystray->setEnabled(false);
|
||||
checkMinimizeToSysTray->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::setSystrayOptionsState(bool checked) {
|
||||
void options_imp::setSystrayOptionsState(bool checked) {
|
||||
if(checked) {
|
||||
enableSystrayOptions();
|
||||
} else {
|
||||
disableSystrayOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableMaxUploadsLimitPerTorrent(bool checked){
|
||||
void options_imp::enableMaxUploadsLimitPerTorrent(bool checked){
|
||||
if(checked){
|
||||
spinMaxUploadsPerTorrent->setEnabled(true);
|
||||
}else{
|
||||
spinMaxUploadsPerTorrent->setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableUploadLimit(bool checked){
|
||||
void options_imp::enableUploadLimit(bool checked){
|
||||
spinUploadLimit->setEnabled(checked);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableApplyButton(){
|
||||
void options_imp::enableApplyButton(){
|
||||
applyButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableMaxRatio(bool checked){
|
||||
void options_imp::enableMaxRatio(bool checked){
|
||||
spinMaxRatio->setEnabled(checked);
|
||||
comboRatioLimitAct->setEnabled(checked);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enablePeerProxy(int index){
|
||||
void options_imp::enablePeerProxy(int index){
|
||||
if(index){
|
||||
//enable
|
||||
lblProxyIP->setEnabled(true);
|
||||
|
@ -1048,9 +1041,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
checkProxyAuth->setEnabled(false);
|
||||
checkProxyAuth->setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableHTTPProxy(int index){
|
||||
void options_imp::enableHTTPProxy(int index){
|
||||
bool enable = (index > 0);
|
||||
lblProxyIP_http->setEnabled(enable);
|
||||
textProxyIP_http->setEnabled(enable);
|
||||
|
@ -1060,130 +1053,130 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
|
||||
if(!enable)
|
||||
checkProxyAuth_http->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enablePeerProxyAuth(bool checked){
|
||||
void options_imp::enablePeerProxyAuth(bool checked){
|
||||
lblProxyUsername->setEnabled(checked);
|
||||
lblProxyPassword->setEnabled(checked);
|
||||
textProxyUsername->setEnabled(checked);
|
||||
textProxyPassword->setEnabled(checked);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableHTTPProxyAuth(bool checked){
|
||||
void options_imp::enableHTTPProxyAuth(bool checked){
|
||||
lblProxyUsername_http->setEnabled(checked);
|
||||
lblProxyPassword_http->setEnabled(checked);
|
||||
textProxyUsername_http->setEnabled(checked);
|
||||
textProxyPassword_http->setEnabled(checked);
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isSlashScreenDisabled() const {
|
||||
bool options_imp::isSlashScreenDisabled() const {
|
||||
return !checkShowSplash->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::preAllocateAllFiles() const {
|
||||
bool options_imp::preAllocateAllFiles() const {
|
||||
return checkPreallocateAll->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::addTorrentsInPause() const {
|
||||
bool options_imp::addTorrentsInPause() const {
|
||||
return checkStartPaused->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isDHTPortSameAsBT() const {
|
||||
bool options_imp::isDHTPortSameAsBT() const {
|
||||
return !checkDifferentDHTPort->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
// Proxy settings
|
||||
bool options_imp::isPeerProxyEnabled() const{
|
||||
// Proxy settings
|
||||
bool options_imp::isPeerProxyEnabled() const{
|
||||
return comboProxyType->currentIndex();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isHTTPProxyEnabled() const {
|
||||
bool options_imp::isHTTPProxyEnabled() const {
|
||||
return comboProxyType_http->currentIndex();
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isPeerProxyAuthEnabled() const{
|
||||
bool options_imp::isPeerProxyAuthEnabled() const{
|
||||
return checkProxyAuth->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getPeerProxyIp() const{
|
||||
QString options_imp::getPeerProxyIp() const{
|
||||
QString ip = textProxyIP->text();
|
||||
ip = ip.trimmed();
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getHTTPProxyIp() const{
|
||||
QString options_imp::getHTTPProxyIp() const{
|
||||
QString ip = textProxyIP_http->text();
|
||||
ip = ip.trimmed();
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short options_imp::getPeerProxyPort() const{
|
||||
unsigned short options_imp::getPeerProxyPort() const{
|
||||
return spinProxyPort->value();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short options_imp::getHTTPProxyPort() const{
|
||||
unsigned short options_imp::getHTTPProxyPort() const{
|
||||
return spinProxyPort_http->value();
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getPeerProxyUsername() const{
|
||||
QString options_imp::getPeerProxyUsername() const{
|
||||
QString username = textProxyUsername->text();
|
||||
username = username.trimmed();
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getHTTPProxyUsername() const{
|
||||
QString options_imp::getHTTPProxyUsername() const{
|
||||
QString username = textProxyUsername_http->text();
|
||||
username = username.trimmed();
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getPeerProxyPassword() const{
|
||||
QString options_imp::getPeerProxyPassword() const{
|
||||
QString password = textProxyPassword->text();
|
||||
password = password.trimmed();
|
||||
return password;
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getHTTPProxyPassword() const{
|
||||
QString options_imp::getHTTPProxyPassword() const{
|
||||
QString password = textProxyPassword_http->text();
|
||||
password = password.trimmed();
|
||||
return password;
|
||||
}
|
||||
}
|
||||
|
||||
// Locale Settings
|
||||
QString options_imp::getLocale() const{
|
||||
// Locale Settings
|
||||
QString options_imp::getLocale() const{
|
||||
return locales.at(comboI18n->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::setLocale(QString locale){
|
||||
void options_imp::setLocale(QString locale){
|
||||
int indexLocales=locales.indexOf(QRegExp(locale));
|
||||
if(indexLocales != -1){
|
||||
comboI18n->setCurrentIndex(indexLocales);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getExportDir() const {
|
||||
QString options_imp::getExportDir() const {
|
||||
if(checkExportDir->isChecked()){
|
||||
return misc::expandPath(textExportDir->text());
|
||||
}else{
|
||||
return QString::null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return action on double-click on a downloading torrent set in options
|
||||
int options_imp::getActionOnDblClOnTorrentDl() const {
|
||||
// Return action on double-click on a downloading torrent set in options
|
||||
int options_imp::getActionOnDblClOnTorrentDl() const {
|
||||
if(actionTorrentDlOnDblClBox->currentIndex()<1)
|
||||
return 0;
|
||||
return actionTorrentDlOnDblClBox->currentIndex();
|
||||
}
|
||||
}
|
||||
|
||||
// Return action on double-click on a finished torrent set in options
|
||||
int options_imp::getActionOnDblClOnTorrentFn() const {
|
||||
// Return action on double-click on a finished torrent set in options
|
||||
int options_imp::getActionOnDblClOnTorrentFn() const {
|
||||
if(actionTorrentFnOnDblClBox->currentIndex()<1)
|
||||
return 0;
|
||||
return actionTorrentFnOnDblClBox->currentIndex();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_addScanFolderButton_clicked() {
|
||||
void options_imp::on_addScanFolderButton_clicked() {
|
||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Add directory to scan"));
|
||||
if (!dir.isEmpty()) {
|
||||
const ScanFoldersModel::PathStatus status = ScanFoldersModel::instance()->addPath(dir, false);
|
||||
|
@ -1207,22 +1200,22 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
QMessageBox::warning(this, tr("Failure"), tr("Failed to add Scan Folder '%1': %2").arg(dir).arg(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_removeScanFolderButton_clicked() {
|
||||
void options_imp::on_removeScanFolderButton_clicked() {
|
||||
const QModelIndexList selected
|
||||
= scanFoldersView->selectionModel()->selectedIndexes();
|
||||
if (selected.isEmpty())
|
||||
return;
|
||||
Q_ASSERT(selected.count() == ScanFoldersModel::instance()->columnCount());
|
||||
ScanFoldersModel::instance()->removePath(selected.first().row());
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::handleScanFolderViewSelectionChanged() {
|
||||
void options_imp::handleScanFolderViewSelectionChanged() {
|
||||
removeScanFolderButton->setEnabled(!scanFoldersView->selectionModel()->selectedIndexes().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_browseExportDirButton_clicked() {
|
||||
void options_imp::on_browseExportDirButton_clicked() {
|
||||
QString export_path = misc::expandPath(textExportDir->text());
|
||||
QDir exportDir(export_path);
|
||||
QString dir;
|
||||
|
@ -1237,9 +1230,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
#endif
|
||||
textExportDir->setText(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_browseFilterButton_clicked() {
|
||||
void options_imp::on_browseFilterButton_clicked() {
|
||||
QString filter_path = misc::expandPath(textFilterPath->text());
|
||||
QDir filterDir(filter_path);
|
||||
QString ipfilter;
|
||||
|
@ -1254,10 +1247,10 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
#endif
|
||||
textFilterPath->setText(ipfilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Display dialog to choose save dir
|
||||
void options_imp::on_browseSaveDirButton_clicked(){
|
||||
// Display dialog to choose save dir
|
||||
void options_imp::on_browseSaveDirButton_clicked(){
|
||||
QString save_path = misc::expandPath(textSavePath->text());
|
||||
QDir saveDir(save_path);
|
||||
QString dir;
|
||||
|
@ -1272,9 +1265,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
#endif
|
||||
textSavePath->setText(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_browseTempDirButton_clicked(){
|
||||
void options_imp::on_browseTempDirButton_clicked(){
|
||||
QString temp_path = misc::expandPath(textTempPath->text());
|
||||
QDir tempDir(temp_path);
|
||||
QString dir;
|
||||
|
@ -1289,31 +1282,31 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
#endif
|
||||
textTempPath->setText(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return Filter object to apply to BT session
|
||||
QString options_imp::getFilter() const{
|
||||
// Return Filter object to apply to BT session
|
||||
QString options_imp::getFilter() const{
|
||||
return textFilterPath->text();
|
||||
}
|
||||
}
|
||||
|
||||
// Web UI
|
||||
// Web UI
|
||||
|
||||
bool options_imp::isWebUiEnabled() const
|
||||
{
|
||||
bool options_imp::isWebUiEnabled() const
|
||||
{
|
||||
return checkWebUi->isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
quint16 options_imp::webUiPort() const
|
||||
{
|
||||
quint16 options_imp::webUiPort() const
|
||||
{
|
||||
return spinWebUiPort->value();
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::webUiUsername() const
|
||||
{
|
||||
QString options_imp::webUiUsername() const
|
||||
{
|
||||
return textWebUiUsername->text();
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::webUiPassword() const
|
||||
{
|
||||
QString options_imp::webUiPassword() const
|
||||
{
|
||||
return textWebUiPassword->text();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue