Public Slots | Signals | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
GeopsyMainWindow Class Reference

#include <GeopsyMainWindow.h>

List of all members.

Public Slots

void activeWindowChanged (QWidget *w)
void addWindow (QWidget *w)
void clearAll ()
Q_SCRIPTABLE void closeAllWindows ()
Q_SCRIPTABLE void createNewGroup ()
void directoryMonitor ()
void exportSignal ()
Q_SCRIPTABLE void fftAmpl ()
Q_SCRIPTABLE void fftPhase ()
Q_SCRIPTABLE void fftTime ()
Q_SCRIPTABLE void helpAbout ()
Q_SCRIPTABLE void helpDocumentation ()
void hideProgressBar ()
void importTable ()
void increaseProgressValue (int value=1)
void load ()
void loadCity ()
void loadFilePattern ()
SubPoolWindownewChronogramWindow ()
SubPoolWindownewChronogramWindow (const SubSignalPool &subPool)
AbstractGraphicWindownewGraphicWindow ()
AbstractGraphicWindownewGraphicWindow (const SubSignalPool &subPool)
SubPoolWindownewMapWindow ()
SubPoolWindownewMapWindow (const SubSignalPool &subPool)
SubPoolWindownewTableWindow ()
SubPoolWindownewTableWindow (const SubSignalPool &subPool)
void openDB (QString fileName=QString::null)
int progressMaximum ()
int progressValue ()
void quit (bool force=false)
void removeWindow (QWidget *w)
void saveDB ()
void saveDBAs ()
void seedlink (QByteArray serverAddress=0, qint16 serverPort=0, QString streamSelection=QString::null)
Q_SCRIPTABLE void setHeader ()
void setPreferences ()
void setProgressMaximum (int value)
void setProgressValue (int value)
Q_SCRIPTABLE void setReceivers ()
Q_SCRIPTABLE void setSources ()
void setSubPoolActionEnabled (bool b, bool rw)
Q_SCRIPTABLE void setTableLocked (bool l)
void showDBStatus ()
void showLoadedSignals (const SubSignalPool &subPool)
void showMessage (QString message)
void showToolBarMenu ()
void showWindow (QWidget *w)
Q_SCRIPTABLE void sort ()
void tileHorizontal ()
void updateWindowTitle (QWidget *w)
Q_SCRIPTABLE void viewRefreshNow ()
Q_SCRIPTABLE void viewSetDataFields ()
void windowsMenuAdd (QWidget *w)
void windowsMenuRemove (QWidget *w)
void windowsMenuSetCurrent (QWidget *w)
void windowsMenuTriggered ()
void windowsMinimize ()

Signals

void asyncIncreaseProgressValue (int value)
void asyncSetProgressMaximum (int value)
void asyncSetProgressValue (int value)
void asyncShowMessage (QString message)

Public Member Functions

SubPoolWindowcurrentSubPoolWin ()
void filesRemoved (const QList< SignalFile * > &fList)
 GeopsyMainWindow (QWidget *parent=0, Qt::WFlags fl=0)
void initTools ()
bool isTableEditionLocked ()
ProgressBarprogressBar () const
virtual ProgressBarprogressBar ()
void refreshLists ()
void setToolFactory (ToolFactory *tf)
void startupPreferences ()
virtual QStatusBar * statusBar ()
ToolFactorytoolFactory ()
virtual bool useProgress ()
const QAction * viewGraphicAction () const
const QAction * viewMapAction () const
const QAction * viewTableAction () const
QWorkspace * workspace ()
 ~GeopsyMainWindow ()

Static Public Member Functions

static QAction * newAction (const QAction &original, QWidget *parent=0)

Public Attributes

QLabel * databaseInfo

Protected Member Functions

virtual void closeEvent (QCloseEvent *e)
virtual void dragEnterEvent (QDragEnterEvent *event)
virtual void dragMoveEvent (QDragMoveEvent *event)
virtual void dropEvent (QDropEvent *event)
bool warnBeforeClear (QString action)

Protected Attributes

uint _dbStatusChecksum
QTimer _dbStatusTimer
DirectoryMonitor_directoryMonitor
QMenu * _editMenu
QAction * _fftAmplitudeAction
QAction * _fftPhaseAction
QAction * _fftTimeAction
QAction * _fileExportAction
QAction * _fileImportAction
FileView_fList
GroupWidget_gList
QMenu * _importSignalMenu
ProgressBar_progressBar
QTimer _progressHideTimer
SeedLinkLoader_seedLink
SubPoolWindow_subPoolWin
bool _tableEditionLocked
QMenu * _toolBarsMenu
ToolFactory_toolFactory
QToolBar * _toolsBar
QMenu * _toolsMenu
QAction * _viewChronogramAction
QAction * _viewGraphicAction
QAction * _viewMapAction
QMenu * _viewMenu
QAction * _viewSetDataFieldsAction
QAction * _viewTableAction
WaveformConsole_waveformConsole
QMenu * _waveMenu
QAction * _windowsCascadeAction
QAction * _windowsCloseAllAction
QMenu * _windowsMenu
QAction * _windowsMinimizeAction
QAction * _windowsTileHAction
QAction * _windowsTileVAction
QWorkspace * _ws

Friends

class GeopsyMainWindowInt

Constructor & Destructor Documentation

GeopsyMainWindow::GeopsyMainWindow ( QWidget *  parent = 0,
Qt::WFlags  fl = 0 
)

References _dbStatusChecksum, _dbStatusTimer, _directoryMonitor, _fList, _gList, _progressBar, _progressHideTimer, _seedLink, _subPoolWin, _tableEditionLocked, _toolFactory, _viewChronogramAction, _viewGraphicAction, _viewMapAction, _viewTableAction, _waveformConsole, _ws, activeWindowChanged(), QGpGuiTools::UpdateIcon::addPlugins(), QGpGuiTools::LogWidget::addView(), asyncIncreaseProgressValue(), asyncSetProgressMaximum(), asyncSetProgressValue(), asyncShowMessage(), databaseInfo, QGpCoreTools::endl(), hideProgressBar(), increaseProgressValue(), newChronogramWindow(), newGraphicWindow(), newMapWindow(), newTableWindow(), SigSelectionDnD::setDragEnabled(), QGpGuiTools::ProgressBar::setMaximum(), QGpGuiTools::UpdateIcon::setName(), setProgressMaximum(), setProgressValue(), QGpGuiTools::UpdateIcon::setVersion(), QGpGuiTools::UpdateIcon::setVersionType(), QGpGuiTools::setWidgetColor(), showDBStatus(), showMessage(), statusBar(), QGpCoreTools::tr(), and TRACE.

                                                               :
    QMainWindow(parent, fl)
{
  TRACE;
  QSettings reg;

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

  _ws=new QWorkspace(this);
  _ws->setScrollBarsEnabled(true);

  _dbStatusChecksum=0;
  _dbStatusTimer.setInterval(1000);
  connect (&_dbStatusTimer, SIGNAL(timeout()), this, SLOT(showDBStatus()));
  _dbStatusTimer.start();

  connect (this, SIGNAL(asyncSetProgressMaximum(int)), this, SLOT(setProgressMaximum(int)), Qt::QueuedConnection);
  connect (this, SIGNAL(asyncSetProgressValue(int)), this, SLOT(setProgressValue(int)), Qt::QueuedConnection);
  connect (this, SIGNAL(asyncIncreaseProgressValue(int)), this, SLOT(increaseProgressValue(int)), Qt::QueuedConnection);
  connect (this, SIGNAL(asyncShowMessage(QString)), this, SLOT(showMessage( QString) ), Qt::QueuedConnection);

  QDockWidget * gDock=new DockWidget(this);
  gDock->setObjectName("Groups");
  gDock->setWindowTitle(tr("Groups"));
  gDock->setFeatures(QDockWidget::AllDockWidgetFeatures);
  gDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  _gList=new GroupWidget;
  gDock->setWidget(_gList);
  addDockWidget(Qt::LeftDockWidgetArea, gDock);

  QDockWidget * fDock=new DockWidget(this);
  fDock->setObjectName("Files");
  fDock->setWindowTitle(tr("Files"));
  fDock->setFeatures (QDockWidget::AllDockWidgetFeatures);
  fDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  _fList=new FileView (fDock);
  fDock->setWidget(_fList);
  addDockWidget(Qt::LeftDockWidgetArea, fDock);
  tabifyDockWidget(gDock, fDock);

  QDockWidget * cDock=new DockWidget(this);
  cDock->setObjectName("WaveformConsole");
  cDock->setWindowTitle(tr("Waveform console"));
  cDock->setFeatures (QDockWidget::AllDockWidgetFeatures);
  cDock->setAllowedAreas(Qt::AllDockWidgetAreas);
  _waveformConsole=new WaveformConsole (cDock);
  cDock->setWidget(_waveformConsole);
  addDockWidget(Qt::LeftDockWidgetArea, cDock);

  QDockWidget * logDock=new QDockWidget(this);
  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);
  tabifyDockWidget(cDock, logDock);

  setWidgetColor(_ws, QColor(220, 220, 220) );
  connect(_ws, SIGNAL(windowActivated( QWidget * )),
           this, SLOT(activeWindowChanged( QWidget * )) );
  setCentralWidget(_ws);

  databaseInfo=new QLabel(statusBar());
  statusBar() ->addPermanentWidget(databaseInfo, 0);

  UpdateIcon * liveUpdate=new UpdateIcon(statusBar());
  liveUpdate->setName("geopsy");
  liveUpdate->setVersion(GEOPSY_VERSION);
  liveUpdate->setVersionType(GEOPSY_VERSION_TYPE);
  reg.beginGroup("Plugins");
  liveUpdate->addPlugins(reg.value("pluginList").toStringList());
  statusBar()->addPermanentWidget(liveUpdate, 0);
  reg.endGroup();

  _progressBar=new ProgressBar(statusBar());
  _progressBar->setMinimum(0);
  _progressBar->setMaximum(100);
  _progressBar->setMaximumWidth(100);
  _progressBar->setMaximumHeight(20);
  _progressBar->setVisible(false);
  connect(&_progressHideTimer, SIGNAL(timeout()), this, SLOT(hideProgressBar()));
  _progressHideTimer.setInterval(2000);
  _progressHideTimer.setSingleShot(true);

  statusBar() ->addPermanentWidget(_progressBar, 0);
  statusBar() ->setSizeGripEnabled(true);
  statusBar() ->showMessage(tr( "Ready" ), 2000);

  addActions();
  _subPoolWin=0;
  _tableEditionLocked=true;
  _toolFactory=0;
  _seedLink=0;
  _directoryMonitor=0;
  activeWindowChanged(0);

  // The ToolButton are added automatically by actions
  // Try to get a pointer to them and add the DnD event filter
  QToolButton * viewGraphicToolBut=0, * viewTableToolBut=0, * viewMapToolBut=0, * viewChronogramToolBut=0;
  QList<QToolButton *> toolButList=findChildren<QToolButton *>();
  for(QList<QToolButton *>::iterator it=toolButList.begin(); it!=toolButList.end();++it) {
    if(( *it) ->defaultAction()==_viewGraphicAction)
      viewGraphicToolBut=* it;
    else if(( *it) ->defaultAction()==_viewTableAction)
      viewTableToolBut=* it;
    else if(( *it) ->defaultAction()==_viewMapAction)
      viewMapToolBut=* it;
    else if(( *it) ->defaultAction()==_viewChronogramAction)
      viewChronogramToolBut=* it;
  }
  ASSERT(viewGraphicToolBut!=0 && viewTableToolBut!=0 && viewMapToolBut!=0);
  if(viewGraphicToolBut!=0 && viewTableToolBut!=0 && viewMapToolBut!=0 && viewChronogramToolBut!= 0) {
    SigSelectionDnD * sigDnD=new SigSelectionDnD(viewGraphicToolBut);
    sigDnD->setDragEnabled(false);
    connect(sigDnD, SIGNAL(selectionDropped( const SubSignalPool& )),
             this, SLOT(newGraphicWindow( const SubSignalPool& )) );
    sigDnD=new SigSelectionDnD(viewTableToolBut);
    sigDnD->setDragEnabled(false);
    connect(sigDnD, SIGNAL(selectionDropped( const SubSignalPool& )),
             this, SLOT(newTableWindow( const SubSignalPool& )) );
    sigDnD=new SigSelectionDnD(viewMapToolBut);
    sigDnD->setDragEnabled(false);
    connect(sigDnD, SIGNAL(selectionDropped( const SubSignalPool& )),
             this, SLOT(newMapWindow( const SubSignalPool& )) );
    sigDnD=new SigSelectionDnD(viewChronogramToolBut);
    sigDnD->setDragEnabled(false);
    connect(sigDnD, SIGNAL(selectionDropped( const SubSignalPool& )),
             this, SLOT(newChronogramWindow( const SubSignalPool& )) );
  }

  if(!restoreState(reg.value("Workspace").toByteArray(), 0)) {
    App::stream() << tr("Cannot restore main window state") << endl;
  }

  setAcceptDrops(true);
}

References TRACE.

{
  TRACE;
  QSettings reg;
  reg.setValue("Workspace", saveState(0));
}

Member Function Documentation

void GeopsyMainWindow::activeWindowChanged ( QWidget *  w) [slot]
void GeopsyMainWindow::addWindow ( QWidget *  w) [slot]

Add window w to geopsy window system. This function belongs to GeopsyGui interface, hence a common way to invoque is:

  geopsyGui->addWindow(w);

To close the window, you must call removeWindow() before deleting the window.

References _ws, TRACE, and windowsMenuAdd().

Referenced by Engine::addWindow(), directoryMonitor(), newChronogramWindow(), newGraphicWindow(), newMapWindow(), newTableWindow(), seedlink(), and setHeader().

{
  TRACE;
  new SizeGrip(w);
  _ws->addWindow(w);
  windowsMenuAdd(w);
}
void GeopsyMainWindow::asyncIncreaseProgressValue ( int  value) [signal]
void GeopsyMainWindow::asyncSetProgressMaximum ( int  value) [signal]
void GeopsyMainWindow::asyncSetProgressValue ( int  value) [signal]
void GeopsyMainWindow::asyncShowMessage ( QString  message) [signal]

Referenced by GeopsyMainWindow(), and showMessage().

void GeopsyMainWindow::clearAll ( ) [slot]
Q_SCRIPTABLE void GeopsyMainWindow::closeAllWindows ( ) [inline, slot]

References _ws.

Referenced by clearAll(), quit(), and FileView::remove().

{_ws->closeAllWindows();}
void GeopsyMainWindow::closeEvent ( QCloseEvent *  e) [protected, virtual]

References quit(), and TRACE.

{
  TRACE;
  quit();
  e->ignore();
}

References _subPoolWin, GeopsyCore::SubSignalPool::addSignal(), GeopsyCore::SubSignalPool::at(), GeopsyCore::SubSignalPool::count(), GroupProperties::folder(), GeopsyCore::Signal::header(), GeopsyCore::SubSignalPool::isEmpty(), GroupProperties::isMultiGroup(), QGpCoreTools::log(), MSG_ID, GeopsyCore::AbstractSignalGroup::name(), QGpGuiTools::Dialog::setMainWidget(), GroupProperties::setNameFromHistory(), GeopsyCore::AbstractSignalGroup::setParent(), QGpCoreTools::ExpressionString::setPattern(), GroupProperties::setProperties(), GeopsyCore::SignalGroup::setSignals(), GroupProperties::setValues(), GroupProperties::splitKey(), GeopsyGui::SubPoolWindow::subPool(), QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  if( !_subPoolWin) return ;
  SignalGroup * g=new SignalGroup;
  g->setSignals(_subPoolWin->subPool());
  Dialog * d=new Dialog(this);
  GroupProperties * dg=new GroupProperties(this);
  d->setMainWidget(dg);
  Settings::getWidget(d, "GroupProperties");
  QList<AbstractSignalGroup *> gList;
  gList.append(g);
  dg->setValues(gList);
  dg->setNameFromHistory();
  while(d->exec()==QDialog::Accepted) {
    Settings::setWidget(d, "GroupProperties");
    dg->setProperties(g);
    Settings::setHistory("GroupNames", g->name());
    if(dg->isMultiGroup()) {
      MetaDataIndex key=dg->splitKey();
      SubSignalPool& subPool=_subPoolWin->subPool();
      Signal * sig=subPool.at(0);
      QVariant val=sig->header(key);
      SubSignalPool splitGroupSubPool;
      splitGroupSubPool.addSignal(sig);
      SignalExpressionContext context;
      ExpressionString gName;
      QString log;
      StreamRedirection sr(new StringStream(&log));
      if(!gName.setPattern(g->name(), &context)) {
        Message::warning(MSG_ID, tr("Create new group(s)"), tr("Error(s) while parsing group name pattern:\n\n%1").arg(log));
        continue;
      }
      int gi=1;
      for(int i=1; i<subPool.count(); i++ ) {
        sig=subPool.at(i);
        if(val!=sig->header(key) ) {
          addSplitGroup(splitGroupSubPool, dg->folder(), gName, context, i-splitGroupSubPool.count()+1, gi++ );
          val=sig->header(key);
        }
        splitGroupSubPool.addSignal(sig);
      }
      if(!splitGroupSubPool.isEmpty()) {
        addSplitGroup(splitGroupSubPool, dg->folder(), gName, context, subPool.count()-splitGroupSubPool.count()+1, gi);
      }
      delete g;
    } else {
      g->setParent(dg->folder());
    }
    delete d;
    return;
  }
  delete g;
  delete d;
}

References _subPoolWin.

{return _subPoolWin;}
void GeopsyMainWindow::dragEnterEvent ( QDragEnterEvent *  event) [protected, virtual]

References TRACE.

{
  TRACE;
  if(e->mimeData()->hasUrls()) {
    e->acceptProposedAction();
  }
}
void GeopsyMainWindow::dragMoveEvent ( QDragMoveEvent *  event) [protected, virtual]

References TRACE.

{
  TRACE;
  if(e->mimeData()->hasUrls()) {
    e->acceptProposedAction();
  }
}
void GeopsyMainWindow::dropEvent ( QDropEvent *  event) [protected, virtual]

References _fList, GeopsyCore::geopsyCore, GeopsyCore::GeopsyCoreEngine::load(), and TRACE.

{
  TRACE;
  if(e->mimeData()->hasUrls()) {
    QList<QUrl> urls=e->mimeData()->urls();
    QUrl url;
    QStringList files;
    MessageContext mc;
    foreach(url,urls) {
      files << url.toLocalFile();
    }
    geopsyCore->load(files, SignalFileFormat::Unknown, true);
   _fList->reset();
  }
  e->acceptProposedAction();
}

References _subPoolWin, GeopsyCore::SignalFileFormat::caption(), fileName, GeopsyCore::SignalFileFormat::filter(), ExportFileType::format(), format, GeopsyCore::SignalFileFormat::id(), ExportFileType::maximumSignalsPerFile(), GeopsyCore::SubSignalPool::maximumTimePickCount(), MSG_ID, GeopsyCore::SubSignalPool::save(), ExportFileType::setFormatList(), GeopsyGui::SubPoolWindow::subPool(), QGpCoreTools::tr(), TRACE, and ExportFileType::useOriginalBaseName().

{
  TRACE;
  MessageContext mc;
  if( !_subPoolWin) return ;
  ExportFileType * d=new ExportFileType(this);
  d->setFormatList(_subPoolWin->inherits( "TableWindow" ));
  Settings::getWidget(d);
  if(d->exec()==QDialog::Accepted) {
    Settings::setWidget(d);
    SignalFileFormat format=d->format();
    bool useOriginalBaseName=d->useOriginalBaseName();
    int maxSignalsPerFile=d->maximumSignalsPerFile();
    if(format.id()==SignalFileFormat::Temporary) {
      if(strcmp( _subPoolWin->metaObject() ->className(), "TableWindow" )==0)
        (( TableWindow* ) _subPoolWin) ->exportTable();
      delete d;
      return;
    }
    if(format.id()==SignalFileFormat::Tomo) {
      ExportPick * d=new ExportPick(this);
      d->pickNo->setMaximum(_subPoolWin->subPool().maximumTimePickCount());
      Settings::getWidget(d);
      if(d->exec()==QDialog::Accepted) {
        Settings::setWidget(d);
        QString fileName=Message::getSaveFileName(tr( "Export %1" ).arg(format.caption()),
                                                     tr("%1 (%2)").arg(format.caption())
                                                                  .arg(format.filter()));
        if(!fileName.isEmpty()) {
          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
          if(!_subPoolWin->subPool().save(fileName, useOriginalBaseName, format, d->pickNo->value())) {
            Message::warning(MSG_ID, tr("Export %1").arg(format.caption()),
                             tr("Error export file %1, see log for details").arg(fileName));
          }
        }
      }
      delete d;
    } else {
      QString filePath;
      if(useOriginalBaseName) {
        filePath=Message::getExistingDirectory(tr("Export %1").arg(format.caption()));
      } else {
        filePath=Message::getSaveFileName(tr( "Export %1" ).arg(format.caption()),
                         tr("%1 (%2)").arg(format.caption()).arg(format.filter()));
      }
      if(!filePath.isEmpty()) {
        QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
        if(!_subPoolWin->subPool().save(filePath, useOriginalBaseName, format, maxSignalsPerFile, 0)) {
          Message::warning(MSG_ID, tr("Export %1").arg(format.caption()),
                           tr("Error export file %1, see log for details").arg(filePath));
        }
      }
    }
  }
  delete d;
}
void GeopsyMainWindow::fftAmpl ( ) [slot]

References _fftAmplitudeAction, _fftPhaseAction, _fftTimeAction, _subPoolWin, GeopsyGui::SubPoolWindow::fastFourierTransform(), and TRACE.

{
  TRACE;
  if( !_subPoolWin) return ;
  _subPoolWin->fastFourierTransform(DoubleSignal::Spectrum);
  _fftTimeAction->setChecked(false);
  _fftAmplitudeAction->setChecked(true);
  _fftPhaseAction->setChecked(false);
}
void GeopsyMainWindow::fftPhase ( ) [slot]
void GeopsyMainWindow::fftTime ( ) [slot]

References _fftAmplitudeAction, _fftPhaseAction, _fftTimeAction, _subPoolWin, GeopsyGui::SubPoolWindow::fastFourierTransform(), and TRACE.

{
  TRACE;
  if( !_subPoolWin) return ;
  _subPoolWin->fastFourierTransform(DoubleSignal::Waveform);
  _fftTimeAction->setChecked(true);
  _fftAmplitudeAction->setChecked(false);
  _fftPhaseAction->setChecked(false);
}
void GeopsyMainWindow::filesRemoved ( const QList< SignalFile * > &  fList)

References _directoryMonitor, and GeopsyGui::DirectoryMonitor::removeFile().

Referenced by FileView::remove().

{
  if(_directoryMonitor) {
    for(QList<SignalFile *>::ConstIterator it=fList.begin();it!=fList.end();++it) {
      _directoryMonitor->removeFile((*it)->name());
    }
  }
}
void GeopsyMainWindow::helpAbout ( ) [slot]

References TRACE.

{
  TRACE;
  GeopsyAboutDialog * d=new GeopsyAboutDialog(this);
  d->exec();
  delete d;
}

References TRACE.

{
  TRACE;
  QUrl doc("http://www.geopsy.org/wiki/index.php/Geopsy");
  QDesktopServices::openUrl(doc);
}

References _progressBar, and TRACE.

Referenced by GeopsyMainWindow().

{
  TRACE;
  _progressBar->hide();
}

References _subPoolWin, TableWindow::importTable(), and TRACE.

{
  TRACE;
  TableWindow * tableWin=qobject_cast<TableWindow *>(_subPoolWin);
  if(tableWin) {
    tableWin->importTable();
  }
}
void GeopsyMainWindow::increaseProgressValue ( int  value = 1) [slot]

References _progressBar, asyncIncreaseProgressValue(), QGpCoreTools::AbstractProgress::increaseValue(), and TRACE.

Referenced by GeopsyMainWindow(), and Engine::increaseProgressValue().

{
  TRACE;
  if(QThread::currentThread()==Application::instance()->mainThread()) {
    _progressBar->increaseValue(value);
  } else {
    emit asyncIncreaseProgressValue(value);
  }
}
void GeopsyMainWindow::load ( ) [slot]

References _fList, GeopsyCore::geopsyCore, GeopsyCore::GeopsyCoreEngine::load(), and TRACE.

{
  TRACE;
  MessageContext mc;
  geopsyCore->load(QStringList(), SignalFileFormat::Unknown, true);
  _fList->reset();
}
void GeopsyMainWindow::loadCity ( ) [slot]

References GeopsyGui::CityLoader::scan(), and TRACE.

{
  TRACE;
  CityLoader * d=new CityLoader(this);
  Settings::getWidget(d);
  d->scan();
  d->exec();
  Settings::setWidget(d);
  delete d;
}

References _fList, baseDir, LoadFilePattern::baseDirectory(), LoadFilePattern::filePattern(), GeopsyCore::geopsyCore, GeopsyCore::GeopsyCoreEngine::load(), LoadFilePattern::saveHistory(), and TRACE.

{
  TRACE;
  LoadFilePattern * d=new LoadFilePattern;
  Settings::getWidget(d);
  if(d->exec()==QDialog::Accepted) {
    Settings::setWidget(d);
    d->saveHistory();
    MessageContext mc;
    QDir baseDir=d->baseDirectory();
    geopsyCore->load(baseDir.absoluteFilePath(d->filePattern()),
                     SignalFileFormat::Unknown, true);
    _fList->reset();
  }
  delete d;
}
QAction * GeopsyMainWindow::newAction ( const QAction &  original,
QWidget *  parent = 0 
) [static]

References TRACE.

Referenced by FileView::setSignalWindow(), and GroupView::setSignalWindow().

{
  TRACE;
  QAction * a=new QAction(original.icon(), original.text(), parent);
  a->setShortcut(original.shortcut());
  a->setToolTip(original.toolTip());
  return a;
}

References addWindow(), GeopsyGui::SubPoolWindow::setSubPool(), showWindow(), and TRACE.

{
  TRACE;
  GraphicWindow * win=new GraphicWindow();
  win->setSubPool(subPool);
  addWindow(win);
  showWindow(win);
  return win;
}

References addWindow(), GeopsyGui::SubPoolWindow::setSubPool(), showWindow(), and TRACE.

{
  TRACE;
  TableWindow * win=new TableWindow();
  win->setSubPool(subPool);
  addWindow(win);
  showWindow(win);
  return win;
}
void GeopsyMainWindow::openDB ( QString  fileName = QString::null) [slot]

References _progressBar.

Referenced by Engine::progressBar().

{return _progressBar;}
virtual ProgressBar* GeopsyMainWindow::progressBar ( ) [inline, virtual]

References _progressBar.

{return _progressBar;}
void GeopsyMainWindow::quit ( bool  force = false) [slot]

References closeAllWindows(), QGpCoreTools::tr(), TRACE, and warnBeforeClear().

Referenced by closeEvent().

{
  TRACE;
  if(force || warnBeforeClear(tr( "Quitting ..." )) ) {
    closeAllWindows();
    qApp->processEvents(); // wait for all windows to be closed
    qApp->quit();
  }
}

References _fList, FileView::refresh(), and TRACE.

Referenced by modeGui(), and Engine::refreshLists().

{
  TRACE;
  _fList->refresh();
}
void GeopsyMainWindow::removeWindow ( QWidget *  w) [slot]

Remove window w from geopsy window system. This function belongs to GeopsyGui interface, hence a common way to invoque is:

  geopsyGui->removeWindow(w);

Window w is not deleted. It must be done after calling this function.

References TRACE, and windowsMenuRemove().

Referenced by Engine::removeWindow().

void GeopsyMainWindow::saveDB ( ) [slot]

References _fList, GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, FileView::refresh(), GeopsyCore::SignalDB::save(), TRACE, and viewRefreshNow().

Referenced by warnBeforeClear().

{
  TRACE;
  geopsyCore->currentDB()->save( );
  _fList->refresh();
  viewRefreshNow();  /* force updating of all viewers, as the ID and file name may have changed
                        when signal samples are modified. The user may be confused if those fields
                        are not updated. */
}
void GeopsyMainWindow::saveDBAs ( ) [slot]
void GeopsyMainWindow::seedlink ( QByteArray  serverAddress = 0,
qint16  serverPort = 0,
QString  streamSelection = QString::null 
) [slot]
void GeopsyMainWindow::setHeader ( ) [slot]

References _subPoolWin, addWindow(), showWindow(), GeopsyGui::SubPoolWindow::subPool(), and TRACE.

{
  TRACE;
  if( !_subPoolWin) return ;
  SetHeader * d=new SetHeader(&_subPoolWin->subPool(), this);
  connect(_subPoolWin, SIGNAL(aboutToClose()), d, SLOT(close()));
  addWindow(d);
  showWindow(d);
}

References _toolFactory, ToolFactory::createPreferenceTabs(), geopsyGui, Preferences::saveToolList(), ToolFactory::setPreferences(), TRACE, and Preferences::updateAll().

Referenced by startupPreferences().

{
  TRACE;
  Preferences * d=new Preferences(this);
  _toolFactory->createPreferenceTabs(d->preferenceTab);
  Settings::getWidget(d);
  d->paramEditor->initTableFields(geopsyGui->preferences()->tableFields());
  d->updateAll();
  if(d->exec()==QDialog::Accepted) {
    Settings::setWidget(d);
    d->saveToolList();
    d->paramEditor->getTableFields(geopsyGui->preferences()->tableFields());
    geopsyGui->preferences()->saveNoAuto();
    geopsyGui->preferences()->load();
    _toolFactory->setPreferences();
  }
  delete d;
}
void GeopsyMainWindow::setProgressMaximum ( int  value) [slot]

References _progressBar, _progressHideTimer, asyncSetProgressMaximum(), QGpGuiTools::ProgressBar::setMaximum(), QGpGuiTools::ProgressBar::show(), and TRACE.

Referenced by GeopsyMainWindow(), and Engine::setProgressMaximum().

{
  TRACE;
  if(QThread::currentThread()==Application::instance()->mainThread()) {
    _progressBar->setMaximum(value);
    _progressBar->show();
    _progressHideTimer.stop();
  } else {
    emit asyncSetProgressMaximum(value);
  }
}
void GeopsyMainWindow::setProgressValue ( int  value) [slot]

References _progressBar, _progressHideTimer, asyncSetProgressValue(), QGpGuiTools::ProgressBar::maximum(), QGpGuiTools::ProgressBar::setValue(), and TRACE.

Referenced by GeopsyMainWindow(), and Engine::setProgressValue().

{
  TRACE;
  if(QThread::currentThread()==Application::instance()->mainThread()) {
    if(value==_progressBar->maximum()) {
      _progressHideTimer.start();
    }
    _progressBar->setValue(value);
  } else {
    emit asyncSetProgressValue(value);
  }
}

References _subPoolWin, GeopsyCore::SubSignalPool::begin(), GeopsyCore::SubSignalPool::end(), StationCoordinates::init(), StationCoordinates::lookup(), MSG_ID, GeopsyCore::Signal::setHeaderModified(), StationCoordinates::setReadOnly(), GeopsyCore::Signal::setReceiver(), GeopsyGui::SubPoolWindow::subPool(), GeopsyGui::SubPoolWindow::subPoolUpdate(), QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  if( !_subPoolWin) return ;
  StationCoordinates * d=new StationCoordinates(this);
  Settings::getWidget(d);
  if(d->init(&_subPoolWin->subPool())) {
    Message::warning(MSG_ID, tr("Set receivers"),
                         tr("Stations with different coordinates have the same name. You will not be "
                         "able to change coordinates of signals. First change the signal names."),
                         Message::ok());
    d->setReadOnly(true);
  }
  if(d->exec()==QDialog::Accepted) {
    Settings::setWidget(d);
    SubSignalPool::iterator it;
    SubSignalPool& subPool=_subPoolWin->subPool();
    for(it=subPool.begin();it!=subPool.end();++it) {
      Signal * sig=*it;
      bool ok;
      Point p=d->lookup(sig, ok);
      if(ok) sig->setReceiver(p);
      sig->setHeaderModified(true);
    }
    _subPoolWin->subPoolUpdate();
  }
  delete d;
}
void GeopsyMainWindow::setSubPoolActionEnabled ( bool  b,
bool  rw 
) [slot]

References _editMenu, _fileExportAction, _fileImportAction, _toolsMenu, _viewSetDataFieldsAction, _waveMenu, and TRACE.

Referenced by activeWindowChanged().

{
  TRACE;
  _fileExportAction->setEnabled(b);
  _fileImportAction->setEnabled(b);
  _viewSetDataFieldsAction->setEnabled(b);
  _waveMenu->setEnabled(b);
  if(b) {
    QList<QAction *> aList=_waveMenu->actions();
    for(QList<QAction *>::iterator it=aList.begin(); it!=aList.end(); it++ ) {
      if((*it)->data().toBool()) (*it)->setEnabled(rw);
    }
  }
  _editMenu->setEnabled(b);
  _toolsMenu->setEnabled(b);
}
void GeopsyMainWindow::setTableLocked ( bool  l) [slot]

References _tableEditionLocked, _ws, TableWindow::setEditionLocked(), and TRACE.

{
  TRACE;
  _tableEditionLocked=l;
  QWidgetList windows=_ws->windowList(QWorkspace::CreationOrder);
  int n=windows.count();
  for(int i=0;i < n;i++ ) {
    TableWindow * table=qobject_cast<TableWindow *>(windows.at(i) );
    if(table) {
      table->setEditionLocked(_tableEditionLocked);
    }
  }
}

References _fList, _gList, _importSignalMenu, _toolFactory, _toolsBar, _toolsMenu, ToolFactory::addActions(), ToolFactory::createImportActions(), newGraphicWindow(), SigSelectionDnD::setDragEnabled(), GroupWidget::setSignalWindow(), FileView::setSignalWindow(), and TRACE.

Referenced by Engine::setMainWindow().

{
  TRACE;
  ASSERT(_toolFactory==0);
  _toolFactory=tf;
  _toolFactory->addActions(_toolsMenu);
  // Get list of tool buttons before actions of tools
  QList<QToolButton *> toolButListBefore=findChildren<QToolButton *>();
  _toolFactory->addActions(_toolsBar);
  // Get list of tool buttons after actions of tools
  QList<QToolButton *> toolButListAfter=findChildren<QToolButton *>();
  for(QList<QToolButton *>::iterator it=toolButListAfter.begin(); it!=toolButListAfter.end();++it) {
    if( ! toolButListBefore.contains( *it) ) {
      SigSelectionDnD * sigDnD=new SigSelectionDnD( *it);
      sigDnD->setDragEnabled(false);
      connect(sigDnD, SIGNAL(selectionDropped( const SubSignalPool& )),
               _toolFactory, SLOT(newGraphicWindow( const SubSignalPool& )) );
    }
  }
  _fList->setSignalWindow(this);
  _gList->setSignalWindow(this);
  // Add eventually actions defined in user plugins for importing signals
  QList<QAction *> customActions=_toolFactory->createImportActions(this);
  foreach(QAction * a, customActions) {
    _importSignalMenu->addAction(a);
  }
}
void GeopsyMainWindow::showLoadedSignals ( const SubSignalPool subPool) [slot]

References _fList, geopsyGui, newGraphicWindow(), newTableWindow(), FileView::refresh(), and TRACE.

Referenced by Engine::showLoadedSignals().

{
  TRACE;
  if(geopsyGui->preferences() ->showTable())
    newTableWindow(subPool);
  if(geopsyGui->preferences() ->showGraphic())
    newGraphicWindow(subPool);
  _fList->refresh();
}
void GeopsyMainWindow::showMessage ( QString  message) [slot]

References asyncShowMessage(), statusBar(), and TRACE.

Referenced by GeopsyMainWindow(), and Engine::showMessage().

{
  TRACE;
  if(QThread::currentThread()==Application::instance()->mainThread()) {
    statusBar()->showMessage(message);
  } else {
    emit asyncShowMessage(message);
  }
}

References _toolBarsMenu, and TRACE.

{
  TRACE;
  _toolBarsMenu->clear();
  QList<QDockWidget *> dockwidgetList=findChildren<QDockWidget *>();
  QAction * a;
  for(QList<QDockWidget *>::iterator it=dockwidgetList.begin();it!=dockwidgetList.end();++it) {
    a=new QAction(( *it) ->windowTitle(), this);
    a->setCheckable(true);
    if(( *it) ->isVisible())
      a->setChecked(true);
    connect(a, SIGNAL(toggled( bool) ), *it, SLOT(setVisible( bool) ));
    _toolBarsMenu->addAction(a);
  }
  _toolBarsMenu->addSeparator();
  QList<QToolBar *> toolBarList=findChildren<QToolBar *>();
  for(QList<QToolBar *>::iterator it=toolBarList.begin();it!=toolBarList.end();++it) {
    a=new QAction(( *it) ->windowTitle(), this);
    a->setCheckable(true);
    if(( *it) ->isVisible())
      a->setChecked(true);
    connect(a, SIGNAL(toggled( bool) ), *it, SLOT(setVisible( bool) ));
    _toolBarsMenu->addAction(a);
  }
}
void GeopsyMainWindow::showWindow ( QWidget *  w) [slot]

Do not call QWidget::show() directly. Use this function instead. This function belongs to GeopsyGui interface, hence a common way to invoque is:

  geopsyGui->showWindow(w);

References _ws, and TRACE.

Referenced by directoryMonitor(), newChronogramWindow(), newGraphicWindow(), newMapWindow(), newTableWindow(), seedlink(), setHeader(), Engine::showWindow(), and windowsMenuTriggered().

{
  TRACE;
  if(_ws->activeWindow() && _ws->activeWindow() ->isMaximized())
    w->showMaximized();
  else
    w->show();
}
void GeopsyMainWindow::sort ( ) [slot]

References _subPoolWin, SortKeys::getKeys(), GeopsyCore::SubSignalPool::sort(), GeopsyGui::SubPoolWindow::subPool(), GeopsyGui::SubPoolWindow::subPoolUpdate(), and TRACE.

{
  TRACE;
  if( !_subPoolWin) return ;
  SortKeys * d=new SortKeys(this);
  Settings::getWidget(d);
  if(d->exec()==QDialog::Accepted) {
    Settings::setWidget(d);
    d->getKeys();
    _subPoolWin->subPool().sort();
    _subPoolWin->subPoolUpdate();
  }
  delete d;
}

References setPreferences(), and TRACE.

Referenced by modeGui().

{
  TRACE;
  // Ask for preferences if specified in QSettings
  QSettings * reg=new QSettings;
  reg->beginGroup( "DialogOptions/Preferences" );
  if(reg->value( "again", true).toBool()) {
    reg->setValue( "again", true);
    delete reg;
    setPreferences();
  } else
    delete reg;
}
virtual QStatusBar* GeopsyMainWindow::statusBar ( ) [inline, virtual]

References _ws, and TRACE.

{
  TRACE;
  // primitive horizontal tiling
  QWidgetList windows=_ws->windowList(QWorkspace::CreationOrder);
  if( !windows.count())
    return ;

  int heightForEach=_ws->height()/windows.count();
  int y=0;
  for(int i=0; i < windows.count(); ++i) {
    QWidget *window=windows.at(i);
    if(window->windowState() & Qt::WindowMaximized) {
      // prevent flicker
      window->hide();
      window->showNormal();
    }
    int preferredHeight=window->minimumHeight() + window->parentWidget() ->baseSize().height();
    int actHeight=(preferredHeight > heightForEach) ? preferredHeight : heightForEach;

    window->parentWidget() ->setGeometry(0, y, _ws->width(), actHeight);
    y += actHeight;
  }
}
void GeopsyMainWindow::updateWindowTitle ( QWidget *  w) [slot]

Call this function whenever the title of the window change. A usual place for this function is inside a re-implementation of QWidget::setWindowTitle(). This function belongs to GeopsyGui interface, hence a common way to invoque is:

  geopsyGui->updateWindowTitle(w);

References TRACE.

Referenced by Engine::updateWindowTitle().

{
  TRACE;
  QAction * a=windowsMenuAction(w);
  if(a && w) {
    QString title=w->windowTitle();
    if(title.length() > 35)
      title=title.left(35) + "...";
    a->setText(title);
  }
}
virtual bool GeopsyMainWindow::useProgress ( ) [inline, virtual]
{return true;}
const QAction* GeopsyMainWindow::viewGraphicAction ( ) const [inline]
const QAction* GeopsyMainWindow::viewMapAction ( ) const [inline]

References _ws, TRACE, and w.

Referenced by saveDB().

{
  TRACE;
  QWidgetList windows=_ws->windowList(QWorkspace::CreationOrder);
  int n=windows.count();
  for(int i=0;i < n;i++ ) {
    QWidget * w=windows.at(i);
    if(w->inherits( "GraphicWindow" ))
      (( GraphicWindow * ) w) ->signalLayer() ->graphContent() ->deepUpdate();
    else if(w->inherits( "MapWindow" ) || w->inherits( "TableWindow" ))
      (( SubPoolWindow * ) w) ->signalsUpdate();
  }
}

References _subPoolWin, and TRACE.

{
  TRACE;
  if(_subPoolWin && _subPoolWin->inherits( "TableWindow" ))
    (( TableWindow * ) _subPoolWin) ->setDataFields();
}
const QAction* GeopsyMainWindow::viewTableAction ( ) const [inline]
bool GeopsyMainWindow::warnBeforeClear ( QString  action) [protected]

References GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, GeopsyCore::SignalDB::isModified(), MSG_ID, saveDB(), QGpCoreTools::tr(), and TRACE.

Referenced by clearAll(), and quit().

{
  TRACE;
  if(geopsyCore->currentDB()->isModified()) {
    switch (Message::warning(MSG_ID, action,
                             tr("Do you want to save the changes to the current database?"),
                             Message::yes(), Message::no(), Message::cancel())) {
    case Message::Answer0:
      saveDB();
      if(geopsyCore->currentDB() ->isModified())
        return false;
    case Message::Answer1:
      break;
    default:
      return false;
    }
  } else if(Message::question(MSG_ID, action, tr("Are you sure?"), Message::no(), Message::yes())
      ==Message::Answer0)
    return false;

  return true;
}
void GeopsyMainWindow::windowsMenuAdd ( QWidget *  w) [slot]

References _windowsMenu, TRACE, TRACE_LOG, TRACE_LOG_INT, TRACE_LOG_POINTER, and windowsMenuTriggered().

Referenced by addWindow().

{
  TRACE;
  // Bug 766 only under Mac 10.6
#ifdef Q_WS_MAC
  TRACE_LOG;
#endif
  if(_windowsMenu->actions().count()==8)
    setWindowsMenuEnabled(true);
  const QIcon icon=w->windowIcon();
  QString title=w->windowTitle();
  if(title.length() > 35)
    title=title.left(35) + "...";
  QAction * a=new QAction(title, this);
#ifdef Q_WS_MAC
  TRACE_LOG_POINTER(a);
#endif
  if( !icon.isNull())
    a->setIcon(icon);
  connect(a, SIGNAL(triggered()), this, SLOT(windowsMenuTriggered()) );
  QByteArray windowPtr(( const char * ) & w, sizeof(QWidget * ));
  a->setData(windowPtr);
  a->setCheckable(true);
#ifdef Q_WS_MAC
  TRACE_LOG_POINTER(w);
#endif
  _windowsMenu->addAction(a);
#ifdef Q_WS_MAC
  TRACE_LOG_INT(_windowsMenu->actions().count());
#endif
}
void GeopsyMainWindow::windowsMenuRemove ( QWidget *  w) [slot]

References _windowsMenu, TRACE, TRACE_LOG, TRACE_LOG_INT, and TRACE_LOG_POINTER.

Referenced by removeWindow().

{
  TRACE;
  // Bug 766 only under Mac 10.6
#ifdef Q_WS_MAC
  TRACE_LOG;
#endif
  QAction * a=windowsMenuAction(w);
#ifdef Q_WS_MAC
  TRACE_LOG_POINTER(a);
#endif
  if(a)
    _windowsMenu->removeAction(a);
#ifdef Q_WS_MAC
  TRACE_LOG_INT(_windowsMenu->actions().count());
#endif
  if(_windowsMenu->actions().count()==8)
    setWindowsMenuEnabled(false);
}
void GeopsyMainWindow::windowsMenuSetCurrent ( QWidget *  w) [slot]

References _windowsMenu, TRACE, TRACE_BUG, TRACE_BUG_INT, TRACE_BUG_N, and TRACE_BUG_POINTER.

Referenced by activeWindowChanged(), and windowsMenuTriggered().

{
  TRACE;
#ifdef Q_WS_MAC
  TRACE_BUG;
#endif
  QList<QAction *> aList=_windowsMenu->actions();
#ifdef Q_WS_MAC
  TRACE_BUG_N(1);
#endif
  for(int i=8;i < aList.count();i++ ) {
    QAction * a=aList.at(i);
    QWidget * wa=*reinterpret_cast<QWidget **>(a->data().toByteArray().data());
#ifdef Q_WS_MAC
    TRACE_BUG_N(2);
    TRACE_BUG_INT(aList.count());
    TRACE_BUG_INT(i);
    TRACE_BUG_POINTER(a);
    TRACE_BUG_POINTER(wa);
#endif
    if(wa==w)
      a->setChecked(true);
    else
      a->setChecked(false);
#ifdef Q_WS_MAC
    TRACE_BUG_N(3);
#endif
  }
}

References showWindow(), TRACE, and windowsMenuSetCurrent().

Referenced by windowsMenuAdd().

{
  TRACE;
  QAction * a=qobject_cast<QAction *>(sender());
  if(a) {
    QWidget * w=*(QWidget ** ) a->data().toByteArray().data();
    if(w) {
      qApp->setActiveWindow(this);
      showWindow(w);
      w->setFocus();
      windowsMenuSetCurrent(w);
    }
  }
}

References _ws, and TRACE.

{
  TRACE;
  _ws->activeWindow() ->showMinimized();
}
QWorkspace* GeopsyMainWindow::workspace ( ) [inline]

References _ws.

Referenced by FileView::remove(), and Engine::signalDataChanged().

{return _ws;}

Friends And Related Function Documentation

friend class GeopsyMainWindowInt [friend]

Member Data Documentation

Referenced by GeopsyMainWindow(), and showDBStatus().

Referenced by GeopsyMainWindow().

QMenu* GeopsyMainWindow::_editMenu [protected]

Referenced by setSubPoolActionEnabled().

Referenced by fftAmpl(), fftPhase(), and fftTime().

QAction* GeopsyMainWindow::_fftPhaseAction [protected]

Referenced by fftAmpl(), fftPhase(), and fftTime().

QAction* GeopsyMainWindow::_fftTimeAction [protected]

Referenced by fftAmpl(), fftPhase(), and fftTime().

Referenced by setSubPoolActionEnabled().

Referenced by setToolFactory().

Referenced by GeopsyMainWindow(), and seedlink().

QMenu* GeopsyMainWindow::_toolBarsMenu [protected]

Referenced by showToolBarMenu().

QToolBar* GeopsyMainWindow::_toolsBar [protected]

Referenced by setToolFactory().

QMenu* GeopsyMainWindow::_toolsMenu [protected]

Referenced by GeopsyMainWindow().

QAction* GeopsyMainWindow::_viewMapAction [protected]

Referenced by GeopsyMainWindow(), and viewMapAction().

QMenu* GeopsyMainWindow::_viewMenu [protected]
QAction* GeopsyMainWindow::_viewTableAction [protected]
QMenu* GeopsyMainWindow::_waveMenu [protected]

Referenced by setSubPoolActionEnabled().

QMenu* GeopsyMainWindow::_windowsMenu [protected]
QWorkspace* GeopsyMainWindow::_ws [protected]

Referenced by GeopsyMainWindow(), and showDBStatus().


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