bool pChild::openFile( const QString& fileName, const QString& codec ) { // if already open file, cancel /*if ( !filePath().isEmpty() ) { return false; }*/ // set filename of the owned document setFilePath( fileName ); // open file const bool locked = blockSignals( true ); const bool opened = mEditor->openFile( fileName, codec ); blockSignals( locked ); if ( !opened ) { setFilePath( QString::null ); return false; } mCodec = QTextCodec::codecForName( codec.toUtf8() ); emit fileOpened(); return true; }
void Navigator::checkDirectory (Q3ListBoxItem *item) { //qDebug("checkDirectory(selected)"); if (! item) { emit noSelection(); selectedFlag = FALSE; return; } if (! item->text().compare("..")) { upDirectory(); return; } QString s; if (item->pixmap()) { // step directory tree down s = currentDir.absPath() + "/" + item->text(); setDirectory(s); return; } getFileSelection(s); emit fileOpened(s); }
/*! \brief Open button clicked. Select a new file. */ void DockIqPlayer::on_openButton_clicked() { QString newFile; qDebug() << "Open button clicked."; newFile = QFileDialog::getOpenFileName(this, tr("Open I/Q recording"), "", tr("I/Q recordings (*.bin *.raw)")); if (newFile.isEmpty()) { /* user cancelled */ return; } /* store new file name */ d_fileName = newFile; /* estimate duration */ QFile f(d_fileName); QTime zero(0, 0, 0, 0); QTime dur; d_duration = f.size() / (d_samprate*d_bps); ui->seekSlider->setRange(0, (int)d_duration); /* show duration */ dur = zero.addSecs((int)d_duration); ui->durLabel->setText(dur.toString("HH:mm:ss")); /* update widgets */ setWindowTitle(tr("I/Q Player: %1").arg(d_fileName)); ui->playButton->setEnabled(true); emit fileOpened(d_fileName); }
/** * Called when a document has completed loading. * Determines the file's properties and refreshes the tag list of the editor * window. * This slot is connected to the completed() signal of the document object. * The signal is emitted when a new file is opened, or when a modified file is * saved. */ void EditorPage::slotFileOpened() { QFileInfo fi(m_pDoc->url().path()); // Get file information m_sName = fi.fileName(); m_bWritable = fi.isWritable(); // Set read/write or read-only mode m_pDoc->setReadWrite(!Config().getReadOnlyMode() && m_bWritable); // Refresh the tag list m_pCtagsList->clear(); m_ctags.run(m_pDoc->url().path()); // Check if this is a modified file that has just been saved if (m_bModified) emit fileSaved(m_pDoc->url().path(), m_bNewFile); // Notify that the document has loaded m_bOpen = true; m_bModified = false; emit fileOpened(this, m_pDoc->url().path()); // Set initial position of the cursor m_nLine = 0; slotCursorPosChange(); // This is no longer a new file m_bNewFile = false; }
/* //////////////////////////////////////////////////////////////////////////// * Default constructor */ TTMpeg2MainWnd::TTMpeg2MainWnd() :QMainWindow() { setupUi(this); // some default values currentStreamOrder = -1; isProjectOpen = false; sliderUpdateFrame = false; enableControls(false); // Conect signals from main menu connect(actionFileOpen, SIGNAL(triggered()), videoFileInfo, SLOT(onFileOpen())); connect(actionAnalyze, SIGNAL(triggered()), SLOT(onAnalyze())); connect(actionSettings, SIGNAL(triggered()), SLOT(onSettings())); connect(actionExit, SIGNAL(triggered()), SLOT(onExit())); connect(actionWriteHeaderList, SIGNAL(triggered()), SLOT(onWriteHeaderList())); // Connect signals from video file info widget connect(videoFileInfo, SIGNAL(fileOpened(QString)), SLOT(onLoadVideoFile(QString))); // Connect signals from the step control widget connect(stepControl, SIGNAL(gotoNextFrame(int, int)), SLOT(onGotoNextFrame(int, int))); connect(stepControl, SIGNAL(gotoPrevFrame(int, int)), SLOT(onGotoPrevFrame(int, int))); // Scroller connect(scroller, SIGNAL(valueChanged(int)), SLOT(onSliderValueChanged(int))); }
void Graph::setDatabaseSti() { // Henter filbanen til databasen databaseSti = QFileDialog::getOpenFileName(); // Sender signal om at filbanen er satt emit fileOpened(); }
void CXIniFileEditor::onOpenFile() { if (mIniFileView->currentIndex().isValid()) emit fileOpened(mIniFileView->currentIndex()); // onOpenFile(mModel->filePath(mIniFileView->currentIndex())); }
void OpenFileManager::registerFile(BaseFile* file) { // Keep the mOpenFiles list alphabetically sorted by Location. int scan; for (scan = 0; scan < mOpenFiles.length(); scan++) if (mOpenFiles[scan]->getLocation().getPath() > file->getLocation().getPath()) break; mOpenFiles.insert(scan, file); emit fileOpened(file); }
void CodeEditor::dropEvent(QDropEvent *event) { foreach (const QUrl &url, event->mimeData()->urls()) { const QString &fileName = url.toLocalFile(); if (fileName.isEmpty()) continue; emit fileOpened(fileName); } }
/* * Show the file open dialog */ void TTVideoFileInfo::onFileOpen() { QString fn = QFileDialog::getOpenFileName( this, tr("Open video file"), TTCut::lastDirPath, "Video (*.m2v *.mpv)" ); if( !fn.isEmpty() ) { QFileInfo fInfo( fn ); TTCut::lastDirPath = fInfo.absolutePath(); emit fileOpened( fn ); } }
void IScoreApplication::startWindow() { win = new MainWindow(); evf = new GlobalEventFilter(win->_view, win->_editor); // this->installEventFilter(evf); win->show(); if(!loadString.isEmpty()) { emit win->sigLoad(loadString); } connect(this, SIGNAL(fileOpened(QString)), win, SLOT(open(QString))); }
FlowCodeDocument *DocManager::openFlowCodeFile( const KURL &url, ViewArea *viewArea ) { FlowCodeDocument *document = new FlowCodeDocument( url.fileName().remove(url.directory()) ); if ( !document->openURL(url) ) { KMessageBox::sorry( 0, i18n("Could not open FlowCode file \"%1\"").arg(url.prettyURL()) ); document->deleteLater(); return 0; } handleNewDocument( document, viewArea ); emit fileOpened(url); return document; }
CircuitDocument *DocManager::openCircuitFile( const KUrl &url, ViewArea *viewArea ) { CircuitDocument *document = new CircuitDocument( url.fileName().remove(url.directory()) ); if ( !document->openURL(url) ) { KMessageBox::sorry( 0l, i18n("Could not open Circuit file \"%1\"", url.prettyUrl()) ); document->deleteLater(); return 0l; } handleNewDocument( document, viewArea ); emit fileOpened(url); return document; }
bool pcl::modeler::SceneTree::openPointCloud(const QString& filename) { QList<RenderWindowItem*> selected_render_window_items = selectedRenderWindowItems(); for (auto &selected_render_window_item : selected_render_window_items) { if(!selected_render_window_item->openPointCloud(filename)) return (false); expandItem(selected_render_window_item); } emit fileOpened(filename); return (true); }
int main(int argc, char *argv[]) { MainApplication a(argc, argv); // setup style QFile f(":/DarkBlue.css"); if (f.open(QIODevice::ReadOnly)) a.setStyleSheet(f.readAll()); a.setOrganizationName("FenNils"); a.setApplicationName( APP_NAME ); a.setApplicationVersion( APP_VERSION ); QSettings::setDefaultFormat( QSettings::IniFormat ); QStringList args = a.arguments(); // setupTranslators(a); const QString locale = QLocale::system().name(); QTranslator qtTranslator; qtTranslator.load( QStringLiteral("qt_") + locale, QLibraryInfo::location( QLibraryInfo::TranslationsPath ) ); a.installTranslator( &qtTranslator ); QTranslator translator; translator.load( QStringLiteral("xqeval_") + locale, QDir::cleanPath(QApplication::applicationDirPath() + SHARE_PATH + QStringLiteral("/translations")) ); a.installTranslator( &translator ); XQEMainWindow w; QObject::connect( &a, SIGNAL(fileOpened(QString)), &w, SLOT(loadQuery(QString)), Qt::DirectConnection ); //!@todo Need to do it right! (file associations) if ( args.count() > 1 ) { const QString queryFile( args[1].trimmed() ); if ( !queryFile.startsWith(QChar(L'-')) ) { w.loadQuery(queryFile); } } w.show(); return a.exec(); }
bool pcl::modeler::SceneTree::openPointCloud(const QString& filename) { QList<RenderWindowItem*> selected_render_window_items = selectedRenderWindowItems(); for (QList<RenderWindowItem*>::iterator selected_render_window_items_it = selected_render_window_items.begin(); selected_render_window_items_it != selected_render_window_items.end(); ++ selected_render_window_items_it) { if(!(*selected_render_window_items_it)->openPointCloud(filename)) return (false); expandItem(*selected_render_window_items_it); } emit fileOpened(filename); return (true); }
PluginTextEditor::PluginTextEditor() { ProjectManager *projectmanager = IPlatform::getInstance()->getProjectManager(); Window *window = IPlatform::getInstance()->getWindowManager()->getWindow(); QTabWidget *tabwidget = window->getTabWidget(); QTextEdit *textedit = new QTextEdit(tr("Welcome!"), tabwidget); textedit->setReadOnly(true); tabwidget->addTab(textedit, tr("Welcome")); Settings *settings = window->getSettingsDialog(); PluginPage *pluginpage = new PluginPage(settings); settings->addSettingsPage(pluginpage); connect(projectmanager, SIGNAL(fileOpened(QString)), this, SLOT(openFile(QString))); connect(projectmanager, SIGNAL(fileClosed(QString)), this, SLOT(closeFile(QString))); connect(window, SIGNAL(closeTabRequested(QString)), this, SLOT(closeFileRequest(QString))); }
bool IScoreApplication::event(QEvent *ev) { bool eaten; switch (ev->type()) { #ifdef __APPLE__ case QEvent::FileOpen: loadString = static_cast<QFileOpenEvent *>(ev)->file(); emit fileOpened(loadString); eaten = true; break; #endif default: return QApplication::event(ev); } return eaten; }
bool Editor::openFile(const QUrl &_url) { QUrl url = _url; if (maybeSave()) { if (url.isEmpty()) { url = QFileDialog::getOpenFileUrl(this, i18n("Open"), QUrl(), QString("%1 (*.turtle);;%2 (*)").arg(i18n("Turtle code files")).arg(i18n("All files")) ); } if (!url.isEmpty()) { KIO::StoredTransferJob *job = KIO::storedGet(url); if (job->exec()) { QByteArray data = job->data(); QBuffer buffer(&data); if (!buffer.open(QIODevice::ReadOnly | QIODevice::Text)) { return false; // can't happen } QTextStream in(&buffer); // check for our magic identifier QString s; s = in.readLine(); if (s != KTURTLE_MAGIC_1_0) { KMessageBox::error(this, i18n("The file you try to open is not a valid KTurtle script, or is incompatible with this version of KTurtle.\nCannot open %1", url.toDisplayString(QUrl::PreferLocalFile))); return false; } QString localizedScript = Translator::instance()->localizeScript(in.readAll()); setContent(localizedScript); setCurrentUrl(url); editor->document()->setModified(false); emit fileOpened(url); return true; } else { KMessageBox::error(this, job->errorString()); return false; } } } // statusbar "Nothing opened" return false; }
int LogFileReader::openFile(QString fileName) { closeFile(); QFileInfo fileInfo(fileName); if(fileName.isEmpty()) return 0; QString ext = fileInfo.suffix().toLower(); int availableFrames = 0; try{ if(ext == "nif") { currentFileReader = new nifVersion1FormatReader(fileName); } else if(ext == "nul") { currentFileReader = new nulVersion1FormatReader(fileName); } else { currentFileReader = new SplitStreamFileFormatReader(fileName); } } catch(exception &e) { qDebug() << "I/O Error:" << e.what(); } if(currentFileReader) { if(currentFileReader->fileGood()) { connect(currentFileReader,SIGNAL(rawImageChanged(const NUImage*)), this, SIGNAL(rawImageChanged(const NUImage*))); connect(currentFileReader,SIGNAL(cameraChanged(int)), this, SIGNAL(cameraChanged(int))); connect(currentFileReader,SIGNAL(sensorDataChanged(const float*, const float*, const float*)), this, SIGNAL(sensorDataChanged(const float*, const float*, const float*))); connect(currentFileReader,SIGNAL(sensorDataChanged( NUSensorsData*)), this, SIGNAL(sensorDataChanged( NUSensorsData*))); connect(currentFileReader,SIGNAL(LocalisationDataChanged(const Localisation*)), this, SIGNAL(LocalisationDataChanged(const Localisation*))); connect(currentFileReader,SIGNAL(frameChanged(int,int)), this, SIGNAL(frameChanged(int,int))); emit fileOpened(fileName); availableFrames = currentFileReader->numFrames(); } else {
bool QtDesignerChild::openFile( const QString& fileName, const QString& codec ) { Q_UNUSED( codec ); if ( QFile::exists( fileName ) ) { // set content QFile file( fileName ); if ( !file.open( QIODevice::ReadOnly ) ) { return false; } createNewForm(); setFilePath( fileName ); mHostWidget->formWindow()->setFileName( fileName ); mHostWidget->formWindow()->setContents( &file ); if ( mHostWidget->formWindow()->mainContainer() ) { // set clean mHostWidget->formWindow()->setDirty( false ); setWindowModified( false ); emit fileOpened(); return true; } else { setFilePath( QString::null ); mHostWidget->formWindow()->setFileName( QString::null ); } } return false; }
void Navigator::setFilter (QString &d) { currentDir.setNameFilter(d); updateList(); // If there is only one item, then select it automatically. if (currentDir.count() == 1) { setCurrentItem(0); QString s1; getFileSelection(s1); QFileInfo info(s1); if (info.isFile()) { emit fileOpened(s1); selectedFlag = TRUE; } } else { emit noSelection(); selectedFlag = FALSE; } }
/* ///////////////////////////////////////////////////////////////////////////// * 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))); }
void EditorBase::load() { setModified(false); emit fileOpened(m_filePath); }