mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 22:52:33 -06:00
Migrate everything to use the new Preferences class and not access directly the qbittorrent.ini file.
This commit is contained in:
@@ -54,7 +54,6 @@
|
||||
#include "misc.h"
|
||||
#include "preferences.h"
|
||||
#include "searchlistdelegate.h"
|
||||
#include "qinisettings.h"
|
||||
#include "mainwindow.h"
|
||||
#include "iconprovider.h"
|
||||
#include "lineedit.h"
|
||||
@@ -301,12 +300,12 @@ void SearchEngine::propagateSectionResized(int index, int , int newsize) {
|
||||
void SearchEngine::saveResultsColumnsWidth() {
|
||||
if (all_tab.size() > 0) {
|
||||
QTreeView* treeview = all_tab.first()->getCurrentTreeView();
|
||||
QIniSettings settings;
|
||||
Preferences* const pref = Preferences::instance();
|
||||
QStringList width_list;
|
||||
QStringList new_width_list;
|
||||
short nbColumns = all_tab.first()->getCurrentSearchListModel()->columnCount();
|
||||
|
||||
QString line = settings.value("SearchResultsColsWidth", QString()).toString();
|
||||
QString line = pref->getSearchColsWidth();
|
||||
if (!line.isEmpty()) {
|
||||
width_list = line.split(' ');
|
||||
}
|
||||
@@ -323,7 +322,7 @@ void SearchEngine::saveResultsColumnsWidth() {
|
||||
new_width_list << QString::number(treeview->columnWidth(i));
|
||||
}
|
||||
}
|
||||
settings.setValue("SearchResultsColsWidth", new_width_list.join(" "));
|
||||
pref->setSearchColsWidth(new_width_list.join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,8 +485,7 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus) {
|
||||
if (searchTimeout->isActive()) {
|
||||
searchTimeout->stop();
|
||||
}
|
||||
QIniSettings settings;
|
||||
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool();
|
||||
bool useNotificationBalloons = Preferences::instance()->useProgramNotification();
|
||||
if (useNotificationBalloons && mp_mainWindow->getCurrentTabWidget() != this) {
|
||||
mp_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has finished"));
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "searchlistdelegate.h"
|
||||
#include "misc.h"
|
||||
#include "searchengine.h"
|
||||
#include "qinisettings.h"
|
||||
#include "preferences.h"
|
||||
|
||||
SearchTab::SearchTab(SearchEngine *parent) : QWidget(), parent(parent)
|
||||
{
|
||||
@@ -106,8 +106,7 @@ QHeaderView* SearchTab::header() const {
|
||||
}
|
||||
|
||||
bool SearchTab::loadColWidthResultsList() {
|
||||
QIniSettings settings;
|
||||
QString line = settings.value("SearchResultsColsWidth", QString()).toString();
|
||||
QString line = Preferences::instance()->getSearchColsWidth();
|
||||
if (line.isEmpty())
|
||||
return false;
|
||||
QStringList width_list = line.split(' ');
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "fs_utils.h"
|
||||
#include "qinisettings.h"
|
||||
#include "preferences.h"
|
||||
|
||||
class SearchCategories: public QObject, public QHash<QString, QString> {
|
||||
Q_OBJECT
|
||||
@@ -75,8 +75,7 @@ public:
|
||||
full_name = engine_elem.elementsByTagName("name").at(0).toElement().text();
|
||||
url = engine_elem.elementsByTagName("url").at(0).toElement().text();
|
||||
supported_categories = engine_elem.elementsByTagName("categories").at(0).toElement().text().split(" ");
|
||||
QIniSettings settings;
|
||||
QStringList disabled_engines = settings.value(QString::fromUtf8("SearchEngines/disabledEngines"), QStringList()).toStringList();
|
||||
QStringList disabled_engines = Preferences::instance()->getSearchEngDisabled();
|
||||
enabled = !disabled_engines.contains(name);
|
||||
}
|
||||
|
||||
@@ -88,14 +87,14 @@ public:
|
||||
void setEnabled(bool _enabled) {
|
||||
enabled = _enabled;
|
||||
// Save to Hard disk
|
||||
QIniSettings settings;
|
||||
QStringList disabled_engines = settings.value(QString::fromUtf8("SearchEngines/disabledEngines"), QStringList()).toStringList();
|
||||
Preferences* const pref = Preferences::instance();
|
||||
QStringList disabled_engines = pref->getSearchEngDisabled();
|
||||
if (enabled) {
|
||||
disabled_engines.removeAll(name);
|
||||
} else {
|
||||
disabled_engines.append(name);
|
||||
}
|
||||
settings.setValue("SearchEngines/disabledEngines", disabled_engines);
|
||||
pref->setSearchEngDisabled(disabled_engines);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user