Browse Source

Use checkable actions instead of check/uncheck icons to avoid issues on systems disabling menu icons (e.g. Recent Gnome)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
87879b6738
  1. 40
      src/transferlistwidget.cpp

40
src/transferlistwidget.cpp

@ -913,16 +913,13 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&){
actions.append(0); actions.append(0);
continue; continue;
} }
QIcon icon; QAction *myAct = hideshowColumn.addAction(listModel->headerData(i, Qt::Horizontal).toString());
if(isColumnHidden(i)) myAct->setCheckable(true);
icon = QIcon(QString::fromUtf8(":/Icons/oxygen/button_cancel.png")); myAct->setChecked(!isColumnHidden(i));
else actions.append(myAct);
icon = QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png"));
actions.append(hideshowColumn.addAction(icon, listModel->headerData(i, Qt::Horizontal).toString()));
} }
// Call menu // Call menu
QAction *act = 0; QAction *act = hideshowColumn.exec(QCursor::pos());
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);
@ -1058,13 +1055,16 @@ void TransferListWidget::displayListMenu(const QPoint&) {
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs())); connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs()));
#if LIBTORRENT_VERSION_MINOR > 14 #if LIBTORRENT_VERSION_MINOR > 14
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0); QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0);
actionSuper_seeding_mode.setCheckable(true);
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding())); connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding()));
#endif #endif
QAction actionRename(QIcon(QString::fromUtf8(":/Icons/oxygen/edit_clear.png")), tr("Rename..."), 0); QAction actionRename(QIcon(QString::fromUtf8(":/Icons/oxygen/edit_clear.png")), tr("Rename..."), 0);
connect(&actionRename, SIGNAL(triggered()), this, SLOT(renameSelectedTorrent())); connect(&actionRename, SIGNAL(triggered()), this, SLOT(renameSelectedTorrent()));
QAction actionSequential_download(tr("Download in sequential order"), 0); QAction actionSequential_download(tr("Download in sequential order"), 0);
actionSequential_download.setCheckable(true);
connect(&actionSequential_download, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSequentialDownload())); connect(&actionSequential_download, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSequentialDownload()));
QAction actionFirstLastPiece_prio(tr("Download first and last piece first"), 0); QAction actionFirstLastPiece_prio(tr("Download first and last piece first"), 0);
actionFirstLastPiece_prio.setCheckable(true);
connect(&actionFirstLastPiece_prio, SIGNAL(triggered()), this, SLOT(toggleSelectedFirstLastPiecePrio())); connect(&actionFirstLastPiece_prio, SIGNAL(triggered()), this, SLOT(toggleSelectedFirstLastPiecePrio()));
// End of actions // End of actions
QMenu listMenu(this); QMenu listMenu(this);
@ -1158,13 +1158,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
listMenu.addAction(&actionSet_upload_limit); listMenu.addAction(&actionSet_upload_limit);
#if LIBTORRENT_VERSION_MINOR > 14 #if LIBTORRENT_VERSION_MINOR > 14
if(!one_not_seed && all_same_super_seeding && one_has_metadata) { if(!one_not_seed && all_same_super_seeding && one_has_metadata) {
QIcon ico; actionSuper_seeding_mode.setChecked(super_seeding_mode);
if(super_seeding_mode) {
ico = QIcon(":/Icons/oxygen/button_ok.png");
} else {
ico = QIcon(":/Icons/oxygen/button_cancel.png");
}
actionSuper_seeding_mode.setIcon(ico);
listMenu.addAction(&actionSuper_seeding_mode); listMenu.addAction(&actionSuper_seeding_mode);
} }
#endif #endif
@ -1176,24 +1170,12 @@ void TransferListWidget::displayListMenu(const QPoint&) {
} }
if(one_not_seed && one_has_metadata) { if(one_not_seed && one_has_metadata) {
if(all_same_sequential_download_mode) { if(all_same_sequential_download_mode) {
QIcon ico; actionSequential_download.setChecked(sequential_download_mode);
if(sequential_download_mode) {
ico = QIcon(":/Icons/oxygen/button_ok.png");
} else {
ico = QIcon(":/Icons/oxygen/button_cancel.png");
}
actionSequential_download.setIcon(ico);
listMenu.addAction(&actionSequential_download); listMenu.addAction(&actionSequential_download);
added_preview_action = true; added_preview_action = true;
} }
if(all_same_prio_firstlast) { if(all_same_prio_firstlast) {
QIcon ico; actionFirstLastPiece_prio.setChecked(prioritize_first_last);
if(prioritize_first_last) {
ico = QIcon(":/Icons/oxygen/button_ok.png");
} else {
ico = QIcon(":/Icons/oxygen/button_cancel.png");
}
actionFirstLastPiece_prio.setIcon(ico);
listMenu.addAction(&actionFirstLastPiece_prio); listMenu.addAction(&actionFirstLastPiece_prio);
added_preview_action = true; added_preview_action = true;
} }

Loading…
Cancel
Save