diff options
| -rw-r--r-- | proto-fg/ftnoir_fgcontrols.ui | 264 | ||||
| -rw-r--r-- | proto-fg/ftnoir_protocol_fg_dialog.cpp | 21 | 
2 files changed, 185 insertions, 100 deletions
| diff --git a/proto-fg/ftnoir_fgcontrols.ui b/proto-fg/ftnoir_fgcontrols.ui index bd5b95c7..4c0a8314 100644 --- a/proto-fg/ftnoir_fgcontrols.ui +++ b/proto-fg/ftnoir_fgcontrols.ui @@ -9,8 +9,8 @@     <rect>      <x>0</x>      <y>0</y> -    <width>415</width> -    <height>112</height> +    <width>342</width> +    <height>100</height>     </rect>    </property>    <property name="windowTitle"> @@ -22,111 +22,183 @@    <property name="autoFillBackground">     <bool>false</bool>    </property> -  <layout class="QGridLayout" name="gridLayout"> -   <item row="0" column="0"> -    <widget class="QLabel" name="label_4"> -     <property name="text"> -      <string>IP-address remote PC</string> -     </property> -    </widget> -   </item> -   <item row="0" column="1"> -    <widget class="QSpinBox" name="spinIPFirstNibble"> -     <property name="maximumSize"> -      <size> -       <width>60</width> -       <height>16777215</height> -      </size> -     </property> -     <property name="maximum"> -      <number>255</number> -     </property> -     <property name="singleStep"> -      <number>1</number> -     </property> -    </widget> -   </item> -   <item row="0" column="2"> -    <widget class="QSpinBox" name="spinIPSecondNibble"> -     <property name="maximumSize"> -      <size> -       <width>60</width> -       <height>16777215</height> -      </size> -     </property> -     <property name="maximum"> -      <number>255</number> -     </property> -     <property name="singleStep"> -      <number>1</number> -     </property> +  <layout class="QVBoxLayout" name="verticalLayout"> +   <property name="spacing"> +    <number>0</number> +   </property> +   <property name="topMargin"> +    <number>2</number> +   </property> +   <item> +    <widget class="QFrame" name="frame"> +     <property name="frameShadow"> +      <enum>QFrame::Raised</enum> +     </property> +     <layout class="QHBoxLayout" name="horizontalLayout"> +      <property name="bottomMargin"> +       <number>0</number> +      </property> +      <item> +       <widget class="QLabel" name="label_4"> +        <property name="sizePolicy"> +         <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> +          <horstretch>0</horstretch> +          <verstretch>0</verstretch> +         </sizepolicy> +        </property> +        <property name="text"> +         <string>IP address</string> +        </property> +       </widget> +      </item> +      <item> +       <widget class="QSpinBox" name="spinIPFirstNibble"> +        <property name="sizePolicy"> +         <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> +          <horstretch>0</horstretch> +          <verstretch>0</verstretch> +         </sizepolicy> +        </property> +        <property name="maximumSize"> +         <size> +          <width>60</width> +          <height>16777215</height> +         </size> +        </property> +        <property name="maximum"> +         <number>255</number> +        </property> +        <property name="singleStep"> +         <number>1</number> +        </property> +       </widget> +      </item> +      <item> +       <widget class="QSpinBox" name="spinIPSecondNibble"> +        <property name="sizePolicy"> +         <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> +          <horstretch>0</horstretch> +          <verstretch>0</verstretch> +         </sizepolicy> +        </property> +        <property name="maximumSize"> +         <size> +          <width>60</width> +          <height>16777215</height> +         </size> +        </property> +        <property name="maximum"> +         <number>255</number> +        </property> +        <property name="singleStep"> +         <number>1</number> +        </property> +       </widget> +      </item> +      <item> +       <widget class="QSpinBox" name="spinIPThirdNibble"> +        <property name="sizePolicy"> +         <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> +          <horstretch>0</horstretch> +          <verstretch>0</verstretch> +         </sizepolicy> +        </property> +        <property name="maximumSize"> +         <size> +          <width>60</width> +          <height>16777215</height> +         </size> +        </property> +        <property name="maximum"> +         <number>255</number> +        </property> +        <property name="singleStep"> +         <number>1</number> +        </property> +       </widget> +      </item> +      <item> +       <widget class="QSpinBox" name="spinIPFourthNibble"> +        <property name="sizePolicy"> +         <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> +          <horstretch>0</horstretch> +          <verstretch>0</verstretch> +         </sizepolicy> +        </property> +        <property name="maximumSize"> +         <size> +          <width>60</width> +          <height>16777215</height> +         </size> +        </property> +        <property name="maximum"> +         <number>255</number> +        </property> +        <property name="singleStep"> +         <number>1</number> +        </property> +       </widget> +      </item> +     </layout>      </widget>     </item> -   <item row="0" column="3"> -    <widget class="QSpinBox" name="spinIPThirdNibble"> -     <property name="maximumSize"> -      <size> -       <width>60</width> -       <height>16777215</height> -      </size> -     </property> -     <property name="maximum"> -      <number>255</number> -     </property> -     <property name="singleStep"> -      <number>1</number> -     </property> +   <item> +    <widget class="QFrame" name="frame_2"> +     <property name="frameShadow"> +      <enum>QFrame::Raised</enum> +     </property> +     <layout class="QHBoxLayout" name="horizontalLayout_2"> +      <property name="topMargin"> +       <number>4</number> +      </property> +      <item> +       <widget class="QLabel" name="label_5"> +        <property name="sizePolicy"> +         <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> +          <horstretch>10</horstretch> +          <verstretch>0</verstretch> +         </sizepolicy> +        </property> +        <property name="text"> +         <string>Port</string> +        </property> +       </widget> +      </item> +      <item> +       <widget class="QSpinBox" name="spinPortNumber"> +        <property name="sizePolicy"> +         <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> +          <horstretch>3</horstretch> +          <verstretch>0</verstretch> +         </sizepolicy> +        </property> +        <property name="minimum"> +         <number>1000</number> +        </property> +        <property name="maximum"> +         <number>10000</number> +        </property> +       </widget> +      </item> +     </layout>      </widget>     </item> -   <item row="0" column="4"> -    <widget class="QSpinBox" name="spinIPFourthNibble"> -     <property name="maximumSize"> -      <size> -       <width>60</width> -       <height>16777215</height> -      </size> -     </property> -     <property name="maximum"> -      <number>255</number> -     </property> -     <property name="singleStep"> -      <number>1</number> -     </property> -    </widget> -   </item> -   <item row="1" column="0"> -    <widget class="QLabel" name="label_5"> -     <property name="text"> -      <string>Port-number</string> -     </property> -    </widget> -   </item> -   <item row="1" column="1"> -    <widget class="QSpinBox" name="spinPortNumber"> -     <property name="minimum"> -      <number>1000</number> -     </property> -     <property name="maximum"> -      <number>10000</number> -     </property> -    </widget> -   </item> -   <item row="2" column="2" colspan="3"> +   <item>      <widget class="QDialogButtonBox" name="buttonBox"> +     <property name="sizePolicy"> +      <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> +       <horstretch>0</horstretch> +       <verstretch>0</verstretch> +      </sizepolicy> +     </property>       <property name="standardButtons"> -      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> +      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>       </property>      </widget>     </item>    </layout>   </widget> - <tabstops> -  <tabstop>spinIPFirstNibble</tabstop> -  <tabstop>spinIPSecondNibble</tabstop> -  <tabstop>spinIPThirdNibble</tabstop> -  <tabstop>spinIPFourthNibble</tabstop> -  <tabstop>spinPortNumber</tabstop> - </tabstops> + <resources/>   <connections/>   <slots>    <slot>startEngineClicked()</slot> diff --git a/proto-fg/ftnoir_protocol_fg_dialog.cpp b/proto-fg/ftnoir_protocol_fg_dialog.cpp index 50ca2a73..43a702f6 100644 --- a/proto-fg/ftnoir_protocol_fg_dialog.cpp +++ b/proto-fg/ftnoir_protocol_fg_dialog.cpp @@ -9,9 +9,13 @@   * copyright notice and this permission notice appear in all copies.             *   */  #include "ftnoir_protocol_fg.h" -#include <QObject> -#include <QFile>  #include "api/plugin-api.hpp" +#include "opentrack-library-path.h" + +#include <QString> +#include <QUrl> +#include <QDir> +#include <QDesktopServices>  //*******************************************************************************************************  // FaceTrackNoIR Client Settings-dialog. @@ -32,14 +36,23 @@ FGControls::FGControls()      connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));      connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); +    connect(ui.buttonBox, &QDialogButtonBox::helpRequested, +            ui.buttonBox, []() +    { +        static const QString contrib_dir = "file:///" + QDir::toNativeSeparators(QStringLiteral("%1/%2/%3"). +            arg(OPENTRACK_BASE_PATH, OPENTRACK_CONTRIB_PATH, "FlightGear")); +        QDesktopServices::openUrl(contrib_dir); +    });  } -void FGControls::doOK() { +void FGControls::doOK() +{      s.b->save();      close();  } -void FGControls::doCancel() { +void FGControls::doCancel() +{      close();  } | 
