mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Code clean up
This commit is contained in:
parent
62503fb663
commit
f1ca4f40af
@ -119,33 +119,15 @@ torrentAdditionDialog::~torrentAdditionDialog() {
|
|||||||
|
|
||||||
void torrentAdditionDialog::readSettings() {
|
void torrentAdditionDialog::readSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
// Restore size and position
|
restoreGeometry(settings.value("TorrentAdditionDlg/dimensions").toByteArray());
|
||||||
resize(settings.value(QString::fromUtf8("TorrentAdditionDlg/size"), size()).toSize());
|
torrentContentList->header()->resizeSection(0, 200); //Default
|
||||||
move(settings.value(QString::fromUtf8("TorrentAdditionDlg/pos"), misc::screenCenter(this)).toPoint());
|
torrentContentList->header()->restoreState(settings.value("TorrentAdditionDlg/contentHeaderState").toByteArray());
|
||||||
// Restore column width
|
|
||||||
const QList<int> contentColsWidths = misc::intListfromStringList(settings.value(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth")).toStringList());
|
|
||||||
if(contentColsWidths.empty()) {
|
|
||||||
torrentContentList->header()->resizeSection(0, 200);
|
|
||||||
} else {
|
|
||||||
for(int i=0; i<contentColsWidths.size(); ++i) {
|
|
||||||
torrentContentList->setColumnWidth(i, contentColsWidths.at(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::saveSettings() {
|
void torrentAdditionDialog::saveSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
if(!is_magnet && t.get() && t->is_valid() && t->num_files() > 1) {
|
settings.setValue("TorrentAdditionDlg/dimensions", saveGeometry());
|
||||||
QStringList contentColsWidths;
|
settings.setValue("TorrentAdditionDlg/contentHeaderState", torrentContentList->header()->saveState());
|
||||||
// -1 because we hid PROGRESS column
|
|
||||||
for(int i=0; i<PropListModel->columnCount()-1; ++i) {
|
|
||||||
contentColsWidths << QString::number(torrentContentList->columnWidth(i));
|
|
||||||
}
|
|
||||||
settings.setValue(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth"), contentColsWidths);
|
|
||||||
}
|
|
||||||
settings.setValue("TorrentAdditionDlg/size", size()+QSize(0, hidden_height));
|
|
||||||
qDebug("pos: (%d, %d)", pos().x(), pos().y());
|
|
||||||
settings.setValue("TorrentAdditionDlg/pos", pos());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::renameTorrentNameInModel(QString file_path) {
|
void torrentAdditionDialog::renameTorrentNameInModel(QString file_path) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user