Changeset 619

Show
Ignore:
Timestamp:
04/14/09 21:24:46 (7 months ago)
Author:
ashot
Message:

fix reset, add menu options for re-indexing and picking which folder to index

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/uploadr/MacUploadr.app/Contents/Resources/chrome/content/uploadr/main.xul

    r602 r619  
    9090  <toolbox id="menu"> 
    9191    <menubar> 
    92       <menu label="&menu.upload;" accesskey="U"> 
     92      <menu label="Desktop" accesskey="D"> 
    9393        <menupopup id="menu_UploadPopup"> 
    94           <menuitem label="&menu.upload.add;" key="key_add" accesskey="A" oncommand="photos.add_dialog();" /> 
    95           <menuitem id="menu_upload" label="&menu.upload;" key="key_upload" accesskey="U" oncommand="photos.upload();" /> 
    96           <menuitem label="Clear Index" accesskey="X" oncommand="photos.removeAll();photos.load();ui.init()" /> 
     94          <menuitem label="Choose Folder to Index" key="key_add" accesskey="C" oncommand="photos.add_dialog();" /> 
     95          <menuitem label="Re-Index" accesskey="R" oncommand="photos.removeAll();" /> 
    9796          <menuitem id="menu_FileQuitItem" label="&menu.upload.exit;" key="key_quit" accesskey="Q" oncommand="exit();" /> 
    9897        </menupopup> 
  • trunk/uploadr/MacUploadr.app/Contents/Resources/chrome/content/uploadr/photos.js

    r615 r619  
    9595                      
    9696        index_some_photos: function(){ 
    97                 //photos.alert('start..'); 
    9897                threads.indexer.dispatch(new IndexDrive(), threads.worker.DISPATCH_NORMAL); 
    9998        }, 
     
    118117                } 
    119118 
    120                 // Open the file picker 
     119                // Open the directory picker 
    121120                var fp = Cc['@mozilla.org/filepicker;1'] 
    122121                        .createInstance(Ci.nsIFilePicker); 
     
    127126                fp.displayDirectory = def; 
    128127                var res = fp.show(); 
     128                 
    129129                if (Ci.nsIFilePicker.returnOK == res) { 
    130                         photos.removeAll();photos.load(fp.file.path);ui.init(); 
     130                        photos.file = Cc['@mozilla.org/file/local;1'] 
     131                                .createInstance(Ci.nsILocalFile); 
     132                        photos.file.initWithPath(fp.file.path); 
     133                        logStringMessage("!!" + photos.file.path); 
     134                         
     135                        photos.removeAll(); 
     136                         
     137                        photos.index_some_photos(); 
     138                         
    131139                        nsPreferences.setUnicharPref('flickr.add_directory', fp.file.path); 
    132140                } 
     
    350358                 
    351359                 
    352                 if(to_flash.length > 0) 
     360                if(to_flash.length > 0){ 
    353361                        photos.call_swf('add_files', [to_flash]); 
     362                } 
    354363                 
    355364                for(var i=0;i<to_flash.length;i++){ 
     
    930939 
    931940        // Load saved metadata 
    932         load: function(path){ 
    933                  
    934                 var obj = !path ? file.read('photos.json') : {}
     941        load: function(){ 
     942                 
     943                var obj = file.read('photos.json')
    935944                 
    936945                if(obj.indexed_paths) 
    937946                    photos.indexed_paths = obj.indexed_paths; 
     947                else 
     948                    photos.indexed_paths = {}; 
    938949             
    939             if(path) { 
    940                 photos.file = Cc['@mozilla.org/file/local;1'] 
    941                                 .createInstance(Ci.nsILocalFile); 
    942                         photos.file.initWithPath(path); 
    943             } 
    944950                 
    945951                if(obj.list) 
     
    10071013    // this is desperate move when the uploadr is in unusable state 
    10081014    removeAll: function() { 
     1015                        
    10091016        //if (document.getElementById('t_clear').className == 'disabled_button') 
    10101017            //return; 
    10111018        //document.getElementById('t_clear').className = 'disabled_button'; 
     1019                        
    10121020        photos.thumb_cancel = true; 
    10131021        if (conf.console.thumb) { 
    1014                                logStringMessage('clearing'); 
    1015                        
     1022                logStringMessage('clearing'); 
     1023       
    10161024        photos.list = []; 
    10171025        photos.indexed_paths = {}, 
     1026        photos.added_paths = {}, 
     1027        photos.indexed_dirs = file.get_excluded_directories(); 
     1028        photos.last_dir = null; 
     1029        photos.last_file = null; 
     1030        photos.indexed_contents = {}, 
     1031        photos.to_thumb = []; 
    10181032        photos.selected = []; 
    10191033        photos.count = 0; 
     
    10211035        photos.errors = 0; 
    10221036        photos.batch_size = 0; 
     1037        photos.waiting_to_thumb = 0; 
    10231038        photos.video_batch_size = 0; 
    10241039        _block_sort = _block_remove = _block_normalize = _block_exit = 0; 
     
    10361051        */ 
    10371052        ui.bandwidth_updated(); 
     1053        photos.thumb_cancel = false; 
    10381054        //meta.disable(); 
    10391055        //buttons.upload.disable(); 
  • trunk/uploadr/MacUploadr.app/Contents/Resources/chrome/content/uploadr/threads.js

    r615 r619  
    180180                        var thumb = this.result.split('###'); 
    181181 
     182                        if(!photos.list[this.id])//cancelled 
     183                                return; 
    182184                        // Get this photo from the DOM and remove its loading class 
    183185                         
     
    247249                                //photos.list[this.id].hash = file.compute_file_hash(thumbPath); 
    248250                                if(photos.list[this.id].thumb_width < 400){ 
     251                                        logStringMessage(this.id); 
    249252                                        photos.call_swf('thumbnail_done', [photos.list[this.id], thumbPath]); 
    250253                                } 
     
    655658         
    656659}; 
     660 
    657661IndexDrive.prototype = { 
    658662        paths:[], 
     
    662666                 
    663667                 
     668                 
     669                         
    664670                if(!photos.file){ 
    665671                        path = Cc['@mozilla.org/file/directory_service;1'] 
     
    681687                //if(photos.last_dir) 
    682688                        //photos.file = photos.last_dir; 
    683  
     689                 
    684690                this.paths = []; 
    685691                this.short_circuit = false; 
     
    966972}; 
    967973 
    968  
  • trunk/uploadr/flash/src/Model.as

    r602 r619  
    1414        public class Model{ 
    1515         
     16         
    1617                public var current_tags:Object; 
    1718                public var user:Object; 
     
    3637                 
    3738                public var current_id:String; 
    38                 public var current:Array
     39                public var current:Array = new Array()
    3940                public var current_by_id:Object; 
    4041                 
     
    5960                public var initialized:Boolean; 
    6061                 
    61                  
    62                  
    6362                public var selected:Array; 
    6463                public var selection_by_id:Object = {}; 
    6564                 
    66                 private var views:Array
     65                private var views:Array = new Array()
    6766                private var timer:Timer; 
    6867                //private var api:FlickrAPI; 
     
    7069                private var look_larger; 
    7170                 
    72                 public var tag_sections:Array
     71                public var tag_sections:Array = new Array()
    7372                 
    7473                 
     
    7978                 
    8079                public function Model(){ 
    81                          
    82                         this.initVars(); 
    83                          
    84                          
    85                          
    8680                         
    8781                        this.mode = "date"; 
     
    10094                } 
    10195                 
    102                 private function initVars(){ 
    103                         this.views = new Array(); 
    104                         this.tag_sections = new Array(); 
    105                 } 
    106                  
    10796                public function reset(){ 
    108                         this.initVars(); 
    10997                        this.sets_by_id = new Object(); 
    11098                        this.tags_by_id = new Object(); 
     
    113101                        this.current_by_id = new Object(); 
    114102                        this.current_id = null; 
    115                         this.current = null; 
     103                        this.current = new Array(); 
     104                        this.tag_sections = new Array(); 
    116105                        this.set_data = new Array(); 
    117106                        this.tag_data = new Array(); 
     
    124113                        this.updateSets(); 
    125114                        this.updateList(); 
     115                        this.dispatch("ListChanged"); 
    126116                        this.refreshMode(); 
    127                         this.dispatch("ListChanged"); 
    128117                        this.dispatch("CurrentChanged"); 
     118                        this.dispatch("Reset"); 
    129119                } 
    130120                 
     
    462452                        this.current_tags = new Object(); 
    463453                         
    464                         //this.updateDatesTags(); 
     454                        this.updateDatesTags(); 
    465455                                 
    466456                        //this.updateCurrentById(); 
     
    476466                        for(var i=0; i < this.current.length; i++){ 
    477467                                if(this.current[i].tags){ 
    478                                                var ts:Array = this.current[i].tags.split(" "); 
     468                                        var ts:Array = this.current[i].tags.split(" "); 
    479469                                        for(var k=0; k<ts.length;k++){ 
    480470                                                if(!this.current_tags[ts[k]]) 
  • trunk/uploadr/flash/src/widget/Grid.as

    r602 r619  
    212212                } 
    213213 
     214                public function clear(){ 
     215                        this.removed_items = {}; 
     216                } 
     217                 
    214218                public function addItem(p:Object, no_refresh=false){ 
    215219                        if(!this.removed_items[p.id]){ 
  • trunk/uploadr/flash/src/widget/PhotoGrid.as

    r602 r619  
    2727                private function refresh_progress(){ 
    2828                        for(var j in this.grid.items){ 
    29                                 if(this.m.all[j].progress >=0) 
     29                                if(this.m.all[j] && this.m.all[j].progress >=0) 
    3030                                        this.grid.items[j].progress = this.m.all[j].progress; 
    3131                        } 
     
    4040                        this.grid.refresh(); 
    4141                        this.grid.scroll_bar.refresh(); 
     42                } 
     43                 
     44                public function m_Reset(){ 
     45                        this.grid.clear(); 
    4246                } 
    4347