freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype-demos][reorg-maingui] [ftinspect] Directly pass


From: Charlie Jiang (@cqjjjzr)
Subject: [Git][freetype/freetype-demos][reorg-maingui] [ftinspect] Directly pass `Engine` object to constructor of `MainGUI`
Date: Fri, 01 Jul 2022 09:34:58 +0000

Charlie Jiang pushed to branch reorg-maingui at FreeType / FreeType Demo Programs

Commits:

  • c10c1cbf
    by Charlie Jiang at 2022-07-01T17:31:08+08:00
    [ftinspect] Directly pass `Engine` object to constructor of `MainGUI`
    
    Because there's no bidirectional dependency between `Engine` and `MainGUI`,
    we no longer need `MainGUI::update` func and can directly pass the `Engine`
    object to `MainGUI`. This also make `engine_` variable available immediately
    in the constructor of `MainGUI`.
    
    * src/ftinspect/maingui.cpp, src/ftinspect/maingui.hpp: As described.
    

2 changed files:

Changes:

  • src/ftinspect/maingui.cpp
    ... ... @@ -14,10 +14,9 @@
    14 14
     #include <freetype/ftdriver.h>
    
    15 15
     
    
    16 16
     
    
    17
    -MainGUI::MainGUI()
    
    17
    +MainGUI::MainGUI(Engine* engine)
    
    18
    +: engine_(engine)
    
    18 19
     {
    
    19
    -  engine_ = NULL;
    
    20
    -
    
    21 20
       setGraphicsDefaults();
    
    22 21
       createLayout();
    
    23 22
       createConnections();
    
    ... ... @@ -37,19 +36,6 @@ MainGUI::~MainGUI()
    37 36
     }
    
    38 37
     
    
    39 38
     
    
    40
    -void
    
    41
    -MainGUI::update(Engine* e)
    
    42
    -{
    
    43
    -  if (engine_)
    
    44
    -    disconnect(&engine_->fontFileManager(), &FontFileManager::currentFileChanged,
    
    45
    -        this, &MainGUI::watchCurrentFont);
    
    46
    -
    
    47
    -  engine_ = e;
    
    48
    -  connect(&engine_->fontFileManager(), &FontFileManager::currentFileChanged,
    
    49
    -          this, &MainGUI::watchCurrentFont);
    
    50
    -}
    
    51
    -
    
    52
    -
    
    53 39
     // overloading
    
    54 40
     
    
    55 41
     void
    
    ... ... @@ -1102,6 +1088,9 @@ MainGUI::createConnections()
    1102 1088
       glyphNavigationMapper_->setMapping(toP100Buttonx_, 100);
    
    1103 1089
       glyphNavigationMapper_->setMapping(toP1000Buttonx_, 1000);
    
    1104 1090
       glyphNavigationMapper_->setMapping(toEndButtonx_, 0x10000);
    
    1091
    +
    
    1092
    +  connect(&engine_->fontFileManager(), &FontFileManager::currentFileChanged,
    
    1093
    +          this, &MainGUI::watchCurrentFont);
    
    1105 1094
     }
    
    1106 1095
     
    
    1107 1096
     
    

  • src/ftinspect/maingui.hpp
    ... ... @@ -53,11 +53,10 @@ class MainGUI
    53 53
       Q_OBJECT
    
    54 54
     
    
    55 55
     public:
    
    56
    -  MainGUI();
    
    56
    +  MainGUI(Engine* engine);
    
    57 57
       ~MainGUI();
    
    58 58
     
    
    59 59
       void setDefaults();
    
    60
    -  void update(Engine*);
    
    61 60
     
    
    62 61
       friend class Engine;
    
    63 62
       friend FT_Error faceRequester(FTC_FaceID,
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]