Ignore:
Timestamp:
04/13/07 19:28:10 (5 years ago)
Author:
jlee
Message:

New ProgressDialog?; new directory handling; DnD still needs to be fixed now; other job types still need work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/thestaticvoid/iriverter/Converter.java

    r157 r158  
     1/* 
     2 * Converter.java 
     3 * Copyright (C) 2005-2007 James Lee 
     4 * 
     5 * This program is free software; you can redistribute it and/or 
     6 * modify it under the terms of the GNU General Public License 
     7 * as published by the Free Software Foundation; either version 2 
     8 * of the License, or (at your option) any later version. 
     9 *  
     10 * This program is distributed in the hope that it will be useful, 
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13 * GNU General Public License for more details. 
     14 *  
     15 * You should have received a copy of the GNU General Public License 
     16 * along with this program; if not, write to the Free Software 
     17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
     18 * 02110-1301, USA. 
     19 *  
     20 * $Id$ 
     21 */ 
    122package org.thestaticvoid.iriverter; 
     23 
     24import java.util.*; 
    225 
    326public class Converter extends Thread { 
    427        private Job[] jobs; 
    528        private ProgressDialogInfo progressDialogInfo; 
    6         private MencoderCommand currentCommand; 
     29        private DoSomeShit currentCommand; 
     30        private List failures; 
    731         
    832        public Converter(Job[] jobs, ProgressDialogInfo progressDialogInfo) { 
    933                this.jobs = jobs; 
    1034                this.progressDialogInfo = progressDialogInfo; 
     35                failures = new ArrayList(); 
    1136        } 
    1237         
    1338        public void run() { 
    1439                for (int i = 0; i < jobs.length; i++) { 
    15                         MencoderCommand[] mencoderCommands = jobs[i].getMencoderCommands(); 
    16                         for (int j = 0; j < mencoderCommands.length; j++) { 
    17                                 currentCommand = mencoderCommands[j]; 
    18                                 currentCommand.run(progressDialogInfo); 
     40                        progressDialogInfo.setCurrentJob(i + 1); 
     41                        progressDialogInfo.setJobDescription(jobs[i].getDescription()); 
     42                         
     43                        try { 
     44                                DoSomeShit[] shitToDo = jobs[i].getShitToDo(); 
     45                                for (int j = 0; j < shitToDo.length; j++) { 
     46                                        currentCommand = shitToDo[j]; 
     47                                        currentCommand.run(progressDialogInfo); 
     48                                } 
     49                        } catch (FailedToDoSomeShit failed) { 
     50                                failures.add(failed.getMessage()); 
    1951                        } 
    2052                } 
     
    2456                currentCommand.cancel(); 
    2557        } 
     58         
     59        public String[] getFailures() { 
     60                return (String[]) failures.toArray(new String[]{}); 
     61        } 
    2662} 
Note: See TracChangeset for help on using the changeset viewer.