29#include <QProgressDialog>
35#include <QDesktopServices>
37#include <QApplication>
38#include <QItemDelegate>
43#include <boost/scope_exit.hpp>
48 class DummyEditorDelegate :
public QItemDelegate {
50 void setModelData(QWidget * , QAbstractItemModel * ,
const QModelIndex & )
const override {}
55 : QMainWindow ( parent ),
81 OpenDB->setEnabled(
false);
84 CreateDatabase->setEnabled(
false);
85 Commit->setEnabled(
false);
87 QMessageBox::information(
this,
89 QString(
"The configuration is opened in archival/detached mode.")
90 .append(
"\nYou can browse or modify objects, but changes cannot be saved or commited."));
99 tableholder->addTab (
new TableTab ( tableholder ),
"Table View" );
100 tableholder->removeTab ( 0 );
102 QPushButton * addtab_button =
new QPushButton (
"+" );
103 tableholder->setCornerWidget ( addtab_button, Qt::TopLeftCorner );
104 connect ( addtab_button, SIGNAL ( clicked() ),
this, SLOT (
slot_add_tab() ) );
106 tableholder->setTabsClosable (
true );
107 connect ( tableholder, SIGNAL ( tabCloseRequested (
int ) ),
this,
113 tableholder->addTab (
new TableTab ( tableholder ),
"Table View" );
114 tableholder->setCurrentIndex ( tableholder->count()-1 );
120 if ( i == -1 || ( ( tableholder->count() == 1 ) && i == 0 ) )
125 QWidget * Widget = tableholder->widget ( i );
127 tableholder->removeTab ( i );
138 setWindowTitle (
"DUNE DAQ Configuration Database Editor (DBE)" );
141 SearchLineTable->hide();
142 SearchLineTable->setClearButtonEnabled(
true);
143 SearchTreeLine->setClearButtonEnabled(
true);
144 CaseSensitiveCheckBoxTable->hide();
145 tableholder->removeTab ( 1 );
148 HelpMenu->setEnabled (
false );
151 Commit->setEnabled (
false );
152 UndoAction->setEnabled (
true );
153 RedoAction->setEnabled (
true );
156 SearchBox->setFocusPolicy ( Qt::ClickFocus );
159 TreeView->setWhatsThis (
"This view shows the classes and objects of the database" );
160 FileView->setWhatsThis (
"This view shows the file structure of the database" );
161 UndoView->setWhatsThis (
"This view shows the commands in the Undo Command stack" );
163 CommittedTable->setHorizontalHeaderLabels(QStringList() <<
"File" <<
"Comment" <<
"Date");
164 CommittedTable->setAlternatingRowColors(
true);
165 CommittedTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
166 CommittedTable->horizontalHeader()->setDefaultSectionSize(250);
167 CommittedTable->setWordWrap(
true);
168 CommittedTable->setTextElideMode(Qt::ElideRight);
169 CommittedTable->setItemDelegate(
new DummyEditorDelegate());
172 InfoWidget->setCurrentIndex (0);
183 connect ( Exit, SIGNAL ( triggered() ),
this, SLOT ( close() ) );
184 connect ( UndoAction, SIGNAL ( triggered() ), UndoView->stack(), SLOT ( undo() ) );
185 connect ( RedoAction, SIGNAL ( triggered() ), UndoView->stack(), SLOT ( redo() ) );
188 connect ( BatchChangeTable, SIGNAL ( triggered() ),
this,
191 connect ( DisplayClassView, SIGNAL ( triggered (
bool ) ), TreeDockWidget,
192 SLOT ( setVisible (
bool ) ) );
193 connect ( DisplayTableView, SIGNAL ( triggered (
bool ) ), TableGroupBox,
194 SLOT ( setVisible (
bool ) ) );
195 connect ( DisplayMessages, SIGNAL ( triggered (
bool ) ), InfoDockWidget,
196 SLOT ( setVisible (
bool ) ) );
197 connect ( DisplayToolbar, SIGNAL ( triggered (
bool ) ), MainToolBar,
198 SLOT ( setVisible (
bool ) ) );
200 connect ( TreeDockWidget, SIGNAL ( visibilityChanged (
bool ) ), DisplayTableView,
201 SLOT ( setChecked (
bool ) ) );
202 connect ( InfoDockWidget , SIGNAL ( visibilityChanged (
bool ) ), DisplayMessages,
203 SLOT ( setChecked (
bool ) ) );
204 connect ( MainToolBar , SIGNAL ( visibilityChanged (
bool ) ), DisplayToolbar,
205 SLOT ( setChecked (
bool ) ) );
208 connect ( LoadDefaultSettings, SIGNAL ( triggered() ),
this,
210 connect ( CreateDatabase, SIGNAL ( triggered() ),
this, SLOT (
slot_create_newdb() ) );
213 connect ( WhatThisAction, SIGNAL ( triggered() ),
this, SLOT (
slot_whatisthis() ) );
217 connect ( TreeView, SIGNAL ( activated ( QModelIndex ) ),
this,
220 connect( &
confaccessor::ref(), SIGNAL(db_committed(
const std::list<std::string>&,
const std::string&)),
this,
235 connect( &
confaccessor::ref(), SIGNAL(db_committed(
const std::list<std::string>&,
const std::string&)),
this,
256 connect ( SearchBox, SIGNAL ( currentIndexChanged(
int) ),
this,
258 connect ( SearchTreeLine, SIGNAL ( textChanged (
const QString & ) ),
this,
260 connect ( SearchTreeLine, SIGNAL ( textEdited (
const QString & ) ),
this,
262 connect ( SearchTreeLine, SIGNAL ( returnPressed() ),
this, SLOT (
slot_filter_query() ) );
263 connect ( SearchLineTable, SIGNAL ( textChanged (
const QString & ) ),
this,
265 connect ( CaseSensitiveCheckBoxTree, SIGNAL ( clicked (
bool ) ),
this,
270 connect ( information_about_dbe, SIGNAL ( triggered() ),
this,
276 SIGNAL ( signal_debug ( QString
const, QString
const ) ),
this,
280 SIGNAL ( signal_info ( QString
const, QString
const ) ),
this,
284 SIGNAL ( signal_note ( QString
const, QString
const ) ),
this,
288 SIGNAL ( signal_warn ( QString
const, QString
const ) ),
this,
292 SIGNAL ( signal_error ( QString
const, QString
const ) ),
this,
296 SIGNAL ( signal_fail ( QString
const, QString
const ) ),
this,
306 {
"Class Name",
"# Objects" };
319 connect (
this_classes, SIGNAL ( ObjectFile ( QString ) ),
326 TreeView->setSortingEnabled (
true );
327 TreeView->resizeColumnToContents ( 0 );
328 TreeView->resizeColumnToContents ( 1 );
331 SLOT ( ToggleEmptyClasses (
bool ) ) );
333 connect ( ShowDerivedObjects, SIGNAL ( toggled (
bool ) ),
this_classes,
334 SLOT ( ToggleAbstractClassesSelectable (
bool ) ) );
342 SearchLineTable->clear();
343 SearchLineTable->show();
344 SearchLineTable->setProperty (
"placeholderText", QVariant ( QString (
"Table Filter" ) ) );
345 CaseSensitiveCheckBoxTable->show();
357 if (
dynamic_cast<ObjectNode *
> ( tree_node ) )
366 QString
const cname = tree_node->
GetData ( 0 ).toString();
371 if ( not cinfo.
p_abstract or ShowDerivedObjects->isChecked() )
373 if (
TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->currentWidget() ) )
375 CurrentTab->CreateModels();
377 CustomDelegate * CurrentDelegate = CurrentTab->GetTableDelegate();
380 connect ( CurrentView, SIGNAL ( OpenEditor (
tref ) ),
this,
382 connect ( CurrentDelegate, SIGNAL ( CreateObjectEditorSignal (
tref ) ),
this,
385 if (
dynamic_cast<ClassNode *
> ( tree_node ) )
387 BOOST_SCOPE_EXIT(CurrentTabModel)
389 emit CurrentTabModel->layoutChanged();
393 emit CurrentTabModel->layoutAboutToBeChanged();
397 tableholder->setTabText ( tableholder->currentIndex(), cname );
398 CurrentTab->ResetTableView();
401 CurrentTab->ResizeHeaders();
422 FileView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
423 FileView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
424 FileView->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
425 FileView->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
444 int DialogResult = SaveDialog->exec();
451 if (!message.isEmpty()) {
452 QMessageBox::warning ( 0,
"Save database", message );
467 if ( not modified.empty() )
471 for ( std::string
const & f : modified )
476 INFO (
"List of modified files committed to the database ",
"Program execution success",
481 WARN (
"Changes where committed successfully but list of modified files could not be retrieved",
482 "Unexpected program execution" );
486 catch ( dunedaq::conffwk::Exception
const & e )
494 catch (daq::dbe::CouldNotCommitChanges
const& exc)
496 std::string reason{exc.what()};
497 auto cause = exc.cause();
498 while (cause !=
nullptr) {
499 reason = cause->what();
500 cause = cause->cause();
502 WARN (
"The changes could not be committed",
505 "\n\nTry fixing includes from File Info window")
530 catch ( dunedaq::conffwk::Exception
const & e )
546 catch ( dunedaq::conffwk::Exception
const & e )
555 bool WidgetFound =
false;
556 QString ObjectEditorName = QString (
"%1@%2" ).arg ( Object.
UID().c_str() ).arg (
559 for ( QWidget * Editor : QApplication::allWidgets() )
563 if ( Widget !=
nullptr )
565 if ( ( Widget->objectName() ).compare ( ObjectEditorName ) == 0 )
568 Widget->setVisible (
true );
585 Batch->setWindowModality ( Qt::WindowModal );
590 ERROR (
"Database must have been loaded",
"No database loaded" );
598 ERROR (
"Database must have been loaded",
"No database loaded" );
603 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->currentWidget() );
608 std::vector<dref> TableObject;
610 if ( !CurrentTab || !CurrentTableModel )
612 ERROR (
"Table cannot be processed",
"Table is empty" );
618 ERROR (
"Table cannot be processed",
"Table is empty" );
622 QString Filter = SearchLineTable->text();
626 if ( Filter.isEmpty() )
628 TableObject.push_back ( Object );
632 QString ObjectString = QString::fromStdString ( Object.UID() );
634 if ( ObjectString.contains ( Filter, Qt::CaseInsensitive ) )
636 TableObject.push_back ( Object );
644 TableObject,
nullptr );
645 Batch->setWindowModality ( Qt::WindowModal );
662 for(
const QString& j : incs) {
676 CreateDatabaseW->show();
677 connect ( CreateDatabaseW, SIGNAL ( CanLoadDatabase (
const QString & ) ),
this,
683 if ( !DatabaseName.isEmpty() )
685 QFileInfo DatabaseFile = QFileInfo ( DatabaseName );
687 if ( DatabaseFile.exists() )
689 QString Path = QString ( DatabaseFile.absoluteFilePath() );
707 WARN (
"File not found during database load",
"File does not exist",
"\n\n Filename:",
708 DatabaseFile.fileName().toStdString() );
713 ERROR (
"Database load error",
"File was not selected" );
721 QMessageBox MessageBox;
723 "Do you really wish to abandon the current database and load a new one ?" );
724 MessageBox.setStandardButtons ( QMessageBox::Yes | QMessageBox::Cancel );
725 MessageBox.setDefaultButton ( QMessageBox::Cancel );
726 int UserOption = MessageBox.exec();
728 switch ( UserOption )
731 case QMessageBox::Yes:
734 case QMessageBox::Cancel:
756 connect(
this, SIGNAL(
signal_db_loaded()), &loop, SLOT(quit()), Qt::QueuedConnection);
761 std::unique_ptr<QProgressDialog> progress_bar;
763 progress_bar.reset(
new QProgressDialog(
"Loading Configuration...", QString(), 0, 0,
this ));
764 progress_bar->setWindowModality ( Qt::WindowModal );
765 progress_bar->show();
768 BOOST_SCOPE_EXIT(
void)
770 QApplication::restoreOverrideCursor();
774 QApplication::setOverrideCursor ( QCursor ( Qt::WaitCursor ) );
777 for ( QWidget * widget : QApplication::allWidgets() )
790 std::future<bool> waiter = std::async ( alreadyLoaded ? std::launch::deferred : std::launch::async, [
this]
800 loop.exec(QEventLoop::ExcludeUserInputEvents);
815 for (
int i = 0; i < tableholder->count(); i++ )
817 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->widget ( i ) );
823 FileView->setModel ( NULL );
829 QSettings * Settings;
830 QString userPath = QDir::homePath() +
"/.conffwk/ATLAS_TDAQ_DBE";
831 QString userFile =
"DBE_User_Settings.conf";
835 if ( QDir ( userPath ).exists ( userFile ) )
836 Settings =
new QSettings (
"ATLAS_TDAQ_DBE",
837 "DBE_User_Settings" );
839 Settings =
new QSettings (
":theme/DBE_Default_User_Settings.conf",
840 QSettings::NativeFormat );
844 Settings =
new QSettings (
":theme/DBE_Default_User_Settings.conf",
845 QSettings::NativeFormat );
848 Settings->beginGroup (
"MainWindow-layout" );
849 resize ( Settings->value (
"size" ).toSize() );
850 move ( Settings->value (
"pos" ).toPoint() );
851 DisplayTableView->setChecked ( Settings->value (
"TableView" ).toBool() );
852 DisplayClassView->setChecked ( Settings->value (
"ClassView" ).toBool() );
854 DisplayMessages->setChecked ( Settings->value (
"Messages" ).toBool() );
855 restoreGeometry ( Settings->value (
"geometry" ).toByteArray() );
856 restoreState ( Settings->value (
"state" ).toByteArray() );
857 Settings->endGroup();
859 Settings->beginGroup (
"MainWindow-checkboxes" );
860 CaseSensitiveCheckBoxTree->setChecked (
861 Settings->value (
"tree-case-sensitive" ).toBool() );
862 CaseSensitiveCheckBoxTable->setChecked (
863 Settings->value (
"table-case-sensitive" ).toBool() );
864 Settings->endGroup();
869 QSettings Settings (
"ATLAS_TDAQ_DBE",
"DBE_User_Settings" );
870 Settings.beginGroup (
"MainWindow-layout" );
871 Settings.setValue (
"size", size() );
872 Settings.setValue (
"pos", pos() );
873 Settings.setValue (
"TableView", DisplayTableView->isChecked() );
874 Settings.setValue (
"ClassView", DisplayClassView->isChecked() );
876 Settings.setValue (
"Messages", DisplayMessages->isChecked() );
877 Settings.setValue (
"geometry", saveGeometry() );
878 Settings.setValue (
"state", saveState() );
881 Settings.beginGroup (
"MainWindow-checkboxes" );
882 Settings.setValue (
"tree-case-sensitive", CaseSensitiveCheckBoxTree->isChecked() );
883 Settings.setValue (
"table-case-sensitive", CaseSensitiveCheckBoxTable->isChecked() );
889 if ( !opts.isEmpty() )
894 QString FileName = opts.value (
"f" );
895 QString RdbFileName = opts.value (
"r" );
896 QString RoksFileName = opts.value (
"o" );
897 QString HashVersion = opts.value (
"v" );
899 if ( !FileName.isEmpty() )
901 FileToLoad = FileName;
904 if ( !HashVersion.isEmpty() )
906 ::setenv(
"TDAQ_DB_VERSION", QString(
"hash:").append(HashVersion).toStdString().c_str(), 1);
907 ::setenv(
"OKS_GIT_PROTOCOL",
"http", 1);
911 else if ( !RdbFileName.isEmpty() )
913 FileToLoad = RdbFileName;
916 else if ( !RoksFileName.isEmpty() )
918 FileToLoad = RoksFileName;
922 if ( not FileToLoad.isEmpty() )
924 dbopen ( FileToLoad, LoadConfig );
1101 QWhatsThis::enterWhatsThisMode();
1106 static QString
const title (
"About DBE" );
1107 static QString
const msg = QString().
1108 append (
"DBE is an editor to work with OKS and RDB backends that manages most of the hard work for you in editing the configuration database\n" ).
1109 append (
"\n\nMaintained :\t\tC&C Working group \n\t\t\t(atlas-tdaq-cc-wg@cern.ch)" ).
1111 append (
"\nLibraries version:\t" ).
1118 QMessageBox::about (
this, title, msg );
1123 QDesktopServices::openUrl ( QUrl (
"https://atlasdaq.cern.ch/dbe/" ) );
1128 InfoWidget->setCurrentIndex ( InfoWidget->indexOf ( CommitedTab ) );
1133 UndoView->stack()->setIndex ( 0 );
1138 if ( CaseSensitiveCheckBoxTree->isChecked() )
1140 Qt::CaseSensitive );
1155 for (
int i = 0; i < tableholder->count(); i++ )
1157 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->widget ( i ) );
1163 FileView->setModel ( NULL );
1175 if ( SearchBox->currentIndex() == 2 )
1197 QString Tmp = SearchTreeLine->text();
1198 if ( SearchBox->currentIndex() == 1 )
1215 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->currentWidget() );
1221 if ( TableFilter ==
nullptr )
1228 if ( CaseSensitiveCheckBoxTable->isChecked() )
1229 TableFilter->setFilterCaseSensitivity (
1230 Qt::CaseSensitive );
1233 TableFilter->setFilterCaseSensitivity ( Qt::CaseInsensitive );
1236 TableFilter->setFilterRegExp ( FilterText );
1243 int IndexOfCurrentTab = tableholder->currentIndex();
1246 std::vector<QModelIndex> idxs;
1248 for(
int i = 0; i < tableholder->count(); ++i) {
1253 if(!TableClassName.isEmpty()) {
1255 if(NodeClass !=
nullptr) {
1264 while(tableholder->count() != 0) {
1265 tableholder->widget(0)->deleteLater();
1266 tableholder->removeTab(0);
1273 for(
const auto& idx : idxs) {
1279 tableholder->setCurrentIndex ( IndexOfCurrentTab );
1288 total += data.toInt();
1290 TotalObjectsLabel->setText (
1291 QString (
"Total Objects: %1" ).arg ( total ) );
1300 foreach ( QWidget * widget, QApplication::allWidgets() ) widget->close();
1312 if ( not Tmp.isEmpty() )
1314 QString
const Query = QString (
"(this (object-id \".*%1.*\" ~=))" ).arg ( Tmp );
1318 std::vector<dbe::tref> result;
1321 std::vector<std::string >> () )
1324 cname, Query.toStdString() );
1326 result.insert ( result.end(), class_matching_objects.begin(),
1327 class_matching_objects.end() );
1332 catch ( dunedaq::conffwk::Exception
const & ex )
1345 if ( Target == SearchBox->lineEdit() && Event->type() == QEvent::MouseButtonRelease )
1347 if ( !SearchBox->lineEdit()->hasSelectedText() )
1349 SearchBox->lineEdit()->selectAll();
1361 foreach ( QWidget * widget, QApplication::allWidgets() )
1366 if ( ObjectEditorInstance )
1376 if ( ObjectCreatorInstance )
1378 OK = ObjectCreatorInstance->
CanClose();
1390 if ( undo_stack->isClean() )
1392 if ( undo_stack->count() == 0 )
1405 QMessageBox::question (
1409 "There are unsaved changes.\n\nDo you want to save and commit them to the DB?\n" ),
1410 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
1411 QMessageBox::Save );
1413 if ( ret == QMessageBox::Discard )
1418 else if ( ret == QMessageBox::Save )
1422 else if ( ret == QMessageBox::Cancel )
1450 BOOST_SCOPE_EXIT(
void)
1452 QApplication::restoreOverrideCursor();
1454 BOOST_SCOPE_EXIT_END
1456 QApplication::setOverrideCursor(Qt::WaitCursor);
1473 QFileDialog FileDialog (
this, tr (
"Open File" ),
".", tr (
"XML files (*.xml)" ) );
1474 FileDialog.setAcceptMode ( QFileDialog::AcceptOpen );
1475 FileDialog.setFileMode ( QFileDialog::ExistingFile );
1476 FileDialog.setViewMode ( QFileDialog::Detail );
1478 if ( FileDialog.exec() )
1480 QStringList FilesSelected = FileDialog.selectedFiles();
1482 if ( FilesSelected.size() )
1484 QString DatabasePath = FilesSelected.value ( 0 );
1503 auto user_confirmation = [] ( QString
const & msg )
1505 QMessageBox ExternalMessageBox;
1506 ExternalMessageBox.setText ( msg );
1507 ExternalMessageBox.setStandardButtons ( QMessageBox::Yes | QMessageBox::No );
1508 ExternalMessageBox.setDefaultButton ( QMessageBox::Yes );
1509 return ExternalMessageBox.exec() == QMessageBox::Yes;
1514 auto rewind_stack = [&undo_stack] ()
1516 std::vector<bool > commands_original_undo_state;
1522 for (
int i = 0; i < undo_stack->count(); ++i )
1528 commands_original_undo_state.push_back ( Command->undoable() );
1529 Command->setundoable (
false );
1535 undo_stack->setIndex ( 0 );
1539 auto cmdstate = commands_original_undo_state.begin();
1541 for (
int i = 0; i != undo_stack->count(); ++i )
1547 Command->setundoable ( *cmdstate++ );
1554 for ( QWidget * widget : QApplication::allWidgets() )
1563 if ( undo_stack->count() != 0 )
1565 const QString msg = QString(
"External changes to the database have been applied. Do you want to replay your changes on top? ")
1566 + QString(
" Otherwise any local change will be lost.\n");
1567 if ( user_confirmation ( msg ) )
1575 while ( not internal_changes->empty() )
1577 internal_changes_reverse_copy.push ( internal_changes->top() );
1578 internal_changes->pop();
1582 for (
int i = 0; i < undo_stack->count(); ++i )
1585 internal_changes_reverse_copy.pop();
1586 internal_changes->push ( Change );
1632 catch ( dunedaq::conffwk::Exception
const & e )
1634 WARN (
"Object reference could not be changed",
1640 WARN (
"Unknown exception during object modification",
"s",
1641 "\n\nFor object with UID:", Change.
uid.c_str(),
"of class:",
1651 INFO (
"Database reloaded due external changes",
"Database consistency enforcement" );
1669 QWidgetList allwidgets = QApplication::topLevelWidgets();
1671 QWidgetList::iterator it = allwidgets.begin();
1672 MainWindow * main_win = qobject_cast<MainWindow *> ( *it );
1674 for ( ; it != allwidgets.end() and main_win ==
nullptr; ++it )
1676 main_win = qobject_cast<MainWindow *> ( *it );
1693 const int MAX_MESSAGE_LENGTH = 500;
1698 QMessageBox mb(
this);
1699 mb.setIcon(QMessageBox::Icon::Critical);
1700 mb.setWindowTitle(title);
1701 mb.setStandardButtons(QMessageBox::Ok);
1702 if(msg.length() > MAX_MESSAGE_LENGTH) {
1703 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1705 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1706 mb.setInformativeText(m);
1707 mb.setDetailedText(msg);
1724 QMessageBox mb(
this);
1725 mb.setIcon(QMessageBox::Icon::Information);
1726 mb.setWindowTitle(title);
1727 mb.setStandardButtons(QMessageBox::Ok);
1728 if(msg.length() > MAX_MESSAGE_LENGTH) {
1729 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1731 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1732 mb.setInformativeText(m);
1733 mb.setDetailedText(msg);
1750 QMessageBox mb(
this);
1751 mb.setIcon(QMessageBox::Icon::Information);
1752 mb.setWindowTitle(title);
1753 mb.setStandardButtons(QMessageBox::Ok);
1754 if(msg.length() > MAX_MESSAGE_LENGTH) {
1755 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1757 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1758 mb.setInformativeText(m);
1759 mb.setDetailedText(msg);
1776 QMessageBox mb(
this);
1777 mb.setIcon(QMessageBox::Icon::Information);
1778 mb.setWindowTitle(title);
1779 mb.setStandardButtons(QMessageBox::Ok);
1780 if(msg.length() > MAX_MESSAGE_LENGTH) {
1781 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1783 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1784 mb.setInformativeText(m);
1785 mb.setDetailedText(msg);
1802 QMessageBox mb(
this);
1803 mb.setIcon(QMessageBox::Icon::Critical);
1804 mb.setWindowTitle(title);
1805 mb.setStandardButtons(QMessageBox::Ok);
1806 if(msg.length() > MAX_MESSAGE_LENGTH) {
1807 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1809 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1810 mb.setInformativeText(m);
1811 mb.setDetailedText(msg);
1828 QMessageBox mb(
this);
1829 mb.setIcon(QMessageBox::Icon::Warning);
1830 mb.setWindowTitle(title);
1831 mb.setStandardButtons(QMessageBox::Ok);
1832 if(msg.length() > MAX_MESSAGE_LENGTH) {
1833 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1835 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1836 mb.setInformativeText(m);
1837 mb.setDetailedText(msg);
1859 std::vector<dbe::dref> objects;
1860 for(
const auto& o : objs) {
1873 for (
int i = 0; i < tableholder->count(); i++ )
1875 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->widget ( i ) );
1879 m->objectsUpdated(objects);
1894 if(uncommittedFiles.empty() ==
true) {
1895 Commit->setEnabled(
false);
1896 Commit->setToolTip(
"There is nothing to commit");
1898 Commit->setEnabled(
true);
1901 for(
const std::string& f : uncommittedFiles) {
1902 l +=
" " + f +
"\n";
1905 Commit->setToolTip(QString::fromStdString(
"Commit changes.\nHere are the uncommitted files:\n" + l));
1911 Commit->setEnabled(
false);
1916 for(
const std::string& f : files) {
1917 CommittedTable->insertRow(0);
1918 CommittedTable->setItem(0, 0,
new QTableWidgetItem(QString::fromStdString(f)));
1919 CommittedTable->setItem(0, 1,
new QTableWidgetItem(QString::fromStdString(msg)));
1920 CommittedTable->setItem(0, 2,
new QTableWidgetItem(QDate::currentDate().toString() +
" " + QTime::currentTime().toString()));
1923 CommittedTable->resizeColumnsToContents();
char const *const dbe_lib_core_version
Including DBE.
QString GetCommitMessage() const
static void parse_all_objects()
static QString check_file_includes(const QString &file)
static void show_file_info(const QString &filename)
void slot_fetch_data(treenode const *)
void slot_information_message(QString const, QString const)
void edit_object_at(const QModelIndex &Index)
bool dbopen(QString const &, dbinfo const &)
void slot_show_userchanges()
void slot_update_committed_files(const std::list< std::string > &, const std::string &)
void slot_warning_message(QString const, QString const)
std::atomic< bool > isArchivedConf
void slot_batch_change_start()
void LoadDefaultSetting()
void slot_loaded_db_file(QString)
void slot_batch_change_stop(const QList< QPair< QString, QString > > &)
void slot_remove_tab(int i)
dbe::models::tree * this_classes
void slot_launch_object_editor(tref)
void slot_abort_changes()
void slot_process_externalchanges()
void slot_toggle_casesensitive_for_treeview(bool)
void load_settings(bool LoadSettings=false)
void slot_launch_batchchange_on_table()
void build_class_tree_model()
void slot_toggle_commit_button()
void closeEvent(QCloseEvent *event)
void slot_load_db_from_create_widget(const QString &)
bool slot_commit_database(bool Exit=false)
void argsparse(QMap< QString, QString > const &)
void slot_launch_batchchange()
cptr< dbe::CustomTreeView > get_view() const
models::treeselection * this_treefilter
void slot_debuginfo_message(QString const, QString const)
void slot_error_message(QString const, QString const)
bool eventFilter(QObject *Target, QEvent *Event)
void slot_open_database_from_file()
void slot_abort_external_changes()
void signal_new_file_model()
QString find_db_repository_dir()
void slot_show_userguide()
static MainWindow * findthis()
void slot_undo_allchanges()
void slot_failure_message(QString const, QString const)
void slot_model_rebuild()
bool m_batch_change_in_progress
void slot_edit_object_from_class_view(QModelIndex const &)
void slot_filter_table_textchange(const QString &)
void slot_filter_textchange(const QString &)
void signal_externalchanges_processed()
std::vector< dbe::tref > ProcessQuery(QString const &)
void signal_batch_change_stopped(const QList< QPair< QString, QString > > &)
void update_total_objects()
MainWindow(QMap< QString, QString > const &CommandLine, QWidget *parent=nullptr)
void slot_notice_message(QString const, QString const)
QSortFilterProxyModel this_filesort
void slot_show_information_about_dbe()
static void InitColorManagement()
dbe::models::table * GetTableModel() const
dbe::models::tableselection * GetTableFilter() const
void setundoable(bool s=true) const
void setredoable(bool s=true) const
static cptr< datahandler > gethandler()
static t_undo_stack_cptr get_commands()
static bool is_database_loaded()
cptr< t_undo_stack > t_undo_stack_cptr
static std::list< std::string > uncommitted_files()
std::stack< t_internal_change, std::vector< t_internal_change > > t_internal_changes_stack
static void set_total_objects(int const i)
static void clear_commands()
static QString dbfullname()
static t_internal_changes_stack_cptr get_internal_change_stack()
static bool load(bool subscribeToChanges=true)
static std::list< std::string > save(QString const &)
static void setdbinfo(QString const &location, dbinfo const itype=dbinfo::oks)
static confaccessor & ref()
static QString db_implementation_name()
static QStringList inclusions(QStringList const &candidates, QStringList files={ })
static dunedaq::conffwk::class_t definition(std::string const &cn, bool direct_only)
std::string class_name() const
static std::vector< configobject::tref > gets(std::string const &cname, std::string const &query="")
static configobject::tref get(dbe::cokey const &desc)
static messenger_proxy & ref()
QList< dbe::dref > * GetTableObjects()
QString get_class_name() const
bool BuildTableFromClass(const QString &ClassName, bool BuildSubClasses=false)
void SetFilterType(FilterType Filter)
virtual QVariant GetData(const int Column, int role=Qt::DisplayRole) const
char const *const dbe_lib_internal_version
char const *const dbe_lib_config_api_version
bool has_obj(std::string const &classname, std::string const &object_uid)
std::string const parse(ers::Issue const &)
inner::configobject::tref tref
config_object_description dref
void error(const Issue &issue)
modification request
Type of modification.
std::string uid
Object Identification.
char const *const dbe_lib_structure_version
Including QT Headers.
#define dbe_compiled_version
#define dbe_compiled_commit