Browse Source

Code clean up

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
f1ca4f40af
  1. 28
      src/torrentadditiondlg.cpp

28
src/torrentadditiondlg.cpp

@ -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…
Cancel
Save