diff --git a/src/gui/autoexpandabledialog.cpp b/src/gui/autoexpandabledialog.cpp index ed42eaa7c..1194e1ab7 100644 --- a/src/gui/autoexpandabledialog.cpp +++ b/src/gui/autoexpandabledialog.cpp @@ -72,7 +72,6 @@ void AutoExpandableDialog::showEvent(QShowEvent *e) { // NOTE: For some strange reason QFontMetrics gets more accurate // when called from showEvent. Only 6 symbols off instead of 11 symbols off. int textW = ui->textEdit->fontMetrics().width(ui->textEdit->text()) + 4; - int screenW = QApplication::desktop()->width() / 4; int wd = textW; if (!windowTitle().isEmpty()) { @@ -87,35 +86,9 @@ void AutoExpandableDialog::showEvent(QShowEvent *e) { wd = _w; } - // Now resize the dialog to fit the contents - // Maximum value is whichever is smaller: - // 1. screen width / 4 - // 2. max width of text from either of: label, title, textedit + // max width of text from either of: label, title, textedit // If the value is less than dialog default size default size is used - wd = textW < screenW ? textW : screenW; if (wd > width()) - resize(width() - ui->horizontalLayout->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(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); + resize(width() - ui->verticalLayout->sizeHint().width() + wd, height()); } diff --git a/src/gui/autoexpandabledialog.h b/src/gui/autoexpandabledialog.h index eab0e89fc..39950e45c 100644 --- a/src/gui/autoexpandabledialog.h +++ b/src/gui/autoexpandabledialog.h @@ -41,9 +41,9 @@ class AutoExpandableDialog; class AutoExpandableDialog : public QDialog { Q_OBJECT - + public: - explicit AutoExpandableDialog(QWidget *parent = 0); + explicit AutoExpandableDialog(QWidget *parent); ~AutoExpandableDialog(); static QString getText(QWidget *parent, const QString& title, const QString& label, @@ -52,7 +52,7 @@ public: protected: void showEvent(QShowEvent *e); - + private: Ui::AutoExpandableDialog *ui; }; diff --git a/src/gui/autoexpandabledialog.ui b/src/gui/autoexpandabledialog.ui index e70454216..43d7daa09 100644 --- a/src/gui/autoexpandabledialog.ui +++ b/src/gui/autoexpandabledialog.ui @@ -7,79 +7,23 @@ 0 0 222 - 94 + 105 - - - 0 - 0 - - - - Dialog - - - - Qt::Vertical - - - - 20 - 40 - - - + - - - - - - + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - diff --git a/src/gui/deletionconfirmationdlg.h b/src/gui/deletionconfirmationdlg.h index a6f21aa4d..37e7acde1 100644 --- a/src/gui/deletionconfirmationdlg.h +++ b/src/gui/deletionconfirmationdlg.h @@ -54,7 +54,6 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { lbl_warn->setFixedWidth(lbl_warn->height()); rememberBtn->setIcon(GuiIconProvider::instance()->getIcon("object-locked")); - move(Utils::Misc::screenCenter(this)); checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault()); connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState())); buttonBox->button(QDialogButtonBox::Cancel)->setFocus(); @@ -64,8 +63,8 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { return checkPermDelete->isChecked(); } - static bool askForDeletionConfirmation(bool& deleteLocalFiles, const int& size, const QString& name) { - DeletionConfirmationDlg dlg(NULL, size, name, deleteLocalFiles); + static bool askForDeletionConfirmation(QWidget *parent, bool& deleteLocalFiles, const int& size, const QString& name) { + DeletionConfirmationDlg dlg(parent, size, name, deleteLocalFiles); if (dlg.exec() == QDialog::Accepted) { deleteLocalFiles = dlg.shouldDeleteLocalFiles(); return true; diff --git a/src/gui/preview.ui b/src/gui/preview.ui index 66a2e0a72..7405b3e0f 100644 --- a/src/gui/preview.ui +++ b/src/gui/preview.ui @@ -16,18 +16,9 @@ - - - 16777215 - 42 - - The following files support previewing, please select one of them: - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - true diff --git a/src/gui/previewselect.cpp b/src/gui/previewselect.cpp index b880550b7..f1bcbb81e 100644 --- a/src/gui/previewselect.cpp +++ b/src/gui/previewselect.cpp @@ -83,7 +83,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, BitTorrent::TorrentHandle *const t } 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(); } connect(this, SIGNAL(readyToPreviewFile(QString)), parent, SLOT(previewFile(QString))); @@ -120,7 +120,7 @@ void PreviewSelect::on_previewButton_clicked() { if (QFile::exists(path)) emit readyToPreviewFile(path); 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(); } diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index 70e3399af..584e52fdf 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -328,7 +328,7 @@ void TransferListWidget::deleteSelectedTorrents(bool deleteLocalFiles) if (torrents.empty()) return; if (Preferences::instance()->confirmTorrentDeletion() - && !DeletionConfirmationDlg::askForDeletionConfirmation(deleteLocalFiles, torrents.size(), torrents[0]->name())) + && !DeletionConfirmationDlg::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name())) return; foreach (BitTorrent::TorrentHandle *const torrent, torrents) BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles); @@ -344,8 +344,9 @@ void TransferListWidget::deleteVisibleTorrents() bool deleteLocalFiles = false; if (Preferences::instance()->confirmTorrentDeletion() - && !DeletionConfirmationDlg::askForDeletionConfirmation(deleteLocalFiles, torrents.size(), torrents[0]->name())) + && !DeletionConfirmationDlg::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name())) return; + foreach (BitTorrent::TorrentHandle *const torrent, torrents) BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles); }