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

This commit is contained in:
Christophe Dumez
2013-02-16 20:04:48 +02:00
parent 6c753ac183
commit da3406b811
18 changed files with 52 additions and 52 deletions

View File

@@ -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() {
}
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() {
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()
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());
}