qBittorrent
DeletionConfirmationDialog Class Reference

#include <deletionconfirmationdialog.h>

Inheritance diagram for DeletionConfirmationDialog:
Collaboration diagram for DeletionConfirmationDialog:

Public Member Functions

 DeletionConfirmationDialog (QWidget *parent, int size, const QString &name, bool defaultDeleteFiles)
 
 ~DeletionConfirmationDialog ()
 
bool isDeleteFileSelected () const
 

Private Slots

void updateRememberButtonState ()
 
void on_rememberBtn_clicked ()
 

Private Attributes

Ui::DeletionConfirmationDialog * m_ui
 

Detailed Description

Definition at line 40 of file deletionconfirmationdialog.h.

Constructor & Destructor Documentation

◆ DeletionConfirmationDialog()

DeletionConfirmationDialog::DeletionConfirmationDialog ( QWidget *  parent,
int  size,
const QString &  name,
bool  defaultDeleteFiles 
)

Definition at line 37 of file deletionconfirmationdialog.cpp.

38  : QDialog(parent)
39  , m_ui(new Ui::DeletionConfirmationDialog)
40 {
41  m_ui->setupUi(this);
42 
43  if (size == 1)
44  m_ui->label->setText(tr("Are you sure you want to delete '%1' from the transfer list?", "Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?").arg(name.toHtmlEscaped()));
45  else
46  m_ui->label->setText(tr("Are you sure you want to delete these %1 torrents from the transfer list?", "Are you sure you want to delete these 5 torrents from the transfer list?").arg(QString::number(size)));
47 
48  // Icons
49  const QSize iconSize = Utils::Gui::largeIconSize();
50  m_ui->labelWarning->setPixmap(UIThemeManager::instance()->getIcon("dialog-warning").pixmap(iconSize));
51  m_ui->labelWarning->setFixedWidth(iconSize.width());
52  m_ui->rememberBtn->setIcon(UIThemeManager::instance()->getIcon("object-locked"));
53  m_ui->rememberBtn->setIconSize(Utils::Gui::mediumIconSize());
54 
55  m_ui->checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());
56  connect(m_ui->checkPermDelete, &QCheckBox::clicked, this, &DeletionConfirmationDialog::updateRememberButtonState);
57  m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setFocus();
58 
59  Utils::Gui::resize(this);
60 }
Ui::DeletionConfirmationDialog * m_ui
static Preferences * instance()
static UIThemeManager * instance()
QSize mediumIconSize(const QWidget *widget=nullptr)
Definition: utils.cpp:105
void resize(QWidget *widget, const QSize &newSize={})
Definition: utils.cpp:54
QSize largeIconSize(const QWidget *widget=nullptr)
Definition: utils.cpp:111

References Preferences::instance(), UIThemeManager::instance(), Utils::Gui::largeIconSize(), m_ui, Utils::Gui::mediumIconSize(), Utils::Gui::resize(), and updateRememberButtonState().

Here is the call graph for this function:

◆ ~DeletionConfirmationDialog()

DeletionConfirmationDialog::~DeletionConfirmationDialog ( )

Definition at line 62 of file deletionconfirmationdialog.cpp.

63 {
64  delete m_ui;
65 }

References m_ui.

Member Function Documentation

◆ isDeleteFileSelected()

bool DeletionConfirmationDialog::isDeleteFileSelected ( ) const

Definition at line 67 of file deletionconfirmationdialog.cpp.

68 {
69  return m_ui->checkPermDelete->isChecked();
70 }

References m_ui.

◆ on_rememberBtn_clicked

void DeletionConfirmationDialog::on_rememberBtn_clicked ( )
privateslot

Definition at line 77 of file deletionconfirmationdialog.cpp.

78 {
79  Preferences::instance()->setDeleteTorrentFilesAsDefault(m_ui->checkPermDelete->isChecked());
80  m_ui->rememberBtn->setEnabled(false);
81 }
void setDeleteTorrentFilesAsDefault(bool del)

References Preferences::instance(), m_ui, and Preferences::setDeleteTorrentFilesAsDefault().

Here is the call graph for this function:

◆ updateRememberButtonState

void DeletionConfirmationDialog::updateRememberButtonState ( )
privateslot

Definition at line 72 of file deletionconfirmationdialog.cpp.

73 {
74  m_ui->rememberBtn->setEnabled(m_ui->checkPermDelete->isChecked() != Preferences::instance()->deleteTorrentFilesAsDefault());
75 }
bool deleteTorrentFilesAsDefault() const

References Preferences::deleteTorrentFilesAsDefault(), Preferences::instance(), and m_ui.

Referenced by DeletionConfirmationDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_ui

Ui::DeletionConfirmationDialog* DeletionConfirmationDialog::m_ui
private

The documentation for this class was generated from the following files: