mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
parent
e24aaa4ce1
commit
fa3d98aa37
2 changed files with 17 additions and 3 deletions
|
@ -29,6 +29,7 @@
|
||||||
#include "downloadfromurldialog.h"
|
#include "downloadfromurldialog.h"
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include <QKeyEvent>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
@ -66,7 +67,7 @@ DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent)
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Download"));
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Download"));
|
||||||
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &DownloadFromURLDialog::downloadButtonClicked);
|
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &DownloadFromURLDialog::onSubmit);
|
||||||
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
|
||||||
m_ui->textUrls->setWordWrapMode(QTextOption::NoWrap);
|
m_ui->textUrls->setWordWrapMode(QTextOption::NoWrap);
|
||||||
|
@ -102,7 +103,7 @@ DownloadFromURLDialog::~DownloadFromURLDialog()
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadFromURLDialog::downloadButtonClicked()
|
void DownloadFromURLDialog::onSubmit()
|
||||||
{
|
{
|
||||||
const QString plainText = m_ui->textUrls->toPlainText();
|
const QString plainText = m_ui->textUrls->toPlainText();
|
||||||
const QList<QStringView> urls = QStringView(plainText).split(u'\n');
|
const QList<QStringView> urls = QStringView(plainText).split(u'\n');
|
||||||
|
@ -125,3 +126,14 @@ void DownloadFromURLDialog::downloadButtonClicked()
|
||||||
emit urlsReadyToBeDownloaded(uniqueURLs.values());
|
emit urlsReadyToBeDownloaded(uniqueURLs.values());
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DownloadFromURLDialog::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Return))
|
||||||
|
{
|
||||||
|
onSubmit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialog::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
|
|
@ -50,9 +50,11 @@ signals:
|
||||||
void urlsReadyToBeDownloaded(const QStringList &torrentURLs);
|
void urlsReadyToBeDownloaded(const QStringList &torrentURLs);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void downloadButtonClicked();
|
void onSubmit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
Ui::DownloadFromURLDialog *m_ui = nullptr;
|
Ui::DownloadFromURLDialog *m_ui = nullptr;
|
||||||
SettingValue<QSize> m_storeDialogSize;
|
SettingValue<QSize> m_storeDialogSize;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue