mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
- Save properties window size, position, columns width and restore them
- Set a minimum default width for NAME column in properties
This commit is contained in:
parent
b24194068a
commit
8ad987a672
@ -146,6 +146,7 @@ properties::properties(QWidget *parent, bittorrent *BTSession, QTorrentHandle &h
|
|||||||
}
|
}
|
||||||
|
|
||||||
properties::~properties(){
|
properties::~properties(){
|
||||||
|
writeSettings();
|
||||||
qDebug("Properties destroyed");
|
qDebug("Properties destroyed");
|
||||||
delete updateInfosTimer;
|
delete updateInfosTimer;
|
||||||
delete PropDelegate;
|
delete PropDelegate;
|
||||||
@ -187,6 +188,11 @@ void properties::writeSettings() {
|
|||||||
settings.beginGroup(QString::fromUtf8("PropWindow"));
|
settings.beginGroup(QString::fromUtf8("PropWindow"));
|
||||||
settings.setValue(QString::fromUtf8("size"), size());
|
settings.setValue(QString::fromUtf8("size"), size());
|
||||||
settings.setValue(QString::fromUtf8("pos"), pos());
|
settings.setValue(QString::fromUtf8("pos"), pos());
|
||||||
|
QVariantList contentColsWidths;
|
||||||
|
for(int i=0; i<PropListModel->columnCount()-1; ++i) {
|
||||||
|
contentColsWidths.append(filesList->columnWidth(i));
|
||||||
|
}
|
||||||
|
settings.setValue(QString::fromUtf8("contentColsWidths"), contentColsWidths);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +200,14 @@ void properties::loadSettings() {
|
|||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
resize(settings.value(QString::fromUtf8("PropWindow/size"), size()).toSize());
|
resize(settings.value(QString::fromUtf8("PropWindow/size"), size()).toSize());
|
||||||
move(settings.value(QString::fromUtf8("PropWindow/pos"), screenCenter()).toPoint());
|
move(settings.value(QString::fromUtf8("PropWindow/pos"), screenCenter()).toPoint());
|
||||||
|
QVariantList contentColsWidths = settings.value(QString::fromUtf8("PropWindow/contentColsWidths"), QVariantList()).toList();
|
||||||
|
if(contentColsWidths.empty()) {
|
||||||
|
filesList->header()->resizeSection(NAME, 200);
|
||||||
|
} else {
|
||||||
|
for(int i=0; i<contentColsWidths.size(); ++i) {
|
||||||
|
filesList->setColumnWidth(i, contentColsWidths.at(i).toInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center window
|
// Center window
|
||||||
|
Loading…
x
Reference in New Issue
Block a user