Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
progressui_osx.mm File Reference
#import <Cocoa/Cocoa.h>
#include <stdio.h>
#include <unistd.h>
#include "progressui.h"
#include "readstrings.h"
#include "errors.h"

Go to the source code of this file.

Classes

class  UpdaterUI

Defines

#define TIMER_INTERVAL   0.2

Functions

int InitProgressUI (int *pargc, char ***pargv)
int ShowProgressUI ()
void QuitProgressUI ()
void UpdateProgressUI (float progress)

Variables

static float sProgressVal
static BOOL sQuit = FALSE
static StringTable sLabels
static const char * sProgramPath

Define Documentation

Definition at line 47 of file progressui_osx.mm.


Function Documentation

int InitProgressUI ( int pargc,
char ***  pargv 
)

Definition at line 113 of file progressui_osx.mm.

{
  sProgramPath = (*pargv)[0];
  
  return 0;
}

Definition at line 145 of file progressui_osx.mm.

{
  sQuit = TRUE;
}

Definition at line 121 of file progressui_osx.mm.

{
  // Only show the Progress UI if the process is taking significant time.
  // Here we measure significant time as taking more than one second.
  
  usleep(500000);
  
  if (sQuit || sProgressVal > 50.0f)
    return 0;

  char path[PATH_MAX];
  snprintf(path, sizeof(path), "%s.ini", sProgramPath);
  if (ReadStrings(path, &sLabels) != OK)
    return -1;
  
  [NSApplication sharedApplication];
  [NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
  [NSApp run];

  return 0;
}

Here is the call graph for this function:

void UpdateProgressUI ( float  progress)

Definition at line 152 of file progressui_osx.mm.

{
  sProgressVal = progress;  // 32-bit writes are atomic
}

Variable Documentation

StringTable sLabels [static]

Definition at line 51 of file progressui_osx.mm.

const char* sProgramPath [static]

Definition at line 52 of file progressui_osx.mm.

float sProgressVal [static]

Definition at line 49 of file progressui_osx.mm.

BOOL sQuit = FALSE [static]

Definition at line 50 of file progressui_osx.mm.