MainWindow::MainWindow() { // set xml of the main window setXML("mainwindow.rc"); setupGUI(); }
void KXMLGUIClient::setXMLFile( const QString& _file, bool merge, bool setXMLDoc ) { // store our xml file name if ( !_file.isNull() ) { d->m_xmlFile = _file; actionCollection()->setXMLFile( _file ); } if ( !setXMLDoc ) return; QString file = _file; if ( QDir::isRelativePath(file) ) { QString doc; QString filter = QString::fromLatin1( instance()->instanceName() + '/' ) + _file; QStringList allFiles = instance()->dirs()->findAllResources( "data", filter ) + instance()->dirs()->findAllResources( "data", _file ); file = findMostRecentXMLFile( allFiles, doc ); if ( file.isEmpty() ) { // this might or might not be an error. for the time being, // let's treat this as if it isn't a problem and the user just // wants the global standards file // however if a non-empty file gets passed and we can't find it we might // inform the developer using some debug output if ( !_file.isEmpty() ) kdWarning() << "KXMLGUIClient::setXMLFile: cannot find .rc file " << _file << endl; setXML( QString::null, true ); return; } else if ( !doc.isEmpty() ) { setXML( doc, merge ); return; } } QString xml = KXMLGUIFactory::readConfigFile( file ); setXML( xml, merge ); }
Impl(std::shared_ptr<Loader>& loader, const std::string& xml) : outer(outer), loader(loader) { // identifiers = getIdentifiers(); setXML(xml); }
K3bAudioView::K3bAudioView( K3bAudioDoc* pDoc, QWidget* parent, const char *name ) : K3bView( pDoc, parent, name ) { m_doc = pDoc; m_songlist = new K3bAudioTrackView( m_doc, this ); setMainWidget( m_songlist ); fillStatusDisplay()->showTime(); // add button for the audio conversion KAction* conversionAction = new KAction( i18n("Convert Tracks"), "redo", 0, this, SLOT(slotAudioConversion()), actionCollection(), "project_audio_convert" ); conversionAction->setToolTip( i18n("Convert audio tracks to other audio formats." ) ); toolBox()->addButton( conversionAction ); toolBox()->addSeparator(); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_PLAY ) ); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_PAUSE ) ); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_STOP ) ); toolBox()->addSpacing(); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_PREV ) ); toolBox()->addButton( m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_NEXT ) ); toolBox()->addSpacing(); toolBox()->addWidgetAction( static_cast<KWidgetAction*>(m_songlist->player()->action( K3bAudioTrackPlayer::ACTION_SEEK )) ); toolBox()->addSeparator(); #ifdef HAVE_MUSICBRAINZ kdDebug() << "(K3bAudioView) m_songlist->actionCollection()->actions().count() " << m_songlist->actionCollection()->actions().count() << endl; toolBox()->addButton( m_songlist->actionCollection()->action( "project_audio_musicbrainz" ) ); toolBox()->addSeparator(); #endif addPluginButtons( K3bProjectPlugin::AUDIO_CD ); toolBox()->addStretch(); // this is just for testing (or not?) // most likely every project type will have it's rc file in the future // we only add the additional actions since K3bView already added the default actions setXML( "<!DOCTYPE kpartgui SYSTEM \"kpartgui.dtd\">" "<kpartgui name=\"k3bproject\" version=\"1\">" "<MenuBar>" " <Menu name=\"project\"><text>&Project</text>" " <Action name=\"project_audio_convert\"/>" #ifdef HAVE_MUSICBRAINZ " <Action name=\"project_audio_musicbrainz\"/>" #endif " </Menu>" "</MenuBar>" "</kpartgui>", true ); }
int File::loadXML(const char *filename, Context *ctx) { xmlDocPtr doc = NULL; xmlNodePtr root; int length; doc = xmlParseFile(filename); if (!doc) { fprintf(stderr, "could not parse XML\n"); return false; } root = doc->xmlRootNode; length = setXML(root, ctx); xmlFreeDoc(doc); return length; fail: if (doc) { xmlFreeDoc(doc); } return 0; }
K3bDataView::K3bDataView(K3bDataDoc* doc, QWidget *parent, const char *name ) : K3bView(doc, parent,name) { m_doc = doc; // --- setup GUI --------------------------------------------------- QSplitter* mainSplitter = new QSplitter( this ); m_dataDirTree = new K3bDataDirTreeView( this, doc, mainSplitter ); m_dataFileView = new K3bDataFileView( this, m_dataDirTree, doc, mainSplitter ); m_dataDirTree->setFileView( m_dataFileView ); setMainWidget( mainSplitter ); connect( m_dataFileView, SIGNAL(dirSelected(K3bDirItem*)), m_dataDirTree, SLOT(setCurrentDir(K3bDirItem*)) ); connect( m_doc, SIGNAL(changed()), this, SLOT(slotDocChanged()) ); m_dataDirTree->checkForNewItems(); m_dataFileView->checkForNewItems(); // the data actions KAction* actionImportSession = new KAction(i18n("&Import Session..."), "gear", 0, this, SLOT(importSession()), actionCollection(), "project_data_import_session" ); KAction* actionClearSession = new KAction(i18n("&Clear Imported Session"), "gear", 0, this, SLOT(clearImportedSession()), actionCollection(), "project_data_clear_imported_session" ); KAction* actionEditBootImages = new KAction(i18n("&Edit Boot Images..."), "cdtrack", 0, this, SLOT(editBootImages()), actionCollection(), "project_data_edit_boot_images" ); actionImportSession->setToolTip( i18n("Import a previously burned session into the current project") ); actionClearSession->setToolTip( i18n("Remove the imported items from a previous session") ); actionEditBootImages->setToolTip( i18n("Modify the bootable settings of the current project") ); toolBox()->addButton( actionImportSession ); toolBox()->addButton( actionClearSession ); toolBox()->addButton( actionEditBootImages ); toolBox()->addSeparator(); toolBox()->addButton( m_dataFileView->actionCollection()->action("parent_dir") ); toolBox()->addSeparator(); addPluginButtons( K3bProjectPlugin::DATA_CD ); toolBox()->addStretch(); m_volumeIDEdit = new QLineEdit( doc->isoOptions().volumeID(), toolBox() ); m_volumeIDEdit->setValidator( new K3bLatin1Validator( m_volumeIDEdit ) ); toolBox()->addLabel( i18n("Volume Name:") ); toolBox()->addSpacing(); toolBox()->addWidget( m_volumeIDEdit ); connect( m_volumeIDEdit, SIGNAL(textChanged(const QString&)), m_doc, SLOT(setVolumeID(const QString&)) ); // this is just for testing (or not?) // most likely every project type will have it's rc file in the future // we only add the additional actions since K3bView already added the default actions setXML( "<!DOCTYPE kpartgui SYSTEM \"kpartgui.dtd\">" "<kpartgui name=\"k3bproject\" version=\"1\">" "<MenuBar>" " <Menu name=\"project\"><text>&Project</text>" " <Action name=\"project_data_import_session\"/>" " <Action name=\"project_data_clear_imported_session\"/>" " <Action name=\"project_data_edit_boot_images\"/>" " </Menu>" "</MenuBar>" "</kpartgui>", true ); }