LCOV - code coverage report
Current view: top level - dbe/src/object - ValidatorComboBox.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 48 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 10 0

            Line data    Source code
       1              : // DUNE DAQ modification notice:
       2              : // This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
       3              : // Fork baseline commit: dbe-02-12-17 (2022-05-12).
       4              : // Renamed since fork: no.
       5              : 
       6              : /// Including QT Headers
       7              : #include <QApplication>
       8              : /// Including DBE
       9              : #include "dbe/StyleUtility.hpp"
      10              : #include "dbe/ValidatorComboBox.hpp"
      11              : 
      12            0 : dbe::ValidatorComboBox::ValidatorComboBox(QWidget* parent)
      13              :   : QComboBox(parent)
      14            0 :   , Valid(false)
      15            0 :   , ValueChanged(false)
      16              : {
      17            0 :   connect(this, SIGNAL(editTextChanged(const QString&)), this, SLOT(TryValidate(const QString&)));
      18            0 :   connect(this, SIGNAL(activated(const QString&)), this, SLOT(ChangeDetected(const QString&)));
      19            0 :   connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(CheckDefaults(int)));
      20            0 : }
      21              : 
      22            0 : dbe::ValidatorComboBox::~ValidatorComboBox() {}
      23              : 
      24              : bool
      25            0 : dbe::ValidatorComboBox::IsValid() const
      26              : {
      27            0 :   return Valid;
      28              : }
      29              : 
      30              : bool
      31            0 : dbe::ValidatorComboBox::IsChanged() const
      32              : {
      33            0 :   return ValueChanged;
      34              : }
      35              : 
      36              : QStringList
      37            0 : dbe::ValidatorComboBox::GetDataList()
      38              : {
      39            0 :   DataList.clear();
      40            0 :   DataList << currentText();
      41            0 :   return DataList;
      42              : }
      43              : 
      44              : void
      45            0 : dbe::ValidatorComboBox::wheelEvent(QWheelEvent* event)
      46              : {
      47            0 :   (void)event;
      48            0 :   return;
      49              : }
      50              : 
      51              : void
      52            0 : dbe::ValidatorComboBox::TryValidate(const QString& ValidateString)
      53              : {
      54            0 :   QString Tmp = ValidateString;
      55            0 :   int index = 0;
      56              : 
      57            0 :   if (this->validator() != nullptr) {
      58            0 :     if (this->validator()->validate(Tmp, index) == QValidator::Acceptable) {
      59            0 :       Valid = true;
      60              : 
      61            0 :       if (CompareDefaults()) {
      62            0 :         this->setPalette(StyleUtility::LoadedDefault);
      63              :       } else {
      64            0 :         this->setPalette(QApplication::palette(this));
      65              :       }
      66            0 :     } else if (this->validator()->validate(Tmp, index) == QValidator::Intermediate) {
      67            0 :       Valid = false;
      68            0 :       this->setPalette(StyleUtility::WarningStatusBarPallete);
      69              :     }
      70              :   } else {
      71            0 :     if (CompareDefaults()) {
      72            0 :       this->setPalette(StyleUtility::LoadedDefault);
      73              :     } else {
      74            0 :       this->setPalette(QApplication::palette(this));
      75              :     }
      76              :   }
      77            0 : }
      78              : 
      79              : void
      80            0 : dbe::ValidatorComboBox::ChangeDetected(const QString& StringChange)
      81              : {
      82            0 :   Q_UNUSED(StringChange)
      83            0 :   ValueChanged = true;
      84            0 :   emit ValueWasChanged();
      85            0 : }
      86              : 
      87              : void
      88            0 : dbe::ValidatorComboBox::CheckDefaults(int DefaultIndex)
      89              : {
      90            0 :   Q_UNUSED(DefaultIndex)
      91              : 
      92            0 :   if (!Default.isEmpty()) {
      93            0 :     TryValidate(this->currentText());
      94              :   }
      95            0 : }
      96              : 
      97              : bool
      98            0 : dbe::ValidatorComboBox::CompareDefaults()
      99              : {
     100            0 :   if (Default.isEmpty()) {
     101              :     return false;
     102              :   }
     103              : 
     104            0 :   if (Default == this->currentText()) {
     105              :     return true;
     106              :   }
     107              : 
     108              :   return false;
     109              : }
        

Generated by: LCOV version 2.0-1