LCOV - code coverage report
Current view: top level - dbe/src/object - ValidatorComboBox.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 49 0
Test Date: 2026-07-12 15:23:06 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/ValidatorComboBox.hpp"
      10              : #include "dbe/StyleUtility.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,
      18              :             SLOT ( TryValidate ( const QString & ) ) );
      19            0 :   connect ( this, SIGNAL ( activated ( const QString & ) ), this,
      20              :             SLOT ( ChangeDetected ( const QString & ) ) );
      21            0 :   connect ( this, SIGNAL ( currentIndexChanged ( int ) ), this,
      22              :             SLOT ( CheckDefaults ( int ) ) );
      23            0 : }
      24              : 
      25            0 : dbe::ValidatorComboBox::~ValidatorComboBox()
      26              : {
      27            0 : }
      28              : 
      29            0 : bool dbe::ValidatorComboBox::IsValid() const
      30              : {
      31            0 :   return Valid;
      32              : }
      33              : 
      34            0 : bool dbe::ValidatorComboBox::IsChanged() const
      35              : {
      36            0 :   return ValueChanged;
      37              : }
      38              : 
      39            0 : QStringList dbe::ValidatorComboBox::GetDataList()
      40              : {
      41            0 :   DataList.clear();
      42            0 :   DataList << currentText();
      43            0 :   return DataList;
      44              : }
      45              : 
      46            0 : void dbe::ValidatorComboBox::wheelEvent ( QWheelEvent * event )
      47              : {
      48            0 :   ( void ) event;
      49            0 :   return;
      50              : }
      51              : 
      52            0 : void 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              :   {
      59            0 :     if ( this->validator()->validate ( Tmp, index ) == QValidator::Acceptable )
      60              :     {
      61            0 :       Valid = true;
      62              : 
      63            0 :       if ( CompareDefaults() )
      64              :       {
      65            0 :         this->setPalette ( StyleUtility::LoadedDefault );
      66              :       }
      67              :       else
      68              :       {
      69            0 :         this->setPalette ( QApplication::palette ( this ) );
      70              :       }
      71              :     }
      72            0 :     else if ( this->validator()->validate ( Tmp, index ) == QValidator::Intermediate )
      73              :     {
      74            0 :       Valid = false;
      75            0 :       this->setPalette ( StyleUtility::WarningStatusBarPallete );
      76              :     }
      77              :   }
      78              :   else
      79              :   {
      80            0 :     if ( CompareDefaults() )
      81              :     {
      82            0 :       this->setPalette ( StyleUtility::LoadedDefault );
      83              :     }
      84              :     else
      85              :     {
      86            0 :       this->setPalette ( QApplication::palette ( this ) );
      87              :     }
      88              :   }
      89            0 : }
      90              : 
      91            0 : void dbe::ValidatorComboBox::ChangeDetected ( const QString & StringChange )
      92              : {
      93            0 :   Q_UNUSED ( StringChange )
      94            0 :   ValueChanged = true;
      95            0 :   emit ValueWasChanged();
      96            0 : }
      97              : 
      98            0 : void dbe::ValidatorComboBox::CheckDefaults ( int DefaultIndex )
      99              : {
     100            0 :   Q_UNUSED ( DefaultIndex )
     101              : 
     102            0 :   if ( !Default.isEmpty() )
     103              :   {
     104            0 :     TryValidate ( this->currentText() );
     105              :   }
     106            0 : }
     107              : 
     108            0 : bool dbe::ValidatorComboBox::CompareDefaults()
     109              : {
     110            0 :   if ( Default.isEmpty() )
     111              :   {
     112              :     return false;
     113              :   }
     114              : 
     115            0 :   if ( Default == this->currentText() )
     116              :   {
     117              :     return true;
     118              :   }
     119              : 
     120              :   return false;
     121              : }
        

Generated by: LCOV version 2.0-1