mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Fix speedlimitdlg position
This commit is contained in:
parent
de54fa2c30
commit
a902eb6b2b
@ -10,9 +10,6 @@
|
||||
<height>83</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Bandwidth allocation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
@ -25,9 +22,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBandwidth">
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
@ -40,9 +34,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
|
@ -862,10 +862,12 @@ void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const
|
||||
void MainWindow::on_actionSetGlobalUploadLimit_triggered()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
bool ok = false;
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||
&ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit());
|
||||
this, &ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit());
|
||||
|
||||
if (ok) {
|
||||
qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.);
|
||||
session->setUploadSpeedLimit(newLimit);
|
||||
@ -875,10 +877,12 @@ void MainWindow::on_actionSetGlobalUploadLimit_triggered()
|
||||
void MainWindow::on_actionSetGlobalDownloadLimit_triggered()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
bool ok = false;
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||
&ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit());
|
||||
this, &ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit());
|
||||
|
||||
if (ok) {
|
||||
qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.);
|
||||
session->setDownloadSpeedLimit(newLimit);
|
||||
|
@ -39,10 +39,10 @@ SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
qDebug("Bandwidth allocation dialog creation");
|
||||
|
||||
// Connect to slots
|
||||
connect(m_ui->bandwidthSlider, SIGNAL(valueChanged(int)), this, SLOT(updateSpinValue(int)));
|
||||
connect(m_ui->spinBandwidth, SIGNAL(valueChanged(int)), this, SLOT(updateSliderValue(int)));
|
||||
move(Utils::Misc::screenCenter(this));
|
||||
}
|
||||
|
||||
SpeedLimitDialog::~SpeedLimitDialog()
|
||||
@ -52,9 +52,9 @@ SpeedLimitDialog::~SpeedLimitDialog()
|
||||
}
|
||||
|
||||
// -2: if cancel
|
||||
long SpeedLimitDialog::askSpeedLimit(bool *ok, QString title, long default_value, long max_value)
|
||||
long SpeedLimitDialog::askSpeedLimit(QWidget *parent, bool *ok, QString title, long default_value, long max_value)
|
||||
{
|
||||
SpeedLimitDialog dlg;
|
||||
SpeedLimitDialog dlg(parent);
|
||||
dlg.setWindowTitle(title);
|
||||
dlg.setupDialog(max_value / 1024., default_value / 1024.);
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
|
@ -44,9 +44,9 @@ namespace Ui
|
||||
class SpeedLimitDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SpeedLimitDialog(QWidget *parent=0);
|
||||
explicit SpeedLimitDialog(QWidget *parent);
|
||||
~SpeedLimitDialog();
|
||||
static long askSpeedLimit(bool *ok, QString title, long default_value, long max_value=10240000);
|
||||
static long askSpeedLimit(QWidget *parent, bool *ok, QString title, long default_value, long max_value=10240000);
|
||||
|
||||
protected slots:
|
||||
void updateSpinValue(int val) const;
|
||||
|
@ -252,9 +252,10 @@ void StatusBar::toggleAlternativeSpeeds()
|
||||
void StatusBar::capDownloadSpeed()
|
||||
{
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
|
||||
bool ok = false;
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||
&ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit());
|
||||
m_bar->parentWidget(), &ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit());
|
||||
if (ok) {
|
||||
qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.);
|
||||
session->setDownloadSpeedLimit(newLimit);
|
||||
@ -265,9 +266,10 @@ void StatusBar::capDownloadSpeed()
|
||||
void StatusBar::capUploadSpeed()
|
||||
{
|
||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||
|
||||
bool ok = false;
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||
&ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit());
|
||||
m_bar->parentWidget(), &ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit());
|
||||
if (ok) {
|
||||
qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.);
|
||||
session->setUploadSpeedLimit(newLimit);
|
||||
|
@ -445,7 +445,7 @@ void TransferListWidget::setDlLimitSelectedTorrents()
|
||||
|
||||
bool ok = false;
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||
&ok, tr("Torrent Download Speed Limiting"), oldLimit
|
||||
this, &ok, tr("Torrent Download Speed Limiting"), oldLimit
|
||||
, BitTorrent::Session::instance()->globalDownloadSpeedLimit());
|
||||
if (!ok) return;
|
||||
|
||||
@ -470,7 +470,7 @@ void TransferListWidget::setUpLimitSelectedTorrents()
|
||||
|
||||
bool ok = false;
|
||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||
&ok, tr("Torrent Upload Speed Limiting"), oldLimit
|
||||
this, &ok, tr("Torrent Upload Speed Limiting"), oldLimit
|
||||
, BitTorrent::Session::instance()->globalUploadSpeedLimit());
|
||||
if (!ok) return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user