mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Columns width are now remembered on restart for the finished torrent list
This commit is contained in:
parent
4a57037c47
commit
762df4b914
3 changed files with 42 additions and 1 deletions
3
TODO
3
TODO
|
@ -46,4 +46,5 @@
|
||||||
- Get upload/download limit per torrent (uncomment some code)
|
- Get upload/download limit per torrent (uncomment some code)
|
||||||
- Improve ratio display / calculation / saving / per torrent...
|
- Improve ratio display / calculation / saving / per torrent...
|
||||||
- Use buttonboxes when possible
|
- Use buttonboxes when possible
|
||||||
- Display the sum of the size of the selected files in the torrent instead of the whole torrent size in download list
|
- Display the sum of the size of the selected files in the torrent instead of the whole torrent size in download list
|
||||||
|
- Support column sorting in finished list
|
|
@ -43,6 +43,10 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){
|
||||||
finishedList->setModel(finishedListModel);
|
finishedList->setModel(finishedListModel);
|
||||||
// Hide hash column
|
// Hide hash column
|
||||||
finishedList->hideColumn(HASH);
|
finishedList->hideColumn(HASH);
|
||||||
|
// Load last columns width for download list
|
||||||
|
if(!loadColWidthFinishedList()){
|
||||||
|
finishedList->header()->resizeSection(0, 200);
|
||||||
|
}
|
||||||
finishedListDelegate = new DLListDelegate();
|
finishedListDelegate = new DLListDelegate();
|
||||||
finishedList->setItemDelegate(finishedListDelegate);
|
finishedList->setItemDelegate(finishedListDelegate);
|
||||||
connect(finishedList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFinishedListMenu(const QPoint&)));
|
connect(finishedList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFinishedListMenu(const QPoint&)));
|
||||||
|
@ -58,6 +62,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){
|
||||||
}
|
}
|
||||||
|
|
||||||
FinishedTorrents::~FinishedTorrents(){
|
FinishedTorrents::~FinishedTorrents(){
|
||||||
|
saveColWidthFinishedList();
|
||||||
delete finishedListDelegate;
|
delete finishedListDelegate;
|
||||||
delete finishedListModel;
|
delete finishedListModel;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +111,39 @@ void FinishedTorrents::setRowColor(int row, const QString& color){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load columns width in a file that were saved previously
|
||||||
|
// (finished list)
|
||||||
|
bool FinishedTorrents::loadColWidthFinishedList(){
|
||||||
|
qDebug("Loading columns width for finished list");
|
||||||
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
|
QString line = settings.value("FinishedListColsWidth", QString()).toString();
|
||||||
|
if(line.isEmpty())
|
||||||
|
return false;
|
||||||
|
QStringList width_list = line.split(' ');
|
||||||
|
if(width_list.size() != finishedListModel->columnCount())
|
||||||
|
return false;
|
||||||
|
unsigned int listSize = width_list.size();
|
||||||
|
for(unsigned int i=0; i<listSize; ++i){
|
||||||
|
finishedList->header()->resizeSection(i, width_list.at(i).toInt());
|
||||||
|
}
|
||||||
|
qDebug("Finished list columns width loaded");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save columns width in a file to remember them
|
||||||
|
// (finished list)
|
||||||
|
void FinishedTorrents::saveColWidthFinishedList() const{
|
||||||
|
qDebug("Saving columns width in finished list");
|
||||||
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
|
QStringList width_list;
|
||||||
|
unsigned int nbColumns = finishedListModel->columnCount();
|
||||||
|
for(unsigned int i=0; i<nbColumns; ++i){
|
||||||
|
width_list << QString(misc::toString(finishedList->columnWidth(i)).c_str());
|
||||||
|
}
|
||||||
|
settings.setValue("FinishedListColsWidth", width_list.join(" "));
|
||||||
|
qDebug("Finished list columns width saved");
|
||||||
|
}
|
||||||
|
|
||||||
void FinishedTorrents::on_actionSet_upload_limit_triggered(){
|
void FinishedTorrents::on_actionSet_upload_limit_triggered(){
|
||||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||||
QModelIndex index;
|
QModelIndex index;
|
||||||
|
|
|
@ -44,6 +44,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
|
||||||
QStringList getFinishedSHAs();
|
QStringList getFinishedSHAs();
|
||||||
QTreeView* getFinishedList();
|
QTreeView* getFinishedList();
|
||||||
QStandardItemModel* getFinishedListModel();
|
QStandardItemModel* getFinishedListModel();
|
||||||
|
bool loadColWidthFinishedList();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addFinishedSHA(QString sha);
|
void addFinishedSHA(QString sha);
|
||||||
|
@ -53,6 +54,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
|
||||||
void propertiesSelection();
|
void propertiesSelection();
|
||||||
void displayFinishedListMenu(const QPoint&);
|
void displayFinishedListMenu(const QPoint&);
|
||||||
void setRowColor(int row, const QString& color);
|
void setRowColor(int row, const QString& color);
|
||||||
|
void saveColWidthFinishedList() const;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void on_actionSet_upload_limit_triggered();
|
void on_actionSet_upload_limit_triggered();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue