@ -42,22 +42,24 @@
# include <QCloseEvent>
# include <QCloseEvent>
# include <QDesktopWidget>
# include <QDesktopWidget>
# ifdef Q_WS_WIN
# ifdef Q_WS_WIN
# include <QWindowsXPStyle>
# include <QWindowsXPStyle>
# endif
# endif
# ifdef Q_WS_MAC
# ifdef Q_WS_MAC
# include <QMacStyle>
# include <QMacStyle>
# endif
# endif
# include <time.h>
# include <time.h>
# include <stdlib.h>
# include <stdlib.h>
# include "options_imp.h"
# include "options_imp.h"
# include "preferences.h"
# include "misc.h"
# include "misc.h"
// Constructor
// Constructor
options_imp : : options_imp ( QWidget * parent ) : QDialog ( parent ) {
options_imp : : options_imp ( QWidget * parent ) : QDialog ( parent ) {
qDebug ( " -> Constructing Options " ) ;
qDebug ( " -> Constructing Options " ) ;
setAttribute ( Qt : : WA_DeleteOnClose ) ;
QString savePath ;
QString savePath ;
setupUi ( this ) ;
setupUi ( this ) ;
// Get apply button in button box
// Get apply button in button box
@ -140,32 +142,32 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
}
}
// Connect signals / slots
// Connect signals / slots
// General tab
// General tab
connect ( checkNoSystray , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( setSystrayOptionsState ( int ) ) ) ;
connect ( checkNoSystray , SIGNAL ( toggled ( bool ) ) , this , SLOT ( setSystrayOptionsState ( bool ) ) ) ;
// Downloads tab
// Downloads tab
connect ( checkTempFolder , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableTempPathInput ( int ) ) ) ;
connect ( checkTempFolder , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableTempPathInput ( bool ) ) ) ;
connect ( checkScanDir , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableDirScan ( int ) ) ) ;
connect ( checkScanDir , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableDirScan ( bool ) ) ) ;
connect ( actionTorrentDlOnDblClBox , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( actionTorrentDlOnDblClBox , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( actionTorrentFnOnDblClBox , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( actionTorrentFnOnDblClBox , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkTempFolder , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkTempFolder , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
// Connection tab
// Connection tab
connect ( checkUploadLimit , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableUploadLimit ( int ) ) ) ;
connect ( checkUploadLimit , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableUploadLimit ( bool ) ) ) ;
connect ( checkDownloadLimit , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableDownloadLimit ( int ) ) ) ;
connect ( checkDownloadLimit , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableDownloadLimit ( bool ) ) ) ;
// Bittorrent tab
// Bittorrent tab
connect ( checkMaxConnecs , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableMaxConnecsLimit ( int ) ) ) ;
connect ( checkMaxConnecs , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableMaxConnecsLimit ( bool ) ) ) ;
connect ( checkMaxConnecsPerTorrent , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableMaxConnecsLimitPerTorrent ( int ) ) ) ;
connect ( checkMaxConnecsPerTorrent , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableMaxConnecsLimitPerTorrent ( bool ) ) ) ;
connect ( checkMaxUploadsPerTorrent , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableMaxUploadsLimitPerTorrent ( int ) ) ) ;
connect ( checkMaxUploadsPerTorrent , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableMaxUploadsLimitPerTorrent ( bool ) ) ) ;
connect ( checkRatioLimit , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableShareRatio ( int ) ) ) ;
connect ( checkRatioLimit , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableShareRatio ( bool ) ) ) ;
connect ( checkRatioRemove , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableDeleteRatio ( int ) ) ) ;
connect ( checkRatioRemove , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableDeleteRatio ( bool ) ) ) ;
connect ( checkSameDHTPort , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableDHTPortSettings ( int ) ) ) ;
connect ( checkSameDHTPort , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableDHTPortSettings ( bool ) ) ) ;
// Proxy tab
// Proxy tab
connect ( comboProxyType_http , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableProxyHTTP ( int ) ) ) ;
connect ( comboProxyType_http , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableProxyHTTP ( int ) ) ) ;
connect ( checkProxyAuth_http , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableProxyAuthHTTP ( int ) ) ) ;
connect ( checkProxyAuth_http , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableProxyAuthHTTP ( bool ) ) ) ;
connect ( comboProxyType , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableProxy ( int ) ) ) ;
connect ( comboProxyType , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableProxy ( int ) ) ) ;
connect ( checkProxyAuth , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableProxyAuth ( int ) ) ) ;
connect ( checkProxyAuth , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableProxyAuth ( bool ) ) ) ;
// Misc tab
// Misc tab
connect ( checkIPFilter , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableFilter ( int ) ) ) ;
connect ( checkIPFilter , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableFilter ( bool ) ) ) ;
connect ( checkEnableRSS , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableRSS ( int ) ) ) ;
connect ( checkEnableRSS , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableRSS ( bool ) ) ) ;
connect ( checkEnableQueueing , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableQueueingSystem ( int ) ) ) ;
connect ( checkEnableQueueing , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableQueueingSystem ( bool ) ) ) ;
// Web UI tab
// Web UI tab
connect ( checkWebUi , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableWebUi ( bool ) ) ) ;
connect ( checkWebUi , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableWebUi ( bool ) ) ) ;
@ -173,72 +175,74 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// General tab
// General tab
connect ( comboI18n , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( comboI18n , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( comboStyle , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( comboStyle , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkConfirmExit , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkConfirmExit , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkSpeedInTitle , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkSpeedInTitle , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinRefreshInterval , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinRefreshInterval , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkNoSystray , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkNoSystray , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkCloseToSystray , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkCloseToSystray , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkMinimizeToSysTray , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkMinimizeToSysTray , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkStartMinimized , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkStartMinimized , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkSystrayBalloons , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkSystrayBalloons , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkDisplayToolbar , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkDisplayToolbar , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkNoSplash , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkNoSplash , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
// Downloads tab
// Downloads tab
connect ( textSavePath , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textSavePath , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkPreallocateAll , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkPreallocateAll , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkAdditionDialog , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkAdditionDialog , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkStartPaused , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkStartPaused , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkScanDir , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkScanDir , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textScanDir , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textScanDir , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
// Connection tab
// Connection tab
connect ( spinPort , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinPort , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkUPnP , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkUPnP , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkNATPMP , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkNATPMP , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkUploadLimit , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkUploadLimit , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkDownloadLimit , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkDownloadLimit , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinUploadLimit , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinUploadLimit , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinDownloadLimit , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinDownloadLimit , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkResolveCountries , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkResolveHosts , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
// Bittorrent tab
// Bittorrent tab
connect ( checkMaxConnecs , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkMaxConnecs , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkMaxConnecsPerTorrent , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkMaxConnecsPerTorrent , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkMaxUploadsPerTorrent , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkMaxUploadsPerTorrent , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxConnec , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxConnec , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxConnecPerTorrent , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxConnecPerTorrent , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxUploadsPerTorrent , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxUploadsPerTorrent , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkDHT , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkDHT , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkSameDHTPort , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkSameDHTPort , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinDHTPort , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinDHTPort , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkLSD , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkLSD , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkAzureusSpoof , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkAzureusSpoof , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( comboEncryption , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( comboEncryption , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkRatioLimit , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkRatioLimit , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkRatioRemove , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkRatioRemove , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinRatio , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinRatio , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxRatio , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxRatio , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
// Proxy tab
// Proxy tab
connect ( comboProxyType_http , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( comboProxyType_http , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyIP_http , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyIP_http , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinProxyPort_http , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinProxyPort_http , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyAuth_http , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyAuth_http , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyUsername_http , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyUsername_http , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyPassword_http , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyPassword_http , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( comboProxyType , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( comboProxyType , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyIP , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyIP , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinProxyPort , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinProxyPort , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyAuth , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyAuth , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyUsername , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyUsername , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyPassword , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textProxyPassword , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyTrackers , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyTrackers , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyPeers , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyPeers , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyWebseeds , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyWebseeds , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyDHT , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkProxyDHT , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
// Misc tab
// Misc tab
connect ( checkIPFilter , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkIPFilter , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textFilterPath , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( textFilterPath , SIGNAL ( textChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinRSSRefresh , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinRSSRefresh , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinRSSMaxArticlesPerFeed , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinRSSMaxArticlesPerFeed , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkEnableRSS , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkEnableRSS , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkEnableQueueing , SIGNAL ( stateChanged ( int ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( checkEnableQueueing , SIGNAL ( toggled ( bool ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxActiveDownloads , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxActiveDownloads , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxActiveUploads , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxActiveUploads , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxActiveTorrents , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
connect ( spinMaxActiveTorrents , SIGNAL ( valueChanged ( QString ) ) , this , SLOT ( enableApplyButton ( ) ) ) ;
@ -258,6 +262,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect ( tabSelection , SIGNAL ( currentItemChanged ( QListWidgetItem * , QListWidgetItem * ) ) , this , SLOT ( changePage ( QListWidgetItem * , QListWidgetItem * ) ) ) ;
connect ( tabSelection , SIGNAL ( currentItemChanged ( QListWidgetItem * , QListWidgetItem * ) ) , this , SLOT ( changePage ( QListWidgetItem * , QListWidgetItem * ) ) ) ;
// Adapt size
// Adapt size
adaptToScreenSize ( ) ;
adaptToScreenSize ( ) ;
show ( ) ;
}
}
// Main destructor
// Main destructor
@ -269,7 +274,7 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
if ( ! current )
if ( ! current )
current = previous ;
current = previous ;
tabOption - > setCurrentIndex ( tabSelection - > row ( current ) ) ;
tabOption - > setCurrentIndex ( tabSelection - > row ( current ) ) ;
}
}
void options_imp : : useStyle ( ) {
void options_imp : : useStyle ( ) {
int style = getStyle ( ) ;
int style = getStyle ( ) ;
@ -403,7 +408,7 @@ void options_imp::saveOptions(){
settings . setValue ( QString : : fromUtf8 ( " sameDHTPortAsBT " ) , isDHTPortSameAsBT ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " sameDHTPortAsBT " ) , isDHTPortSameAsBT ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " DHTPort " ) , getDHTPort ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " DHTPort " ) , getDHTPort ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " LSD " ) , isLSDEnabled ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " LSD " ) , isLSDEnabled ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " Azureus Spoof" ) , shouldSpoofAzureus ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " utorrent Spoof" ) , isUtorrentSpoofingEnabled ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " Encryption " ) , getEncryptionSetting ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " Encryption " ) , getEncryptionSetting ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " DesiredRatio " ) , getDesiredRatio ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " DesiredRatio " ) , getDesiredRatio ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " MaxRatio " ) , getDeleteRatio ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " MaxRatio " ) , getDeleteRatio ( ) ) ;
@ -448,7 +453,7 @@ void options_imp::saveOptions(){
settings . endGroup ( ) ;
settings . endGroup ( ) ;
}
}
bool options_imp : : shouldSpoofAzureus ( ) const {
bool options_imp : : isUtorrentSpoofingEnabled ( ) const {
return checkAzureusSpoof - > isChecked ( ) ;
return checkAzureusSpoof - > isChecked ( ) ;
}
}
@ -512,83 +517,72 @@ void options_imp::setStyle(int style){
comboStyle - > setCurrentIndex ( style ) ;
comboStyle - > setCurrentIndex ( style ) ;
}
}
bool options_imp : : isHTTPProxyAuthEnabled ( ) const {
return checkProxyAuth_http - > isChecked ( ) ;
}
void options_imp : : loadOptions ( ) {
void options_imp : : loadOptions ( ) {
int intValue ;
int intValue ;
float floatValue ;
float floatValue ;
QString strValue ;
QString strValue ;
QSettings settings ( " qBittorrent " , " qBittorrent " ) ;
settings . beginGroup ( " Preferences " ) ;
// General preferences
// General preferences
settings . beginGroup ( " General " ) ;
setLocale ( Preferences : : getLocale ( ) ) ;
setLocale ( settings . value ( QString : : fromUtf8 ( " Locale " ) , " en_GB " ) . toString ( ) ) ;
setStyle ( Preferences : : getStyle ( ) ) ;
setStyle ( settings . value ( QString : : fromUtf8 ( " Style " ) , 0 ) . toInt ( ) ) ;
checkConfirmExit - > setChecked ( Preferences : : confirmOnExit ( ) ) ;
checkConfirmExit - > setChecked ( settings . value ( QString : : fromUtf8 ( " ExitConfirm " ) , true ) . toBool ( ) ) ;
checkSpeedInTitle - > setChecked ( Preferences : : speedInTitleBar ( ) ) ;
checkSpeedInTitle - > setChecked ( settings . value ( QString : : fromUtf8 ( " SpeedInTitleBar " ) , false ) . toBool ( ) ) ;
spinRefreshInterval - > setValue ( Preferences : : getRefreshInterval ( ) ) ;
spinRefreshInterval - > setValue ( settings . value ( QString : : fromUtf8 ( " RefreshInterval " ) , 1500 ) . toInt ( ) ) ;
checkNoSystray - > setChecked ( ! Preferences : : systrayIntegration ( ) ) ;
checkNoSystray - > setChecked ( ! settings . value ( QString : : fromUtf8 ( " SystrayEnabled " ) , true ) . toBool ( ) ) ;
checkDisplayToolbar - > setChecked ( Preferences : : isToolbarDisplayed ( ) ) ;
checkDisplayToolbar - > setChecked ( settings . value ( QString : : fromUtf8 ( " ToolbarDisplayed " ) , true ) . toBool ( ) ) ;
checkNoSplash - > setChecked ( Preferences : : isSlashScreenDisabled ( ) ) ;
checkNoSplash - > setChecked ( settings . value ( QString : : fromUtf8 ( " NoSplashScreen " ) , false ) . toBool ( ) ) ;
if ( checkNoSystray - > isChecked ( ) ) {
if ( ! systrayIntegration ( ) ) {
disableSystrayOptions ( ) ;
disableSystrayOptions ( ) ;
} else {
} else {
enableSystrayOptions ( ) ;
enableSystrayOptions ( ) ;
checkCloseToSystray - > setChecked ( settings . value ( QString : : fromUtf8 ( " Cl oseToTray" ) , false ) . toBool ( ) ) ;
checkCloseToSystray - > setChecked ( Preferences : : cl oseToTray( ) ) ;
checkMinimizeToSysTray - > setChecked ( settings . value ( QString : : fro mUtf8 ( " M inimizeToTray" ) , false ) . toBool ( ) ) ;
checkMinimizeToSysTray - > setChecked ( Preferences : : minimizeToTray ( ) ) ;
checkStartMinimized - > setChecked ( settings . value ( QString : : fromUtf8 ( " S tartMinimized" ) , false ) . toBool ( ) ) ;
checkStartMinimized - > setChecked ( Preferences : : s tartMinimized( ) ) ;
checkSystrayBalloons - > setChecked ( settings . value ( QString : : fromUtf8 ( " NotificationBaloons " ) , true ) . toBool ( ) ) ;
checkSystrayBalloons - > setChecked ( Preferences : : OSDEnabled ( ) ) ;
}
}
// End General preferences
// End General preferences
settings . endGroup ( ) ;
// Downloads preferences
// Downloads preferences
settings . beginGroup ( " Downloads " ) ;
textSavePath - > setText ( Preferences : : getSavePath ( ) ) ;
# ifdef Q_WS_WIN
if ( Preferences : : isTempPathEnabled ( ) ) {
QString home = QDir : : rootPath ( ) ;
# else
QString home = QDir : : homePath ( ) ;
# endif
if ( home [ home . length ( ) - 1 ] ! = QDir : : separator ( ) ) {
home + = QDir : : separator ( ) ;
}
textSavePath - > setText ( settings . value ( QString : : fromUtf8 ( " SavePath " ) , home + " qBT_dir " ) . toString ( ) ) ;
if ( settings . value ( QString : : fromUtf8 ( " TempPathEnabled " ) , false ) . toBool ( ) ) {
// enable
// enable
checkTempFolder - > setChecked ( true ) ;
checkTempFolder - > setChecked ( true ) ;
enableTempPathInput ( 2 ) ;
enableTempPathInput ( checkTempFolder - > isChecked ( ) ) ;
} else {
} else {
checkTempFolder - > setChecked ( false ) ;
checkTempFolder - > setChecked ( false ) ;
enableTempPathInput ( 0 ) ;
enableTempPathInput ( checkTempFolder - > isChecked ( ) ) ;
}
}
textTempPath - > setText ( settings . value ( QString : : fromUtf8 ( " TempPath " ) , home + " qBT_dir " + QDir : : separator ( ) + " temp " ) . toString ( ) ) ;
textTempPath - > setText ( Preferences : : getTempPath ( ) ) ;
checkPreallocateAll - > setChecked ( settings . value ( QString : : fromUtf8 ( " PreAllocation " ) , false ) . toBool ( ) ) ;
checkPreallocateAll - > setChecked ( Preferences : : preAllocateAllFiles ( ) ) ;
checkAdditionDialog - > setChecked ( settings . value ( QString : : fromUtf8 ( " AdditionDialog " ) , true ) . toBool ( ) ) ;
checkAdditionDialog - > setChecked ( Preferences : : useAdditionDialog ( ) ) ;
checkStartPaused - > setChecked ( settings . value ( QString : : fromUtf8 ( " StartInPause " ) , false ) . toBool ( ) ) ;
checkStartPaused - > setChecked ( Preferences : : addTorrentsInPause ( ) ) ;
strValue = settings . value ( QString : : fromUtf8 ( " ScanDir " ) , QString ( ) ) . toString ( ) ;
strValue = Preferences : : getSavePath ( ) ;
if ( strValue . isEmpty ( ) ) {
if ( strValue . isEmpty ( ) ) {
// Disable
// Disable
checkScanDir - > setChecked ( false ) ;
checkScanDir - > setChecked ( false ) ;
enableDirScan ( 0 ) ;
enableDirScan ( checkScanDir - > isChecked ( ) ) ;
} else {
} else {
// enable
// enable
checkScanDir - > setChecked ( true ) ;
checkScanDir - > setChecked ( true ) ;
textScanDir - > setText ( strValue ) ;
textScanDir - > setText ( strValue ) ;
enableDirScan ( 2 ) ;
enableDirScan ( checkScanDir - > isChecked ( ) ) ;
}
}
intValue = settings . value ( QString : : fromUtf8 ( " DblClOnTorDl " ) , 0 ) . toInt ( ) ;
intValue = Preferences : : getActionOnDblClOnTorrentDl ( ) ;
if ( intValue > = actionTorrentDlOnDblClBox - > count ( ) )
if ( intValue > = actionTorrentDlOnDblClBox - > count ( ) )
intValue = 0 ;
intValue = 0 ;
actionTorrentDlOnDblClBox - > setCurrentIndex ( intValue ) ;
actionTorrentDlOnDblClBox - > setCurrentIndex ( intValue ) ;
intValue = settings . value ( QString : : fromUtf8 ( " DblClOnTorFn " ) , 1 ) . toInt ( ) ;
intValue = Preferences : : getActionOnDblClOnTorrentFn ( ) ;
if ( intValue > = actionTorrentFnOnDblClBox - > count ( ) )
if ( intValue > = actionTorrentFnOnDblClBox - > count ( ) )
intValue = 1 ;
intValue = 1 ;
actionTorrentFnOnDblClBox - > setCurrentIndex ( intValue ) ;
actionTorrentFnOnDblClBox - > setCurrentIndex ( intValue ) ;
// End Downloads preferences
// End Downloads preferences
settings . endGroup ( ) ;
// Connection preferences
// Connection preferences
settings . beginGroup ( " Connection " ) ;
spinPort - > setValue ( Preferences : : getSessionPort ( ) ) ;
spinPort - > setValue ( settings . value ( QString : : fromUtf8 ( " PortRangeMin " ) , 6881 ) . toInt ( ) ) ;
checkUPnP - > setChecked ( Preferences : : isUPnPEnabled ( ) ) ;
checkUPnP - > setChecked ( settings . value ( QString : : fromUtf8 ( " UPnP " ) , true ) . toBool ( ) ) ;
checkNATPMP - > setChecked ( Preferences : : isNATPMPEnabled ( ) ) ;
checkNATPMP - > setChecked ( settings . value ( QString : : fromUtf8 ( " NAT-PMP " ) , true ) . toBool ( ) ) ;
intValue = Preferences : : getGlobalDownloadLimit ( ) ;
intValue = settings . value ( QString : : fromUtf8 ( " GlobalDLLimit " ) , - 1 ) . toInt ( ) ;
if ( intValue > 0 ) {
if ( intValue > 0 ) {
// Enabled
// Enabled
checkDownloadLimit - > setChecked ( true ) ;
checkDownloadLimit - > setChecked ( true ) ;
@ -599,7 +593,7 @@ void options_imp::loadOptions(){
checkDownloadLimit - > setChecked ( false ) ;
checkDownloadLimit - > setChecked ( false ) ;
spinDownloadLimit - > setEnabled ( false ) ;
spinDownloadLimit - > setEnabled ( false ) ;
}
}
intValue = settings . value ( QString : : fromUtf8 ( " GlobalUPLimit " ) , 50 ) . toIn t( ) ;
intValue = Preferences : : getGlobalUploadLimi t( ) ;
if ( intValue ! = - 1 ) {
if ( intValue ! = - 1 ) {
// Enabled
// Enabled
checkUploadLimit - > setChecked ( true ) ;
checkUploadLimit - > setChecked ( true ) ;
@ -610,7 +604,7 @@ void options_imp::loadOptions(){
checkUploadLimit - > setChecked ( false ) ;
checkUploadLimit - > setChecked ( false ) ;
spinUploadLimit - > setEnabled ( false ) ;
spinUploadLimit - > setEnabled ( false ) ;
}
}
intValue = settings . value ( QString : : fromUtf8 ( " ProxyType " ) , 0 ) . toInt ( ) ;
intValue = Preferences : : getProxyType ( ) ;
if ( intValue < = 0 ) {
if ( intValue < = 0 ) {
intValue = 0 ;
intValue = 0 ;
} else {
} else {
@ -623,27 +617,20 @@ void options_imp::loadOptions(){
comboProxyType - > setCurrentIndex ( intValue ) ;
comboProxyType - > setCurrentIndex ( intValue ) ;
enableProxy ( intValue ) ;
enableProxy ( intValue ) ;
//if(isProxyEnabled()) {
//if(isProxyEnabled()) {
settings . beginGroup ( " Proxy " ) ;
// Proxy is enabled, save settings
// Proxy is enabled, save settings
textProxyIP - > setText ( settings . value ( QString : : fromUtf8 ( " IP " ) , " 0.0.0.0 " ) . toString ( ) ) ;
textProxyIP - > setText ( Preferences : : getProxyIp ( ) ) ;
spinProxyPort - > setValue ( settings . value ( QString : : fromUtf8 ( " Port " ) , 8080 ) . toInt ( ) ) ;
spinProxyPort - > setValue ( Preferences : : getProxyPort ( ) ) ;
checkProxyAuth - > setChecked ( settings . value ( QString : : fromUtf8 ( " Authentication " ) , false ) . toBool ( ) ) ;
checkProxyAuth - > setChecked ( Preferences : : isProxyAuthEnabled ( ) ) ;
textProxyUsername - > setText ( settings . value ( QString : : fromUtf8 ( " Username " ) , QString ( ) ) . toString ( ) ) ;
textProxyUsername - > setText ( Preferences : : getProxyUsername ( ) ) ;
textProxyPassword - > setText ( settings . value ( QString : : fromUtf8 ( " Password " ) , QString ( ) ) . toString ( ) ) ;
textProxyPassword - > setText ( Preferences : : getProxyPassword ( ) ) ;
if ( isProxyAuthEnabled ( ) ) {
enableProxyAuth ( checkProxyAuth - > isChecked ( ) ) ;
enableProxyAuth ( 2 ) ; // Enable
// Credentials
} else {
enableProxyAuth ( 0 ) ; // Disable
}
// Affected connections
// Affected connections
checkProxyTrackers - > setChecked ( settings . value ( QString : : fromUtf8 ( " AffectTrackers " ) , true ) . toBool ( ) ) ;
checkProxyTrackers - > setChecked ( Preferences : : useProxyForTrackers ( ) ) ;
checkProxyPeers - > setChecked ( settings . value ( QString : : fromUtf8 ( " AffectPeers " ) , true ) . toBool ( ) ) ;
checkProxyPeers - > setChecked ( Preferences : : useProxyForPeers ( ) ) ;
checkProxyWebseeds - > setChecked ( settings . value ( QString : : fromUtf8 ( " AffectWebSeeds " ) , true ) . toBool ( ) ) ;
checkProxyWebseeds - > setChecked ( Preferences : : useProxyForWebseeds ( ) ) ;
checkProxyDHT - > setChecked ( settings . value ( QString : : fromUtf8 ( " AffectDHT " ) , true ) . toBool ( ) ) ;
checkProxyDHT - > setChecked ( Preferences : : useProxyForDHT ( ) ) ;
settings . endGroup ( ) ; // End Proxy
//}
//}
intValue = settings . value ( QString : : fromUtf8 ( " HTTPProxyType " ) , 0 ) . toInt ( ) ;
intValue = Preferences : : getHTTPProxyType ( ) ;
if ( intValue < = 0 ) {
if ( intValue < = 0 ) {
intValue = 0 ;
intValue = 0 ;
} else {
} else {
@ -651,28 +638,17 @@ void options_imp::loadOptions(){
}
}
comboProxyType_http - > setCurrentIndex ( intValue ) ;
comboProxyType_http - > setCurrentIndex ( intValue ) ;
enableProxyHTTP ( intValue ) ;
enableProxyHTTP ( intValue ) ;
settings . beginGroup ( " HTTPProxy " ) ;
textProxyUsername_http - > setText ( Preferences : : getHTTPProxyUsername ( ) ) ;
textProxyUsername_http - > setText ( settings . value ( QString : : fromUtf8 ( " Username " ) , QString ( ) ) . toString ( ) ) ;
textProxyPassword_http - > setText ( Preferences : : getHTTPProxyPassword ( ) ) ;
textProxyPassword_http - > setText ( settings . value ( QString : : fromUtf8 ( " Password " ) , QString ( ) ) . toString ( ) ) ;
textProxyIP_http - > setText ( Preferences : : getHTTPProxyIp ( ) ) ;
textProxyIP_http - > setText ( settings . value ( QString : : fromUtf8 ( " IP " ) , " 0.0.0.0 " ) . toString ( ) ) ;
spinProxyPort_http - > setValue ( Preferences : : getHTTPProxyPort ( ) ) ;
spinProxyPort_http - > setValue ( settings . value ( QString : : fromUtf8 ( " Port " ) , 8080 ) . toInt ( ) ) ;
checkProxyAuth_http - > setChecked ( Preferences : : isHTTPProxyAuthEnabled ( ) ) ;
checkProxyAuth_http - > setChecked ( settings . value ( QString : : fromUtf8 ( " Authentication " ) , false ) . toBool ( ) ) ;
enableProxyAuthHTTP ( checkProxyAuth_http - > isChecked ( ) ) ;
if ( isHTTPProxyEnabled ( ) ) {
// End HTTPProxy
if ( isHTTPProxyAuthEnabled ( ) ) {
enableProxyAuthHTTP ( 2 ) ; // Enable
} else {
enableProxyAuthHTTP ( 0 ) ; // Disable
}
} else {
enableProxyAuthHTTP ( 0 ) ; // Disable
}
settings . endGroup ( ) ; // End HTTPProxy
// End Connection preferences
// End Connection preferences
settings . endGroup ( ) ;
// Bittorrent preferences
// Bittorrent preferences
settings . beginGroup ( " Bittorrent " ) ;
intValue = Preferences : : getMaxConnecs ( ) ;
intValue = settings . value ( QString : : fromUtf8 ( " MaxConnecs " ) , 500 ) . toInt ( ) ;
if ( intValue > 0 ) {
if ( intValue ! = - 1 ) {
// enable
// enable
checkMaxConnecs - > setChecked ( true ) ;
checkMaxConnecs - > setChecked ( true ) ;
spinMaxConnec - > setEnabled ( true ) ;
spinMaxConnec - > setEnabled ( true ) ;
@ -682,8 +658,8 @@ void options_imp::loadOptions(){
checkMaxConnecs - > setChecked ( false ) ;
checkMaxConnecs - > setChecked ( false ) ;
spinMaxConnec - > setEnabled ( false ) ;
spinMaxConnec - > setEnabled ( false ) ;
}
}
intValue = settings . value ( QString : : fromUtf8 ( " MaxConnecsPerTorrent " ) , 100 ) . toI nt( ) ;
intValue = Preferences : : getMaxConnecsPerTorre nt( ) ;
if ( intValue ! = - 1 ) {
if ( intValue > 0 ) {
// enable
// enable
checkMaxConnecsPerTorrent - > setChecked ( true ) ;
checkMaxConnecsPerTorrent - > setChecked ( true ) ;
spinMaxConnecPerTorrent - > setEnabled ( true ) ;
spinMaxConnecPerTorrent - > setEnabled ( true ) ;
@ -693,8 +669,8 @@ void options_imp::loadOptions(){
checkMaxConnecsPerTorrent - > setChecked ( false ) ;
checkMaxConnecsPerTorrent - > setChecked ( false ) ;
spinMaxConnecPerTorrent - > setEnabled ( false ) ;
spinMaxConnecPerTorrent - > setEnabled ( false ) ;
}
}
intValue = settings . value ( QString : : fromUtf8 ( " MaxUploadsPerTorrent " ) , 4 ) . toI nt( ) ;
intValue = Preferences : : getMaxUploadsPerTorre nt( ) ;
if ( intValue ! = - 1 ) {
if ( intValue > 0 ) {
// enable
// enable
checkMaxUploadsPerTorrent - > setChecked ( true ) ;
checkMaxUploadsPerTorrent - > setChecked ( true ) ;
spinMaxUploadsPerTorrent - > setEnabled ( true ) ;
spinMaxUploadsPerTorrent - > setEnabled ( true ) ;
@ -704,14 +680,14 @@ void options_imp::loadOptions(){
checkMaxUploadsPerTorrent - > setChecked ( false ) ;
checkMaxUploadsPerTorrent - > setChecked ( false ) ;
spinMaxUploadsPerTorrent - > setEnabled ( false ) ;
spinMaxUploadsPerTorrent - > setEnabled ( false ) ;
}
}
checkDHT - > setChecked ( settings . value ( QString : : fromUtf8 ( " DHT " ) , true ) . toBool ( ) ) ;
checkDHT - > setChecked ( Preferences : : isDHTEnabled ( ) ) ;
checkSameDHTPort - > setChecked ( settings . value ( QString : : fromUtf8 ( " sameDHTPortAsBT " ) , true ) . toBool ( ) ) ;
checkSameDHTPort - > setChecked ( Preferences : : isDHTPortSameAsBT ( ) ) ;
enableDHTPortSettings ( checkSameDHTPort - > checkState ( ) ) ;
enableDHTPortSettings ( checkSameDHTPort - > isChecked ( ) ) ;
spinDHTPort - > setValue ( settings . value ( QString : : fromUtf8 ( " DHTPort " ) , 6882 ) . toIn t( ) ) ;
spinDHTPort - > setValue ( Preferences : : getDHTPor t( ) ) ;
checkLSD - > setChecked ( settings . value ( QString : : fromUtf8 ( " LSD " ) , true ) . toBool ( ) ) ;
checkLSD - > setChecked ( Preferences : : isLSDEnabled ( ) ) ;
checkAzureusSpoof - > setChecked ( settings . value ( QString : : fromUtf8 ( " AzureusSpoof " ) , false ) . toBool ( ) ) ;
checkAzureusSpoof - > setChecked ( Preferences : : isUtorrentSpoofingEnabled ( ) ) ;
comboEncryption - > setCurrentIndex ( settings . value ( QString : : fromUtf8 ( " Encryption " ) , 0 ) . toInt ( ) ) ;
comboEncryption - > setCurrentIndex ( Preferences : : getEncryptionSetting ( ) ) ;
floatValue = settings . value ( QString : : fromUtf8 ( " DesiredRatio " ) , - 1 ) . toDouble ( ) ;
floatValue = Preferences : : getDesiredRatio ( ) ;
if ( floatValue > = 1. ) {
if ( floatValue > = 1. ) {
// Enable
// Enable
checkRatioLimit - > setChecked ( true ) ;
checkRatioLimit - > setChecked ( true ) ;
@ -722,7 +698,7 @@ void options_imp::loadOptions(){
checkRatioLimit - > setChecked ( false ) ;
checkRatioLimit - > setChecked ( false ) ;
spinRatio - > setEnabled ( false ) ;
spinRatio - > setEnabled ( false ) ;
}
}
floatValue = settings . value ( QString : : fromUtf8 ( " MaxRatio " ) , - 1 ) . toDouble ( ) ;
floatValue = Preferences : : getDeleteRatio ( ) ;
if ( floatValue > = 1. ) {
if ( floatValue > = 1. ) {
// Enable
// Enable
checkRatioRemove - > setChecked ( true ) ;
checkRatioRemove - > setChecked ( true ) ;
@ -734,53 +710,32 @@ void options_imp::loadOptions(){
spinMaxRatio - > setEnabled ( false ) ;
spinMaxRatio - > setEnabled ( false ) ;
}
}
// End Bittorrent preferences
// End Bittorrent preferences
settings . endGroup ( ) ;
// Misc preferences
// Misc preferences
// * IP Filter
// * IP Filter
settings . beginGroup ( " IPFilter " ) ;
checkIPFilter - > setChecked ( Preferences : : isFilteringEnabled ( ) ) ;
checkIPFilter - > setChecked ( settings . value ( QString : : fromUtf8 ( " Enabled " ) , false ) . toBool ( ) ) ;
enableFilter ( checkIPFilter - > isChecked ( ) ) ;
if ( isFilteringEnabled ( ) ) {
textFilterPath - > setText ( Preferences : : getFilter ( ) ) ;
enableFilter ( 2 ) ; // Enable
textFilterPath - > setText ( settings . value ( QString : : fromUtf8 ( " File " ) , QString ( ) ) . toString ( ) ) ;
} else {
enableFilter ( 0 ) ; // Disable
}
// End IP Filter
// End IP Filter
settings . endGroup ( ) ;
// * RSS
// * RSS
settings . beginGroup ( " RSS " ) ;
checkEnableRSS - > setChecked ( Preferences : : isRSSEnabled ( ) ) ;
checkEnableRSS - > setChecked ( settings . value ( QString : : fromUtf8 ( " RSSEnabled " ) , false ) . toBool ( ) ) ;
enableRSS ( checkEnableRSS - > isChecked ( ) ) ;
if ( isRSSEnabled ( ) ) {
spinRSSRefresh - > setValue ( Preferences : : getRSSRefreshInterval ( ) ) ;
enableRSS ( 2 ) ; // Enable
spinRSSMaxArticlesPerFeed - > setValue ( Preferences : : getRSSMaxArticlesPerFeed ( ) ) ;
} else {
enableRSS ( 0 ) ; // Disable
}
spinRSSRefresh - > setValue ( settings . value ( QString : : fromUtf8 ( " RSSRefresh " ) , 5 ) . toInt ( ) ) ;
spinRSSMaxArticlesPerFeed - > setValue ( settings . value ( QString : : fromUtf8 ( " RSSMaxArticlesPerFeed " ) , 50 ) . toInt ( ) ) ;
// End RSS preferences
// End RSS preferences
settings . endGroup ( ) ;
// Queueing system preferences
// Queueing system preferences
settings . beginGroup ( " Queueing " ) ;
checkEnableQueueing - > setChecked ( Preferences : : isQueueingSystemEnabled ( ) ) ;
checkEnableQueueing - > setChecked ( settings . value ( " QueueingEnabled " , false ) . toBool ( ) ) ;
enableQueueingSystem ( checkEnableQueueing - > isChecked ( ) ) ;
if ( isQueueingSystemEnabled ( ) ) {
spinMaxActiveDownloads - > setValue ( Preferences : : getMaxActiveDownloads ( ) ) ;
enableQueueingSystem ( 2 ) ; // Enable
spinMaxActiveUploads - > setValue ( Preferences : : getMaxActiveUploads ( ) ) ;
spinMaxActiveDownloads - > setValue ( settings . value ( QString : : fromUtf8 ( " MaxActiveDownloads " ) , 3 ) . toInt ( ) ) ;
spinMaxActiveTorrents - > setValue ( Preferences : : getMaxActiveTorrents ( ) ) ;
spinMaxActiveUploads - > setValue ( settings . value ( QString : : fromUtf8 ( " MaxActiveUploads " ) , 3 ) . toInt ( ) ) ;
spinMaxActiveTorrents - > setValue ( settings . value ( QString : : fromUtf8 ( " MaxActiveTorrents " ) , 5 ) . toInt ( ) ) ;
} else {
enableQueueingSystem ( 0 ) ; // Disable
}
// End Queueing system preferences
// End Queueing system preferences
settings . endGroup ( ) ;
// Web UI
// Web UI
settings . beginGroup ( " WebUI " ) ;
checkWebUi - > setChecked ( Preferences : : isWebUiEnabled ( ) ) ;
checkWebUi - > setChecked ( settings . value ( " Enabled " , false ) . toBool ( ) ) ;
enableWebUi ( checkWebUi - > isChecked ( ) ) ;
enableWebUi ( isWebUiEnabled ( ) ) ;
spinWebUiPort - > setValue ( Preferences : : getWebUiPort ( ) ) ;
spinWebUiPort - > setValue ( settings . value ( " Port " , 8080 ) . toInt ( ) ) ;
textWebUiUsername - > setText ( Preferences : : getWebUiUsername ( ) ) ;
textWebUiUsername - > setText ( settings . value ( " Username " , " user " ) . toString ( ) ) ;
textWebUiPassword - > setText ( Preferences : : getWebUiPassword ( ) ) ;
textWebUiPassword - > setText ( settings . value ( " Password " , " " ) . toString ( ) ) ;
// End Web UI
// End Web UI
settings . endGroup ( ) ;
// Random stuff
// Random stuff
srand ( time ( 0 ) ) ;
srand ( time ( 0 ) ) ;
}
}
@ -887,9 +842,9 @@ bool options_imp::systrayIntegration() const{
}
}
int options_imp : : getDHTPort ( ) const {
int options_imp : : getDHTPort ( ) const {
if ( isDHTPortSameAsBT ( ) )
if ( isDHTPortSameAsBT ( ) )
return 0 ;
return 0 ;
return spinDHTPort - > value ( ) ;
return spinDHTPort - > value ( ) ;
}
}
// Return Share ratio
// Return Share ratio
@ -961,19 +916,16 @@ void options_imp::on_buttonBox_accepted(){
if ( applyButton - > isEnabled ( ) ) {
if ( applyButton - > isEnabled ( ) ) {
saveOptions ( ) ;
saveOptions ( ) ;
applyButton - > setEnabled ( false ) ;
applyButton - > setEnabled ( false ) ;
// set infobar text
this - > hide ( ) ;
this - > hide ( ) ;
emit status_changed ( true ) ;
emit status_changed ( ) ;
} else {
setAttribute ( Qt : : WA_DeleteOnClose ) ;
accept ( ) ;
}
}
accept ( ) ;
}
}
void options_imp : : applySettings ( QAbstractButton * button ) {
void options_imp : : applySettings ( QAbstractButton * button ) {
if ( button = = applyButton ) {
if ( button = = applyButton ) {
saveOptions ( ) ;
saveOptions ( ) ;
emit status_changed ( false ) ;
emit status_changed ( ) ;
}
}
}
}
@ -987,25 +939,21 @@ void options_imp::on_buttonBox_rejected(){
reject ( ) ;
reject ( ) ;
}
}
void options_imp : : enableDownloadLimit ( int checkBoxValue ) {
void options_imp : : enableDownloadLimit ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
spinDownloadLimit - > setEnabled ( false ) ;
} else {
//enable
spinDownloadLimit - > setEnabled ( true ) ;
spinDownloadLimit - > setEnabled ( true ) ;
} else {
spinDownloadLimit - > setEnabled ( false ) ;
}
}
}
}
void options_imp : : enableTempPathInput ( int checkBoxValue ) {
void options_imp : : enableTempPathInput ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
textTempPath - > setEnabled ( false ) ;
browseTempDirButton - > setEnabled ( false ) ;
} else {
//enable
textTempPath - > setEnabled ( true ) ;
textTempPath - > setEnabled ( true ) ;
browseTempDirButton - > setEnabled ( true ) ;
browseTempDirButton - > setEnabled ( true ) ;
} else {
textTempPath - > setEnabled ( false ) ;
browseTempDirButton - > setEnabled ( false ) ;
}
}
}
}
@ -1013,43 +961,37 @@ bool options_imp::useAdditionDialog() const{
return checkAdditionDialog - > isChecked ( ) ;
return checkAdditionDialog - > isChecked ( ) ;
}
}
void options_imp : : enableMaxConnecsLimit ( int checkBoxValue ) {
void options_imp : : enableMaxConnecsLimit ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
spinMaxConnec - > setEnabled ( false ) ;
} else {
//enable
spinMaxConnec - > setEnabled ( true ) ;
spinMaxConnec - > setEnabled ( true ) ;
} else {
spinMaxConnec - > setEnabled ( false ) ;
}
}
}
}
void options_imp : : enableQueueingSystem ( int checkBoxValue ) {
void options_imp : : enableQueueingSystem ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
spinMaxActiveDownloads - > setEnabled ( false ) ;
spinMaxActiveUploads - > setEnabled ( false ) ;
label_max_active_dl - > setEnabled ( false ) ;
label_max_active_up - > setEnabled ( false ) ;
maxActiveTorrents_lbl - > setEnabled ( false ) ;
spinMaxActiveTorrents - > setEnabled ( false ) ;
} else {
//enable
spinMaxActiveDownloads - > setEnabled ( true ) ;
spinMaxActiveDownloads - > setEnabled ( true ) ;
spinMaxActiveUploads - > setEnabled ( true ) ;
spinMaxActiveUploads - > setEnabled ( true ) ;
label_max_active_dl - > setEnabled ( true ) ;
label_max_active_dl - > setEnabled ( true ) ;
label_max_active_up - > setEnabled ( true ) ;
label_max_active_up - > setEnabled ( true ) ;
maxActiveTorrents_lbl - > setEnabled ( true ) ;
maxActiveTorrents_lbl - > setEnabled ( true ) ;
spinMaxActiveTorrents - > setEnabled ( true ) ;
spinMaxActiveTorrents - > setEnabled ( true ) ;
} else {
spinMaxActiveDownloads - > setEnabled ( false ) ;
spinMaxActiveUploads - > setEnabled ( false ) ;
label_max_active_dl - > setEnabled ( false ) ;
label_max_active_up - > setEnabled ( false ) ;
maxActiveTorrents_lbl - > setEnabled ( false ) ;
spinMaxActiveTorrents - > setEnabled ( false ) ;
}
}
}
}
void options_imp : : enableMaxConnecsLimitPerTorrent ( int checkBoxValue ) {
void options_imp : : enableMaxConnecsLimitPerTorrent ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
spinMaxConnecPerTorrent - > setEnabled ( false ) ;
} else {
//enable
spinMaxConnecPerTorrent - > setEnabled ( true ) ;
spinMaxConnecPerTorrent - > setEnabled ( true ) ;
} else {
spinMaxConnecPerTorrent - > setEnabled ( false ) ;
}
}
}
}
@ -1065,55 +1007,47 @@ void options_imp::disableSystrayOptions() {
checkSystrayBalloons - > setEnabled ( false ) ;
checkSystrayBalloons - > setEnabled ( false ) ;
}
}
void options_imp : : setSystrayOptionsState ( int checkBoxValue ) {
void options_imp : : setSystrayOptionsState ( bool checked ) {
if ( checkBoxValue = = 2 ) {
if ( checked ) {
disableSystrayOptions ( ) ;
disableSystrayOptions ( ) ;
} else {
} else {
enableSystrayOptions ( ) ;
enableSystrayOptions ( ) ;
}
}
}
}
void options_imp : : enableMaxUploadsLimitPerTorrent ( int checkBoxValue ) {
void options_imp : : enableMaxUploadsLimitPerTorrent ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
spinMaxUploadsPerTorrent - > setEnabled ( false ) ;
} else {
//enable
spinMaxUploadsPerTorrent - > setEnabled ( true ) ;
spinMaxUploadsPerTorrent - > setEnabled ( true ) ;
} else {
spinMaxUploadsPerTorrent - > setEnabled ( false ) ;
}
}
}
}
void options_imp : : enableFilter ( int checkBoxValue ) {
void options_imp : : enableFilter ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
lblFilterPath - > setEnabled ( false ) ;
textFilterPath - > setEnabled ( false ) ;
browseFilterButton - > setEnabled ( false ) ;
} else {
//enable
lblFilterPath - > setEnabled ( true ) ;
lblFilterPath - > setEnabled ( true ) ;
textFilterPath - > setEnabled ( true ) ;
textFilterPath - > setEnabled ( true ) ;
browseFilterButton - > setEnabled ( true ) ;
browseFilterButton - > setEnabled ( true ) ;
} else {
lblFilterPath - > setEnabled ( false ) ;
textFilterPath - > setEnabled ( false ) ;
browseFilterButton - > setEnabled ( false ) ;
}
}
}
}
void options_imp : : enableRSS ( int checkBoxValue ) {
void options_imp : : enableRSS ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
groupRSSSettings - > setEnabled ( false ) ;
} else {
//enable
groupRSSSettings - > setEnabled ( true ) ;
groupRSSSettings - > setEnabled ( true ) ;
} else {
groupRSSSettings - > setEnabled ( false ) ;
}
}
}
}
void options_imp : : enableUploadLimit ( int checkBoxValue ) {
void options_imp : : enableUploadLimit ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
spinUploadLimit - > setEnabled ( false ) ;
} else {
//enable
spinUploadLimit - > setEnabled ( true ) ;
spinUploadLimit - > setEnabled ( true ) ;
} else {
spinUploadLimit - > setEnabled ( false ) ;
}
}
}
}
@ -1123,35 +1057,29 @@ void options_imp::enableApplyButton(){
}
}
}
}
void options_imp : : enableShareRatio ( int checkBoxValue ) {
void options_imp : : enableShareRatio ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
spinRatio - > setEnabled ( false ) ;
} else {
//enable
spinRatio - > setEnabled ( true ) ;
spinRatio - > setEnabled ( true ) ;
} else {
spinRatio - > setEnabled ( false ) ;
}
}
}
}
void options_imp : : enableDHTPortSettings ( int checkBoxValue ) {
void options_imp : : enableDHTPortSettings ( bool checked ) {
if ( checkBoxValue = = 2 ) {
if ( checked ) {
//Disable
spinDHTPort - > setEnabled ( false ) ;
dh_port_lbl - > setEnabled ( false ) ;
} else {
//enable
spinDHTPort - > setEnabled ( true ) ;
spinDHTPort - > setEnabled ( true ) ;
dh_port_lbl - > setEnabled ( true ) ;
dh_port_lbl - > setEnabled ( true ) ;
} else {
spinDHTPort - > setEnabled ( false ) ;
dh_port_lbl - > setEnabled ( false ) ;
}
}
}
}
void options_imp : : enableDeleteRatio ( int checkBoxValue ) {
void options_imp : : enableDeleteRatio ( bool checked ) {
if ( checkBoxValue ! = 2 ) {
if ( checked ) {
//Disable
spinMaxRatio - > setEnabled ( false ) ;
} else {
//enable
spinMaxRatio - > setEnabled ( true ) ;
spinMaxRatio - > setEnabled ( true ) ;
} else {
spinMaxRatio - > setEnabled ( false ) ;
}
}
}
}
@ -1195,15 +1123,13 @@ void options_imp::enableProxyHTTP(int index){
}
}
}
}
void options_imp : : enableProxyAuth ( int checkBoxValue ) {
void options_imp : : enableProxyAuth ( bool checked ) {
if ( checkBoxValue = = 2 ) {
if ( checked ) {
//enable
lblProxyUsername - > setEnabled ( true ) ;
lblProxyUsername - > setEnabled ( true ) ;
lblProxyPassword - > setEnabled ( true ) ;
lblProxyPassword - > setEnabled ( true ) ;
textProxyUsername - > setEnabled ( true ) ;
textProxyUsername - > setEnabled ( true ) ;
textProxyPassword - > setEnabled ( true ) ;
textProxyPassword - > setEnabled ( true ) ;
} else {
} else {
//disable
lblProxyUsername - > setEnabled ( false ) ;
lblProxyUsername - > setEnabled ( false ) ;
lblProxyPassword - > setEnabled ( false ) ;
lblProxyPassword - > setEnabled ( false ) ;
textProxyUsername - > setEnabled ( false ) ;
textProxyUsername - > setEnabled ( false ) ;
@ -1211,15 +1137,13 @@ void options_imp::enableProxyAuth(int checkBoxValue){
}
}
}
}
void options_imp : : enableProxyAuthHTTP ( int checkBoxValue ) {
void options_imp : : enableProxyAuthHTTP ( bool checked ) {
if ( checkBoxValue = = 2 ) {
if ( checked ) {
//enable
lblProxyUsername_http - > setEnabled ( true ) ;
lblProxyUsername_http - > setEnabled ( true ) ;
lblProxyPassword_http - > setEnabled ( true ) ;
lblProxyPassword_http - > setEnabled ( true ) ;
textProxyUsername_http - > setEnabled ( true ) ;
textProxyUsername_http - > setEnabled ( true ) ;
textProxyPassword_http - > setEnabled ( true ) ;
textProxyPassword_http - > setEnabled ( true ) ;
} else {
} else {
//disable
lblProxyUsername_http - > setEnabled ( false ) ;
lblProxyUsername_http - > setEnabled ( false ) ;
lblProxyPassword_http - > setEnabled ( false ) ;
lblProxyPassword_http - > setEnabled ( false ) ;
textProxyUsername_http - > setEnabled ( false ) ;
textProxyUsername_http - > setEnabled ( false ) ;
@ -1227,13 +1151,11 @@ void options_imp::enableProxyAuthHTTP(int checkBoxValue){
}
}
}
}
void options_imp : : enableDirScan ( int checkBoxValue ) {
void options_imp : : enableDirScan ( bool checked ) {
if ( checkBoxValue = = 2 ) {
if ( checked ) {
//enable
textScanDir - > setEnabled ( true ) ;
textScanDir - > setEnabled ( true ) ;
browseScanDirButton - > setEnabled ( true ) ;
browseScanDirButton - > setEnabled ( true ) ;
} else {
} else {
//disable
textScanDir - > setEnabled ( false ) ;
textScanDir - > setEnabled ( false ) ;
browseScanDirButton - > setEnabled ( false ) ;
browseScanDirButton - > setEnabled ( false ) ;
}
}
@ -1269,11 +1191,7 @@ bool options_imp::isHTTPProxyEnabled() const {
}
}
bool options_imp : : isProxyAuthEnabled ( ) const {
bool options_imp : : isProxyAuthEnabled ( ) const {
return checkProxyAuth - > isEnabled ( ) & & checkProxyAuth - > isChecked ( ) ;
return checkProxyAuth - > isChecked ( ) ;
}
bool options_imp : : isHTTPProxyAuthEnabled ( ) const {
return checkProxyAuth_http - > isEnabled ( ) & & checkProxyAuth_http - > isChecked ( ) ;
}
}
QString options_imp : : getProxyIp ( ) const {
QString options_imp : : getProxyIp ( ) const {