hrev51011 adds 1 changeset to branch 'master'
old head: ad7783e44df140933511f09e6750f2de4b3ba608
new head: fdd3fd9e0689e06570a1305ef0d59cae484f9f6b
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=fdd3fd9e0689+%5Ead7783e44df1
----------------------------------------------------------------------------
fdd3fd9e0689: MediaConvert: Added error messages
... when converted file cannot be writen to destination
Signed-off-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Fixes #12334.
[ Vivek Roy <vivekroy@xxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev51011
Commit: fdd3fd9e0689e06570a1305ef0d59cae484f9f6b
URL: http://cgit.haiku-os.org/haiku/commit/?id=fdd3fd9e0689
Author: Vivek Roy <vivekroy@xxxxxxxxxxx>
Date: Wed Mar 8 02:12:36 2017 UTC
Committer: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Commit-Date: Sun Mar 12 09:31:40 2017 UTC
Ticket: https://dev.haiku-os.org/ticket/12334
----------------------------------------------------------------------------
2 files changed, 40 insertions(+), 1 deletion(-)
src/apps/mediaconverter/MediaConverterApp.cpp | 25 ++++++++++++++++++++
src/apps/mediaconverter/MediaConverterWindow.cpp | 16 ++++++++++++-
----------------------------------------------------------------------------
diff --git a/src/apps/mediaconverter/MediaConverterApp.cpp
b/src/apps/mediaconverter/MediaConverterApp.cpp
index e3949d3..5fc41d0 100644
--- a/src/apps/mediaconverter/MediaConverterApp.cpp
+++ b/src/apps/mediaconverter/MediaConverterApp.cpp
@@ -204,6 +204,18 @@ MediaConverterApp::_CreateOutputFile(BDirectory directory,
name.Append(outputFormat->file_extension);
+ BEntry directoryEntry;
+ directory.GetEntry(&directoryEntry);
+ if (!directoryEntry.Exists()) {
+ BAlert* alert = new BAlert(B_TRANSLATE("Error"),
+ B_TRANSLATE("Selected directory not found. "
+ "Defaulting to /boot/home"),
+ B_TRANSLATE("OK"));
+ alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
+ alert->Go();
+ directory.SetTo("/boot/home");
+ }
+
BEntry inEntry(ref);
BEntry outEntry;
@@ -318,6 +330,11 @@ MediaConverterApp::_RunConvert()
} else {
+ srcIndex++;
+ BString error(
+ B_TRANSLATE("Error converting
'%filename'"));
+ error.ReplaceAll("%filename", inRef.name);
+ fWin->SetStatusMessage(error.String());
fWin->Unlock();
break;
}
@@ -391,6 +408,9 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile,
BMediaFile* outFile,
B_TRANSLATE("Audio quality not
supported"));
fWin->Unlock();
}
+ } else {
+ fWin->SetStatusMessage(
+ B_TRANSLATE("Error creating track."));
}
} else if (inFormat.IsVideo() && (videoCodec != NULL)) {
@@ -465,9 +485,14 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile,
BMediaFile* outFile,
fWin->SetVideoQualityLabel(videoQualitySupport);
fWin->Unlock();
}
+ } else {
+ fWin->SetStatusMessage(
+ B_TRANSLATE("Error creating video."));
}
} else {
// didn't do anything with the track
+ fWin->SetStatusMessage(
+ B_TRANSLATE("Input file not recognized as Audio
or Video"));
inFile->ReleaseTrack(inTrack);
}
}
diff --git a/src/apps/mediaconverter/MediaConverterWindow.cpp
b/src/apps/mediaconverter/MediaConverterWindow.cpp
index 7fee41f..7cf8336 100644
--- a/src/apps/mediaconverter/MediaConverterWindow.cpp
+++ b/src/apps/mediaconverter/MediaConverterWindow.cpp
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <Alert.h>
#include <Application.h>
@@ -1005,6 +1006,19 @@ MediaConverterWindow::_CreateMenu()
void
MediaConverterWindow::_SetOutputFolder(BEntry entry)
{
- fOutputDir.SetTo(&entry);
+ BPath path;
+ entry.GetPath(&path);
+ if (access(path.Path(), W_OK) != -1) {
+ fOutputDir.SetTo(&entry);
+ } else {
+ BString errorString(B_TRANSLATE("Error writing to location:
%strPath%."
+ " Defaulting to location: /boot/home"));
+ errorString.ReplaceFirst("%strPath%", path.Path());
+ BAlert* alert = new BAlert(B_TRANSLATE("Error"),
+ errorString.String(), B_TRANSLATE("OK"));
+ alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
+ alert->Go();
+ fOutputDir.SetTo("/boot/home");
+ }
TruncateOutputFolderPath();
}