mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Clean up PreviewSelectDialog class
This commit is contained in:
parent
a9e6ef183b
commit
0607050ecc
@ -2187,7 +2187,7 @@ void TorrentHandle::setSuperSeeding(const bool enable)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentHandle::flushCache()
|
void TorrentHandle::flushCache() const
|
||||||
{
|
{
|
||||||
m_nativeHandle.flush_cache();
|
m_nativeHandle.flush_cache();
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ namespace BitTorrent
|
|||||||
void setUploadLimit(int limit);
|
void setUploadLimit(int limit);
|
||||||
void setDownloadLimit(int limit);
|
void setDownloadLimit(int limit);
|
||||||
void setSuperSeeding(bool enable);
|
void setSuperSeeding(bool enable);
|
||||||
void flushCache();
|
void flushCache() const;
|
||||||
void addTrackers(const QVector<TrackerEntry> &trackers);
|
void addTrackers(const QVector<TrackerEntry> &trackers);
|
||||||
void replaceTrackers(const QVector<TrackerEntry> &trackers);
|
void replaceTrackers(const QVector<TrackerEntry> &trackers);
|
||||||
void addUrlSeeds(const QVector<QUrl> &urlSeeds);
|
void addUrlSeeds(const QVector<QUrl> &urlSeeds);
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
#define SETTINGS_KEY(name) "PreviewSelectDialog/" name
|
#define SETTINGS_KEY(name) "PreviewSelectDialog/" name
|
||||||
|
|
||||||
PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
|
PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::TorrentHandle *torrent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_ui(new Ui::PreviewSelectDialog)
|
, m_ui(new Ui::PreviewSelectDialog)
|
||||||
, m_torrent(torrent)
|
, m_torrent(torrent)
|
||||||
@ -53,13 +53,12 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, BitTorrent::TorrentHan
|
|||||||
, m_storeTreeHeaderState(SETTINGS_KEY("HeaderState"))
|
, m_storeTreeHeaderState(SETTINGS_KEY("HeaderState"))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Preview"));
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Preview"));
|
||||||
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PreviewSelectDialog::previewButtonClicked);
|
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PreviewSelectDialog::previewButtonClicked);
|
||||||
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
|
||||||
Preferences *const pref = Preferences::instance();
|
const Preferences *pref = Preferences::instance();
|
||||||
// Preview list
|
// Preview list
|
||||||
m_previewListModel = new QStandardItemModel(0, NB_COLUMNS, this);
|
m_previewListModel = new QStandardItemModel(0, NB_COLUMNS, this);
|
||||||
m_previewListModel->setHeaderData(NAME, Qt::Horizontal, tr("Name"));
|
m_previewListModel->setHeaderData(NAME, Qt::Horizontal, tr("Name"));
|
||||||
|
@ -60,26 +60,25 @@ public:
|
|||||||
NB_COLUMNS
|
NB_COLUMNS
|
||||||
};
|
};
|
||||||
|
|
||||||
PreviewSelectDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
|
PreviewSelectDialog(QWidget *parent, const BitTorrent::TorrentHandle *torrent);
|
||||||
~PreviewSelectDialog();
|
~PreviewSelectDialog();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void readyToPreviewFile(QString) const;
|
void readyToPreviewFile(QString) const;
|
||||||
|
|
||||||
protected:
|
|
||||||
void showEvent(QShowEvent *event) override;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void previewButtonClicked();
|
void previewButtonClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
void loadWindowState();
|
void loadWindowState();
|
||||||
void saveWindowState();
|
void saveWindowState();
|
||||||
|
|
||||||
Ui::PreviewSelectDialog *m_ui;
|
Ui::PreviewSelectDialog *m_ui;
|
||||||
QStandardItemModel *m_previewListModel;
|
QStandardItemModel *m_previewListModel;
|
||||||
PreviewListDelegate *m_listDelegate;
|
PreviewListDelegate *m_listDelegate;
|
||||||
BitTorrent::TorrentHandle *const m_torrent;
|
const BitTorrent::TorrentHandle *m_torrent;
|
||||||
bool m_headerStateInitialized = false;
|
bool m_headerStateInitialized = false;
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
|
@ -501,9 +501,10 @@ void TransferListWidget::openSelectedTorrentsFolder() const
|
|||||||
|
|
||||||
void TransferListWidget::previewSelectedTorrents()
|
void TransferListWidget::previewSelectedTorrents()
|
||||||
{
|
{
|
||||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents())) {
|
for (const BitTorrent::TorrentHandle *torrent : asConst(getSelectedTorrents())) {
|
||||||
if (torrentContainsPreviewableFiles(torrent)) {
|
if (torrentContainsPreviewableFiles(torrent)) {
|
||||||
const auto *dialog = new PreviewSelectDialog(this, torrent);
|
auto *dialog = new PreviewSelectDialog(this, torrent);
|
||||||
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, &PreviewSelectDialog::readyToPreviewFile, this, &TransferListWidget::previewFile);
|
connect(dialog, &PreviewSelectDialog::readyToPreviewFile, this, &TransferListWidget::previewFile);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user