mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-10 12:21:12 +00:00
Simplify the code a bit now that QIniSettings uses qBittorrent / qBittorrent by default
This commit is contained in:
parent
6c753ac183
commit
da3406b811
@ -62,7 +62,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
Preferences pref;
|
Preferences pref;
|
||||||
ui->start_torrent_cb->setChecked(!pref.addTorrentsInPause());
|
ui->start_torrent_cb->setChecked(!pref.addTorrentsInPause());
|
||||||
ui->save_path_combo->addItem(fsutils::toDisplayPath(pref.getSavePath()), pref.getSavePath());
|
ui->save_path_combo->addItem(fsutils::toDisplayPath(pref.getSavePath()), pref.getSavePath());
|
||||||
@ -93,7 +93,7 @@ AddNewTorrentDialog::~AddNewTorrentDialog()
|
|||||||
|
|
||||||
void AddNewTorrentDialog::loadState()
|
void AddNewTorrentDialog::loadState()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.beginGroup(QString::fromUtf8("AddNewTorrentDialog"));
|
settings.beginGroup(QString::fromUtf8("AddNewTorrentDialog"));
|
||||||
QByteArray state = settings.value("treeHeaderState").toByteArray();
|
QByteArray state = settings.value("treeHeaderState").toByteArray();
|
||||||
if (!state.isEmpty())
|
if (!state.isEmpty())
|
||||||
@ -109,7 +109,7 @@ void AddNewTorrentDialog::loadState()
|
|||||||
|
|
||||||
void AddNewTorrentDialog::saveState()
|
void AddNewTorrentDialog::saveState()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.beginGroup(QString::fromUtf8("AddNewTorrentDialog"));
|
settings.beginGroup(QString::fromUtf8("AddNewTorrentDialog"));
|
||||||
if (m_contentModel)
|
if (m_contentModel)
|
||||||
settings.setValue("treeHeaderState", ui->content_tree->header()->saveState());
|
settings.setValue("treeHeaderState", ui->content_tree->header()->saveState());
|
||||||
@ -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());
|
showAdvancedSettings(settings.value("AddNewTorrentDialog/expanded").toBool());
|
||||||
// Set dialog position
|
// Set dialog position
|
||||||
setdialogPosition();
|
setdialogPosition();
|
||||||
@ -251,7 +251,7 @@ bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri)
|
|||||||
QString torrent_name = misc::magnetUriToName(m_url);
|
QString torrent_name = misc::magnetUriToName(m_url);
|
||||||
setWindowTitle(torrent_name.isEmpty() ? tr("Magnet link") : torrent_name);
|
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());
|
showAdvancedSettings(settings.value("AddNewTorrentDialog/expanded").toBool());
|
||||||
// Set dialog position
|
// Set dialog position
|
||||||
setdialogPosition();
|
setdialogPosition();
|
||||||
@ -262,7 +262,7 @@ bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri)
|
|||||||
void AddNewTorrentDialog::saveSavePathHistory() const
|
void AddNewTorrentDialog::saveSavePathHistory() const
|
||||||
{
|
{
|
||||||
QDir selected_save_path(ui->save_path_combo->itemData(ui->save_path_combo->currentIndex()).toString());
|
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
|
// Get current history
|
||||||
QStringList history = settings.value("TorrentAdditionDlg/save_path_history").toStringList();
|
QStringList history = settings.value("TorrentAdditionDlg/save_path_history").toStringList();
|
||||||
QList<QDir> history_dirs;
|
QList<QDir> history_dirs;
|
||||||
@ -488,7 +488,7 @@ void AddNewTorrentDialog::setdialogPosition()
|
|||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
QPoint center(misc::screenCenter(this));
|
QPoint center(misc::screenCenter(this));
|
||||||
// Adjust y
|
// Adjust y
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
int y = settings.value("AddNewTorrentDialog/y", -1).toInt();
|
int y = settings.value("AddNewTorrentDialog/y", -1).toInt();
|
||||||
if (y >= 0) {
|
if (y >= 0) {
|
||||||
center.setY(y);
|
center.setY(y);
|
||||||
@ -502,7 +502,7 @@ void AddNewTorrentDialog::setdialogPosition()
|
|||||||
|
|
||||||
void AddNewTorrentDialog::loadSavePathHistory()
|
void AddNewTorrentDialog::loadSavePathHistory()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
QDir default_save_path(Preferences().getSavePath());
|
QDir default_save_path(Preferences().getSavePath());
|
||||||
// Load save path history
|
// Load save path history
|
||||||
QStringList raw_path_history = settings.value("TorrentAdditionDlg/save_path_history").toStringList();
|
QStringList raw_path_history = settings.value("TorrentAdditionDlg/save_path_history").toStringList();
|
||||||
|
@ -40,7 +40,7 @@ DNSUpdater::DNSUpdater(QObject *parent) :
|
|||||||
updateCredentials();
|
updateCredentials();
|
||||||
|
|
||||||
// Load saved settings from previous session
|
// Load saved settings from previous session
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
m_lastIPCheckTime = settings.value("DNSUpdater/lastUpdateTime").toDateTime();
|
m_lastIPCheckTime = settings.value("DNSUpdater/lastUpdateTime").toDateTime();
|
||||||
m_lastIP = QHostAddress(settings.value("DNSUpdater/lastIP").toString());
|
m_lastIP = QHostAddress(settings.value("DNSUpdater/lastIP").toString());
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ DNSUpdater::DNSUpdater(QObject *parent) :
|
|||||||
|
|
||||||
DNSUpdater::~DNSUpdater() {
|
DNSUpdater::~DNSUpdater() {
|
||||||
// Save lastupdate time and last ip
|
// Save lastupdate time and last ip
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
settings.setValue("DNSUpdater/lastUpdateTime", m_lastIPCheckTime);
|
settings.setValue("DNSUpdater/lastUpdateTime", m_lastIPCheckTime);
|
||||||
settings.setValue("DNSUpdater/lastIP", m_lastIP.toString());
|
settings.setValue("DNSUpdater/lastIP", m_lastIP.toString());
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ class LegalNotice: public QObject {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static bool userAgreesWithNotice() {
|
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
|
if (settings.value(QString::fromUtf8("LegalNotice/Accepted"), false).toBool()) // Already accepted once
|
||||||
return true;
|
return true;
|
||||||
#ifdef DISABLE_GUI
|
#ifdef DISABLE_GUI
|
||||||
|
@ -491,7 +491,7 @@ void MainWindow::tab_changed(int new_tab) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::writeSettings() {
|
void MainWindow::writeSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||||
settings.setValue("geometry", saveGeometry());
|
settings.setValue("geometry", saveGeometry());
|
||||||
// Splitter size
|
// Splitter size
|
||||||
@ -501,7 +501,7 @@ void MainWindow::writeSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::readSettings() {
|
void MainWindow::readSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||||
if (settings.contains("geometry")) {
|
if (settings.contains("geometry")) {
|
||||||
if (restoreGeometry(settings.value("geometry").toByteArray()))
|
if (restoreGeometry(settings.value("geometry").toByteArray()))
|
||||||
@ -922,7 +922,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) {
|
|||||||
// torrents to download list
|
// torrents to download list
|
||||||
void MainWindow::on_actionOpen_triggered() {
|
void MainWindow::on_actionOpen_triggered() {
|
||||||
Preferences pref;
|
Preferences pref;
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
// Open File Open Dialog
|
// Open File Open Dialog
|
||||||
// Note: it is possible to select more than one file
|
// Note: it is possible to select more than one file
|
||||||
const QStringList pathsList = QFileDialog::getOpenFileNames(0,
|
const QStringList pathsList = QFileDialog::getOpenFileNames(0,
|
||||||
@ -1172,7 +1172,7 @@ void MainWindow::showNotificationBaloon(QString title, QString msg) const {
|
|||||||
*****************************************************/
|
*****************************************************/
|
||||||
|
|
||||||
void MainWindow::downloadFromURLList(const QStringList& url_list) {
|
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();
|
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||||
foreach (QString url, url_list) {
|
foreach (QString url, url_list) {
|
||||||
if (url.startsWith("bc://bt/", Qt::CaseInsensitive)) {
|
if (url.startsWith("bc://bt/", Qt::CaseInsensitive)) {
|
||||||
|
@ -300,7 +300,7 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
|
|||||||
}
|
}
|
||||||
|
|
||||||
void options_imp::loadWindowState() {
|
void options_imp::loadWindowState() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
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();
|
||||||
if (!p.isNull())
|
if (!p.isNull())
|
||||||
@ -320,7 +320,7 @@ void options_imp::loadWindowState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void options_imp::saveWindowState() const {
|
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/size"), size());
|
||||||
settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos());
|
settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos());
|
||||||
// Splitter size
|
// Splitter size
|
||||||
|
@ -295,12 +295,12 @@ void PeerListWidget::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PeerListWidget::loadSettings() {
|
void PeerListWidget::loadSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
header()->restoreState(settings.value("TorrentProperties/Peers/PeerListState").toByteArray());
|
header()->restoreState(settings.value("TorrentProperties/Peers/PeerListState").toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListWidget::saveSettings() const {
|
void PeerListWidget::saveSettings() const {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.setValue("TorrentProperties/Peers/PeerListState", header()->saveState());
|
settings.setValue("TorrentProperties/Peers/PeerListState", header()->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ void PropertiesWidget::loadTorrentInfos(const QTorrentHandle& _h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PropertiesWidget::readSettings() {
|
void PropertiesWidget::readSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
// Restore splitter sizes
|
// Restore splitter sizes
|
||||||
QStringList sizes_str = settings.value(QString::fromUtf8("TorrentProperties/SplitterSizes"), QString()).toString().split(",");
|
QStringList sizes_str = settings.value(QString::fromUtf8("TorrentProperties/SplitterSizes"), QString()).toString().split(",");
|
||||||
if (sizes_str.size() == 2) {
|
if (sizes_str.size() == 2) {
|
||||||
@ -288,7 +288,7 @@ void PropertiesWidget::readSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PropertiesWidget::saveSettings() {
|
void PropertiesWidget::saveSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
|
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
|
||||||
// Splitter sizes
|
// Splitter sizes
|
||||||
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
||||||
|
@ -440,7 +440,7 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::loadSettings() {
|
void TrackerList::loadSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
if (!header()->restoreState(settings.value("TorrentProperties/Trackers/TrackerListState").toByteArray())) {
|
if (!header()->restoreState(settings.value("TorrentProperties/Trackers/TrackerListState").toByteArray())) {
|
||||||
setColumnWidth(0, 30);
|
setColumnWidth(0, 30);
|
||||||
setColumnWidth(1, 300);
|
setColumnWidth(1, 300);
|
||||||
@ -448,6 +448,6 @@ void TrackerList::loadSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::saveSettings() const {
|
void TrackerList::saveSettings() const {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.setValue("TorrentProperties/Trackers/TrackerListState", header()->saveState());
|
settings.setValue("TorrentProperties/Trackers/TrackerListState", header()->saveState());
|
||||||
}
|
}
|
||||||
|
@ -2790,7 +2790,7 @@ void QBtSession::startUpTorrents() {
|
|||||||
addTorrent(torrentBackup.path()+QDir::separator()+hash+".torrent", false, QString(), true);
|
addTorrent(torrentBackup.path()+QDir::separator()+hash+".torrent", false, QString(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
settings.setValue("ported_to_new_savepath_system", true);
|
settings.setValue("ported_to_new_savepath_system", true);
|
||||||
qDebug("Unfinished torrents resumed");
|
qDebug("Unfinished torrents resumed");
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ AutomatedRssDownloader::~AutomatedRssDownloader()
|
|||||||
void AutomatedRssDownloader::loadSettings()
|
void AutomatedRssDownloader::loadSettings()
|
||||||
{
|
{
|
||||||
// load dialog geometry
|
// load dialog geometry
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
restoreGeometry(settings.value("RssFeedDownloader/geometry").toByteArray());
|
restoreGeometry(settings.value("RssFeedDownloader/geometry").toByteArray());
|
||||||
ui->checkEnableDownloader->setChecked(RssSettings().isRssDownloadingEnabled());
|
ui->checkEnableDownloader->setChecked(RssSettings().isRssDownloadingEnabled());
|
||||||
ui->hsplitter->restoreState(settings.value("RssFeedDownloader/hsplitterSizes").toByteArray());
|
ui->hsplitter->restoreState(settings.value("RssFeedDownloader/hsplitterSizes").toByteArray());
|
||||||
@ -120,7 +120,7 @@ void AutomatedRssDownloader::saveSettings()
|
|||||||
{
|
{
|
||||||
RssSettings().setRssDownloadingEnabled(ui->checkEnableDownloader->isChecked());
|
RssSettings().setRssDownloadingEnabled(ui->checkEnableDownloader->isChecked());
|
||||||
// Save dialog geometry
|
// Save dialog geometry
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
settings.setValue("RssFeedDownloader/geometry", saveGeometry());
|
settings.setValue("RssFeedDownloader/geometry", saveGeometry());
|
||||||
settings.setValue("RssFeedDownloader/hsplitterSizes", ui->hsplitter->saveState());
|
settings.setValue("RssFeedDownloader/hsplitterSizes", ui->hsplitter->saveState());
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ void RSSImp::deleteSelectedItems()
|
|||||||
|
|
||||||
void RSSImp::loadFoldersOpenState()
|
void RSSImp::loadFoldersOpenState()
|
||||||
{
|
{
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
settings.beginGroup("Rss");
|
settings.beginGroup("Rss");
|
||||||
QStringList open_folders = settings.value("open_folders", QStringList()).toStringList();
|
QStringList open_folders = settings.value("open_folders", QStringList()).toStringList();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -320,7 +320,7 @@ void RSSImp::saveFoldersOpenState()
|
|||||||
qDebug("saving open folder: %s", qPrintable(path));
|
qDebug("saving open folder: %s", qPrintable(path));
|
||||||
open_folders << path;
|
open_folders << path;
|
||||||
}
|
}
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
settings.beginGroup("Rss");
|
settings.beginGroup("Rss");
|
||||||
settings.setValue("open_folders", open_folders);
|
settings.setValue("open_folders", open_folders);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -578,7 +578,7 @@ void RSSImp::refreshTextBrowser()
|
|||||||
void RSSImp::saveSlidersPosition()
|
void RSSImp::saveSlidersPosition()
|
||||||
{
|
{
|
||||||
// Remember sliders positions
|
// Remember sliders positions
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
settings.setValue("rss/splitter_h", splitter_h->saveState());
|
settings.setValue("rss/splitter_h", splitter_h->saveState());
|
||||||
settings.setValue("rss/splitter_v", splitter_v->saveState());
|
settings.setValue("rss/splitter_v", splitter_v->saveState());
|
||||||
qDebug("Splitters position saved");
|
qDebug("Splitters position saved");
|
||||||
@ -586,7 +586,7 @@ void RSSImp::saveSlidersPosition()
|
|||||||
|
|
||||||
void RSSImp::restoreSlidersPosition()
|
void RSSImp::restoreSlidersPosition()
|
||||||
{
|
{
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
QByteArray pos_h = settings.value("rss/splitter_h", QByteArray()).toByteArray();
|
QByteArray pos_h = settings.value("rss/splitter_h", QByteArray()).toByteArray();
|
||||||
if (!pos_h.isNull()) {
|
if (!pos_h.isNull()) {
|
||||||
splitter_h->restoreState(pos_h);
|
splitter_h->restoreState(pos_h);
|
||||||
|
@ -301,7 +301,7 @@ void SearchEngine::propagateSectionResized(int index, int , int newsize) {
|
|||||||
void SearchEngine::saveResultsColumnsWidth() {
|
void SearchEngine::saveResultsColumnsWidth() {
|
||||||
if (all_tab.size() > 0) {
|
if (all_tab.size() > 0) {
|
||||||
QTreeView* treeview = all_tab.first()->getCurrentTreeView();
|
QTreeView* treeview = all_tab.first()->getCurrentTreeView();
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
QStringList width_list;
|
QStringList width_list;
|
||||||
QStringList new_width_list;
|
QStringList new_width_list;
|
||||||
short nbColumns = all_tab.first()->getCurrentSearchListModel()->columnCount();
|
short nbColumns = all_tab.first()->getCurrentSearchListModel()->columnCount();
|
||||||
@ -486,7 +486,7 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus) {
|
|||||||
if (searchTimeout->isActive()) {
|
if (searchTimeout->isActive()) {
|
||||||
searchTimeout->stop();
|
searchTimeout->stop();
|
||||||
}
|
}
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool();
|
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool();
|
||||||
if (useNotificationBalloons && mp_mainWindow->getCurrentTabWidget() != this) {
|
if (useNotificationBalloons && mp_mainWindow->getCurrentTabWidget() != this) {
|
||||||
mp_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has finished"));
|
mp_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has finished"));
|
||||||
|
@ -106,7 +106,7 @@ QHeaderView* SearchTab::header() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SearchTab::loadColWidthResultsList() {
|
bool SearchTab::loadColWidthResultsList() {
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
QString line = settings.value("SearchResultsColsWidth", QString()).toString();
|
QString line = settings.value("SearchResultsColsWidth", QString()).toString();
|
||||||
if (line.isEmpty())
|
if (line.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
full_name = engine_elem.elementsByTagName("name").at(0).toElement().text();
|
full_name = engine_elem.elementsByTagName("name").at(0).toElement().text();
|
||||||
url = engine_elem.elementsByTagName("url").at(0).toElement().text();
|
url = engine_elem.elementsByTagName("url").at(0).toElement().text();
|
||||||
supported_categories = engine_elem.elementsByTagName("categories").at(0).toElement().text().split(" ");
|
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();
|
QStringList disabled_engines = settings.value(QString::fromUtf8("SearchEngines/disabledEngines"), QStringList()).toStringList();
|
||||||
enabled = !disabled_engines.contains(name);
|
enabled = !disabled_engines.contains(name);
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ public:
|
|||||||
void setEnabled(bool _enabled) {
|
void setEnabled(bool _enabled) {
|
||||||
enabled = _enabled;
|
enabled = _enabled;
|
||||||
// Save to Hard disk
|
// 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();
|
QStringList disabled_engines = settings.value(QString::fromUtf8("SearchEngines/disabledEngines"), QStringList()).toStringList();
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
disabled_engines.removeAll(name);
|
disabled_engines.removeAll(name);
|
||||||
|
@ -69,7 +69,7 @@ TorrentCreatorDlg::~TorrentCreatorDlg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::on_addFolder_button_clicked() {
|
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 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);
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), last_path, QFileDialog::ShowDirsOnly);
|
||||||
if (!dir.isEmpty()) {
|
if (!dir.isEmpty()) {
|
||||||
@ -85,7 +85,7 @@ void TorrentCreatorDlg::on_addFolder_button_clicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::on_addFile_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 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);
|
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), last_path);
|
||||||
if (!file.isEmpty()) {
|
if (!file.isEmpty()) {
|
||||||
@ -117,7 +117,7 @@ void TorrentCreatorDlg::on_createButton_clicked() {
|
|||||||
if (!trackers_list->toPlainText().trimmed().isEmpty())
|
if (!trackers_list->toPlainText().trimmed().isEmpty())
|
||||||
saveTrackerList();
|
saveTrackerList();
|
||||||
|
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
QString last_path = settings.value("CreateTorrent/last_save_path", QDir::homePath()).toString();
|
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)"));
|
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()
|
|||||||
|
|
||||||
void TorrentCreatorDlg::saveTrackerList()
|
void TorrentCreatorDlg::saveTrackerList()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.setValue("CreateTorrent/TrackerList", trackers_list->toPlainText());
|
settings.setValue("CreateTorrent/TrackerList", trackers_list->toPlainText());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::loadTrackerList()
|
void TorrentCreatorDlg::loadTrackerList()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
trackers_list->setPlainText(settings.value("CreateTorrent/TrackerList", "").toString());
|
trackers_list->setPlainText(settings.value("CreateTorrent/TrackerList", "").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::saveSettings()
|
void TorrentCreatorDlg::saveSettings()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.setValue("CreateTorrent/dimensions", saveGeometry());
|
settings.setValue("CreateTorrent/dimensions", saveGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentCreatorDlg::loadSettings()
|
void TorrentCreatorDlg::loadSettings()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
restoreGeometry(settings.value("CreateTorrent/dimensions").toByteArray());
|
restoreGeometry(settings.value("CreateTorrent/dimensions").toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ TorrentImportDlg::~TorrentImportDlg()
|
|||||||
|
|
||||||
void TorrentImportDlg::on_browseTorrentBtn_clicked()
|
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();
|
const QString default_dir = settings.value(QString::fromUtf8("MainWindowLastDir"), QDir::homePath()).toString();
|
||||||
// Ask for a torrent file
|
// Ask for a torrent file
|
||||||
m_torrentPath = QFileDialog::getOpenFileName(this, tr("Torrent file to import"), default_dir, tr("Torrent files (*.torrent)"));
|
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()
|
|||||||
|
|
||||||
void TorrentImportDlg::on_browseContentBtn_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();
|
const QString default_dir = settings.value(QString::fromUtf8("TorrentImport/LastContentDir"), QDir::homePath()).toString();
|
||||||
if (t->num_files() == 1) {
|
if (t->num_files() == 1) {
|
||||||
// Single file torrent
|
// Single file torrent
|
||||||
@ -213,7 +213,7 @@ void TorrentImportDlg::importTorrent()
|
|||||||
qDebug("Adding the torrent to the session...");
|
qDebug("Adding the torrent to the session...");
|
||||||
QBtSession::instance()->addTorrent(torrent_path);
|
QBtSession::instance()->addTorrent(torrent_path);
|
||||||
// Remember the last opened folder
|
// Remember the last opened folder
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.setValue(QString::fromUtf8("MainWindowLastDir"), torrent_path);
|
settings.setValue(QString::fromUtf8("MainWindowLastDir"), torrent_path);
|
||||||
settings.setValue("TorrentImport/LastContentDir", content_path);
|
settings.setValue("TorrentImport/LastContentDir", content_path);
|
||||||
return;
|
return;
|
||||||
@ -278,13 +278,13 @@ bool TorrentImportDlg::skipFileChecking() const
|
|||||||
|
|
||||||
void TorrentImportDlg::loadSettings()
|
void TorrentImportDlg::loadSettings()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
restoreGeometry(settings.value("TorrentImportDlg/dimensions").toByteArray());
|
restoreGeometry(settings.value("TorrentImportDlg/dimensions").toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentImportDlg::saveSettings()
|
void TorrentImportDlg::saveSettings()
|
||||||
{
|
{
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.setValue("TorrentImportDlg/dimensions", saveGeometry());
|
settings.setValue("TorrentImportDlg/dimensions", saveGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void saveSettings() const {
|
void saveSettings() const {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
settings.beginGroup(QString::fromUtf8("TransferListFilters"));
|
settings.beginGroup(QString::fromUtf8("TransferListFilters"));
|
||||||
settings.setValue("selectedFilterIndex", QVariant(statusFilters->currentRow()));
|
settings.setValue("selectedFilterIndex", QVariant(statusFilters->currentRow()));
|
||||||
//settings.setValue("selectedLabelIndex", QVariant(labelFilters->currentRow()));
|
//settings.setValue("selectedLabelIndex", QVariant(labelFilters->currentRow()));
|
||||||
@ -289,7 +289,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loadSettings() {
|
void loadSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
statusFilters->setCurrentRow(settings.value("TransferListFilters/selectedFilterIndex", 0).toInt());
|
statusFilters->setCurrentRow(settings.value("TransferListFilters/selectedFilterIndex", 0).toInt());
|
||||||
const QStringList label_list = Preferences().getTorrentLabels();
|
const QStringList label_list = Preferences().getTorrentLabels();
|
||||||
foreach (const QString &label, label_list) {
|
foreach (const QString &label, label_list) {
|
||||||
|
@ -185,7 +185,7 @@ inline QModelIndex TransferListWidget::mapFromSource(const QModelIndex &index) c
|
|||||||
|
|
||||||
|
|
||||||
QStringList TransferListWidget::getCustomLabels() const {
|
QStringList TransferListWidget::getCustomLabels() const {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings;
|
||||||
return settings.value("TransferListFilters/customLabels", QStringList()).toStringList();
|
return settings.value("TransferListFilters/customLabels", QStringList()).toStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -900,13 +900,13 @@ void TransferListWidget::applyStatusFilter(int f) {
|
|||||||
|
|
||||||
void TransferListWidget::saveSettings()
|
void TransferListWidget::saveSettings()
|
||||||
{
|
{
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
settings.setValue("TransferList/HeaderState", header()->saveState());
|
settings.setValue("TransferList/HeaderState", header()->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TransferListWidget::loadSettings()
|
bool TransferListWidget::loadSettings()
|
||||||
{
|
{
|
||||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
QIniSettings settings;
|
||||||
bool ok = header()->restoreState(settings.value("TransferList/HeaderState").toByteArray());
|
bool ok = header()->restoreState(settings.value("TransferList/HeaderState").toByteArray());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
header()->resizeSection(0, 200); // Default
|
header()->resizeSection(0, 200); // Default
|
||||||
|
Loading…
x
Reference in New Issue
Block a user