"Fossies" - the Fresh Open Source Software Archive

Member "flightgear-2020.3.8/src/GUI/qml/SettingExtraArguments.qml" (24 Mar 2021, 3953 Bytes) of package /linux/privat/flightgear-2020.3.8.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) QML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "SettingExtraArguments.qml": 2020.3.7_vs_2020.3.8.

    1 import QtQuick 2.4
    2 import FlightGear.Launcher 1.0
    3 import "."
    4 
    5 SettingControl {
    6     id: root
    7     implicitHeight: col.height + Style.margin * 2
    8     readonly property string placeholder: "--option=value --prop:/sim/name=value"
    9     property alias value: edit.text
   10     option: "xxx" // non-empty value so apply() is called
   11     property string defaultValue: "" // needed to type save/restore logic to string
   12 
   13     Column
   14     {
   15         id: col
   16         y: Style.margin
   17         width: parent.width
   18         spacing: Style.margin
   19 
   20         SettingDescription {
   21             id: description
   22             enabled: root.enabled
   23             text: qsTr("Enter additional command-line arguments if any are required. " +
   24                        "See <a href=\"http://flightgear.sourceforge.net/getstart-en/getstart-enpa2.html#x5-450004.5\">here</a> " +
   25                        "for documentation on possible arguments. " +
   26                        "<br>" +
   27                        "<b>Warning:</b> values entered here always override other settings; <a href=\"#view-command-line\">click here</a> " +
   28                        "to view the final set of arguments that will be used"
   29                        );
   30 
   31             onLinkActivated: {
   32                 if (link == "#view-command-line") {
   33                     _launcher.viewCommandLine();
   34                 } else {
   35                     Qt.openUrlExternally(link)
   36                 }
   37             }
   38 
   39             width: parent.width
   40         }
   41 
   42         SettingDescription {
   43             id: warningText
   44             enabled: root.enabled
   45             visible: tokenizer.haveUnsupportedArgs
   46             width: parent.width
   47             text: qsTr("<b>Warning:</b> specifying <tt>fg-root</tt>, <tt>fg-aircraft</tt>, <tt>fg-scenery</tt> or <tt>fg-home</tt> " +
   48                        "using this section is not recommended, and may cause problem or prevent the simulator from running. " +
   49                        "Please use the add-ons page to setup scenery and aircrft directories, and the 'Select data files location' " +
   50                        "menu item to change the root data directory.");
   51         }
   52 
   53         SettingDescription {
   54             id: positionalArgsText
   55             enabled: root.enabled
   56             visible: tokenizer.havePositionalArgs
   57             width: parent.width
   58             text: qsTr("<b>Note:</b> you have entered arguments relating to the startup location below. " +
   59                        "To prevent problems caused by conflicting settings, the values entered on the location " +
   60                        "page (for example, airport or altitude) will be ignored.");
   61         }
   62 
   63         SettingDescription {
   64             id: aircraftArgsText
   65             enabled: root.enabled
   66             visible: tokenizer.haveAircraftArgs
   67             width: parent.width
   68             text: qsTr("<b>Note:</b> you have entered arguments relating to the selected aircraft. " +
   69                        "To prevent problems caused by conflicting settings, the aircraft page will be ignored.");
   70         }
   71 
   72         PlainTextEditBox
   73         {
   74             id: edit
   75             width: parent.width
   76             enabled: root.enabled
   77             placeholder: root.placeholder
   78         }
   79     }
   80 
   81     function apply()
   82     {
   83         var tokens = tokenizer.tokens;
   84         for (var i = 0; i < tokens.length; i++) {
   85             var tk = tokens[i];
   86             if (tk.arg.substring(0, 5) === "prop:") {
   87                 _config.setProperty(tk.arg.substring(5), tk.value, LaunchConfig.ExtraArgs);
   88             } else {
   89                 _config.setArg(tk.arg, tk.value, LaunchConfig.ExtraArgs);
   90             }
   91         }
   92     }
   93 
   94     Binding {
   95         target: _location
   96         property: "skipFromArgs"
   97         value: tokenizer.havePositionalArgs
   98     }
   99 
  100     Binding {
  101         target: _launcher
  102         property: "skipAircraftFromArgs"
  103         value: tokenizer.haveAircraftArgs
  104     }
  105 
  106     ArgumentTokenizer {
  107         id: tokenizer
  108         argString: edit.text
  109     }
  110 }