24#include <QProgressDialog>
30#include <QDesktopServices>
32#include <QApplication>
33#include <QItemDelegate>
38#include <boost/scope_exit.hpp>
43 class DummyEditorDelegate :
public QItemDelegate {
45 void setModelData(QWidget * , QAbstractItemModel * ,
const QModelIndex & )
const override {}
50 : QMainWindow ( parent ),
76 OpenDB->setEnabled(
false);
79 CreateDatabase->setEnabled(
false);
80 Commit->setEnabled(
false);
82 QMessageBox::information(
this,
84 QString(
"The configuration is opened in archival/detached mode.")
85 .append(
"\nYou can browse or modify objects, but changes cannot be saved or commited."));
94 tableholder->addTab (
new TableTab ( tableholder ),
"Table View" );
95 tableholder->removeTab ( 0 );
97 QPushButton * addtab_button =
new QPushButton (
"+" );
98 tableholder->setCornerWidget ( addtab_button, Qt::TopLeftCorner );
99 connect ( addtab_button, SIGNAL ( clicked() ),
this, SLOT (
slot_add_tab() ) );
101 tableholder->setTabsClosable (
true );
102 connect ( tableholder, SIGNAL ( tabCloseRequested (
int ) ),
this,
108 tableholder->addTab (
new TableTab ( tableholder ),
"Table View" );
109 tableholder->setCurrentIndex ( tableholder->count()-1 );
115 if ( i == -1 || ( ( tableholder->count() == 1 ) && i == 0 ) )
120 QWidget * Widget = tableholder->widget ( i );
122 tableholder->removeTab ( i );
133 setWindowTitle (
"DUNE DAQ Configuration Database Editor (DBE)" );
136 SearchLineTable->hide();
137 SearchLineTable->setClearButtonEnabled(
true);
138 SearchTreeLine->setClearButtonEnabled(
true);
139 CaseSensitiveCheckBoxTable->hide();
140 tableholder->removeTab ( 1 );
143 HelpMenu->setEnabled (
false );
146 Commit->setEnabled (
false );
147 UndoAction->setEnabled (
true );
148 RedoAction->setEnabled (
true );
151 SearchBox->setFocusPolicy ( Qt::ClickFocus );
154 TreeView->setWhatsThis (
"This view shows the classes and objects of the database" );
155 FileView->setWhatsThis (
"This view shows the file structure of the database" );
156 UndoView->setWhatsThis (
"This view shows the commands in the Undo Command stack" );
158 CommittedTable->setHorizontalHeaderLabels(QStringList() <<
"File" <<
"Comment" <<
"Date");
159 CommittedTable->setAlternatingRowColors(
true);
160 CommittedTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
161 CommittedTable->horizontalHeader()->setDefaultSectionSize(250);
162 CommittedTable->setWordWrap(
true);
163 CommittedTable->setTextElideMode(Qt::ElideRight);
164 CommittedTable->setItemDelegate(
new DummyEditorDelegate());
167 InfoWidget->setCurrentIndex (0);
178 connect ( Exit, SIGNAL ( triggered() ),
this, SLOT ( close() ) );
179 connect ( UndoAction, SIGNAL ( triggered() ), UndoView->stack(), SLOT ( undo() ) );
180 connect ( RedoAction, SIGNAL ( triggered() ), UndoView->stack(), SLOT ( redo() ) );
183 connect ( BatchChangeTable, SIGNAL ( triggered() ),
this,
186 connect ( DisplayClassView, SIGNAL ( triggered (
bool ) ), TreeDockWidget,
187 SLOT ( setVisible (
bool ) ) );
188 connect ( DisplayTableView, SIGNAL ( triggered (
bool ) ), TableGroupBox,
189 SLOT ( setVisible (
bool ) ) );
190 connect ( DisplayMessages, SIGNAL ( triggered (
bool ) ), InfoDockWidget,
191 SLOT ( setVisible (
bool ) ) );
192 connect ( DisplayToolbar, SIGNAL ( triggered (
bool ) ), MainToolBar,
193 SLOT ( setVisible (
bool ) ) );
195 connect ( TreeDockWidget, SIGNAL ( visibilityChanged (
bool ) ), DisplayTableView,
196 SLOT ( setChecked (
bool ) ) );
197 connect ( InfoDockWidget , SIGNAL ( visibilityChanged (
bool ) ), DisplayMessages,
198 SLOT ( setChecked (
bool ) ) );
199 connect ( MainToolBar , SIGNAL ( visibilityChanged (
bool ) ), DisplayToolbar,
200 SLOT ( setChecked (
bool ) ) );
203 connect ( LoadDefaultSettings, SIGNAL ( triggered() ),
this,
205 connect ( CreateDatabase, SIGNAL ( triggered() ),
this, SLOT (
slot_create_newdb() ) );
208 connect ( WhatThisAction, SIGNAL ( triggered() ),
this, SLOT (
slot_whatisthis() ) );
212 connect ( TreeView, SIGNAL ( activated ( QModelIndex ) ),
this,
215 connect( &
confaccessor::ref(), SIGNAL(db_committed(
const std::list<std::string>&,
const std::string&)),
this,
230 connect( &
confaccessor::ref(), SIGNAL(db_committed(
const std::list<std::string>&,
const std::string&)),
this,
251 connect ( SearchBox, SIGNAL ( currentIndexChanged(
int) ),
this,
253 connect ( SearchTreeLine, SIGNAL ( textChanged (
const QString & ) ),
this,
255 connect ( SearchTreeLine, SIGNAL ( textEdited (
const QString & ) ),
this,
257 connect ( SearchTreeLine, SIGNAL ( returnPressed() ),
this, SLOT (
slot_filter_query() ) );
258 connect ( SearchLineTable, SIGNAL ( textChanged (
const QString & ) ),
this,
260 connect ( CaseSensitiveCheckBoxTree, SIGNAL ( clicked (
bool ) ),
this,
265 connect ( information_about_dbe, SIGNAL ( triggered() ),
this,
271 SIGNAL ( signal_debug ( QString
const, QString
const ) ),
this,
275 SIGNAL ( signal_info ( QString
const, QString
const ) ),
this,
279 SIGNAL ( signal_note ( QString
const, QString
const ) ),
this,
283 SIGNAL ( signal_warn ( QString
const, QString
const ) ),
this,
287 SIGNAL ( signal_error ( QString
const, QString
const ) ),
this,
291 SIGNAL ( signal_fail ( QString
const, QString
const ) ),
this,
301 {
"Class Name",
"# Objects" };
314 connect (
this_classes, SIGNAL ( ObjectFile ( QString ) ),
321 TreeView->setSortingEnabled (
true );
322 TreeView->resizeColumnToContents ( 0 );
323 TreeView->resizeColumnToContents ( 1 );
326 SLOT ( ToggleEmptyClasses (
bool ) ) );
328 connect ( ShowDerivedObjects, SIGNAL ( toggled (
bool ) ),
this_classes,
329 SLOT ( ToggleAbstractClassesSelectable (
bool ) ) );
337 SearchLineTable->clear();
338 SearchLineTable->show();
339 SearchLineTable->setProperty (
"placeholderText", QVariant ( QString (
"Table Filter" ) ) );
340 CaseSensitiveCheckBoxTable->show();
352 if (
dynamic_cast<ObjectNode *
> ( tree_node ) )
361 QString
const cname = tree_node->
GetData ( 0 ).toString();
366 if ( not cinfo.
p_abstract or ShowDerivedObjects->isChecked() )
368 if (
TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->currentWidget() ) )
370 CurrentTab->CreateModels();
372 CustomDelegate * CurrentDelegate = CurrentTab->GetTableDelegate();
375 connect ( CurrentView, SIGNAL ( OpenEditor (
tref ) ),
this,
377 connect ( CurrentDelegate, SIGNAL ( CreateObjectEditorSignal (
tref ) ),
this,
380 if (
dynamic_cast<ClassNode *
> ( tree_node ) )
382 BOOST_SCOPE_EXIT(CurrentTabModel)
384 emit CurrentTabModel->layoutChanged();
388 emit CurrentTabModel->layoutAboutToBeChanged();
392 tableholder->setTabText ( tableholder->currentIndex(), cname );
393 CurrentTab->ResetTableView();
396 CurrentTab->ResizeHeaders();
417 FileView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
418 FileView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
419 FileView->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
420 FileView->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
439 int DialogResult = SaveDialog->exec();
446 if (!message.isEmpty()) {
447 QMessageBox::warning ( 0,
"Save database", message );
462 if ( not modified.empty() )
466 for ( std::string
const & f : modified )
471 INFO (
"List of modified files committed to the database ",
"Program execution success",
476 WARN (
"Changes where committed successfully but list of modified files could not be retrieved",
477 "Unexpected program execution" );
481 catch ( dunedaq::conffwk::Exception
const & e )
489 catch (daq::dbe::CouldNotCommitChanges
const& exc)
491 std::string reason{exc.what()};
492 auto cause = exc.cause();
493 while (cause !=
nullptr) {
494 reason = cause->what();
495 cause = cause->cause();
497 WARN (
"The changes could not be committed",
500 "\n\nTry fixing includes from File Info window")
525 catch ( dunedaq::conffwk::Exception
const & e )
541 catch ( dunedaq::conffwk::Exception
const & e )
550 bool WidgetFound =
false;
551 QString ObjectEditorName = QString (
"%1@%2" ).arg ( Object.
UID().c_str() ).arg (
554 for ( QWidget * Editor : QApplication::allWidgets() )
558 if ( Widget !=
nullptr )
560 if ( ( Widget->objectName() ).compare ( ObjectEditorName ) == 0 )
563 Widget->setVisible (
true );
580 Batch->setWindowModality ( Qt::WindowModal );
585 ERROR (
"Database must have been loaded",
"No database loaded" );
593 ERROR (
"Database must have been loaded",
"No database loaded" );
598 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->currentWidget() );
603 std::vector<dref> TableObject;
605 if ( !CurrentTab || !CurrentTableModel )
607 ERROR (
"Table cannot be processed",
"Table is empty" );
613 ERROR (
"Table cannot be processed",
"Table is empty" );
617 QString Filter = SearchLineTable->text();
621 if ( Filter.isEmpty() )
623 TableObject.push_back ( Object );
627 QString ObjectString = QString::fromStdString ( Object.UID() );
629 if ( ObjectString.contains ( Filter, Qt::CaseInsensitive ) )
631 TableObject.push_back ( Object );
639 TableObject,
nullptr );
640 Batch->setWindowModality ( Qt::WindowModal );
657 for(
const QString& j : incs) {
671 CreateDatabaseW->show();
672 connect ( CreateDatabaseW, SIGNAL ( CanLoadDatabase (
const QString & ) ),
this,
678 if ( !DatabaseName.isEmpty() )
680 QFileInfo DatabaseFile = QFileInfo ( DatabaseName );
682 if ( DatabaseFile.exists() )
684 QString Path = QString ( DatabaseFile.absoluteFilePath() );
702 WARN (
"File not found during database load",
"File does not exist",
"\n\n Filename:",
703 DatabaseFile.fileName().toStdString() );
708 ERROR (
"Database load error",
"File was not selected" );
716 QMessageBox MessageBox;
718 "Do you really wish to abandon the current database and load a new one ?" );
719 MessageBox.setStandardButtons ( QMessageBox::Yes | QMessageBox::Cancel );
720 MessageBox.setDefaultButton ( QMessageBox::Cancel );
721 int UserOption = MessageBox.exec();
723 switch ( UserOption )
726 case QMessageBox::Yes:
729 case QMessageBox::Cancel:
751 connect(
this, SIGNAL(
signal_db_loaded()), &loop, SLOT(quit()), Qt::QueuedConnection);
756 std::unique_ptr<QProgressDialog> progress_bar;
758 progress_bar.reset(
new QProgressDialog(
"Loading Configuration...", QString(), 0, 0,
this ));
759 progress_bar->setWindowModality ( Qt::WindowModal );
760 progress_bar->show();
763 BOOST_SCOPE_EXIT(
void)
765 QApplication::restoreOverrideCursor();
769 QApplication::setOverrideCursor ( QCursor ( Qt::WaitCursor ) );
772 for ( QWidget * widget : QApplication::allWidgets() )
785 std::future<bool> waiter = std::async ( alreadyLoaded ? std::launch::deferred : std::launch::async, [
this]
795 loop.exec(QEventLoop::ExcludeUserInputEvents);
810 for (
int i = 0; i < tableholder->count(); i++ )
812 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->widget ( i ) );
818 FileView->setModel ( NULL );
824 QSettings * Settings;
825 QString userPath = QDir::homePath() +
"/.conffwk/ATLAS_TDAQ_DBE";
826 QString userFile =
"DBE_User_Settings.conf";
830 if ( QDir ( userPath ).exists ( userFile ) )
831 Settings =
new QSettings (
"ATLAS_TDAQ_DBE",
832 "DBE_User_Settings" );
834 Settings =
new QSettings (
":theme/DBE_Default_User_Settings.conf",
835 QSettings::NativeFormat );
839 Settings =
new QSettings (
":theme/DBE_Default_User_Settings.conf",
840 QSettings::NativeFormat );
843 Settings->beginGroup (
"MainWindow-layout" );
844 resize ( Settings->value (
"size" ).toSize() );
845 move ( Settings->value (
"pos" ).toPoint() );
846 DisplayTableView->setChecked ( Settings->value (
"TableView" ).toBool() );
847 DisplayClassView->setChecked ( Settings->value (
"ClassView" ).toBool() );
849 DisplayMessages->setChecked ( Settings->value (
"Messages" ).toBool() );
850 restoreGeometry ( Settings->value (
"geometry" ).toByteArray() );
851 restoreState ( Settings->value (
"state" ).toByteArray() );
852 Settings->endGroup();
854 Settings->beginGroup (
"MainWindow-checkboxes" );
855 CaseSensitiveCheckBoxTree->setChecked (
856 Settings->value (
"tree-case-sensitive" ).toBool() );
857 CaseSensitiveCheckBoxTable->setChecked (
858 Settings->value (
"table-case-sensitive" ).toBool() );
859 Settings->endGroup();
864 QSettings Settings (
"ATLAS_TDAQ_DBE",
"DBE_User_Settings" );
865 Settings.beginGroup (
"MainWindow-layout" );
866 Settings.setValue (
"size", size() );
867 Settings.setValue (
"pos", pos() );
868 Settings.setValue (
"TableView", DisplayTableView->isChecked() );
869 Settings.setValue (
"ClassView", DisplayClassView->isChecked() );
871 Settings.setValue (
"Messages", DisplayMessages->isChecked() );
872 Settings.setValue (
"geometry", saveGeometry() );
873 Settings.setValue (
"state", saveState() );
876 Settings.beginGroup (
"MainWindow-checkboxes" );
877 Settings.setValue (
"tree-case-sensitive", CaseSensitiveCheckBoxTree->isChecked() );
878 Settings.setValue (
"table-case-sensitive", CaseSensitiveCheckBoxTable->isChecked() );
884 if ( !opts.isEmpty() )
889 QString FileName = opts.value (
"f" );
890 QString RdbFileName = opts.value (
"r" );
891 QString RoksFileName = opts.value (
"o" );
892 QString HashVersion = opts.value (
"v" );
894 if ( !FileName.isEmpty() )
896 FileToLoad = FileName;
899 if ( !HashVersion.isEmpty() )
901 ::setenv(
"TDAQ_DB_VERSION", QString(
"hash:").append(HashVersion).toStdString().c_str(), 1);
902 ::setenv(
"OKS_GIT_PROTOCOL",
"http", 1);
906 else if ( !RdbFileName.isEmpty() )
908 FileToLoad = RdbFileName;
911 else if ( !RoksFileName.isEmpty() )
913 FileToLoad = RoksFileName;
917 if ( not FileToLoad.isEmpty() )
919 dbopen ( FileToLoad, LoadConfig );
1096 QWhatsThis::enterWhatsThisMode();
1101 static QString
const title (
"About DBE" );
1102 static QString
const msg = QString().
1103 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" ).
1104 append (
"\n\nMaintained :\t\tC&C Working group \n\t\t\t(atlas-tdaq-cc-wg@cern.ch)" ).
1106 append (
"\nLibraries version:\t" ).
1113 QMessageBox::about (
this, title, msg );
1118 QDesktopServices::openUrl ( QUrl (
"https://atlasdaq.cern.ch/dbe/" ) );
1123 InfoWidget->setCurrentIndex ( InfoWidget->indexOf ( CommitedTab ) );
1128 UndoView->stack()->setIndex ( 0 );
1133 if ( CaseSensitiveCheckBoxTree->isChecked() )
1135 Qt::CaseSensitive );
1150 for (
int i = 0; i < tableholder->count(); i++ )
1152 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->widget ( i ) );
1158 FileView->setModel ( NULL );
1170 if ( SearchBox->currentIndex() == 2 )
1192 QString Tmp = SearchTreeLine->text();
1193 if ( SearchBox->currentIndex() == 1 )
1210 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->currentWidget() );
1216 if ( TableFilter ==
nullptr )
1223 if ( CaseSensitiveCheckBoxTable->isChecked() )
1224 TableFilter->setFilterCaseSensitivity (
1225 Qt::CaseSensitive );
1228 TableFilter->setFilterCaseSensitivity ( Qt::CaseInsensitive );
1231 TableFilter->setFilterRegExp ( FilterText );
1238 int IndexOfCurrentTab = tableholder->currentIndex();
1241 std::vector<QModelIndex> idxs;
1243 for(
int i = 0; i < tableholder->count(); ++i) {
1248 if(!TableClassName.isEmpty()) {
1250 if(NodeClass !=
nullptr) {
1259 while(tableholder->count() != 0) {
1260 tableholder->widget(0)->deleteLater();
1261 tableholder->removeTab(0);
1268 for(
const auto& idx : idxs) {
1274 tableholder->setCurrentIndex ( IndexOfCurrentTab );
1283 total += data.toInt();
1285 TotalObjectsLabel->setText (
1286 QString (
"Total Objects: %1" ).arg ( total ) );
1295 foreach ( QWidget * widget, QApplication::allWidgets() ) widget->close();
1307 if ( not Tmp.isEmpty() )
1309 QString
const Query = QString (
"(this (object-id \".*%1.*\" ~=))" ).arg ( Tmp );
1313 std::vector<dbe::tref> result;
1316 std::vector<std::string >> () )
1319 cname, Query.toStdString() );
1321 result.insert ( result.end(), class_matching_objects.begin(),
1322 class_matching_objects.end() );
1327 catch ( dunedaq::conffwk::Exception
const & ex )
1340 if ( Target == SearchBox->lineEdit() && Event->type() == QEvent::MouseButtonRelease )
1342 if ( !SearchBox->lineEdit()->hasSelectedText() )
1344 SearchBox->lineEdit()->selectAll();
1356 foreach ( QWidget * widget, QApplication::allWidgets() )
1361 if ( ObjectEditorInstance )
1371 if ( ObjectCreatorInstance )
1373 OK = ObjectCreatorInstance->
CanClose();
1385 if ( undo_stack->isClean() )
1387 if ( undo_stack->count() == 0 )
1400 QMessageBox::question (
1404 "There are unsaved changes.\n\nDo you want to save and commit them to the DB?\n" ),
1405 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
1406 QMessageBox::Save );
1408 if ( ret == QMessageBox::Discard )
1413 else if ( ret == QMessageBox::Save )
1417 else if ( ret == QMessageBox::Cancel )
1445 BOOST_SCOPE_EXIT(
void)
1447 QApplication::restoreOverrideCursor();
1449 BOOST_SCOPE_EXIT_END
1451 QApplication::setOverrideCursor(Qt::WaitCursor);
1468 QFileDialog FileDialog (
this, tr (
"Open File" ),
".", tr (
"XML files (*.xml)" ) );
1469 FileDialog.setAcceptMode ( QFileDialog::AcceptOpen );
1470 FileDialog.setFileMode ( QFileDialog::ExistingFile );
1471 FileDialog.setViewMode ( QFileDialog::Detail );
1473 if ( FileDialog.exec() )
1475 QStringList FilesSelected = FileDialog.selectedFiles();
1477 if ( FilesSelected.size() )
1479 QString DatabasePath = FilesSelected.value ( 0 );
1498 auto user_confirmation = [] ( QString
const & msg )
1500 QMessageBox ExternalMessageBox;
1501 ExternalMessageBox.setText ( msg );
1502 ExternalMessageBox.setStandardButtons ( QMessageBox::Yes | QMessageBox::No );
1503 ExternalMessageBox.setDefaultButton ( QMessageBox::Yes );
1504 return ExternalMessageBox.exec() == QMessageBox::Yes;
1509 auto rewind_stack = [&undo_stack] ()
1511 std::vector<bool > commands_original_undo_state;
1517 for (
int i = 0; i < undo_stack->count(); ++i )
1523 commands_original_undo_state.push_back ( Command->undoable() );
1524 Command->setundoable (
false );
1530 undo_stack->setIndex ( 0 );
1534 auto cmdstate = commands_original_undo_state.begin();
1536 for (
int i = 0; i != undo_stack->count(); ++i )
1542 Command->setundoable ( *cmdstate++ );
1549 for ( QWidget * widget : QApplication::allWidgets() )
1558 if ( undo_stack->count() != 0 )
1560 const QString msg = QString(
"External changes to the database have been applied. Do you want to replay your changes on top? ")
1561 + QString(
" Otherwise any local change will be lost.\n");
1562 if ( user_confirmation ( msg ) )
1570 while ( not internal_changes->empty() )
1572 internal_changes_reverse_copy.push ( internal_changes->top() );
1573 internal_changes->pop();
1577 for (
int i = 0; i < undo_stack->count(); ++i )
1580 internal_changes_reverse_copy.pop();
1581 internal_changes->push ( Change );
1627 catch ( dunedaq::conffwk::Exception
const & e )
1629 WARN (
"Object reference could not be changed",
1635 WARN (
"Unknown exception during object modification",
"s",
1636 "\n\nFor object with UID:", Change.
uid.c_str(),
"of class:",
1646 INFO (
"Database reloaded due external changes",
"Database consistency enforcement" );
1664 QWidgetList allwidgets = QApplication::topLevelWidgets();
1666 QWidgetList::iterator it = allwidgets.begin();
1667 MainWindow * main_win = qobject_cast<MainWindow *> ( *it );
1669 for ( ; it != allwidgets.end() and main_win ==
nullptr; ++it )
1671 main_win = qobject_cast<MainWindow *> ( *it );
1688 const int MAX_MESSAGE_LENGTH = 500;
1693 QMessageBox mb(
this);
1694 mb.setIcon(QMessageBox::Icon::Critical);
1695 mb.setWindowTitle(title);
1696 mb.setStandardButtons(QMessageBox::Ok);
1697 if(msg.length() > MAX_MESSAGE_LENGTH) {
1698 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1700 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1701 mb.setInformativeText(m);
1702 mb.setDetailedText(msg);
1719 QMessageBox mb(
this);
1720 mb.setIcon(QMessageBox::Icon::Information);
1721 mb.setWindowTitle(title);
1722 mb.setStandardButtons(QMessageBox::Ok);
1723 if(msg.length() > MAX_MESSAGE_LENGTH) {
1724 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1726 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1727 mb.setInformativeText(m);
1728 mb.setDetailedText(msg);
1745 QMessageBox mb(
this);
1746 mb.setIcon(QMessageBox::Icon::Information);
1747 mb.setWindowTitle(title);
1748 mb.setStandardButtons(QMessageBox::Ok);
1749 if(msg.length() > MAX_MESSAGE_LENGTH) {
1750 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1752 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1753 mb.setInformativeText(m);
1754 mb.setDetailedText(msg);
1771 QMessageBox mb(
this);
1772 mb.setIcon(QMessageBox::Icon::Information);
1773 mb.setWindowTitle(title);
1774 mb.setStandardButtons(QMessageBox::Ok);
1775 if(msg.length() > MAX_MESSAGE_LENGTH) {
1776 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1778 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1779 mb.setInformativeText(m);
1780 mb.setDetailedText(msg);
1797 QMessageBox mb(
this);
1798 mb.setIcon(QMessageBox::Icon::Critical);
1799 mb.setWindowTitle(title);
1800 mb.setStandardButtons(QMessageBox::Ok);
1801 if(msg.length() > MAX_MESSAGE_LENGTH) {
1802 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1804 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1805 mb.setInformativeText(m);
1806 mb.setDetailedText(msg);
1823 QMessageBox mb(
this);
1824 mb.setIcon(QMessageBox::Icon::Warning);
1825 mb.setWindowTitle(title);
1826 mb.setStandardButtons(QMessageBox::Ok);
1827 if(msg.length() > MAX_MESSAGE_LENGTH) {
1828 QString&& m = msg.left(MAX_MESSAGE_LENGTH);
1830 mb.setText(
"<b>The message has been truncated because too long, look at the details for the full message</b>");
1831 mb.setInformativeText(m);
1832 mb.setDetailedText(msg);
1854 std::vector<dbe::dref> objects;
1855 for(
const auto& o : objs) {
1868 for (
int i = 0; i < tableholder->count(); i++ )
1870 TableTab * CurrentTab =
dynamic_cast<TableTab *
> ( tableholder->widget ( i ) );
1874 m->objectsUpdated(objects);
1889 if(uncommittedFiles.empty() ==
true) {
1890 Commit->setEnabled(
false);
1891 Commit->setToolTip(
"There is nothing to commit");
1893 Commit->setEnabled(
true);
1896 for(
const std::string& f : uncommittedFiles) {
1897 l +=
" " + f +
"\n";
1900 Commit->setToolTip(QString::fromStdString(
"Commit changes.\nHere are the uncommitted files:\n" + l));
1906 Commit->setEnabled(
false);
1911 for(
const std::string& f : files) {
1912 CommittedTable->insertRow(0);
1913 CommittedTable->setItem(0, 0,
new QTableWidgetItem(QString::fromStdString(f)));
1914 CommittedTable->setItem(0, 1,
new QTableWidgetItem(QString::fromStdString(msg)));
1915 CommittedTable->setItem(0, 2,
new QTableWidgetItem(QDate::currentDate().toString() +
" " + QTime::currentTime().toString()));
1918 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