mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
bufixes on hidden columns in transfert lists
This commit is contained in:
parent
8ab6aeafcc
commit
0d90ad8f7c
@ -59,6 +59,9 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
|
|||||||
finishedListDelegate = new FinishedListDelegate(finishedList);
|
finishedListDelegate = new FinishedListDelegate(finishedList);
|
||||||
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&)));
|
||||||
|
finishedList->header()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
connect(finishedList->header(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFinishedHoSMenu(const QPoint&)));
|
||||||
|
|
||||||
connect(finishedList, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(notifyTorrentDoubleClicked(const QModelIndex&)));
|
connect(finishedList, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(notifyTorrentDoubleClicked(const QModelIndex&)));
|
||||||
actionDelete->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete.png")));
|
actionDelete->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete.png")));
|
||||||
actionPreview_file->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/preview.png")));
|
actionPreview_file->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/preview.png")));
|
||||||
@ -377,26 +380,32 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
|
|||||||
myFinishedListMenu.addSeparator();
|
myFinishedListMenu.addSeparator();
|
||||||
myFinishedListMenu.addAction(actionOpen_destination_folder);
|
myFinishedListMenu.addAction(actionOpen_destination_folder);
|
||||||
myFinishedListMenu.addAction(actionTorrent_Properties);
|
myFinishedListMenu.addAction(actionTorrent_Properties);
|
||||||
// hide/show columns menu
|
|
||||||
QMenu hideshowColumn(this);
|
|
||||||
hideshowColumn.setTitle(tr("Hide or Show Column"));
|
|
||||||
for(int i=0; i<=F_RATIO; i++) {
|
|
||||||
hideshowColumn.addAction(getActionHoSCol(i));
|
|
||||||
}
|
|
||||||
hideshowColumn.addAction(actionResizeAllColumns);
|
|
||||||
myFinishedListMenu.addMenu(&hideshowColumn);
|
|
||||||
|
|
||||||
// Call menu
|
// Call menu
|
||||||
// XXX: why mapToGlobal() is not enough?
|
// XXX: why mapToGlobal() is not enough?
|
||||||
myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,55));
|
myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,55));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hiding Columns functions
|
* Hiding Columns functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// hide/show columns menu
|
||||||
|
void FinishedTorrents::displayFinishedHoSMenu(const QPoint& pos){
|
||||||
|
QMenu hideshowColumn(this);
|
||||||
|
hideshowColumn.setTitle(tr("Hide or Show Column"));
|
||||||
|
for(int i=0; i<=F_RATIO; i++) {
|
||||||
|
hideshowColumn.addAction(getActionHoSCol(i));
|
||||||
|
}
|
||||||
|
hideshowColumn.addAction(actionResizeAllColumns);
|
||||||
|
// Call menu
|
||||||
|
hideshowColumn.exec(mapToGlobal(pos)+QPoint(10,55));
|
||||||
|
}
|
||||||
|
|
||||||
// toggle hide/show a column
|
// toggle hide/show a column
|
||||||
void FinishedTorrents::hideOrShowColumn(int index) {
|
void FinishedTorrents::hideOrShowColumn(int index) {
|
||||||
|
short nbColumns = 0;
|
||||||
if(!finishedList->isColumnHidden(index)) {
|
if(!finishedList->isColumnHidden(index)) {
|
||||||
unsigned short i=0, nbColDisplayed = 0;
|
unsigned short i=0, nbColDisplayed = 0;
|
||||||
while(i<finishedListModel->columnCount()-1 && nbColDisplayed<=1) {
|
while(i<finishedListModel->columnCount()-1 && nbColDisplayed<=1) {
|
||||||
@ -406,25 +415,31 @@ void FinishedTorrents::hideOrShowColumn(int index) {
|
|||||||
}
|
}
|
||||||
// can't hide a lonely column
|
// can't hide a lonely column
|
||||||
if(nbColDisplayed>1) {
|
if(nbColDisplayed>1) {
|
||||||
|
//resize all others non-hidden columns
|
||||||
|
for(int i=0; i<finishedListModel->columnCount()-1; i++) {
|
||||||
|
if(finishedList->isColumnHidden(i) == false)
|
||||||
|
nbColumns++;
|
||||||
|
}
|
||||||
|
for(int i=0; i<finishedListModel->columnCount()-1; i++) {
|
||||||
|
if(i != index) {
|
||||||
|
finishedList->setColumnWidth(i, (int)ceil(finishedList->columnWidth(i)+(finishedList->columnWidth(index)/(nbColumns-1))));
|
||||||
|
}
|
||||||
|
}
|
||||||
finishedList->setColumnHidden(index, true);
|
finishedList->setColumnHidden(index, true);
|
||||||
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png")));
|
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png")));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//short buf_width = finishedList->columnWidth(index);
|
//short buf_width = finishedList->columnWidth(index);
|
||||||
short nbColumns = 0;
|
|
||||||
finishedList->setColumnHidden(index, false);
|
finishedList->setColumnHidden(index, false);
|
||||||
/*finishedList->resizeColumnToContents(index);
|
|
||||||
if(finishedList->columnWidth(index)<buf_width)
|
|
||||||
finishedList->setColumnWidth(index, buf_width);*/
|
|
||||||
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
||||||
//resize all others non-hidden columns
|
//resize all others non-hidden columns
|
||||||
for(int i=0; i<finishedListModel->columnCount()-1; i++) {
|
for(int i=0; i<finishedListModel->columnCount()-1; i++) {
|
||||||
if(finishedList->isColumnHidden(i))
|
if(finishedList->isColumnHidden(i) == false)
|
||||||
nbColumns++;
|
nbColumns++;
|
||||||
}
|
}
|
||||||
for(int i=0; i<finishedListModel->columnCount()-1; i++) {
|
for(int i=0; i<finishedListModel->columnCount()-1; i++) {
|
||||||
if(i != index) {
|
if(i != index) {
|
||||||
finishedList->setColumnWidth(i, (int)floor(finishedList->columnWidth(i)-(finishedList->columnWidth(index)/(nbColumns-1))));
|
finishedList->setColumnWidth(i, (int)ceil(finishedList->columnWidth(i)-(finishedList->columnWidth(index)/(nbColumns-1))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
|
|||||||
protected slots:
|
protected slots:
|
||||||
void showProperties(const QModelIndex &index);
|
void showProperties(const QModelIndex &index);
|
||||||
void displayFinishedListMenu(const QPoint&);
|
void displayFinishedListMenu(const QPoint&);
|
||||||
|
void displayFinishedHoSMenu(const QPoint&);
|
||||||
void setRowColor(int row, QString color);
|
void setRowColor(int row, QString color);
|
||||||
void saveColWidthFinishedList() const;
|
void saveColWidthFinishedList() const;
|
||||||
void sortFinishedList(int index);
|
void sortFinishedList(int index);
|
||||||
@ -66,6 +67,13 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
|
|||||||
void torrentAdded(QString path, QTorrentHandle& h, bool fastResume);
|
void torrentAdded(QString path, QTorrentHandle& h, bool fastResume);
|
||||||
void on_actionSet_upload_limit_triggered();
|
void on_actionSet_upload_limit_triggered();
|
||||||
void notifyTorrentDoubleClicked(const QModelIndex& index);
|
void notifyTorrentDoubleClicked(const QModelIndex& index);
|
||||||
|
void hideOrShowColumnName();
|
||||||
|
void hideOrShowColumnSize();
|
||||||
|
void hideOrShowColumnProgress();
|
||||||
|
void hideOrShowColumnUpSpeed();
|
||||||
|
void hideOrShowColumnLeechers();
|
||||||
|
void hideOrShowColumnRatio();
|
||||||
|
void resetAllColumns();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addTorrent(QString hash);
|
void addTorrent(QString hash);
|
||||||
@ -75,13 +83,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
|
|||||||
void propertiesSelection();
|
void propertiesSelection();
|
||||||
void deleteTorrent(QString hash);
|
void deleteTorrent(QString hash);
|
||||||
void showPropertiesFromHash(QString hash);
|
void showPropertiesFromHash(QString hash);
|
||||||
void hideOrShowColumnName();
|
|
||||||
void hideOrShowColumnSize();
|
|
||||||
void hideOrShowColumnProgress();
|
|
||||||
void hideOrShowColumnUpSpeed();
|
|
||||||
void hideOrShowColumnLeechers();
|
|
||||||
void hideOrShowColumnRatio();
|
|
||||||
void resetAllColumns();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void torrentMovedFromFinishedList(QString);
|
void torrentMovedFromFinishedList(QString);
|
||||||
|
@ -87,6 +87,8 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession)
|
|||||||
connect(downloadList, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(notifyTorrentDoubleClicked(const QModelIndex&)));
|
connect(downloadList, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(notifyTorrentDoubleClicked(const QModelIndex&)));
|
||||||
connect(downloadList->header(), SIGNAL(sectionPressed(int)), this, SLOT(sortDownloadList(int)));
|
connect(downloadList->header(), SIGNAL(sectionPressed(int)), this, SLOT(sortDownloadList(int)));
|
||||||
connect(downloadList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayDLListMenu(const QPoint&)));
|
connect(downloadList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayDLListMenu(const QPoint&)));
|
||||||
|
downloadList->header()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
connect(downloadList->header(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayDLHoSMenu(const QPoint&)));
|
||||||
connect(infoBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoBarMenu(const QPoint&)));
|
connect(infoBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoBarMenu(const QPoint&)));
|
||||||
// Actions
|
// Actions
|
||||||
connect(actionPause, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPause_triggered()));
|
connect(actionPause, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionPause_triggered()));
|
||||||
@ -297,14 +299,6 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
|
|||||||
myDLLlistMenu.addSeparator();
|
myDLLlistMenu.addSeparator();
|
||||||
myDLLlistMenu.addAction(actionOpen_destination_folder);
|
myDLLlistMenu.addAction(actionOpen_destination_folder);
|
||||||
myDLLlistMenu.addAction(actionTorrent_Properties);
|
myDLLlistMenu.addAction(actionTorrent_Properties);
|
||||||
// hide/show columns menu
|
|
||||||
QMenu hideshowColumn(this);
|
|
||||||
hideshowColumn.setTitle(tr("Hide or Show Column"));
|
|
||||||
for(int i=0; i<=ETA; i++) {
|
|
||||||
hideshowColumn.addAction(getActionHoSCol(i));
|
|
||||||
}
|
|
||||||
hideshowColumn.addAction(actionResizeAllColumns);
|
|
||||||
myDLLlistMenu.addMenu(&hideshowColumn);
|
|
||||||
// Call menu
|
// Call menu
|
||||||
// XXX: why mapToGlobal() is not enough?
|
// XXX: why mapToGlobal() is not enough?
|
||||||
myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,60));
|
myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,60));
|
||||||
@ -315,8 +309,21 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
|
|||||||
* Hiding Columns functions
|
* Hiding Columns functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// hide/show columns menu
|
||||||
|
void DownloadingTorrents::displayDLHoSMenu(const QPoint& pos){
|
||||||
|
QMenu hideshowColumn(this);
|
||||||
|
hideshowColumn.setTitle(tr("Hide or Show Column"));
|
||||||
|
for(int i=0; i<=ETA; i++) {
|
||||||
|
hideshowColumn.addAction(getActionHoSCol(i));
|
||||||
|
}
|
||||||
|
hideshowColumn.addAction(actionResizeAllColumns);
|
||||||
|
// Call menu
|
||||||
|
hideshowColumn.exec(mapToGlobal(pos)+QPoint(10,55));
|
||||||
|
}
|
||||||
|
|
||||||
// toggle hide/show a column
|
// toggle hide/show a column
|
||||||
void DownloadingTorrents::hideOrShowColumn(int index) {
|
void DownloadingTorrents::hideOrShowColumn(int index) {
|
||||||
|
short nbColumns = 0;
|
||||||
if(!downloadList->isColumnHidden(index)) {
|
if(!downloadList->isColumnHidden(index)) {
|
||||||
unsigned short i=0, nbColDisplayed = 0;
|
unsigned short i=0, nbColDisplayed = 0;
|
||||||
while(i<DLListModel->columnCount()-1 && nbColDisplayed<=1) {
|
while(i<DLListModel->columnCount()-1 && nbColDisplayed<=1) {
|
||||||
@ -326,21 +333,31 @@ void DownloadingTorrents::hideOrShowColumn(int index) {
|
|||||||
}
|
}
|
||||||
// can't hide a lonely column
|
// can't hide a lonely column
|
||||||
if(nbColDisplayed>1) {
|
if(nbColDisplayed>1) {
|
||||||
|
//resize all others non-hidden columns
|
||||||
|
for(int i=0; i<DLListModel->columnCount()-1; i++) {
|
||||||
|
if(downloadList->isColumnHidden(i) == false)
|
||||||
|
nbColumns++;
|
||||||
|
}
|
||||||
|
for(int i=0; i<DLListModel->columnCount()-1; i++) {
|
||||||
|
if(i != index) {
|
||||||
|
downloadList->setColumnWidth(i, (int)ceil(downloadList->columnWidth(i)+(downloadList->columnWidth(index)/(nbColumns-1))));
|
||||||
|
}
|
||||||
|
}
|
||||||
downloadList->setColumnHidden(index, true);
|
downloadList->setColumnHidden(index, true);
|
||||||
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png")));
|
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png")));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
short nbColumns = 0;
|
//short buf_width = finishedList->columnWidth(index);
|
||||||
downloadList->setColumnHidden(index, false);
|
downloadList->setColumnHidden(index, false);
|
||||||
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
||||||
//resize all others non-hidden columns
|
//resize all others non-hidden columns
|
||||||
for(int i=0; i<DLListModel->columnCount()-1; i++) {
|
for(int i=0; i<DLListModel->columnCount()-1; i++) {
|
||||||
if(downloadList->isColumnHidden(i))
|
if(downloadList->isColumnHidden(i) == false)
|
||||||
nbColumns++;
|
nbColumns++;
|
||||||
}
|
}
|
||||||
for(int i=0; i<DLListModel->columnCount()-1; i++) {
|
for(int i=0; i<DLListModel->columnCount()-1; i++) {
|
||||||
if(i != index) {
|
if(i != index) {
|
||||||
downloadList->setColumnWidth(i, (int)floor(downloadList->columnWidth(i)-(downloadList->columnWidth(index)/(nbColumns-1))));
|
downloadList->setColumnWidth(i, (int)ceil(downloadList->columnWidth(i)-(downloadList->columnWidth(index)/(nbColumns-1))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
|
|||||||
void notifyTorrentDoubleClicked(const QModelIndex& index);
|
void notifyTorrentDoubleClicked(const QModelIndex& index);
|
||||||
void on_actionSet_upload_limit_triggered();
|
void on_actionSet_upload_limit_triggered();
|
||||||
void displayDLListMenu(const QPoint& pos);
|
void displayDLListMenu(const QPoint& pos);
|
||||||
|
void displayDLHoSMenu(const QPoint&);
|
||||||
void on_actionClearLog_triggered();
|
void on_actionClearLog_triggered();
|
||||||
void displayInfoBarMenu(const QPoint& pos);
|
void displayInfoBarMenu(const QPoint& pos);
|
||||||
void addTorrent(QString hash);
|
void addTorrent(QString hash);
|
||||||
@ -83,6 +84,15 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
|
|||||||
void setRowColor(int row, QColor color);
|
void setRowColor(int row, QColor color);
|
||||||
void displayDownloadingUrlInfos(QString url);
|
void displayDownloadingUrlInfos(QString url);
|
||||||
void showProperties(const QModelIndex &index);
|
void showProperties(const QModelIndex &index);
|
||||||
|
void hideOrShowColumnName();
|
||||||
|
void hideOrShowColumnSize();
|
||||||
|
void hideOrShowColumnProgress();
|
||||||
|
void hideOrShowColumnDownSpeed();
|
||||||
|
void hideOrShowColumnUpSpeed();
|
||||||
|
void hideOrShowColumnSeedersLeechers();
|
||||||
|
void hideOrShowColumnRatio();
|
||||||
|
void hideOrShowColumnEta();
|
||||||
|
void resetAllColumns();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateDlList();
|
void updateDlList();
|
||||||
@ -96,15 +106,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
|
|||||||
void sortProgressColumnDelayed();
|
void sortProgressColumnDelayed();
|
||||||
void updateFileSizeAndProgress(QString hash);
|
void updateFileSizeAndProgress(QString hash);
|
||||||
void showPropertiesFromHash(QString hash);
|
void showPropertiesFromHash(QString hash);
|
||||||
void hideOrShowColumnName();
|
|
||||||
void hideOrShowColumnSize();
|
|
||||||
void hideOrShowColumnProgress();
|
|
||||||
void hideOrShowColumnDownSpeed();
|
|
||||||
void hideOrShowColumnUpSpeed();
|
|
||||||
void hideOrShowColumnSeedersLeechers();
|
|
||||||
void hideOrShowColumnRatio();
|
|
||||||
void hideOrShowColumnEta();
|
|
||||||
void resetAllColumns();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user