Public Slots | Signals | Public Member Functions | Private Attributes | List of all members
dbutils::gui::CustomTabWidget Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/DatabaseUtils/cxx/include/GUI/CustomTabWidget.h"

Inheritance diagram for dbutils::gui::CustomTabWidget:

Public Slots

void reactToDataChange ()
 
void reactToDataSave ()
 

Signals

void aChangeWasMade ()
 
void dataWasSaved ()
 

Public Member Functions

 CustomTabWidget (QWidget *parent=0)
 
int addTab (QWidget *page, const QString &label)
 
bool loadData (const dbutils::daqconfig::IDSpec &idSpec)
 
bool hasChanges () const
 
bool saveChanges (const dbutils::daqconfig::IDSpec &oldGlobalIdSpec, const dbutils::daqconfig::IDSpec &newGlobalIdSpec, const dbutils::daqconfig::GlobalNameSpec &newGlobalNameSpec)
 
bool addInitialRow ()
 
void isTopLevel (bool setting=true)
 

Private Attributes

bool _isTopLevel
 

Detailed Description

Class for providing local enhancements to the QTabWidget class.

Author
Kurt Biery
Version
Revision
1.7.14.1
Date
2019/09/27 00:07:04

Definition at line 18 of file CustomTabWidget.h.

Constructor & Destructor Documentation

dbutils::gui::CustomTabWidget::CustomTabWidget ( QWidget *  parent = 0)

Definition at line 13 of file CustomTabWidget.cpp.

13  : QTabWidget(parent), _isTopLevel(false)
14 {
15 }

Member Function Documentation

void dbutils::gui::CustomTabWidget::aChangeWasMade ( )
signal
bool dbutils::gui::CustomTabWidget::addInitialRow ( )

Definition at line 58 of file CustomTabWidget.cpp.

References dbutils::gui::Changeable::addInitialRow(), confusionMatrixTree::count, compare_h5_caf::idx, saveChanges(), and fabricate::status.

Referenced by dbutils::gui::DAQConfigEditorDisplay::addInitialRow().

59 {
60  bool status = true;
61  for (int idx = 0; idx < this->count(); ++idx) {
62  QWidget* theWidget = widget(idx);
63  Changeable* changeableObject = dynamic_cast<Changeable*>(theWidget);
64  if (! changeableObject->addInitialRow()) {status = false;}
65  }
66  return status;
67 }
int status
Definition: fabricate.py:1613
int dbutils::gui::CustomTabWidget::addTab ( QWidget *  page,
const QString &  label 
)

Definition at line 17 of file CustomTabWidget.cpp.

References aChangeWasMade(), g4zmq::connect(), dataWasSaved(), reactToDataChange(), and reactToDataSave().

Referenced by dbutils::gui::DAQConfigEditorDisplay::DAQConfigEditorDisplay().

18 {
19  connect(page, SIGNAL(aChangeWasMade()), this, SLOT(reactToDataChange()));
20  connect(page, SIGNAL(dataWasSaved()), this, SLOT(reactToDataSave()));
21 
22  return QTabWidget::addTab(page, label);
23 }
const char * label
def connect(endpoint="tcp://127.0.0.1:5555")
Definition: g4zmq.py:15
void dbutils::gui::CustomTabWidget::dataWasSaved ( )
signal

Referenced by addTab(), isTopLevel(), and reactToDataSave().

bool dbutils::gui::CustomTabWidget::hasChanges ( ) const

Definition at line 48 of file CustomTabWidget.cpp.

References confusionMatrixTree::count, dbutils::gui::Changeable::hasChanges(), and compare_h5_caf::idx.

Referenced by dbutils::gui::DAQConfigEditorDisplay::hasChanges(), and saveChanges().

49 {
50  for (int idx = 0; idx < this->count(); ++idx) {
51  QWidget* theWidget = widget(idx);
52  Changeable* changeableObject = dynamic_cast<Changeable*>(theWidget);
53  if (changeableObject->hasChanges()) {return true;}
54  }
55  return false;
56 }
void dbutils::gui::CustomTabWidget::isTopLevel ( bool  setting = true)
inline
bool dbutils::gui::CustomTabWidget::loadData ( const dbutils::daqconfig::IDSpec idSpec)

Definition at line 25 of file CustomTabWidget.cpp.

References _isTopLevel, confusionMatrixTree::count, compare_h5_caf::idx, dbutils::gui::Storeable::loadData(), bp_utils::progressBar(), and fabricate::status.

Referenced by dbutils::gui::DAQConfigEditorDisplay::_doLoadNewDataset(), and dbutils::gui::DAQConfigEditorDisplay::_doReloadCurrentDataset().

26 {
27  bool status = true;
28 
29  boost::shared_ptr<QProgressDialog> progressBar;
30  if (_isTopLevel) {
31  progressBar.reset(new QProgressDialog("Loading data...", "Close", 0,
32  this->count(), this));
33  progressBar->setWindowModality(Qt::WindowModal);
34  progressBar->setMinimumDuration(250);
35  }
36 
37  for (int idx = 0; idx < this->count(); ++idx) {
38  if (_isTopLevel) {progressBar->setValue(idx);}
39  QWidget* theWidget = widget(idx);
40  Storeable* storeableObject = dynamic_cast<Storeable*>(theWidget);
41  if (! storeableObject->loadData(idSpec)) {status = false;}
42  }
43  if (_isTopLevel) {progressBar->setValue(this->count());}
44 
45  return status;
46 }
def progressBar(value, endvalue, docdb_id, bar_length=40)
Definition: bp_utils.py:6
int status
Definition: fabricate.py:1613
void dbutils::gui::CustomTabWidget::reactToDataChange ( )
slot

Definition at line 99 of file CustomTabWidget.cpp.

References aChangeWasMade(), and dbutils::gui::CustomTabBehaviors::updateTabTextColors().

Referenced by addTab(), and isTopLevel().

100 {
101  CustomTabBehaviors::updateTabTextColors(this, this->tabBar());
102  emit aChangeWasMade();
103 }
void updateTabTextColors(QTabWidget *tabWidget, QTabBar *tabBar)
void dbutils::gui::CustomTabWidget::reactToDataSave ( )
slot

Definition at line 105 of file CustomTabWidget.cpp.

References dataWasSaved(), and dbutils::gui::CustomTabBehaviors::updateTabTextColors().

Referenced by addTab(), and isTopLevel().

106 {
107  CustomTabBehaviors::updateTabTextColors(this, this->tabBar());
108  emit dataWasSaved();
109 }
void updateTabTextColors(QTabWidget *tabWidget, QTabBar *tabBar)
bool dbutils::gui::CustomTabWidget::saveChanges ( const dbutils::daqconfig::IDSpec oldGlobalIdSpec,
const dbutils::daqconfig::IDSpec newGlobalIdSpec,
const dbutils::daqconfig::GlobalNameSpec newGlobalNameSpec 
)

Definition at line 70 of file CustomTabWidget.cpp.

References _isTopLevel, confusionMatrixTree::count, hasChanges(), compare_h5_caf::idx, bp_utils::progressBar(), dbutils::gui::Storeable::saveChanges(), and fabricate::status.

Referenced by dbutils::gui::DAQConfigEditorDisplay::_doSaveChanges(), and addInitialRow().

73 {
74  if (! hasChanges()) {return true;}
75 
76  boost::shared_ptr<QProgressDialog> progressBar;
77  if (_isTopLevel) {
78  progressBar.reset(new QProgressDialog("Loading data...", "Close", 0,
79  this->count(), this));
80  progressBar->setWindowModality(Qt::WindowModal);
81  progressBar->setMinimumDuration(250);
82  }
83 
84  bool status = true;
85  for (int idx = 0; idx < this->count(); ++idx) {
86  if (_isTopLevel) {progressBar->setValue(idx);}
87  QWidget* theWidget = widget(idx);
88  Storeable* storeableObject = dynamic_cast<Storeable*>(theWidget);
89  if (! storeableObject->saveChanges(oldGlobalIdSpec,
90  newGlobalIdSpec,
91  newGlobalNameSpec)) {
92  status = false;
93  }
94  }
95  if (_isTopLevel) {progressBar->setValue(this->count());}
96  return status;
97 }
def progressBar(value, endvalue, docdb_id, bar_length=40)
Definition: bp_utils.py:6
int status
Definition: fabricate.py:1613

Member Data Documentation

bool dbutils::gui::CustomTabWidget::_isTopLevel
private

Definition at line 50 of file CustomTabWidget.h.

Referenced by isTopLevel(), loadData(), and saveChanges().


The documentation for this class was generated from the following files: