mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-13 05:41:17 +00:00
- Remember torrent addition dialog size and position
This commit is contained in:
parent
ad597c72d2
commit
944e25a5d8
@ -39,6 +39,8 @@
|
||||
#include <QMenu>
|
||||
#include <QSettings>
|
||||
#include <QHeaderView>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/bencode.hpp>
|
||||
@ -110,6 +112,10 @@ public:
|
||||
|
||||
void readSettings() {
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
// Restore size and position
|
||||
resize(settings.value(QString::fromUtf8("TorrentAdditionDlg/size"), size()).toSize());
|
||||
move(settings.value(QString::fromUtf8("TorrentAdditionDlg/pos"), screenCenter()).toPoint());
|
||||
// Restore column width
|
||||
QVariantList contentColsWidths = settings.value(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth"), QVariantList()).toList();
|
||||
if(contentColsWidths.empty()) {
|
||||
torrentContentList->header()->resizeSection(0, 200);
|
||||
@ -120,6 +126,22 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Screen center point
|
||||
QPoint screenCenter() const{
|
||||
int scrn = 0;
|
||||
QWidget *w = this->topLevelWidget();
|
||||
|
||||
if(w)
|
||||
scrn = QApplication::desktop()->screenNumber(w);
|
||||
else if(QApplication::desktop()->isVirtualDesktop())
|
||||
scrn = QApplication::desktop()->screenNumber(QCursor::pos());
|
||||
else
|
||||
scrn = QApplication::desktop()->screenNumber(this);
|
||||
|
||||
QRect desk(QApplication::desktop()->availableGeometry(scrn));
|
||||
return QPoint((desk.width() - this->frameGeometry().width()) / 2, (desk.height() - this->frameGeometry().height()) / 2);
|
||||
}
|
||||
|
||||
void saveSettings() {
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
QVariantList contentColsWidths;
|
||||
@ -128,6 +150,8 @@ public:
|
||||
contentColsWidths.append(torrentContentList->columnWidth(i));
|
||||
}
|
||||
settings.setValue(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth"), contentColsWidths);
|
||||
settings.setValue("TorrentAdditionDlg/size", size());
|
||||
settings.setValue("TorrentAdditionDlg/pos", pos());
|
||||
}
|
||||
|
||||
void showLoad(QString filePath, QString from_url=QString::null){
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>511</width>
|
||||
<width>585</width>
|
||||
<height>517</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user