Stop the organise files dialog from resizing only after a manual resize has been done by the user - otherwise the dialog doesn't grow/shrink automatically when you select a new destination.
This commit is contained in:
parent
76e6281af5
commit
527135abb1
@ -26,6 +26,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QResizeEvent>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
@ -39,7 +40,8 @@ OrganiseDialog::OrganiseDialog(TaskManager* task_manager, QWidget *parent)
|
|||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui_(new Ui_OrganiseDialog),
|
ui_(new Ui_OrganiseDialog),
|
||||||
task_manager_(task_manager),
|
task_manager_(task_manager),
|
||||||
total_size_(0)
|
total_size_(0),
|
||||||
|
resized_by_user_(false)
|
||||||
{
|
{
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
connect(ui_->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), SLOT(Reset()));
|
connect(ui_->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), SLOT(Reset()));
|
||||||
@ -238,7 +240,9 @@ void OrganiseDialog::UpdatePreviews() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustSize();
|
if (!resized_by_user_) {
|
||||||
|
adjustSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize OrganiseDialog::sizeHint() const {
|
QSize OrganiseDialog::sizeHint() const {
|
||||||
@ -254,7 +258,9 @@ void OrganiseDialog::Reset() {
|
|||||||
ui_->eject_after->setChecked(false);
|
ui_->eject_after->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OrganiseDialog::showEvent(QShowEvent *) {
|
void OrganiseDialog::showEvent(QShowEvent*) {
|
||||||
|
resized_by_user_ = false;
|
||||||
|
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
ui_->naming->setPlainText(s.value("format", kDefaultFormat).toString());
|
ui_->naming->setPlainText(s.value("format", kDefaultFormat).toString());
|
||||||
@ -309,3 +315,11 @@ void OrganiseDialog::OrganiseFinished(const QStringList& files_with_errors) {
|
|||||||
error_dialog_.reset(new OrganiseErrorDialog);
|
error_dialog_.reset(new OrganiseErrorDialog);
|
||||||
error_dialog_->Show(OrganiseErrorDialog::Type_Copy, files_with_errors);
|
error_dialog_->Show(OrganiseErrorDialog::Type_Copy, files_with_errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OrganiseDialog::resizeEvent(QResizeEvent* e) {
|
||||||
|
if (e->spontaneous()) {
|
||||||
|
resized_by_user_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialog::resizeEvent(e);
|
||||||
|
}
|
||||||
|
@ -58,7 +58,8 @@ public slots:
|
|||||||
void accept();
|
void accept();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *);
|
void showEvent(QShowEvent*);
|
||||||
|
void resizeEvent(QResizeEvent*);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Reset();
|
void Reset();
|
||||||
@ -80,6 +81,8 @@ private:
|
|||||||
quint64 total_size_;
|
quint64 total_size_;
|
||||||
|
|
||||||
boost::scoped_ptr<OrganiseErrorDialog> error_dialog_;
|
boost::scoped_ptr<OrganiseErrorDialog> error_dialog_;
|
||||||
|
|
||||||
|
bool resized_by_user_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ORGANISEDIALOG_H
|
#endif // ORGANISEDIALOG_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user