1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-14 09:44:51 +01:00

Initialize variables and formatting

This commit is contained in:
Jonas Kvinge 2021-06-21 19:55:18 +02:00
parent 83b54f2ae6
commit ebfd8cd6f7
3 changed files with 8 additions and 7 deletions

View File

@ -84,9 +84,9 @@ AlbumCoverExport::DialogResult AlbumCoverExport::Exec() {
s.setValue("export_downloaded", ui_->export_downloaded->isChecked());
s.setValue("export_embedded", ui_->export_embedded->isChecked());
result.fileName_ = fileName;
result.filename_ = fileName;
result.overwrite_ = overwrite;
result.forceSize_ = forceSize;
result.forcesize_ = forceSize;
result.width_ = width.toInt();
result.height_ = height.toInt();
result.export_downloaded_ = ui_->export_downloaded->isChecked();

View File

@ -46,19 +46,20 @@ class AlbumCoverExport : public QDialog {
};
struct DialogResult {
DialogResult() : cancelled_(false), export_downloaded_(false), export_embedded_(false), forcesize_(false), width_(0), height_(0) {}
bool cancelled_;
bool export_downloaded_;
bool export_embedded_;
QString fileName_;
QString filename_;
OverwriteMode overwrite_;
bool forceSize_;
bool forcesize_;
int width_;
int height_;
bool IsSizeForced() const {
return forceSize_ && width_ > 0 && height_ > 0;
return forcesize_ && width_ > 0 && height_ > 0;
}
bool RequiresCoverProcessing() const {

View File

@ -119,7 +119,7 @@ void CoverExportRunnable::ProcessAndExportCover() {
QString dir = song_.url().toLocalFile().section('/', 0, -2);
QString extension = cover_path.section('.', -1);
QString new_file = dir + '/' + dialog_result_.fileName_ + '.' + (cover_path == Song::kEmbeddedCover ? "jpg" : extension);
QString new_file = dir + '/' + dialog_result_.filename_ + '.' + (cover_path == Song::kEmbeddedCover ? "jpg" : extension);
// If the file exists, do not override!
if (dialog_result_.overwrite_ == AlbumCoverExport::OverwriteMode_None && QFile::exists(new_file)) {
@ -163,7 +163,7 @@ void CoverExportRunnable::ExportCover() {
QString dir = song_.url().toLocalFile().section('/', 0, -2);
QString extension = cover_path.section('.', -1);
QString new_file = dir + '/' + dialog_result_.fileName_ + '.' + (cover_path == Song::kEmbeddedCover ? "jpg" : extension);
QString new_file = dir + '/' + dialog_result_.filename_ + '.' + (cover_path == Song::kEmbeddedCover ? "jpg" : extension);
// If the file exists, do not override!
if (dialog_result_.overwrite_ == AlbumCoverExport::OverwriteMode_None && QFile::exists(new_file)) {