Save and restore geometry in transcoder dialog
This commit is contained in:
@@ -101,10 +101,15 @@ TranscodeDialog::TranscodeDialog(QWidget *parent)
|
|||||||
// Load settings
|
// Load settings
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
|
if (s.contains("geometry")) {
|
||||||
|
restoreGeometry(s.value("geometry").toByteArray());
|
||||||
|
}
|
||||||
last_add_dir_ = s.value("last_add_dir", QDir::homePath()).toString();
|
last_add_dir_ = s.value("last_add_dir", QDir::homePath()).toString();
|
||||||
last_import_dir_ = s.value("last_import_dir", QDir::homePath()).toString();
|
last_import_dir_ = s.value("last_import_dir", QDir::homePath()).toString();
|
||||||
|
|
||||||
QString last_output_format = s.value("last_output_format", "audio/x-vorbis").toString();
|
QString last_output_format = s.value("last_output_format", "audio/x-vorbis").toString();
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
for (int i = 0; i < ui_->format->count(); ++i) {
|
for (int i = 0; i < ui_->format->count(); ++i) {
|
||||||
if (last_output_format == ui_->format->itemData(i).value<TranscoderPreset>().codec_mimetype_) {
|
if (last_output_format == ui_->format->itemData(i).value<TranscoderPreset>().codec_mimetype_) {
|
||||||
ui_->format->setCurrentIndex(i);
|
ui_->format->setCurrentIndex(i);
|
||||||
@@ -192,6 +197,7 @@ void TranscodeDialog::Start() {
|
|||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
s.setValue("last_output_format", preset.codec_mimetype_);
|
s.setValue("last_output_format", preset.codec_mimetype_);
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,6 +269,7 @@ void TranscodeDialog::Add() {
|
|||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
s.setValue("last_add_dir", last_add_dir_);
|
s.setValue("last_add_dir", last_add_dir_);
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,9 +290,10 @@ void TranscodeDialog::Import() {
|
|||||||
SetFilenames(filenames);
|
SetFilenames(filenames);
|
||||||
|
|
||||||
last_import_dir_ = path;
|
last_import_dir_ = path;
|
||||||
QSettings settings;
|
QSettings s;
|
||||||
settings.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
settings.setValue("last_import_dir", last_import_dir_);
|
s.setValue("last_import_dir", last_import_dir_);
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,4 +384,28 @@ QString TranscodeDialog::GetOutputFileName(const QString &input, const Transcode
|
|||||||
file_name = file_name.section('.', 0, -2);
|
file_name = file_name.section('.', 0, -2);
|
||||||
return path + '/' + file_name + '.' + preset.extension_;
|
return path + '/' + file_name + '.' + preset.extension_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TranscodeDialog::SaveGeometry() {
|
||||||
|
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup(kSettingsGroup);
|
||||||
|
s.setValue("geometry", saveGeometry());
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TranscodeDialog::accept() {
|
||||||
|
|
||||||
|
SaveGeometry();
|
||||||
|
QDialog::accept();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TranscodeDialog::reject() {
|
||||||
|
|
||||||
|
SaveGeometry();
|
||||||
|
QDialog::reject();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ class TranscodeDialog : public QDialog {
|
|||||||
void LogLine(const QString message);
|
void LogLine(const QString message);
|
||||||
void Options();
|
void Options();
|
||||||
void AddDestination();
|
void AddDestination();
|
||||||
|
void accept();
|
||||||
|
void reject();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetWorking(bool working);
|
void SetWorking(bool working);
|
||||||
@@ -73,6 +75,7 @@ class TranscodeDialog : public QDialog {
|
|||||||
void UpdateProgress();
|
void UpdateProgress();
|
||||||
QString TrimPath(const QString &path) const;
|
QString TrimPath(const QString &path) const;
|
||||||
QString GetOutputFileName(const QString &input, const TranscoderPreset &preset) const;
|
QString GetOutputFileName(const QString &input, const TranscoderPreset &preset) const;
|
||||||
|
void SaveGeometry();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_TranscodeDialog *ui_;
|
Ui_TranscodeDialog *ui_;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>:/icons/64x64/strawberry.png</normaloff>:/icons/64x64/strawberry.png</iconset>
|
<normaloff>:/icons/64x64/strawberry.png</normaloff>:/icons/64x64/strawberry.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="layout_dialog">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="input_group">
|
<widget class="QGroupBox" name="input_group">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
<layout class="QHBoxLayout" name="layout_progress">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="progress_text">
|
<widget class="QLabel" name="progress_text">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -221,5 +221,38 @@
|
|||||||
<tabstop>button_box</tabstop>
|
<tabstop>button_box</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>button_box</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>TranscodeDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>249</x>
|
||||||
|
<y>420</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>249</x>
|
||||||
|
<y>223</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>button_box</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>TranscodeDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>249</x>
|
||||||
|
<y>420</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>249</x>
|
||||||
|
<y>223</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user