Переглянути джерело

added label for flightnumber prefix

fiffty-50 4 роки тому
батько
коміт
6ccc77ebd4
4 змінених файлів з 19 додано та 18 видалено
  1. 1 0
      mainwindow.ui
  2. 3 6
      newflight.cpp
  3. 14 1
      newflight.ui
  4. 1 11
      settingswidget.cpp

+ 1 - 0
mainwindow.ui

@@ -36,6 +36,7 @@
    </attribute>
    <addaction name="actionHome"/>
    <addaction name="actionLogbook"/>
+   <addaction name="actionNew_Flight"/>
    <addaction name="actionSettings"/>
    <addaction name="actionQuit"/>
   </widget>

+ 3 - 6
newflight.cpp

@@ -21,6 +21,7 @@
 #include <QMessageBox>
 #include <QDebug>
 #include <QCompleter>
+#include <QLatin1Char>
 #include <QStringList>
 #include <QStringListModel>
 #include <QSortFilterProxyModel>
@@ -137,12 +138,6 @@ NewFlight::NewFlight(QWidget *parent) :
     ui->deptTZ->setFocusPolicy(Qt::NoFocus);
     ui->destTZ->setFocusPolicy(Qt::NoFocus);
     ui->newDept->setFocus();
-
-    QString flightNumberPrefix = dbSettings::retreiveSetting(50);
-    if(flightNumberPrefix.length() != 0){
-        ui->FlightNumberLineEdit->setText(flightNumberPrefix);
-    }
-
 }
 
 NewFlight::~NewFlight()
@@ -370,6 +365,8 @@ void NewFlight::restoreSettings()
     ui->AutolandCheckBox->setChecked(dbSettings::retreiveSetting(109).toInt());
     ui->IfrCheckBox->setChecked(dbSettings::retreiveSetting(110).toInt());
     ui->VfrCheckBox->setChecked(dbSettings::retreiveSetting(111).toInt());
+
+    ui->flightNumberPrefixLabel->setText(dbSettings::retreiveSetting(50) + QLatin1Char('-'));
     //ui->autoNightCheckBox->setChecked(dbSettings::retreiveSetting("112")[1].toInt());
     //qDebug() << "restore Settings ifr to int: " << dbSettings::retreiveSetting("110")[1].toInt();
 

+ 14 - 1
newflight.ui

@@ -200,7 +200,7 @@
            <second>0</second>
            <year>2019</year>
            <month>12</month>
-           <day>14</day>
+           <day>13</day>
           </datetime>
          </property>
          <property name="displayFormat">
@@ -266,6 +266,19 @@
          </property>
         </widget>
        </item>
+       <item row="5" column="1">
+        <widget class="QLabel" name="flightNumberPrefixLabel">
+         <property name="toolTip">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Can bet changed in Settings&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
     </widget>

+ 1 - 11
settingswidget.cpp

@@ -22,16 +22,6 @@ settingsWidget::settingsWidget(QWidget *parent) :
     themeGroup->addButton(ui->systemThemeCheckBox, 0);
     themeGroup->addButton(ui->lightThemeCheckBox, 1);
     themeGroup->addButton(ui->darkThemeCheckBox, 2);
-
-    /*connect(themeGroup,
-            SIGNAL(idToggled(int)),
-            this,
-            SLOT(themeGroup_toggled(int)));*/
-
-    /*connect(themeGroup,
-    SIGNAL(idToggled(int)),
-    SLOT(themeGroup_toggled(int)));*/
-
     connect(themeGroup, SIGNAL(buttonClicked(int)), this, SLOT(themeGroup_toggled(int)));
 
     switch (dbSettings::retreiveSetting(10).toInt()) {
@@ -55,7 +45,7 @@ settingsWidget::settingsWidget(QWidget *parent) :
         ui->flightNumberPrefixLineEdit->setText(storedPrefix);
     }
 
-    QRegExp flightNumberPrefix_rx("[a-zA-Z]?[a-zA-Z]?[a-zA-Z]?[a-zA-Z]"); // allow max 4 letters (upper and lower)
+    QRegExp flightNumberPrefix_rx("[a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]"); // allow max 3 letters (upper and lower) and numbers
     QValidator *flightNumberPrefixValidator = new QRegExpValidator(flightNumberPrefix_rx, this);
     ui->flightNumberPrefixLineEdit->setValidator(flightNumberPrefixValidator);