Changeset 154


Ignore:
Timestamp:
Jan 14, 2025, 12:35:35 PM (7 days ago)
Author:
chronos
Message:

Merged revision(s) 152-153 from trunk:

  • Modified: Improved flatpak packaging.
  • Fixed: Detection of languages directory on Linux.
  • Fixed: Top left menu alignment.
  • Modified: Improved debian control script.
Files:
2 deleted
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • tags/1.4.0

  • tags/1.4.0/Forms/UFormMain.lfm

    r137 r154  
    1515  OnKeyUp = FormKeyUp
    1616  OnShow = FormShow
    17   LCLVersion = '2.2.6.0'
     17  LCLVersion = '3.6.0.0'
    1818  object PaintBox1: TPaintBox
    1919    Left = 0
  • tags/1.4.0/Forms/UFormMain.pas

    r134 r154  
    6363
    6464procedure TFormMain.FormCreate(Sender: TObject);
     65{$IFDEF UNIX}
    6566const
    66   UnixLanguagesDir = '/usr/share/TransLines/languages';
    67 begin
     67  UnixLanguagesDir = '../share/TransLines';
     68var
     69  NewDir: string;
     70{$ENDIF}
     71const
     72  LanguagesDirName = 'Languages';
     73var
     74  BaseDir: string;
     75begin
     76  BaseDir := ExcludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)));
     77  Core.Translator1.POFilesFolder := BaseDir + DirectorySeparator + LanguagesDirName;
     78
    6879  {$IFDEF UNIX}
    6980  // If installed in UNIX system then use installation directory for po files
    70   if not DirectoryExists(Core.Translator1.POFilesFolder) and DirectoryExists(UnixLanguagesDir) then
    71     Core.Translator1.POFilesFolder := UnixLanguagesDir;
     81  NewDir := BaseDir + DirectorySeparator + UnixLanguagesDir + DirectorySeparator +
     82    LanguagesDirName;
     83  if not DirectoryExists(Core.Translator1.POFilesFolder) and DirectoryExists(NewDir) then
     84    Core.Translator1.POFilesFolder := NewDir;
    7285  {$ENDIF}
    7386
  • tags/1.4.0/Install/deb/TransLines.desktop

    r125 r154  
    77Terminal=false
    88Type=Application
    9 Categories=GNOME;Application;Game;
     9Categories=Game;Simulation
    1010StartupNotify=true
     11Keywords=metro;subway;transport;map;transit;simulation;passengers
  • tags/1.4.0/Install/deb/debian/rules

    r125 r154  
    1414
    1515override_dh_auto_install:
    16         install -d -m 755 $(ROOT)/usr/bin
    17         install -s -m 755 TransLines $(ROOT)/usr/bin
    18         install -d -m 755 $(ROOT)/usr/share/applications
    19         install -m 755 Install/deb/TransLines.desktop $(ROOT)/usr/share/applications
    20         install -d -m 755 $(ROOT)/usr/share/pixmaps
    21         install -m 644 Images/64x64/TransLines.png $(ROOT)/usr/share/pixmaps
    22         install -d -m 755 $(ROOT)/usr/share/TransLines/languages
    23         install -m 755 Languages/*.pot $(ROOT)/usr/share/TransLines/languages
    24         install -m 755 Languages/*.po $(ROOT)/usr/share/TransLines/languages
     16        install -Dm755 TransLines -t $(ROOT)/usr/bin
     17        install -Dm644 Install/deb/TransLines.desktop -t $(ROOT)/usr/share/applications
     18        install -Dm644 Images/64x64/TransLines.png -t $(ROOT)/usr/share/pixmaps
     19        install -Dm644 Languages/*.po -t $(ROOT)/usr/share/TransLines/Languages
     20        install -Dm644 Packages/Common/Languages/*.po -t $(ROOT)/usr/share/TransLines/Languages
    2521
    2622%:
  • tags/1.4.0/Install/flatpak/build.sh

    r146 r154  
    77
    88# Install dependencies
    9 flatpak install --system flathub org.kde.Sdk//5.15-23.08
    10 flatpak install --system flathub org.kde.Platform//5.15-23.08
    11 flatpak install --system flathub org.freedesktop.Sdk.Extension.freepascal//23.08
     9flatpak install --system flathub org.kde.Sdk//5.15-24.08
     10flatpak install --system flathub org.kde.Platform//5.15-24.08
     11flatpak install --system flathub org.freedesktop.Sdk.Extension.freepascal//24.08
    1212flatpak install --system flathub org.flatpak.Builder
    1313
  • tags/1.4.0/Install/flatpak/net.zdechov.app.TransLines.yml

    r149 r154  
    11app-id: net.zdechov.app.TransLines
    22runtime: org.kde.Platform
    3 runtime-version: '5.15-23.08'
     3runtime-version: '5.15-24.08'
    44sdk: org.kde.Sdk
    55sdk-extensions:
    66  - org.freedesktop.Sdk.Extension.freepascal
    77command: TransLines
     8rename-icon: TransLines
     9rename-desktop-file: TransLines.desktop
    810finish-args:
    911  - --share=ipc
     
    2628      - type: svn
    2729        url: https://svn.zdechov.net/translines/tags/1.4.0
    28         revision: r149
     30        revision: r154
    2931    buildsystem: simple
    3032    build-commands:
     
    3234        . /usr/lib/sdk/freepascal/enable.sh
    3335        lazbuild --build-mode=Release --ws=qt5 TransLines.lpi
    34       - install -Dm755 TransLines -t $FLATPAK_DEST/share/TransLines
    35       - install -d $FLATPAK_DEST/bin
    36       - ln -s $FLATPAK_DEST/share/TransLines/TransLines $FLATPAK_DEST/bin/TransLines
    37       - install -Dm644 Install/flatpak/${FLATPAK_ID}.desktop -t $FLATPAK_DEST/share/applications
    38       - install -Dm644 Images/256x256/TransLines.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
     36      - install -Dm755 TransLines -t $FLATPAK_DEST/bin
     37      - install -Dm644 Install/deb/TransLines.desktop -t $FLATPAK_DEST/share/applications
     38      - install -Dm644 Images/256x256/TransLines.png -t $FLATPAK_DEST/share/icons/hicolor/256x256/apps
    3939      - install -Dm644 Languages/*.po -t $FLATPAK_DEST/share/TransLines/Languages
    40       - install -Dm644 Install/flatpak/${FLATPAK_ID}.appdata.xml $FLATPAK_DEST/share/metainfo/${FLATPAK_ID}.metainfo.xml
     40      - install -Dm644 Packages/Common/Languages/*.po -t $FLATPAK_DEST/share/TransLines/Languages
     41      - install -Dm644 Install/flatpak/${FLATPAK_ID}.metainfo.xml -t $FLATPAK_DEST/share/metainfo
  • tags/1.4.0/Packages/Common/UTranslator.pas

    r86 r154  
    4848    procedure TranslateProperty(Component: TPersistent; PropInfo: PPropInfo);
    4949    function IsExcluded(Component: TPersistent; PropertyName: string): Boolean;
    50     function GetLangFileDir: string;
     50    function GetLangFileDirs: TStrings;
    5151  public
    5252    ComponentExcludes: TComponentExcludesList;
     
    7171  end;
    7272
     73const
     74  PoExt = '.po';
     75
    7376procedure Register;
    7477
    7578
    7679implementation
     80
     81uses
     82  Common;
    7783
    7884procedure Register;
     
    161167  FileList: TStringList;
    162168  I: Integer;
     169  J: Integer;
    163170  LocaleShort: string;
    164171  SearchMask: string;
     172  LangDirs: TStrings;
    165173begin
    166174  FPoFiles.Clear;
    167   if Assigned(FLanguage) then
    168   try
     175  if Assigned(FLanguage) then begin
    169176    LocaleShort := GetLocaleShort;
    170     //ShowMessage(ExtractFileDir(Application.ExeName) +
    171     //  DirectorySeparator + 'Languages' + ' ' + '*.' + LocaleShort + '.po');
    172177    SearchMask := '*';
    173178    if LocaleShort <> '' then SearchMask := SearchMask + '.' + LocaleShort;
    174     SearchMask := SearchMask + '.po';
    175     FileList := FindAllFiles(GetLangFileDir, SearchMask);
    176     for I := 0 to FileList.Count - 1 do begin
    177       FileName := FileList[I];
    178       //FileName := FindLocaleFileName('.po');
    179       if FileExists(FileName) and (
    180       ((LocaleShort = '') and (Pos('.', FileName) = Pos('.po', FileName))) or
    181       (LocaleShort <> '')) then FPoFiles.Add(TPOFile.Create(FileName));
    182     end;
    183   finally
    184     FileList.Free;
     179    SearchMask := SearchMask + PoExt;
     180    LangDirs := GetLangFileDirs;
     181    for J := 0 to LangDirs.Count - 1 do begin
     182      FileList := FindAllFiles(LangDirs[J], SearchMask);
     183      try
     184        for I := 0 to FileList.Count - 1 do begin
     185          FileName := FileList[I];
     186          //FileName := FindLocaleFileName('.po');
     187           if FileExists(FileName) and (
     188          ((LocaleShort = '') and (Pos('.', FileName) = Pos(PoExt, FileName))) or
     189          (LocaleShort <> '')) then FPoFiles.Add(TPOFile.Create(FileName));
     190        end;
     191      finally
     192        FileList.Free;
     193      end;
     194    end;
     195    LangDirs.Free;
    185196  end;
    186197end;
     
    299310end;
    300311
    301 function TTranslator.GetLangFileDir: string;
    302 begin
    303   Result := FPoFilesFolder;
    304   if Copy(Result, 1, 1) <> DirectorySeparator then
    305     Result := ExtractFileDir(Application.ExeName) +
    306       DirectorySeparator + Result;
     312function TTranslator.GetLangFileDirs: TStrings;
     313var
     314  I: Integer;
     315begin
     316  Result := TStringList.Create;
     317  Result.Delimiter := ';';
     318  Result.StrictDelimiter := True;
     319  Result.DelimitedText := FPoFilesFolder;
     320
     321  for I := 0 to Result.Count - 1 do begin
     322    Result[I] := StringReplace(Result[I], '/', DirectorySeparator, [rfReplaceAll]);
     323    Result[I] := StringReplace(Result[I], '\', DirectorySeparator, [rfReplaceAll]);
     324    if (Copy(Result[I], 1, 1) <> DirectorySeparator) and (Copy(Result[I], 2, 2) <> ':\') then
     325      Result[I] := ExtractFileDir(Application.ExeName) +
     326        DirectorySeparator + Result[I];
     327  end;
    307328end;
    308329
     
    371392var
    372393  I: Integer;
    373   LangDir: string;
    374 begin
    375   LangDir := GetLangFileDir;
     394  J: Integer;
     395  LangDirs: TStrings;
     396begin
     397  LangDirs := GetLangFileDirs;
    376398  Languages.SearchByCode('').Available := True; // Automatic
    377399
    378400  for I := 1 to Languages.Count - 1 do
    379401  with Languages[I] do begin
    380     Available := FileExists(LangDir + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
    381       '.' + Code + ExtensionSeparator + 'po') or (Code = 'en');
    382   end;
     402    for J := 0 to LangDirs.Count - 1 do begin
     403      if FileExists(LangDirs[J] + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
     404        '.' + Code + PoExt) or (Code = 'en') then begin
     405          Available := True;
     406          Continue;
     407        end;
     408    end;
     409  end;
     410  LangDirs.Free;
    383411end;
    384412
     
    569597end;
    570598
    571 
    572599end.
    573 
  • tags/1.4.0/UMenu.pas

    r130 r154  
    224224
    225225    X := (CanvasSize.X - TotalWidth) div 2;
     226    if X < 5 then X := 5;
    226227    Y := (CanvasSize.Y - TotalHeight) div 2;
     228    if Y < 5 then Y := 5;
    227229
    228230    // Menu items
  • trunk/Forms/FormMain.lfm

    r143 r154  
    1515  OnKeyUp = FormKeyUp
    1616  OnShow = FormShow
    17   LCLVersion = '2.2.6.0'
     17  LCLVersion = '3.6.0.0'
    1818  object PaintBox1: TPaintBox
    1919    Left = 0
  • trunk/Forms/FormMain.pas

    r153 r154  
    6363const
    6464  UnixLanguagesDir = '../share/TransLines';
     65var
     66  NewDir: string;
     67{$ENDIF}
     68const
    6569  LanguagesDirName = 'Languages';
    6670var
    67   NewDir: string;
    6871  BaseDir: string;
    69 {$ENDIF}
    7072begin
    7173  BaseDir := ExcludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)));
  • trunk/Install/flatpak/net.zdechov.app.TransLines.yml

    r152 r154  
    2828      - type: svn
    2929        url: https://svn.zdechov.net/translines/trunk
    30         revision: r152
     30        revision: r154
    3131    buildsystem: simple
    3232    build-commands:
  • trunk/Packages/Common/Translator.pas

    r145 r154  
    322322    Result[I] := StringReplace(Result[I], '/', DirectorySeparator, [rfReplaceAll]);
    323323    Result[I] := StringReplace(Result[I], '\', DirectorySeparator, [rfReplaceAll]);
    324     if Copy(Result[I], 1, 1) <> DirectorySeparator then
     324    if (Copy(Result[I], 1, 1) <> DirectorySeparator) and (Copy(Result[I], 2, 2) <> ':\') then
    325325      Result[I] := ExtractFileDir(Application.ExeName) +
    326326        DirectorySeparator + Result[I];
Note: See TracChangeset for help on using the changeset viewer.