function varargout = finalInstall(varargin)
% FinalInstall
%   FinalInstall displays information about the the installation of IMPACT

%   Project: IMPACT
%   Title of Code: FinalInstall
%   Relevant additional documentation:
%   Developer: Carlos Gonzalez
%   External Dependencies: NA
%
%   Disclaimer
%   CAUTION: It is strongly recommended that changes to this code
%   should be avoided without first consulting with authors.
%-----------

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @finalInstall_OpeningFcn, ...
                   'gui_OutputFcn',  @finalInstall_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before finalInstall is made visible.
function finalInstall_OpeningFcn(hObject, eventdata, handles, varargin)
% Load mls icon
warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
jframe=get(gcf,'javaframe');
logo = which('icon.png');
jIcon=javax.swing.ImageIcon(logo);
jframe.setFigureIcon(jIcon);
warning('on','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');

% Errors ??   
if ~isempty(varargin) && numel(varargin)>1
    if isnumeric(varargin{1})
        if varargin{1}==0 % neither errors nor warnings
            set(handles.text_message,'string','The IMPACT toolbox version 1.0 has been installed successfully. Please restart MATLAB');
            set(handles.listbox_errors,'Visible','off');
        elseif varargin{1}==1 % only warnings
            if iscell(varargin{2}) && ~isempty(varargin{2})
                set(handles.text_message,'string','There were some warnings during the installation');
                set(handles.listbox_errors,'string',varargin{2});
            end
        else
            set(handles.text_message,'string','There were some errors during the installation, please contact SgurrControl');
            set(handles.listbox_errors,'string',[varargin{2},varargin{3}]);
        end
    end
end

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes finalInstall wait for user response (see UIRESUME)
% uiwait(handles.figErrInstallation);


% --- Outputs from this function are returned to the command line.
function varargout = finalInstall_OutputFcn(hObject, eventdata, handles) 
% Get default command line output from handles structure
varargout{1} = [];


% --- Executes on selection change in listbox_errors.
function listbox_errors_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function listbox_errors_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton_close.
function pushbutton_close_Callback(hObject, eventdata, handles)
close(handles.figErrInstallation)
