Commit f58c67fb authored by cvs2svn's avatar cvs2svn
Browse files

This commit was manufactured by cvs2svn to create tag 'COOL_2_6-patches'.

git-svn-id: file:///git/lcgcool.svndb/cool/tags/COOL_2_6-patches@15145 4525493e-7705-40b1-a816-d608a930855b
parent b8163edb
#ifndef ACE_ERRORS_H
#define ACE_ERRORS_H
#include <string>
namespace ace_errors {
class EmptyFolder {
public:
EmptyFolder() {}
~EmptyFolder() {}
std::string what() const { return( "Empty folder" ); }
}; // EmptyFolder
} // namespace ace_errors
#endif
#ifndef CONNECTIONDIALOG_H
#define CONNECTIONDIALOG_H
#include <QtCore/QString>
#include <QtCore/QHash>
#include "ACE/accesstocool.h"
#include "ACE/ui_ConnectionDialog_BASE.h"
class QCloseEvent;
class ConnectionDialog : public QDialog, private Ui::ConnectionDialog_BASE
{
Q_OBJECT
public:
ConnectionDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~ConnectionDialog();
void closeConnection( QString connectionString );
bool isConnected( QString connectionString = "" );
private:
QHash< QString, cool::IDatabasePtr > connectionHash;
QString dbConnectionQString;
void closeEvent( QCloseEvent* event );
void setConnections();
QString buildConnectionString();
void loadConnectionSettings( bool reload = false );
void saveConnectionSettings();
signals:
void buildFolderTree( cool::IDatabasePtr dbPtr, const QString connectionString );
private slots:
void slotConnect();
void slotRemoveHistoryEntry();
void slotRemoveAllHistory();
void slotPredefinedCS( bool enabled );
void slotPrepareDBType( int choice );
void slotPrepareDBType_2( int choice );
};
#endif
#ifndef CONTENTEDITOR_H
#define CONTENTEDITOR_H
#include <QtCore/QVariant>
#include <QtCore/QString>
#include "ACE/ui_ContentEditor_BASE.h"
enum ContentType { StringCT, HexCT };
class ContentEditor : public QDialog, private Ui::ContentEditor_BASE
{
Q_OBJECT
public:
ContentEditor( QWidget* parent = 0, bool binaryContent = false, bool readOnly = true, Qt::WindowFlags f = 0 );
~ContentEditor();
QVariant contents() const;
bool isBinary() const;
bool isReadOnly() const;
bool isModified() const;
QTextEdit* getEditor();
void prepareEditor( bool enableBinary = false, bool enableReadOnly = true );
void setContent( QVariant content = QVariant(), ContentType cType = StringCT, bool defaultValue = false );
private:
void setConnections();
bool contentBinary;
bool contentReadOnly;
ContentType defaultContentType;
ContentType currentContentType;
QVariant defaultContent;
QVariant currentContent;
bool modified;
QString browsedFileName;
public slots:
void slotBrowse();
void slotExport();
void slotRevert();
void slotViewContentAs( int cType );
void slotTextChanged();
};
#endif
#ifndef FILTERBUILDER_H
#define FILTERBUILDER_H
#include <QtCore/QList>
#include <QtCore/QMultiHash>
#include <QtGui/QDockWidget>
#include "ACE/ui_FilterBuilder_BASE.h"
#include "ACE/FilterEntry.h"
class FolderTableModel;
class QScrollArea;
class QPushButton;
class FilterBuilder : public QWidget, private Ui::FilterBuilder_BASE
{
Q_OBJECT
friend class FilterEntry;
public:
FilterBuilder( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~FilterBuilder();
QList< int > applyFilter( FolderTableModel* tableModel, bool allChannels = true, int rowStartPos = -1, int rowEndPos = -1 );
private:
QList< FilterEntry* > filterEntryList;
QMultiHash< FolderTableModel*, int > filterColumnPositions;
FolderTableModel* currentTableModel;
QScrollArea* filterEntryScrollArea;
QWidget* filterEntryScrollAreaWidget;
QVBoxLayout* filterEntryScrollAreaWidget_Layout;
QSpacerItem* spacerItem_ScrollAreaWidget;
void updateColumnComboBox();
int filterEntryCount( bool activeOnly = false );
void fillColumn( FilterEntry* filterEntry, FolderTableModel* tableModel );
signals:
void applyClicked( FolderTableModel*, QList< int > );
public slots:
void slotAddFilterEntry();
void slotRemoveFilterEntry( FilterEntry* filterEntry );
void slotUpdateFilter( FolderTableModel* tableModel, QString folderName = "" );
void slotUpdateTableView();
void slotShowAll();
void slotSaveColumnPositions();
void slotClearCurrentTableModel( FolderTableModel* theModel );
};
#endif
#ifndef FILTERBUILDERDOCKWIDGET_H
#define FILTERBUILDERDOCKWIDGET_H
#include <QtGui/QDockWidget>
#include "ACE/FilterBuilder.h"
class QWidget;
class QCloseEvent;
class FilterBuilderDockWidget : public QDockWidget
{
Q_OBJECT
public:
FilterBuilderDockWidget( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
~FilterBuilderDockWidget();
FilterBuilder* filterBuilder;
/*
private:
// void closeEvent( QCloseEvent* event );
void focusInEvent( QFocusEvent* event );
signals:
void changeFocusToFilterBuilder();
*/
};
#endif
#ifndef FILTERENTRY_H
#define FILTERENTRY_H
#include <QtCore/QPair>
#include <QtCore/QString>
#include <QtCore/QModelIndex>
#include <QtCore/QDateTime>
#include "ACE/ui_FilterEntry_BASE.h"
class FilterBuilder;
class FilterEntry;
// typedef of pointer to member function.
typedef bool ( FilterEntry::*FilterFunction )( QModelIndex );
class FilterEntry : public QWidget, public Ui::FilterEntry_BASE
{
Q_OBJECT
public:
FilterEntry( const QString filterName, FilterBuilder* fBuilder, QWidget* parent = 0, Qt::WindowFlags f = 0 );
~FilterEntry();
QPair< int, FilterFunction > getFilterFunction();
bool filter_Date( QModelIndex tableModelIndex );
bool filter_nonDate( QModelIndex tableModelIndex );
private:
void setConnections();
int columnIndex;
int comparatorIndex;
int predefinedFilterIndex;
FilterBuilder* filterBuilder;
signals:
void removeFilter( FilterEntry* );
private slots:
void slotSelectColumn( int selection );
void slotSelectComparator( int selection = -1 );
void slotSelectDateFilter( int selection = -1 );
void slotRemoveClicked();
void slotSetDateTimeB( QDateTime dateTime );
void slotCheckDateTimeB( QDateTime dateTime );
};
#endif
#ifndef FOLDEROPENDIALOG_H
#define FOLDEROPENDIALOG_H
#include <QtCore/QStringList>
#include "ACE/accesstocool.h"
#include "ACE/ui_FolderOpenDialog_BASE.h"
class FolderOpenDialog : public QDialog, private Ui::FolderOpenDialog_BASE
{
Q_OBJECT
public:
FolderOpenDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~FolderOpenDialog();
void prepare( cool::IFolderPtr fPtr, QString fName );
cool::ValidityKey getSinceIOV();
cool::ChannelSelection getChannelSelection();
QString getTag();
QString getFolderCharacteristics();
private:
void setConnections();
void fill();
QMap<unsigned int, unsigned int> channelPosMap;
QMap< unsigned int, unsigned int> channelSubsetPosMap;
cool::IFolderPtr folderPtr;
QString folderName;
QStringList tagList;
public slots:
void slotOpen();
void slotAddChannelRange();
void slotRemoveChannelRange();
void slotCheckRange( int index );
};
#endif
#include <QtCore/QHash>
#include <QtCore/QModelIndex>
#include <QtCore/QString>
#include "ACE/ui_MainWindow_BASE.h"
#include "ACE/accesstocool.h"
class QTreeView;
class QCloseEvent;
class QDockWidget;
class FolderTreeModel;
class FolderTableModel;
class FolderTableDockWidget;
class FolderTableView;
class ConnectionDialog;
class FilterBuilderDockWidget;
class FolderOpenDialog;
class MainWindow : public QMainWindow, private Ui::MainWindow_BASE
{
Q_OBJECT
public:
MainWindow( QWidget* parent = 0 );
~MainWindow();
private:
QHash< QModelIndex, FolderTableModel* > folderTableModels; // ModelIndex is for folder tree
QHash< const FolderTableModel*, FolderTableDockWidget* > folderTableDockWidgets;
QHash< FolderTreeModel*, QTreeView* > folderTreeViews;
ConnectionDialog* connectionDialog;
FolderOpenDialog* folderOpenDialog;
FilterBuilderDockWidget* filterBuilderDockWidget;
QWidget* defaultConnectionTab;
unsigned int connectionCounter;
void setConnections();
void initialise_ACE_Settings();
void closeEvent( QCloseEvent* event );
void loadGUISettings();
void saveGUISettings();
bool commitAll( bool ask = false, FolderTableModel* thisModelOnly = NULL );
void removeFolder( FolderTableModel* theModel, QModelIndex treeIndex = QModelIndex() );
// Test routines
void testRoutine();
public slots:
void slotCreateFolderTable( const QModelIndex& fTreeIndex );
void slotCreateFolderTree( cool::IDatabasePtr dbPtr, const QString connectionString );
void slotConnectionOpen();
void slotConnectionDisconnect();
void slotFolderCommit();
void slotFolderCommitAll();
void slotFolderFilter( bool enabled );
void slotTableModified( const FolderTableModel* modifiedModel, const bool changed );
void slotCheckButtons( bool force = true );
void slotRemoveFolder( FolderTableModel* theModel );
// void slotRemoveFolderTable( const QModelIndex& fTreeIndex );
// void slotRemoveFolderTree( int tabPos );
};
#ifndef ACCESSTOCOOL_H
#define ACCESSTOCOOL_H
#include <CoolKernel/ChannelSelection.h>
#include <CoolKernel/IDatabaseSvc.h>
#include <CoolKernel/IDatabase.h>
#include <CoolKernel/DatabaseId.h>
#include <CoolKernel/types.h>
#include <CoolKernel/Record.h>
#include <CoolKernel/RecordSpecification.h>
#include <CoolKernel/FolderSpecification.h>
#include <CoolKernel/FolderVersioning.h>
#include <CoolKernel/IFolder.h>
#include <CoolKernel/StorageType.h>
#include <CoolKernel/Exception.h>
#include <CoolKernel/IObject.h>
#include <CoolKernel/IObjectIterator.h>
#include <CoolKernel/IField.h>
#include <CoolKernel/IFieldSpecification.h>
#include <CoralBase/Exception.h>
#include <CoolApplication/DatabaseSvcFactory.h>
#include <RelationalAccess/ConnectionServiceException.h>
// Test routine includes
#include <QtCore/QString>
#include <QtCore/QByteArray>
#include "CoralBase/Attribute.h"
#include "CoralBase/Blob.h"
#include <sstream>
namespace cool {
bool openDatabase( cool::DatabaseId m_dbId, cool::IDatabasePtr& db );
// Test routines
void createTestDB();
coral::AttributeList createPayload( int index, const cool::RecordSpecification& spec );
} // cool namespace
#endif
#ifndef FOLDERTABLEDELEGATE_H
#define FOLDERTABLEDELEGATE_H
#include <QtGui/QItemDelegate>
class FolderTableDelegate: public QItemDelegate
{
Q_OBJECT
public:
FolderTableDelegate( QObject* parent = 0 );
~FolderTableDelegate();
QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
void setEditorData( QWidget* editor, const QModelIndex& index ) const;
void setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const;
void updateEditorGeometry( QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
private slots:
void commitAndCloseEditor();
};
#endif
#ifndef FOLDERTABLEDOCKWIDGET_H
#define FOLDERTABLEDOCKWIDGET_H
#include <QtGui/QDockWidget>
#include <ACE/foldertablemodel.h>
class QWidget;
class QCloseEvent;
class FolderTableDockWidget : public QDockWidget
{
Q_OBJECT
public:
FolderTableDockWidget( /*const QString& folderName, int folderNumber,*/ QWidget* parent = 0, Qt::WindowFlags flags = 0 );
~FolderTableDockWidget();
void setTableModel( FolderTableModel* model );
private:
FolderTableModel* folderTableModel;
void closeEvent( QCloseEvent* event );
void focusInEvent( QFocusEvent* event );
signals:
void changeFocusToTable();
void folderTableDockWidgetClose( FolderTableModel* );
};
#endif
#ifndef FOLDERTABLEITEM_H
#define FOLDERTABLEITEM_H
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QVariant>
#include <QtCore/QPair>
#include <QtCore/QSettings>
class RootFolderTableItem;
class FolderTableItem
{
friend class RootFolderTableItem;
public:
FolderTableItem( const QList<QVariant>& data, RootFolderTableItem* parent, bool newItem = false );
~FolderTableItem() {};
void setClonedSourceItem( FolderTableItem* newClonedSourceItem );
FolderTableItem* getClonedSourceItem();
int columnCount() const;
QVariant data( int column ) const;
QList<QVariant> data() const;
void setData( const QVariant& data, int column = 0 );
int row() const;
RootFolderTableItem* parent();
bool isNew() const;
bool isHidden() const;
void setHidden( bool enabled = true );
unsigned getChannelId() const;
void setOld();
protected:
QList<QVariant> tableItemData;
RootFolderTableItem* rootTableItem;
FolderTableItem* clonedSourceItem;
bool hidden;
bool newItem;
};
class RootFolderTableItem
{
friend class FolderTableItem;
public:
RootFolderTableItem( const QList<QString>& headerNames, const QList< QPair< QString, QVariant > >& headerTypes );
~RootFolderTableItem();
QList<FolderTableItem*> getChildren() const;
void appendChild( FolderTableItem* child );
void insertChild( FolderTableItem* child, int row = 0 );
void removeChildAt( int row );
FolderTableItem* child( int row );
int childCount() const;
int columnCount() const;
QString header( int column ) const;
int headerPos( const QString& headerName ) const;
QPair< QString, QVariant > headerType( int column ) const;
bool setHeader( const QString& headerName, int column = 0 );
QList< FolderTableItem* > newItems() const;
bool anyNew() const;
bool isFiltered() const;
QMap< int, FolderTableItem* > filteredChildren() const;
int find( unsigned channelId ) const;
void sort( int column, Qt::SortOrder order );
template <typename ColumnType> void sort1( int column, Qt::SortOrder order );
QSettings settings;
private:
QList<FolderTableItem*> childTableItems;
QList<QString> headerNameList;
QList< QPair< QString, QVariant > > headerTypeList;
// QMap< QString, QPair< QString, QVariant > > folderAttributes;
};
#endif
#ifndef FOLDERTABLEMODEL_H
#define FOLDERTABLEMODEL_H
#include <QtCore/QAbstractTableModel>
#include <QtCore/QModelIndex>
#include <QtCore/QVariant>
#include <QtCore/QSet>
#include <QtCore/QDateTime>
#include <vector>
#include <string>
#include "ACE/foldertableitem.h"
#include "ACE/accesstocool.h"
enum DisplayAsMask { noMask, octMask, decMask, hexMask, datetimeMask, blobMask, clobMask };
enum ColumnResponse { noResponse, readonlyResponse, confirmResponse };
class RootFolderTableItem;
class QValidator;
class FolderTableModel;
// typedef of pointer to member function.
typedef bool ( FolderTableModel::*FilterFunction0 )( int );
class FolderTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
FolderTableModel( cool::IFolderPtr folderPtr, cool::ValidityKey start = cool::ValidityKeyMin, cool::ValidityKey end = cool::ValidityKeyMax, cool::ChannelSelection channels = cool::ChannelSelection(), QString tag = "", QObject* parent = 0 );
~FolderTableModel();
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
QVariant rawData( const QModelIndex& index ) const;
QVariant headerData( int section, Qt::Orientation orientation = Qt::Horizontal, int role = Qt::DisplayRole ) const;
QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const;
QModelIndex parent( const QModelIndex& index ) const;
int rowCount( const QModelIndex& parent = QModelIndex() ) const;
int columnCount( const QModelIndex& parent = QModelIndex() ) const;
Qt::ItemFlags flags( const QModelIndex& index ) const;
bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole );
void setData( const QModelIndexList& indexList, const QVariant& value, int role = Qt::EditRole );
bool canSetDisplayAsMask( const QModelIndex& index ) const;
bool canSetDisplayAsMask( const QModelIndexList& indexList ) const;
bool setHeaderData( int section, Qt::Orientation orientation, const QVariant& value, int role = Qt::EditRole );
bool removeRows( int row, int count = 1, const QModelIndex& parent = QModelIndex() );
bool insertRows( int row, int count = 1, const QModelIndex& parent = QModelIndex() );
QVariant::Type getQVariantType( const std::string& coolType ) const;
QVariant::Type getQVariantType( const QModelIndex& index ) const;
QVariant::Type getQVariantType( const QString& field ) const;
QVariant::Type getQVariantType( int column ) const;
QString getCoolTypeString( const QModelIndex& index ) const;
RootFolderTableItem* getRootTableItem() const;
void setDefaultCopyRow( int row );
QList< int > filter( FilterFunction0 f, bool inverse, bool allChannels = true, int rowStartPos = -1, int rowEndPos = -1 );
QList< int > filter_mres( bool inverse = true );
int filter_mre_singleChannel( int row );
bool filter_mre( int row );
QList< FolderTableItem* > _updateValidityKeys( QList< FolderTableItem* > newTableItems );
bool commit();
bool isNewRow( int row ) const;
DisplayAsMask getDisplayAsMask( int column ) const;