Changeset 178


Ignore:
Timestamp:
Mar 27, 2018, 11:07:44 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Examples moved to subdirectory Examples.
  • Added: Support for override of default project file opened on first application start.
  • Modified: Fixed displaying of command line help.
Location:
trunk
Files:
1 added
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Install/deb/debian/rules

    r156 r178  
    2222        install -m 755 Languages/UJobProgressView.cs.po $(ROOT)/usr/share/AcronymDecoder/languages
    2323        install -d -m 755 $(ROOT)/usr/share/AcronymDecoder/Examples
    24         install -m 755 "Example acronyms.adp" $(ROOT)/usr/share/AcronymDecoder/Examples
     24        @install -D -m 644 Examples/* $(ROOT)/usr/share/AcronymDecoder/Examples || true
    2525        install -d -m 755 $(ROOT)/usr/share/applications
    2626        install -m 755 Install/deb/AcronymDecoder.desktop $(ROOT)/usr/share/applications
  • trunk/Install/win

    • Property svn:ignore set to
      *.exe
  • trunk/Install/win/AcronymDecoder.iss

    r172 r178  
    7474Source: "{#MyAppSubDir}\libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion
    7575Source: "{#MyAppSubDir}\ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion
    76 Source: "{#MyAppSubDir}\Example acronyms.adp"; DestDir: "{app}"; Flags: ignoreversion
     76Source: "{#MyAppSubDir}\Examples"; DestDir: "{app}\Examples"; Flags: ignoreversion
    7777Source: "{#MyAppSubDir}\Release notes.txt"; DestDir: "{app}"; Flags: ignoreversion
    7878Source: "{#MyAppSubDir}\Languages\*.po"; DestDir: "{app}\Languages"; Flags: ignoreversion
  • trunk/Languages/AcronymDecoder.cs.po

    r176 r178  
    752752msgstr "Špatný formát souboru"
    753753
     754#: ucore.soptions
     755msgid "options"
     756msgstr "volby"
     757
     758#: ucore.sprojectfile
     759msgid "project file"
     760msgstr "projektový soubor"
     761
     762#: ucore.sshowthishelp
     763msgid "Show this help"
     764msgstr "Ukázat tuto nápovědu"
     765
     766#: ucore.sstartminimizedintray
     767msgid "Start minimized in system tray"
     768msgstr "Startovat zmenšený do oznamovací oblasti"
     769
    754770#: uformabout.slicense
    755771msgid "License"
  • trunk/Languages/AcronymDecoder.po

    r176 r178  
    742742msgstr ""
    743743
     744#: ucore.soptions
     745msgid "options"
     746msgstr ""
     747
     748#: ucore.sprojectfile
     749msgid "project file"
     750msgstr ""
     751
     752#: ucore.sshowthishelp
     753msgid "Show this help"
     754msgstr ""
     755
     756#: ucore.sstartminimizedintray
     757msgid "Start minimized in system tray"
     758msgstr ""
     759
    744760#: uformabout.slicense
    745761msgid "License"
  • trunk/UCore.pas

    r174 r178  
    4040    procedure SetAlwaysOnTop(AValue: Boolean);
    4141    function FindFirstNonOption: string;
     42    procedure WriteLnConsole(Text: string);
    4243  public
    4344    AcronymDb: TAcronymDb;
     
    6970const
    7071  ExampleFile = 'Example acronyms.adp';
     72  DefaultOverrideFile = 'Default.txt';
     73
     74resourcestring
     75  SStartMinimizedInTray = 'Start minimized in system tray';
     76  SShowThisHelp = 'Show this help';
     77  SOptions = 'options';
     78  SProjectFile = 'project file';
    7179
    7280
     
    108116end;
    109117
     118procedure TCore.WriteLnConsole(Text: string);
     119begin
     120  {$IFDEF WINDOWS}
     121  if not IsConsole then begin
     122    IsConsole := True;
     123    SysInitStdIO;
     124  end;
     125  {$ENDIF}
     126  WriteLn(Text);
     127end;
     128
    110129procedure TCore.Initialize;
    111130var
    112131  FileNameOption: string;
    113132  ExampleFileName: string;
     133  DefaultOverrideFileName: string;
     134  ExamplesDir: string;
     135  Lines: TStringList;
     136  Output: string;
    114137begin
    115138  if not InitializeStarted then begin
     
    117140    LoadConfig;
    118141
    119     {$IFDEF 0}
    120142    if Application.HasOption('h', 'help') then begin
    121       WriteLn('AcronymDecoder <project file>');
    122       WriteLn('  -t    --tray   Start minimized in system tray');
    123       WriteLn('  -h    --help  Show this help');
     143      Output := 'AcronymDecoder [' + SOptions + '] <' + SProjectFile + '>' + LineEnding;
     144      Output := Output + '  -t    --tray   ' + SStartMinimizedInTray + LineEnding;
     145      Output := Output + '  -h    --help   ' + SShowThisHelp + LineEnding;
     146      WriteLnConsole(Output);
    124147      Application.Terminate;
    125148      Exit;
    126149    end;
    127     {$ENDIF}
    128150
    129151    if Application.HasOption('t', 'tray') then begin
     
    131153    end;
    132154
    133     ExampleFileName := ExtractFileDir(Application.ExeName) + DirectorySeparator + ExampleFile;
     155    ExamplesDir := ExtractFileDir(Application.ExeName) + DirectorySeparator +
     156      'Examples';
     157    {$IFDEF Linux}
     158    // If installed in Linux system then use installation directory for po files
     159    if Application.ExeName = '/usr/bin/' + ExtractFileNameOnly(Application.ExeName) then
     160      ExamplesDir := '/usr/share/' + ExtractFileNameOnly(Application.ExeName) +
     161        DirectorySeparator + 'Examples';
     162    {$ENDIF}
     163    ExampleFileName := ExamplesDir + DirectorySeparator + ExampleFile;
     164
     165    // To override default project file put new project name to default file
     166    DefaultOverrideFileName := ExamplesDir + DirectorySeparator + DefaultOverrideFile;
     167    if FileExists(DefaultOverrideFileName) then begin
     168      Lines := TStringList.Create;
     169      Lines.LoadFromFile(DefaultOverrideFileName);
     170      if Lines.Count > 0 then
     171        ExampleFileName := ExamplesDir + DirectorySeparator + Lines[0];
     172      Lines.Free;
     173    end;
     174
    134175    FileNameOption := FindFirstNonOption;
    135176    if FileNameOption <> '' then begin
     
    144185    if FileExists(ExampleFileName) then begin
    145186      // Open default database with examples if no item is in recent openned history
    146       FileNameOption := ExtractFileDir(Application.ExeName) + DirectorySeparator + ExampleFile;
    147       {$IFDEF Linux}
    148       // If installed in Linux system then use installation directory for po files
    149       if Application.ExeName = '/usr/bin/' + ExtractFileNameOnly(Application.ExeName) then
    150         FileNameOption := '/usr/share/' + ExtractFileNameOnly(Application.ExeName) + '/Examples/' + ExampleFile;
    151       {$ENDIF}
    152       FormMain.ProjectOpen(FileNameOption);
     187      FormMain.ProjectOpen(ExampleFileName);
    153188    end else begin
    154189      // Create empty file
Note: See TracChangeset for help on using the changeset viewer.