Browse Source

Simplify the code a bit now that QIniSettings uses qBittorrent / qBittorrent by default

adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
da3406b811
  1. 16
      src/addnewtorrentdialog.cpp
  2. 4
      src/dnsupdater.cpp
  3. 2
      src/main.cpp
  4. 8
      src/mainwindow.cpp
  5. 4
      src/preferences/options_imp.cpp
  6. 4
      src/properties/peerlistwidget.cpp
  7. 4
      src/properties/propertieswidget.cpp
  8. 4
      src/properties/trackerlist.cpp
  9. 2
      src/qtlibtorrent/qbtsession.cpp
  10. 4
      src/rss/automatedrssdownloader.cpp
  11. 8
      src/rss/rss_imp.cpp
  12. 4
      src/searchengine/searchengine.cpp
  13. 2
      src/searchengine/searchtab.cpp
  14. 4
      src/searchengine/supportedengines.h
  15. 14
      src/torrentcreator/torrentcreatordlg.cpp
  16. 10
      src/torrentimportdlg.cpp
  17. 4
      src/transferlistfilterswidget.h
  18. 6
      src/transferlistwidget.cpp

16
src/addnewtorrentdialog.cpp

@ -62,7 +62,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent) : @@ -62,7 +62,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent) :
{
ui->setupUi(this);
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
Preferences pref;
ui->start_torrent_cb->setChecked(!pref.addTorrentsInPause());
ui->save_path_combo->addItem(fsutils::toDisplayPath(pref.getSavePath()), pref.getSavePath());
@ -93,7 +93,7 @@ AddNewTorrentDialog::~AddNewTorrentDialog() @@ -93,7 +93,7 @@ AddNewTorrentDialog::~AddNewTorrentDialog()
void AddNewTorrentDialog::loadState()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.beginGroup(QString::fromUtf8("AddNewTorrentDialog"));
QByteArray state = settings.value("treeHeaderState").toByteArray();
if (!state.isEmpty())
@ -109,7 +109,7 @@ void AddNewTorrentDialog::loadState() @@ -109,7 +109,7 @@ void AddNewTorrentDialog::loadState()
void AddNewTorrentDialog::saveState()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.beginGroup(QString::fromUtf8("AddNewTorrentDialog"));
if (m_contentModel)
settings.setValue("treeHeaderState", ui->content_tree->header()->saveState());
@ -229,7 +229,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString @@ -229,7 +229,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString
}
}
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
showAdvancedSettings(settings.value("AddNewTorrentDialog/expanded").toBool());
// Set dialog position
setdialogPosition();
@ -251,7 +251,7 @@ bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri) @@ -251,7 +251,7 @@ bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri)
QString torrent_name = misc::magnetUriToName(m_url);
setWindowTitle(torrent_name.isEmpty() ? tr("Magnet link") : torrent_name);
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
showAdvancedSettings(settings.value("AddNewTorrentDialog/expanded").toBool());
// Set dialog position
setdialogPosition();
@ -262,7 +262,7 @@ bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri) @@ -262,7 +262,7 @@ bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri)
void AddNewTorrentDialog::saveSavePathHistory() const
{
QDir selected_save_path(ui->save_path_combo->itemData(ui->save_path_combo->currentIndex()).toString());
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
// Get current history
QStringList history = settings.value("TorrentAdditionDlg/save_path_history").toStringList();
QList<QDir> history_dirs;
@ -488,7 +488,7 @@ void AddNewTorrentDialog::setdialogPosition() @@ -488,7 +488,7 @@ void AddNewTorrentDialog::setdialogPosition()
qApp->processEvents();
QPoint center(misc::screenCenter(this));
// Adjust y
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
int y = settings.value("AddNewTorrentDialog/y", -1).toInt();
if (y >= 0) {
center.setY(y);
@ -502,7 +502,7 @@ void AddNewTorrentDialog::setdialogPosition() @@ -502,7 +502,7 @@ void AddNewTorrentDialog::setdialogPosition()
void AddNewTorrentDialog::loadSavePathHistory()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
QDir default_save_path(Preferences().getSavePath());
// Load save path history
QStringList raw_path_history = settings.value("TorrentAdditionDlg/save_path_history").toStringList();

4
src/dnsupdater.cpp

@ -40,7 +40,7 @@ DNSUpdater::DNSUpdater(QObject *parent) : @@ -40,7 +40,7 @@ DNSUpdater::DNSUpdater(QObject *parent) :
updateCredentials();
// Load saved settings from previous session
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
m_lastIPCheckTime = settings.value("DNSUpdater/lastUpdateTime").toDateTime();
m_lastIP = QHostAddress(settings.value("DNSUpdater/lastIP").toString());
@ -58,7 +58,7 @@ DNSUpdater::DNSUpdater(QObject *parent) : @@ -58,7 +58,7 @@ DNSUpdater::DNSUpdater(QObject *parent) :
DNSUpdater::~DNSUpdater() {
// Save lastupdate time and last ip
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
settings.setValue("DNSUpdater/lastUpdateTime", m_lastIPCheckTime);
settings.setValue("DNSUpdater/lastIP", m_lastIP.toString());
}

2
src/main.cpp

@ -98,7 +98,7 @@ class LegalNotice: public QObject { @@ -98,7 +98,7 @@ class LegalNotice: public QObject {
public:
static bool userAgreesWithNotice() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
if (settings.value(QString::fromUtf8("LegalNotice/Accepted"), false).toBool()) // Already accepted once
return true;
#ifdef DISABLE_GUI

8
src/mainwindow.cpp

@ -491,7 +491,7 @@ void MainWindow::tab_changed(int new_tab) { @@ -491,7 +491,7 @@ void MainWindow::tab_changed(int new_tab) {
}
void MainWindow::writeSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.beginGroup(QString::fromUtf8("MainWindow"));
settings.setValue("geometry", saveGeometry());
// Splitter size
@ -501,7 +501,7 @@ void MainWindow::writeSettings() { @@ -501,7 +501,7 @@ void MainWindow::writeSettings() {
}
void MainWindow::readSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.beginGroup(QString::fromUtf8("MainWindow"));
if (settings.contains("geometry")) {
if (restoreGeometry(settings.value("geometry").toByteArray()))
@ -922,7 +922,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) { @@ -922,7 +922,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) {
// torrents to download list
void MainWindow::on_actionOpen_triggered() {
Preferences pref;
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
// Open File Open Dialog
// Note: it is possible to select more than one file
const QStringList pathsList = QFileDialog::getOpenFileNames(0,
@ -1172,7 +1172,7 @@ void MainWindow::showNotificationBaloon(QString title, QString msg) const { @@ -1172,7 +1172,7 @@ void MainWindow::showNotificationBaloon(QString title, QString msg) const {
*****************************************************/
void MainWindow::downloadFromURLList(const QStringList& url_list) {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
foreach (QString url, url_list) {
if (url.startsWith("bc://bt/", Qt::CaseInsensitive)) {

4
src/preferences/options_imp.cpp

@ -300,7 +300,7 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous @@ -300,7 +300,7 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
}
void options_imp::loadWindowState() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
resize(settings.value(QString::fromUtf8("Preferences/State/size"), sizeFittingScreen()).toSize());
QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint();
if (!p.isNull())
@ -320,7 +320,7 @@ void options_imp::loadWindowState() { @@ -320,7 +320,7 @@ void options_imp::loadWindowState() {
}
void options_imp::saveWindowState() const {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.setValue(QString::fromUtf8("Preferences/State/size"), size());
settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos());
// Splitter size

4
src/properties/peerlistwidget.cpp

@ -295,12 +295,12 @@ void PeerListWidget::clear() { @@ -295,12 +295,12 @@ void PeerListWidget::clear() {
}
void PeerListWidget::loadSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
header()->restoreState(settings.value("TorrentProperties/Peers/PeerListState").toByteArray());
}
void PeerListWidget::saveSettings() const {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.setValue("TorrentProperties/Peers/PeerListState", header()->saveState());
}

4
src/properties/propertieswidget.cpp

@ -268,7 +268,7 @@ void PropertiesWidget::loadTorrentInfos(const QTorrentHandle& _h) @@ -268,7 +268,7 @@ void PropertiesWidget::loadTorrentInfos(const QTorrentHandle& _h)
}
void PropertiesWidget::readSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
// Restore splitter sizes
QStringList sizes_str = settings.value(QString::fromUtf8("TorrentProperties/SplitterSizes"), QString()).toString().split(",");
if (sizes_str.size() == 2) {
@ -288,7 +288,7 @@ void PropertiesWidget::readSettings() { @@ -288,7 +288,7 @@ void PropertiesWidget::readSettings() {
}
void PropertiesWidget::saveSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
// Splitter sizes
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());

4
src/properties/trackerlist.cpp

@ -440,7 +440,7 @@ void TrackerList::showTrackerListMenu(QPoint) { @@ -440,7 +440,7 @@ void TrackerList::showTrackerListMenu(QPoint) {
}
void TrackerList::loadSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
if (!header()->restoreState(settings.value("TorrentProperties/Trackers/TrackerListState").toByteArray())) {
setColumnWidth(0, 30);
setColumnWidth(1, 300);
@ -448,6 +448,6 @@ void TrackerList::loadSettings() { @@ -448,6 +448,6 @@ void TrackerList::loadSettings() {
}
void TrackerList::saveSettings() const {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.setValue("TorrentProperties/Trackers/TrackerListState", header()->saveState());
}

2
src/qtlibtorrent/qbtsession.cpp

@ -2790,7 +2790,7 @@ void QBtSession::startUpTorrents() { @@ -2790,7 +2790,7 @@ void QBtSession::startUpTorrents() {
addTorrent(torrentBackup.path()+QDir::separator()+hash+".torrent", false, QString(), true);
}
}
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
settings.setValue("ported_to_new_savepath_system", true);
qDebug("Unfinished torrents resumed");
}

4
src/rss/automatedrssdownloader.cpp

@ -108,7 +108,7 @@ AutomatedRssDownloader::~AutomatedRssDownloader() @@ -108,7 +108,7 @@ AutomatedRssDownloader::~AutomatedRssDownloader()
void AutomatedRssDownloader::loadSettings()
{
// load dialog geometry
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
restoreGeometry(settings.value("RssFeedDownloader/geometry").toByteArray());
ui->checkEnableDownloader->setChecked(RssSettings().isRssDownloadingEnabled());
ui->hsplitter->restoreState(settings.value("RssFeedDownloader/hsplitterSizes").toByteArray());
@ -120,7 +120,7 @@ void AutomatedRssDownloader::saveSettings() @@ -120,7 +120,7 @@ void AutomatedRssDownloader::saveSettings()
{
RssSettings().setRssDownloadingEnabled(ui->checkEnableDownloader->isChecked());
// Save dialog geometry
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
settings.setValue("RssFeedDownloader/geometry", saveGeometry());
settings.setValue("RssFeedDownloader/hsplitterSizes", ui->hsplitter->saveState());
}

8
src/rss/rss_imp.cpp

@ -281,7 +281,7 @@ void RSSImp::deleteSelectedItems() @@ -281,7 +281,7 @@ void RSSImp::deleteSelectedItems()
void RSSImp::loadFoldersOpenState()
{
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
settings.beginGroup("Rss");
QStringList open_folders = settings.value("open_folders", QStringList()).toStringList();
settings.endGroup();
@ -320,7 +320,7 @@ void RSSImp::saveFoldersOpenState() @@ -320,7 +320,7 @@ void RSSImp::saveFoldersOpenState()
qDebug("saving open folder: %s", qPrintable(path));
open_folders << path;
}
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
settings.beginGroup("Rss");
settings.setValue("open_folders", open_folders);
settings.endGroup();
@ -578,7 +578,7 @@ void RSSImp::refreshTextBrowser() @@ -578,7 +578,7 @@ void RSSImp::refreshTextBrowser()
void RSSImp::saveSlidersPosition()
{
// Remember sliders positions
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
settings.setValue("rss/splitter_h", splitter_h->saveState());
settings.setValue("rss/splitter_v", splitter_v->saveState());
qDebug("Splitters position saved");
@ -586,7 +586,7 @@ void RSSImp::saveSlidersPosition() @@ -586,7 +586,7 @@ void RSSImp::saveSlidersPosition()
void RSSImp::restoreSlidersPosition()
{
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
QByteArray pos_h = settings.value("rss/splitter_h", QByteArray()).toByteArray();
if (!pos_h.isNull()) {
splitter_h->restoreState(pos_h);

4
src/searchengine/searchengine.cpp

@ -301,7 +301,7 @@ void SearchEngine::propagateSectionResized(int index, int , int newsize) { @@ -301,7 +301,7 @@ void SearchEngine::propagateSectionResized(int index, int , int newsize) {
void SearchEngine::saveResultsColumnsWidth() {
if (all_tab.size() > 0) {
QTreeView* treeview = all_tab.first()->getCurrentTreeView();
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
QStringList width_list;
QStringList new_width_list;
short nbColumns = all_tab.first()->getCurrentSearchListModel()->columnCount();
@ -486,7 +486,7 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus) { @@ -486,7 +486,7 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus) {
if (searchTimeout->isActive()) {
searchTimeout->stop();
}
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool();
if (useNotificationBalloons && mp_mainWindow->getCurrentTabWidget() != this) {
mp_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has finished"));

2
src/searchengine/searchtab.cpp

@ -106,7 +106,7 @@ QHeaderView* SearchTab::header() const { @@ -106,7 +106,7 @@ QHeaderView* SearchTab::header() const {
}
bool SearchTab::loadColWidthResultsList() {
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
QString line = settings.value("SearchResultsColsWidth", QString()).toString();
if (line.isEmpty())
return false;

4
src/searchengine/supportedengines.h

@ -75,7 +75,7 @@ public: @@ -75,7 +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(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
QStringList disabled_engines = settings.value(QString::fromUtf8("SearchEngines/disabledEngines"), QStringList()).toStringList();
enabled = !disabled_engines.contains(name);
}
@ -88,7 +88,7 @@ public: @@ -88,7 +88,7 @@ public:
void setEnabled(bool _enabled) {
enabled = _enabled;
// Save to Hard disk
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
QStringList disabled_engines = settings.value(QString::fromUtf8("SearchEngines/disabledEngines"), QStringList()).toStringList();
if (enabled) {
disabled_engines.removeAll(name);

14
src/torrentcreator/torrentcreatordlg.cpp

@ -69,7 +69,7 @@ TorrentCreatorDlg::~TorrentCreatorDlg() { @@ -69,7 +69,7 @@ TorrentCreatorDlg::~TorrentCreatorDlg() {
}
void TorrentCreatorDlg::on_addFolder_button_clicked() {
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
QString last_path = settings.value("CreateTorrent/last_add_path", QDir::homePath()).toString();
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), last_path, QFileDialog::ShowDirsOnly);
if (!dir.isEmpty()) {
@ -85,7 +85,7 @@ void TorrentCreatorDlg::on_addFolder_button_clicked() { @@ -85,7 +85,7 @@ void TorrentCreatorDlg::on_addFolder_button_clicked() {
}
void TorrentCreatorDlg::on_addFile_button_clicked() {
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
QString last_path = settings.value("CreateTorrent/last_add_path", QDir::homePath()).toString();
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), last_path);
if (!file.isEmpty()) {
@ -117,7 +117,7 @@ void TorrentCreatorDlg::on_createButton_clicked() { @@ -117,7 +117,7 @@ void TorrentCreatorDlg::on_createButton_clicked() {
if (!trackers_list->toPlainText().trimmed().isEmpty())
saveTrackerList();
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
QString last_path = settings.value("CreateTorrent/last_save_path", QDir::homePath()).toString();
QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), last_path, tr("Torrent Files")+QString::fromUtf8(" (*.torrent)"));
@ -246,25 +246,25 @@ void TorrentCreatorDlg::updateOptimalPieceSize() @@ -246,25 +246,25 @@ void TorrentCreatorDlg::updateOptimalPieceSize()
void TorrentCreatorDlg::saveTrackerList()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.setValue("CreateTorrent/TrackerList", trackers_list->toPlainText());
}
void TorrentCreatorDlg::loadTrackerList()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
trackers_list->setPlainText(settings.value("CreateTorrent/TrackerList", "").toString());
}
void TorrentCreatorDlg::saveSettings()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.setValue("CreateTorrent/dimensions", saveGeometry());
}
void TorrentCreatorDlg::loadSettings()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
restoreGeometry(settings.value("CreateTorrent/dimensions").toByteArray());
}

10
src/torrentimportdlg.cpp

@ -62,7 +62,7 @@ TorrentImportDlg::~TorrentImportDlg() @@ -62,7 +62,7 @@ TorrentImportDlg::~TorrentImportDlg()
void TorrentImportDlg::on_browseTorrentBtn_clicked()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
const QString default_dir = settings.value(QString::fromUtf8("MainWindowLastDir"), QDir::homePath()).toString();
// Ask for a torrent file
m_torrentPath = QFileDialog::getOpenFileName(this, tr("Torrent file to import"), default_dir, tr("Torrent files (*.torrent)"));
@ -75,7 +75,7 @@ void TorrentImportDlg::on_browseTorrentBtn_clicked() @@ -75,7 +75,7 @@ void TorrentImportDlg::on_browseTorrentBtn_clicked()
void TorrentImportDlg::on_browseContentBtn_clicked()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
const QString default_dir = settings.value(QString::fromUtf8("TorrentImport/LastContentDir"), QDir::homePath()).toString();
if (t->num_files() == 1) {
// Single file torrent
@ -213,7 +213,7 @@ void TorrentImportDlg::importTorrent() @@ -213,7 +213,7 @@ void TorrentImportDlg::importTorrent()
qDebug("Adding the torrent to the session...");
QBtSession::instance()->addTorrent(torrent_path);
// Remember the last opened folder
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.setValue(QString::fromUtf8("MainWindowLastDir"), torrent_path);
settings.setValue("TorrentImport/LastContentDir", content_path);
return;
@ -278,13 +278,13 @@ bool TorrentImportDlg::skipFileChecking() const @@ -278,13 +278,13 @@ bool TorrentImportDlg::skipFileChecking() const
void TorrentImportDlg::loadSettings()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
restoreGeometry(settings.value("TorrentImportDlg/dimensions").toByteArray());
}
void TorrentImportDlg::saveSettings()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.setValue("TorrentImportDlg/dimensions", saveGeometry());
}

4
src/transferlistfilterswidget.h

@ -281,7 +281,7 @@ public: @@ -281,7 +281,7 @@ public:
}
void saveSettings() const {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
settings.beginGroup(QString::fromUtf8("TransferListFilters"));
settings.setValue("selectedFilterIndex", QVariant(statusFilters->currentRow()));
//settings.setValue("selectedLabelIndex", QVariant(labelFilters->currentRow()));
@ -289,7 +289,7 @@ public: @@ -289,7 +289,7 @@ public:
}
void loadSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
statusFilters->setCurrentRow(settings.value("TransferListFilters/selectedFilterIndex", 0).toInt());
const QStringList label_list = Preferences().getTorrentLabels();
foreach (const QString &label, label_list) {

6
src/transferlistwidget.cpp

@ -185,7 +185,7 @@ inline QModelIndex TransferListWidget::mapFromSource(const QModelIndex &index) c @@ -185,7 +185,7 @@ inline QModelIndex TransferListWidget::mapFromSource(const QModelIndex &index) c
QStringList TransferListWidget::getCustomLabels() const {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QIniSettings settings;
return settings.value("TransferListFilters/customLabels", QStringList()).toStringList();
}
@ -900,13 +900,13 @@ void TransferListWidget::applyStatusFilter(int f) { @@ -900,13 +900,13 @@ void TransferListWidget::applyStatusFilter(int f) {
void TransferListWidget::saveSettings()
{
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
settings.setValue("TransferList/HeaderState", header()->saveState());
}
bool TransferListWidget::loadSettings()
{
QIniSettings settings("qBittorrent", "qBittorrent");
QIniSettings settings;
bool ok = header()->restoreState(settings.value("TransferList/HeaderState").toByteArray());
if (!ok) {
header()->resizeSection(0, 200); // Default

Loading…
Cancel
Save