void DiffAnalystWindow::onFileSave()
{
	DiffSession* curWin = (DiffSession*) m_pWs->activeWindow();
	if (curWin)
	{
		QString dawName = curWin->getDawName();
		if(!dawName.isEmpty())
		{
			generateDAWFile(dawName,curWin);
		}else{
			onFileSaveAs();
		}
	}
}
Exemple #2
0
void MainWindow::onFileSave()
{
	if (!fDoc)
		return;

	if (fDoc->fPath.isEmpty())
	{
		onFileSaveAs();
		return;
	}

	fDoc->Save();
	QFileInfo info(fDoc->fPath);
	setWindowTitle(tr("Papagayo") + " - " + info.fileName());
}
/* /////////////////////////////////////////////////////////////////////////////
 * Application main window constructor
 */
TTCutMainWindow::TTCutMainWindow() 
: QMainWindow()
{

  // setup Qt Designer UI
  setupUi( this );

  // images
  // --------------------------------------------------------------------------
  TTCut::imgDownArrow  = new QPixmap( downarrow_18_xpm );
  TTCut::imgUpArrow    = new QPixmap( uparrow_18_xpm );
  TTCut::imgDelete     = new QPixmap( cancel_18_xpm );
  TTCut::imgFileOpen24 = new QPixmap( fileopen_24_xpm );
  TTCut::imgFileNew    = new QPixmap( filenew_16_xpm );
  TTCut::imgFileOpen   = new QPixmap( fileopen_16_xpm );
  TTCut::imgFileSave   = new QPixmap( filesave_16_xpm );;
  TTCut::imgFileSaveAs = new QPixmap( filesaveas_16_xpm );
  TTCut::imgSaveImage  = new QPixmap( saveimage_16_xpm );
  TTCut::imgSettings   = new QPixmap( settings_16_xpm );
  TTCut::imgSettings18 = new QPixmap( settings_18_xpm );
  TTCut::imgExit       = new QPixmap( exit_16_xpm );
  TTCut::imgPlay       = new QPixmap( play_18_xpm );
  TTCut::imgStop       = new QPixmap( stop_18_xpm );
  TTCut::imgSearch     = new QPixmap( search_18_xpm );
  TTCut::imgChapter    = new QPixmap( chapter_18_xpm );
  TTCut::imgPreview    = new QPixmap( preview_18_xpm );
  TTCut::imgCutAV      = new QPixmap( cutav_18_xpm );
  TTCut::imgCutAudio   = new QPixmap( cutaudio_18_xpm );
  TTCut::imgGoTo       = new QPixmap( goto_18_xpm );
  TTCut::imgMarker     = new QPixmap( note_18_xpm );
  TTCut::imgClock      = new QPixmap( clock_16_xpm );
  TTCut::imgApply      = new QPixmap( apply_18_xpm );
  TTCut::imgAddToList  = new QPixmap( addtolist_18_xpm );
  TTCut::imgFileClose  = new QPixmap( fileclose_18_xpm );

  setFocusPolicy(Qt::StrongFocus);

  // Message logger instance
  log = TTMessageLogger::getInstance();
  
  // Get the current Qt version at runtime
  log->infoMsg(oName, "TTCut-Version: %s", qPrintable(TTCut::versionString));
  log->infoMsg(oName, "Qt-Version:    %s", qVersion());

#if QT_VERSION < 0x040100
  // TODO: Show message box and abort session
  log->errorMsg(oName, "Qt-Version >= 4.1.0 required");
#endif

  // Settings
  TTCut::recentFileList.clear();
  settings = new TTCutSettings();
  settings->readSettings();
  log->enableLogFile(TTCut::createLogFile);
  log->setLogModeConsole(TTCut::logModeConsole);
  log->setLogModeExtended(TTCut::logModeExtended);

 
  // Audio list
  audioList = new TTAudioListData();
  audioFileInfo->setListData(audioList);

  // Mux list and mplex provider (later by plugin)
  muxListData   = new TTMuxListData();
  mplexProvider = new TTMplexProvider();

  // no navigation
  navigationEnabled( false );
 
  // init
  cutListData            = NULL;
  mpegStream             = NULL;
  TTCut::isVideoOpen     = false;
  TTCut::projectFileName = "";
  
  // Signal and slot connections
  // 
  // Connect signals from main menu
  // --------------------------------------------------------------------------
  connect(actionOpenVideo,        SIGNAL(triggered()), videoFileInfo, SLOT(onFileOpen()));
  connect(actionOpenAudio,        SIGNAL(triggered()), audioFileInfo, SLOT(onFileOpen()));
  connect(actionFileNew,          SIGNAL(triggered()), SLOT(onFileNew()));
  connect(actionFileOpen,         SIGNAL(triggered()), SLOT(onFileOpen()));
  connect(actionFileSave,         SIGNAL(triggered()), SLOT(onFileSave()));
  connect(actionFileSaveAs,       SIGNAL(triggered()), SLOT(onFileSaveAs()));
  connect(actionExit,             SIGNAL(triggered()), SLOT(onFileExit()));
  connect(actionSaveCurrentFrame, SIGNAL(triggered()), SLOT(onActionSave()));
  connect(actionSettings,         SIGNAL(triggered()), SLOT(onActionSettings()));
  connect(actionAbout,            SIGNAL(triggered()), SLOT(onHelpAbout()));

  // recent files
  for (int i = 0; i < MaxRecentFiles; ++i) {
    recentFileAction[i] = new QAction(this);
    recentFileAction[i]->setVisible(false);
    menuRecentProjects->addAction(recentFileAction[i]);
    connect(recentFileAction[i], SIGNAL(triggered()), SLOT(onFileRecent()));
  }
 
  updateRecentFileActions();

  // Connect signals from video and audio info
  // --------------------------------------------------------------------------
  connect(videoFileInfo,          SIGNAL(fileOpened(QString)), SLOT(onReadVideoStream(QString)));
  connect(audioFileInfo,          SIGNAL(fileOpened(QString)), SLOT(onReadAudioStream(QString)));

  // Connect signals from navigation widget
  // --------------------------------------------------------------------------
  connect(navigation, SIGNAL(prevIFrame()),      currentFrame, SLOT(onPrevIFrame()));
  connect(navigation, SIGNAL(nextIFrame()),      currentFrame, SLOT(onNextIFrame()));
  connect(navigation, SIGNAL(prevPFrame()),      currentFrame, SLOT(onPrevPFrame()));
  connect(navigation, SIGNAL(nextPFrame()),      currentFrame, SLOT(onNextPFrame()));
  connect(navigation, SIGNAL(prevBFrame()),      currentFrame, SLOT(onPrevBFrame()));
  connect(navigation, SIGNAL(nextBFrame()),      currentFrame, SLOT(onNextBFrame()));
  connect(navigation, SIGNAL(setCutOut(int)),    currentFrame, SLOT(onSetCutOut(int)));
  connect(navigation, SIGNAL(setCutOut(int)),    cutOutFrame,  SLOT(onGotoCutOut(int)));
  connect(navigation, SIGNAL(setCutIn(int)),     currentFrame, SLOT(onSetCutIn(int)));
  connect(navigation, SIGNAL(gotoCutIn(int)),    currentFrame, SLOT(onGotoCutIn(int)));
  connect(navigation, SIGNAL(gotoCutOut(int)),   currentFrame, SLOT(onGotoCutOut(int)));
  connect(navigation, SIGNAL(addCutRange(int, int)), cutList,   SLOT(onAddEntry(int, int)));
  connect(navigation, SIGNAL(gotoMarker(int)),   currentFrame, SLOT(onGotoMarker(int)));
  connect(navigation, SIGNAL(moveNumSteps(int)), currentFrame, SLOT(onMoveNumSteps(int)));
  connect(navigation, SIGNAL(moveToHome()),      currentFrame, SLOT(onMoveToHome()));
  connect(navigation, SIGNAL(moveToEnd()),       currentFrame, SLOT(onMoveToEnd()));

  // Connect signal from video slider
  // --------------------------------------------------------------------------
  connect(streamNavigator, SIGNAL(sliderValueChanged(int)), SLOT(onVideoSliderChanged(int)));

  // Connect signals from cut-out frame widget
  // --------------------------------------------------------------------------
  connect(cutOutFrame, SIGNAL(equalFrameFound(int)), currentFrame, SLOT(onGotoFrame(int)));
  connect(cutOutFrame, SIGNAL(newCutOutFramePos(int)), cutList,    SLOT(onEditCutOut(int)));

  // Connect signals from current frame widget
  // --------------------------------------------------------------------------
  connect(currentFrame, SIGNAL(newFramePosition(int)), SLOT(onNewFramePos(int))); 

  // Connect signals from cut list widget
  // --------------------------------------------------------------------------
  connect(cutList, SIGNAL(entrySelected(int)), cutOutFrame,     SLOT(onGotoCutOut(int)));
  connect(cutList, SIGNAL(entryEdit(const TTCutListDataItem&)), 
                                              navigation,       SLOT(onEditCut(const TTCutListDataItem&)));
  connect(cutList, SIGNAL(gotoCutIn(int)),     currentFrame,    SLOT(onGotoFrame(int)));
  connect(cutList, SIGNAL(gotoCutOut(int)),    currentFrame,    SLOT(onGotoFrame(int)));
  connect(cutList, SIGNAL(refreshDisplay()),   streamNavigator, SLOT(onRefreshDisplay()));
  connect(cutList, SIGNAL(previewCut(int)),                     SLOT(onPreviewCut(int)));
  connect(cutList, SIGNAL(audioVideoCut(int)),                  SLOT(onAudioVideoCut(int)));
  connect(cutList, SIGNAL(audioCut(int)),                       SLOT(onAudioCut(int)));
}
bool DiffAnalystWindow::initMenuBar()
{
	bool ret=false;
	// ////////////////////////////////////////////////////////////////////
	// FILE
	m_pFileMenu = new QPopupMenu (this);
	if(m_pFileMenu == NULL) return false;
	menuBar ()->insertItem ("&File", m_pFileMenu);

	// New
	m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileNew)), "&New Session Wizard", this,
		SLOT (onFileNew ()), CTRL + Key_N);
	// Open
	m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileOpen)), "&Open",
		this, SLOT (onFileOpen ()), CTRL + Key_O);
	
	// -------------------
	m_pFileMenu->insertSeparator ();
	
	// Save
	m_SaveId = m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileSave)),
		"&Save", this, SLOT (onFileSave ()), CTRL + Key_S);
	m_pFileMenu->setItemEnabled (m_SaveId, false);

	// Save As
	m_SaveAsId = m_pFileMenu->insertItem (QIconSet(QPixmap()),
		"Save &As", this, SLOT (onFileSaveAs ()), CTRL + Key_A);
	m_pFileMenu->setItemEnabled (m_SaveAsId, false);

	// -------------------
//	m_pFileMenu->insertSeparator ();

	// export data
//	m_ExportDataId = m_pFileMenu->insertItem ("&Export...", this,
//		SLOT (onExportData ()));
//	m_pFileMenu->setItemEnabled (m_ExportDataId, false);

	// -------------------
	m_pFileMenu->insertSeparator ();

	// Close
	m_CloseId 	= m_pFileMenu->insertItem ("&Close", this, SLOT (onFileClose ()), CTRL + Key_W);
	m_CloseAllId 	= m_pFileMenu->insertItem ("Close Al&l", this, SLOT (onCloseAllWindows ()));

	// Quit
	m_pFileMenu->insertItem ("&Quit", this, SLOT (close ()), CTRL + Key_Q);
	QObject::connect (qApp, SIGNAL (aboutToQuit ()), this,
		SLOT (onAboutToQuit ()));
	
	// ////////////////////////////////////////////////////////////////////
	// SETTINGS
//	m_pSettingsMenu = new QPopupMenu (this);
//	if(m_pSettingsMenu == NULL) return false;
//	menuBar ()->insertItem ("&Settings", m_pSettingsMenu);

	// /////////////////////////////////////////////////////////////////////
	// TOOLS
	m_pToolsMenu = new QPopupMenu (this);
	if(m_pToolsMenu == NULL) return false;

	m_pToolsMenu->setCheckable (TRUE);
        connect (m_pToolsMenu, SIGNAL (aboutToShow ()), this,
                SLOT (toolsMenuAboutToShow ()));

	menuBar ()->insertItem ("&Tools", m_pToolsMenu);

	// /////////////////////////////////////////////////////////////////////
	// VIEW 
	m_pViewMenu = new QPopupMenu (this);
	if(m_pViewMenu == NULL) return false;
	menuBar ()->insertItem ("&View", m_pViewMenu);

	// View Management
	m_ViewManageId = m_pViewMenu->insertItem (QPixmap(viewconfig),"&View Management", this,
		SLOT (onViewManage ()));

	// /////////////////////////////////////////////////////////////////////
	// WINDOWS
	m_pWindowsMenu = new QPopupMenu (this);
	if(m_pWindowsMenu == NULL) return false;
        connect (m_pWindowsMenu, SIGNAL (aboutToShow ()), this,
                SLOT (onWindowsMenuAboutToShow ()));
	
	menuBar ()->insertItem ("&Windows", m_pWindowsMenu);

	// /////////////////////////////////////////////////////////////////////
	// HELPS
	m_pHelpMenu = new QPopupMenu (this);
	if(m_pHelpMenu == NULL) return false;
	menuBar ()->insertItem ("&Help", m_pHelpMenu);

	m_pHelpMenu->insertItem ("&About", this, SLOT (onHelpAbout ()), Key_F1);
	m_pHelpMenu->insertItem ("&Help", this, SLOT (onHelpContents ()));
	
	ret = true;
	return ret;
}// DiffAnalystWindow::initMenuBar