diff --git a/src/FileIO.cpp b/src/FileIO.cpp index dfe9c6c7d..f8974829f 100644 --- a/src/FileIO.cpp +++ b/src/FileIO.cpp @@ -19,69 +19,12 @@ FileIO::FileIO(const wxString name, FileIOMode mode) : mName(name), mMode(mode), - mFtp(NULL), mInputStream(NULL), mOutputStream(NULL), mOpen(false) { wxString scheme; - mUri.Create(mName); - scheme = mUri.GetScheme(); - - if (scheme == wxT("ftp")) { - wxString user = mUri.GetUser(); - wxString pass = mUri.GetPassword();; - - mFtp = new wxFTP(); - mFtp->SetDefaultTimeout(60); - - if (!user.IsEmpty()) { - mFtp->SetUser(user); - } - - if (!pass.IsEmpty()) { - mFtp->SetPassword(pass); - } - - if (!mFtp->Connect(mUri.GetServer())) { - wxPrintf(wxT("Couldn't connect to server\n")); - - delete mFtp; - mFtp = NULL; - - return; - } - - mFtp->SetBinary(); - mFtp->SetPassive(true); - - if (mMode == FileIO::Input) { - mInputStream = mFtp->GetInputStream(mUri.GetPath()); - if (mInputStream == NULL) { - wxPrintf(wxT("Couldn't get input stream: %s\n"), mUri.GetPath().c_str()); - - delete mFtp; - mFtp = NULL; - - return; - } - } - else { - mOutputStream = mFtp->GetOutputStream(mUri.GetPath()); - if (mOutputStream == NULL) { - wxPrintf(wxT("Couldn't get output stream: %s\n"), mUri.GetPath().c_str()); - - delete mFtp; - mFtp = NULL; - - return; - } - } - - mOpen = true; - } - else { if (mMode == FileIO::Input) { mInputStream = new wxFFileInputStream(mName); if (mInputStream == NULL) { @@ -98,7 +41,6 @@ FileIO::FileIO(const wxString name, FileIOMode mode) } mOpen = true; - } } FileIO::~FileIO() @@ -123,11 +65,6 @@ void FileIO::Close() mInputStream = NULL; } - if (mFtp) { - delete mFtp; - mFtp = NULL; - } - SetCatalogInfo(); mOpen = false; @@ -139,7 +76,7 @@ void FileIO::Close() void FileIO::SetCatalogInfo() { #ifdef __WXMAC__ - if (!mOpen || mFtp != NULL) { + if (!mOpen ) { return; } @@ -161,7 +98,7 @@ void FileIO::SetCatalogInfo() void FileIO::SetCatalogInfo(wxUint32 type) { #ifdef __WXMAC__ - if (!mOpen || mFtp != NULL) { + if (!mOpen ) { return; } diff --git a/src/FileIO.h b/src/FileIO.h index 3d1e82696..77f2971cb 100644 --- a/src/FileIO.h +++ b/src/FileIO.h @@ -13,7 +13,6 @@ #include #include -#include class FileIO { @@ -43,8 +42,6 @@ class FileIO private: wxString mName; FileIOMode mMode; - wxURI mUri; - wxFTP *mFtp; wxInputStream *mInputStream; wxOutputStream *mOutputStream; bool mOpen; diff --git a/src/Makefile.am b/src/Makefile.am index 9b1efa40b..829c5c95c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -197,14 +197,12 @@ audacity_SOURCES = \ TrackPanel.cpp \ TrackPanel.h \ TrackPanelAx.cpp \ - TrackPanelAx.h \ - UndoManager.cpp \ - UndoManager.h \ - UploadDialog.cpp \ - UploadDialog.h \ - ViewInfo.h \ - VoiceKey.cpp \ - VoiceKey.h \ + TrackPanelAx.h \ + UndoManager.cpp \ + UndoManager.h \ + ViewInfo.h \ + VoiceKey.cpp \ + VoiceKey.h \ WaveClip.cpp \ WaveClip.h \ WaveTrack.cpp \ diff --git a/src/Makefile.in b/src/Makefile.in index 1db55fef8..1ec007a7f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Makefile.in generated by automake 1.13.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -211,22 +211,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \ $(top_srcdir)/m4/ax_cflags_strict_prototypes.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compiler_flags.m4 \ - $(top_srcdir)/m4/ax_compiler_vendor.m4 \ - $(top_srcdir)/m4/ax_cxx_check_flag.m4 \ - $(top_srcdir)/m4/ax_cxxcpp_check_flag.m4 \ - $(top_srcdir)/m4/ax_ld_check_flag.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/visibility.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_cxx_check_flag.m4 \ + $(top_srcdir)/m4/ax_cxxcpp_check_flag.m4 \ + $(top_srcdir)/m4/ax_ld_check_flag.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = configwin.h configunix.h CONFIG_CLEAN_FILES = audacity.desktop CONFIG_CLEAN_VPATH_FILES = @@ -297,26 +289,25 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \ SoundActivatedRecord.h Spectrum.cpp Spectrum.h \ SplashDialog.cpp SplashDialog.h Tags.cpp Tags.h Theme.cpp \ Theme.h ThemeAsCeeCode.h TimeDialog.cpp TimeDialog.h \ - TimerRecordDialog.cpp TimerRecordDialog.h TimeTrack.cpp \ - TimeTrack.h Track.cpp Track.h TrackArtist.cpp TrackArtist.h \ - TrackPanel.cpp TrackPanel.h TrackPanelAx.cpp TrackPanelAx.h \ - UndoManager.cpp UndoManager.h UploadDialog.cpp UploadDialog.h \ - ViewInfo.h VoiceKey.cpp VoiceKey.h WaveClip.cpp WaveClip.h \ - WaveTrack.cpp WaveTrack.h WrappedType.cpp WrappedType.h \ - commands/AppCommandEvent.cpp commands/AppCommandEvent.h \ - commands/BatchEvalCommand.cpp commands/BatchEvalCommand.h \ - commands/Command.cpp commands/Command.h \ - commands/CommandBuilder.cpp commands/CommandBuilder.h \ - commands/CommandDirectory.cpp commands/CommandDirectory.h \ - commands/CommandHandler.cpp commands/CommandHandler.h \ - commands/CommandManager.cpp commands/CommandManager.h \ - commands/CommandMisc.h commands/CommandSignature.cpp \ - commands/CommandSignature.h commands/CommandTargets.h \ - commands/CommandType.cpp commands/CommandType.h \ - commands/CompareAudioCommand.cpp \ - commands/CompareAudioCommand.h commands/ExecMenuCommand.cpp \ - commands/ExecMenuCommand.h commands/GetAllMenuCommands.cpp \ - commands/GetAllMenuCommands.h \ + TimerRecordDialog.cpp TimerRecordDialog.h TimeTrack.cpp \ + TimeTrack.h Track.cpp Track.h TrackArtist.cpp TrackArtist.h \ + TrackPanel.cpp TrackPanel.h TrackPanelAx.cpp TrackPanelAx.h \ + UndoManager.cpp UndoManager.h ViewInfo.h VoiceKey.cpp \ + VoiceKey.h WaveClip.cpp WaveClip.h WaveTrack.cpp WaveTrack.h \ + WrappedType.cpp WrappedType.h commands/AppCommandEvent.cpp \ + commands/AppCommandEvent.h commands/BatchEvalCommand.cpp \ + commands/BatchEvalCommand.h commands/Command.cpp \ + commands/Command.h commands/CommandBuilder.cpp \ + commands/CommandBuilder.h commands/CommandDirectory.cpp \ + commands/CommandDirectory.h commands/CommandHandler.cpp \ + commands/CommandHandler.h commands/CommandManager.cpp \ + commands/CommandManager.h commands/CommandMisc.h \ + commands/CommandSignature.cpp commands/CommandSignature.h \ + commands/CommandTargets.h commands/CommandType.cpp \ + commands/CommandType.h commands/CompareAudioCommand.cpp \ + commands/CompareAudioCommand.h commands/ExecMenuCommand.cpp \ + commands/ExecMenuCommand.h commands/GetAllMenuCommands.cpp \ + commands/GetAllMenuCommands.h \ commands/GetProjectInfoCommand.cpp \ commands/GetProjectInfoCommand.h \ commands/GetTrackInfoCommand.cpp \ @@ -528,15 +519,14 @@ am_audacity_OBJECTS = $(am__objects_1) audacity-AboutDialog.$(OBJEXT) \ audacity-Tags.$(OBJEXT) audacity-Theme.$(OBJEXT) \ audacity-TimeDialog.$(OBJEXT) \ audacity-TimerRecordDialog.$(OBJEXT) \ - audacity-TimeTrack.$(OBJEXT) audacity-Track.$(OBJEXT) \ - audacity-TrackArtist.$(OBJEXT) audacity-TrackPanel.$(OBJEXT) \ - audacity-TrackPanelAx.$(OBJEXT) audacity-UndoManager.$(OBJEXT) \ - audacity-UploadDialog.$(OBJEXT) audacity-VoiceKey.$(OBJEXT) \ - audacity-WaveClip.$(OBJEXT) audacity-WaveTrack.$(OBJEXT) \ - audacity-WrappedType.$(OBJEXT) \ - commands/audacity-AppCommandEvent.$(OBJEXT) \ - commands/audacity-BatchEvalCommand.$(OBJEXT) \ - commands/audacity-Command.$(OBJEXT) \ + audacity-TimeTrack.$(OBJEXT) audacity-Track.$(OBJEXT) \ + audacity-TrackArtist.$(OBJEXT) audacity-TrackPanel.$(OBJEXT) \ + audacity-TrackPanelAx.$(OBJEXT) audacity-UndoManager.$(OBJEXT) \ + audacity-VoiceKey.$(OBJEXT) audacity-WaveClip.$(OBJEXT) \ + audacity-WaveTrack.$(OBJEXT) audacity-WrappedType.$(OBJEXT) \ + commands/audacity-AppCommandEvent.$(OBJEXT) \ + commands/audacity-BatchEvalCommand.$(OBJEXT) \ + commands/audacity-Command.$(OBJEXT) \ commands/audacity-CommandBuilder.$(OBJEXT) \ commands/audacity-CommandDirectory.$(OBJEXT) \ commands/audacity-CommandHandler.$(OBJEXT) \ @@ -1113,26 +1103,25 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \ SoundActivatedRecord.h Spectrum.cpp Spectrum.h \ SplashDialog.cpp SplashDialog.h Tags.cpp Tags.h Theme.cpp \ Theme.h ThemeAsCeeCode.h TimeDialog.cpp TimeDialog.h \ - TimerRecordDialog.cpp TimerRecordDialog.h TimeTrack.cpp \ - TimeTrack.h Track.cpp Track.h TrackArtist.cpp TrackArtist.h \ - TrackPanel.cpp TrackPanel.h TrackPanelAx.cpp TrackPanelAx.h \ - UndoManager.cpp UndoManager.h UploadDialog.cpp UploadDialog.h \ - ViewInfo.h VoiceKey.cpp VoiceKey.h WaveClip.cpp WaveClip.h \ - WaveTrack.cpp WaveTrack.h WrappedType.cpp WrappedType.h \ - commands/AppCommandEvent.cpp commands/AppCommandEvent.h \ - commands/BatchEvalCommand.cpp commands/BatchEvalCommand.h \ - commands/Command.cpp commands/Command.h \ - commands/CommandBuilder.cpp commands/CommandBuilder.h \ - commands/CommandDirectory.cpp commands/CommandDirectory.h \ - commands/CommandHandler.cpp commands/CommandHandler.h \ - commands/CommandManager.cpp commands/CommandManager.h \ - commands/CommandMisc.h commands/CommandSignature.cpp \ - commands/CommandSignature.h commands/CommandTargets.h \ - commands/CommandType.cpp commands/CommandType.h \ - commands/CompareAudioCommand.cpp \ - commands/CompareAudioCommand.h commands/ExecMenuCommand.cpp \ - commands/ExecMenuCommand.h commands/GetAllMenuCommands.cpp \ - commands/GetAllMenuCommands.h \ + TimerRecordDialog.cpp TimerRecordDialog.h TimeTrack.cpp \ + TimeTrack.h Track.cpp Track.h TrackArtist.cpp TrackArtist.h \ + TrackPanel.cpp TrackPanel.h TrackPanelAx.cpp TrackPanelAx.h \ + UndoManager.cpp UndoManager.h ViewInfo.h VoiceKey.cpp \ + VoiceKey.h WaveClip.cpp WaveClip.h WaveTrack.cpp WaveTrack.h \ + WrappedType.cpp WrappedType.h commands/AppCommandEvent.cpp \ + commands/AppCommandEvent.h commands/BatchEvalCommand.cpp \ + commands/BatchEvalCommand.h commands/Command.cpp \ + commands/Command.h commands/CommandBuilder.cpp \ + commands/CommandBuilder.h commands/CommandDirectory.cpp \ + commands/CommandDirectory.h commands/CommandHandler.cpp \ + commands/CommandHandler.h commands/CommandManager.cpp \ + commands/CommandManager.h commands/CommandMisc.h \ + commands/CommandSignature.cpp commands/CommandSignature.h \ + commands/CommandTargets.h commands/CommandType.cpp \ + commands/CommandType.h commands/CompareAudioCommand.cpp \ + commands/CompareAudioCommand.h commands/ExecMenuCommand.cpp \ + commands/ExecMenuCommand.h commands/GetAllMenuCommands.cpp \ + commands/GetAllMenuCommands.h \ commands/GetProjectInfoCommand.cpp \ commands/GetProjectInfoCommand.h \ commands/GetTrackInfoCommand.cpp \ @@ -1955,13 +1944,12 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-TimerRecordDialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-Track.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-TrackArtist.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-TrackPanel.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-TrackPanelAx.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-UndoManager.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-UploadDialog.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-VoiceKey.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-WaveClip.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-WaveTrack.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-TrackPanel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-TrackPanelAx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-UndoManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-VoiceKey.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-WaveClip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-WaveTrack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-WrappedType.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaudacity_la-BlockFile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaudacity_la-DirManager.Plo@am__quote@ @@ -3376,26 +3364,12 @@ audacity-UndoManager.obj: UndoManager.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT audacity-UndoManager.obj -MD -MP -MF $(DEPDIR)/audacity-UndoManager.Tpo -c -o audacity-UndoManager.obj `if test -f 'UndoManager.cpp'; then $(CYGPATH_W) 'UndoManager.cpp'; else $(CYGPATH_W) '$(srcdir)/UndoManager.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-UndoManager.Tpo $(DEPDIR)/audacity-UndoManager.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='UndoManager.cpp' object='audacity-UndoManager.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o audacity-UndoManager.obj `if test -f 'UndoManager.cpp'; then $(CYGPATH_W) 'UndoManager.cpp'; else $(CYGPATH_W) '$(srcdir)/UndoManager.cpp'; fi` - -audacity-UploadDialog.o: UploadDialog.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT audacity-UploadDialog.o -MD -MP -MF $(DEPDIR)/audacity-UploadDialog.Tpo -c -o audacity-UploadDialog.o `test -f 'UploadDialog.cpp' || echo '$(srcdir)/'`UploadDialog.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-UploadDialog.Tpo $(DEPDIR)/audacity-UploadDialog.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='UploadDialog.cpp' object='audacity-UploadDialog.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o audacity-UploadDialog.o `test -f 'UploadDialog.cpp' || echo '$(srcdir)/'`UploadDialog.cpp - -audacity-UploadDialog.obj: UploadDialog.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT audacity-UploadDialog.obj -MD -MP -MF $(DEPDIR)/audacity-UploadDialog.Tpo -c -o audacity-UploadDialog.obj `if test -f 'UploadDialog.cpp'; then $(CYGPATH_W) 'UploadDialog.cpp'; else $(CYGPATH_W) '$(srcdir)/UploadDialog.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-UploadDialog.Tpo $(DEPDIR)/audacity-UploadDialog.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='UploadDialog.cpp' object='audacity-UploadDialog.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o audacity-UploadDialog.obj `if test -f 'UploadDialog.cpp'; then $(CYGPATH_W) 'UploadDialog.cpp'; else $(CYGPATH_W) '$(srcdir)/UploadDialog.cpp'; fi` - -audacity-VoiceKey.o: VoiceKey.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT audacity-VoiceKey.o -MD -MP -MF $(DEPDIR)/audacity-VoiceKey.Tpo -c -o audacity-VoiceKey.o `test -f 'VoiceKey.cpp' || echo '$(srcdir)/'`VoiceKey.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-VoiceKey.Tpo $(DEPDIR)/audacity-VoiceKey.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o audacity-UndoManager.obj `if test -f 'UndoManager.cpp'; then $(CYGPATH_W) 'UndoManager.cpp'; else $(CYGPATH_W) '$(srcdir)/UndoManager.cpp'; fi` + +audacity-VoiceKey.o: VoiceKey.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT audacity-VoiceKey.o -MD -MP -MF $(DEPDIR)/audacity-VoiceKey.Tpo -c -o audacity-VoiceKey.o `test -f 'VoiceKey.cpp' || echo '$(srcdir)/'`VoiceKey.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-VoiceKey.Tpo $(DEPDIR)/audacity-VoiceKey.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='VoiceKey.cpp' object='audacity-VoiceKey.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o audacity-VoiceKey.o `test -f 'VoiceKey.cpp' || echo '$(srcdir)/'`VoiceKey.cpp diff --git a/src/Menus.cpp b/src/Menus.cpp index 2b4ad901d..50479c68a 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -74,7 +74,6 @@ simplifies construction of menu items. #include "LoadModules.h" #include "Prefs.h" #include "Printing.h" -#include "UploadDialog.h" #ifdef USE_MIDI #include "NoteTrack.h" #endif // USE_MIDI @@ -291,11 +290,6 @@ void AudacityProject::CreateMenusAndCommands() AudioIONotBusyFlag); c->AddItem(wxT("EditChains"), _("Edit C&hains..."), FN(OnEditChains)); -#ifdef EXPERIMENTAL_FTP - c->AddSeparator(); - c->AddItem(wxT("Upload File"), _("&Upload File..."), FN(OnUpload)); -#endif - c->AddSeparator(); c->AddItem(wxT("PageSetup"), _("Pa&ge Setup..."), FN(OnPageSetup), @@ -2874,17 +2868,6 @@ void AudacityProject::OnExit() QuitAudacity(); } -#ifdef EXPERIMENTAL_FTP - void AudacityProject::OnUpload() - { - //if (mTags->ShowEditDialog(this, wxT("Edit ID3 Tags (for MP3 exporting)"))) - // PushState(wxT("Edit ID3 Tags"), wxT("Edit ID3 Tags")); - - UploadDialog dlog(this); - dlog.ShowModal(); - } -#endif - void AudacityProject::OnExportLabels() { Track *t; diff --git a/src/Menus.h b/src/Menus.h index 11beef8a5..b99a1c537 100644 --- a/src/Menus.h +++ b/src/Menus.h @@ -189,10 +189,6 @@ void OnExportMultiple(); void OnExportLabels(); void OnExportMIDI(); -#ifdef EXPERIMENTAL_FTP - void OnUpload(); -#endif - void OnPreferences(); void OnPageSetup(); diff --git a/src/UploadDialog.cpp b/src/UploadDialog.cpp deleted file mode 100644 index d7c306d28..000000000 --- a/src/UploadDialog.cpp +++ /dev/null @@ -1,1454 +0,0 @@ -/********************************************************************** - - Audacity: A Digital Audio Editor - - UploadDialog.cpp - - Mike Underwood - munderwood@bedheaddesign.com - - Much like the author, this code is crazy at times but it gets the job - done. - -*******************************************************************//** - -\class UploadDialog -\brief A contributed class for uploading audio via FTP. - -*//*******************************************************************/ - -#include "Audacity.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "UploadDialog.h" -#include "PlatformCompatibility.h" -#include "FileNames.h" -#include "Theme.h" -#include "AllThemeResources.h" -#include "Project.h" - -#include "FileDialog.h" - -//#include "../images/AudacityLogo.xpm" -//#include "../images/UploadImages.h" - -// Icon images - -///\todo get these XPMs out of here and into Theme. - -// ---------------------------------------------------------------------------- -// icons -// ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(UploadDialog, wxDialog) - EVT_MENU(wxID_POPUP_DOWNLOAD, UploadDialog::OnPopupMenu) - EVT_MENU(wxID_POPUP_DELETE, UploadDialog::OnPopupMenu) - EVT_MENU(wxID_POPUP_RENAME, UploadDialog::OnPopupMenu) - - EVT_BUTTON(wxID_UPLOAD_FILE, UploadDialog::OnUploadFile) - EVT_BUTTON(wxID_UPLOAD_DIR, UploadDialog::OnUploadDir) - EVT_BUTTON(wxID_CREATEDIR, UploadDialog::OnCreateDir) - EVT_BUTTON(wxID_CANCEL, UploadDialog::OnCancel) - EVT_BUTTON(wxID_CONNECT, UploadDialog::OnConnect) - EVT_BUTTON(wxID_DISCONNECT, UploadDialog::OnDisconnect) - - EVT_LIST_ITEM_ACTIVATED(wxID_FILEMANAGER, UploadDialog::OnActivateItem) - EVT_LIST_ITEM_ACTIVATED(wxID_SITELIST, UploadDialog::OnActivateSite) - EVT_LIST_ITEM_SELECTED(wxID_SITELIST, UploadDialog::OnSelectSite) - EVT_LIST_ITEM_RIGHT_CLICK(wxID_FILEMANAGER, UploadDialog::OnListRightClick) - - EVT_BUTTON(wxID_DELSITE, UploadDialog::OnDeleteSite) -END_EVENT_TABLE() - -IMPLEMENT_CLASS(UploadDialog, wxDialog) - -UploadDialog::UploadDialog(wxWindow * parent) -: wxDialog(parent, -1, wxT("Audacity FTP"), - wxDefaultPosition, wxSize(640, 480), wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS) -{ - ftp = NULL; - dirnameList = new wxArrayString(); - dirpermList = new wxArrayString(); - dirsizeList = new wxArrayString(); - filenameList = new wxArrayString(); - filepermList = new wxArrayString(); - filesizeList = new wxArrayString(); - displayNames = new wxArrayString(); - displayPerm = new wxArrayString(); - displaySizes = new wxArrayString(); - ftpList = new wxArrayString(); - - icons = new wxImageList(16, 16, false, 2); - wxIcon *folderIcon = new wxIcon; - folderIcon->CopyFromBitmap(theTheme.Bitmap( bmpUploadFolder)); - wxIcon *fileIcon = new wxIcon; - fileIcon->CopyFromBitmap(theTheme.Bitmap( bmpUploadFile)); - wxIcon *mp3Icon = new wxIcon; - mp3Icon->CopyFromBitmap(theTheme.Bitmap( bmpUploadMp3)); - wxIcon *upIcon = new wxIcon; - upIcon->CopyFromBitmap(theTheme.Bitmap( bmpUploadUp)); - icons->Add(*folderIcon); - icons->Add(*fileIcon); - icons->Add(*mp3Icon); - icons->Add(*upIcon); - - wxFlexGridSizer *topSizer = new wxFlexGridSizer(2, 1); - wxStaticBoxSizer *connectionBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("FTP Connection"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL); - wxStaticBoxSizer *fileBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("File Manager"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL); - wxStaticBoxSizer *siteBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("Site Manager"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL); - - wxFlexGridSizer *connectionSizer = new wxFlexGridSizer(2, 4); - wxBoxSizer *leftSizer = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *rightSizer = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *fileButtonSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer *siteButtonSizer = new wxBoxSizer(wxHORIZONTAL); - - wxStdDialogButtonSizer *stdButtonSizer = new wxStdDialogButtonSizer(); - - txtFtpName = new wxTextCtrl(this, wxID_FTPNAME, wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("")); - txtFtpHost = new wxTextCtrl(this, wxID_FTPHOST, wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("")); - txtFtpUser = new wxTextCtrl(this, wxID_FTPUSER, wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("")); - txtFtpPass = new wxTextCtrl(this, wxID_FTPPASS, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD, wxDefaultValidator, wxT("")); - btnConnect = new wxButton(this, wxID_CONNECT, wxT("&Connect"), wxDefaultPosition, wxDefaultSize); - btnDisconnect = new wxButton(this, wxID_DISCONNECT, wxT("&Disconnect"), wxDefaultPosition, wxDefaultSize); - btnDisconnect->Enable(false); - - btnUploadFile = new wxButton(this, wxID_UPLOAD_FILE, wxT("Upload &File"), wxDefaultPosition, wxDefaultSize); - btnUploadFile->Enable(false); - btnUploadDir = new wxButton(this, wxID_UPLOAD_DIR, wxT("Upload F&older"), wxDefaultPosition, wxDefaultSize); - btnUploadDir->Enable(false); - btnCreateDir = new wxButton(this, wxID_CREATEDIR, wxT("N&ew Folder"), wxDefaultPosition, wxDefaultSize); - btnCreateDir->Enable(false); - - btnDelSite = new wxButton(this, wxID_DELSITE, wxT("&Remove Site"), wxDefaultPosition, wxDefaultSize); - - fileManager = new wxListView(this, wxID_FILEMANAGER, wxDefaultPosition, wxSize(350, 350), wxLC_REPORT, wxDefaultValidator, wxT("")); - fileManager->AssignImageList(icons, wxIMAGE_LIST_SMALL); - //fileManager->Show(false); - fileManager->InsertColumn(0, wxT("Name")); - fileManager->InsertColumn(1, wxT("Size (bytes)")); - fileManager->InsertColumn(2, wxT("Permissions")); - - siteList = new wxListView(this, wxID_SITELIST, wxDefaultPosition, wxSize(200, 215), wxLC_REPORT | wxLC_NO_HEADER, wxDefaultValidator, wxT("")); - siteList->InsertColumn(0, wxT("")); - - connectionSizer->Add(new wxStaticText(this, -1, wxT("Name:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT, wxT(""))); - connectionSizer->Add(txtFtpName); - connectionSizer->Add(new wxStaticText(this, -1, wxT("Host:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT, wxT(""))); - connectionSizer->Add(txtFtpHost); - connectionSizer->Add(new wxStaticText(this, -1, wxT("Username:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT, wxT(""))); - connectionSizer->Add(txtFtpUser); - connectionSizer->Add(new wxStaticText(this, -1, wxT("Password:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT, wxT(""))); - connectionSizer->Add(txtFtpPass); - connectionSizer->Add(btnConnect, 0, wxALIGN_LEFT | wxALL, 5); - connectionSizer->Add(btnDisconnect, 0, wxALIGN_LEFT | wxALL, 5); - - connectionBox->Add(connectionSizer, 0, wxALIGN_CENTER); - connectionBox->Add(200, 0); - - stdButtonSizer->AddButton(new wxButton(this, wxID_CANCEL, _("&Cancel"))); - stdButtonSizer->Realize(); - - fileButtonSizer->Add(btnUploadFile, 0, wxALL, 5); - fileButtonSizer->Add(btnUploadDir, 0, wxALL, 5); - fileButtonSizer->Add(btnCreateDir, 0, wxALL, 5); - - //siteButtonSizer->Add(btnNewSite, 0, wxALL, 5); - siteButtonSizer->Add(btnDelSite, 0, wxALL, 5); - - fileBox->Add(fileManager, 0, wxALIGN_CENTER); - fileBox->Add(fileButtonSizer, 0, wxALIGN_CENTER); - //fileBox->Add(300, 0); - - siteBox->Add(siteList, 0, wxALIGN_CENTER); - siteBox->Add(siteButtonSizer, 0, wxALIGN_LEFT); - - leftSizer->Add(connectionBox); - leftSizer->Add(siteBox, 0, wxTOP, 10); - rightSizer->Add(fileBox); - rightSizer->Add(stdButtonSizer, 0, wxALIGN_RIGHT | wxALIGN_BOTTOM | wxALL, 5 ); - - topSizer->Add(leftSizer, 0, wxALL, 10); - topSizer->Add(rightSizer, 0, wxTOP | wxBOTTOM | wxRIGHT, 10); - - SetSizerAndFit(topSizer); - - // populate siteList - UpdateSiteList(); - -} - -UploadDialog::~UploadDialog() -{ - -} - -void UploadDialog::OnCancel(wxCommandEvent & event) -{ - if (ftp) - OnDisconnect(event); - - EndModal(0); -} - -void UploadDialog::OnConnect(wxCommandEvent & WXUNUSED(event)) -{ - - wxString system; - - SetTitle(wxT("Connecting...")); - SetCursor(wxCURSOR_WAIT); - - //int connectionExists = -1; - - ftp = new wxFTP(); - ftp->SetUser(txtFtpUser->GetValue()); - ftp->SetPassword(txtFtpPass->GetValue()); - - if (ftp->Connect(txtFtpHost->GetValue())) - { - - // check which system ftp is running on - ftp->SendCommand(wxT("SYST")); - system = ftp->GetLastResult(); - system = system.Lower(); - - //wxMessageBox(system, wxT("FTP Status"), wxOK | wxICON_INFORMATION, this); - - if (system.Find(wxT("unix"))==-1 && system.Find(wxT("windows"))==-1) - { - wxString msg; - msg.Printf(wxT("Unknown FTP Server type: %s\n\nOnly Unix based and Windows systems are supported/tested at this time."), (const wxChar*)system); - wxMessageBox(msg, wxT("Error"), wxOK | wxICON_INFORMATION, this); - } - - btnConnect->Enable(false); - btnDisconnect->Enable(true); - btnUploadFile->Enable(true); - btnUploadDir->Enable(true); - btnCreateDir->Enable(true); - btnDelSite->Enable(false); - - fileManager->Show(true); - siteList->Show(false); - - txtFtpName->Enable(false); - txtFtpHost->Enable(false); - txtFtpUser->Enable(false); - txtFtpPass->Enable(false); - - if (txtFtpName->GetValue().Trim() == wxT("")) - txtFtpName->SetValue(wxT("New Site")); - - // save login into to connections file - if (SaveFtpSite(txtFtpName->GetValue(), txtFtpHost->GetValue(), txtFtpUser->GetValue(), txtFtpPass->GetValue())) - { - // add site to site list - long tmp = siteList->InsertItem(siteList->GetItemCount(), txtFtpName->GetValue(), 0); - siteList->SetItemData(tmp, 0); - } - - SetTitle(wxT("Connected to: ") + txtFtpHost->GetValue()); - - RefreshFiles(); - - } - - else - { - wxMessageBox(wxT("Connection cannot be established"), wxT("FTP Status"), wxOK | wxICON_INFORMATION, this); - delete ftp; - ftp = NULL; - } - - SetCursor(wxCURSOR_ARROW); - -} - -void UploadDialog::OnDisconnect(wxCommandEvent & WXUNUSED(event)) -{ - - delete ftp; - ftp = NULL; - - - btnDisconnect->Enable(false); - btnConnect->Enable(true); - btnUploadFile->Enable(false); - btnUploadDir->Enable(false); - btnCreateDir->Enable(false); - btnDelSite->Enable(true); - - fileManager->Show(false); - fileManager->DeleteAllItems(); - siteList->Show(true); - - txtFtpName->Enable(true); - txtFtpHost->Enable(true); - txtFtpUser->Enable(true); - txtFtpPass->Enable(true); - - SetTitle(wxT("No Connection")); - fileManager->Show(false); - - LoadFtpSiteList(); -} - - -void UploadDialog::OnUploadFile(wxCommandEvent & WXUNUSED(event)) -{ - unsigned int count; - wxString name; - wxString path; - wxArrayString files; - - abort = false; - - FileDialog open(this, wxT("Choose file(s) to upload"), - ::wxGetCwd(), wxT(""), - wxT("All files (*.*)|*.*"), - wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER); - - if (open.ShowModal()==wxID_OK) - { - SetCursor(wxCURSOR_WAIT); - - // get the file(s) the user selected - open.GetPaths(files); - - for (count = 0; count < files.GetCount(); count++) - { - if (!abort) - { - // remove path from filename - int index = files.Item(count).Find(wxT('\\'), true); - wxString name = files.Item(count).Mid(index+1, files.Item(count).Length() - index); - wxString path = ftp->Pwd()+wxT("/")+name.MakeLower(); - - - // upload the file - UploadFile(files.Item(count), path.MakeLower()); - } - } - - RefreshFiles(); - - SetCursor(wxCURSOR_ARROW); - - } -} - -void UploadDialog::OnUploadDir(wxCommandEvent & WXUNUSED(event)) -{ - - wxDirDialog open(this, wxT("Choose folder to upload"), wxT("")); - int result = open.ShowModal(); - - abort = false; - - if (result == wxID_OK) - { - SetCursor(wxCURSOR_WAIT); - UploadDir(open.GetPath(), wxT("")); - SetCursor(wxCURSOR_ARROW); - } -} - -void UploadDialog::OnListRightClick(wxListEvent &event) -{ - - listIndex = event.m_itemIndex; - - wxMenu *menu = new wxMenu(); - wxMenuItem *del = new wxMenuItem(menu, wxID_POPUP_DELETE, wxT("Delete"), wxT("Delete file(s) from server")); - wxMenuItem *rn = new wxMenuItem(menu, wxID_POPUP_RENAME, wxT("Rename"), wxT("Rename file")); - wxMenuItem *dl = new wxMenuItem(menu, wxID_POPUP_DOWNLOAD, wxT("Download"), wxT("Download this file(s) to your computer")); - - wxMenuItem *sep = new wxMenuItem(menu, -1, wxT(""), wxT("")); - - menu->Insert(0, dl); - menu->Insert(1, sep); - menu->Insert(2, del); - menu->Insert(3, rn); - - fileManager->GetItemPosition(event.m_itemIndex ,mousePos); - PopupMenu(menu, mousePos.x + 250, mousePos.y + 50); -} - -void UploadDialog::OnActivateSite (wxListEvent & WXUNUSED(event)) -{ -} - -void UploadDialog::OnPopupMenu (wxCommandEvent &event) -{ - - if (event.GetId() == wxID_POPUP_DOWNLOAD) - { - abort = false; - - if (fileManager->GetSelectedItemCount() > 1) - { - SetCursor(wxCURSOR_WAIT); - DownloadMultipleItems(); - SetCursor(wxCURSOR_ARROW); - } - - else - { - SetCursor(wxCURSOR_WAIT); - wxString item = fileManager->GetItemText(listIndex); - - if (displayPerm->Item(listIndex).GetChar(0)=='d') - DownloadItem(item, true); - else - DownloadItem(item, false); - - SetCursor(wxCURSOR_ARROW); - } - } - - if (event.GetId() == wxID_POPUP_DELETE) - { - - - if (fileManager->GetSelectedItemCount() > 1) - { - - int result = wxMessageBox(wxT("Delete selected items?"), wxT("Confirm"), wxYES_NO, NULL); - - if (result == wxYES) - { - SetCursor(wxCURSOR_WAIT); - - long item = -1; - wxArrayString *selectList = new wxArrayString(); - wxArrayString *selectPerm = new wxArrayString(); - - item = fileManager->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - while (item != -1) - { - // add selected item to list - selectList->Add(displayNames->Item(item)); - selectPerm->Add(displayPerm->Item(item)); - - // get next item - item = fileManager->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - } - - unsigned int count; - for (count = 0; count < selectList->GetCount(); count++) - { - if (selectList->Item(count) != wxT("..")) - { - // if directory - if (selectPerm->Item(count).GetChar(0) == wxT('d')) - { - mProgress = new ProgressDialog(wxT("Deleting..."), wxT("")); - - deleteFileList = new wxArrayString(); - deleteDirList = new wxArrayString(); - - GetDeleteList(selectList->Item(count)); - RemoveItems(deleteFileList, deleteDirList); - - deleteFileList->Clear(); - deleteDirList->Clear(); - - delete mProgress; - } - - else - ftp->RmFile(selectList->Item(count)); - - } - } - - selectList->Clear(); - selectPerm->Clear(); - - SetCursor(wxCURSOR_ARROW); - } - - RefreshFiles(); - } - - - else - { - - wxString confirm; - confirm.Printf(wxT("Delete %s?"), - displayNames->Item(listIndex).c_str()); - - int result = wxMessageBox(confirm, wxT("Confirm"), wxYES_NO, NULL); - - if (result == wxYES) - { - SetCursor(wxCURSOR_WAIT); - - // if directory - if (displayPerm->Item(listIndex).GetChar(0) == 'd') - { - // create progress bar - mProgress = new ProgressDialog(wxT("Delete"), wxT("")); - - deleteFileList = new wxArrayString(); - deleteDirList = new wxArrayString(); - - GetDeleteList(displayNames->Item(listIndex)); - RemoveItems(deleteFileList, deleteDirList); - - deleteFileList->Clear(); - deleteDirList->Clear(); - - delete mProgress; - } - else - { - //DeleteItem(displayNames->Item(listIndex), false); - ftp->RmFile(displayNames->Item(listIndex)); - } - SetCursor(wxCURSOR_ARROW); - } - - RefreshFiles(); - - } - } - - if (event.GetId() == wxID_POPUP_RENAME) - { - wxString result = wxGetTextFromUser(wxT("Please enter the new file/folder name:"), wxT("Rename"), fileManager->GetItemText(listIndex), this); - - if (result != wxT("")) - { - result.Replace(wxT(" "), wxT("_"), true); - - if (ftp->Rename(fileManager->GetItemText(listIndex).MakeLower(), result)) - RefreshFiles(); - else - wxMessageBox(wxT("Error renaming file, check permissions."), wxT("FTP Status"), wxOK, NULL); - } - } - -} - -void UploadDialog::GetDeleteList (wxString src) -{ - unsigned int count; - - ftp->ChDir(src); - GetDirContents(); - - for (count = 0; count < displayNames->GetCount(); count++) - { - if (displayPerm->Item(count).GetChar(0) == wxT('d')) - { - GetDeleteList(displayNames->Item(count)); - } - else - { - if (displayNames->Item(count) != wxT("..")) - { - deleteFileList->Add(ftp->Pwd()+wxT("/")+displayNames->Item(count)); - } - } - - mProgress->Update(count, (int)displayNames->GetCount(), wxT("Preparing to delete")); - } - - deleteDirList->Add(ftp->Pwd()); - - ftp->ChDir(wxT("..")); - GetDirContents(); - -} - -void UploadDialog::RemoveItems(wxArrayString *files, wxArrayString *dirs) -{ - unsigned int count; - - for (count = 0; count < files->GetCount(); count++) - { - ftp->RmFile(files->Item(count)); - - mProgress->Update(count, (int)files->GetCount(), wxT("Deleting files")); - } - - for (count = 0; count < dirs->GetCount(); count++) - { - ftp->RmDir(dirs->Item(count)); - - mProgress->Update(count, (int)dirs->GetCount(), wxT("Deleting directories")); - } - -} - -void UploadDialog::GetDirContents (void) -{ - unsigned int count; - wxString filename; - wxString buf; - wxString size; - - wxArrayString *rawList = new wxArrayString(); - - dirnameList->Empty(); - dirpermList->Empty(); - dirsizeList->Empty(); - filenameList->Empty(); - filepermList->Empty(); - filesizeList->Empty(); - displayNames->Empty(); - displayPerm->Empty(); - displaySizes->Empty(); - - if (ftp->GetDirList(*rawList)) - { - - // get Directory list - for (count = 0; count < rawList->GetCount(); count++) - { - - filename = rawList->Item(count); - - wxArrayString *info = new wxArrayString(); - ExtractListData(filename, info); - - if (info->Item(3) == wxT("yes")) - { - dirnameList->Add(info->Item(0)); - dirpermList->Add(info->Item(1)); - dirsizeList->Add(info->Item(2)); - } - - } - - // get File list - for (count = 0; count < rawList->GetCount(); count++) - { - - filename = rawList->Item(count); - - wxArrayString *info = new wxArrayString(); - ExtractListData(filename, info); - - if (info->Item(3) == wxT("no")) - { - filenameList->Add(info->Item(0)); - filepermList->Add(info->Item(1)); - filesizeList->Add(info->Item(2)); - } - - } - - dirnameList->Insert(wxT(".."), 0); - dirpermList->Insert(wxT("up"), 0); - dirsizeList->Insert(wxT("-"), 0); - - - // add directories and files - for (count = 0; count < dirnameList->GetCount(); count++) - { - displayNames->Add(dirnameList->Item(count)); - displayPerm->Add(dirpermList->Item(count)); - displaySizes->Add(dirsizeList->Item(count)); - } - - for (count = 0; count < filenameList->GetCount(); count++) - { - if (!filenameList->Item(count).IsNumber()) - { - displayNames->Add(filenameList->Item(count)); - displayPerm->Add(filepermList->Item(count)); - displaySizes->Add(filesizeList->Item(count)); - } - } - } - else - wxMessageBox(wxT("Unable to retrieve directory contents."), wxT("FTP Status"), wxOK | wxICON_INFORMATION, this); - - -} - -void UploadDialog::OnActivateItem (wxListEvent &event) -{ - -if (ftp->ChDir(displayNames->Item(event.m_itemIndex))) -{ - RefreshFiles(); -} - - - -} - -void UploadDialog::RefreshFiles(void) -{ - unsigned int count; - long tmp; - - // get directory listing and save it - GetDirContents(); - - // clear filemanager - fileManager->DeleteAllItems(); - - for (count = 0; count < displayNames->GetCount(); count++) - { - if (displayPerm->Item(count)[0] == wxT('d') || displayNames->Item(count) == wxT("..")) - { - if (displayNames->Item(count) == wxT("..")) - tmp = fileManager->InsertItem(count, displayNames->Item(count), 3); - else - tmp = fileManager->InsertItem(count, displayNames->Item(count), 0); - - } - else - { - if (displayNames->Item(count).Mid(displayNames->Item(count).Length()-4, 4) == wxT(".mp3")) - tmp = fileManager->InsertItem(count, displayNames->Item(count), 2); - else - tmp = fileManager->InsertItem(count, displayNames->Item(count), 1); - - } - - fileManager->SetItemData(tmp, count); - - // filesize - if (displayPerm->Item(count)[0] == wxT('d') || displayNames->Item(count) == wxT("..")) - fileManager->SetItem(count, 1, wxT("-")); - else - fileManager->SetItem(count, 1, displaySizes->Item(count)); - - // file permissions - fileManager->SetItem(count, 2, displayPerm->Item(count)); - } - - // show - fileManager->Show(true); - - - -} - - -// This function extracts the data from a ftp list string -void UploadDialog::ExtractListData (wxString string, wxArrayString *results) -{ - int index; - wxString permissions; - wxString name; - wxString size; - wxString isDir = wxT("no"); - - // trim string - string.Trim(); - - - // extract data left to right - - // extract permissions - index = string.Find(' '); - permissions = string.Mid(0, index); - string = string.Mid(index+1, string.Length()); - string.Trim(false); - - // junk it - index = string.Find(' '); - string = string.Mid(index+1, string.Length()); - string.Trim(false); - - // junk it - index = string.Find(' '); - string = string.Mid(index+1, string.Length()); - string.Trim(false); - - // junk it - index = string.Find(' '); - string = string.Mid(index+1, string.Length()); - string.Trim(false); - - // extract filesize - index = string.Find(' '); - size = string.Mid(0, index); - string = string.Mid(index+1, string.Length()); - string.Trim(false); - - // junk it - index = string.Find(' '); - string = string.Mid(index+1, string.Length()); - string.Trim(false); - - // junk it - index = string.Find(' '); - string = string.Mid(index+1, string.Length()); - string.Trim(false); - - // junk it - index = string.Find(' '); - string = string.Mid(index+1, string.Length()); - string.Trim(false); - - // extract filename - name = string.Mid(0, string.Length()); - string.Trim(); - string.Trim(false); - - if (permissions[0] == wxT('d')) - isDir = wxT("yes"); - else - isDir = wxT("no"); - - results->Add(name); - results->Add(permissions); - results->Add(size); - results->Add(isDir); - -} - -void UploadDialog::DownloadFile (wxString src, wxString dest) -{ - - wxInputStream *in; - wxFileOutputStream *out; - size_t size; - char *chunk; - int iterations; - int count; - - if (!abort) - { - in = ftp->GetInputStream(src); - - if ( !in ) - { - wxLogError(wxT("Could not get file: ")+src); - } - else - { - - size = in->GetLength(); - - if (size > CHUNKSIZE) - chunk = new char[CHUNKSIZE]; - else - chunk = new char[size]; - - mProgress = new ProgressDialog(wxT("Download Progress"), wxT("")); - - // create output file - out = new wxFileOutputStream(dest); - - if (size > 0) - { - // find number of iterations needed - if (size > CHUNKSIZE) - iterations = size / CHUNKSIZE; - else - iterations = 1; - - for (count = 0; count < iterations; count++) - { - if (!abort) - { - if (size > CHUNKSIZE) - { - in->Read(chunk, CHUNKSIZE); - out->Write(chunk, CHUNKSIZE); - } - else - { - in->Read(chunk, size); - out->Write(chunk, size); - } - } - - int updateResult = mProgress->Update(count, iterations, src); - if (updateResult != eProgressSuccess) - { - //wxMessageBox("ABORT", wxT("FTP Status"), wxOK | wxICON_INFORMATION, NULL); - - abort = true; - break; - } - - } - - if (!abort) - { - int remSize = size - (CHUNKSIZE * iterations); - - if (remSize > 0) - { - - char *endChunk = new char[remSize]; - - in->Read(endChunk, remSize); - out->Write(endChunk, remSize); - - delete [] endChunk; - } - } - } - - delete in; - delete out; - delete [] chunk; - - if (abort) - { - wxRemoveFile(dest); - ftp->Reconnect(); - } - - delete mProgress; - } - } -} - -void UploadDialog::UploadFile(wxString src, wxString dest) -{ - wxFileInputStream *in_stream; - size_t size; - char *chunk; - int iterations; - int count; - - in_stream = new wxFileInputStream(src); - - size = in_stream->GetLength(); - - if (size > CHUNKSIZE) - chunk = new char[CHUNKSIZE]; - else - chunk = new char[size]; - - // create progress bar - mProgress = new ProgressDialog(wxT("Upload Progress"), wxT("")); - - // find number of iterations needed - if (size > CHUNKSIZE) - iterations = size / CHUNKSIZE; - else - iterations = 1; - - // create output file on server - dest.Replace(wxT(" "), wxT("_"), true); - dest = dest.MakeLower(); - - wxOutputStream *out_stream = ftp->GetOutputStream(dest); - - if (out_stream == NULL) - { - wxMessageBox(ftp->GetLastResult()); - } - else - { - if (size > 0) - { - for (count = 0; count < iterations; count++) - { - if (size > CHUNKSIZE) - { - in_stream->Read(chunk, CHUNKSIZE); - out_stream->Write(chunk, CHUNKSIZE); - } - else - { - in_stream->Read(chunk, size); - out_stream->Write(chunk, size); - } - - // result is false, user clicked abort - if(!mProgress->Update(count, iterations, dest)) - { - abort = true; - break; - } - - } - - if (!abort) - { - int remSize = size - (CHUNKSIZE * iterations); - - if (remSize > 0) - { - - char *endChunk = new char[remSize]; - - in_stream->Read(endChunk, remSize); - out_stream->Write(endChunk, remSize); - - delete [] endChunk; - } - } - - } - delete out_stream; - } - - delete [] chunk; - delete in_stream; - - // if aborted, delete incomplete file - if (abort) - ftp->RmFile(dest); - - delete mProgress; -} - -void UploadDialog::UploadDir (wxString src, wxString dest) -{ - wxDir *dir = new wxDir(); - wxArrayString *files = new wxArrayString(); - wxArrayString *dirs = new wxArrayString(); - wxString debug; - wxString name; - bool unique; - int index; - unsigned int count, count2; - - // get list of directories - dir->GetAllFiles(src, files, wxT(""), wxDIR_FILES | wxDIR_DIRS); - - // extract directories from filenames - for (count = files->GetCount()-1; count > 0; count--) - { - - // remove filename - index = files->Item(count).Find(wxT('\\'), true); - name = files->Item(count).Mid(0, index); - - // remove root dir - index = name.Find(wxT('\\')); - name = name.Mid(index, name.Length() - index); - - // replace '\' with '/' - name.Replace(wxT("\\"), wxT("/"), true); - name = name.MakeLower(); - - unique = true; - for (count2 = 0; count2 < dirs->GetCount(); count2++) - { - if (name == dirs->Item(count2)) - { - unique = false; - break; - } - } - - if (unique) - dirs->Add(name); - - } - - // create directories on server - for (count = 0; count < dirs->GetCount(); count++) - { - wxString dirname = ftp->Pwd()+dirs->Item(count); - ftp->MkDir(dirname.MakeLower()); - } - - // upload files - for (count = 0; count < files->GetCount(); count++) - { - if (!abort) - { - index = files->Item(count).Find(wxT('\\')); - name = files->Item(count).Mid(index, files->Item(count).Length() - index); - - name.Replace(wxT("\\"), wxT("/"), true); - name = ftp->Pwd()+name; - - UploadFile(files->Item(count), name); - } - } - - RefreshFiles(); -} - -void UploadDialog::DownloadDir (wxString src, wxString dest) -{ - if (!abort) - { - wxString dirName; - - if (dest.Last() == wxT('\\')) - dirName = dest+src; - else - dirName = dest+wxT("\\")+src; - - // create directory on users computer - if (!wxDirExists(dirName)) - wxMkdir(dirName); - - // change to src directory - if (ftp->ChDir(src)) - { - GetDirContents(); - - // loop through each item and download - unsigned int count; - for (count = 0; count < displayNames->GetCount(); count++) - { - if (!abort) - { - bool isDir = false; - wxString destName; - - if (displayNames->Item(count) != wxT("..")) - { - if (displayPerm->Item(count).GetChar(0) == wxT('d')) - isDir = true; - - //destName = dirName+"\\"+displayNames->Item(count); - - DownloadItem(displayNames->Item(count), dirName, isDir, true); - } - } - } - - // switch back to parent - ftp->ChDir(wxT("..")); - GetDirContents(); - - } - else - wxMessageBox(wxT("Cannot copy folder: ")+src, wxT("Error"), wxOK, NULL); - - } - - -} - -void UploadDialog::DownloadItem (wxString &src, wxString &dest, - bool dir, bool multi) -{ - if (abort) - return; - - if (dir) - { - if (multi) - { - DownloadDir(src, dest); - } - - else - { - wxDirDialog *saveDir = new wxDirDialog(this, wxT("Download Folder"), wxT("")); - int result = saveDir->ShowModal(); - - if (result == wxID_OK) - DownloadDir(src, saveDir->GetPath()); - } - - } - else - { - // if part of a multi file download, don't ask what to save file as... - // just save to dest argument - if (multi) - { - DownloadFile(src, dest+wxT("\\")+src); - } - else - { - FileDialog saveFile(this, wxT("Download File"), - wxT(""), src, - wxT("All files (*.*)|*.*"), wxFD_SAVE | wxRESIZE_BORDER); - int result = saveFile.ShowModal(); - - if (result == wxID_OK) - DownloadFile(src, saveFile.GetPath()); - } - } -} - -void UploadDialog::DownloadItem (wxString &src, bool dir) -{ - if (abort) - return; - - if (dir) - { - - wxDirDialog saveDir(this, wxT("Download Folder"), wxT("")); - int result = saveDir.ShowModal(); - - if (result == wxID_OK) - DownloadDir(src, saveDir.GetPath()); - - } - else - { - - FileDialog saveFile(this, wxT("Download File"), wxT(""), src, wxT("All files (*.*)|*.*"), wxFD_SAVE | wxRESIZE_BORDER); - int result = saveFile.ShowModal(); - - if (result == wxID_OK) - DownloadFile(src, saveFile.GetPath()); - - } -} - -void UploadDialog::DownloadMultipleItems (void) -{ - - long item = -1; - - // get save directory - wxDirDialog *saveDir = new wxDirDialog(this, wxT("Download Files"), wxT("")); - saveDir->ShowModal(); - - // download selected items - item = fileManager->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - while (item != -1) - { - // if directory - if (displayPerm->Item(item).GetChar(0) == wxT('d')) - { - //DownloadItem(fileManager->GetItemText(listIndex), saveDir->GetPath(), true, true); - DownloadDir(displayNames->Item(item), saveDir->GetPath()+wxT("\\")); - - } - else - { - DownloadFile(displayNames->Item(item), saveDir->GetPath()+wxT("\\")+displayNames->Item(item)); - } - - // get next item - item = fileManager->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - - } - -} - -void UploadDialog::OnCreateDir(wxCommandEvent & WXUNUSED(event)) -{ - - wxString result = wxGetTextFromUser(wxT("Please enter new folder name:"), wxT("New Folder"), wxT(""), this); - - if (result != wxT("")) - { - result.Replace(wxT(" "), wxT("_"), true); - - if (ftp->MkDir(result.MakeLower())) - RefreshFiles(); - else - wxMessageBox(ftp->GetLastResult()); - } - -} - -void UploadDialog::OnNewSite (wxCommandEvent & WXUNUSED(event)) -{ - int count; - int index; - long tmp; - wxListItem listItem; - wxString newSite = wxT("New Site"); - - index = siteList->GetItemCount(); - - tmp = siteList->InsertItem(index, newSite, 0); - siteList->SetItemData(tmp, 0); - - // make sure all items are deselected - for (count = 0; count < siteList->GetItemCount(); count++) - siteList->SetItemState(count, 0, wxLIST_STATE_SELECTED); - - // select added item - siteList->SetItemState(tmp, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); - - txtFtpName->SetValue(newSite); - - ftpIndex = tmp; -} - -void UploadDialog::OnDeleteSite (wxCommandEvent & WXUNUSED(event)) -{ - wxString debug; - -// debug.Printf("%d", index); -// wxMessageBox(debug, wxT("FTP Status"), wxOK | wxICON_INFORMATION, this); - - wxFileName fn( FileNames::DataDir(), wxT("connections.ini") ); - - wxTextFile *file = new wxTextFile(fn.GetFullPath()); - - if (file->Exists()) - { - file->Open(); - - file->RemoveLine(ftpIndex); - file->RemoveLine(ftpIndex); - file->RemoveLine(ftpIndex); - file->RemoveLine(ftpIndex); - - file->Write(); - file->Close(); - - siteList->DeleteItem(ftpIndex); - } - - UpdateSiteList(); -} - -void UploadDialog::OnFtpChange (wxCommandEvent & WXUNUSED(event)) -{ - siteList->SetItemText(ftpIndex, txtFtpName->GetValue()); -} - -void UploadDialog::OnSelectSite (wxListEvent &event) -{ - currentFtp = event.m_itemIndex; - ftpIndex = event.m_itemIndex; - - txtFtpName->SetValue(ftpList->Item((ftpIndex * 4)+0)); - txtFtpHost->SetValue(ftpList->Item((ftpIndex * 4)+1)); - txtFtpUser->SetValue(ftpList->Item((ftpIndex * 4)+2)); - txtFtpPass->SetValue(ftpList->Item((ftpIndex * 4)+3)); - - //wxString debug; - //debug.Printf("ftpIndex %d", ftpIndex); - //wxMessageBox(debug, wxT("FTP Status"), wxOK | wxICON_INFORMATION, NULL); -} - -bool UploadDialog::SaveFtpSite(wxString name, wxString host, wxString user, wxString pass) -{ - wxFileName fn( FileNames::DataDir(), wxT("connections.ini") ); - - wxTextFile *file = new wxTextFile(fn.GetFullPath()); - - if (file->Exists()) - file->Open(); - else - { - file->Create(); - file->Open(); - } - - // see if this ftp is already in our file - unsigned int count = 0; - int found = -1; - - while (count < file->GetLineCount()) - { - - if (file->GetLine(count) == name) - { - found = count; - break; - } - - count += 4; - } - - // add new site - if (found == -1) - { - file->AddLine(name); - file->AddLine(host); - file->AddLine(user); - file->AddLine(pass); - - file->Write(); - file->Close(); - - return true; - - } - else - { - file->RemoveLine(found); - file->RemoveLine(found); - file->RemoveLine(found); - file->RemoveLine(found); - - file->InsertLine(pass, found); - file->InsertLine(user, found); - file->InsertLine(host, found); - file->InsertLine(name, found); - - file->Write(); - file->Close(); - - return false; - } - - - - -} - -void UploadDialog::LoadFtpSiteList (void) -{ - wxFileName fn( FileNames::DataDir(), wxT("connections.ini") ); - - wxTextFile *file = new wxTextFile(fn.GetFullPath()); - unsigned int count; - - if (file->Exists()) - { - file->Open(); - - ftpList->Empty(); - - for (count = 0; count < file->GetLineCount(); count++) - ftpList->Add(file->GetLine(count)); - - file->Close(); - } - -} - -void UploadDialog::UpdateSiteList (void) -{ - unsigned int count; - unsigned int insert_count; - long tmp; - - LoadFtpSiteList(); - - - count = 0; - insert_count = 0; - - siteList->DeleteAllItems(); - - while (count < ftpList->GetCount()) - { - //wxMessageBox(ftpList->Item(count), wxT("Error"), wxOK, NULL); - - tmp = siteList->InsertItem(insert_count, ftpList->Item(count), 0); - siteList->SetItemData(tmp, insert_count); - - count += 4; - insert_count++; - } - -} diff --git a/src/UploadDialog.h b/src/UploadDialog.h deleted file mode 100644 index 3a8ce5ca0..000000000 --- a/src/UploadDialog.h +++ /dev/null @@ -1,139 +0,0 @@ -/********************************************************************** - - Audacity: A Digital Audio Editor - - AboutDialog.h - - Mike Underwood - -**********************************************************************/ - -#ifndef __AUDACITY_UPLOAD_DLG__ -#define __AUDACITY_UPLOAD_DLG__ - -#include -#include -#include -#include - -#include "widgets/ProgressDialog.h" - -#define wxID_FTPNAME 1000 -#define wxID_FTPHOST 1001 -#define wxID_FTPUSER 1002 -#define wxID_FTPPASS 1003 -#define wxID_SAVEFTP 1004 -#define wxID_USEPASV 1005 -#define wxID_CONNECT 1006 -#define wxID_DISCONNECT 1007 -#define wxID_UPLOAD_FILE 1008 -#define wxID_UPLOAD_DIR 1009 -#define wxID_STATUSBAR 1010 -#define wxID_SITELIST 1011 -#define wxID_FILEMANAGER 1012 -#define wxID_CREATEDIR 1013 -#define wxID_NEWSITE 1014 -#define wxID_DELSITE 1015 - -#define wxID_POPUP_DOWNLOAD 2000 -#define wxID_POPUP_RENAME 2001 -#define wxID_POPUP_DELETE 2002 - -#define CHUNKSIZE 128 - -class wxBoxSizer; -class wxButton; -class wxCheckBox; -class wxListView; -class wxTextCtrl; -class wxFTP; -class wxStatusBar; - -class UploadDialog:public wxDialog { - DECLARE_DYNAMIC_CLASS(UploadDialog) - - public: - UploadDialog(wxWindow * parent); - virtual ~ UploadDialog(); - - void OnCancel(wxCommandEvent & event); - void OnConnect(wxCommandEvent & event); - void OnDisconnect(wxCommandEvent & event); - void OnUploadFile(wxCommandEvent & event); - void OnUploadDir(wxCommandEvent & event); - void OnCreateDir(wxCommandEvent & event); - void OnActivateItem (wxListEvent &event); - void OnActivateSite (wxListEvent &event); - void OnListRightClick (wxListEvent & event); - void OnPopupMenu (wxCommandEvent & event); - void OnNewSite (wxCommandEvent & event); - void OnDeleteSite (wxCommandEvent &event); - void OnFtpChange(wxCommandEvent & event); - void OnSelectSite (wxListEvent &event); - void OnCharPress (wxKeyEvent &event); - - void GetDirContents(void); - void RefreshFiles(void); - void ExtractListData (wxString string, wxArrayString *results); - - bool SaveFtpSite(wxString name, wxString host, wxString user, wxString pass); - void LoadFtpSiteList (void); - void UpdateSiteList (void); - - void DownloadItem (wxString &src, wxString &dest, bool dir, bool multi); - void DownloadItem (wxString &src, bool dir); - void DownloadMultipleItems(void); - void DownloadFile (wxString src, wxString dest); - void DownloadDir (wxString src, wxString dest); - - void GetDeleteList (wxString src); - void RemoveItems(wxArrayString *files, wxArrayString *dirs); - void UploadFile(wxString src, wxString dest); - void UploadDir (wxString src, wxString dest); - - wxBoxSizer *topsizer; - wxButton *btnConnect; - wxButton *btnDisconnect; - wxButton *btnUploadFile; - wxButton *btnUploadDir; - wxButton *btnCreateDir; - - wxButton *btnNewSite; - wxButton *btnDelSite; - - wxCheckBox *cbSave; - wxCheckBox *cbPasv; - wxImageList *icons; - wxListView *siteList; - wxListView *fileManager; - wxTextCtrl *txtFtpName; - wxTextCtrl *txtFtpHost; - wxTextCtrl *txtFtpUser; - wxTextCtrl *txtFtpPass; - wxFTP *ftp; - wxPoint mousePos; - - wxArrayString *filenameList; - wxArrayString *filepermList; - wxArrayString *filesizeList; - wxArrayString *dirnameList; - wxArrayString *dirpermList; - wxArrayString *dirsizeList; - wxArrayString *displayNames; - wxArrayString *displayPerm; - wxArrayString *displaySizes; - wxArrayString *deleteFileList; - wxArrayString *deleteDirList; - wxArrayString *ftpList; - - ProgressDialog *mProgress; - - long listIndex; - long ftpIndex; - long currentFtp; - bool abort; - - DECLARE_EVENT_TABLE() -}; - -#endif diff --git a/win/Projects/Audacity/Audacity.vcproj b/win/Projects/Audacity/Audacity.vcproj index 416d18e1f..b36e84d13 100644 --- a/win/Projects/Audacity/Audacity.vcproj +++ b/win/Projects/Audacity/Audacity.vcproj @@ -828,14 +828,6 @@ RelativePath="..\..\..\src\UndoManager.h" > - - - -