11/* **************************************************************************
2- BeataDialog.cpp
3- BEtter Attribute TAble
2+ QgsAttributeTableDialog.cpp
43 -------------------
54 date : Feb 2009
65 copyright : Vita Cizek
1716
1817#include < QtGui>
1918
20- #include " BeataDialog .h"
21- #include " BeataModel .h"
22- #include " BeataView .h"
19+ #include " qgsattributetabledialog .h"
20+ #include " qgsattributetablemodel .h"
21+ #include " qgsattributetableview .h"
2322
2423#include < qgsapplication.h>
2524#include < qgsvectordataprovider.h>
3231#include " qgslogger.h"
3332
3433
35- class QBeataTableDock : public QDockWidget
34+ class QgsAttributeTableTableDock : public QDockWidget
3635{
3736 public:
38- QBeataTableDock ( const QString & title, QWidget * parent = 0 , Qt::WindowFlags flags = 0 )
37+ QgsAttributeTableTableDock ( const QString & title, QWidget * parent = 0 , Qt::WindowFlags flags = 0 )
3938 : QDockWidget( title, parent, flags )
4039 {
4140 setObjectName ( " AttributeTable" ); // set object name so the position can be saved
@@ -48,7 +47,7 @@ class QBeataTableDock : public QDockWidget
4847};
4948
5049
51- BeataDialog::BeataDialog ( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags )
50+ QgsAttributeTableDialog::QgsAttributeTableDialog ( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags )
5251 : QDialog( parent, flags ), mDock( NULL )
5352{
5453 mLayer = theLayer;
@@ -61,8 +60,8 @@ BeataDialog::BeataDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowF
6160 restoreGeometry ( settings.value ( " /Windows/BetterAttributeTable/geometry" ).toByteArray () );
6261
6362 mView ->setLayer ( mLayer );
64- mFilterModel = ( BeataFilterModel * ) mView ->model ();
65- mModel = ( BeataModel * )(( BeataFilterModel * )mView ->model () )->sourceModel ();
63+ mFilterModel = ( QgsAttributeTableFilterModel * ) mView ->model ();
64+ mModel = ( QgsAttributeTableModel * )(( QgsAttributeTableFilterModel * )mView ->model () )->sourceModel ();
6665
6766 mQuery = query;
6867 mColumnBox = columnBox;
@@ -72,7 +71,7 @@ BeataDialog::BeataDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowF
7271 bool myDockFlag = mySettings.value ( " /qgis/dockAttributeTable" , false ).toBool ();
7372 if ( myDockFlag )
7473 {
75- mDock = new QBeataTableDock ( tr ( " Attribute table - %1" ).arg ( mLayer ->name () ), QgisApp::instance () );
74+ mDock = new QgsAttributeTableTableDock ( tr ( " Attribute table - %1" ).arg ( mLayer ->name () ), QgisApp::instance () );
7675 mDock ->setAllowedAreas ( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
7776 mDock ->setWidget ( this );
7877 QgisApp::instance ()->addDockWidget ( Qt::BottomDockWidgetArea, mDock );
@@ -111,11 +110,11 @@ BeataDialog::BeataDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowF
111110 updateSelectionFromLayer ();
112111}
113112
114- BeataDialog ::~BeataDialog ()
113+ QgsAttributeTableDialog ::~QgsAttributeTableDialog ()
115114{
116115}
117116
118- void BeataDialog ::closeEvent ( QCloseEvent* event )
117+ void QgsAttributeTableDialog ::closeEvent ( QCloseEvent* event )
119118{
120119 QDialog::closeEvent ( event );
121120
@@ -127,7 +126,7 @@ void BeataDialog::closeEvent( QCloseEvent* event )
127126}
128127
129128
130- QIcon BeataDialog ::getThemeIcon ( const QString theName )
129+ QIcon QgsAttributeTableDialog ::getThemeIcon ( const QString theName )
131130{
132131 // copied from QgisApp::getThemeIcon. To be removed when merged to SVN
133132
@@ -149,12 +148,12 @@ QIcon BeataDialog::getThemeIcon( const QString theName )
149148 }
150149}
151150
152- void BeataDialog ::showAdvanced ()
151+ void QgsAttributeTableDialog ::showAdvanced ()
153152{
154153 mMenuActions ->exec ( QCursor::pos () );
155154}
156155
157- void BeataDialog ::on_mSelectedToTopButton_clicked ()
156+ void QgsAttributeTableDialog ::on_mSelectedToTopButton_clicked ()
158157{
159158 int freeIndex = 0 ;
160159
@@ -194,35 +193,35 @@ void BeataDialog::on_mSelectedToTopButton_clicked()
194193 updateSelection ();
195194}
196195
197- void BeataDialog ::on_mCopySelectedRowsButton_clicked ()
196+ void QgsAttributeTableDialog ::on_mCopySelectedRowsButton_clicked ()
198197{
199198 QgisApp::instance ()->editCopy ( mLayer );
200199}
201200
202- void BeataDialog ::on_mZoomMapToSelectedRowsButton_clicked ()
201+ void QgsAttributeTableDialog ::on_mZoomMapToSelectedRowsButton_clicked ()
203202{
204203 QgisApp::instance ()->zoomToSelected ();
205204}
206205
207- void BeataDialog ::on_mInvertSelectionButton_clicked ()
206+ void QgsAttributeTableDialog ::on_mInvertSelectionButton_clicked ()
208207{
209208 mLayer ->invertSelection ();
210209}
211210
212- void BeataDialog ::on_mRemoveSelectionButton_clicked ()
211+ void QgsAttributeTableDialog ::on_mRemoveSelectionButton_clicked ()
213212{
214213 mLayer ->removeSelection ();
215214}
216215
217- void BeataDialog ::on_cbxShowSelectedOnly_toggled ( bool theFlag )
216+ void QgsAttributeTableDialog ::on_cbxShowSelectedOnly_toggled ( bool theFlag )
218217{
219218 mFilterModel ->mHideUnselected = theFlag;
220219 mFilterModel ->invalidate ();
221220 // TODO: weird
222221 // mModel->changeLayout();
223222}
224223
225- void BeataDialog ::columnBoxInit ()
224+ void QgsAttributeTableDialog ::columnBoxInit ()
226225{
227226 QgsFieldMap fieldMap = mLayer ->dataProvider ()->fields ();
228227 QgsFieldMap::Iterator it = fieldMap.begin ();
@@ -231,7 +230,7 @@ void BeataDialog::columnBoxInit()
231230 mColumnBox ->addItem ( it.value ().name () );
232231}
233232
234- int BeataDialog ::columnBoxColumnId ()
233+ int QgsAttributeTableDialog ::columnBoxColumnId ()
235234{
236235 QgsFieldMap fieldMap = mLayer ->dataProvider ()->fields ();
237236 QgsFieldMap::Iterator it = fieldMap.begin ();
@@ -243,7 +242,7 @@ int BeataDialog::columnBoxColumnId()
243242 return 0 ;
244243}
245244
246- void BeataDialog ::updateSelection ()
245+ void QgsAttributeTableDialog ::updateSelection ()
247246{
248247 QModelIndex index;
249248 mView ->setSelectionMode ( QAbstractItemView::MultiSelection );
@@ -272,7 +271,7 @@ void BeataDialog::updateSelection()
272271 */
273272}
274273
275- void BeataDialog ::updateRowSelection ( int index )
274+ void QgsAttributeTableDialog ::updateRowSelection ( int index )
276275{
277276 // map index to filter model
278277 // index = mFilterModel->mapFromSource(mModel->index(index, 0)).row();
@@ -326,7 +325,7 @@ void BeataDialog::updateRowSelection( int index )
326325}
327326
328327// fast row deselection needed
329- void BeataDialog ::updateRowSelection ( int first, int last, bool startNewSelection )
328+ void QgsAttributeTableDialog ::updateRowSelection ( int first, int last, bool startNewSelection )
330329{
331330 disconnect ( mLayer , SIGNAL ( selectionChanged () ), this , SLOT ( updateSelectionFromLayer () ) );
332331
@@ -398,14 +397,14 @@ void BeataDialog::updateRowSelection( int first, int last, bool startNewSelectio
398397 connect ( mLayer , SIGNAL ( selectionChanged () ), this , SLOT ( updateSelectionFromLayer () ) );
399398}
400399
401- void BeataDialog ::updateSelectionFromLayer ()
400+ void QgsAttributeTableDialog ::updateSelectionFromLayer ()
402401{
403402 QgsDebugMsg ( " updateFromLayer" );
404403 mSelectedFeatures = mLayer ->selectedFeaturesIds ();
405404 updateSelection ();
406405}
407406
408- void BeataDialog ::doSearch ( QString searchString )
407+ void QgsAttributeTableDialog ::doSearch ( QString searchString )
409408{
410409 // parse search string and build parsed tree
411410 QgsSearchString search;
@@ -462,7 +461,7 @@ void BeataDialog::doSearch( QString searchString )
462461 QMessageBox::information ( this , tr ( " Search results" ), str );
463462}
464463
465- void BeataDialog ::search ()
464+ void QgsAttributeTableDialog ::search ()
466465{
467466
468467 QString str = mColumnBox ->currentText ();
@@ -483,7 +482,7 @@ void BeataDialog::search()
483482 doSearch ( str );
484483}
485484
486- void BeataDialog ::on_mAdvancedSearchButton_clicked ()
485+ void QgsAttributeTableDialog ::on_mAdvancedSearchButton_clicked ()
487486{
488487 QgsSearchQueryBuilder dlg ( mLayer , this );
489488 dlg.setSearchString ( mQuery ->displayText () );
@@ -492,12 +491,12 @@ void BeataDialog::on_mAdvancedSearchButton_clicked()
492491 doSearch ( dlg.searchString () );
493492}
494493
495- void BeataDialog ::on_mToggleEditingButton_toggled ()
494+ void QgsAttributeTableDialog ::on_mToggleEditingButton_toggled ()
496495{
497496 emit editingToggled ( mLayer );
498497}
499498
500- void BeataDialog ::editingToggled ()
499+ void QgsAttributeTableDialog ::editingToggled ()
501500{
502501 mToggleEditingButton ->setChecked ( mLayer ->isEditable () );
503502
@@ -509,19 +508,19 @@ void BeataDialog::editingToggled()
509508}
510509
511510// not used now
512- void BeataDialog ::startEditing ()
511+ void QgsAttributeTableDialog ::startEditing ()
513512{
514513 mLayer ->startEditing ();
515514}
516515
517516// not used now
518- void BeataDialog ::submit ()
517+ void QgsAttributeTableDialog ::submit ()
519518{
520519 mLayer ->commitChanges ();
521520}
522521
523522// not used now
524- void BeataDialog ::revert ()
523+ void QgsAttributeTableDialog ::revert ()
525524{
526525 mLayer ->rollBack ();
527526 mModel ->revert ();
0 commit comments