In the Netlist tab of the Controller, add a count of RoutingPads.

* New: In Hurricane, in NetlistWidget & NetlistModel, adds a column for
    the RoutingPads count. Special display to mark global nets.
* Change: In Hurricane, in all MVC's models, some improvements on the
    way the columns are sized and the titles displayeds.
This commit is contained in:
Jean-Paul Chaput 2015-07-25 11:55:42 +02:00
parent ed2cd18c48
commit 8ead28d86c
7 changed files with 70 additions and 93 deletions

View File

@ -1,60 +1,23 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Project. // This file is part of the Coriolis Software.
// Copyright (C) Laboratoire LIP6 - Departement ASIM // Copyright (c) UPMC 2008-2015, All Rights Reserved
// Universite Pierre et Marie Curie
// //
// Main contributors : // +-----------------------------------------------------------------+
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./NetInformations.cpp" | // | C++ Module : "./NetInformations.cpp" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QObject> #include <QObject>
#include "hurricane/Name.h"
#include "hurricane/Name.h" #include "hurricane/Net.h"
#include "hurricane/Net.h" #include "hurricane/viewer/NetInformations.h"
#include "hurricane/viewer/NetInformations.h"
namespace Hurricane { namespace Hurricane {
@ -100,7 +63,7 @@ namespace Hurricane {
int SimpleNetInformations::getColumnCount () int SimpleNetInformations::getColumnCount ()
{ return 2; } { return 3; }
QVariant SimpleNetInformations::getColumnName ( int column ) QVariant SimpleNetInformations::getColumnName ( int column )
@ -108,6 +71,7 @@ namespace Hurricane {
switch ( column ) { switch ( column ) {
case 0: return QVariant(QObject::tr("Net")); case 0: return QVariant(QObject::tr("Net"));
case 1: return QVariant(QObject::tr("Plugs")); case 1: return QVariant(QObject::tr("Plugs"));
case 2: return QVariant(QObject::tr("RoutingPads"));
} }
return QVariant(QObject::tr("Column Out of Bound")); return QVariant(QObject::tr("Column Out of Bound"));
} }
@ -116,8 +80,15 @@ namespace Hurricane {
QVariant SimpleNetInformations::getColumn ( int column ) QVariant SimpleNetInformations::getColumn ( int column )
{ {
switch ( column ) { switch ( column ) {
case 0: return _columnNet; case 0: return _netName;
case 1: return _columnPlug; case 1: return (unsigned int)_plugsCount;
case 2:
if (_net->isGlobal()) {
if (not _rpsCount) return "N/A (global)";
string s = getString(_rpsCount) + " (global)";
return s.c_str();
}
return (unsigned int)_rpsCount;
} }
return QVariant(QObject::tr("Column Out of Bound")); return QVariant(QObject::tr("Column Out of Bound"));
} }
@ -125,9 +96,9 @@ namespace Hurricane {
SimpleNetInformations::SimpleNetInformations ( const Net* net ) SimpleNetInformations::SimpleNetInformations ( const Net* net )
: NetInformations(net) : NetInformations(net)
, _netName (getString(getName()).c_str())
, _plugsCount (_net->getPlugs().getSize()) , _plugsCount (_net->getPlugs().getSize())
, _columnNet (getString(getName()).c_str()) , _rpsCount (_net->getRoutingPads().getSize())
, _columnPlug ((unsigned int)_plugsCount)
{ } { }

View File

@ -58,22 +58,27 @@ namespace Hurricane {
_rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4;
_sortModel->setSourceModel ( _baseModel ); _sortModel->setSourceModel ( _baseModel );
_sortModel->setDynamicSortFilter ( true ); _sortModel->setDynamicSortFilter( true );
_sortModel->setFilterKeyColumn ( 0 ); _sortModel->setFilterKeyColumn ( 0 );
_view->setShowGrid ( false ); _view->setShowGrid ( false );
_view->setAlternatingRowColors ( true ); _view->setAlternatingRowColors( true );
_view->setSelectionBehavior ( QAbstractItemView::SelectRows ); _view->setSelectionBehavior ( QAbstractItemView::SelectRows );
_view->setSortingEnabled ( true ); _view->setSortingEnabled ( true );
_view->setModel ( _sortModel ); _view->setModel ( _sortModel );
QHeaderView* horizontalHeader = _view->horizontalHeader (); QHeaderView* horizontalHeader = _view->horizontalHeader();
horizontalHeader->setStretchLastSection ( true ); horizontalHeader->setDefaultAlignment ( Qt::AlignHCenter );
horizontalHeader->setMinimumSectionSize( (Graphics::isHighDpi()) ? 300 : 150 );
horizontalHeader->setResizeMode ( 0, QHeaderView::Interactive );
horizontalHeader->setResizeMode ( 1, QHeaderView::Interactive );
horizontalHeader->setResizeMode ( 2, QHeaderView::Interactive );
horizontalHeader->setStretchLastSection( true );
QHeaderView* verticalHeader = _view->verticalHeader (); QHeaderView* verticalHeader = _view->verticalHeader();
verticalHeader->setVisible ( false ); verticalHeader->setVisible( false );
verticalHeader->setDefaultSectionSize ( _rowHeight ); verticalHeader->setDefaultSectionSize( _rowHeight );
// verticalHeader->setStyleSheet( "QHeaderView::section {" // verticalHeader->setStyleSheet( "QHeaderView::section {"
// "padding-bottom: 0px;" // "padding-bottom: 0px;"
@ -84,29 +89,29 @@ namespace Hurricane {
// "}" // "}"
// ); // );
_filterPatternLineEdit = new QLineEdit(this); _filterPatternLineEdit = new QLineEdit( this );
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); QLabel* filterPatternLabel = new QLabel( tr("&Filter pattern:"), this );
filterPatternLabel->setBuddy(_filterPatternLineEdit); filterPatternLabel->setBuddy( _filterPatternLineEdit );
QGridLayout* gLayout = new QGridLayout(); QGridLayout* gLayout = new QGridLayout();
gLayout->addWidget(_view , 1, 0, 1, 2); gLayout->addWidget( _view , 1, 0, 1, 2 );
gLayout->addWidget(filterPatternLabel , 2, 0); gLayout->addWidget( filterPatternLabel , 2, 0 );
gLayout->addWidget(_filterPatternLineEdit, 2, 1); gLayout->addWidget( _filterPatternLineEdit, 2, 1 );
setLayout ( gLayout ); setLayout( gLayout );
QAction* fitAction = new QAction ( tr("&Fit to Net"), this ); QAction* fitAction = new QAction( tr("&Fit to Net"), this );
fitAction->setShortcut ( QKeySequence(tr("CTRL+F")) ); fitAction->setShortcut ( QKeySequence(tr("CTRL+F")) );
fitAction->setStatusTip ( tr("Fit the view to the Net's bounding box") ); fitAction->setStatusTip( tr("Fit the view to the Net's bounding box") );
addAction ( fitAction ); addAction( fitAction );
connect ( _filterPatternLineEdit , SIGNAL(textChanged(const QString &)) connect( _filterPatternLineEdit , SIGNAL(textChanged(const QString &))
, this , SLOT (textFilterChanged()) ); , this , SLOT (textFilterChanged()) );
connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) connect( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&))
, this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) ); , this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) );
connect ( fitAction , SIGNAL(triggered ()), this, SLOT(fitToNet ()) ); connect( fitAction , SIGNAL(triggered ()), this, SLOT(fitToNet ()) );
resize(300, 300); resize( 300, 300 );
} }

View File

@ -112,7 +112,6 @@ namespace Hurricane {
} }
if ( role == Qt::FontRole ) { if ( role == Qt::FontRole ) {
//if ( index.row() == 0 ) return QVariant();
switch (index.column()) { switch (index.column()) {
case 0: return nameFont; case 0: return nameFont;
case 1: return valueFont; case 1: return valueFont;

View File

@ -176,7 +176,6 @@ namespace Hurricane {
if ( !index.isValid() ) return QVariant (); if ( !index.isValid() ) return QVariant ();
if ( role == Qt::SizeHintRole ) { if ( role == Qt::SizeHintRole ) {
if ( index.row() == 0 ) return QVariant();
switch (index.column()) { switch (index.column()) {
case 0: return 200; case 0: return 200;
default: default:

View File

@ -117,7 +117,6 @@ namespace Hurricane {
} }
if ( role == Qt::FontRole ) { if ( role == Qt::FontRole ) {
if ( index.row() == 0 ) return QVariant();
switch (index.column()) { switch (index.column()) {
default: return entityFont; default: return entityFont;
} }

View File

@ -67,16 +67,17 @@ namespace Hurricane {
static QVariant getColumnName ( int column ); static QVariant getColumnName ( int column );
virtual QVariant getColumn ( int column ); virtual QVariant getColumn ( int column );
inline size_t getPlugsCount () const; inline size_t getPlugsCount () const;
inline size_t getRpsCount () const;
protected: protected:
QVariant _netName;
size_t _plugsCount; size_t _plugsCount;
QVariant _columnNet; size_t _rpsCount;
QVariant _columnPlug;
}; };
inline size_t SimpleNetInformations::getPlugsCount () const inline size_t SimpleNetInformations::getPlugsCount () const { return _plugsCount; }
{ return _plugsCount; } inline size_t SimpleNetInformations::getRpsCount () const { return _rpsCount; }
// ------------------------------------------------------------------- // -------------------------------------------------------------------

View File

@ -180,14 +180,17 @@ namespace Hurricane {
void NetlistWidget::setCell ( Cell* cell ) void NetlistWidget::setCell ( Cell* cell )
{ {
_cell = cell; _cell = cell;
_view->selectionModel()->clear (); _view->setVisible( false );
_baseModel->setCell<InformationType> ( cell ); _view->selectionModel()->clear();
_baseModel->setCell<InformationType>( cell );
string windowTitle = "Netlist" + getString(cell); string windowTitle = "Netlist" + getString(cell);
setWindowTitle ( tr(windowTitle.c_str()) ); setWindowTitle( tr(windowTitle.c_str()) );
_view->selectRow ( 0 ); _view->selectRow( 0 );
_view->resizeColumnToContents ( 0 ); for ( int i=0 ; i<_baseModel->columnCount() ; ++i )
_view->resizeColumnToContents( i );
_view->setVisible( true );
} }