From e27a64859497293fb82fbe4303d760dd8219410e Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 3 Jul 2012 18:47:27 +0300 Subject: [PATCH] Remember Y position of the torrent addition dialog --- src/addnewtorrentdialog.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/addnewtorrentdialog.cpp b/src/addnewtorrentdialog.cpp index 6dec0435d..bf710d75f 100644 --- a/src/addnewtorrentdialog.cpp +++ b/src/addnewtorrentdialog.cpp @@ -108,6 +108,7 @@ void AddNewTorrentDialog::saveState() settings.beginGroup(QString::fromUtf8("AddNewTorrentDialog")); if (m_contentModel) settings.setValue("treeHeaderState", ui->content_tree->header()->saveState()); + settings.setValue("y", pos().y()); } void AddNewTorrentDialog::showTorrent(const QString &torrent_path, const QString& from_url) @@ -474,9 +475,16 @@ void AddNewTorrentDialog::setdialogPosition() { qApp->processEvents(); QPoint center(misc::screenCenter(this)); - center.ry() -= 120; - if (center.y() < 0) - center.setY(0); + // Adjust y + QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); + int y = settings.value("AddNewTorrentDialog/y", -1).toInt(); + if (y >= 0) { + center.setY(y); + } else { + center.ry() -= 120; + if (center.y() < 0) + center.setY(0); + } move(center); }