Browse Source

Simplify resize actions for AddNewTorrentDialog

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
51b7e299b4
  1. 15
      src/gui/addnewtorrentdialog.cpp
  2. 1
      src/gui/addnewtorrentdialog.h

15
src/gui/addnewtorrentdialog.cpp

@ -256,6 +256,8 @@ void AddNewTorrentDialog::showEvent(QShowEvent *event)
void AddNewTorrentDialog::showAdvancedSettings(bool show) void AddNewTorrentDialog::showAdvancedSettings(bool show)
{ {
const int minimumW = minimumWidth();
setMinimumWidth(width()); // to remain the same width
if (show) { if (show) {
ui->adv_button->setText(QString::fromUtf8(C_UP)); ui->adv_button->setText(QString::fromUtf8(C_UP));
ui->settings_group->setVisible(true); ui->settings_group->setVisible(true);
@ -274,7 +276,8 @@ void AddNewTorrentDialog::showAdvancedSettings(bool show)
ui->infoGroup->setVisible(false); ui->infoGroup->setVisible(false);
ui->buttonsHLayout->insertWidget(0, layout()->takeAt(layout()->indexOf(ui->never_show_cb) + 1)->widget()); ui->buttonsHLayout->insertWidget(0, layout()->takeAt(layout()->indexOf(ui->never_show_cb) + 1)->widget());
} }
relayout(); adjustSize();
setMinimumWidth(minimumW);
} }
void AddNewTorrentDialog::saveSavePathHistory() const void AddNewTorrentDialog::saveSavePathHistory() const
@ -347,7 +350,6 @@ void AddNewTorrentDialog::onSavePathChanged(int index)
// Toggle default save path setting checkbox visibility // Toggle default save path setting checkbox visibility
ui->default_save_path_cb->setChecked(false); ui->default_save_path_cb->setChecked(false);
ui->default_save_path_cb->setVisible(QDir(ui->save_path_combo->itemData(ui->save_path_combo->currentIndex()).toString()) != QDir(Preferences::instance()->getSavePath())); ui->default_save_path_cb->setVisible(QDir(ui->save_path_combo->itemData(ui->save_path_combo->currentIndex()).toString()) != QDir(Preferences::instance()->getSavePath()));
relayout();
// Remember index // Remember index
m_oldIndex = index; m_oldIndex = index;
@ -404,15 +406,6 @@ void AddNewTorrentDialog::browseButton_clicked()
connect(ui->save_path_combo, SIGNAL(currentIndexChanged(int)), SLOT(onSavePathChanged(int))); connect(ui->save_path_combo, SIGNAL(currentIndexChanged(int)), SLOT(onSavePathChanged(int)));
} }
void AddNewTorrentDialog::relayout()
{
qApp->processEvents();
int min_width = minimumWidth();
setMinimumWidth(width());
adjustSize();
setMinimumWidth(min_width);
}
void AddNewTorrentDialog::renameSelectedFile() void AddNewTorrentDialog::renameSelectedFile()
{ {
const QModelIndexList selectedIndexes = ui->content_tree->selectionModel()->selectedRows(0); const QModelIndexList selectedIndexes = ui->content_tree->selectionModel()->selectedRows(0);

1
src/gui/addnewtorrentdialog.h

@ -68,7 +68,6 @@ private slots:
void displayContentTreeMenu(const QPoint&); void displayContentTreeMenu(const QPoint&);
void updateDiskSpaceLabel(); void updateDiskSpaceLabel();
void onSavePathChanged(int); void onSavePathChanged(int);
void relayout();
void renameSelectedFile(); void renameSelectedFile();
void setdialogPosition(); void setdialogPosition();
void updateMetadata(const BitTorrent::TorrentInfo &info); void updateMetadata(const BitTorrent::TorrentInfo &info);

Loading…
Cancel
Save