Browse Source

License management improvements

Josh Engebretson 10 years ago
parent
commit
d5c37241c9

+ 10 - 6
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/ui/managelicense.tb.txt

@@ -1,6 +1,10 @@
-TBLayout: axis: y, distribution: gravity, position: left
-	TBLayout: 
-		TBButton: id: "return_activation" text: "Return Activation"
-		TBTextField: text: "Return the activation on this computer"
-	TBSeparator: gravity: left right, skin: AESeparator
-	TBButton: text: OK, id: ok
+TBLayout: axis: y
+	TBLayout: axis: y, distribution: gravity, position: left
+		TBLayout: 
+			TBButton: id: "return_activation" text: "Return Activation"
+				lp: min-width: 128, min-height: 64			
+			TBTextField: text: "Return the activation on this computer"
+		TBSeparator: gravity: left right, skin: AESeparator
+	TBLayout: distribution: gravity
+		TBButton: text: OK, id: ok
+			lp: min-width: 64, min-height: 32

+ 6 - 3
Source/AtomicEditor/Source/AEEditor.cpp

@@ -34,6 +34,7 @@
 #include "Resources/AEResourceOps.h"
 
 #include <TurboBadger/tb_message_window.h>
+#include <TurboBadger/animation/tb_animation.h>
 
 namespace AtomicEditor
 {
@@ -312,9 +313,6 @@ void Editor::HandleExitRequested(StringHash eventType, VariantMap& eventData)
         aepreferences_->Write();
     }
 
-    TBUI* tbui = GetSubsystem<TBUI>();
-    tbui->Shutdown();
-
     mainframe_ = 0;
     player_ = 0;
     project_ = 0;
@@ -322,6 +320,11 @@ void Editor::HandleExitRequested(StringHash eventType, VariantMap& eventData)
     aejavascript_ = 0;
     aepreferences_ = 0;
 
+    TBAnimationManager::BeginBlockAnimations();
+
+    TBUI* tbui = GetSubsystem<TBUI>();
+    tbui->Shutdown();
+
     context_->RemoveSubsystem(Javascript::GetBaseTypeStatic());
 
     SendEvent(E_EDITORSHUTDOWN);

+ 4 - 1
Source/AtomicEditor/Source/License/AELicenseSystem.cpp

@@ -515,9 +515,12 @@ void LicenseSystem::HandleDeactivate(StringHash eventType, VariantMap& eventData
             }
             else if (response.StartsWith("AC_NOTACTIVATED") || response.StartsWith("AC_SUCCESS"))
             {
-                editor->PostModalInfo("Deactivation Success", "Deactivation was successful");
                 ResetLicense();
                 RemoveLicense();
+
+                UIModalOps* ops = GetSubsystem<UIModalOps>();
+                ops->Hide();
+                ops->ShowActivation();
             }
 
         }

+ 15 - 11
Source/AtomicEditor/Source/License/UIManageLicense.cpp

@@ -50,6 +50,7 @@ UIManageLicense::UIManageLicense(Context* context):
 
 UIManageLicense::~UIManageLicense()
 {
+    progressModal_->Hide();
 }
 
 bool UIManageLicense::OnEvent(const TBWidgetEvent &ev)
@@ -59,17 +60,22 @@ bool UIManageLicense::OnEvent(const TBWidgetEvent &ev)
 
     if (ev.type == EVENT_TYPE_CLICK)
     {
-        if (ev.type == EVENT_TYPE_CLICK)
+
+        if (ev.target->GetID() == TBIDC("ok"))
+        {
+            UIModalOps* ops = GetSubsystem<UIModalOps>();
+            ops->Hide();
+            return true;
+        }
+
+        if (ev.target->GetID() == TBIDC("confirm_license_return"))
         {
-            if (ev.target->GetID() == TBIDC("confirm_license_return"))
+            if (ev.ref_id == TBIDC("TBMessageWindow.ok"))
             {
-                if (ev.ref_id == TBIDC("TBMessageWindow.ok"))
-                {
-                    request_ = licenseSystem->Deactivate();
-                    SubscribeToEvent(request_, E_CURLCOMPLETE, HANDLER(UIManageLicense, HandleCurlComplete));
-                    progressModal_->SetMessage("Returning license, please wait...");
-                    progressModal_->Show();
-                }
+                request_ = licenseSystem->Deactivate();
+                SubscribeToEvent(request_, E_CURLCOMPLETE, HANDLER(UIManageLicense, HandleCurlComplete));
+                progressModal_->SetMessage("Returning license, please wait...");
+                progressModal_->Show();
             }
         }
 
@@ -98,8 +104,6 @@ bool UIManageLicense::OnEvent(const TBWidgetEvent &ev)
 void UIManageLicense::HandleCurlComplete(StringHash eventType, VariantMap& eventData)
 {
     progressModal_->Hide();
-
-
 }
 
 }

+ 12 - 0
Source/AtomicEditor/Source/UI/UIMainFrame.cpp

@@ -495,6 +495,17 @@ bool MainFrame::HandlePopupMenuEvent(const TBWidgetEvent &ev)
     {
         Editor* editor = GetSubsystem<Editor>();
 
+        // modals
+        if (ev.target->GetID() == TBIDC("modal_info"))
+        {
+            messageModal_ = 0;
+        }
+        else if (ev.target->GetID() == TBIDC("modal_error"))
+        {
+            messageModal_ = 0;
+        }
+
+
         if (ev.target->GetID() == TBIDC("file popup"))
         {
             if (ev.ref_id == TBIDC("new project"))
@@ -785,6 +796,7 @@ void MainFrame::HandlePlatformChange(StringHash eventType, VariantMap& eventData
 
 void MainFrame::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
 {
+    messageModal_= 0;
     context_->RemoveSubsystem(GetType());
 }