mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Merge pull request #3858 from Chocobo1/screen_center
Fix dialogs didn't position on the correct screen
This commit is contained in:
commit
d61fc7e820
@ -366,7 +366,7 @@ void Application::allTorrentsFinished()
|
|||||||
// do nothing & skip confirm
|
// do nothing & skip confirm
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!ShutdownConfirmDlg::askForConfirmation(action)) return;
|
if (!ShutdownConfirmDlg::askForConfirmation(m_window, action)) return;
|
||||||
}
|
}
|
||||||
#endif // DISABLE_GUI
|
#endif // DISABLE_GUI
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ void Application::processParams(const QStringList ¶ms)
|
|||||||
param = param.trimmed();
|
param = param.trimmed();
|
||||||
|
|
||||||
// Process strings indicating options specified by the user.
|
// Process strings indicating options specified by the user.
|
||||||
|
|
||||||
if (param.startsWith(QLatin1String("@savePath="))) {
|
if (param.startsWith(QLatin1String("@savePath="))) {
|
||||||
torrentParams.savePath = param.mid(10);
|
torrentParams.savePath = param.mid(10);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1127,7 +1127,6 @@ void Preferences::setMainLastDir(const QString &path)
|
|||||||
setValue("MainWindowLastDir", path);
|
setValue("MainWindowLastDir", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
|
||||||
QSize Preferences::getPrefSize(const QSize& defaultSize) const
|
QSize Preferences::getPrefSize(const QSize& defaultSize) const
|
||||||
{
|
{
|
||||||
return value("Preferences/State/size", defaultSize).toSize();
|
return value("Preferences/State/size", defaultSize).toSize();
|
||||||
@ -1137,17 +1136,6 @@ void Preferences::setPrefSize(const QSize &size)
|
|||||||
{
|
{
|
||||||
setValue("Preferences/State/size", size);
|
setValue("Preferences/State/size", size);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
QPoint Preferences::getPrefPos() const
|
|
||||||
{
|
|
||||||
return value("Preferences/State/pos").toPoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::setPrefPos(const QPoint &pos)
|
|
||||||
{
|
|
||||||
setValue("Preferences/State/pos", pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList Preferences::getPrefHSplitterSizes() const
|
QStringList Preferences::getPrefHSplitterSizes() const
|
||||||
{
|
{
|
||||||
@ -1219,14 +1207,14 @@ void Preferences::setPropTrackerListState(const QByteArray &state)
|
|||||||
setValue("TorrentProperties/Trackers/qt5/TrackerListState", state);
|
setValue("TorrentProperties/Trackers/qt5/TrackerListState", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Preferences::getRssGeometry() const
|
QSize Preferences::getRssGeometrySize(const QSize &defaultSize) const
|
||||||
{
|
{
|
||||||
return value("RssFeedDownloader/geometry").toByteArray();
|
return value("RssFeedDownloader/geometrySize", defaultSize).toSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setRssGeometry(const QByteArray &geometry)
|
void Preferences::setRssGeometrySize(const QSize &geometry)
|
||||||
{
|
{
|
||||||
setValue("RssFeedDownloader/geometry", geometry);
|
setValue("RssFeedDownloader/geometrySize", geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Preferences::getRssHSplitterSizes() const
|
QByteArray Preferences::getRssHSplitterSizes() const
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QSize>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
#include <QNetworkCookie>
|
#include <QNetworkCookie>
|
||||||
@ -274,12 +275,8 @@ public:
|
|||||||
void setMainVSplitterState(const QByteArray &state);
|
void setMainVSplitterState(const QByteArray &state);
|
||||||
QString getMainLastDir() const;
|
QString getMainLastDir() const;
|
||||||
void setMainLastDir(const QString &path);
|
void setMainLastDir(const QString &path);
|
||||||
#ifndef DISABLE_GUI
|
|
||||||
QSize getPrefSize(const QSize &defaultSize) const;
|
QSize getPrefSize(const QSize &defaultSize) const;
|
||||||
void setPrefSize(const QSize &size);
|
void setPrefSize(const QSize &size);
|
||||||
#endif
|
|
||||||
QPoint getPrefPos() const;
|
|
||||||
void setPrefPos(const QPoint &pos);
|
|
||||||
QStringList getPrefHSplitterSizes() const;
|
QStringList getPrefHSplitterSizes() const;
|
||||||
void setPrefHSplitterSizes(const QStringList &sizes);
|
void setPrefHSplitterSizes(const QStringList &sizes);
|
||||||
QByteArray getPeerListState() const;
|
QByteArray getPeerListState() const;
|
||||||
@ -294,8 +291,8 @@ public:
|
|||||||
void setPropVisible(const bool visible);
|
void setPropVisible(const bool visible);
|
||||||
QByteArray getPropTrackerListState() const;
|
QByteArray getPropTrackerListState() const;
|
||||||
void setPropTrackerListState(const QByteArray &state);
|
void setPropTrackerListState(const QByteArray &state);
|
||||||
QByteArray getRssGeometry() const;
|
QSize getRssGeometrySize(const QSize &defaultSize) const;
|
||||||
void setRssGeometry(const QByteArray &geometry);
|
void setRssGeometrySize(const QSize &geometry);
|
||||||
QByteArray getRssHSplitterSizes() const;
|
QByteArray getRssHSplitterSizes() const;
|
||||||
void setRssHSplitterSizes(const QByteArray &sizes);
|
void setRssHSplitterSizes(const QByteArray &sizes);
|
||||||
QStringList getRssOpenFolders() const;
|
QStringList getRssOpenFolders() const;
|
||||||
|
@ -219,21 +219,15 @@ void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
// Get screen center
|
QPoint Utils::Misc::screenCenter(const QWidget *w)
|
||||||
QPoint Utils::Misc::screenCenter(QWidget *win)
|
|
||||||
{
|
{
|
||||||
int scrn = 0;
|
// Returns the QPoint which the widget will be placed center on screen (where parent resides)
|
||||||
const QWidget *w = win->window();
|
|
||||||
|
|
||||||
if (w)
|
QWidget *parent = w->parentWidget();
|
||||||
scrn = QApplication::desktop()->screenNumber(w);
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
else if (QApplication::desktop()->isVirtualDesktop())
|
int scrn = desktop->screenNumber(parent); // fallback to `primaryScreen` when parent is invalid
|
||||||
scrn = QApplication::desktop()->screenNumber(QCursor::pos());
|
QRect r = desktop->availableGeometry(scrn);
|
||||||
else
|
return QPoint(r.x() + (r.width() - w->frameSize().width()) / 2, r.y() + (r.height() - w->frameSize().height()) / 2);
|
||||||
scrn = QApplication::desktop()->screenNumber(win);
|
|
||||||
|
|
||||||
QRect desk(QApplication::desktop()->availableGeometry(scrn));
|
|
||||||
return QPoint((desk.width() - win->frameGeometry().width()) / 2, (desk.height() - win->frameGeometry().height()) / 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -102,7 +102,7 @@ namespace Utils
|
|||||||
void openPath(const QString& absolutePath);
|
void openPath(const QString& absolutePath);
|
||||||
void openFolderSelect(const QString& absolutePath);
|
void openFolderSelect(const QString& absolutePath);
|
||||||
|
|
||||||
QPoint screenCenter(QWidget *win);
|
QPoint screenCenter(const QWidget *w);
|
||||||
QSize smallIconSize();
|
QSize smallIconSize();
|
||||||
QSize largeIconSize();
|
QSize largeIconSize();
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +63,6 @@ const QString KEY_DEFAULTCATEGORY = SETTINGS_KEY("DefaultCategory");
|
|||||||
const QString KEY_TREEHEADERSTATE = SETTINGS_KEY("TreeHeaderState");
|
const QString KEY_TREEHEADERSTATE = SETTINGS_KEY("TreeHeaderState");
|
||||||
const QString KEY_WIDTH = SETTINGS_KEY("Width");
|
const QString KEY_WIDTH = SETTINGS_KEY("Width");
|
||||||
const QString KEY_EXPANDED = SETTINGS_KEY("Expanded");
|
const QString KEY_EXPANDED = SETTINGS_KEY("Expanded");
|
||||||
const QString KEY_POSITION = SETTINGS_KEY("Position");
|
|
||||||
const QString KEY_TOPLEVEL = SETTINGS_KEY("TopLevel");
|
const QString KEY_TOPLEVEL = SETTINGS_KEY("TopLevel");
|
||||||
const QString KEY_SAVEPATHHISTORY = SETTINGS_KEY("SavePathHistory");
|
const QString KEY_SAVEPATHHISTORY = SETTINGS_KEY("SavePathHistory");
|
||||||
|
|
||||||
@ -85,7 +84,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
|||||||
, m_oldIndex(0)
|
, m_oldIndex(0)
|
||||||
, m_torrentParams(inParams)
|
, m_torrentParams(inParams)
|
||||||
{
|
{
|
||||||
// TODO: set dialog file properties using m_torrentParams.filePriorities
|
// TODO: set dialog file properties using m_torrentParams.filePriorities
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui->lblMetaLoading->setVisible(false);
|
ui->lblMetaLoading->setVisible(false);
|
||||||
@ -99,7 +98,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
|||||||
ui->startTorrentCheckBox->setChecked(true);
|
ui->startTorrentCheckBox->setChecked(true);
|
||||||
else
|
else
|
||||||
ui->startTorrentCheckBox->setChecked(!session->isAddTorrentPaused());
|
ui->startTorrentCheckBox->setChecked(!session->isAddTorrentPaused());
|
||||||
|
|
||||||
ui->comboTTM->blockSignals(true); // the TreeView size isn't correct if the slot does it job at this point
|
ui->comboTTM->blockSignals(true); // the TreeView size isn't correct if the slot does it job at this point
|
||||||
ui->comboTTM->setCurrentIndex(!session->isAutoTMMDisabledByDefault());
|
ui->comboTTM->setCurrentIndex(!session->isAutoTMMDisabledByDefault());
|
||||||
ui->comboTTM->blockSignals(false);
|
ui->comboTTM->blockSignals(false);
|
||||||
@ -114,7 +113,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
|||||||
ui->createSubfolderCheckBox->setChecked(false);
|
ui->createSubfolderCheckBox->setChecked(false);
|
||||||
else
|
else
|
||||||
ui->createSubfolderCheckBox->setChecked(session->isCreateTorrentSubfolder());
|
ui->createSubfolderCheckBox->setChecked(session->isCreateTorrentSubfolder());
|
||||||
|
|
||||||
ui->skipCheckingCheckBox->setChecked(m_torrentParams.skipChecking);
|
ui->skipCheckingCheckBox->setChecked(m_torrentParams.skipChecking);
|
||||||
ui->doNotDeleteTorrentCheckBox->setVisible(TorrentFileGuard::autoDeleteMode() != TorrentFileGuard::Never);
|
ui->doNotDeleteTorrentCheckBox->setVisible(TorrentFileGuard::autoDeleteMode() != TorrentFileGuard::Never);
|
||||||
|
|
||||||
@ -179,11 +178,10 @@ void AddNewTorrentDialog::loadState()
|
|||||||
{
|
{
|
||||||
m_headerState = settings()->loadValue(KEY_TREEHEADERSTATE).toByteArray();
|
m_headerState = settings()->loadValue(KEY_TREEHEADERSTATE).toByteArray();
|
||||||
int width = settings()->loadValue(KEY_WIDTH, -1).toInt();
|
int width = settings()->loadValue(KEY_WIDTH, -1).toInt();
|
||||||
if (width >= 0) {
|
QSize geo = size();
|
||||||
QRect geo = geometry();
|
geo.setWidth(width);
|
||||||
geo.setWidth(width);
|
resize(geo);
|
||||||
setGeometry(geo);
|
|
||||||
}
|
|
||||||
ui->adv_button->setChecked(settings()->loadValue(KEY_EXPANDED).toBool());
|
ui->adv_button->setChecked(settings()->loadValue(KEY_EXPANDED).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +189,6 @@ void AddNewTorrentDialog::saveState()
|
|||||||
{
|
{
|
||||||
if (m_contentModel)
|
if (m_contentModel)
|
||||||
settings()->storeValue(KEY_TREEHEADERSTATE, ui->contentTreeView->header()->saveState());
|
settings()->storeValue(KEY_TREEHEADERSTATE, ui->contentTreeView->header()->saveState());
|
||||||
settings()->storeValue(KEY_POSITION, pos().y());
|
|
||||||
settings()->storeValue(KEY_WIDTH, width());
|
settings()->storeValue(KEY_WIDTH, width());
|
||||||
settings()->storeValue(KEY_EXPANDED, ui->adv_button->isChecked());
|
settings()->storeValue(KEY_EXPANDED, ui->adv_button->isChecked());
|
||||||
}
|
}
|
||||||
@ -235,13 +232,13 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
|
|||||||
m_filePath = torrentPath;
|
m_filePath = torrentPath;
|
||||||
|
|
||||||
if (!QFile::exists(m_filePath)) {
|
if (!QFile::exists(m_filePath)) {
|
||||||
MessageBoxRaised::critical(0, tr("I/O Error"), tr("The torrent file '%1' does not exist.").arg(Utils::Fs::toNativePath(m_filePath)));
|
MessageBoxRaised::critical(this, tr("I/O Error"), tr("The torrent file '%1' does not exist.").arg(Utils::Fs::toNativePath(m_filePath)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo fileinfo(m_filePath);
|
QFileInfo fileinfo(m_filePath);
|
||||||
if (!fileinfo.isReadable()) {
|
if (!fileinfo.isReadable()) {
|
||||||
MessageBoxRaised::critical(0, tr("I/O Error"), tr("The torrent file '%1' cannot be read from the disk. Probably you don't have enough permissions.").arg(Utils::Fs::toNativePath(m_filePath)));
|
MessageBoxRaised::critical(this, tr("I/O Error"), tr("The torrent file '%1' cannot be read from the disk. Probably you don't have enough permissions.").arg(Utils::Fs::toNativePath(m_filePath)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +246,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
|
|||||||
QString error;
|
QString error;
|
||||||
m_torrentInfo = BitTorrent::TorrentInfo::loadFromFile(m_filePath, error);
|
m_torrentInfo = BitTorrent::TorrentInfo::loadFromFile(m_filePath, error);
|
||||||
if (!m_torrentInfo.isValid()) {
|
if (!m_torrentInfo.isValid()) {
|
||||||
MessageBoxRaised::critical(0, tr("Invalid torrent"), tr("Failed to load the torrent: %1.\nError: %2", "Don't remove the '\n' characters. They insert a newline.").arg(Utils::Fs::toNativePath(m_filePath)).arg(error));
|
MessageBoxRaised::critical(this, tr("Invalid torrent"), tr("Failed to load the torrent: %1.\nError: %2", "Don't remove the '\n' characters. They insert a newline.").arg(Utils::Fs::toNativePath(m_filePath)).arg(error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,16 +258,16 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
|
|||||||
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
|
||||||
if (torrent) {
|
if (torrent) {
|
||||||
if (torrent->isPrivate() || m_torrentInfo.isPrivate()) {
|
if (torrent->isPrivate() || m_torrentInfo.isPrivate()) {
|
||||||
MessageBoxRaised::critical(0, tr("Already in download list"), tr("Torrent is already in download list. Trackers weren't merged because it is a private torrent."), QMessageBox::Ok);
|
MessageBoxRaised::critical(this, tr("Already in download list"), tr("Torrent is already in download list. Trackers weren't merged because it is a private torrent."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
torrent->addTrackers(m_torrentInfo.trackers());
|
torrent->addTrackers(m_torrentInfo.trackers());
|
||||||
torrent->addUrlSeeds(m_torrentInfo.urlSeeds());
|
torrent->addUrlSeeds(m_torrentInfo.urlSeeds());
|
||||||
MessageBoxRaised::information(0, tr("Already in download list"), tr("Torrent is already in download list. Trackers were merged."), QMessageBox::Ok);
|
MessageBoxRaised::information(this, tr("Already in download list"), tr("Torrent is already in download list. Trackers were merged."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageBoxRaised::critical(0, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding state."), QMessageBox::Ok);
|
MessageBoxRaised::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding state."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -284,7 +281,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
|
|||||||
bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
|
bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
|
||||||
{
|
{
|
||||||
if (!magnetUri.isValid()) {
|
if (!magnetUri.isValid()) {
|
||||||
MessageBoxRaised::critical(0, tr("Invalid magnet link"), tr("This magnet link was not recognized"));
|
MessageBoxRaised::critical(this, tr("Invalid magnet link"), tr("This magnet link was not recognized"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,16 +292,16 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
|
|||||||
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
|
||||||
if (torrent) {
|
if (torrent) {
|
||||||
if (torrent->isPrivate()) {
|
if (torrent->isPrivate()) {
|
||||||
MessageBoxRaised::critical(0, tr("Already in download list"), tr("Torrent is already in download list. Trackers weren't merged because it is a private torrent."), QMessageBox::Ok);
|
MessageBoxRaised::critical(this, tr("Already in download list"), tr("Torrent is already in download list. Trackers weren't merged because it is a private torrent."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
torrent->addTrackers(magnetUri.trackers());
|
torrent->addTrackers(magnetUri.trackers());
|
||||||
torrent->addUrlSeeds(magnetUri.urlSeeds());
|
torrent->addUrlSeeds(magnetUri.urlSeeds());
|
||||||
MessageBoxRaised::information(0, tr("Already in download list"), tr("Magnet link is already in download list. Trackers were merged."), QMessageBox::Ok);
|
MessageBoxRaised::information(this, tr("Already in download list"), tr("Magnet link is already in download list. Trackers were merged."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageBoxRaised::critical(0, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok);
|
MessageBoxRaised::critical(this, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -317,8 +314,6 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
|
|||||||
|
|
||||||
setupTreeview();
|
setupTreeview();
|
||||||
TMMChanged(ui->comboTTM->currentIndex());
|
TMMChanged(ui->comboTTM->currentIndex());
|
||||||
// Set dialog position
|
|
||||||
setdialogPosition();
|
|
||||||
|
|
||||||
BitTorrent::Session::instance()->loadMetadata(magnetUri);
|
BitTorrent::Session::instance()->loadMetadata(magnetUri);
|
||||||
setMetadataProgressIndicator(true, tr("Retrieving metadata..."));
|
setMetadataProgressIndicator(true, tr("Retrieving metadata..."));
|
||||||
@ -575,28 +570,6 @@ void AddNewTorrentDialog::renameSelectedFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::setdialogPosition()
|
|
||||||
{
|
|
||||||
// In macOS, AddNewTorrentDialog is a sheet, not a window. Moving it
|
|
||||||
// causes very bad things to happen, especially if AddNewTorrentDialog is
|
|
||||||
// on a secondary monitor.
|
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
qApp->processEvents();
|
|
||||||
QPoint center(Utils::Misc::screenCenter(this));
|
|
||||||
// Adjust y
|
|
||||||
int y = settings()->loadValue(KEY_POSITION, -1).toInt();
|
|
||||||
if (y >= 0) {
|
|
||||||
center.setY(y);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
center.ry() -= 120;
|
|
||||||
if (center.y() < 0)
|
|
||||||
center.setY(0);
|
|
||||||
}
|
|
||||||
move(center);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddNewTorrentDialog::populateSavePathComboBox()
|
void AddNewTorrentDialog::populateSavePathComboBox()
|
||||||
{
|
{
|
||||||
QString defSavePath = BitTorrent::Session::instance()->defaultSavePath();
|
QString defSavePath = BitTorrent::Session::instance()->defaultSavePath();
|
||||||
@ -608,7 +581,7 @@ void AddNewTorrentDialog::populateSavePathComboBox()
|
|||||||
foreach (const QString &savePath, settings()->loadValue(KEY_SAVEPATHHISTORY).toStringList())
|
foreach (const QString &savePath, settings()->loadValue(KEY_SAVEPATHHISTORY).toStringList())
|
||||||
if (QDir(savePath) != defaultSaveDir)
|
if (QDir(savePath) != defaultSaveDir)
|
||||||
ui->savePathComboBox->addItem(Utils::Fs::toNativePath(savePath), savePath);
|
ui->savePathComboBox->addItem(Utils::Fs::toNativePath(savePath), savePath);
|
||||||
|
|
||||||
if (!m_torrentParams.savePath.isEmpty())
|
if (!m_torrentParams.savePath.isEmpty())
|
||||||
setSavePath(m_torrentParams.savePath);
|
setSavePath(m_torrentParams.savePath);
|
||||||
}
|
}
|
||||||
@ -711,7 +684,7 @@ void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &info)
|
|||||||
|
|
||||||
disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo)));
|
disconnect(this, SLOT(updateMetadata(BitTorrent::TorrentInfo)));
|
||||||
if (!info.isValid()) {
|
if (!info.isValid()) {
|
||||||
MessageBoxRaised::critical(0, tr("I/O Error"), ("Invalid metadata."));
|
MessageBoxRaised::critical(this, tr("I/O Error"), ("Invalid metadata."));
|
||||||
setMetadataProgressIndicator(false, tr("Invalid metadata"));
|
setMetadataProgressIndicator(false, tr("Invalid metadata"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -772,13 +745,11 @@ void AddNewTorrentDialog::setupTreeview()
|
|||||||
|
|
||||||
updateDiskSpaceLabel();
|
updateDiskSpaceLabel();
|
||||||
showAdvancedSettings(settings()->loadValue(KEY_EXPANDED, false).toBool());
|
showAdvancedSettings(settings()->loadValue(KEY_EXPANDED, false).toBool());
|
||||||
// Set dialog position
|
|
||||||
setdialogPosition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason)
|
void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason)
|
||||||
{
|
{
|
||||||
MessageBoxRaised::critical(0, tr("Download Error"), QString("Cannot download '%1': %2").arg(url).arg(reason));
|
MessageBoxRaised::critical(this, tr("Download Error"), QString("Cannot download '%1': %2").arg(url).arg(reason));
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ private slots:
|
|||||||
void updateDiskSpaceLabel();
|
void updateDiskSpaceLabel();
|
||||||
void onSavePathChanged(int);
|
void onSavePathChanged(int);
|
||||||
void renameSelectedFile();
|
void renameSelectedFile();
|
||||||
void setdialogPosition();
|
|
||||||
void updateMetadata(const BitTorrent::TorrentInfo &info);
|
void updateMetadata(const BitTorrent::TorrentInfo &info);
|
||||||
void browseButton_clicked();
|
void browseButton_clicked();
|
||||||
void handleDownloadFailed(const QString &url, const QString &reason);
|
void handleDownloadFailed(const QString &url, const QString &reason);
|
||||||
|
@ -72,7 +72,6 @@ void AutoExpandableDialog::showEvent(QShowEvent *e) {
|
|||||||
// NOTE: For some strange reason QFontMetrics gets more accurate
|
// NOTE: For some strange reason QFontMetrics gets more accurate
|
||||||
// when called from showEvent. Only 6 symbols off instead of 11 symbols off.
|
// when called from showEvent. Only 6 symbols off instead of 11 symbols off.
|
||||||
int textW = ui->textEdit->fontMetrics().width(ui->textEdit->text()) + 4;
|
int textW = ui->textEdit->fontMetrics().width(ui->textEdit->text()) + 4;
|
||||||
int screenW = QApplication::desktop()->width() / 4;
|
|
||||||
int wd = textW;
|
int wd = textW;
|
||||||
|
|
||||||
if (!windowTitle().isEmpty()) {
|
if (!windowTitle().isEmpty()) {
|
||||||
@ -87,35 +86,9 @@ void AutoExpandableDialog::showEvent(QShowEvent *e) {
|
|||||||
wd = _w;
|
wd = _w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Now resize the dialog to fit the contents
|
// Now resize the dialog to fit the contents
|
||||||
// Maximum value is whichever is smaller:
|
// max width of text from either of: label, title, textedit
|
||||||
// 1. screen width / 4
|
|
||||||
// 2. max width of text from either of: label, title, textedit
|
|
||||||
// If the value is less than dialog default size default size is used
|
// If the value is less than dialog default size default size is used
|
||||||
wd = textW < screenW ? textW : screenW;
|
|
||||||
if (wd > width())
|
if (wd > width())
|
||||||
resize(width() - ui->horizontalLayout->sizeHint().width() + wd, height());
|
resize(width() - ui->verticalLayout->sizeHint().width() + wd, height());
|
||||||
|
|
||||||
// Use old dialog behavior: prohibit resizing the dialog
|
|
||||||
setFixedHeight(height());
|
|
||||||
|
|
||||||
// Update geometry: center on screen
|
|
||||||
QDesktopWidget *desk = QApplication::desktop();
|
|
||||||
MainWindow *wnd = qobject_cast<MainWindow*>(QApplication::activeWindow());
|
|
||||||
QPoint p = QCursor::pos();
|
|
||||||
|
|
||||||
int screenNum = 0;
|
|
||||||
if (wnd == 0)
|
|
||||||
screenNum = desk->screenNumber(p);
|
|
||||||
else if (!wnd->isHidden())
|
|
||||||
screenNum = desk->screenNumber(wnd);
|
|
||||||
else
|
|
||||||
screenNum = desk->screenNumber(p);
|
|
||||||
|
|
||||||
QRect screenRes = desk->screenGeometry(screenNum);
|
|
||||||
|
|
||||||
QRect geom = geometry();
|
|
||||||
geom.moveCenter(QPoint(screenRes.width() / 2, screenRes.height() / 2));
|
|
||||||
setGeometry(geom);
|
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ class AutoExpandableDialog;
|
|||||||
|
|
||||||
class AutoExpandableDialog : public QDialog {
|
class AutoExpandableDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutoExpandableDialog(QWidget *parent = 0);
|
explicit AutoExpandableDialog(QWidget *parent);
|
||||||
~AutoExpandableDialog();
|
~AutoExpandableDialog();
|
||||||
|
|
||||||
static QString getText(QWidget *parent, const QString& title, const QString& label,
|
static QString getText(QWidget *parent, const QString& title, const QString& label,
|
||||||
@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *e);
|
void showEvent(QShowEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AutoExpandableDialog *ui;
|
Ui::AutoExpandableDialog *ui;
|
||||||
};
|
};
|
||||||
|
@ -7,79 +7,23 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>222</width>
|
<width>222</width>
|
||||||
<height>94</height>
|
<height>105</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Dialog</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<widget class="QLabel" name="textLabel"/>
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="textLabel">
|
<widget class="QLineEdit" name="textEdit"/>
|
||||||
<property name="toolTip">
|
</item>
|
||||||
<string notr="true"/>
|
<item>
|
||||||
</property>
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="text">
|
<property name="standardButtons">
|
||||||
<string notr="true"/>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="textEdit">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</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>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
<height>83</height>
|
<height>83</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Bandwidth allocation</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
@ -25,9 +22,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBandwidth">
|
<widget class="QSpinBox" name="spinBandwidth">
|
||||||
<property name="suffix">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>65535</number>
|
<number>65535</number>
|
||||||
</property>
|
</property>
|
||||||
@ -40,9 +34,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "ui_cookiesdialog.h"
|
#include "ui_cookiesdialog.h"
|
||||||
|
|
||||||
#define SETTINGS_KEY(name) "CookiesDialog/" name
|
#define SETTINGS_KEY(name) "CookiesDialog/" name
|
||||||
const QString KEY_GEOMETRY = SETTINGS_KEY("Geometry");
|
const QString KEY_SIZE = SETTINGS_KEY("Size");
|
||||||
const QString KEY_COOKIESVIEWSTATE = SETTINGS_KEY("CookiesViewState");
|
const QString KEY_COOKIESVIEWSTATE = SETTINGS_KEY("CookiesViewState");
|
||||||
|
|
||||||
CookiesDialog::CookiesDialog(QWidget *parent)
|
CookiesDialog::CookiesDialog(QWidget *parent)
|
||||||
@ -55,14 +55,14 @@ CookiesDialog::CookiesDialog(QWidget *parent)
|
|||||||
m_cookiesModel->index(0, 0),
|
m_cookiesModel->index(0, 0),
|
||||||
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||||
|
|
||||||
restoreGeometry(SettingsStorage::instance()->loadValue(KEY_GEOMETRY).toByteArray());
|
resize(SettingsStorage::instance()->loadValue(KEY_SIZE, size()).toSize());
|
||||||
m_ui->treeView->header()->restoreState(
|
m_ui->treeView->header()->restoreState(
|
||||||
SettingsStorage::instance()->loadValue(KEY_COOKIESVIEWSTATE).toByteArray());
|
SettingsStorage::instance()->loadValue(KEY_COOKIESVIEWSTATE).toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
CookiesDialog::~CookiesDialog()
|
CookiesDialog::~CookiesDialog()
|
||||||
{
|
{
|
||||||
SettingsStorage::instance()->storeValue(KEY_GEOMETRY, saveGeometry());
|
SettingsStorage::instance()->storeValue(KEY_SIZE, size());
|
||||||
SettingsStorage::instance()->storeValue(
|
SettingsStorage::instance()->storeValue(
|
||||||
KEY_COOKIESVIEWSTATE, m_ui->treeView->header()->saveState());
|
KEY_COOKIESVIEWSTATE, m_ui->treeView->header()->saveState());
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
|
@ -54,7 +54,6 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
|
|||||||
lbl_warn->setFixedWidth(lbl_warn->height());
|
lbl_warn->setFixedWidth(lbl_warn->height());
|
||||||
rememberBtn->setIcon(GuiIconProvider::instance()->getIcon("object-locked"));
|
rememberBtn->setIcon(GuiIconProvider::instance()->getIcon("object-locked"));
|
||||||
|
|
||||||
move(Utils::Misc::screenCenter(this));
|
|
||||||
checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());
|
checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());
|
||||||
connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));
|
connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));
|
||||||
buttonBox->button(QDialogButtonBox::Cancel)->setFocus();
|
buttonBox->button(QDialogButtonBox::Cancel)->setFocus();
|
||||||
@ -64,8 +63,8 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
|
|||||||
return checkPermDelete->isChecked();
|
return checkPermDelete->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool askForDeletionConfirmation(bool& deleteLocalFiles, const int& size, const QString& name) {
|
static bool askForDeletionConfirmation(QWidget *parent, bool& deleteLocalFiles, const int& size, const QString& name) {
|
||||||
DeletionConfirmationDlg dlg(NULL, size, name, deleteLocalFiles);
|
DeletionConfirmationDlg dlg(parent, size, name, deleteLocalFiles);
|
||||||
if (dlg.exec() == QDialog::Accepted) {
|
if (dlg.exec() == QDialog::Accepted) {
|
||||||
deleteLocalFiles = dlg.shouldDeleteLocalFiles();
|
deleteLocalFiles = dlg.shouldDeleteLocalFiles();
|
||||||
return true;
|
return true;
|
||||||
|
@ -47,7 +47,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
show();
|
|
||||||
// Paste clipboard if there is an URL in it
|
// Paste clipboard if there is an URL in it
|
||||||
QString clip_txt = qApp->clipboard()->text();
|
QString clip_txt = qApp->clipboard()->text();
|
||||||
QStringList clip_txt_list = clip_txt.split(QString::fromUtf8("\n"));
|
QStringList clip_txt_list = clip_txt.split(QString::fromUtf8("\n"));
|
||||||
@ -71,6 +71,8 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
|||||||
}
|
}
|
||||||
if (clip_txt_list_cleaned.size() > 0)
|
if (clip_txt_list_cleaned.size() > 0)
|
||||||
textUrls->setText(clip_txt_list_cleaned.join("\n"));
|
textUrls->setText(clip_txt_list_cleaned.join("\n"));
|
||||||
|
|
||||||
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
~downloadFromURL() {}
|
~downloadFromURL() {}
|
||||||
@ -93,7 +95,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!url_list_cleaned.size()) {
|
if (!url_list_cleaned.size()) {
|
||||||
QMessageBox::warning(0, tr("No URL entered"), tr("Please type at least one URL."));
|
QMessageBox::warning(this, tr("No URL entered"), tr("Please type at least one URL."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit urlsReadyToBeDownloaded(url_list_cleaned);
|
emit urlsReadyToBeDownloaded(url_list_cleaned);
|
||||||
|
@ -15,21 +15,17 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<widget class="QLabel" name="downloadURL_lbl">
|
||||||
<item>
|
<property name="font">
|
||||||
<widget class="QLabel" name="downloadURL_lbl">
|
<font>
|
||||||
<property name="font">
|
<weight>75</weight>
|
||||||
<font>
|
<bold>true</bold>
|
||||||
<weight>75</weight>
|
</font>
|
||||||
<bold>true</bold>
|
</property>
|
||||||
</font>
|
<property name="text">
|
||||||
</property>
|
<string>Add torrent links</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Add torrent links</string>
|
</widget>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextEdit" name="textUrls">
|
<widget class="QTextEdit" name="textUrls">
|
||||||
@ -43,19 +39,13 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_infos">
|
<widget class="QLabel" name="label_infos">
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>17</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<italic>true</italic>
|
<italic>true</italic>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>One per line (HTTP links, Magnet links and info-hashes are supported)</string>
|
<string>One link per line (HTTP links, Magnet links and info-hashes are supported)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -385,7 +385,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
qDebug("GUI Built");
|
qDebug("GUI Built");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (!pref->neverCheckFileAssoc() && (!Preferences::isTorrentFileAssocSet() || !Preferences::isMagnetLinkAssocSet())) {
|
if (!pref->neverCheckFileAssoc() && (!Preferences::isTorrentFileAssocSet() || !Preferences::isMagnetLinkAssocSet())) {
|
||||||
if (QMessageBox::question(0, tr("Torrent file association"),
|
if (QMessageBox::question(this, tr("Torrent file association"),
|
||||||
tr("qBittorrent is not the default application to open torrent files or Magnet links.\nDo you want to associate qBittorrent to torrent files and Magnet links?"),
|
tr("qBittorrent is not the default application to open torrent files or Magnet links.\nDo you want to associate qBittorrent to torrent files and Magnet links?"),
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
|
||||||
Preferences::setTorrentFileAssoc(true);
|
Preferences::setTorrentFileAssoc(true);
|
||||||
@ -841,7 +841,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHand
|
|||||||
if (pref->recursiveDownloadDisabled()) return;
|
if (pref->recursiveDownloadDisabled()) return;
|
||||||
// Get Torrent name
|
// Get Torrent name
|
||||||
QString torrentName = torrent->name();
|
QString torrentName = torrent->name();
|
||||||
QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent '%1' contains torrent files, do you want to proceed with their download?").arg(torrentName));
|
QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent '%1' contains torrent files, do you want to proceed with their download?").arg(torrentName), QMessageBox::NoButton, this);
|
||||||
QPushButton *yes = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole);
|
QPushButton *yes = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole);
|
||||||
/*QPushButton *no = */ confirmBox.addButton(tr("No"), QMessageBox::NoRole);
|
/*QPushButton *no = */ confirmBox.addButton(tr("No"), QMessageBox::NoRole);
|
||||||
QPushButton *never = confirmBox.addButton(tr("Never"), QMessageBox::NoRole);
|
QPushButton *never = confirmBox.addButton(tr("Never"), QMessageBox::NoRole);
|
||||||
@ -862,10 +862,12 @@ void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const
|
|||||||
void MainWindow::on_actionSetGlobalUploadLimit_triggered()
|
void MainWindow::on_actionSetGlobalUploadLimit_triggered()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||||
&ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit());
|
this, &ok, tr("Global Upload Speed Limit"), session->uploadSpeedLimit());
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.);
|
qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.);
|
||||||
session->setUploadSpeedLimit(newLimit);
|
session->setUploadSpeedLimit(newLimit);
|
||||||
@ -875,10 +877,12 @@ void MainWindow::on_actionSetGlobalUploadLimit_triggered()
|
|||||||
void MainWindow::on_actionSetGlobalDownloadLimit_triggered()
|
void MainWindow::on_actionSetGlobalDownloadLimit_triggered()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||||
&ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit());
|
this, &ok, tr("Global Download Speed Limit"), session->downloadSpeedLimit());
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.);
|
qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.);
|
||||||
session->setDownloadSpeedLimit(newLimit);
|
session->setDownloadSpeedLimit(newLimit);
|
||||||
@ -1164,8 +1168,9 @@ void MainWindow::on_actionOpen_triggered()
|
|||||||
// Open File Open Dialog
|
// Open File Open Dialog
|
||||||
// Note: it is possible to select more than one file
|
// Note: it is possible to select more than one file
|
||||||
const QStringList pathsList =
|
const QStringList pathsList =
|
||||||
QFileDialog::getOpenFileNames(0, tr("Open Torrent Files"), pref->getMainLastDir(),
|
QFileDialog::getOpenFileNames(this, tr("Open Torrent Files"), pref->getMainLastDir(),
|
||||||
tr("Torrent Files") + " (*.torrent)");
|
tr("Torrent Files") + " (*.torrent)");
|
||||||
|
|
||||||
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
|
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
|
||||||
if (!pathsList.isEmpty()) {
|
if (!pathsList.isEmpty()) {
|
||||||
foreach (QString file, pathsList) {
|
foreach (QString file, pathsList) {
|
||||||
|
@ -52,7 +52,6 @@ class TransferListFiltersWidget;
|
|||||||
class PropertiesWidget;
|
class PropertiesWidget;
|
||||||
class StatusBar;
|
class StatusBar;
|
||||||
class TorrentCreatorDlg;
|
class TorrentCreatorDlg;
|
||||||
class downloadFromURL;
|
|
||||||
class LineEdit;
|
class LineEdit;
|
||||||
class ExecutionLog;
|
class ExecutionLog;
|
||||||
class PowerManagement;
|
class PowerManagement;
|
||||||
|
@ -357,7 +357,6 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
m_ui->advPageLayout->addWidget(advancedSettings);
|
m_ui->advPageLayout->addWidget(advancedSettings);
|
||||||
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
|
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
|
||||||
|
|
||||||
// Adapt size
|
|
||||||
show();
|
show();
|
||||||
loadWindowState();
|
loadWindowState();
|
||||||
}
|
}
|
||||||
@ -404,14 +403,9 @@ void OptionsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previo
|
|||||||
void OptionsDialog::loadWindowState()
|
void OptionsDialog::loadWindowState()
|
||||||
{
|
{
|
||||||
const Preferences* const pref = Preferences::instance();
|
const Preferences* const pref = Preferences::instance();
|
||||||
resize(pref->getPrefSize(sizeFittingScreen()));
|
|
||||||
QPoint p = pref->getPrefPos();
|
resize(pref->getPrefSize(this->size()));
|
||||||
QRect scr_rect = qApp->desktop()->screenGeometry();
|
|
||||||
if (!p.isNull() && scr_rect.contains(p))
|
|
||||||
move(p);
|
|
||||||
// Load slider size
|
|
||||||
const QStringList sizes_str = pref->getPrefHSplitterSizes();
|
const QStringList sizes_str = pref->getPrefHSplitterSizes();
|
||||||
// Splitter size
|
|
||||||
QList<int> sizes;
|
QList<int> sizes;
|
||||||
if (sizes_str.size() == 2) {
|
if (sizes_str.size() == 2) {
|
||||||
sizes << sizes_str.first().toInt();
|
sizes << sizes_str.first().toInt();
|
||||||
@ -427,8 +421,10 @@ void OptionsDialog::loadWindowState()
|
|||||||
void OptionsDialog::saveWindowState() const
|
void OptionsDialog::saveWindowState() const
|
||||||
{
|
{
|
||||||
Preferences* const pref = Preferences::instance();
|
Preferences* const pref = Preferences::instance();
|
||||||
|
|
||||||
|
// window size
|
||||||
pref->setPrefSize(size());
|
pref->setPrefSize(size());
|
||||||
pref->setPrefPos(pos());
|
|
||||||
// Splitter size
|
// Splitter size
|
||||||
QStringList sizes_str;
|
QStringList sizes_str;
|
||||||
sizes_str << QString::number(m_ui->hsplitter->sizes().first());
|
sizes_str << QString::number(m_ui->hsplitter->sizes().first());
|
||||||
@ -436,25 +432,6 @@ void OptionsDialog::saveWindowState() const
|
|||||||
pref->setPrefHSplitterSizes(sizes_str);
|
pref->setPrefHSplitterSizes(sizes_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize OptionsDialog::sizeFittingScreen() const
|
|
||||||
{
|
|
||||||
int scrn = 0;
|
|
||||||
QWidget *w = this->topLevelWidget();
|
|
||||||
|
|
||||||
if (w)
|
|
||||||
scrn = QApplication::desktop()->screenNumber(w);
|
|
||||||
else if (QApplication::desktop()->isVirtualDesktop())
|
|
||||||
scrn = QApplication::desktop()->screenNumber(QCursor::pos());
|
|
||||||
else
|
|
||||||
scrn = QApplication::desktop()->screenNumber(this);
|
|
||||||
|
|
||||||
QRect desk(QApplication::desktop()->availableGeometry(scrn));
|
|
||||||
if (width() > desk.width() || height() > desk.height())
|
|
||||||
if (desk.width() > 0 && desk.height() > 0)
|
|
||||||
return QSize(desk.width(), desk.height());
|
|
||||||
return size();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDialog::saveOptions()
|
void OptionsDialog::saveOptions()
|
||||||
{
|
{
|
||||||
applyButton->setEnabled(false);
|
applyButton->setEnabled(false);
|
||||||
|
@ -170,7 +170,6 @@ private:
|
|||||||
quint16 webUiPort() const;
|
quint16 webUiPort() const;
|
||||||
QString webUiUsername() const;
|
QString webUiUsername() const;
|
||||||
QString webUiPassword() const;
|
QString webUiPassword() const;
|
||||||
QSize sizeFittingScreen() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool setSslKey(const QByteArray &key);
|
bool setSslKey(const QByteArray &key);
|
||||||
|
@ -16,18 +16,9 @@
|
|||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>42</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>The following files support previewing, please select one of them:</string>
|
<string>The following files support previewing, please select one of them:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -83,7 +83,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, BitTorrent::TorrentHandle *const t
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!previewListModel->rowCount()) {
|
if (!previewListModel->rowCount()) {
|
||||||
QMessageBox::critical(0, tr("Preview impossible"), tr("Sorry, we can't preview this file"));
|
QMessageBox::critical(this->parentWidget(), tr("Preview impossible"), tr("Sorry, we can't preview this file"));
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
connect(this, SIGNAL(readyToPreviewFile(QString)), parent, SLOT(previewFile(QString)));
|
connect(this, SIGNAL(readyToPreviewFile(QString)), parent, SLOT(previewFile(QString)));
|
||||||
@ -120,7 +120,7 @@ void PreviewSelect::on_previewButton_clicked() {
|
|||||||
if (QFile::exists(path))
|
if (QFile::exists(path))
|
||||||
emit readyToPreviewFile(path);
|
emit readyToPreviewFile(path);
|
||||||
else
|
else
|
||||||
QMessageBox::critical(0, tr("Preview impossible"), tr("Sorry, we can't preview this file"));
|
QMessageBox::critical(this->parentWidget(), tr("Preview impossible"), tr("Sorry, we can't preview this file"));
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
|
|||||||
QAction *act = menu.exec(QCursor::pos());
|
QAction *act = menu.exec(QCursor::pos());
|
||||||
if (act == 0) return;
|
if (act == 0) return;
|
||||||
if (act == addPeerAct) {
|
if (act == addPeerAct) {
|
||||||
QList<BitTorrent::PeerAddress> peersList = PeersAdditionDlg::askForPeers();
|
QList<BitTorrent::PeerAddress> peersList = PeersAdditionDlg::askForPeers(this);
|
||||||
int peerCount = 0;
|
int peerCount = 0;
|
||||||
foreach (const BitTorrent::PeerAddress &addr, peersList) {
|
foreach (const BitTorrent::PeerAddress &addr, peersList) {
|
||||||
if (torrent->connectPeer(addr)) {
|
if (torrent->connectPeer(addr)) {
|
||||||
@ -258,9 +258,9 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (peerCount < peersList.length())
|
if (peerCount < peersList.length())
|
||||||
QMessageBox::information(0, tr("Peer addition"), tr("Some peers could not be added. Check the Log for details."));
|
QMessageBox::information(this, tr("Peer addition"), tr("Some peers could not be added. Check the Log for details."));
|
||||||
else if (peerCount > 0)
|
else if (peerCount > 0)
|
||||||
QMessageBox::information(0, tr("Peer addition"), tr("The peers were added to this torrent."));
|
QMessageBox::information(this, tr("Peer addition"), tr("The peers were added to this torrent."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (act == banAct) {
|
if (act == banAct) {
|
||||||
|
@ -51,9 +51,9 @@ PeersAdditionDlg::~PeersAdditionDlg()
|
|||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BitTorrent::PeerAddress> PeersAdditionDlg::askForPeers()
|
QList<BitTorrent::PeerAddress> PeersAdditionDlg::askForPeers(QWidget *parent)
|
||||||
{
|
{
|
||||||
PeersAdditionDlg dlg;
|
PeersAdditionDlg dlg(parent);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
return dlg.m_peersList;
|
return dlg.m_peersList;
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,10 @@ class PeersAdditionDlg: public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PeersAdditionDlg(QWidget *parent = 0);
|
PeersAdditionDlg(QWidget *parent);
|
||||||
~PeersAdditionDlg();
|
~PeersAdditionDlg();
|
||||||
|
|
||||||
static QList<BitTorrent::PeerAddress> askForPeers();
|
static QList<BitTorrent::PeerAddress> askForPeers(QWidget *parent);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void validateInput();
|
void validateInput();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>List of peers to add (one per line):</string>
|
<string>List of peers to add (one IP per line):</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -40,9 +40,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -347,7 +347,7 @@ void TrackerList::askForTrackers() {
|
|||||||
if (!torrent) return;
|
if (!torrent) return;
|
||||||
|
|
||||||
QList<BitTorrent::TrackerEntry> trackers;
|
QList<BitTorrent::TrackerEntry> trackers;
|
||||||
foreach (const QString &tracker, TrackersAdditionDlg::askForTrackers(torrent))
|
foreach (const QString &tracker, TrackersAdditionDlg::askForTrackers(this, torrent))
|
||||||
trackers << tracker;
|
trackers << tracker;
|
||||||
torrent->addTrackers(trackers);
|
torrent->addTrackers(trackers);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "guiiconprovider.h"
|
#include "guiiconprovider.h"
|
||||||
#include "ui_trackersadditiondlg.h"
|
#include "ui_trackersadditiondlg.h"
|
||||||
|
|
||||||
TrackersAdditionDlg::TrackersAdditionDlg(BitTorrent::TorrentHandle *const torrent, QWidget *parent)
|
TrackersAdditionDlg::TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_ui(new Ui::TrackersAdditionDlg())
|
, m_ui(new Ui::TrackersAdditionDlg())
|
||||||
, m_torrent(torrent)
|
, m_torrent(torrent)
|
||||||
@ -132,10 +132,10 @@ void TrackersAdditionDlg::getTrackerError(const QString &, const QString &error)
|
|||||||
QMessageBox::warning(this, tr("Download error"), tr("The trackers list could not be downloaded, reason: %1").arg(error), QMessageBox::Ok);
|
QMessageBox::warning(this, tr("Download error"), tr("The trackers list could not be downloaded, reason: %1").arg(error), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList TrackersAdditionDlg::askForTrackers(BitTorrent::TorrentHandle *const torrent)
|
QStringList TrackersAdditionDlg::askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
|
||||||
{
|
{
|
||||||
QStringList trackers;
|
QStringList trackers;
|
||||||
TrackersAdditionDlg dlg(torrent);
|
TrackersAdditionDlg dlg(parent, torrent);
|
||||||
if (dlg.exec() == QDialog::Accepted)
|
if (dlg.exec() == QDialog::Accepted)
|
||||||
return dlg.newTrackers();
|
return dlg.newTrackers();
|
||||||
|
|
||||||
|
@ -51,11 +51,11 @@ class TrackersAdditionDlg : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TrackersAdditionDlg(BitTorrent::TorrentHandle *const torrent, QWidget *parent = 0);
|
TrackersAdditionDlg(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
|
||||||
~TrackersAdditionDlg();
|
~TrackersAdditionDlg();
|
||||||
|
|
||||||
QStringList newTrackers() const;
|
QStringList newTrackers() const;
|
||||||
static QStringList askForTrackers(BitTorrent::TorrentHandle *const torrent);
|
static QStringList askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_uTorrentListButton_clicked();
|
void on_uTorrentListButton_clicked();
|
||||||
|
@ -26,13 +26,6 @@
|
|||||||
<property name="lineWrapMode">
|
<property name="lineWrapMode">
|
||||||
<enum>QTextEdit::NoWrap</enum>
|
<enum>QTextEdit::NoWrap</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="html">
|
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
<property name="acceptRichText">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -51,23 +44,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<widget class="QLineEdit" name="list_url"/>
|
<widget class="QLineEdit" name="list_url"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="uTorrentListButton">
|
<widget class="QPushButton" name="uTorrentListButton"/>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>31</width>
|
|
||||||
<height>31</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>31</width>
|
|
||||||
<height>31</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
@ -149,17 +149,15 @@ AutomatedRssDownloader::~AutomatedRssDownloader()
|
|||||||
|
|
||||||
void AutomatedRssDownloader::loadSettings()
|
void AutomatedRssDownloader::loadSettings()
|
||||||
{
|
{
|
||||||
// load dialog geometry
|
|
||||||
const Preferences *const pref = Preferences::instance();
|
const Preferences *const pref = Preferences::instance();
|
||||||
restoreGeometry(pref->getRssGeometry());
|
resize(pref->getRssGeometrySize(this->size()));
|
||||||
m_ui->hsplitter->restoreState(pref->getRssHSplitterSizes());
|
m_ui->hsplitter->restoreState(pref->getRssHSplitterSizes());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutomatedRssDownloader::saveSettings()
|
void AutomatedRssDownloader::saveSettings()
|
||||||
{
|
{
|
||||||
// Save dialog geometry
|
|
||||||
Preferences *const pref = Preferences::instance();
|
Preferences *const pref = Preferences::instance();
|
||||||
pref->setRssGeometry(saveGeometry());
|
pref->setRssGeometrySize(this->size());
|
||||||
pref->setRssHSplitterSizes(m_ui->hsplitter->saveState());
|
pref->setRssHSplitterSizes(m_ui->hsplitter->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,9 +207,9 @@ void PluginSelectDlg::on_actionUninstall_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
QMessageBox::warning(0, tr("Uninstall warning"), tr("Some plugins could not be uninstalled because they are included in qBittorrent. Only the ones you added yourself can be uninstalled.\nThose plugins were disabled."));
|
QMessageBox::warning(this, tr("Uninstall warning"), tr("Some plugins could not be uninstalled because they are included in qBittorrent. Only the ones you added yourself can be uninstalled.\nThose plugins were disabled."));
|
||||||
else
|
else
|
||||||
QMessageBox::information(0, tr("Uninstall success"), tr("All selected plugins were uninstalled successfully"));
|
QMessageBox::information(this, tr("Uninstall success"), tr("All selected plugins were uninstalled successfully"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginSelectDlg::enableSelection(bool enable)
|
void PluginSelectDlg::enableSelection(bool enable)
|
||||||
|
@ -265,7 +265,7 @@ void SearchWidget::on_searchButton_clicked()
|
|||||||
const QString pattern = m_ui->m_searchPattern->text().trimmed();
|
const QString pattern = m_ui->m_searchPattern->text().trimmed();
|
||||||
// No search pattern entered
|
// No search pattern entered
|
||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
QMessageBox::critical(0, tr("Empty search pattern"), tr("Please type a search pattern first"));
|
QMessageBox::critical(this, tr("Empty search pattern"), tr("Please type a search pattern first"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,9 @@
|
|||||||
#include "base/utils/misc.h"
|
#include "base/utils/misc.h"
|
||||||
|
|
||||||
|
|
||||||
ShutdownConfirmDlg::ShutdownConfirmDlg(const ShutdownDialogAction &action)
|
ShutdownConfirmDlg::ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogAction &action)
|
||||||
: ui(new Ui::confirmShutdownDlg)
|
: QDialog(parent)
|
||||||
|
, ui(new Ui::confirmShutdownDlg)
|
||||||
, m_timeout(15)
|
, m_timeout(15)
|
||||||
, m_action(action)
|
, m_action(action)
|
||||||
{
|
{
|
||||||
@ -82,9 +83,9 @@ void ShutdownConfirmDlg::showEvent(QShowEvent *event)
|
|||||||
m_timer.start();
|
m_timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShutdownConfirmDlg::askForConfirmation(const ShutdownDialogAction &action)
|
bool ShutdownConfirmDlg::askForConfirmation(QWidget *parent, const ShutdownDialogAction &action)
|
||||||
{
|
{
|
||||||
ShutdownConfirmDlg dlg(action);
|
ShutdownConfirmDlg dlg(parent, action);
|
||||||
return (dlg.exec() == QDialog::Accepted);
|
return (dlg.exec() == QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ class ShutdownConfirmDlg: public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShutdownConfirmDlg(const ShutdownDialogAction &action);
|
ShutdownConfirmDlg(QWidget *parent, const ShutdownDialogAction &action);
|
||||||
~ShutdownConfirmDlg();
|
~ShutdownConfirmDlg();
|
||||||
|
|
||||||
static bool askForConfirmation(const ShutdownDialogAction &action);
|
static bool askForConfirmation(QWidget *parent, const ShutdownDialogAction &action);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
@ -39,10 +39,10 @@ SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
qDebug("Bandwidth allocation dialog creation");
|
qDebug("Bandwidth allocation dialog creation");
|
||||||
|
|
||||||
// Connect to slots
|
// Connect to slots
|
||||||
connect(m_ui->bandwidthSlider, SIGNAL(valueChanged(int)), this, SLOT(updateSpinValue(int)));
|
connect(m_ui->bandwidthSlider, SIGNAL(valueChanged(int)), this, SLOT(updateSpinValue(int)));
|
||||||
connect(m_ui->spinBandwidth, SIGNAL(valueChanged(int)), this, SLOT(updateSliderValue(int)));
|
connect(m_ui->spinBandwidth, SIGNAL(valueChanged(int)), this, SLOT(updateSliderValue(int)));
|
||||||
move(Utils::Misc::screenCenter(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpeedLimitDialog::~SpeedLimitDialog()
|
SpeedLimitDialog::~SpeedLimitDialog()
|
||||||
@ -52,9 +52,9 @@ SpeedLimitDialog::~SpeedLimitDialog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -2: if cancel
|
// -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.setWindowTitle(title);
|
||||||
dlg.setupDialog(max_value / 1024., default_value / 1024.);
|
dlg.setupDialog(max_value / 1024., default_value / 1024.);
|
||||||
if (dlg.exec() == QDialog::Accepted) {
|
if (dlg.exec() == QDialog::Accepted) {
|
||||||
|
@ -44,9 +44,9 @@ namespace Ui
|
|||||||
class SpeedLimitDialog : public QDialog {
|
class SpeedLimitDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SpeedLimitDialog(QWidget *parent=0);
|
explicit SpeedLimitDialog(QWidget *parent);
|
||||||
~SpeedLimitDialog();
|
~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:
|
protected slots:
|
||||||
void updateSpinValue(int val) const;
|
void updateSpinValue(int val) const;
|
||||||
|
@ -44,12 +44,13 @@ StatsDialog::StatsDialog(QWidget *parent)
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(ui->buttonOK, SIGNAL(clicked()), SLOT(close()));
|
connect(ui->buttonBox, SIGNAL(accepted()), SLOT(close()));
|
||||||
updateUI();
|
updateUI();
|
||||||
t = new QTimer(this);
|
t = new QTimer(this);
|
||||||
t->setInterval(1500);
|
t->setInterval(1500);
|
||||||
connect(t, SIGNAL(timeout()), SLOT(updateUI()));
|
connect(t, SIGNAL(timeout()), SLOT(updateUI()));
|
||||||
t->start();
|
t->start();
|
||||||
|
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class StatsDialog : public QDialog {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StatsDialog(QWidget *parent = 0);
|
explicit StatsDialog(QWidget *parent);
|
||||||
~StatsDialog();
|
~StatsDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>273</width>
|
<width>286</width>
|
||||||
<height>395</height>
|
<height>401</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -223,28 +223,11 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<item>
|
<property name="standardButtons">
|
||||||
<spacer name="horizontalSpacer">
|
<set>QDialogButtonBox::Ok</set>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Horizontal</enum>
|
</widget>
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="buttonOK">
|
|
||||||
<property name="text">
|
|
||||||
<string>OK</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -252,9 +252,10 @@ void StatusBar::toggleAlternativeSpeeds()
|
|||||||
void StatusBar::capDownloadSpeed()
|
void StatusBar::capDownloadSpeed()
|
||||||
{
|
{
|
||||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
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) {
|
if (ok) {
|
||||||
qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.);
|
qDebug("Setting global download rate limit to %.1fKb/s", newLimit / 1024.);
|
||||||
session->setDownloadSpeedLimit(newLimit);
|
session->setDownloadSpeedLimit(newLimit);
|
||||||
@ -265,9 +266,10 @@ void StatusBar::capDownloadSpeed()
|
|||||||
void StatusBar::capUploadSpeed()
|
void StatusBar::capUploadSpeed()
|
||||||
{
|
{
|
||||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
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) {
|
if (ok) {
|
||||||
qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.);
|
qDebug("Setting global upload rate limit to %.1fKb/s", newLimit / 1024.);
|
||||||
session->setUploadSpeedLimit(newLimit);
|
session->setUploadSpeedLimit(newLimit);
|
||||||
|
@ -328,7 +328,7 @@ void TransferListWidget::deleteSelectedTorrents(bool deleteLocalFiles)
|
|||||||
if (torrents.empty()) return;
|
if (torrents.empty()) return;
|
||||||
|
|
||||||
if (Preferences::instance()->confirmTorrentDeletion()
|
if (Preferences::instance()->confirmTorrentDeletion()
|
||||||
&& !DeletionConfirmationDlg::askForDeletionConfirmation(deleteLocalFiles, torrents.size(), torrents[0]->name()))
|
&& !DeletionConfirmationDlg::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name()))
|
||||||
return;
|
return;
|
||||||
foreach (BitTorrent::TorrentHandle *const torrent, torrents)
|
foreach (BitTorrent::TorrentHandle *const torrent, torrents)
|
||||||
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles);
|
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles);
|
||||||
@ -344,8 +344,9 @@ void TransferListWidget::deleteVisibleTorrents()
|
|||||||
|
|
||||||
bool deleteLocalFiles = false;
|
bool deleteLocalFiles = false;
|
||||||
if (Preferences::instance()->confirmTorrentDeletion()
|
if (Preferences::instance()->confirmTorrentDeletion()
|
||||||
&& !DeletionConfirmationDlg::askForDeletionConfirmation(deleteLocalFiles, torrents.size(), torrents[0]->name()))
|
&& !DeletionConfirmationDlg::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (BitTorrent::TorrentHandle *const torrent, torrents)
|
foreach (BitTorrent::TorrentHandle *const torrent, torrents)
|
||||||
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles);
|
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles);
|
||||||
}
|
}
|
||||||
@ -445,7 +446,7 @@ void TransferListWidget::setDlLimitSelectedTorrents()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||||
&ok, tr("Torrent Download Speed Limiting"), oldLimit
|
this, &ok, tr("Torrent Download Speed Limiting"), oldLimit
|
||||||
, BitTorrent::Session::instance()->globalDownloadSpeedLimit());
|
, BitTorrent::Session::instance()->globalDownloadSpeedLimit());
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
|
||||||
@ -470,7 +471,7 @@ void TransferListWidget::setUpLimitSelectedTorrents()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
const long newLimit = SpeedLimitDialog::askSpeedLimit(
|
||||||
&ok, tr("Torrent Upload Speed Limiting"), oldLimit
|
this, &ok, tr("Torrent Upload Speed Limiting"), oldLimit
|
||||||
, BitTorrent::Session::instance()->globalUploadSpeedLimit());
|
, BitTorrent::Session::instance()->globalUploadSpeedLimit());
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user