Still simplifying program options

This commit is contained in:
Christophe Dumez 2010-06-21 19:20:58 +00:00
parent 8b5886cc6e
commit 08a08e4b24
4 changed files with 1365 additions and 1341 deletions

View file

@ -44,6 +44,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
setupUi(this);
move(misc::screenCenter(this));
checkPermDelete->setChecked(Preferences::deleteTorrentFilesAsDefault());
connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));
buttonBox->setFocus();
}
@ -60,6 +61,15 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
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

View file

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

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>143</height>
<width>463</width>
<height>152</height>
</rect>
</property>
<property name="sizePolicy">
@ -59,6 +59,31 @@
</item>
</layout>
</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>
<widget class="QCheckBox" name="checkPermDelete">
<property name="sizePolicy">
@ -73,10 +98,12 @@
</font>
</property>
<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>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
@ -97,7 +124,6 @@
</widget>
<resources>
<include location="../icons.qrc"/>
<include location="icons.qrc"/>
</resources>
<connections>
<connection>

View file

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