2010-03-09 09:26:22 -06:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
New Library Manager Widget. Access with Tools menu or CTRL+M.
* New: In CRL Core, created a LibraryManager widget. It provides a
composite information based on what is present, for each
Alliance library:
1. - A Cell in memory, without Catalog::State.
2. - A Catalog::State, with or whithout the Cell in memory.
3. - The files of the Cell in the librariy's directory.
4. - A file with a format referenced for one of the importers.
File type recognition is based *only* on the file extension,
so it may easily confused. Be careful about what you put in
the library's directory.
One of the big limitation is that it will not display Hurricane
libraries that do not have the AllianceLibrary extension.
This widget is put in a separate library <libmanager>, included
in the default CRLCORE_LIBRARIES.
* Change: In CRL Core, in State (through the loader), now sets the
InMemory flag (event if nobody uses it yet...). Display it in
the state _getString().
In AllianceFramework, new getAllianceLibraries() method.
In CatalogExtension, make the static method "get()" publicly
accessible, for sometimes we want the whole State.
* Bug: In vlsisapd, in Path, the pathcache was not rebuild when it
should, leading to incorrect results.
* New: In vlsisapd, in Path, added a listdir() method to access the
contents of a directory and a stat() method to poll the status
of a file/directory.
Rename the ".string()" method in ".toString()" to avoid
tricky name resolution with std::string, refactor in all the
other tools.
* Change: In Hurricane, in Controller, no longer oversize the fonts
of the table's headers.
* New: In Unicorn, in UnicornGui, integrate LibraryManager.
2015-05-09 10:03:17 -05:00
|
|
|
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
2010-03-09 09:26:22 -06:00
|
|
|
//
|
2012-11-16 06:54:58 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:26:22 -06: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 |
|
|
|
|
// | =============================================================== |
|
2010-05-14 02:37:33 -05:00
|
|
|
// | C++ Module : "./OpenCellDialog.cpp" |
|
2012-11-16 06:54:58 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:26:22 -06:00
|
|
|
|
|
|
|
|
New Library Manager Widget. Access with Tools menu or CTRL+M.
* New: In CRL Core, created a LibraryManager widget. It provides a
composite information based on what is present, for each
Alliance library:
1. - A Cell in memory, without Catalog::State.
2. - A Catalog::State, with or whithout the Cell in memory.
3. - The files of the Cell in the librariy's directory.
4. - A file with a format referenced for one of the importers.
File type recognition is based *only* on the file extension,
so it may easily confused. Be careful about what you put in
the library's directory.
One of the big limitation is that it will not display Hurricane
libraries that do not have the AllianceLibrary extension.
This widget is put in a separate library <libmanager>, included
in the default CRLCORE_LIBRARIES.
* Change: In CRL Core, in State (through the loader), now sets the
InMemory flag (event if nobody uses it yet...). Display it in
the state _getString().
In AllianceFramework, new getAllianceLibraries() method.
In CatalogExtension, make the static method "get()" publicly
accessible, for sometimes we want the whole State.
* Bug: In vlsisapd, in Path, the pathcache was not rebuild when it
should, leading to incorrect results.
* New: In vlsisapd, in Path, added a listdir() method to access the
contents of a directory and a stat() method to poll the status
of a file/directory.
Rename the ".string()" method in ".toString()" to avoid
tricky name resolution with std::string, refactor in all the
other tools.
* Change: In Hurricane, in Controller, no longer oversize the fonts
of the table's headers.
* New: In Unicorn, in UnicornGui, integrate LibraryManager.
2015-05-09 10:03:17 -05:00
|
|
|
#include <iostream>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QButtonGroup>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include "hurricane/Warning.h"
|
|
|
|
#include "hurricane/viewer/Graphics.h"
|
|
|
|
#include "crlcore/Environment.h"
|
|
|
|
#include "crlcore/AllianceFramework.h"
|
|
|
|
#include "unicorn/OpenCellDialog.h"
|
2010-03-09 09:26:22 -06:00
|
|
|
|
|
|
|
|
|
|
|
namespace Unicorn {
|
|
|
|
|
New Library Manager Widget. Access with Tools menu or CTRL+M.
* New: In CRL Core, created a LibraryManager widget. It provides a
composite information based on what is present, for each
Alliance library:
1. - A Cell in memory, without Catalog::State.
2. - A Catalog::State, with or whithout the Cell in memory.
3. - The files of the Cell in the librariy's directory.
4. - A file with a format referenced for one of the importers.
File type recognition is based *only* on the file extension,
so it may easily confused. Be careful about what you put in
the library's directory.
One of the big limitation is that it will not display Hurricane
libraries that do not have the AllianceLibrary extension.
This widget is put in a separate library <libmanager>, included
in the default CRLCORE_LIBRARIES.
* Change: In CRL Core, in State (through the loader), now sets the
InMemory flag (event if nobody uses it yet...). Display it in
the state _getString().
In AllianceFramework, new getAllianceLibraries() method.
In CatalogExtension, make the static method "get()" publicly
accessible, for sometimes we want the whole State.
* Bug: In vlsisapd, in Path, the pathcache was not rebuild when it
should, leading to incorrect results.
* New: In vlsisapd, in Path, added a listdir() method to access the
contents of a directory and a stat() method to poll the status
of a file/directory.
Rename the ".string()" method in ".toString()" to avoid
tricky name resolution with std::string, refactor in all the
other tools.
* Change: In Hurricane, in Controller, no longer oversize the fonts
of the table's headers.
* New: In Unicorn, in UnicornGui, integrate LibraryManager.
2015-05-09 10:03:17 -05:00
|
|
|
using namespace std;
|
2010-03-09 09:26:22 -06:00
|
|
|
using Hurricane::Warning;
|
|
|
|
using Hurricane::Graphics;
|
|
|
|
using CRL::Environment;
|
|
|
|
using CRL::AllianceFramework;
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2010-05-14 02:37:33 -05:00
|
|
|
// Class : "OpenCellDialog".
|
2010-03-09 09:26:22 -06:00
|
|
|
|
|
|
|
|
2010-05-14 02:37:33 -05:00
|
|
|
OpenCellDialog::OpenCellDialog ( QWidget* parent )
|
|
|
|
: QDialog (parent)
|
|
|
|
, _lineEdit (NULL)
|
2010-03-09 09:26:22 -06:00
|
|
|
, _viewerCheckBox(NULL)
|
|
|
|
{
|
|
|
|
setWindowTitle ( tr("Open Cell") );
|
|
|
|
|
|
|
|
QLabel* label = new QLabel ();
|
|
|
|
label->setText ( tr("Enter Cell name (without extention)") );
|
|
|
|
label->setFont ( Graphics::getNormalFont(true) );
|
|
|
|
|
|
|
|
_lineEdit = new QLineEdit ();
|
|
|
|
_lineEdit->setMinimumWidth ( 400 );
|
|
|
|
|
|
|
|
_viewerCheckBox = new QCheckBox ();
|
|
|
|
_viewerCheckBox->setText ( tr("Open 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 ();
|
|
|
|
|
2010-08-18 15:27:18 -05:00
|
|
|
#if DEPRECATED
|
2010-03-09 09:26:22 -06:00
|
|
|
QFrame* separator = new QFrame ();
|
|
|
|
separator->setFrameShape ( QFrame::HLine );
|
|
|
|
separator->setFrameShadow ( QFrame::Sunken );
|
|
|
|
|
|
|
|
QHBoxLayout* hLayout2 = new QHBoxLayout ();
|
|
|
|
QButtonGroup* formatGroup = new QButtonGroup ();
|
|
|
|
|
|
|
|
QRadioButton* formatButton = new QRadioButton ();
|
|
|
|
formatButton->setText ( tr("vst/ap") );
|
|
|
|
formatButton->setChecked ( true );
|
|
|
|
formatGroup->setId ( formatButton, 0 );
|
|
|
|
formatGroup->addButton ( formatButton );
|
|
|
|
hLayout2->addWidget ( formatButton );
|
|
|
|
|
|
|
|
formatButton = new QRadioButton ();
|
|
|
|
formatButton->setText ( tr("DEF") );
|
|
|
|
formatButton->setChecked ( false );
|
|
|
|
formatGroup->setId ( formatButton, 1 );
|
|
|
|
formatGroup->addButton ( formatButton );
|
|
|
|
hLayout2->addWidget ( formatButton );
|
2010-08-18 15:27:18 -05:00
|
|
|
#endif // DEPRECATED
|
2010-03-09 09:26:22 -06:00
|
|
|
|
|
|
|
QVBoxLayout* vLayout = new QVBoxLayout ();
|
|
|
|
vLayout->setSizeConstraint ( QLayout::SetFixedSize );
|
|
|
|
vLayout->addWidget ( label );
|
|
|
|
vLayout->addWidget ( _lineEdit );
|
|
|
|
vLayout->addWidget ( _viewerCheckBox );
|
|
|
|
vLayout->addLayout ( hLayout1 );
|
2010-08-18 15:27:18 -05:00
|
|
|
//vLayout->addWidget ( separator );
|
|
|
|
//vLayout->addLayout ( hLayout2 );
|
2010-03-09 09:26:22 -06:00
|
|
|
|
|
|
|
setLayout ( vLayout );
|
|
|
|
//setModal ( true );
|
|
|
|
|
|
|
|
connect ( okButton, SIGNAL(clicked()) , this, SLOT(accept()) );
|
|
|
|
connect ( cancelButton, SIGNAL(clicked()) , this, SLOT(reject()) );
|
2010-08-18 15:27:18 -05:00
|
|
|
//connect ( formatGroup , SIGNAL(buttonClicked(int)), this, SLOT(formatChanged(int)) );
|
2010-03-09 09:26:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-14 02:37:33 -05:00
|
|
|
const QString OpenCellDialog::getCellName () const
|
2010-03-09 09:26:22 -06:00
|
|
|
{
|
|
|
|
return _lineEdit->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-14 02:37:33 -05:00
|
|
|
bool OpenCellDialog::newViewerRequest () const
|
2010-03-09 09:26:22 -06:00
|
|
|
{
|
|
|
|
return _viewerCheckBox->isChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-14 02:37:33 -05:00
|
|
|
bool OpenCellDialog::runDialog ( QWidget* parent, QString& name, bool& newViewerRequest )
|
2010-03-09 09:26:22 -06:00
|
|
|
{
|
2010-05-14 02:37:33 -05:00
|
|
|
OpenCellDialog* dialog = new OpenCellDialog ( parent );
|
2010-03-09 09:26:22 -06:00
|
|
|
bool dialogResult = (dialog->exec() == Accepted);
|
|
|
|
|
|
|
|
name = dialog->getCellName ();
|
|
|
|
newViewerRequest = dialog->newViewerRequest ();
|
|
|
|
|
|
|
|
delete dialog;
|
|
|
|
|
|
|
|
return dialogResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-18 15:27:18 -05:00
|
|
|
#if DEPRECATED
|
2010-05-14 02:37:33 -05:00
|
|
|
void OpenCellDialog::formatChanged ( int index )
|
2010-03-09 09:26:22 -06:00
|
|
|
{
|
|
|
|
Environment* environment = AllianceFramework::get()->getEnvironment();
|
|
|
|
switch ( index ) {
|
|
|
|
case 0:
|
|
|
|
environment->setIN_LO ( "vst" );
|
|
|
|
environment->setIN_PH ( "ap" );
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
environment->setIN_LO ( "def" );
|
|
|
|
environment->setIN_PH ( "def" );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
cerr << Warning("Unknown input format: %d.",index) << endl;
|
|
|
|
}
|
|
|
|
}
|
2010-08-18 15:27:18 -05:00
|
|
|
#endif
|
2010-03-09 09:26:22 -06:00
|
|
|
|
|
|
|
|
|
|
|
} // End of Unicorn namespace.
|