|
|
@ -127,6 +127,17 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window, |
|
|
|
setColumnHidden(TorrentModelItem::TR_SAVE_PATH, true); |
|
|
|
setColumnHidden(TorrentModelItem::TR_SAVE_PATH, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Ensure that at least one column is visible at all times
|
|
|
|
|
|
|
|
bool atLeastOne = false; |
|
|
|
|
|
|
|
for (unsigned int i=0; i<TorrentModelItem::NB_COLUMNS; i++) { |
|
|
|
|
|
|
|
if (!isColumnHidden(i)) { |
|
|
|
|
|
|
|
atLeastOne = true; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!atLeastOne) |
|
|
|
|
|
|
|
setColumnHidden(TorrentModelItem::TR_NAME, false); |
|
|
|
|
|
|
|
|
|
|
|
//When adding/removing columns between versions some may
|
|
|
|
//When adding/removing columns between versions some may
|
|
|
|
//end up being size 0 when the new version is launched with
|
|
|
|
//end up being size 0 when the new version is launched with
|
|
|
|
//a conf file from the previous version.
|
|
|
|
//a conf file from the previous version.
|
|
|
@ -558,11 +569,23 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&) { |
|
|
|
myAct->setChecked(!isColumnHidden(i)); |
|
|
|
myAct->setChecked(!isColumnHidden(i)); |
|
|
|
actions.append(myAct); |
|
|
|
actions.append(myAct); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int visibleCols = 0; |
|
|
|
|
|
|
|
for (unsigned int i=0; i<TorrentModelItem::NB_COLUMNS; i++) { |
|
|
|
|
|
|
|
if (!isColumnHidden(i)) |
|
|
|
|
|
|
|
visibleCols++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (visibleCols > 1) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Call menu
|
|
|
|
// Call menu
|
|
|
|
QAction *act = hideshowColumn.exec(QCursor::pos()); |
|
|
|
QAction *act = hideshowColumn.exec(QCursor::pos()); |
|
|
|
if (act) { |
|
|
|
if (act) { |
|
|
|
int col = actions.indexOf(act); |
|
|
|
int col = actions.indexOf(act); |
|
|
|
Q_ASSERT(col >= 0); |
|
|
|
Q_ASSERT(col >= 0); |
|
|
|
|
|
|
|
Q_ASSERT(visibleCols > 0); |
|
|
|
|
|
|
|
if (!isColumnHidden(col) && visibleCols == 1) |
|
|
|
|
|
|
|
return; |
|
|
|
qDebug("Toggling column %d visibility", col); |
|
|
|
qDebug("Toggling column %d visibility", col); |
|
|
|
setColumnHidden(col, !isColumnHidden(col)); |
|
|
|
setColumnHidden(col, !isColumnHidden(col)); |
|
|
|
if (!isColumnHidden(col) && columnWidth(col) <= 5) |
|
|
|
if (!isColumnHidden(col) && columnWidth(col) <= 5) |
|
|
|