]> git.sesse.net Git - vlc/commitdiff
* ALL: basic skeleton for a streaming-wizard (refs #13)
authorFelix Paul Kühne <fkuehne@videolan.org>
Sun, 19 Jun 2005 19:37:42 +0000 (19:37 +0000)
committerFelix Paul Kühne <fkuehne@videolan.org>
Sun, 19 Jun 2005 19:37:42 +0000 (19:37 +0000)
    done:
    - all items are included with complete l10n support
    - checkboxes and select-file-buttons behave as they are supposed to

    todo:
    - implementation of the logic, i.e. handling of the collected values, respective manipulation of the GUI, start of the stream
    - move some arrays to an external header file
    - some GUI things (e.g. radio buttons on page 2, etc. - see FIXMEs)
    - implementation of some help-dialogues (it might be necessary to create a re-usable window in the nib for that, since NSAlert is Panther and Tiger only)
    - l10n string fixes (both in OSX and WX)
    => most of the work still needs to be done

13 files changed:
Makefile.am
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
extras/MacOSX/Resources/English.lproj/Wizard.nib/classes.nib [new file with mode: 0644]
extras/MacOSX/Resources/English.lproj/Wizard.nib/info.nib [new file with mode: 0644]
extras/MacOSX/Resources/English.lproj/Wizard.nib/keyedobjects.nib [new file with mode: 0644]
extras/MacOSX/vlc.pbproj/project.pbxproj
modules/gui/macosx/Modules.am
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/wizard.h [new file with mode: 0644]
modules/gui/macosx/wizard.m [new file with mode: 0644]

index 51fc5fdb0a9586dc69553f07dc8d206b8eccddd5..20e0b1aed75f238f504d546eaeae50345abd3821 100644 (file)
@@ -159,6 +159,9 @@ EXTRA_DIST += \
        extras/MacOSX/Resources/English.lproj/Preferences.nib/classes.nib \
        extras/MacOSX/Resources/English.lproj/Preferences.nib/info.nib \
        extras/MacOSX/Resources/English.lproj/Preferences.nib/keyedobjects.nib \
+       extras/MacOSX/Resources/English.lproj/Wizard.nib/classes.nib \
+       extras/MacOSX/Resources/English.lproj/Wizard.nib/info.nib \
+       extras/MacOSX/Resources/English.lproj/Wizard.nib/keyedobjects.nib \
        extras/MacOSX/Resources/English.lproj/InfoPlist.strings \
        extras/MacOSX/Resources/a52.icns \
        extras/MacOSX/Resources/aac.icns \
@@ -532,6 +535,8 @@ VLC-release.app: vlc
            vout.h \
            voutqt.m \
            voutgl.m \
+           wizard.h \
+           wizard.m \
            vout.m; do \
          cp "$(srcdir)/modules/gui/macosx/$$i" \
              $(top_builddir)/tmp/modules/gui/macosx; \
@@ -629,6 +634,8 @@ VLC.app: vlc
            vout.h \
            voutqt.m \
            voutgl.m \
+           wizard.h \
+           wizard.m \
            vout.m; do \
          cp "$(srcdir)/modules/gui/macosx/$$i" \
              $(top_builddir)/tmp/modules/gui/macosx; \
index 1ba5bff402470bb6462931c9348e8741a0e7a0ac..7306954a958c9ea41439c7de41a1de78e0b1f306 100644 (file)
                 openRecentItem = id; 
                 openWebsite = id; 
                 reportABug = id; 
+                showWizard = id; 
                 timesliderUpdate = id; 
                 togglePlaylist = id; 
                 viewAbout = id; 
index 0f7a2377d19d6a21be1c819f81aa38a9ebd3dc8c..243de85a48aec574ef25b515d9cffeadd206cc94 100644 (file)
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>101 241 496 270 0 0 800 578 </string>
+       <string>91 42 496 270 0 0 800 578 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>1617</key>
@@ -11,7 +11,7 @@
                <key>2197</key>
                <string>214 442 596 144 0 0 1024 746 </string>
                <key>29</key>
-               <string>72 702 419 44 0 0 1024 746 </string>
+               <string>205 505 419 44 0 0 800 578 </string>
                <key>915</key>
                <string>730 416 178 211 0 0 1024 746 </string>
        </dict>
@@ -21,6 +21,7 @@
        <array/>
        <key>IBOpenObjects</key>
        <array>
+               <integer>29</integer>
                <integer>2029</integer>
                <integer>21</integer>
        </array>
index 39feff409dd491d8cb69e58952fa3963b3e8ad85..a1545d968e4e2c6851f5bc8f2937c31ec1614148 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
diff --git a/extras/MacOSX/Resources/English.lproj/Wizard.nib/classes.nib b/extras/MacOSX/Resources/English.lproj/Wizard.nib/classes.nib
new file mode 100644 (file)
index 0000000..e0916e7
--- /dev/null
@@ -0,0 +1,96 @@
+{
+    IBClasses = (
+        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {
+            ACTIONS = {
+                cancelRun = id; 
+                nextTab = id; 
+                prevTab = id; 
+                "t1_mrInfo_streaming" = id; 
+                "t1_mrInfo_transcode" = id; 
+                "t2_addNewStream" = id; 
+                "t2_chooseStreamOrPlst" = id; 
+                "t2_enableExtract" = id; 
+                "t3_addressEntered" = id; 
+                "t4_AudCdcChanged" = id; 
+                "t4_VidCdcChanged" = id; 
+                "t4_enblAudTrnscd" = id; 
+                "t4_enblVidTrnscd" = id; 
+                "t6_enblSapAnnce" = id; 
+                "t6_mrInfo_sap" = id; 
+                "t6_mrInfo_ttl" = id; 
+                "t7_selectTrnscdDestFile" = id; 
+            }; 
+            CLASS = VLCWizard; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {
+                "o_btn_backward" = id; 
+                "o_btn_cancel" = id; 
+                "o_btn_forward" = id; 
+                "o_t1_btn_mrInfo_strmg" = id; 
+                "o_t1_btn_mrInfo_trnscd" = id; 
+                "o_t1_rdo_streaming" = id; 
+                "o_t1_rdo_transcode" = id; 
+                "o_t1_txt_notice" = id; 
+                "o_t1_txt_text" = id; 
+                "o_t1_txt_title" = id; 
+                "o_t2_box_prtExtrct" = id; 
+                "o_t2_btn_chooseFile" = id; 
+                "o_t2_ckb_enblPartExtrct" = id; 
+                "o_t2_fld_pathToNewStrm" = id; 
+                "o_t2_fld_prtExtrctFrom" = id; 
+                "o_t2_fld_prtExtrctTo" = id; 
+                "o_t2_rdo_exstPlstItm" = id; 
+                "o_t2_rdo_newStrm" = id; 
+                "o_t2_tbl_plst" = id; 
+                "o_t2_text" = id; 
+                "o_t2_title" = id; 
+                "o_t2_txt_prtExtrctFrom" = id; 
+                "o_t2_txt_prtExtrctTo" = id; 
+                "o_t3_box_dest" = id; 
+                "o_t3_box_strmgMthd" = id; 
+                "o_t3_fld_address" = id; 
+                "o_t3_matrix_stmgMhd" = id; 
+                "o_t3_txt_destInfo" = id; 
+                "o_t3_txt_text" = id; 
+                "o_t3_txt_title" = id; 
+                "o_t4_box_audio" = id; 
+                "o_t4_box_video" = id; 
+                "o_t4_ckb_audio" = id; 
+                "o_t4_ckb_video" = id; 
+                "o_t4_pop_audioBitrate" = id; 
+                "o_t4_pop_audioCodec" = id; 
+                "o_t4_pop_videoBitrate" = id; 
+                "o_t4_pop_videoCodec" = id; 
+                "o_t4_text" = id; 
+                "o_t4_title" = id; 
+                "o_t4_txt_bitrateAudio" = id; 
+                "o_t4_txt_bitrateVideo" = id; 
+                "o_t4_txt_codecAudio" = id; 
+                "o_t4_txt_codecVideo" = id; 
+                "o_t4_txt_hintAudio" = id; 
+                "o_t4_txt_hintVideo" = id; 
+                "o_t5_matrix_encap" = id; 
+                "o_t5_text" = id; 
+                "o_t5_title" = id; 
+                "o_t6_btn_mrInfo_sap" = id; 
+                "o_t6_btn_mrInfo_ttl" = id; 
+                "o_t6_ckb_sap" = id; 
+                "o_t6_fld_sap" = id; 
+                "o_t6_fld_ttl" = id; 
+                "o_t6_text" = id; 
+                "o_t6_title" = id; 
+                "o_t6_txt_ttl" = id; 
+                "o_t7_btn_chooseFile" = id; 
+                "o_t7_fld_filePath" = id; 
+                "o_t7_text" = id; 
+                "o_t7_title" = id; 
+                "o_t7_txt_saveFileTo" = id; 
+                "o_tab_pageHolder" = id; 
+                "o_wizard_window" = id; 
+            }; 
+            SUPERCLASS = NSObject; 
+        }
+    ); 
+    IBVersion = 1; 
+}
\ No newline at end of file
diff --git a/extras/MacOSX/Resources/English.lproj/Wizard.nib/info.nib b/extras/MacOSX/Resources/English.lproj/Wizard.nib/info.nib
new file mode 100644 (file)
index 0000000..be5f5cf
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>IBDocumentLocation</key>
+       <string>62 303 356 241 0 0 800 578 </string>
+       <key>IBFramework Version</key>
+       <string>364.0</string>
+       <key>IBLockedObjects</key>
+       <array>
+               <integer>6</integer>
+               <integer>14</integer>
+               <integer>10</integer>
+       </array>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>6</integer>
+       </array>
+       <key>IBSystem Version</key>
+       <string>7W98</string>
+</dict>
+</plist>
diff --git a/extras/MacOSX/Resources/English.lproj/Wizard.nib/keyedobjects.nib b/extras/MacOSX/Resources/English.lproj/Wizard.nib/keyedobjects.nib
new file mode 100644 (file)
index 0000000..366fd18
Binary files /dev/null and b/extras/MacOSX/Resources/English.lproj/Wizard.nib/keyedobjects.nib differ
index cafe59ed915483bf284053eb50cfc7d9ec4e23e8..c49a0c9a5546be51b20ab483a778721bccb4bdc8 100644 (file)
                                DCA00AA9075F948800E6BF46,
                                DCF358BB077F10BA007DB450,
                                DCA693C30789DF8700139EC6,
+                               DCFCCDB9085CE18F001E36AF,
                        );
                        isa = PBXResourcesBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
                                8ED6C28803E2EB1C0059A3A7,
                                8E9CA1A506D7DEE800B7186C,
                                8E9CA1A606D7DEE800B7186C,
+                               DC769AB8085DF0DB001A838D,
+                               DC769AB7085DF0DB001A838D,
                        );
                        isa = PBXGroup;
                        name = Classes;
 //DC2
 //DC3
 //DC4
+               DC769AB7085DF0DB001A838D = {
+                       fileEncoding = 5;
+                       isa = PBXFileReference;
+                       lastKnownFileType = sourcecode.c.objc;
+                       name = wizard.m;
+                       path = "/Users/felix/Desktop/Programming/VideoLAN/vlc-trunk/modules/gui/macosx/wizard.m";
+                       refType = 0;
+                       sourceTree = "<absolute>";
+               };
+               DC769AB8085DF0DB001A838D = {
+                       fileEncoding = 5;
+                       isa = PBXFileReference;
+                       lastKnownFileType = sourcecode.c.h;
+                       name = wizard.h;
+                       path = "/Users/felix/Desktop/Programming/VideoLAN/vlc-trunk/modules/gui/macosx/wizard.h";
+                       refType = 0;
+                       sourceTree = "<absolute>";
+               };
                DCA00AA7075F948800E6BF46 = {
                        children = (
                                DCA00AA8075F948800E6BF46,
                                F74F13EA02C2A79C01EE194C,
                                DCF358B9077F10BA007DB450,
                                DCA693C10789DF8700139EC6,
+                               DCFCCDB7085CE18F001E36AF,
                        );
                        isa = PBXGroup;
                        name = nibs;
                        refType = 4;
                        sourceTree = "<group>";
                };
+               DCFCCDB7085CE18F001E36AF = {
+                       children = (
+                               DCFCCDB8085CE18F001E36AF,
+                       );
+                       isa = PBXVariantGroup;
+                       name = Wizard.nib;
+                       path = "";
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               DCFCCDB8085CE18F001E36AF = {
+                       isa = PBXFileReference;
+                       lastKnownFileType = wrapper.nib;
+                       name = English;
+                       path = Resources/English.lproj/Wizard.nib;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               DCFCCDB9085CE18F001E36AF = {
+                       fileRef = DCFCCDB7085CE18F001E36AF;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
 //DC0
 //DC1
 //DC2
index cc84857ef5d120fd8b5e43193b9f27ae86e63106..eda20da922c7cb45d7f4ef97ee41bc5b4cf48d82 100644 (file)
@@ -28,5 +28,7 @@ SOURCES_macosx = \
        voutqt.m \
        voutgl.m \
        vout.h \
+       wizard.h \
+       wizard.m \
        $(NULL)
 
index 1a7fc3c6732620e6f09700a7b3ae26134ad14449..ea51c1e69b951bfad990453bd16bfba06abc9781 100644 (file)
@@ -90,7 +90,9 @@ struct intf_sys_t
     id o_prefs;                 /* VLCPrefs       */
     id o_about;                 /* VLAboutBox     */
     id o_open;                  /* VLCOpen        */
+    id o_wizard;                /* VLCWizard      */
     BOOL nib_open_loaded;       /* reference to the open-nib */
+    BOOL nib_wizard_loaded;     /* reference to the wizard-nib */
 
     IBOutlet id o_window;       /* main window    */
     IBOutlet id o_playlist_view;/* playlist view  */
@@ -154,6 +156,7 @@ struct intf_sys_t
     IBOutlet id o_mi_open_net;
     IBOutlet id o_mi_open_recent;
     IBOutlet id o_mi_open_recent_cm;
+    IBOutlet id o_mi_open_wizard;
 
     IBOutlet id o_mu_edit;
     IBOutlet id o_mi_cut;
@@ -286,6 +289,8 @@ struct intf_sys_t
 - (IBAction)intfOpenDisc:(id)sender;
 - (IBAction)intfOpenNet:(id)sender;
 
+- (IBAction)showWizard:(id)sender;
+
 - (IBAction)viewAbout:(id)sender;
 - (IBAction)viewPreferences:(id)sender;
 - (IBAction)closeError:(id)sender;
index 58e3e75e3d2f4701cad0bced5ff613c51bb0c3bf..b3bff37f23bd5714ea06cf89cbad9f8f1a725d25 100644 (file)
@@ -38,6 +38,7 @@
 #include "controls.h"
 #include "about.h"
 #include "open.h"
+#include "wizard.h"
 
 /*****************************************************************************
  * Local prototypes.
@@ -296,6 +297,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     o_about = [[VLAboutBox alloc] init];
     o_prefs = nil;
     o_open = [[VLCOpen alloc] init];
+    o_wizard = [[VLCWizard alloc] init];
 
     i_lastShownVolume = -1;
     return _o_sharedMainInstance;
@@ -459,6 +461,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_mi_open_net setTitle: _NS("Open Network...")];
     [o_mi_open_recent setTitle: _NS("Open Recent")];
     [o_mi_open_recent_cm setTitle: _NS("Clear Menu")];
+    [o_mi_open_wizard setTitle: _NS("Wizard...")];
 
     [o_mu_edit setTitle: _NS("Edit")];
     [o_mi_cut setTitle: _NS("Cut")];
@@ -1421,6 +1424,18 @@ static VLCMain *_o_sharedMainInstance = nil;
     }
 }
 
+- (IBAction)showWizard:(id)sender
+{
+    if (!nib_wizard_loaded)
+    {
+        nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
+        [o_wizard initStrings];
+        [o_wizard showWizard];
+    } else {
+        [o_wizard showWizard];
+    }
+}
+
 - (IBAction)viewAbout:(id)sender
 {
     [o_about showPanel];
@@ -1557,12 +1572,13 @@ static VLCMain *_o_sharedMainInstance = nil;
         else
         {
             o_rect.size.height = 500;
-            if ( o_rect.size.width == [o_window minSize].width )
-            {
-                o_rect.size.width = 500;
-            }
-
         }
+        
+        if ( o_rect.size.width == [o_window minSize].width )
+        {
+            o_rect.size.width = 500;
+        }
+        
         o_rect.size.height = (o_size_with_playlist.height > 200) ?
             o_size_with_playlist.height : 500;
         o_rect.origin.x = [o_window frame].origin.x;
@@ -1574,6 +1590,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     {
         /* make small */
         o_rect.size.height = [o_window minSize].height;
+        o_rect.size.width = [o_window minSize].width;
         o_rect.origin.x = [o_window frame].origin.x;
         /* Calculate the position of the lower right corner after resize */
         o_rect.origin.y = [o_window frame].origin.y +
diff --git a/modules/gui/macosx/wizard.h b/modules/gui/macosx/wizard.h
new file mode 100644 (file)
index 0000000..b089550
--- /dev/null
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * wizard.h: MacOS X Streaming Wizard
+ *****************************************************************************
+ * Copyright (C) 2005 VideoLAN
+ * $Id$
+ *
+ * Authors: Felix Kühne <fkuehne@users.sf.net> 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * VLCWizard 
+ *****************************************************************************/
+#import <Cocoa/Cocoa.h>
+
+@interface VLCWizard : NSObject
+{
+    IBOutlet id o_btn_backward;
+    IBOutlet id o_btn_cancel;
+    IBOutlet id o_btn_forward;
+    IBOutlet id o_t1_btn_mrInfo_strmg;
+    IBOutlet id o_t1_btn_mrInfo_trnscd;
+    IBOutlet id o_t1_rdo_streaming;
+    IBOutlet id o_t1_rdo_transcode;
+    IBOutlet id o_t1_txt_notice;
+    IBOutlet id o_t1_txt_text;
+    IBOutlet id o_t1_txt_title;
+    IBOutlet id o_t2_box_prtExtrct;
+    IBOutlet id o_t2_ckb_enblPartExtrct;
+    IBOutlet id o_t2_btn_chooseFile;
+    IBOutlet id o_t2_fld_pathToNewStrm;
+    IBOutlet id o_t2_fld_prtExtrctFrom;
+    IBOutlet id o_t2_fld_prtExtrctTo;
+    IBOutlet id o_t2_rdo_exstPlstItm;
+    IBOutlet id o_t2_rdo_newStrm;
+    IBOutlet id o_t2_tbl_plst;
+    IBOutlet id o_t2_text;
+    IBOutlet id o_t2_title;
+    IBOutlet id o_t2_txt_prtExtrctFrom;
+    IBOutlet id o_t2_txt_prtExtrctTo;
+    IBOutlet id o_t3_box_dest;
+    IBOutlet id o_t3_box_strmgMthd;
+    IBOutlet id o_t3_fld_address;
+    IBOutlet id o_t3_matrix_stmgMhd;
+    IBOutlet id o_t3_txt_destInfo;
+    IBOutlet id o_t3_txt_text;
+    IBOutlet id o_t3_txt_title;
+    IBOutlet id o_t4_box_audio;
+    IBOutlet id o_t4_box_video;
+    IBOutlet id o_t4_ckb_audio;
+    IBOutlet id o_t4_ckb_video;
+    IBOutlet id o_t4_pop_audioBitrate;
+    IBOutlet id o_t4_pop_audioCodec;
+    IBOutlet id o_t4_pop_videoBitrate;
+    IBOutlet id o_t4_pop_videoCodec;
+    IBOutlet id o_t4_text;
+    IBOutlet id o_t4_title;
+    IBOutlet id o_t4_txt_audioBitrate;
+    IBOutlet id o_t4_txt_videoBitrate;
+    IBOutlet id o_t4_txt_audioCodec;
+    IBOutlet id o_t4_txt_videoCodec;
+    IBOutlet id o_t4_txt_hintAudio;
+    IBOutlet id o_t4_txt_hintVideo;
+    IBOutlet id o_t5_matrix_encap;
+    IBOutlet id o_t5_text;
+    IBOutlet id o_t5_title;
+    IBOutlet id o_t6_ckb_sap;
+    IBOutlet id o_t6_fld_sap;
+    IBOutlet id o_t6_fld_ttl;
+    IBOutlet id o_t6_text;
+    IBOutlet id o_t6_title;
+    IBOutlet id o_t6_txt_ttl;
+    IBOutlet id o_t6_btn_mrInfo_ttl;
+    IBOutlet id o_t6_btn_mrInfo_sap;
+    IBOutlet id o_t7_btn_chooseFile;
+    IBOutlet id o_t7_fld_filePath;
+    IBOutlet id o_t7_text;
+    IBOutlet id o_t7_title;
+    IBOutlet id o_t7_txt_saveFileTo;
+    IBOutlet id o_tab_pageHolder;
+    IBOutlet id o_wizard_window;
+}
+- (IBAction)cancelRun:(id)sender;
+- (IBAction)nextTab:(id)sender;
+- (IBAction)prevTab:(id)sender;
+- (IBAction)t1_mrInfo_streaming:(id)sender;
+- (IBAction)t1_mrInfo_transcode:(id)sender;
+- (IBAction)t2_addNewStream:(id)sender;
+- (IBAction)t2_chooseStreamOrPlst:(id)sender;
+- (IBAction)t2_enableExtract:(id)sender;
+- (IBAction)t3_addressEntered:(id)sender;
+- (IBAction)t4_AudCdcChanged:(id)sender;
+- (IBAction)t4_enblAudTrnscd:(id)sender;
+- (IBAction)t4_enblVidTrnscd:(id)sender;
+- (IBAction)t4_VidCdcChanged:(id)sender;
+- (IBAction)t6_enblSapAnnce:(id)sender;
+- (IBAction)t6_mrInfo_ttl:(id)sender;
+- (IBAction)t6_mrInfo_sap:(id)sender;
+- (IBAction)t7_selectTrnscdDestFile:(id)sender;
+
++ (VLCWizard *)sharedInstance;
+- (void)showWizard;
+@end
diff --git a/modules/gui/macosx/wizard.m b/modules/gui/macosx/wizard.m
new file mode 100644 (file)
index 0000000..f0048ce
--- /dev/null
@@ -0,0 +1,319 @@
+/*****************************************************************************
+ * wizard.h: MacOS X Streaming Wizard
+ *****************************************************************************
+ * Copyright (C) 2005 VideoLAN
+ * $Id$
+ *
+ * Authors: Felix Kühne <fkuehne@users.sf.net> 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Note: this code is based upon ../wxwindows/wizard.cpp,
+ *       written by Clément Stenac.
+ *****************************************************************************/ 
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/ 
+#import "wizard.h"
+#import "intf.h"
+
+
+/*****************************************************************************
+ * VLCWizard implementation
+ *****************************************************************************/
+
+@implementation VLCWizard
+
+static VLCWizard *_o_sharedInstance = nil;
+
++ (VLCWizard *)sharedInstance
+{
+    return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
+}
+
+- (id)init 
+{
+    if (_o_sharedInstance) {
+        [self dealloc];
+    } else {
+        _o_sharedInstance = [super init];
+    }
+    
+    return _o_sharedInstance;
+}
+
+- (void)awakeFromNib
+{
+    /* some minor cleanup */
+    [o_t2_tbl_plst setEnabled:NO];
+
+    /* FIXME: make the both arrays global */
+
+    /* add audio-codecs for transcoding */
+    NSArray * audioBitratesArray;
+    audioBitratesArray = [NSArray arrayWithObjects: @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
+    [o_t4_pop_audioBitrate removeAllItems];
+    [o_t4_pop_audioBitrate addItemsWithTitles: audioBitratesArray];
+    [o_t4_pop_audioBitrate selectItemWithTitle: @"192"];
+    
+    /* add video-codecs for transcoding */
+    NSArray * videoBitratesArray;
+    videoBitratesArray = [NSArray arrayWithObjects: @"3072", @"2048", @"1024", @"768", @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
+    [o_t4_pop_videoBitrate removeAllItems];
+    [o_t4_pop_videoBitrate addItemsWithTitles: videoBitratesArray];
+    [o_t4_pop_videoBitrate selectItemWithTitle: @"1024"];
+    
+    /* FIXME: fill the codec-popups as well */
+}
+
+- (void)showWizard
+{
+    /* just present the window to the user */
+    /* we might need a method to reset the window first */
+    [o_tab_pageHolder selectFirstTabViewItem:self];
+    
+    [o_wizard_window center];
+    [o_wizard_window displayIfNeeded];
+    [o_wizard_window makeKeyAndOrderFront:nil];
+}
+
+- (void)initStrings
+{
+    /* localise all strings to the users lang */
+    /* method is called from intf.m (in method openWizard) */
+    
+    /* general items */
+    [o_btn_backward setTitle: _NS("< Back")];
+    [o_btn_cancel setTitle: _NS("Cancel")];
+    [o_btn_forward setTitle: _NS("Next >")];
+    [o_wizard_window setTitle: _NS("Streaming/Transcoding Wizard")];
+    
+    /* page one ("Hello") */
+    [o_t1_txt_title setStringValue: _NS("Streaming/Transcoding Wizard")];
+    [o_t1_txt_text setStringValue: _NS("This wizard helps you to stream, transcode or save a stream")];
+    [o_t1_btn_mrInfo_strmg setTitle: _NS("More Info")];
+    [o_t1_btn_mrInfo_trnscd setTitle: _NS("More Info")];
+    [o_t1_txt_notice setStringValue: _NS("This wizard only gives access to a small subset of VLC's streaming and transcoding capabilities. Use the Open and Stream Output dialogs to get all of them")];
+    [o_t1_rdo_streaming setTitle: _NS("Stream to network")];
+    [o_t1_rdo_transcode setTitle: _NS("Transcode/Save to file")];
+    
+    /* page two ("Input") */
+    [o_t2_title setStringValue: _NS("Choose input")];
+    [o_t2_text setStringValue: _NS("Choose here your input stream")];
+    [o_t2_rdo_newStrm setTitle: _NS("Select a stream")];
+    [o_t2_rdo_exstPlstItm setTitle: _NS("Existing playlist item")];
+    [o_t2_btn_chooseFile setTitle: _NS("Choose...")];
+    [[[o_t2_tbl_plst tableColumnWithIdentifier:@"name"] headerCell] setStringValue: _NS("Name")];
+    [o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
+    [o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
+    [o_t2_txt_prtExtrctFrom setStringValue: _NS("From")];
+    [o_t2_txt_prtExtrctTo setStringValue: _NS("To")];
+    
+    /* page three ("Streaming 1") */
+    [o_t3_txt_title setStringValue: _NS("Streaming")];
+    [o_t3_txt_text setStringValue: _NS("In this page, you will select how your input stream will be sent.")];
+    [o_t3_box_dest setTitle: _NS("Destination")];
+    [o_t3_box_strmgMthd setTitle: _NS("Streaming method")];
+    [o_t3_txt_destInfo setStringValue: _NS("Enter the address of the computer to stream to")];
+    [[o_t3_matrix_stmgMhd cellAtRow:1 column:0] setTitle: _NS("UDP Unicast")];
+    [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setTitle: _NS("UDP Multicast")];
+    
+    /* page four ("Transcode 1") */
+    [o_t4_title setStringValue: _NS("Transcode")];
+    [o_t4_text setStringValue: _NS("If you want to change the compression format of the audio or video tracks, fill in this page. (If you only want to change the container format, proceed to next page).")];
+    [o_t4_box_audio setTitle: _NS("Audio")];
+    [o_t4_box_video setTitle: _NS("Video")];
+    [o_t4_ckb_audio setTitle: _NS("Transcode audio")];
+    [o_t4_ckb_video setTitle: _NS("Transcode video")];
+    [o_t4_txt_videoBitrate setStringValue: _NS("Bitrate (kb/s)")];
+    [o_t4_txt_videoCodec setStringValue: _NS("Codec")];
+    [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio and you want to " \
+                         "transcode it, enable this")];
+    [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video and you want to " \
+                         "transcode it, enable this")];
+    
+    /* page five ("Encap") */
+    [o_t5_title setStringValue: _NS("Encapsulation format")];
+    [o_t5_text setStringValue: _NS("In this page, you will select how the stream will be "\
+                     "encapsulated. Depending on the choices you made, all "\
+                     "formats won't be available.")];
+    
+    /* page six ("Streaming 2") */
+    [o_t6_title setStringValue: _NS("Additional streaming options")];
+    [o_t6_text setStringValue: _NS("In this page, you will define a few " \
+                              "additional parameters for your stream.")];
+    [o_t6_txt_ttl setStringValue: _NS("Time-To-Live (TTL)")];
+    [o_t6_btn_mrInfo_ttl setTitle: _NS("More Info")];
+    [o_t6_ckb_sap setTitle: _NS("SAP Announce")];
+    [o_t6_btn_mrInfo_sap setTitle: _NS("More Info")];
+     
+    /* page seven ("Transcode 2") */
+    [o_t7_title setStringValue: _NS("Additional transcode options")];
+    [o_t7_text setStringValue: _NS("In this page, you will define a few " \
+                              "additionnal parameters for your transcoding.")];
+    [o_t7_txt_saveFileTo setStringValue: _NS("Select the file to save to")];
+    [o_t7_btn_chooseFile setTitle: _NS("Choose...")];
+}
+
+- (IBAction)cancelRun:(id)sender
+{
+    [o_wizard_window close];
+}
+
+- (IBAction)nextTab:(id)sender
+{
+    /* only a stub atm; needs to be implemented correctly later on */
+    [o_tab_pageHolder selectNextTabViewItem:self];
+}
+
+- (IBAction)prevTab:(id)sender
+{
+    /* only a stub atm; needs to be implemented correctly later on */
+    [o_tab_pageHolder selectPreviousTabViewItem:self];
+}
+
+- (IBAction)t1_mrInfo_streaming:(id)sender
+{
+    /* show a simple notify sheet for the help */
+}
+
+- (IBAction)t1_mrInfo_transcode:(id)sender
+{
+    /* show a simple notify sheet for the help */
+}
+
+- (IBAction)t2_addNewStream:(id)sender
+{
+    NSOpenPanel * openPanel = [NSOpenPanel openPanel];
+    SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
+    [openPanel beginSheetForDirectory:@"~" file:nil types:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
+}
+
+- (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
+{
+    if (returnCode == NSOKButton)
+    {
+        [o_t2_fld_pathToNewStrm setStringValue:[sheet filename]];
+        /* FIXME: store path in a global variable */
+    }
+}
+
+- (IBAction)t2_chooseStreamOrPlst:(id)sender
+{
+    /* enable and disable the respective items depending on user's choice */
+    /* TODO */
+}
+
+- (IBAction)t2_enableExtract:(id)sender
+{
+    /* enable/disable the respective items */
+    if([o_t2_ckb_enblPartExtrct state] == NSOnState)
+    {
+        [o_t2_fld_prtExtrctFrom setEnabled:YES];
+        [o_t2_fld_prtExtrctTo setEnabled:YES];
+    } else {
+        [o_t2_fld_prtExtrctFrom setEnabled:NO];
+        [o_t2_fld_prtExtrctTo setEnabled:NO];
+    }
+}
+
+- (IBAction)t3_addressEntered:(id)sender
+{
+    /* check whether the entered address is valid */
+}
+
+- (IBAction)t4_AudCdcChanged:(id)sender
+{
+    /* update codec info */
+}
+
+- (IBAction)t4_enblAudTrnscd:(id)sender
+{
+    /* enable/disable the respective items */
+    if([o_t4_ckb_audio state] == NSOnState)
+    {
+        [o_t4_pop_audioCodec setEnabled:YES];
+        
+        [o_t4_pop_audioBitrate setEnabled:YES];
+    } else {
+        [o_t4_pop_audioCodec setEnabled:NO];
+        [o_t4_pop_audioBitrate setEnabled:NO];
+    }
+}
+
+- (IBAction)t4_enblVidTrnscd:(id)sender
+{
+    /* enable/disable the respective items */
+    if([o_t4_ckb_video state] == NSOnState)
+    {
+        [o_t4_pop_videoCodec setEnabled:YES];
+        [o_t4_pop_videoBitrate setEnabled:YES];
+    } else {
+        [o_t4_pop_videoCodec setEnabled:NO];
+        [o_t4_pop_videoBitrate setEnabled:NO];
+    }
+}
+
+- (IBAction)t4_VidCdcChanged:(id)sender
+{
+    /* update codec info */
+}
+
+- (IBAction)t6_enblSapAnnce:(id)sender
+{
+    /* enable/disable input fld */
+    if([o_t6_ckb_sap state] == NSOnState)
+    {
+        [o_t6_fld_sap setEnabled:YES];
+    } else {
+        [o_t6_fld_sap setEnabled:NO];
+        [o_t6_fld_sap setStringValue:@""];
+    }
+}
+
+- (IBAction)t6_mrInfo_ttl:(id)sender
+{
+    /* show a simple notify sheet for the help */
+}
+
+- (IBAction)t6_mrInfo_sap:(id)sender
+{
+    /* show a simple notify sheet for the help */
+}
+
+- (IBAction)t7_selectTrnscdDestFile:(id)sender
+{
+    /* provide a save-to-dialogue, so the user can choose a location for his/her new file */
+    NSSavePanel * savePanel = [NSSavePanel savePanel];
+    SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
+    [savePanel beginSheetForDirectory:@"~" file:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
+    /* FIXME: insert a suffix in file depending on the chosen encap-format */
+}
+
+- (void)t7_getTrnscdDestFile: (NSSavePanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
+{
+    if (returnCode == NSOKButton)
+    {
+        [o_t7_fld_filePath setStringValue:[sheet filename]];
+        /* FIXME: store path in a global variable and add a suffix depending on the chosen encap-format, if needed */
+    }
+}
+
+@end