Public Slots | Public Member Functions | Protected Member Functions | Protected Attributes
MainWindow Class Reference

Brief description of class still missing. More...

#include <MainWindow.h>

List of all members.

Public Slots

void about ()
void copyImage ()
void currentFileChanged (const QString &fileName)
void exportImage ()
void fileExit ()
void helpDocumentation ()
void newView ()
virtual void printDocument ()
void refreshScene ()
void rotateView ()
virtual void saveDocument ()
virtual void saveDocumentAs ()
void selectAll ()
void setActiveProject (MultiDocumentSubWindow *w)
void setBackground ()
void setDimensionMode ()
void setEllipseMode ()
void setLineMode ()
void setMoveMode ()
void setRectMode ()
void setSnapContours ()
void setSnapGrid ()
void setSnapNodes ()
void setSnapX ()
void setSnapY ()
void setTextMode ()

Public Member Functions

void addBackground (GeophysicalModel *m, QString comments)
bool addCommand (MapProject *p, const QString &cmd)
void createView (MapProject *p)
void loadPanel (QString fileName)
 MainWindow (QWidget *parent=0, Qt::WFlags fl=Qt::Window)
 MainWindow (QWidget *parent=0, Qt::WindowFlags f=0)
 MainWindow (QWidget *parent=0)
void projectClosed (MapProject *p)
QList< MapProject * > projects () const
Resultsresults () const
int scan (GeophysicalModel *m, QString sliderPattern, int nSteps)
GraphicSheetsheet ()
 ~MainWindow ()
 ~MainWindow ()

Protected Member Functions

void addActions ()
void closeEvent (QCloseEvent *e)
void closeEvent (QCloseEvent *e)

Protected Attributes

GraphicSheet_sheet

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

MainWindow::MainWindow ( QWidget *  parent = 0,
Qt::WindowFlags  f = 0 
)

Description of constructor still missing

References QGpGuiTools::LogWidget::addView(), setActiveProject(), QGpCoreTools::tr(), and TRACE.

    : MultiDocumentWindow(parent, f)
{
  TRACE;
  _currentView=0;

  resize(QSize( 674, 523).expandedTo(minimumSizeHint()) );
  setWindowIcon(QIcon( ":/images/logo-16x16.png" ));
  setWindowTitle(tr( "FastMap" ));

  QDockWidget * bDock=new QDockWidget;
  bDock->setObjectName("Console");
  bDock->setWindowTitle(tr( "Console"));
  bDock->setFeatures (QDockWidget::AllDockWidgetFeatures);
  bDock->setAllowedAreas(Qt::AllDockWidgetAreas);
  _console=new DrawConsole(bDock);
  bDock->setWidget(_console);
  addDockWidget(Qt::LeftDockWidgetArea, bDock);

  QDockWidget * logDock=new QDockWidget;
  logDock->setObjectName( "Log" );
  logDock->setWindowTitle(tr( "Log" ));
  logDock->setFeatures (QDockWidget::AllDockWidgetFeatures);
  logDock->setAllowedAreas(Qt::AllDockWidgetAreas);
  LogWidget * logs=new LogWidget (logDock);
  logs->addView(QThread::currentThread(), tr("Messages"));
  logDock->setWidget(logs);
  addDockWidget(Qt::LeftDockWidgetArea, logDock);

  addActions();

  // Add at least one tab (after windows menu is created)
  addTab();

  connect(this, SIGNAL(activeWindowChanged(MultiDocumentSubWindow *)),
           this, SLOT(setActiveProject(MultiDocumentSubWindow *)));

  QSettings reg;
  restoreState(reg.value("Workspace").toByteArray(), 0);

}

Description of destructor still missing

References TRACE.

{
  TRACE;
  QSettings reg;
  reg.setValue( "Workspace", saveState(0) );
}
MainWindow::MainWindow ( QWidget *  parent = 0,
Qt::WFlags  fl = Qt::Window 
)

References _sheet, currentFileChanged(), FIGUE_VERSION, FIGUE_VERSION_TYPE, QGpGuiTools::UpdateIcon::setName(), SciFigs::GraphicSheet::setStatusBar(), QGpGuiTools::UpdateIcon::setVersion(), QGpGuiTools::UpdateIcon::setVersionType(), QGpCoreTools::tr(), and TRACE.

    : QMainWindow(parent, fl)
{
  TRACE;
  resize(QSize(778, 533).expandedTo(minimumSizeHint()));
  setWindowTitle(tr("figue"));
  setWindowIcon(QIcon(":/images/figue-48x48.png"));
  _sheet=new GraphicSheet(this);
  _sheet->setObjectName("sheet");
  setCentralWidget(_sheet);

  UpdateIcon * liveUpdate=new UpdateIcon(statusBar());
  liveUpdate->setName("figue");
  liveUpdate->setVersion(FIGUE_VERSION);
  liveUpdate->setVersionType(FIGUE_VERSION_TYPE);
  statusBar() ->addPermanentWidget(liveUpdate, 0);

  _sheet->setStatusBar(statusBar());

  statusBar() ->setSizeGripEnabled(true);
  statusBar() ->showMessage(tr("Ready"), 2000);
  connect(_sheet, SIGNAL(currentFileChanged(const QString&)),
          this, SLOT(currentFileChanged(const QString&)));
  addActions();
}
MainWindow::MainWindow ( QWidget *  parent = 0)

Description of constructor still missing

References setBackground(), QGpCoreTools::tr(), and TRACE.

    : QMainWindow(parent)
{
  TRACE;
  setAttribute(Qt::WA_DeleteOnClose, false);

  _templateModel=0;
  _results=new Results(this);
  setCentralWidget(_results);

  _backgroundModels=new QPlainTextEdit(this);
  _backgroundModels->setLineWrapMode(QPlainTextEdit::NoWrap);
  connect(_backgroundModels, SIGNAL(textChanged()), this, SLOT(setBackground()) );

  DockWidget * dockBg=new DockWidget(this);
  connect(dockBg, SIGNAL(hidden()), this, SLOT(setToolsMenuState()), Qt::QueuedConnection);
  dockBg->setObjectName( "BackgroundModels" );
  dockBg->setWindowTitle(tr("Background models"));
  dockBg->setFeatures (QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
  dockBg->setAllowedAreas(Qt::AllDockWidgetAreas);
  dockBg->setWidget(_backgroundModels);
  addDockWidget(Qt::BottomDockWidgetArea, dockBg);

  _referenceModel=new QPlainTextEdit(this);
  _referenceModel->setLineWrapMode(QPlainTextEdit::NoWrap);
  connect(_referenceModel, SIGNAL(textChanged()), this, SLOT(setReferenceModel()) );

  DockWidget * dockRef=new DockWidget(this);
  connect(dockRef, SIGNAL(hidden()), this, SLOT(setToolsMenuState()), Qt::QueuedConnection);
  dockRef->setObjectName( "ReferenceModel" );
  dockRef->setWindowTitle(tr("Reference model"));
  dockRef->setFeatures (QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
  dockRef->setAllowedAreas(Qt::AllDockWidgetAreas);
  dockRef->setWidget(_referenceModel);
  addDockWidget(Qt::BottomDockWidgetArea, dockRef);
  tabifyDockWidget(dockBg, dockRef);

  _foregroundModel=new QPlainTextEdit(this);
  _foregroundModel->setLineWrapMode(QPlainTextEdit::NoWrap);
  _foregroundModel->setReadOnly(true);

  DockWidget * dockFg=new DockWidget(this);
  connect(dockFg, SIGNAL(hidden()), this, SLOT(setToolsMenuState()), Qt::QueuedConnection);
  dockFg->setObjectName( "ForegroundModel" );
  dockFg->setWindowTitle(tr("Foreground model"));
  dockFg->setFeatures (QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
  dockFg->setAllowedAreas(Qt::AllDockWidgetAreas);
  dockFg->setWidget(_foregroundModel);
  addDockWidget(Qt::BottomDockWidgetArea, dockFg);
  tabifyDockWidget(dockRef, dockFg);

  _controlPanel=new ControlPanel(this);
  connect(_controlPanel, SIGNAL(modelChanged(GeophysicalModel * )), this, SLOT(setForeground(GeophysicalModel *)) );

  DockWidget * dockCp=new DockWidget(this);
  connect(dockCp, SIGNAL(hidden()), this, SLOT(setToolsMenuState()), Qt::QueuedConnection);
  dockCp->setObjectName( "ControlPanel" );
  dockCp->setWindowTitle(tr("Control Panel"));
  dockCp->setFeatures (QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
  dockCp->setAllowedAreas(Qt::AllDockWidgetAreas);
  dockCp->setWidget(_controlPanel);
  addDockWidget(Qt::BottomDockWidgetArea, dockCp);

  addActions();
}

Member Function Documentation

void MainWindow::about ( ) [slot]

References FIGUE_DISTRIBUTION, FIGUE_VERSION, QGpGuiTools::Dialog::setMainWidget(), QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  QString version("Version: ");
  version+=FIGUE_VERSION;
  if(strlen(FIGUE_DISTRIBUTION)>0) {
    version+=" (";
    version+=FIGUE_DISTRIBUTION;
    version+=")";
  }
  Dialog * d=new Dialog(this);
  d->setWindowTitle(tr("About figue"));
  d->setMinimumSize(500,300);
  QLabel * text=new QLabel;
  text->setTextFormat(Qt::RichText);
  text->setWordWrap(true);
  text->setOpenExternalLinks(true);
  text->setText(tr("<p>%1</p>"
                   "<p>Figue is a graphical tool to modify, fix, customize, polish... all figures copied from "
                   "processing softwares such as Geopsy or Dinver. Additionally, Figue can help you create "
                   "plots from data.</p>"
                   "<p>Using, Copying and Modifying this program is granted to everyone under the terms "
                   "of the GNU Public License version 2. <b>However, we would appreciate that you properly "
                   "reference this work, released for free, in all your publications or reports achieved "
                   "with this software.</b></p>"
                   "<p>This program is provided AS IS with NO WARRANTY OF ANY KIND, "
                   "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS "
                   "FOR A PARTICULAR PURPOSE.</p>").arg(version));
  d->setMainWidget(text, Dialog::Close);
  d->exec();
  delete d;
}
void MainWindow::addActions ( ) [protected]
void MainWindow::addBackground ( GeophysicalModel m,
QString  comments 
)

References Results::addBackground(), QGpCoreWave::GeophysicalModel::toStream(), and TRACE.

Referenced by LiveModelReader::parse().

{
  TRACE;
  _backgroundModels->blockSignals(true);
  if(!comments.isEmpty()) {
    if(comments.right(1)=="\n") comments.chop(1);
    _backgroundModels->appendPlainText(comments);
  }
  QString mText;
  QTextStream s(&mText);
  m->toStream(s);
  _backgroundModels->appendPlainText(mText);
  _backgroundModels->blockSignals(false);
  _results->addBackground(m);
}
bool MainWindow::addCommand ( MapProject p,
const QString &  cmd 
)

Add command cmd to the console if p is the current project

References DrawConsole::addCommand(), DrawConsole::currentProject(), and TRACE.

{
  TRACE;
  if(p==_console->currentProject()) {
    _console->addCommand(cmd);
    return true;
  } else {
    return false;
  }
}
void MainWindow::closeEvent ( QCloseEvent *  e) [protected]

References TRACE.

{
  TRACE;
  qApp->quit();
  e->ignore();
}
void MainWindow::closeEvent ( QCloseEvent *  e) [protected]
void MainWindow::copyImage ( ) [slot]

References TRACE.

{
  TRACE;

}

References MapProject::addView(), and TRACE.

Referenced by MainEnvironment::newDocument(), newView(), and MainEnvironment::openDocument().

{
  TRACE;
  MapView * v=new MapView;
  p->addView(v);
  addWindow(v);
}
void MainWindow::currentFileChanged ( const QString &  fileName) [slot]

References TRACE.

Referenced by MainWindow().

{
  TRACE;
  setWindowTitle("figue - " + fileName);
}
void MainWindow::exportImage ( ) [slot]
void MainWindow::fileExit ( ) [slot]

References TRACE.

{
  TRACE;
  qApp->quit();
}

References TRACE.

{
  TRACE;
  QDesktopServices::openUrl(QUrl("http://www.geopsy.org/wiki/index.php/SciFigs:_Figue"));
}
void MainWindow::loadPanel ( QString  fileName)

References ControlPanel::load(), and TRACE.

Referenced by LiveModelReader::setOptions().

{
  TRACE;
  _controlPanel->load(fileName);
}
void MainWindow::newView ( ) [slot]

References createView(), DrawConsole::currentProject(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p) {
    createView(p);
  }
}
void MainWindow::printDocument ( ) [virtual, slot]

References DrawConsole::currentProject(), MapProject::print(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p) {
    p->print();
  }
}

References MapView::project(), DrawConsole::setCurrentProject(), and TRACE.

Referenced by MainEnvironment::quit().

{
  TRACE;
  if(_currentView && _currentView->project()==p) {
    _currentView=0;
    _console->setCurrentProject(0);
    setWindowTitle("FastMap");
  }
}
QList< MapProject * > MainWindow::projects ( ) const

References TRACE, and QGpCoreTools::unique().

Referenced by MainEnvironment::projects().

{
  TRACE;
  QList<MapView *> vList=findChildren<MapView *>();
  QList<MapProject *> pList;
  for(QList<MapView *>::iterator it=vList.begin(); it!=vList.end();it++) {
    pList.append((*it)->project());
  }
  qSort(pList);
  unique(pList);
  return pList;
}
void MainWindow::refreshScene ( ) [slot]

References DrawConsole::currentProject(), MapView::project(), DrawConsole::script(), MapProject::setScript(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->project()->setScript(_console->script());
  }
}
Results* MainWindow::results ( ) const [inline]

Referenced by LiveModelReader::setOptions().

{return _results;}
void MainWindow::rotateView ( ) [slot]

References DrawConsole::currentProject(), MapView::setRotation(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setRotation();
  }
}
void MainWindow::saveDocument ( ) [virtual, slot]

References DrawConsole::currentProject(), MapProject::save(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p) {
    p->save();
  }
}
void MainWindow::saveDocumentAs ( ) [virtual, slot]

References DrawConsole::currentProject(), MapProject::saveAs(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p) {
    p->saveAs();
  }
}
int MainWindow::scan ( GeophysicalModel m,
QString  sliderPattern,
int  nSteps 
)

References QGpCoreTools::Curve< pointType >::begin(), Results::calculator(), CurvesThread::curves(), QGpCoreTools::endl(), ModelSlider::modify(), CurvesThread::run(), ControlPanel::slider(), sOut(), QGpCoreTools::tr(), and TRACE.

Referenced by LiveModelReader::parse().

{
  TRACE;
  ModelSlider * slider=_controlPanel->slider(sliderName);
  nSteps--;
  double fac=1.0/(double)nSteps;
  CurvesThread * calc=qobject_cast<CurvesThread *>(_results->calculator());
  if(!calc) {
    App::stream() << tr("Only curve types are accepted for scan: e.g. dispersion, ellipticity,...") << endl;
    return 2;
  }
  QTextStream sOut(stdout);
  for(int i=0; i<=nSteps; i++) {
    if( !slider->modify(m, i*fac) ) {
      App::stream() << tr("Bad model generated") << endl;
      return 2;
    }
    calc->run(m);
    sOut << tr("# p=%1").arg(i*fac) << endl;
    QList< Curve<Point2D> > cList=calc->curves();
    for(QList< Curve<Point2D> >::const_iterator it=cList.begin(); it!= cList.end(); it++ ) {
      sOut << it->toString();
    }
  }
  return 0;
}
void MainWindow::selectAll ( ) [slot]

References TRACE.

{
  TRACE;

}

References MapProject::fileName(), MapProject::name(), MapView::project(), DrawConsole::setCurrentProject(), DrawView::SnapContours, DrawView::SnapGrid, DrawView::SnapNodes, MapView::snapOption(), MapView::snapType(), DrawView::SnapX, DrawView::SnapY, and TRACE.

Referenced by MainWindow(), MainEnvironment::newDocument(), and MainEnvironment::openDocument().

{
  TRACE;
  MapView * mp=qobject_cast<MapView *>(w);
  if(mp) {
    _currentView=mp;
    MapProject * p=_currentView->project();
    _console->setCurrentProject(p);
    switch(_currentView->snapType()) {
    case DrawView::SnapNodes:
      _editSnapNodesAction->setChecked(true);
      break;
    case DrawView::SnapContours:
      _editSnapContoursAction->setChecked(true);
      break;
    case DrawView::SnapGrid:
      _editSnapGridAction->setChecked(true);
      break;
    default:
      break;
    }
    _editSnapXAction->setChecked(_currentView->snapOption() & DrawView::SnapX);
    _editSnapYAction->setChecked(_currentView->snapOption() & DrawView::SnapY);
    if(p->fileName().isEmpty()) {
      setWindowTitle("FastMap - "+_currentView->project()->name());
    } else {
      setWindowTitle("FastMap - "+_currentView->project()->fileName());
    }
  } else {
    _currentView=0;
    _console->setCurrentProject(0);
    setWindowTitle("FastMap");
  }
}
void MainWindow::setBackground ( ) [slot]

References Results::addBackground(), Results::calculateBackground(), Results::clearBackground(), Results::createModel(), QGpCoreTools::endl(), QGpCoreWave::GeophysicalModel::fromStream(), QGpCoreWave::GeophysicalModel::isEmpty(), str, QGpCoreTools::tr(), and TRACE.

Referenced by LiveModelReader::exec(), and MainWindow().

{
  TRACE;
  QString str=_backgroundModels->toPlainText();
  GeophysicalModel * m;
  QTextStream s(&str);
  _results->clearBackground();
  int n=0;
  while(!s.atEnd()) {
    m=_results->createModel();
    if(!m->fromStream(s)) {
      App::stream() << tr("Error parsing background models") << endl;
      delete m;
      return;
    }
    if(!m->isEmpty()) {
      _results->addBackground(m);
      n++;
    }
  }
  App::stream() << tr("%1 background model(s)").arg(n) << endl;
  _results->calculateBackground();
}

References DrawConsole::currentProject(), MapView::Dimension, MapView::setMode(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setMode(MapView::Dimension);
  }
}
void MainWindow::setEllipseMode ( ) [slot]

References DrawConsole::currentProject(), MapView::Ellipse, MapView::setMode(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setMode(MapView::Ellipse);
  }
}
void MainWindow::setLineMode ( ) [slot]

References DrawConsole::currentProject(), MapView::Line, MapView::setMode(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setMode(MapView::Line);
  }
}
void MainWindow::setMoveMode ( ) [slot]

References DrawConsole::currentProject(), MapView::Move, MapView::setMode(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setMode(MapView::Move);
  }
}
void MainWindow::setRectMode ( ) [slot]

References DrawConsole::currentProject(), MapView::Rect, MapView::setMode(), and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setMode(MapView::Rect);
  }
}
void MainWindow::setSnapContours ( ) [slot]
void MainWindow::setSnapGrid ( ) [slot]

References DrawConsole::currentProject(), MapView::setSnapType(), DrawView::SnapGrid, and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setSnapType(DrawView::SnapGrid);
  }
}
void MainWindow::setSnapNodes ( ) [slot]

References DrawConsole::currentProject(), MapView::setSnapType(), DrawView::SnapNodes, and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setSnapType(DrawView::SnapNodes);
  }
}
void MainWindow::setSnapX ( ) [slot]

References DrawConsole::currentProject(), MapView::setSnapOption(), MapView::snapOption(), DrawView::SnapX, and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    if(_editSnapXAction->isChecked()) {
      _currentView->setSnapOption(_currentView->snapOption() | DrawView::SnapX);
    } else {
      _currentView->setSnapOption(_currentView->snapOption() ^ DrawView::SnapX);
    }
  }
}
void MainWindow::setSnapY ( ) [slot]

References DrawConsole::currentProject(), MapView::setSnapOption(), MapView::snapOption(), DrawView::SnapY, and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    if(_editSnapYAction->isChecked()) {
      _currentView->setSnapOption(_currentView->snapOption() | DrawView::SnapY);
    } else {
      _currentView->setSnapOption(_currentView->snapOption() ^ DrawView::SnapY);
    }
  }
}
void MainWindow::setTextMode ( ) [slot]

References DrawConsole::currentProject(), MapView::setMode(), MapView::Text, and TRACE.

{
  TRACE;
  MapProject * p=_console->currentProject();
  if(p && _currentView) {
    _currentView->setMode(MapView::Text);
  }
}

References _sheet.

Referenced by main().

{return _sheet;}

Member Data Documentation

Referenced by MainWindow(), and sheet().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines