Permalink
Browse files

initial code for auto updates and about window complete (closes #31 and

closes #39)
  • Loading branch information...
tonylukasavage committed Aug 1, 2011
1 parent e4cadca commit 58712fae79d30a077156d5ab9947723bd0d6a0e5
View
@@ -27,10 +27,10 @@
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
- <versionNumber>0.2.0</versionNumber>
+ <versionNumber>0.2.1</versionNumber>
<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
- <versionLabel>0.2.0 alpha</versionLabel>
+ <versionLabel>0.2.1 alpha</versionLabel>
<!-- Description, displayed in the AIR application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
View
@@ -97,11 +97,15 @@
this.htmlRendered.addEventListener(Event.COMPLETE, this.onHtmlComplete);
this.editorTabNavigator.addEventListener(IndexChangedEvent.CHANGE, onEditorTabChange);
+ this.checkForUpdates();
+ }
+
+ public function checkForUpdates(isVisible:Boolean=false):void {
appUpdater = new ApplicationUpdaterUI();
appUpdater.updateURL = "http://savagelook.com/gonzo_updater/update.xml";
appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdaterUpdate);
appUpdater.addEventListener(ErrorEvent.ERROR, onUpdaterError);
- appUpdater.isCheckForUpdateVisible = true;
+ appUpdater.isCheckForUpdateVisible = isVisible;
appUpdater.isFileUpdateVisible = true;
appUpdater.isInstallUpdateVisible = true;
appUpdater.initialize();
@@ -73,14 +73,17 @@
<menuitem label="Help">
<menuitem label="Cheat Sheet" id="help_tutorial" keyEquivalent="t" controlKey="true" shiftKey="true"/>
<menuitem type="separator"/>
- <menuitem label="About Gonzo..." id="help_about" enabled="false"/>
+ <menuitem label="Check for Updates..." id="help_updates" />
+ <menuitem type="separator"/>
+ <menuitem label="About Gonzo..." id="help_about" />
</menuitem>
</root>
</fx:XML>
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.savagelook.Gonzo.windows.GonzoPreferenceWindow;
+ import com.savagelook.Gonzo.windows.GonzoAboutWindow;
import mx.containers.VBox;
import mx.controls.Alert;
import mx.controls.textClasses.TextRange;
@@ -394,6 +397,14 @@
this.doWindowWordWrap(node.@toggled == "true");
} else if (id == "help_tutorial") {
this.doHelpCheatSheet();
+ } else if (id == "help_updates") {
+ gonzo.checkForUpdates(true);
+ } else if (id == "help_about") {
+ var aboutWindow:GonzoAboutWindow = PopUpManager.createPopUp(gonzo, GonzoAboutWindow, true) as GonzoAboutWindow;
+ aboutWindow.addEventListener(GonzoAboutWindow.CHECK_FOR_UPDATES, function(e:Event):void {
+ gonzo.checkForUpdates(true);
+ });
+ PopUpManager.centerPopUp(aboutWindow);
} else if (id == "markdown_linkInline") {
editor.doLinkInline();
} else if (id == "markdown_imageInline") {
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="180"
+ title="About Gonzo"
+ close="onClose();"
+ creationComplete="titlewindow1_creationCompleteHandler(event)">
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+ <fx:Script>
+ <![CDATA[
+ import mx.events.FlexEvent;
+ import mx.managers.PopUpManager;
+
+ public static const CHECK_FOR_UPDATES:String = "GonzoAboutWindow_CheckForUpdates";
+
+ private function onClose():void {
+ PopUpManager.removePopUp(this);
+ }
+
+ protected function titlewindow1_creationCompleteHandler(event:FlexEvent):void
+ {
+ var xml:XML = NativeApplication.nativeApplication.applicationDescriptor;
+ var ns:Namespace = xml.namespace();
+ versionLabel.text = "Version: " + xml.ns::versionLabel;
+ }
+
+
+ protected function label1_clickHandler(event:MouseEvent):void
+ {
+ this.dispatchEvent(new Event(GonzoAboutWindow.CHECK_FOR_UPDATES));
+ this.onClose();
+ }
+
+ ]]>
+ </fx:Script>
+ <s:layout>
+ <s:HorizontalLayout gap="10" paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10" verticalAlign="middle"/>
+ </s:layout>
+ <s:Image source="assets/gonzo.png" />
+ <s:VGroup gap="5">
+ <s:Label text="Gonzo" fontSize="36" fontWeight="bold" />
+ <s:Label text="The lightweight markdown editor" fontSize="16"/>
+ <s:Label id="versionLabel" text="" fontSize="16"/>
+ <s:Label text="Check for updates..." fontStyle="italic" fontSize="14" color="#3333ff" click="label1_clickHandler(event)" buttonMode="true"/>
+ </s:VGroup>
+</s:TitleWindow>

0 comments on commit 58712fa

Please sign in to comment.