Browse Source

Still simplifying program options

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
08a08e4b24
  1. 10
      src/deletionconfirmationdlg.h
  2. 485
      src/options_imp.cpp
  3. 34
      src/ui/confirmdeletiondlg.ui
  4. 63
      src/ui/options.ui

10
src/deletionconfirmationdlg.h

@ -44,6 +44,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
setupUi(this); setupUi(this);
move(misc::screenCenter(this)); move(misc::screenCenter(this));
checkPermDelete->setChecked(Preferences::deleteTorrentFilesAsDefault()); checkPermDelete->setChecked(Preferences::deleteTorrentFilesAsDefault());
connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));
buttonBox->setFocus(); buttonBox->setFocus();
} }
@ -60,6 +61,15 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
return false; return false;
} }
private slots:
void updateRememberButtonState() {
rememberBtn->setEnabled(checkPermDelete->isChecked() != Preferences::deleteTorrentFilesAsDefault());
}
void on_rememberBtn_clicked() {
Preferences::setDeleteTorrentFilesAsDefault(checkPermDelete->isChecked());
rememberBtn->setEnabled(false);
}
}; };
#endif // DELETIONCONFIRMATIONDLG_H #endif // DELETIONCONFIRMATIONDLG_H

485
src/options_imp.cpp

@ -155,12 +155,12 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
#else #else
if(!QSystemTrayIcon::isSystemTrayAvailable()){ if(!QSystemTrayIcon::isSystemTrayAvailable()){
#endif #endif
checkNoSystray->setChecked(true); checkShowSystray->setChecked(false);
checkNoSystray->setEnabled(false); checkShowSystray->setEnabled(false);
} }
// Connect signals / slots // Connect signals / slots
// General tab // General tab
connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(setSystrayOptionsState(bool))); connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(setSystrayOptionsState(bool)));
// Downloads tab // Downloads tab
connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableTempPathInput(bool))); connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableTempPathInput(bool)));
connect(checkExportDir, SIGNAL(toggled(bool)), this, SLOT(enableTorrentExport(bool))); connect(checkExportDir, SIGNAL(toggled(bool)), this, SLOT(enableTorrentExport(bool)));
@ -194,12 +194,11 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
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(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkShowSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDeleteTorrentFiles, 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(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -292,28 +291,28 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// Adapt size // Adapt size
show(); show();
loadWindowState(); loadWindowState();
} }
// Main destructor // Main destructor
options_imp::~options_imp(){ options_imp::~options_imp(){
qDebug("-> destructing Options"); qDebug("-> destructing Options");
foreach (const QString &path, addedScanDirs) foreach (const QString &path, addedScanDirs)
ScanFoldersModel::instance()->removePath(path); ScanFoldersModel::instance()->removePath(path);
delete scrollArea_advanced->layout(); delete scrollArea_advanced->layout();
delete advancedSettings; delete advancedSettings;
} }
void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous) { 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() {
QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex()))); QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex())));
} }
void options_imp::loadWindowState() { void options_imp::loadWindowState() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
resize(settings.value(QString::fromUtf8("Preferences/State/size"), sizeFittingScreen()).toSize()); resize(settings.value(QString::fromUtf8("Preferences/State/size"), sizeFittingScreen()).toSize());
QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint(); QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint();
@ -331,9 +330,9 @@ void options_imp::loadWindowState() {
sizes << hsplitter->width()-130; sizes << hsplitter->width()-130;
} }
hsplitter->setSizes(sizes); hsplitter->setSizes(sizes);
} }
void options_imp::saveWindowState() const { void options_imp::saveWindowState() const {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue(QString::fromUtf8("Preferences/State/size"), size()); settings.setValue(QString::fromUtf8("Preferences/State/size"), size());
settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos()); settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos());
@ -342,9 +341,9 @@ void options_imp::saveWindowState() const {
sizes_str << QString::number(hsplitter->sizes().first()); sizes_str << QString::number(hsplitter->sizes().first());
sizes_str << QString::number(hsplitter->sizes().last()); sizes_str << QString::number(hsplitter->sizes().last());
settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str); settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str);
} }
QSize options_imp::sizeFittingScreen() { QSize options_imp::sizeFittingScreen() {
int scrn = 0; int scrn = 0;
QWidget *w = this->topLevelWidget(); QWidget *w = this->topLevelWidget();
@ -361,9 +360,9 @@ QSize options_imp::sizeFittingScreen() {
return QSize(desk.width(), desk.height()); return QSize(desk.width(), desk.height());
} }
return size(); return size();
} }
void options_imp::saveOptions(){ void options_imp::saveOptions(){
applyButton->setEnabled(false); applyButton->setEnabled(false);
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
// Apply style // Apply style
@ -379,7 +378,6 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray()); settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray());
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized()); settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
settings.setValue(QString::fromUtf8("NoSplashScreen"), isSlashScreenDisabled()); settings.setValue(QString::fromUtf8("NoSplashScreen"), isSlashScreenDisabled());
Preferences::setDeleteTorrentFilesAsDefault(checkDeleteTorrentFiles->isChecked());
// End General preferences // End General preferences
settings.endGroup(); settings.endGroup();
// Downloads preferences // Downloads preferences
@ -534,13 +532,13 @@ void options_imp::saveOptions(){
// Save advanced settings // Save advanced settings
advancedSettings->saveAdvancedSettings(); advancedSettings->saveAdvancedSettings();
} }
bool options_imp::isFilteringEnabled() const{ bool options_imp::isFilteringEnabled() const{
return checkIPFilter->isChecked(); return checkIPFilter->isChecked();
} }
int options_imp::getPeerProxyType() const{ int options_imp::getPeerProxyType() const{
switch(comboProxyType->currentIndex()) { switch(comboProxyType->currentIndex()) {
case 1: case 1:
return SOCKS4; return SOCKS4;
@ -558,9 +556,9 @@ int options_imp::getPeerProxyType() const{
default: default:
return -1; return -1;
} }
} }
int options_imp::getHTTPProxyType() const { int options_imp::getHTTPProxyType() const {
switch(comboProxyType_http->currentIndex()) { switch(comboProxyType_http->currentIndex()) {
case 1: { case 1: {
if(isHTTPProxyAuthEnabled()){ if(isHTTPProxyAuthEnabled()){
@ -577,23 +575,23 @@ int options_imp::getHTTPProxyType() const {
default: default:
return -1; // Disabled return -1; // Disabled
} }
} }
QString options_imp::getStyle() const{ QString options_imp::getStyle() const{
return comboStyle->itemText(comboStyle->currentIndex()); return comboStyle->itemText(comboStyle->currentIndex());
} }
void options_imp::setStyle(QString style) { void options_imp::setStyle(QString style) {
int index = comboStyle->findText(style, Qt::MatchFixedString); int index = comboStyle->findText(style, Qt::MatchFixedString);
if(index > 0) if(index > 0)
comboStyle->setCurrentIndex(index); comboStyle->setCurrentIndex(index);
} }
bool options_imp::isHTTPProxyAuthEnabled() const{ bool options_imp::isHTTPProxyAuthEnabled() const{
return checkProxyAuth_http->isChecked(); return checkProxyAuth_http->isChecked();
} }
void options_imp::loadOptions(){ void options_imp::loadOptions(){
int intValue; int intValue;
float floatValue; float floatValue;
QString strValue; QString strValue;
@ -601,10 +599,9 @@ void options_imp::loadOptions(){
setLocale(Preferences::getLocale()); setLocale(Preferences::getLocale());
setStyle(Preferences::getStyle()); setStyle(Preferences::getStyle());
checkAltRowColors->setChecked(Preferences::useAlternatingRowColors()); checkAltRowColors->setChecked(Preferences::useAlternatingRowColors());
checkNoSystray->setChecked(!Preferences::systrayIntegration()); checkShowSystray->setChecked(Preferences::systrayIntegration());
checkNoSplash->setChecked(Preferences::isSlashScreenDisabled()); checkShowSplash->setChecked(!Preferences::isSlashScreenDisabled());
checkDeleteTorrentFiles->setChecked(Preferences::deleteTorrentFilesAsDefault()); if(!checkShowSystray->isChecked()) {
if(checkNoSystray->isChecked()) {
disableSystrayOptions(); disableSystrayOptions();
} else { } else {
enableSystrayOptions(); enableSystrayOptions();
@ -866,15 +863,15 @@ void options_imp::loadOptions(){
// End Web UI // End Web UI
// Random stuff // Random stuff
srand(time(0)); srand(time(0));
} }
// return min & max ports // return min & max ports
// [min, max] // [min, max]
int options_imp::getPort() const{ int options_imp::getPort() const{
return spinPort->value(); return spinPort->value();
} }
void options_imp::enableSpoofingSettings(int index) { void options_imp::enableSpoofingSettings(int index) {
switch(index) { switch(index) {
case 0: // qBittorrent case 0: // qBittorrent
resetPeerVersion_button->setEnabled(false); resetPeerVersion_button->setEnabled(false);
@ -913,9 +910,9 @@ void options_imp::enableSpoofingSettings(int index) {
client_build->clear(); client_build->clear();
break; break;
} }
} }
void options_imp::on_resetPeerVersion_button_clicked() { void options_imp::on_resetPeerVersion_button_clicked() {
switch(comboPeerID->currentIndex()) { switch(comboPeerID->currentIndex()) {
case 1: // Vuze case 1: // Vuze
client_version->setText(Preferences::getDefaultClientVersion("AZ")); client_version->setText(Preferences::getDefaultClientVersion("AZ"));
@ -928,66 +925,66 @@ void options_imp::on_resetPeerVersion_button_clicked() {
client_build->setText(Preferences::getDefaultClientBuild("UT")); client_build->setText(Preferences::getDefaultClientBuild("UT"));
break; break;
} }
} }
void options_imp::on_randomButton_clicked() { void options_imp::on_randomButton_clicked() {
// Range [1024: 65535] // Range [1024: 65535]
spinPort->setValue(rand() % 64512 + 1024); spinPort->setValue(rand() % 64512 + 1024);
} }
int options_imp::getEncryptionSetting() const{ int options_imp::getEncryptionSetting() const{
return comboEncryption->currentIndex(); return comboEncryption->currentIndex();
} }
int options_imp::getMaxActiveDownloads() const { int options_imp::getMaxActiveDownloads() const {
return spinMaxActiveDownloads->value(); return spinMaxActiveDownloads->value();
} }
int options_imp::getMaxActiveUploads() const { int options_imp::getMaxActiveUploads() const {
return spinMaxActiveUploads->value(); return spinMaxActiveUploads->value();
} }
int options_imp::getMaxActiveTorrents() const { int options_imp::getMaxActiveTorrents() const {
return spinMaxActiveTorrents->value(); return spinMaxActiveTorrents->value();
} }
bool options_imp::minimizeToTray() const{ bool options_imp::minimizeToTray() const{
if(checkNoSystray->isChecked()) return false; if(!checkShowSystray->isChecked()) return false;
return checkMinimizeToSysTray->isChecked(); return checkMinimizeToSysTray->isChecked();
} }
bool options_imp::closeToTray() const{ bool options_imp::closeToTray() const{
if(checkNoSystray->isChecked()) return false; if(!checkShowSystray->isChecked()) return false;
return checkCloseToSystray->isChecked(); return checkCloseToSystray->isChecked();
} }
bool options_imp::isQueueingSystemEnabled() const { bool options_imp::isQueueingSystemEnabled() const {
return checkEnableQueueing->isChecked(); return checkEnableQueueing->isChecked();
} }
bool options_imp::isDHTEnabled() const{ bool options_imp::isDHTEnabled() const{
return checkDHT->isChecked(); return checkDHT->isChecked();
} }
bool options_imp::isRSSEnabled() const{ bool options_imp::isRSSEnabled() const{
return checkEnableRSS->isChecked(); return checkEnableRSS->isChecked();
} }
bool options_imp::isLSDEnabled() const{ bool options_imp::isLSDEnabled() const{
return checkLSD->isChecked(); return checkLSD->isChecked();
} }
bool options_imp::isUPnPEnabled() const{ bool options_imp::isUPnPEnabled() const{
return checkUPnP->isChecked(); return checkUPnP->isChecked();
} }
bool options_imp::isNATPMPEnabled() const{ bool options_imp::isNATPMPEnabled() const{
return checkNATPMP->isChecked(); return checkNATPMP->isChecked();
} }
// Return Download & Upload limits in kbps // Return Download & Upload limits in kbps
// [download,upload] // [download,upload]
QPair<int,int> options_imp::getGlobalBandwidthLimits() const{ QPair<int,int> options_imp::getGlobalBandwidthLimits() const{
int DL = -1, UP = -1; int DL = -1, UP = -1;
if(checkDownloadLimit->isChecked()){ if(checkDownloadLimit->isChecked()){
DL = spinDownloadLimit->value(); DL = spinDownloadLimit->value();
@ -996,43 +993,43 @@ QPair<int,int> options_imp::getGlobalBandwidthLimits() const{
UP = spinUploadLimit->value(); UP = spinUploadLimit->value();
} }
return qMakePair(DL, UP); return qMakePair(DL, UP);
} }
bool options_imp::startMinimized() const { bool options_imp::startMinimized() const {
if(checkStartMinimized->isChecked()) return true; if(checkStartMinimized->isChecked()) return true;
return checkStartMinimized->isChecked(); return checkStartMinimized->isChecked();
} }
bool options_imp::systrayIntegration() const{ bool options_imp::systrayIntegration() const{
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
return false; return false;
#endif #endif
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false; if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
return (!checkNoSystray->isChecked()); return checkShowSystray->isChecked();
} }
int options_imp::getDHTPort() const { int options_imp::getDHTPort() const {
return spinDHTPort->value(); return spinDHTPort->value();
} }
// Return Share ratio // Return Share ratio
float options_imp::getDesiredRatio() const{ float options_imp::getDesiredRatio() const{
if(checkRatioLimit->isChecked()){ if(checkRatioLimit->isChecked()){
return spinRatio->value(); return spinRatio->value();
} }
return -1; return -1;
} }
// Return Share ratio // Return Share ratio
float options_imp::getDeleteRatio() const{ float options_imp::getDeleteRatio() const{
if(checkRatioRemove->isChecked()){ if(checkRatioRemove->isChecked()){
return spinMaxRatio->value(); return spinMaxRatio->value();
} }
return -1; return -1;
} }
// Return Save Path // Return Save Path
QString options_imp::getSavePath() const{ QString options_imp::getSavePath() const{
if(textSavePath->text().trimmed().isEmpty()){ if(textSavePath->text().trimmed().isEmpty()){
QString save_path = Preferences::getSavePath(); QString save_path = Preferences::getSavePath();
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
@ -1041,42 +1038,42 @@ QString options_imp::getSavePath() const{
textSavePath->setText(save_path); textSavePath->setText(save_path);
} }
return misc::expandPath(textSavePath->text()); return misc::expandPath(textSavePath->text());
} }
QString options_imp::getTempPath() const { QString options_imp::getTempPath() const {
return misc::expandPath(textTempPath->text()); return misc::expandPath(textTempPath->text());
} }
bool options_imp::isTempPathEnabled() const { bool options_imp::isTempPathEnabled() const {
return checkTempFolder->isChecked(); return checkTempFolder->isChecked();
} }
// Return max connections number // Return max connections number
int options_imp::getMaxConnecs() const{ int options_imp::getMaxConnecs() const{
if(!checkMaxConnecs->isChecked()){ if(!checkMaxConnecs->isChecked()){
return -1; return -1;
}else{ }else{
return spinMaxConnec->value(); return spinMaxConnec->value();
} }
} }
int options_imp::getMaxConnecsPerTorrent() const{ int options_imp::getMaxConnecsPerTorrent() const{
if(!checkMaxConnecsPerTorrent->isChecked()){ if(!checkMaxConnecsPerTorrent->isChecked()){
return -1; return -1;
}else{ }else{
return spinMaxConnecPerTorrent->value(); return spinMaxConnecPerTorrent->value();
} }
} }
int options_imp::getMaxUploadsPerTorrent() const{ int options_imp::getMaxUploadsPerTorrent() const{
if(!checkMaxUploadsPerTorrent->isChecked()){ if(!checkMaxUploadsPerTorrent->isChecked()){
return -1; return -1;
}else{ }else{
return spinMaxUploadsPerTorrent->value(); return spinMaxUploadsPerTorrent->value();
} }
} }
void options_imp::on_buttonBox_accepted(){ void options_imp::on_buttonBox_accepted(){
if(applyButton->isEnabled()){ if(applyButton->isEnabled()){
saveOptions(); saveOptions();
applyButton->setEnabled(false); applyButton->setEnabled(false);
@ -1085,34 +1082,34 @@ void options_imp::on_buttonBox_accepted(){
} }
saveWindowState(); saveWindowState();
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(); emit status_changed();
} }
} }
void options_imp::closeEvent(QCloseEvent *e){ void options_imp::closeEvent(QCloseEvent *e){
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
e->accept(); e->accept();
} }
void options_imp::on_buttonBox_rejected(){ void options_imp::on_buttonBox_rejected(){
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
reject(); reject();
} }
void options_imp::enableDownloadLimit(bool checked){ void options_imp::enableDownloadLimit(bool checked){
if(checked){ if(checked){
spinDownloadLimit->setEnabled(true); spinDownloadLimit->setEnabled(true);
}else{ }else{
spinDownloadLimit->setEnabled(false); spinDownloadLimit->setEnabled(false);
} }
} }
void options_imp::enableTempPathInput(bool checked){ void options_imp::enableTempPathInput(bool checked){
if(checked){ if(checked){
textTempPath->setEnabled(true); textTempPath->setEnabled(true);
browseTempDirButton->setEnabled(true); browseTempDirButton->setEnabled(true);
@ -1120,89 +1117,89 @@ void options_imp::enableTempPathInput(bool checked){
textTempPath->setEnabled(false); textTempPath->setEnabled(false);
browseTempDirButton->setEnabled(false); browseTempDirButton->setEnabled(false);
} }
} }
bool options_imp::useAdditionDialog() const{ bool options_imp::useAdditionDialog() const{
return checkAdditionDialog->isChecked(); return checkAdditionDialog->isChecked();
} }
void options_imp::enableSchedulerFields(bool checked) { void options_imp::enableSchedulerFields(bool checked) {
schedule_from->setEnabled(checked); schedule_from->setEnabled(checked);
schedule_to->setEnabled(checked); schedule_to->setEnabled(checked);
schedule_days->setEnabled(checked); schedule_days->setEnabled(checked);
} }
void options_imp::enableMaxConnecsLimit(bool checked){ void options_imp::enableMaxConnecsLimit(bool checked){
spinMaxConnec->setEnabled(checked); spinMaxConnec->setEnabled(checked);
} }
void options_imp::enableQueueingSystem(bool checked) { void options_imp::enableQueueingSystem(bool checked) {
spinMaxActiveDownloads->setEnabled(checked); spinMaxActiveDownloads->setEnabled(checked);
spinMaxActiveUploads->setEnabled(checked); spinMaxActiveUploads->setEnabled(checked);
label_max_active_dl->setEnabled(checked); label_max_active_dl->setEnabled(checked);
label_max_active_up->setEnabled(checked); label_max_active_up->setEnabled(checked);
maxActiveTorrents_lbl->setEnabled(checked); maxActiveTorrents_lbl->setEnabled(checked);
spinMaxActiveTorrents->setEnabled(checked); spinMaxActiveTorrents->setEnabled(checked);
} }
void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){ void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){
spinMaxConnecPerTorrent->setEnabled(checked); spinMaxConnecPerTorrent->setEnabled(checked);
} }
void options_imp::enableSystrayOptions() { void options_imp::enableSystrayOptions() {
checkCloseToSystray->setEnabled(true); checkCloseToSystray->setEnabled(true);
checkMinimizeToSysTray->setEnabled(true); checkMinimizeToSysTray->setEnabled(true);
} }
void options_imp::disableSystrayOptions() { void options_imp::disableSystrayOptions() {
checkCloseToSystray->setEnabled(false); checkCloseToSystray->setEnabled(false);
checkMinimizeToSysTray->setEnabled(false); checkMinimizeToSysTray->setEnabled(false);
} }
void options_imp::setSystrayOptionsState(bool checked) { void options_imp::setSystrayOptionsState(bool checked) {
if(checked) { if(checked) {
disableSystrayOptions();
} else {
enableSystrayOptions(); enableSystrayOptions();
} else {
disableSystrayOptions();
}
} }
}
void options_imp::enableMaxUploadsLimitPerTorrent(bool checked){ void options_imp::enableMaxUploadsLimitPerTorrent(bool checked){
if(checked){ if(checked){
spinMaxUploadsPerTorrent->setEnabled(true); spinMaxUploadsPerTorrent->setEnabled(true);
}else{ }else{
spinMaxUploadsPerTorrent->setEnabled(false); spinMaxUploadsPerTorrent->setEnabled(false);
} }
} }
void options_imp::enableFilter(bool checked){ void options_imp::enableFilter(bool checked){
lblFilterPath->setEnabled(checked); lblFilterPath->setEnabled(checked);
textFilterPath->setEnabled(checked); textFilterPath->setEnabled(checked);
browseFilterButton->setEnabled(checked); browseFilterButton->setEnabled(checked);
} }
void options_imp::enableRSS(bool checked) { void options_imp::enableRSS(bool checked) {
groupRSSSettings->setEnabled(checked); groupRSSSettings->setEnabled(checked);
} }
void options_imp::enableUploadLimit(bool checked){ void options_imp::enableUploadLimit(bool checked){
spinUploadLimit->setEnabled(checked); spinUploadLimit->setEnabled(checked);
} }
void options_imp::enableApplyButton(){ void options_imp::enableApplyButton(){
applyButton->setEnabled(true); applyButton->setEnabled(true);
} }
void options_imp::enableShareRatio(bool checked){ void options_imp::enableShareRatio(bool checked){
spinRatio->setEnabled(checked); spinRatio->setEnabled(checked);
} }
void options_imp::enableDHTPortSettings(bool checked) { void options_imp::enableDHTPortSettings(bool checked) {
spinDHTPort->setEnabled(checked); spinDHTPort->setEnabled(checked);
dh_port_lbl->setEnabled(checked); dh_port_lbl->setEnabled(checked);
} }
void options_imp::enableDHTSettings(bool checked) { void options_imp::enableDHTSettings(bool checked) {
if(checked){ if(checked){
checkDifferentDHTPort->setEnabled(true); checkDifferentDHTPort->setEnabled(true);
enableDHTPortSettings(checkDifferentDHTPort->isChecked()); enableDHTPortSettings(checkDifferentDHTPort->isChecked());
@ -1210,14 +1207,14 @@ void options_imp::enableDHTSettings(bool checked) {
checkDifferentDHTPort->setEnabled(false); checkDifferentDHTPort->setEnabled(false);
enableDHTPortSettings(false); enableDHTPortSettings(false);
} }
} }
void options_imp::enableDeleteRatio(bool checked){ void options_imp::enableDeleteRatio(bool checked){
spinMaxRatio->setEnabled(checked); spinMaxRatio->setEnabled(checked);
} }
void options_imp::enablePeerProxy(int index){ void options_imp::enablePeerProxy(int index){
if(index){ if(index){
//enable //enable
lblProxyIP->setEnabled(true); lblProxyIP->setEnabled(true);
@ -1239,9 +1236,9 @@ void options_imp::enablePeerProxy(int index){
checkProxyAuth->setEnabled(false); checkProxyAuth->setEnabled(false);
checkProxyAuth->setChecked(false); checkProxyAuth->setChecked(false);
} }
} }
void options_imp::enableHTTPProxy(int index){ void options_imp::enableHTTPProxy(int index){
bool enable = (index > 0); bool enable = (index > 0);
lblProxyIP_http->setEnabled(enable); lblProxyIP_http->setEnabled(enable);
textProxyIP_http->setEnabled(enable); textProxyIP_http->setEnabled(enable);
@ -1251,135 +1248,135 @@ void options_imp::enableHTTPProxy(int index){
if(!enable) if(!enable)
checkProxyAuth_http->setChecked(false); checkProxyAuth_http->setChecked(false);
} }
void options_imp::enablePeerProxyAuth(bool checked){ void options_imp::enablePeerProxyAuth(bool checked){
lblProxyUsername->setEnabled(checked); lblProxyUsername->setEnabled(checked);
lblProxyPassword->setEnabled(checked); lblProxyPassword->setEnabled(checked);
textProxyUsername->setEnabled(checked); textProxyUsername->setEnabled(checked);
textProxyPassword->setEnabled(checked); textProxyPassword->setEnabled(checked);
} }
void options_imp::enableHTTPProxyAuth(bool checked){ void options_imp::enableHTTPProxyAuth(bool checked){
lblProxyUsername_http->setEnabled(checked); lblProxyUsername_http->setEnabled(checked);
lblProxyPassword_http->setEnabled(checked); lblProxyPassword_http->setEnabled(checked);
textProxyUsername_http->setEnabled(checked); textProxyUsername_http->setEnabled(checked);
textProxyPassword_http->setEnabled(checked); textProxyPassword_http->setEnabled(checked);
} }
void options_imp::enableTorrentExport(bool checked) { void options_imp::enableTorrentExport(bool checked) {
textExportDir->setEnabled(checked); textExportDir->setEnabled(checked);
browseExportDirButton->setEnabled(checked); browseExportDirButton->setEnabled(checked);
} }
bool options_imp::isSlashScreenDisabled() const { bool options_imp::isSlashScreenDisabled() const {
return checkNoSplash->isChecked(); return !checkShowSplash->isChecked();
} }
bool options_imp::preAllocateAllFiles() const { bool options_imp::preAllocateAllFiles() const {
return checkPreallocateAll->isChecked(); return checkPreallocateAll->isChecked();
} }
bool options_imp::addTorrentsInPause() const { bool options_imp::addTorrentsInPause() const {
return checkStartPaused->isChecked(); return checkStartPaused->isChecked();
} }
bool options_imp::isDHTPortSameAsBT() const { bool options_imp::isDHTPortSameAsBT() const {
return !checkDifferentDHTPort->isChecked(); return !checkDifferentDHTPort->isChecked();
} }
// Proxy settings // Proxy settings
bool options_imp::isPeerProxyEnabled() const{ bool options_imp::isPeerProxyEnabled() const{
return comboProxyType->currentIndex(); return comboProxyType->currentIndex();
} }
bool options_imp::isHTTPProxyEnabled() const { bool options_imp::isHTTPProxyEnabled() const {
return comboProxyType_http->currentIndex(); return comboProxyType_http->currentIndex();
} }
bool options_imp::isPeerProxyAuthEnabled() const{ bool options_imp::isPeerProxyAuthEnabled() const{
return checkProxyAuth->isChecked(); return checkProxyAuth->isChecked();
} }
QString options_imp::getPeerProxyIp() const{ QString options_imp::getPeerProxyIp() const{
QString ip = textProxyIP->text(); QString ip = textProxyIP->text();
ip = ip.trimmed(); ip = ip.trimmed();
return ip; return ip;
} }
QString options_imp::getHTTPProxyIp() const{ QString options_imp::getHTTPProxyIp() const{
QString ip = textProxyIP_http->text(); QString ip = textProxyIP_http->text();
ip = ip.trimmed(); ip = ip.trimmed();
return ip; return ip;
} }
unsigned short options_imp::getPeerProxyPort() const{ unsigned short options_imp::getPeerProxyPort() const{
return spinProxyPort->value(); return spinProxyPort->value();
} }
unsigned short options_imp::getHTTPProxyPort() const{ unsigned short options_imp::getHTTPProxyPort() const{
return spinProxyPort_http->value(); return spinProxyPort_http->value();
} }
QString options_imp::getPeerProxyUsername() const{ QString options_imp::getPeerProxyUsername() const{
QString username = textProxyUsername->text(); QString username = textProxyUsername->text();
username = username.trimmed(); username = username.trimmed();
return username; return username;
} }
QString options_imp::getHTTPProxyUsername() const{ QString options_imp::getHTTPProxyUsername() const{
QString username = textProxyUsername_http->text(); QString username = textProxyUsername_http->text();
username = username.trimmed(); username = username.trimmed();
return username; return username;
} }
QString options_imp::getPeerProxyPassword() const{ QString options_imp::getPeerProxyPassword() const{
QString password = textProxyPassword->text(); QString password = textProxyPassword->text();
password = password.trimmed(); password = password.trimmed();
return password; return password;
} }
QString options_imp::getHTTPProxyPassword() const{ QString options_imp::getHTTPProxyPassword() const{
QString password = textProxyPassword_http->text(); QString password = textProxyPassword_http->text();
password = password.trimmed(); password = password.trimmed();
return password; return password;
} }
// Locale Settings // Locale Settings
QString options_imp::getLocale() const{ QString options_imp::getLocale() const{
return locales.at(comboI18n->currentIndex()); return locales.at(comboI18n->currentIndex());
} }
void options_imp::setLocale(QString locale){ void options_imp::setLocale(QString locale){
int indexLocales=locales.indexOf(QRegExp(locale)); int indexLocales=locales.indexOf(QRegExp(locale));
if(indexLocales != -1){ if(indexLocales != -1){
comboI18n->setCurrentIndex(indexLocales); comboI18n->setCurrentIndex(indexLocales);
} }
} }
QString options_imp::getExportDir() const { QString options_imp::getExportDir() const {
if(checkExportDir->isChecked()){ if(checkExportDir->isChecked()){
return misc::expandPath(textExportDir->text()); return misc::expandPath(textExportDir->text());
}else{ }else{
return QString::null; return QString::null;
} }
} }
// Return action on double-click on a downloading torrent set in options // Return action on double-click on a downloading torrent set in options
int options_imp::getActionOnDblClOnTorrentDl() const { int options_imp::getActionOnDblClOnTorrentDl() const {
if(actionTorrentDlOnDblClBox->currentIndex()<1) if(actionTorrentDlOnDblClBox->currentIndex()<1)
return 0; return 0;
return actionTorrentDlOnDblClBox->currentIndex(); return actionTorrentDlOnDblClBox->currentIndex();
} }
// Return action on double-click on a finished torrent set in options // Return action on double-click on a finished torrent set in options
int options_imp::getActionOnDblClOnTorrentFn() const { int options_imp::getActionOnDblClOnTorrentFn() const {
if(actionTorrentFnOnDblClBox->currentIndex()<1) if(actionTorrentFnOnDblClBox->currentIndex()<1)
return 0; return 0;
return actionTorrentFnOnDblClBox->currentIndex(); 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")); const QString dir = QFileDialog::getExistingDirectory(this, tr("Add directory to scan"));
if (!dir.isEmpty()) { if (!dir.isEmpty()) {
const ScanFoldersModel::PathStatus status = ScanFoldersModel::instance()->addPath(dir, false); const ScanFoldersModel::PathStatus status = ScanFoldersModel::instance()->addPath(dir, false);
@ -1403,22 +1400,22 @@ void options_imp::on_addScanFolderButton_clicked() {
QMessageBox::warning(this, tr("Failure"), tr("Failed to add Scan Folder '%1': %2").arg(dir).arg(error)); 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 const QModelIndexList &selected
= scanFoldersView->selectionModel()->selectedIndexes(); = scanFoldersView->selectionModel()->selectedIndexes();
if (selected.isEmpty()) if (selected.isEmpty())
return; return;
Q_ASSERT(selected.count() == ScanFoldersModel::instance()->columnCount()); Q_ASSERT(selected.count() == ScanFoldersModel::instance()->columnCount());
ScanFoldersModel::instance()->removePath(selected.first().row()); ScanFoldersModel::instance()->removePath(selected.first().row());
} }
void options_imp::handleScanFolderViewSelectionChanged() { void options_imp::handleScanFolderViewSelectionChanged() {
removeScanFolderButton->setEnabled(!scanFoldersView->selectionModel()->selectedIndexes().isEmpty()); 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()); QString export_path = misc::expandPath(textExportDir->text());
QDir exportDir(export_path); QDir exportDir(export_path);
QString dir; QString dir;
@ -1433,9 +1430,9 @@ void options_imp::on_browseExportDirButton_clicked() {
#endif #endif
textExportDir->setText(dir); textExportDir->setText(dir);
} }
} }
void options_imp::on_browseFilterButton_clicked() { void options_imp::on_browseFilterButton_clicked() {
QString filter_path = misc::expandPath(textFilterPath->text()); QString filter_path = misc::expandPath(textFilterPath->text());
QDir filterDir(filter_path); QDir filterDir(filter_path);
QString ipfilter; QString ipfilter;
@ -1450,10 +1447,10 @@ void options_imp::on_browseFilterButton_clicked() {
#endif #endif
textFilterPath->setText(ipfilter); textFilterPath->setText(ipfilter);
} }
} }
// Display dialog to choose save dir // Display dialog to choose save dir
void options_imp::on_browseSaveDirButton_clicked(){ void options_imp::on_browseSaveDirButton_clicked(){
QString save_path = misc::expandPath(textSavePath->text()); QString save_path = misc::expandPath(textSavePath->text());
QDir saveDir(save_path); QDir saveDir(save_path);
QString dir; QString dir;
@ -1468,9 +1465,9 @@ void options_imp::on_browseSaveDirButton_clicked(){
#endif #endif
textSavePath->setText(dir); textSavePath->setText(dir);
} }
} }
void options_imp::on_browseTempDirButton_clicked(){ void options_imp::on_browseTempDirButton_clicked(){
QString temp_path = misc::expandPath(textTempPath->text()); QString temp_path = misc::expandPath(textTempPath->text());
QDir tempDir(temp_path); QDir tempDir(temp_path);
QString dir; QString dir;
@ -1485,36 +1482,36 @@ void options_imp::on_browseTempDirButton_clicked(){
#endif #endif
textTempPath->setText(dir); textTempPath->setText(dir);
} }
} }
// Return Filter object to apply to BT session // Return Filter object to apply to BT session
QString options_imp::getFilter() const{ QString options_imp::getFilter() const{
return textFilterPath->text(); return textFilterPath->text();
} }
// Web UI // Web UI
void options_imp::enableWebUi(bool checkBoxValue){ void options_imp::enableWebUi(bool checkBoxValue){
groupWebUiServer->setEnabled(checkBoxValue); groupWebUiServer->setEnabled(checkBoxValue);
groupWebUiAuth->setEnabled(checkBoxValue); groupWebUiAuth->setEnabled(checkBoxValue);
} }
bool options_imp::isWebUiEnabled() const bool options_imp::isWebUiEnabled() const
{ {
return checkWebUi->isChecked(); return checkWebUi->isChecked();
} }
quint16 options_imp::webUiPort() const quint16 options_imp::webUiPort() const
{ {
return spinWebUiPort->value(); return spinWebUiPort->value();
} }
QString options_imp::webUiUsername() const QString options_imp::webUiUsername() const
{ {
return textWebUiUsername->text(); return textWebUiUsername->text();
} }
QString options_imp::webUiPassword() const QString options_imp::webUiPassword() const
{ {
return textWebUiPassword->text(); return textWebUiPassword->text();
} }

34
src/ui/confirmdeletiondlg.ui

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>399</width> <width>463</width>
<height>143</height> <height>152</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -59,6 +59,31 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="rememberBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remember choice</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/encrypted.png</normaloff>:/Icons/oxygen/encrypted.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkPermDelete"> <widget class="QCheckBox" name="checkPermDelete">
<property name="sizePolicy"> <property name="sizePolicy">
@ -73,10 +98,12 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Delete the files on the hard disk as well</string> <string>Also delete the files on the hard disk</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy"> <property name="sizePolicy">
@ -97,7 +124,6 @@
</widget> </widget>
<resources> <resources>
<include location="../icons.qrc"/> <include location="../icons.qrc"/>
<include location="icons.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>

63
src/ui/options.ui

@ -240,16 +240,16 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-24</y>
<width>524</width> <width>506</width>
<height>406</height> <height>430</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
<item> <item>
<widget class="QGroupBox" name="UISettingsBox"> <widget class="QGroupBox" name="UISettingsBox">
<property name="title"> <property name="title">
<string>User interface</string> <string>Visual Appearance</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8">
<property name="bottomMargin"> <property name="bottomMargin">
@ -338,20 +338,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QCheckBox" name="checkNoSplash">
<property name="text">
<string>Disable splash screen</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkDeleteTorrentFiles">
<property name="text">
<string>On torrent deletion, also delete files on hard disk as a default</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -475,40 +461,47 @@
<item> <item>
<widget class="QGroupBox" name="systrayBox"> <widget class="QGroupBox" name="systrayBox">
<property name="title"> <property name="title">
<string>System tray icon</string> <string>Desktop</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_12">
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item>
<widget class="QCheckBox" name="checkNoSystray"> <widget class="QCheckBox" name="checkShowSplash">
<property name="text"> <property name="text">
<string>Disable system tray icon</string> <string>Show splash screen on start up</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item>
<widget class="QCheckBox" name="checkMinimizeToSysTray"> <widget class="QCheckBox" name="checkStartMinimized">
<property name="text"> <property name="text">
<string>Minimize to tray</string> <string>Start qBittorrent minimized</string>
</property> </property>
<property name="checked"> </widget>
<bool>false</bool> </item>
<item>
<widget class="QCheckBox" name="checkShowSystray">
<property name="text">
<string>Show qBittorrent icon in notification area</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QCheckBox" name="checkCloseToSystray"> <widget class="QCheckBox" name="checkMinimizeToSysTray">
<property name="text"> <property name="text">
<string comment="i.e: The systray tray icon will still be visible when closing the main window.">Close to tray</string> <string>Minimize qBittorrent to notification area</string>
</property>
<property name="checked">
<bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item>
<widget class="QCheckBox" name="checkStartMinimized"> <widget class="QCheckBox" name="checkCloseToSystray">
<property name="text"> <property name="text">
<string>Start minimized</string> <string comment="i.e: The systray tray icon will still be visible when closing the main window.">Close qBittorrent to notification area</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -3089,10 +3082,8 @@ QGroupBox {
<tabstop>tabOption</tabstop> <tabstop>tabOption</tabstop>
<tabstop>comboI18n</tabstop> <tabstop>comboI18n</tabstop>
<tabstop>comboStyle</tabstop> <tabstop>comboStyle</tabstop>
<tabstop>checkNoSystray</tabstop>
<tabstop>checkCloseToSystray</tabstop> <tabstop>checkCloseToSystray</tabstop>
<tabstop>checkMinimizeToSysTray</tabstop> <tabstop>checkMinimizeToSysTray</tabstop>
<tabstop>checkStartMinimized</tabstop>
<tabstop>textSavePath</tabstop> <tabstop>textSavePath</tabstop>
<tabstop>browseSaveDirButton</tabstop> <tabstop>browseSaveDirButton</tabstop>
<tabstop>checkPreallocateAll</tabstop> <tabstop>checkPreallocateAll</tabstop>

Loading…
Cancel
Save