ReaWwise

REAPER extension
Log | Files | Refs | Submodules

ImportControlsComponent.h (3781B)


      1 /*----------------------------------------------------------------------------------------
      2 
      3 Copyright (c) 2023 AUDIOKINETIC Inc.
      4 
      5 This file is licensed to use under the license available at:
      6 https://github.com/audiokinetic/ReaWwise/blob/main/License.txt (the "License").
      7 You may not use this file except in compliance with the License.
      8 
      9 Unless required by applicable law or agreed to in writing, software distributed
     10 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
     11 CONDITIONS OF ANY KIND, either express or implied.  See the License for the
     12 specific language governing permissions and limitations under the License.
     13 
     14 ----------------------------------------------------------------------------------------*/
     15 
     16 #pragma once
     17 
     18 #include "Core/DawContext.h"
     19 #include "Core/ImportTask.h"
     20 #include "Core/WaapiClient.h"
     21 #include "Persistance/ApplicationProperties.h"
     22 
     23 #include <juce_gui_basics/juce_gui_basics.h>
     24 
     25 namespace AK::WwiseTransfer
     26 {
     27 	class ImportControlsComponent
     28 		: public juce::Component
     29 		, private juce::ValueTree::Listener
     30 		, private juce::AsyncUpdater
     31 	{
     32 	public:
     33 		ImportControlsComponent(juce::ValueTree appState, WaapiClient& waapiClient, DawContext& dawContext, ApplicationProperties& applicationProperties, const juce::String& applicationName);
     34 		~ImportControlsComponent() override;
     35 
     36 		void resized() override;
     37 
     38 		void transferToWwise();
     39 
     40 	private:
     41 		juce::TextButton importButton;
     42 		juce::ValueTree applicationState;
     43 		juce::CachedValue<bool> originalsSubfolderValid;
     44 		juce::CachedValue<bool> importDestinationValid;
     45 		juce::CachedValue<juce::String> importDestination;
     46 		juce::CachedValue<juce::String> originalsSubFolder;
     47 		juce::CachedValue<juce::String> originalsFolder;
     48 		juce::CachedValue<juce::String> projectPath;
     49 		juce::CachedValue<juce::String> languageSubfolder;
     50 		juce::CachedValue<Import::ContainerNameExistsOption> containerNameExistsOption;
     51 		juce::CachedValue<Import::ApplyTemplateOption> applyTemplateOption;
     52 		juce::CachedValue<bool> transferInProgress;
     53 		juce::ValueTree hierarchyMapping;
     54 		juce::ValueTree previewItems;
     55 
     56 		juce::CachedValue<juce::String> selectObjectsOnImportCommand;
     57 		juce::CachedValue<bool> applyTemplateFeatureEnabled;
     58 		juce::CachedValue<bool> undoGroupFeatureEnabled;
     59 		juce::CachedValue<bool> waqlEnabled;
     60 
     61 		WaapiClient& waapiClient;
     62 		DawContext& dawContext;
     63 		ApplicationProperties& applicationProperties;
     64 
     65 		std::unique_ptr<juce::ThreadWithProgressWindow> importTask;
     66 
     67 		juce::ToggleButton showSilentIncrementWarningToggle;
     68 
     69 		juce::TextEditor errorMessageContainer;
     70 
     71 		const juce::String applicationName;
     72 
     73 		void showImportSummaryModal(const Import::Summary& summary, const Import::Task::Options& importTaskOptions);
     74 		juce::URL createImportSummaryFile(const Import::Summary& summary, const Import::Task::Options& importTaskOptions);
     75 
     76 		void refreshComponent();
     77 
     78 		void valueTreePropertyChanged(juce::ValueTree& treeWhosePropertyHasChanged, const juce::Identifier& property) override;
     79 		void valueTreeChildAdded(juce::ValueTree& parentTree, juce::ValueTree& childWhichHasBeenAdded);
     80 		void valueTreeChildRemoved(juce::ValueTree& parentTree, juce::ValueTree& childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved);
     81 		void valueTreeChildOrderChanged(juce::ValueTree& parentTreeWhoseChildrenHaveMoved, int oldIndex, int newIndex);
     82 
     83 		void handleAsyncUpdate() override;
     84 
     85 		void onRenderFailedDetected();
     86 		void onImportCancelled();
     87 		void onFileRenamedDetected(bool isPathIncomplete, const std::vector<Import::Item>& importItems);
     88 		void onPathIncompleteDetected(const std::vector<Import::Item>& importItems);
     89 		void onImport(const std::vector<Import::Item>& importItems);
     90 
     91 		JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ImportControlsComponent)
     92 	};
     93 } // namespace AK::WwiseTransfer