coriolis/unicorn/src/ImportCellDialog.cpp

146 lines
4.4 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
2015-03-17 10:42:12 -05:00
// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved
//
Update to Qt 5, requires cmake 2.8.9. New placer: Etesian. Update to Qt 5: * Change: Now requires at least cmake 2.8.9. * Change: CMakeLists.txt needs small changes. Qt modules must be found one by one (Core, Gui, Widgets). Must add "set(CMAKE_AUTOMOC ON)" in the top file and replace "qt4" prefix in macros by "qt5". Added simpler macro "setup_qt()" in FindBootstrap.cmake. * Change: No longer need to include <QGtkStyle> is is choosen by default according to the current desktop environment. * Change: In <hurricane>, In HApplication, launch ExceptionWidget when a std::exception is catched instead of silently discarting it. New placer Tool: Etesian * New: <etesian> analytical placer. Encapsulate Coloquinte from Gabriel Gouvine. * New: in <documentation>, add stub demonstration ToolEngine <smurf>. Needs to be commented. Miscellaneous: * New: in <boostrap> and <unicorn>, added support for Etesian, the new analytic placer. The tool itself will be added in the next commit. * Bug: in <CellWidget>, when shifting the display buffer, we no longer can copy the buffer on itself (we should never have). Now go through a temporary one (PlaneId::AutoCopy) which is added to the DrawingPlanes. Affect "goLeft()" and "goUp()". * Bug: In <CellWidget>, remove the WA_PaintOnScreen flag/attribute. When it's on, no PaintEvent is transmitted to the CellWidget when it's the central widget of the <CellViewer> (QMainWindow). It's something I still don't understand from the doc of Qt. * Change: In <AreaCommand>, use the PlaneId enumeration instead of a anonymous numerical index. * Change: In <HApplication>, no longer catch and silently discard standartd exceptions but launch the ExceptionWidget... Suppress the now deprecated constructor with "Type" argument. * Change: In <SelectionModel>, the "reset()" method is deprecated in Qt5, instead enclose the "clear()" by a "beginResetModel()" and "endResetModel()" pair. * New: In <crlcore>, add support for ISPD05 benchmarks (in Bookshelf format). Forked from ISPD04 and not finished yet. * Change: In <Mauka>, distinguish the Action string identifier from <Etesian> * New: In <unicorn>, add entry for ISPD05 loader. Add entry for <Etesian> analytic placer.
2014-03-22 05:50:36 -05:00
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | U n i c o r n - M a i n G U I |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./ImportCellDialog.cpp" |
Update to Qt 5, requires cmake 2.8.9. New placer: Etesian. Update to Qt 5: * Change: Now requires at least cmake 2.8.9. * Change: CMakeLists.txt needs small changes. Qt modules must be found one by one (Core, Gui, Widgets). Must add "set(CMAKE_AUTOMOC ON)" in the top file and replace "qt4" prefix in macros by "qt5". Added simpler macro "setup_qt()" in FindBootstrap.cmake. * Change: No longer need to include <QGtkStyle> is is choosen by default according to the current desktop environment. * Change: In <hurricane>, In HApplication, launch ExceptionWidget when a std::exception is catched instead of silently discarting it. New placer Tool: Etesian * New: <etesian> analytical placer. Encapsulate Coloquinte from Gabriel Gouvine. * New: in <documentation>, add stub demonstration ToolEngine <smurf>. Needs to be commented. Miscellaneous: * New: in <boostrap> and <unicorn>, added support for Etesian, the new analytic placer. The tool itself will be added in the next commit. * Bug: in <CellWidget>, when shifting the display buffer, we no longer can copy the buffer on itself (we should never have). Now go through a temporary one (PlaneId::AutoCopy) which is added to the DrawingPlanes. Affect "goLeft()" and "goUp()". * Bug: In <CellWidget>, remove the WA_PaintOnScreen flag/attribute. When it's on, no PaintEvent is transmitted to the CellWidget when it's the central widget of the <CellViewer> (QMainWindow). It's something I still don't understand from the doc of Qt. * Change: In <AreaCommand>, use the PlaneId enumeration instead of a anonymous numerical index. * Change: In <HApplication>, no longer catch and silently discard standartd exceptions but launch the ExceptionWidget... Suppress the now deprecated constructor with "Type" argument. * Change: In <SelectionModel>, the "reset()" method is deprecated in Qt5, instead enclose the "clear()" by a "beginResetModel()" and "endResetModel()" pair. * New: In <crlcore>, add support for ISPD05 benchmarks (in Bookshelf format). Forked from ISPD04 and not finished yet. * Change: In <Mauka>, distinguish the Action string identifier from <Etesian> * New: In <unicorn>, add entry for ISPD05 loader. Add entry for <Etesian> analytic placer.
2014-03-22 05:50:36 -05:00
// +-----------------------------------------------------------------+
#include <iostream>
using namespace std;
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QComboBox>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "hurricane/Warning.h"
#include "hurricane/viewer/Graphics.h"
#include "unicorn/ImportCell.h"
#include "unicorn/ImportCellDialog.h"
namespace Unicorn {
using Hurricane::Warning;
using Hurricane::Graphics;
// -------------------------------------------------------------------
// Class : "ImportCellDialog".
ImportCellDialog::ImportCellDialog ( QWidget* parent )
: QDialog (parent)
, _lineEdit (new QLineEdit())
, _viewerCheckBox(new QCheckBox())
, _formatComboBox(new QComboBox())
{
setWindowTitle ( tr("Import Cell") );
QLabel* label = new QLabel ();
label->setText ( tr("Enter Cell name (without extention)") );
label->setFont ( Graphics::getNormalFont(true) );
_lineEdit->setMinimumWidth ( 400 );
_viewerCheckBox->setText ( tr("Import in new Viewer") );
QPushButton* okButton = new QPushButton ();
okButton->setText ( "OK" );
okButton->setDefault ( true );
QPushButton* cancelButton = new QPushButton ();
cancelButton->setText ( "Cancel" );
QHBoxLayout* hLayout1 = new QHBoxLayout ();
hLayout1->addStretch ();
hLayout1->addWidget ( okButton );
hLayout1->addStretch ();
hLayout1->addWidget ( cancelButton );
hLayout1->addStretch ();
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
QHBoxLayout* hLayout2 = new QHBoxLayout ();
QLabel* formatLabel = new QLabel ();
formatLabel->setText ( tr("Import Format") );
formatLabel->setFont ( Graphics::getNormalFont(true) );
hLayout2->addWidget ( formatLabel );
#if 0
_formatComboBox->addItem ( tr("ACM/SIGDA (aka MCNC, .bench)"), ImportCell::AcmSigda );
_formatComboBox->addItem ( tr("ISPD'04 (Bookshelf)") , ImportCell::Ispd04 );
_formatComboBox->addItem ( tr("ISPD'05 (Bookshelf)") , ImportCell::Ispd05 );
_formatComboBox->addItem ( tr("ICCAD'04 (LEF/DEF)") , ImportCell::Iccad04 );
_formatComboBox->addItem ( tr("Alliance compliant DEF") , ImportCell::AllianceDef );
#endif
hLayout2->addWidget ( _formatComboBox );
QVBoxLayout* vLayout = new QVBoxLayout ();
vLayout->setSizeConstraint ( QLayout::SetFixedSize );
vLayout->addWidget ( label );
vLayout->addWidget ( _lineEdit );
vLayout->addLayout ( hLayout2 );
vLayout->addWidget ( _viewerCheckBox );
vLayout->addWidget ( separator );
vLayout->addLayout ( hLayout1 );
setLayout ( vLayout );
//setModal ( true );
connect ( okButton, SIGNAL(clicked()), this, SLOT(accept()) );
connect ( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) );
}
void ImportCellDialog::addFormat ( QString menuName, int index )
{
_formatComboBox->addItem( menuName, index );
}
const QString ImportCellDialog::getCellName () const
{ return _lineEdit->text(); }
bool ImportCellDialog::useNewViewer () const
{ return _viewerCheckBox->isChecked(); }
bool ImportCellDialog::runDialog ( QString& name, int& format, bool& newViewerRequest )
{
bool dialogResult = (exec() == Accepted);
name = getCellName ();
newViewerRequest = useNewViewer ();
format = getFormat ();
return dialogResult;
}
int ImportCellDialog::getFormat () const
{
int index = _formatComboBox->currentIndex();
if ( index < 0 ) return 0;
return _formatComboBox->itemData(index).toInt();
}
} // End of Unicorn namespace.