Exemple #1
0
void
ZoomWidget::zoomWorldSize( const QSizeF & worldSize, const QPointF & pcenter )
{
    // first reset zoom
    zoomWorldSize( worldSize);

    // center on the given point
    centerView( pcenter );
}
Exemple #2
0
///// resetView //////////////////////////////////////////////////////////////
void GLView::resetView(const bool update)
/// Resets translation/orientation/zoom of the scene.
{
  centerView(false);
  resetOrientation(false);
  zoomFit(); // calls setModified()
  if(update)
    updateGL();
}
Exemple #3
0
void LevelMap::moveCursor(GLshort i)
{
	GridBlock* gb = getBlockByIso(sBlock->getCoordIso(X) + 
											PATH_DIR[sBlock->getCoordIso(Y)%2][i][X], 
											sBlock->getCoordIso(Y) + 
											PATH_DIR[sBlock->getCoordIso(Y)%2][i][Y]);	
	if(gb != NULL){
		selectBlock(gb);
		
		switch(i){
			case DOWN_LEFT:
				if((sBlock->getOffset(X) + BLOCK_SIZE_ISO[MAX_ZOOM][X] / 2) * pow(2, camera.getZoom() - 2) < camera.getView(X) || 
					(sBlock->getOffset(Y) + BLOCK_SIZE_ISO[MAX_ZOOM][Y] / 2) * pow(2, camera.getZoom() - 2) < camera.getView(Y))
					centerView(sBlock->getOffset(X), sBlock->getOffset(Y));
				break;
				
			case UP_RIGHT:
				if((sBlock->getOffset(X) + BLOCK_SIZE_ISO[MAX_ZOOM][X] / 2) * pow(2, camera.getZoom() - 2) > camera.getView(X) + MAIN_FRAME_SIZE[X] || 
					(sBlock->getOffset(Y) + BLOCK_SIZE_ISO[MAX_ZOOM][Y] / 2) * pow(2, camera.getZoom() - 2) > camera.getView(Y) + MAIN_FRAME_SIZE[Y])
					centerView(sBlock->getOffset(X), sBlock->getOffset(Y));
				break;
				
			case DOWN_RIGHT:				
				if((sBlock->getOffset(X) + BLOCK_SIZE_ISO[MAX_ZOOM][X] / 2) * pow(2, camera.getZoom() - 2) > camera.getView(X) + MAIN_FRAME_SIZE[X] || 
					(sBlock->getOffset(Y) + BLOCK_SIZE_ISO[MAX_ZOOM][Y] / 2) * pow(2, camera.getZoom() - 2) < camera.getView(Y))
					centerView(sBlock->getOffset(X), sBlock->getOffset(Y));
				break;
				
			case UP_LEFT:				
				if((sBlock->getOffset(X) + BLOCK_SIZE_ISO[MAX_ZOOM][X] / 2) * pow(2, camera.getZoom() - 2) < camera.getView(X) || 
					(sBlock->getOffset(Y) + BLOCK_SIZE_ISO[MAX_ZOOM][Y] / 2) * pow(2, camera.getZoom() - 2) > camera.getView(Y) + MAIN_FRAME_SIZE[Y])
					centerView(sBlock->getOffset(X), sBlock->getOffset(Y));
				break;
		}
	}
}
Exemple #4
0
void
ZoomWidget::zoomView( const double & z )
{
    if ( z == 1.0 )
        return;

    // remember current center point in MAP CS
    QPointF pcenter = QPointF( width()/2,height()/2 ) * wm_.inverted();

    // scale the matrix
    wm_.scale( z, z );

    // put the center point back in the center
    centerView( pcenter );

    emit matrixChanged( wm_ );
}
Exemple #5
0
void MainWindow::createActions()
{
	// Map menu:
	createWorldActions();

	m_actNewGen = new QAction(tr("&New generator"), this);
	m_actNewGen->setShortcut(tr("Ctrl+N"));
	m_actNewGen->setStatusTip(tr("Open a generator INI file and display the generated biomes"));
	connect(m_actNewGen, SIGNAL(triggered()), this, SLOT(newGenerator()));

	m_actOpenGen = new QAction(tr("&Open generator..."), this);
	m_actOpenGen->setShortcut(tr("Ctrl+G"));
	m_actOpenGen->setStatusTip(tr("Open a generator INI file and display the generated biomes"));
	connect(m_actOpenGen, SIGNAL(triggered()), this, SLOT(openGenerator()));

	m_actOpenWorld = new QAction(tr("&Open world..."), this);
	m_actOpenWorld->setShortcut(tr("Ctrl+O"));
	m_actOpenWorld->setStatusTip(tr("Open an existing world and display its biomes"));
	connect(m_actOpenWorld, SIGNAL(triggered()), this, SLOT(openWorld()));

	m_actReload = new QAction(tr("&Reload"), this);
	m_actReload->setShortcut(tr("F5"));
	m_actReload->setStatusTip(tr("Clear the view cache and force a reload of all the data"));
	connect(m_actReload, SIGNAL(triggered()), m_BiomeView, SLOT(reload()));

	m_actExit = new QAction(tr("E&xit"), this);
	m_actExit->setShortcut(tr("Alt+X"));
	m_actExit->setStatusTip(tr("Exit %1").arg(QApplication::instance()->applicationName()));
	connect(m_actExit, SIGNAL(triggered()), this, SLOT(close()));

	// View menu:
	m_actViewCenter = new QAction(tr("&Reset to center"), this);
	m_actViewCenter->setStatusTip(tr("Scrolls the view back to the map center"));
	connect(m_actViewCenter, SIGNAL(triggered()), this, SLOT(centerView()));

	QActionGroup * zoomGroup = new QActionGroup(this);
	for (int i = 0; i < ARRAYCOUNT(m_ViewZooms); i++)
	{
		m_actViewZoom[i] = new QAction(tr("&Zoom %1%").arg(std::floor(m_ViewZooms[i] * 100)), this);
		m_actViewZoom[i]->setCheckable(true);
		m_actViewZoom[i]->setData(QVariant(i));
		zoomGroup->addAction(m_actViewZoom[i]);
		connect(m_actViewZoom[i], SIGNAL(triggered()), this, SLOT(setViewZoom()));
	}
	m_actViewZoom[m_CurrentZoomLevel]->setChecked(true);
}
Exemple #6
0
/*! Constructs widgets and connections of signals for the main window.
 */
void MPWindow::initUIComponents()
{
    // Initialise view
    m_view = new MPMapView(this);
    connect(m_view, SIGNAL(interactionChanged(Interaction*)), this, SLOT(onInteractionChanged(Interaction*)));
    connect(m_view, SIGNAL(viewportShift()), this, SLOT(onViewShift()));
    connect(m_view, SIGNAL(painted(qlonglong)), this, SLOT(onViewPainted(qlonglong)));
    connect(m_view, SIGNAL(imageRequested(int)), this, SLOT(onViewImageRequested(int)));
    connect(m_view, SIGNAL(imageReceived()), this, SLOT(onViewImageReceived()));
    connect(m_view, SIGNAL(imageFinished()), this, SLOT(onViewImageFinished()));
    connect(m_view, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(onViewMouseMove(QMouseEvent*)));
    connect(m_view, SIGNAL(featureSnap(Feature*)), this, SLOT(onViewFeatureSnap(Feature*)));

    setCentralWidget(m_view);

    // Docks
    m_infosdock = new InfosDock(this);
    m_infosdock->setAllowedAreas(Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea);
    addDockWidget(Qt::RightDockWidgetArea, m_infosdock);
    connect(m_infosdock, SIGNAL(dockClosed(bool)), this, SLOT(onDisplayInfosDock(bool)));

    // Status bar
    m_coordsLabel = new CoordField(this);
    connect(m_coordsLabel, SIGNAL(centerView(qreal,qreal)), this, SLOT(onCenterView(qreal,qreal)));

    m_meterPerPixelLabel = new QLabel(this);
    m_zoomlevelLabel = new QLabel(this);    
    m_paintTimeLabel = new QLabel(this);
    m_paintTimeLabel->setMinimumWidth(23);

    m_dataProgress = new QProgressBar(this);
    m_dataProgress->setMaximumWidth(200);
    m_dataProgress->setVisible(false);

    m_imagesProgress = new QProgressBar(this);
    m_imagesProgress->setMaximumWidth(200);
    m_imagesProgress->setFormat(tr("tile %v / %m"));

    m_wsProgress = new QProgressBar(this);
    m_wsProgress->setMaximumWidth(200);
    m_wsProgress->setTextVisible(true);
    m_wsProgress->setFormat(tr("Requesting...")); // This has no effects, because max = 0
    m_wsProgress->setVisible(false);
    m_wsProgress->setMaximum(0);

    // Separators
    m_sepCoordZoom = new QFrame(this);
    m_sepCoordZoom->setFrameStyle(QFrame::VLine);
    m_sepZoomScale = new QFrame(this);
    m_sepZoomScale->setFrameStyle(QFrame::VLine);
    m_sepScaleTime = new QFrame(this);
    m_sepScaleTime->setFrameStyle(QFrame::VLine);

    statusBar()->addPermanentWidget(m_imagesProgress);
    statusBar()->addPermanentWidget(m_dataProgress);
    statusBar()->addPermanentWidget(m_wsProgress);
    statusBar()->addPermanentWidget(m_coordsLabel);
    statusBar()->addPermanentWidget(m_sepCoordZoom);
    statusBar()->addPermanentWidget(m_zoomlevelLabel);
    statusBar()->addPermanentWidget(m_sepZoomScale);
    statusBar()->addPermanentWidget(m_meterPerPixelLabel);
    statusBar()->addPermanentWidget(m_sepScaleTime);
    statusBar()->addPermanentWidget(m_paintTimeLabel);
}
Exemple #7
0
UEditorWindow::UEditorWindow(QWidget *parent)
    : QMainWindow(parent),
      ui(new Ui::EditWindowClass),
      _confirmCloseMessageBox(0),
      _redoAction(0),
      _undoAction(0),
      _spaceNoteGeneration(false)
{

    this->setFocusPolicy(Qt::StrongFocus);
_startTime=0;
    _playViolon = false;
    _currentFile = NULL;
    _isPlaying=false;
setAcceptDrops(true);
USetting::Instance.init();

#ifdef QT_MODULE_NETWORK
UCheckUpdate * check = new UCheckUpdate(QUrl(URL_VERSION));
connect(check,SIGNAL(connected()),this,SLOT(onConnected()));
#endif


    setupAudio();
    setupUi();

            _currentFile = new UFile(this);// "songs/arkol - vingt ans/Arkol - vingt ans.txt");

            fileConnect();

            this->showSentenceWidget->setHScroll(0);

        connect(ui->vScroll,SIGNAL(valueChanged(int)),this,SLOT(onUpdateVScrollAndScale(int)));
        connect(ui->vSlider,SIGNAL(valueChanged(int)),this,SLOT(onUpdateVScrollAndScale(int)));
        connect(ui->vScroll,SIGNAL(sliderPressed()),this,SLOT(onUpdateVScrollAndScale()));
        connect(ui->vSlider,SIGNAL(sliderPressed()),this,SLOT(onUpdateVScrollAndScale()));
        //connect(ui->vScroll,SIGNAL(actionTriggered(int)),this,SLOT(changeVScroll(int)));

        connect(_hScroll,SIGNAL(valueChanged(int)),this,SLOT(changeHScroll(int)));
        //connect(ui->hSlider,SIGNAL(valueChanged(int)),this,SLOT(changeHSlider(int)));
        connect(_hScroll,SIGNAL(sliderPressed()),this,SLOT(changeHScroll()));
        //connect(ui->hSlider,SIGNAL(sliderPressed()),this,SLOT(changeHSlider()));
        connect(_hScroll,SIGNAL(pageStepChanged(int)),this,SLOT(changeHSlider(int)));





        connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(openFile()));

        connect(ui->actionEditHeaders,SIGNAL(triggered()),this,SLOT(editHeader()));
        connect(ui->actionApplyOffset,SIGNAL(triggered()),this,SLOT(openTiming()));
        connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
        connect(playAction, SIGNAL(triggered()), this, SLOT(tooglePlay()));
        connect(pauseAction, SIGNAL(triggered()), this, SLOT(tooglePlay()));
        connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecord()));
        connect(showSentenceWidget,SIGNAL(haveToStop()), this, SLOT(tooglePlay()));

        connect(this->ui->offsetSpinBox, SIGNAL(valueChanged(int)), showSentenceWidget, SLOT(setPreviousDisplayed(int)));
        this->ui->offsetSpinBox->setValue(2);
        connect(ui->actionSetNormalNote,SIGNAL(triggered()),showSentenceWidget, SLOT(setNormal()));
        connect(ui->actionSetFreeNote,SIGNAL(triggered()),showSentenceWidget, SLOT(setFree()));
        connect(ui->actionSetGoldNote,SIGNAL(triggered()),showSentenceWidget, SLOT(setGold()));

        connect(ui->actionMergeNotes,SIGNAL(triggered()),showSentenceWidget, SLOT(fusion()));
        connect(ui->actionSplitNote,SIGNAL(triggered()),showSentenceWidget, SLOT(split()));

        connect(ui->actionAddNote,SIGNAL(triggered()),showSentenceWidget, SLOT(nextClickAddNote()));
        connect(ui->actionAddSeparator,SIGNAL(triggered()),showSentenceWidget, SLOT(nextClickAddSeparator()));

        connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(save()));
        connect(ui->actionSaveAs,SIGNAL(triggered()),this,SLOT(saveAs()));
        connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newSong()));

        connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(close()));

        connect(&UInputManager::Instance,SIGNAL(spacePressEvent(void)),this,SLOT(tooglePlay()));

        connect(_wydget_timeline, SIGNAL(gapModified(double)),this, SLOT(gapModified(double)));

         connect(ui->actionDeleteNote,SIGNAL(triggered()),showSentenceWidget,SLOT(deleteNotes()));

        connect(ui->actionPreferences,SIGNAL(triggered()),&USetting::Instance,SLOT(showDialog()));

        connect(ui->actionMorphe,SIGNAL(triggered()),showSentenceWidget,SLOT(calquer()));


        connect(ui->actionLockTimings,SIGNAL(toggled(bool)),showSentenceWidget,SLOT(lockTime(bool)));

        connect(ui->actionCenter,SIGNAL(triggered()),this,SLOT(centerView()));

        connect(ui->actionHelp,SIGNAL(triggered()),this,SLOT(displayHelpScreen()));
        connect(ui->actionSendFeedback,SIGNAL(triggered()),this,SLOT(displayFeedback()));




        onUpdateVScrollAndScale();
        changeHScroll(0);


       // _currentFile = new UFile(this);
        this->showSentenceWidget->setLyrics(_currentFile->lyrics);
        _wydget_lyrics->setWidgetWords(showSentenceWidget);


        _undoAction = _currentFile->lyrics->history().createUndoAction(this->ui->menuEdit, tr("Annuler "));
        _undoAction->setShortcut(QKeySequence::Undo);
        _undoAction->setIcon(QIcon(":/images/undo.png"));
        this->ui->menuEdit->addAction(_undoAction);
        this->ui->toolBar->insertAction(this->ui->actionSetNormalNote, _undoAction);

        _redoAction = _currentFile->lyrics->history().createRedoAction(this->ui->menuEdit, tr("Refaire "));
        _redoAction->setShortcut(QKeySequence::Redo);
        _redoAction->setIcon(QIcon(":/images/redo.png"));
        this->ui->menuEdit->addAction(_redoAction);
        this->ui->toolBar->insertAction(this->ui->actionSetNormalNote, _redoAction);


        readLastFile();

        connect(ui->actionRecentFiles,SIGNAL(triggered()),this,SLOT(openLastFile()));



        readSettings();

        _spaceNote = new Recorder(this->showSentenceWidget);

        _autoSaveTimer = new QTimer(this);
          connect(_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSave()));

          adaptNewFile();


}