Esempio n. 1
0
void PlotZoomer::loadSettings(QSettings &settings)
{
  settings.beginGroup("zoom");

  int zoomMode = settings.value("mode", int(PlotZoomer::ZoomBoth)).toInt();
  setZoomMode(PlotZoomer::ZoomMode(zoomMode));

  int zoomIndex = settings.value("index", -1).toInt();
  int stackSize = settings.beginReadArray("stack");
  QStack<QRectF> stack;
  stack.resize(stackSize);
  for (int i = 0; i < stackSize; ++i)
  {
    settings.setArrayIndex(i);
    read(settings, stack[i]);
  }
  settings.endArray();

  setZoomStack(stack, zoomIndex);

  if (stackSize <= 1)
  {
    zoomToFit(true);
  }

  settings.endGroup();
}
Esempio n. 2
0
  void
  TreeCanvas::update(void) {
    QMutexLocker locker(&mutex);
    layoutMutex.lock();
    if (root != NULL) {
      root->layout(*na);
      BoundingBox bb = root->getBoundingBox();

      int w = static_cast<int>((bb.right-bb.left+Layout::extent)*scale);
      int h =
        static_cast<int>(2*Layout::extent+
          root->getShape()->depth()*Layout::dist_y*scale);
      xtrans = -bb.left+(Layout::extent / 2);
      
      QSize viewport_size = size();
      QAbstractScrollArea* sa =
        static_cast<QAbstractScrollArea*>(parentWidget()->parentWidget());
      sa->horizontalScrollBar()->setRange(0,w-viewport_size.width());
      sa->verticalScrollBar()->setRange(0,h-viewport_size.height());
      sa->horizontalScrollBar()->setPageStep(viewport_size.width());
      sa->verticalScrollBar()->setPageStep(viewport_size.height());
      sa->horizontalScrollBar()->setSingleStep(Layout::extent);
      sa->verticalScrollBar()->setSingleStep(Layout::extent);
    }
    if (autoZoom)
      zoomToFit();
    layoutMutex.unlock();
    QWidget::update();
  }
Esempio n. 3
0
void PlotZoomer::fitIfAutoScaling()
{
  QwtPlot *plotter = plot();
  if (plotter->axisAutoScale(AxisY) && plotter->axisAutoScale(AxisX))
  {
    zoomToFit(true);
  }
}
Esempio n. 4
0
 void
 TreeCanvas::setAutoZoom(bool b) {
   autoZoom = b;
   if (autoZoom) {
     zoomToFit();
   }
   emit autoZoomChanged(b);
   scaleBar->setEnabled(!b);
 }
void CAPresentationHandler::nextSlide()
{
    if (d->currentSlideNum == d->document->pageCount()-1)
        return;
    d->currentSlideNum++;
    emit currentSlideNumberChanged();

    gotoCurrentSlide();
    zoomToFit();
}
void CAPresentationHandler::previousSlide()
{
    if (d->currentSlideNum > 0)
    {
        d->currentSlideNum--;
        emit currentSlideNumberChanged();
    }

    gotoCurrentSlide();
    zoomToFit();
}
Esempio n. 7
0
		void DockableRegularData1DWidget::contextMenuEvent(QContextMenuEvent* e)
		{
			Q3PopupMenu context_menu;
			context_menu.insertItem("ZoomToFit", this, SLOT(zoomToFit()));
			context_menu.insertItem("ZoomIn", this, SLOT(zoomIn()));
			context_menu.insertItem("ZoomOut", this, SLOT(zoomOut()));
			QPoint pos = e->reason() == QContextMenuEvent::Mouse ? e->globalPos() :
				mapToGlobal( QPoint(e->pos().x(), 0) ) + QPoint( width() / 2, height() / 2 );
			context_menu.exec(pos);
			e->accept();
		}
Esempio n. 8
0
void SvgImageView::finishLoadFromDocument()
{
    QSvgRenderer* renderer = document()->svgRenderer();
    GV_RETURN_IF_FAIL(renderer);
    mSvgItem->setSharedRenderer(renderer);
    if (zoomToFit()) {
        setZoom(computeZoomToFit(), QPointF(-1, -1), ForceUpdate);
    } else {
        mSvgItem->setScale(zoom());
    }
    applyPendingScrollPos();
    completed();
}
Esempio n. 9
0
void PlotZoomer::widgetMouseReleaseEvent(QMouseEvent *event)
{
  if (mouseMatch(MouseSelect3, event))
  {
    // Panner handles middle button.
    return;
  }

  QwtPlotZoomer::widgetMouseReleaseEvent(event);
  if (mouseMatch(MouseSelect2, event))
  {
    if (_contextMenuExpectedSeq == _contextMenuSequenceNumber)
    {
      ++_contextMenuSequenceNumber;
      zoomToFit();
    }
  }
}
Esempio n. 10
0
void
Gist::addActions() {

    /// Expand current node
    auto expand_action = new QAction("Expand", this);
    expand_action->setShortcut(QKeySequence("Return"));
    addAction(expand_action);
    connect(expand_action, SIGNAL(triggered()), m_Canvas, SLOT(expandCurrentNode()));

    reset = new QAction("Reset", this);
    addAction(reset);
    connect(reset, SIGNAL(triggered()), m_Canvas, SLOT(reset()));
    // reset->setShortcut(QKeySequence("Ctrl+R"));

    showPixelTree = new QAction("Pixel Tree View", this);
    addAction(showPixelTree);
    connect(showPixelTree, SIGNAL(triggered()), m_Canvas, SLOT(showPixelTree()));

    showIcicleTree = new QAction("Icicle Tree View", this);
    addAction(showIcicleTree);
    connect(showIcicleTree, SIGNAL(triggered()), m_Canvas, SLOT(showIcicleTree()));

    showWebscript = new QAction("Webscript View", this);
    addAction(showWebscript);
    connect(showWebscript, SIGNAL(triggered()), m_Canvas, SLOT(showWebscript()));

    followPath = new QAction("Follow Path", this);
    addAction(followPath);
    connect(followPath, SIGNAL(triggered()), m_Canvas, SLOT(followPath()));

    /// Collect ML stats
    auto collectMLStats_action = new QAction("Collect ML stats", this);
    addAction(collectMLStats_action);
    connect(collectMLStats_action, SIGNAL(triggered()), m_Canvas, SLOT(collectMLStats()));

    deleteWhiteNodes = new QAction{"Delete Unexplored Nodes", this};
    addAction(deleteWhiteNodes);
    connect(deleteWhiteNodes, &QAction::triggered, m_Canvas, &TreeCanvas::deleteWhiteNodes);

    navUp = new QAction("Up", this);
    addAction(navUp);
    navUp->setShortcut(QKeySequence("Up"));
    connect(navUp, SIGNAL(triggered()), m_Canvas, SLOT(navUp()));

    navDown = new QAction("Down", this);
    addAction(navDown);
    navDown->setShortcut(QKeySequence("Down"));
    connect(navDown, SIGNAL(triggered()), m_Canvas, SLOT(navDown()));

    navLeft = new QAction("Left", this);
    addAction(navLeft);
    navLeft->setShortcut(QKeySequence("Left"));
    connect(navLeft, SIGNAL(triggered()), m_Canvas, SLOT(navLeft()));

    navRight = new QAction("Right", this);
    addAction(navRight);
    navRight->setShortcut(QKeySequence("Right"));
    connect(navRight, SIGNAL(triggered()), m_Canvas, SLOT(navRight()));

    navRoot = new QAction("Root", this);
    addAction(navRoot);
    navRoot->setShortcut(QKeySequence("R"));
    connect(navRoot, SIGNAL(triggered()), m_Canvas, SLOT(navRoot()));

    navNextSol = new QAction("To next solution", this);
    addAction(navNextSol);
    navNextSol->setShortcut(QKeySequence("Shift+Right"));
    connect(navNextSol, SIGNAL(triggered()), m_Canvas, SLOT(navNextSol()));

    navPrevSol = new QAction("To previous solution", this);
    addAction(navPrevSol);
    navPrevSol->setShortcut(QKeySequence("Shift+Left"));
    connect(navPrevSol, SIGNAL(triggered()), m_Canvas, SLOT(navPrevSol()));

    navNextLeaf = new QAction("To next leaf", this);
    addAction(navNextLeaf);
    navNextLeaf->setShortcut(QKeySequence("Ctrl+Right"));
    connect(navNextLeaf, SIGNAL(triggered()), m_Canvas, SLOT(navNextLeaf()));

    navPrevLeaf = new QAction("To previous leaf", this);
    addAction(navPrevLeaf);
    navPrevLeaf->setShortcut(QKeySequence("Ctrl+Left"));
    connect(navPrevLeaf, SIGNAL(triggered()), m_Canvas, SLOT(navPrevLeaf()));

    searchNext = new QAction("Next solution", this);
    addAction(searchNext);
    searchNext->setShortcut(QKeySequence("N"));

    searchAll = new QAction("All solutions", this);
    addAction(searchAll);
    searchAll->setShortcut(QKeySequence("A"));

    toggleHidden = new QAction("Hide/unhide", this);
    addAction(toggleHidden);
    toggleHidden->setShortcut(QKeySequence("H"));
    connect(toggleHidden, SIGNAL(triggered()), m_Canvas, SLOT(toggleHidden()));

    hideFailed = new QAction("Hide failed subtrees", this);
    addAction(hideFailed);
    hideFailed->setShortcut(QKeySequence("F"));
    connect(hideFailed, SIGNAL(triggered()), m_Canvas, SLOT(hideFailed()));

    hideSize = new QAction("Hide small subtrees", this);
    addAction(hideSize);
    connect(hideSize, SIGNAL(triggered()), m_Canvas, SLOT(hideSize()));

#ifdef MAXIM_DEBUG
    auto printDebugInfo = new QAction("Print Debug Info", this);
    printDebugInfo->setShortcut(QKeySequence("Ctrl+Shift+D"));
    connect(printDebugInfo, &QAction::triggered, m_Canvas,
            &TreeCanvas::printDebugInfo);
    addAction(printDebugInfo);

    auto updateCanvas = new QAction{"Update Canvas", this};
    updateCanvas->setShortcut(QKeySequence("Shift+U"));
    connect(updateCanvas, &QAction::triggered, [this]() {
        qDebug() << "action: update canvas";
        m_Canvas->update();
    });
    addAction(updateCanvas);

    auto addChildren = new QAction{"Add 2 Children", this};
    addChildren->setShortcut(QKeySequence("Shift+C"));
    connect(addChildren, &QAction::triggered, m_Canvas, &TreeCanvas::addChildren);
    addAction(addChildren);

    deleteNode = new QAction{"Delete Node", this};
    deleteNode->setShortcut(QKeySequence("del"));
    connect(deleteNode, &QAction::triggered, m_Canvas, &TreeCanvas::deleteSelectedNode);
    addAction(deleteNode);

    dirtyUpNode = new QAction{"Dirty Up Node", this};
    dirtyUpNode->setShortcut(QKeySequence("D"));
    connect(dirtyUpNode, &QAction::triggered, m_Canvas, &TreeCanvas::dirtyUpNode);
    addAction(dirtyUpNode);
#endif

    unhideAll = new QAction("Unhide all", this);
    addAction(unhideAll);
    unhideAll->setShortcut(QKeySequence("U"));
    connect(unhideAll, SIGNAL(triggered()), m_Canvas, SLOT(unhideAll()));

    labelBranches = new QAction("Label/clear branches", this);
    addAction(labelBranches);
    labelBranches->setShortcut(QKeySequence("L"));
    /// TODO(maxim): should this be the default (Qt::WindowShortcut) instead?
    labelBranches->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    connect(labelBranches, SIGNAL(triggered()), m_Canvas, SLOT(labelBranches()));

    labelPath = new QAction("Label/clear path", this);
    addAction(labelPath);
    labelPath->setShortcut(QKeySequence("Shift+L"));
    connect(labelPath, SIGNAL(triggered()), m_Canvas, SLOT(labelPath()));
    // labelPath->setShortcutContext(Qt::ApplicationShortcut);

    analyzeSimilarSubtrees = new QAction("Symilar Subtree Analysis", this);
    addAction(analyzeSimilarSubtrees);
    analyzeSimilarSubtrees->setShortcut(QKeySequence("Shift+s"));
    connect(analyzeSimilarSubtrees, SIGNAL(triggered()), m_Canvas, SLOT(analyzeSimilarSubtrees()));

    highlightNodesMenu = new QAction("Highlight Nodes Based On ...", this);
    addAction(highlightNodesMenu);
    connect(highlightNodesMenu, SIGNAL(triggered()), m_Canvas, SLOT(highlightNodesMenu()));

    showNogoods = new QAction("Show no-goods", this);
    addAction(showNogoods);
    showNogoods->setShortcut(QKeySequence("Shift+N"));
    connect(showNogoods, SIGNAL(triggered()), m_Canvas, SLOT(showNogoods()));

    showNodeInfo = new QAction("Show node info", this);
    addAction(showNodeInfo);
    showNodeInfo->setShortcut(QKeySequence("I"));
    connect(showNodeInfo, SIGNAL(triggered()), m_Canvas, SLOT(showNodeInfo()));

    showNodeOnPixelTree = new QAction("Show node on a pixel tree", this);
    addAction(showNodeOnPixelTree);
    showNodeOnPixelTree->setShortcut(QKeySequence("J"));
    connect(showNodeOnPixelTree, SIGNAL(triggered()), m_Canvas, SLOT(showNodeOnPixelTree()));

    toggleStop = new QAction("Stop/unstop", this);
    addAction(toggleStop);
    toggleStop->setShortcut(QKeySequence("X"));
    connect(toggleStop, SIGNAL(triggered()), m_Canvas, SLOT(toggleStop()));

    unstopAll = new QAction("Do not stop in subtree", this);
    addAction(unstopAll);
    unstopAll->setShortcut(QKeySequence("Shift+X"));
    connect(unstopAll, SIGNAL(triggered()), m_Canvas, SLOT(unstopAll()));

    zoomToFit = new QAction("Zoom to fit", this);
    addAction(zoomToFit);
    zoomToFit->setShortcut(QKeySequence("Z"));
    connect(zoomToFit, SIGNAL(triggered()), m_Canvas, SLOT(zoomToFit()));

    center = new QAction("Center current node", this);
    addAction(center);
    center->setShortcut(QKeySequence("C"));
    connect(center, SIGNAL(triggered()), m_Canvas, SLOT(centerCurrentNode()));

    exportPDF = new QAction("Export subtree PDF...", this);
    addAction(exportPDF);
    exportPDF->setShortcut(QKeySequence("P"));
    connect(exportPDF, SIGNAL(triggered()), m_Canvas, SLOT(exportPDF()));

    exportWholeTreePDF = new QAction("Export PDF...", this);
    addAction(exportWholeTreePDF);
    exportWholeTreePDF->setShortcut(QKeySequence("Ctrl+Shift+P"));
    connect(exportWholeTreePDF, SIGNAL(triggered()), m_Canvas, SLOT(exportWholeTreePDF()));

    print = new QAction("Print...", this);
    addAction(print);
    print->setShortcut(QKeySequence("Ctrl+P"));
    connect(print, SIGNAL(triggered()), m_Canvas, SLOT(print()));

    printSearchLog = new QAction("Export search log...", this);
    addAction(printSearchLog);
    connect(printSearchLog, SIGNAL(triggered()), m_Canvas, SLOT(printSearchLog()));

    bookmarkNode = new QAction("Add/remove bookmark", this);
    bookmarkNode->setShortcut(QKeySequence("Shift+B"));
    connect(bookmarkNode, SIGNAL(triggered()), m_Canvas, SLOT(bookmarkNode()));

    nullBookmark = new QAction("<none>",this);
    nullBookmark->setCheckable(true);
    nullBookmark->setChecked(false);
    nullBookmark->setEnabled(false);

    bookmarksGroup = new QActionGroup(this);
    bookmarksGroup->setExclusive(false);
    bookmarksGroup->addAction(nullBookmark);
    connect(bookmarksGroup, SIGNAL(triggered(QAction*)),
            this, SLOT(selectBookmark(QAction*)));

    bookmarksMenu = new QMenu("Bookmarks", this);
    connect(bookmarksMenu, SIGNAL(aboutToShow()),
            this, SLOT(populateBookmarksMenu()));

    showNodeStats = new QAction("Node statistics", this);
    addAction(showNodeStats);
    showNodeStats->setShortcut(QKeySequence("S"));
    connect(showNodeStats, SIGNAL(triggered()),
            this, SLOT(showStats()));

    nullComparator = new QAction("<none>",this);
    nullComparator->setCheckable(true);
    nullComparator->setChecked(false);
    nullComparator->setEnabled(false);
    comparatorGroup = new QActionGroup(this);
    comparatorGroup->setExclusive(false);
    comparatorGroup->addAction(nullComparator);
//    connect(comparatorGroup, SIGNAL(triggered(QAction*)),
//            this, SLOT(selectComparator(QAction*)));

    comparatorMenu = new QMenu("Comparators", this);
    comparatorMenu->addActions(comparatorGroup->actions());

    contextMenu = new QMenu(this);
    
    contextMenu->addAction(collectMLStats_action);
    contextMenu->addAction(showNodeStats);
    contextMenu->addAction(center);

    contextMenu->addSeparator();

    contextMenu->addAction(searchNext);
    contextMenu->addAction(searchAll);

    contextMenu->addSeparator();

    contextMenu->addAction(toggleHidden);
    contextMenu->addAction(hideFailed);
    contextMenu->addAction(hideSize);
    contextMenu->addAction(unhideAll);
    contextMenu->addAction(labelBranches);
    contextMenu->addAction(labelPath);
    contextMenu->addAction(showNogoods);
    contextMenu->addAction(showNodeInfo);
    contextMenu->addAction(showNodeOnPixelTree);
    
    contextMenu->addAction(toggleStop);
    contextMenu->addAction(unstopAll);

    contextMenu->addSeparator();

    contextMenu->addMenu(bookmarksMenu);

    contextMenu->addSeparator();

#ifdef MAXIM_DEBUG
    contextMenu->addAction(deleteNode);
    contextMenu->addAction(dirtyUpNode);
#endif

}
Esempio n. 11
0
 void
 TreeCanvas::resizeToOuter(void) {
   if (autoZoom)
     zoomToFit();
 }
Esempio n. 12
0
//Setup camera/modelview to view a model with enclosing cuboid defined by min[X,Y,Z] and max[X,Y,Z]
bool View::init(bool force, float* newmin, float* newmax)
{
  if (!newmin) newmin = min;
  if (!newmax) newmax = max;

  for (int i=0; i<3; i++)
  {
    //Invalid bounds! Skip
    if (!ISFINITE(newmin[i]) || !ISFINITE(newmax[i])) return false;

    //If bounds changed, reset focal point to default
    //(causes jitter when switching timesteps - do we really want this?)
    if (min[i] != newmin[i] || max[i] != newmax[i]) focal_point[i] = default_focus[i];

    min[i] = newmin[i];
    max[i] = newmax[i];
    dims[i] = fabs(max[i] - min[i]);

    //Fallback focal point and rotation centre = model bounding box centre point
    if (focal_point[i] == FLT_MIN) focal_point[i] = min[i] + dims[i] / 2.0f;
    rotate_centre[i] = focal_point[i];
  }

  //Save magnitude of dimensions
  model_size = sqrt(dotProduct(dims,dims));
  if (model_size == 0 || !ISFINITE(model_size)) return false;

  //Check and calculate near/far clip planes
  float near_clip = properties["near"];
  float far_clip = properties["far"];
  checkClip(near_clip, far_clip);

  if (max[2] > min[2]+FLT_EPSILON) is3d = true;
  else is3d = false;
  debug_print("Model size %f dims: %f,%f,%f - %f,%f,%f (scale %f,%f,%f) 3d? %s\n",
              model_size, min[0], min[1], min[2], max[0], max[1], max[2], scale[0], scale[1], scale[2], (is3d ? "yes" : "no"));

  //Auto-cam etc should only be processed once... and only when viewport size has been set
  if ((force || !initialised) && width > 0 && height > 0)
  {
    //Only flag correctly initialised after focal point set (have model bounds)
    initialised = true;

    projection(EYE_CENTRE);

    //Default translation by model size
    if (model_trans[2] == 0)
      model_trans[2] = -model_size;

    // Initial zoom to fit
    // NOTE without (int) cast properties["zoomstep"] == 0 here always evaluated to false!
    if ((int)properties["zoomstep"] == 0) zoomToFit();

    debug_print("   Auto cam: (Viewport %d x %d) (Model: %f x %f x %f)\n", width, height, dims[0], dims[1], dims[2]);
    debug_print("   Looking At: %f,%f,%f\n", focal_point[0], focal_point[1], focal_point[2]);
    debug_print("   Rotate Origin: %f,%f,%f\n", rotate_centre[0], rotate_centre[1], rotate_centre[2]);
    debug_print("   Clip planes: near %f far %f. Focal length %f Eye separation ratio: %f\n", (float)properties["near"], (float)properties["far"], focal_length, eye_sep_ratio);
    debug_print("   Translate: %f,%f,%f\n", model_trans[0], model_trans[1], model_trans[2]);

    //Apply changes to view
    apply();
  }

  return true;
}
Esempio n. 13
0
MainWindow::MainWindow(QAction* actionQuit, QAction* actionNewTab, QAction* actionFullscreen, QAction* actionLoadSession, QAction* actionSaveSession, QWidget* parent)
    : QMainWindow(parent),
    ui(new Ui::MainWindow),
    fetcher(new Fetcher),
    local(new LocalFetcher),
    source(IMAGE_SOURCE_UNKNOWN)
{
    ui->setupUi(this);

    QStringList  sources;
    sources.append("Google");
    sources.append("Local file");
//    sources.append("Picsearch");
    ui->cbSource->addItems(sources);
    ui->cbSource->setCurrentIndex(IMAGE_SOURCE_GOOGLE);

    fetcher->hide();
    local->hide();

    ui->menuFile->addAction(actionNewTab);
    ui->menuFile->addAction(actionLoadSession);
    ui->menuFile->addAction(actionSaveSession);
    ui->menuFile->addAction(actionQuit);
    ui->menuView->insertAction(ui->actionResetTransforms,actionFullscreen);

    ui->tbFullScreen->setDefaultAction(actionFullscreen);
    ui->tbNewTab->setDefaultAction(actionNewTab);
    ui->tbResetTransform->setDefaultAction(ui->actionResetTransforms);
    ui->tbSave->setDefaultAction(actionSaveSession);

    ui->glTools->addWidget(fetcher,0,6,2,1);
    ui->glTools->addWidget(local,0,6,2,1);

    updateSource();

    connect(ui->cbSource,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSource()));

    ui->actionViewOnlyMode->setShortcut(Qt::Key_Tab);
    QList<QKeySequence> keys;
    keys << Qt::Key_Delete << Qt::Key_Backspace;
    ui->actionDeleteSelected->setShortcuts(keys);
    // These are necessary if the actions are to remain accessible when the menubar is hidden:
    this->addAction(ui->actionViewOnlyMode);
    this->addAction(ui->actionResetTransforms);
    this->addAction(ui->actionZoomToFit);
    this->addAction(ui->actionIntroduction);
    this->addAction(ui->actionTips);
    this->addAction(ui->actionOpenDirectory);
    this->addAction(ui->actionOpenFile);

    this->addAction(ui->actionDeleteSelected);
    this->addAction(ui->actionUncropSelected);
    this->addAction(ui->actionCentreInView);
    this->addAction(ui->actionResetRotation);
    this->addAction(ui->actionResetScale);
    this->addAction(ui->actionScaleToFit);

    this->addAction(actionFullscreen);
    this->addAction(actionLoadSession);
    this->addAction(actionSaveSession);
    this->addAction(actionNewTab);
    this->addAction(actionQuit);

    connect(ui->actionIntroduction,SIGNAL(triggered()),this,SLOT(showHelp()));
    connect(ui->actionTips,SIGNAL(triggered()),this,SLOT(showTips()));
    connect(ui->actionViewOnlyMode,SIGNAL(triggered(bool)),this,SLOT(enterViewOnlyMode(bool)));
    connect(ui->actionPreferences,SIGNAL(triggered()),this,SLOT(showPreferences()));

    connect(fetcher,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString)));
    connect(fetcher,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool)));
    connect(local,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool)));
    connect(local,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString)));

    initBlacklistDocker();
    initInfoDocker();

    initView(parent);
    dlDir = QString(DEFAULT_DOWNLOAD_DIRECTORY);
    dlMgr = new QNetworkAccessManager(this);


    connect(ui->actionResetTransforms,SIGNAL(triggered()),gvMain,SLOT(resetTransforms()));
    connect(ui->actionZoomToFit,SIGNAL(triggered()),gvMain,SLOT(zoomToFit()));
    connect(ui->actionOpenDirectory,SIGNAL(triggered()),local,SLOT(selectDirectory()));
    connect(ui->actionOpenFile,SIGNAL(triggered()),local,SLOT(selectFile()));

    connect(ui->actionDeleteSelected,SIGNAL(triggered()),gsMain,SLOT(deleteSelected()));
    connect(ui->actionUncropSelected,SIGNAL(triggered()),gsMain,SLOT(uncropSelected()));
    connect(ui->actionCentreInView,SIGNAL(triggered()),gsMain,SLOT(centreSelection()));
    connect(ui->actionResetRotation,SIGNAL(triggered()),gsMain,SLOT(resetSelectionRotation()));
    connect(ui->actionResetScale,SIGNAL(triggered()),gsMain,SLOT(resetSelectionScale()));
    connect(ui->actionScaleToFit,SIGNAL(triggered()),this,SLOT(scaleSelectedToFit()));

    ui->verticalLayout->removeWidget(ui->toolWidget);
    ui->toolBar->addWidget(ui->toolWidget);
    setCentralWidget(gvMain);
    ui->thumbBar->addWidget(gvCarousel);

    ui->statusBar->addWidget(fetcher->getStatusText(),0);
    ui->statusBar->addWidget(fetcher->getProgressBar(),1);

    connect(this,SIGNAL(settingsChanged()),this,SLOT(loadSettings()));
    loadSettings();
}
Esempio n. 14
0
Void PlaYUVerApp::createActions()
{
  m_arrayActions.resize( TOTAL_ACT );

  // ------------ File ------------
  m_arrayActions[OPEN_ACT] = new QAction( QIcon( ":/images/open.png" ), tr( "&Open" ), this );
  m_arrayActions[OPEN_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogOpenButton ) );
  m_arrayActions[OPEN_ACT]->setShortcuts( QKeySequence::Open );
  m_arrayActions[OPEN_ACT]->setStatusTip( tr( "Open stream" ) );
  connect( m_arrayActions[OPEN_ACT], SIGNAL( triggered() ), this, SLOT( open() ) );

  m_arrayRecentFilesActions.resize( MAX_RECENT_FILES );
  for( Int i = 0; i < MAX_RECENT_FILES; i++ )
  {
    m_arrayRecentFilesActions[i] = new QAction( this );
    m_arrayRecentFilesActions[i]->setVisible( false );
    connect( m_arrayRecentFilesActions[i], SIGNAL( triggered() ), this, SLOT( openRecent() ) );
  }

  m_arrayActions[SAVE_ACT] = new QAction( QIcon( ":/images/save.png" ), tr( "&Save Frame" ), this );
  m_arrayActions[SAVE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogSaveButton ) );
  m_arrayActions[SAVE_ACT]->setShortcuts( QKeySequence::SaveAs );
  m_arrayActions[SAVE_ACT]->setStatusTip( tr( "Save current frame" ) );
  connect( m_arrayActions[SAVE_ACT], SIGNAL( triggered() ), this, SLOT( save() ) );

  m_arrayActions[FORMAT_ACT] = new QAction( tr( "&Format" ), this );
  m_arrayActions[FORMAT_ACT]->setIcon( QIcon::fromTheme( "transform-scale", QIcon( ":/images/configuredialog.png" ) ) );
  m_arrayActions[FORMAT_ACT]->setShortcut( Qt::CTRL + Qt::Key_F );
  m_arrayActions[FORMAT_ACT]->setStatusTip( tr( "Open format dialog" ) );
  connect( m_arrayActions[FORMAT_ACT], SIGNAL( triggered() ), this, SLOT( format() ) );

  m_arrayActions[RELOAD_ACT] = new QAction( tr( "&Reload" ), this );
  m_arrayActions[RELOAD_ACT]->setIcon( style()->standardIcon( QStyle::SP_BrowserReload ) );
  m_arrayActions[RELOAD_ACT]->setShortcut( Qt::CTRL + Qt::Key_R );
  m_arrayActions[RELOAD_ACT]->setShortcut( Qt::Key_F5 );
  m_arrayActions[RELOAD_ACT]->setStatusTip( tr( "Reload current sequence" ) );
  connect( m_arrayActions[RELOAD_ACT], SIGNAL( triggered() ), this, SLOT( reload() ) );

  m_arrayActions[RELOAD_ALL_ACT] = new QAction( tr( "Reload All" ), this );
  m_arrayActions[RELOAD_ALL_ACT]->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_R );
  m_arrayActions[RELOAD_ALL_ACT]->setStatusTip( tr( "Reload all sequences" ) );
  connect( m_arrayActions[RELOAD_ALL_ACT], SIGNAL( triggered() ), this, SLOT( reloadAll() ) );

  m_arrayActions[LOAD_ALL_ACT] = new QAction( tr( "Preload" ), this );
  m_arrayActions[LOAD_ALL_ACT]->setStatusTip( tr( "Load sequence into memory (caution)" ) );
  connect( m_arrayActions[LOAD_ALL_ACT], SIGNAL( triggered() ), this, SLOT( loadAll() ) );

  m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this );
  m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) );
  m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
  connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeActiveSubWindow() ) );

  m_arrayActions[CLOSEALL_ACT] = new QAction( tr( "Close &All" ), this );
  m_arrayActions[CLOSEALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
  connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeAllSubWindow() ) );

  m_arrayActions[EXIT_ACT] = new QAction( tr( "E&xit" ), this );
  m_arrayActions[EXIT_ACT]->setShortcuts( QKeySequence::Quit );
  m_arrayActions[EXIT_ACT]->setStatusTip( tr( "Exit the application" ) );
  connect( m_arrayActions[EXIT_ACT], SIGNAL( triggered() ), qApp, SLOT( closeAllWindows() ) );

  // ------------ View ------------
  mapperZoom = new QSignalMapper( this );
  connect( mapperZoom, SIGNAL( mapped(int) ), this, SLOT( scaleFrame(int) ) );

  m_arrayActions[ZOOM_IN_ACT] = new QAction( tr( "Zoom &In (+25%)" ), this );
  m_arrayActions[ZOOM_IN_ACT]->setIcon( QIcon::fromTheme( "zoom-in", QIcon( ":/images/zoomin.png" ) ) );
  m_arrayActions[ZOOM_IN_ACT]->setShortcut( tr( "Ctrl++" ) );
  m_arrayActions[ZOOM_IN_ACT]->setStatusTip( tr( "Scale the image up by 25%" ) );
  connect( m_arrayActions[ZOOM_IN_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
  mapperZoom->setMapping( m_arrayActions[ZOOM_IN_ACT], 125 );

  m_arrayActions[ZOOM_OUT_ACT] = new QAction( tr( "Zoom &Out (-25%)" ), this );
  m_arrayActions[ZOOM_OUT_ACT]->setIcon( QIcon::fromTheme( "zoom-out", QIcon( ":/images/zoomout.png" ) ) );
  m_arrayActions[ZOOM_OUT_ACT]->setShortcut( tr( "Ctrl+-" ) );
  m_arrayActions[ZOOM_OUT_ACT]->setStatusTip( tr( "Scale the image down by 25%" ) );
  connect( m_arrayActions[ZOOM_OUT_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
  mapperZoom->setMapping( m_arrayActions[ZOOM_OUT_ACT], 80 );

  m_arrayActions[ZOOM_NORMAL_ACT] = new QAction( tr( "&Normal Size" ), this );
  m_arrayActions[ZOOM_NORMAL_ACT]->setIcon( QIcon::fromTheme( "zoom-original", QIcon( ":/images/zoomtonormal.png" ) ) );
  m_arrayActions[ZOOM_NORMAL_ACT]->setShortcut( tr( "Ctrl+N" ) );
  m_arrayActions[ZOOM_NORMAL_ACT]->setStatusTip( tr( "Show the image at its original size" ) );
  connect( m_arrayActions[ZOOM_NORMAL_ACT], SIGNAL( triggered() ), this, SLOT( normalSize() ) );

  m_arrayActions[ZOOM_FIT_ACT] = new QAction( tr( "Zoom to &Fit" ), this );
  m_arrayActions[ZOOM_FIT_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
  m_arrayActions[ZOOM_FIT_ACT]->setStatusTip( tr( "Zoom in or out to fit on the window." ) );
  connect( m_arrayActions[ZOOM_FIT_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFit() ) );

  m_arrayActions[ZOOM_FIT_ALL_ACT] = new QAction( tr( "Zoom to Fit All" ), this );
//m_arrayActions[ZOOM_FIT_ALL_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
  m_arrayActions[ZOOM_FIT_ALL_ACT]->setStatusTip( tr( "Apply zoom to fit to all windows" ) );
  connect( m_arrayActions[ZOOM_FIT_ALL_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFitAll() ) );

  m_appModuleVideo->createActions();
  m_appModuleQuality->createActions();
  m_appModuleExtensions->createActions();
  m_pcWindowHandle->createActions();

// ------------ About ------------

#ifdef USE_FERVOR
  m_arrayActions[UPDATE_ACT] = new QAction( tr( "&Update" ), this );
  m_arrayActions[UPDATE_ACT]->setStatusTip( tr( "Check for updates" ) );
  connect( m_arrayActions[UPDATE_ACT], SIGNAL( triggered() ), FvUpdater::sharedUpdater(), SLOT( CheckForUpdatesNotSilent() ) );
#endif

  m_arrayActions[ABOUT_ACT] = new QAction( tr( "&About" ), this );
  m_arrayActions[ABOUT_ACT]->setStatusTip( tr( "Show the application's About box" ) );
  connect( m_arrayActions[ABOUT_ACT], SIGNAL( triggered() ), this, SLOT( about() ) );

  m_arrayActions[ABOUTQT_ACT] = new QAction( tr( "About &Qt" ), this );
  m_arrayActions[ABOUTQT_ACT]->setIcon( QIcon( ":images/qt.png" ) );
  m_arrayActions[ABOUTQT_ACT]->setStatusTip( tr( "Show the Qt library's About box" ) );
  connect( m_arrayActions[ABOUTQT_ACT], SIGNAL( triggered() ), qApp, SLOT( aboutQt() ) );
}