Пример #1
0
void SVPlotMainWindow::load(const QString& fileName) {
  //
  // See if we have a subwindow, if not create one.
  // Then try to load the file.
  //
  SVPlotSubWindow *w = currentSubWindow();
  if (!w) {
    newSubWindow();
    w = currentSubWindow();
  }

  if (!w->load(fileName))
    return;

  QFileInfo info(fileName);
  // Store the full path to the file, otherwise it may be possible
  // to get relative paths to some working directory - which may
  // be different next time.
  config().addRecentFile(info.filePath());
  config().setRecentDirectory(info.filePath());

  // Synchronize the browser dock as well.
  p->browserDock->setDirectory(info.filePath());

  // In case there were no recent files yet, the menu may be disabled
  if (!p->menuRecentFiles->isEnabled())
    p->menuRecentFiles->setEnabled(true);
}
Пример #2
0
 /**
  * This gets called when a window is activated or the workspace loses focus.
  *
  * @param w
  */
 void Workspace::activateViewport(QMdiSubWindow *w) {
   if(w) {
     emit cubeViewportActivated((MdiCubeViewport *) w->widget()->layout()->itemAt(0)->widget());
   }
   //Check if there is no current window (on close)
   else if(!currentSubWindow()) {
     emit cubeViewportActivated((MdiCubeViewport *)NULL);
   }
 }
Пример #3
0
        void app_area::sub_window_activated(QMdiSubWindow* w)
        {
            if(!w) w = currentSubWindow();
            if(!w) return;

            auto mw = dynamic_cast<gui::message*>(w);
            if(!mw) return;
            
            mw->clear_alert();
        }
Пример #4
0
void SVPlotMainWindow::exportAs(const QString& format) {
  if (!currentSubWindow())
    return;

  QString filterFormat = "%1 (*.%2)";

  QString filter = "All files (*.*)";
  SVPlotMainWindowPrivate::supportedFormatsMap::const_iterator i = p->exportAsFormat.constBegin();
  for ( ; i != p->exportAsFormat.constEnd(); ++i)
    filter += ";; " + filterFormat.arg(i.value()).arg(i.key());

  QString selectedFilter = filterFormat.arg(p->exportAsFormat.value(format))
                                       .arg(format);

  QString fileName = QFileDialog::getSaveFileName(this, "Export As",
                                                  config().recentDirectory(),
                                                  filter,
                                                  &selectedFilter);

  if (!fileName.isEmpty()) {
    currentSubWindow()->exportAs(fileName, format);
    config().setRecentDirectory(fileName);
  }
}
Пример #5
0
void SVPlotMainWindow::setMoveEnabled(bool on) {
  if (currentSubWindow())
    currentSubWindow()->setMoveEnabled(on);
}
Пример #6
0
void SVPlotMainWindow::zoomFit() {
  if (currentSubWindow())
    currentSubWindow()->zoomFit();
}
Пример #7
0
void SVPlotMainWindow::print() {
  if (currentSubWindow())
    currentSubWindow()->print();
}
Пример #8
0
QWidget* ImprovedWorkspace::activeWindow()
{
    return currentSubWindow();
}