void ProjectSession::loadDocument( ) { while ( !_docDataList.isEmpty() ) { DocumentData & dd = _docDataList.first(); if ( dd.type == "Source" ) { PartController::getInstance()->setEncoding( dd.encoding ); PartController::getInstance()->editDocumentInternal( dd.url, dd.line, -1, dd.activate ); } else if ( dd.type == "Documentation" ) { // FIXME needs to be deferred if !activate ? PartController::getInstance()->showDocument( dd.url, true ); } else { // FIXME needs to be deferred if !activate ? PartController::getInstance()->editDocument( dd.url ); } _docDataList.pop_front(); loadDocument(); //QTimer::singleShot( 0, this, SLOT(loadDocument()) ); } }
/** Get the xml file and load it * * \return \c true if no error occured * */ bool RainbruRPG::Network::Ident::xmlAccountList::refresh(){ bool ret; GlobalURI gu; filename=gu.getXmlAdress("players.xml"); bool success= CurlFileToXml::perform(); if (success){ loadDocument(this); ret=true; } else{ long resp=CurlFileToXml::getServerResponse(); GTS_LIT(str); // TRANSLATORS: The parameter is a numerical error code. sprintf(str, _("An error occured while getting xmlAccountList. " "Server response was : %d"), resp); LOGE(str); correctlyLoaded=false; ret=false; } return ret; }
bool ReaderViewNative::openRecentBook() { CRLog::debug("ReaderViewNative::openRecentBook()"); int index = 0; if ( _docview->isDocumentOpened() ) { CRLog::debug("ReaderViewNative::openRecentBook() : saving previous document state"); _docview->swapToCache(); _docview->getDocument()->updateMap(); _docview->savePosition(); closeBook(); index = 1; } LVPtrVector<CRFileHistRecord> & files = _docview->getHistory()->getRecords(); CRLog::info("ReaderViewNative::openRecentBook() : %d files found in history, startIndex=%d", files.length(), index); if ( index < files.length() ) { CRFileHistRecord * file = files.get( index ); lString16 fn = file->getFilePathName(); CRLog::info("ReaderViewNative::openRecentBook() : checking file %s", LCSTR(fn)); // TODO: check error if ( LVFileExists(fn) ) { return loadDocument( fn ); } else { CRLog::error("file %s doesn't exist", LCSTR(fn)); return false; } //_docview->swapToCache(); } else { CRLog::info("ReaderViewNative::openRecentBook() : no recent book found in history"); } return false; }
QgsExternalResourceWidget::QgsExternalResourceWidget( QWidget *parent ) : QWidget( parent ) , mFileWidgetVisible( true ) , mDocumentViewerContent( NoContent ) , mDocumentViewerHeight( 0 ) , mDocumentViewerWidth( 0 ) , mRelativeStorage( QgsFileWidget::Absolute ) { setBackgroundRole( QPalette::Window ); setAutoFillBackground( true ); QGridLayout* layout = new QGridLayout(); layout->setMargin( 0 ); mFileWidget = new QgsFileWidget( this ); layout->addWidget( mFileWidget, 0, 0 ); mFileWidget->setVisible( mFileWidgetVisible ); mPixmapLabel = new QgsPixmapLabel( this ); layout->addWidget( mPixmapLabel, 1, 0 ); #ifdef WITH_QTWEBKIT mWebView = new QWebView( this ); layout->addWidget( mWebView, 2, 0 ); #endif updateDocumentViewer(); setLayout( layout ); connect( mFileWidget, SIGNAL( fileChanged( QString ) ), this, SLOT( loadDocument( QString ) ) ); }
void PdfViewer::slotReload() { double cur_pos = m_pdfView->pageNumberWithPosition(); //std::cout << "POSITION WAS " << cur_pos << std::endl ; QString filename = m_file; closeDocument(); loadDocument(filename); // using DocumentObserver::KeepPosition as second argument doesn't work, but since closeDocument() saves the current position, this is not a problem m_pdfView->amkhlvJumpToPosition(cur_pos); }
void PdfViewer::slotOpenFile() { #ifndef QT_NO_FILEDIALOG const QString fileName = QFileDialog::getOpenFileName(this, tr("Open PDF Document"), m_file, tr("PDF Documents (*.pdf)")); if (fileName.isEmpty()) { return; } loadDocument(fileName); #endif // QT_NO_FILEDIALOG }
//--------------------------------------------------------------------------- bool ProjectSession::restoreFromFile( const QString & sessionFileName, const QValueList< KDevPlugin * > plugins ) { bool bFileOpenOK = true; QFile f(sessionFileName); if ( f.open(IO_ReadOnly) ) { // file opened successfully bool ok = domdoc.setContent( &f); f.close(); if (!ok) { KMessageBox::sorry(0L, i18n("The file %1 does not contain valid XML.\n" "The loading of the session failed.").arg(sessionFileName)); initXMLTree(); // because it was now broken after failed setContent() return false; } } else { bFileOpenOK = false; } // Check for proper document type. if (domdoc.doctype().name() != "KDevPrjSession") { KMessageBox::sorry(0L, i18n("The file %1 does not contain a valid KDevelop project session ('KDevPrjSession').\n").arg(sessionFileName) + i18n("The document type seems to be: '%1'.").arg(domdoc.doctype().name())); return false; } QDomElement session = domdoc.documentElement(); // read the information about the mainframe widget if (bFileOpenOK) { recreateDocs(session); } // now also let the plugins load their session stuff QDomElement pluginListEl = session.namedItem("pluginList").toElement(); QValueList<KDevPlugin*>::ConstIterator it = plugins.begin(); while( it != plugins.end() ) { KDevPlugin* pPlugin = (*it); QString pluginName = pPlugin->instance()->instanceName(); QDomElement pluginEl = pluginListEl.namedItem(pluginName).toElement(); if (!pluginEl.isNull()) { // now plugin, load what you find! pPlugin->restorePartialProjectSession(&pluginEl); } ++it; } QTimer::singleShot( 0, this, SLOT(loadDocument()) ); return true; }
/** The default constructor * */ RainbruRPG::Options::xmlLanguage::xmlLanguage() :doc(NULL), root(NULL), lastUsed(""), defaultLang(""), mNbMessages(0) { LOGI("xmlLanguage creation"); Network::GlobalURI gu; this->filename=gu.getUserDirFile("languages.xml"); refresh(); languageList=new tLanguageList(); if (loadDocument()){ loadLastUsed(); loadDefault(); loadNbMessages(); GTS_LIT(str1); // TRANSLATORS: The parameter is a language name. sprintf(str1, _("Last used language found : '%s'"), lastUsed); LOGI(str1); GTS_LIT(str2); // TRANSLATORS: The parameter is a language name. sprintf(str2, _("Default language found : '%s'"), defaultLang); LOGI(str2); treatAllLanguages(); GTS_TIN(str3); // TRANSLATORS: The parameter is an integer (the list size). sprintf(str3, _("Language list size is '%d'"), languageList->size()); LOGI(str3); } else{ LOGE(_("Cannot load languages.xml")); GTS_LIT(str4); // TRANSLATORS: The parameter is an absolute file name (i.e. with paths). sprintf(str4,_("languages.xml absolute filename : '%s'"),filename.c_str()); LOGE(str4) GTS_BIG(str5); // TRANSLATORS: The parameter is an error string sprintf(str5,_("TinyXml error description '%s'"),doc->ErrorDesc()); LOGE(str5) } }
/*! */ bool SceneDocument::loadDocument(const QUrl& file_url, QVariant& node, QString& error_message) noexcept { QJsonObject object; const auto file_path = toFilePath(file_url); const bool result = loadDocument(file_path, object, error_message); if (result) node = toVariant(object); return result; }
void XMLWriter::setRevision(int revision) { if(!loadDocument()) return; if(m_document.elementsByTagName("TrollingObjects").count() == 1) { QDomElement element = m_document.elementsByTagName("TrollingObjects").at(0).toElement(); element.setAttribute("revision", revision); saveDocument(); } }
bool XMLWriter::write(TrollingObject* p_object) { if(!loadDocument()) return false; QDomElement trollingObject; int id = p_object->getId(); if(!getTrollingObjectElement(trollingObject, id)) return false; p_object->setId(id); clearNodeContents(trollingObject); trollingObject.setAttribute("type", p_object->getType()); p_object->setSaved(); QHashIterator<QString, QString> iter(p_object->getProperties()); while( iter.hasNext() ) { iter.next(); if(iter.value().isEmpty()) continue; QDomElement property = m_document.createElement(iter.key()); QDomText text = m_document.createTextNode(iter.value()); property.appendChild(text); trollingObject.appendChild(property); } QList< QHash<QString, QString> > list = p_object->getList(); QDomElement listelement = m_document.createElement("PropertyList"); for(int loop=0; loop < list.size(); loop++) { QDomElement listItem = m_document.createElement("PropertyListItem"); QHash<QString, QString> subProperty = list.at(loop); QHashIterator<QString, QString> iter(subProperty); while( iter.hasNext() ) { iter.next(); if(iter.value().isEmpty()) continue; QDomElement property = m_document.createElement(iter.key()); QDomText text = m_document.createTextNode(iter.value()); property.appendChild(text); listItem.appendChild(property); } listelement.appendChild(listItem); } trollingObject.appendChild(listelement); return saveDocument(); }
bool JSON::load(Variant & root, const std::string & filename) { auto tokenizer = createJSONTokenizer(); // Load file if (!tokenizer.loadDocument(filename)) { return false; } // Begin parsing return readDocument(root, tokenizer); }
int XMLWriter::getRevision() { int retval = 0; if(!loadDocument()) return retval; if(m_document.elementsByTagName("TrollingObjects").count() == 1) { QDomElement element = m_document.elementsByTagName("TrollingObjects").at(0).toElement(); retval = element.attribute("revision").toInt(); } return retval; }
void V3DocViewWin::openRecentBook( int index ) { _docview->savePosition(); LVPtrVector<CRFileHistRecord> & files = _docview->getHistory()->getRecords(); if ( index >= 1 && index < files.length() ) { CRFileHistRecord * file = files.get( index ); lString16 fn = file->getFilePathName(); // TODO: check error if ( LVFileExists(fn) ) { //showWaitIcon(); loadDocument( fn ); } //_docview->swapToCache(); } }
/** * Tries to load \a doc from config file, or if that fails, from a back up. */ bool AtomicXmlFile::loadDocument(QDomDocument* doc) const { Q_ASSERT(doc); QStringList fileNames; fileNames << tempFileName() << fileName_ << backupFileName(); foreach(QString fileName, fileNames) if (loadDocument(doc, fileName)) return true; return false; }
void DocumentSourceSort::populate() { if (_mergingPresorted) { typedef DocumentSourceMergeCursors DSCursors; if (DSCursors* castedSource = dynamic_cast<DSCursors*>(pSource)) { populateFromCursors(castedSource->getCursors()); } else { msgasserted(17196, "can only mergePresorted from MergeCursors"); } } else { while (boost::optional<Document> next = pSource->getNext()) { loadDocument(std::move(*next)); } loadingDone(); } }
Document* DocumentFormat::loadDocument(IOAdapterFactory* iof, const GUrl& url, const QVariantMap& hints, U2OpStatus& os) { QScopedPointer<IOAdapter> io(iof->createIOAdapter()); if (!io->open(url, IOAdapterMode_Read)) { os.setError(L10N::errorOpeningFileRead(url)); return NULL; } Document* res = NULL; U2DbiRef dbiRef = fetchDbiRef(hints, os); CHECK_OP(os, NULL); if (dbiRef.isValid()) { DbiConnection con(dbiRef, os); CHECK_OP(os, NULL); Q_UNUSED(con); res = loadDocument(io.data(), dbiRef, hints, os); CHECK_OP(os, NULL); } else { res = loadDocument(io.data(), U2DbiRef(), hints, os); } return res; }
/* Slots */ void MainWindow::openDocumentAction() { QString selectedFileName = QFileDialog::getOpenFileName ( this, tr("Select file for open"), QDir::currentPath(), tr("XML files (*.xml);;All files (*.*)") ); if ( selectedFileName.isEmpty() ) return; if ( !QFile::exists( selectedFileName ) ) { QMessageBox::critical( this, tr("Input/output error"), tr("File %1 doesn't exist!").arg( selectedFileName )); return; } if ( isEmptyDocument() ) loadDocument ( selectedFileName ); else openDocumentInNewWindow ( selectedFileName ); }
bool XMLWriter::remove(TrollingObject* p_object) { if(!loadDocument()) return false; QDomElement trollingObject; int id = p_object->getId(); if(!getTrollingObjectElement(trollingObject, id)) return false; clearNodeContents(trollingObject); trollingObject.parentNode().removeChild(trollingObject); return saveDocument(); }
void fileOpen() { wchar_t temp[_MAX_FNAME + 1]; temp[0] = L'\0'; // clear string OPENFILENAMEW ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = temp; ofn.nMaxFile = _MAX_FNAME; ofn.lpstrDefExt = L"rocket"; ofn.lpstrFilter = L"ROCKET File (*.rocket)\0*.rocket\0All Files (*.*)\0*.*\0\0"; ofn.Flags = OFN_SHOWHELP | OFN_FILEMUSTEXIST; if (GetOpenFileNameW(&ofn)) { loadDocument(temp); } }
bool FileBasedDocument::loadFrom (const File& newFile, const bool showMessageOnFailure) { MouseCursor::showWaitCursor(); const File oldFile (documentFile); documentFile = newFile; String error; if (newFile.existsAsFile()) { error = loadDocument (newFile); if (error.isEmpty()) { setChangedFlag (false); MouseCursor::hideWaitCursor(); setLastDocumentOpened (newFile); return true; } } else { error = "The file doesn't exist"; } documentFile = oldFile; MouseCursor::hideWaitCursor(); if (showMessageOnFailure) { AlertWindow::showMessageBox (AlertWindow::WarningIcon, TRANS("Failed to open file..."), TRANS("There was an error while trying to load the file:\n\n") + newFile.getFullPathName() + "\n\n" + error); } return false; }
QList<int> XMLWriter::getIds(const QString& p_type) { QList<int> ids; if(!loadDocument()) return ids; QDomNodeList nodelist = m_document.elementsByTagName("TrollingObject"); for(int loop=0; loop < nodelist.size(); loop++) { QDomNode trollingnode = nodelist.at(loop); if(trollingnode.isElement()) { QDomElement element = trollingnode.toElement(); if(p_type.isNull() || element.attribute("type") == p_type) { ids.append(element.attribute("id").toInt()); } } } return ids; }
void XmlPropertyReader::parseGameObjectFile(Ogre::DataStreamPtr &stream, const Ogre::String &groupName) { initializeXml(); XERCES_CPP_NAMESPACE::DOMDocument* doc = loadDocument(stream); DOMNodeList* godefsXml = doc->getDocumentElement()->getElementsByTagName(AutoXMLCh("gameobjectclass").data()); for (unsigned int idx = 0; idx < godefsXml->getLength(); idx++) { PropertyRecordPtr ps(new PropertyRecord()); DOMElement* curNode = static_cast<DOMElement*>(godefsXml->item(idx)); const DOMNamedNodeMap* godefAttrs = curNode->getAttributes(); for (XMLSize_t attrIdx = 0; attrIdx < godefAttrs->getLength(); attrIdx++) { PropertyEntry entry = processProperty(static_cast<DOMAttr*>(godefAttrs->item(attrIdx))); if (entry.first != "") { ps->setProperty(entry.first, entry.second); } } DOMNodeList* godefChildren = curNode->getChildNodes(); for (XMLSize_t childIdx = 0; childIdx < godefChildren->getLength(); childIdx++) { DOMNode* curChild = godefChildren->item(childIdx); if (curChild->getNodeType() == DOMNode::ELEMENT_NODE) { PropertyEntry entry = processProperty(static_cast<DOMElement*>(curChild)); if (entry.first != "") { ps->setProperty(entry.first, entry.second); } } } mPropertyRecords.push_back(ps); } shutdownXml(); }
Scene* SceneLoader::loadScene(Ogre::DataStreamPtr &data) { TiXmlDocument* doc = loadDocument(data); TiXmlElement* root = doc->RootElement(); Scene* scene = new Scene(getAttributeValueAsString(root, "name")); for (TiXmlNode* cur = root->FirstChild(); cur; cur = cur->NextSibling()) { if (cur->Type() == TiXmlNode::ELEMENT) { TiXmlElement* elem = cur->ToElement(); if (hasNodeName(elem, "map")) { scene->addMap(getAttributeValueAsStdString(elem, "file")); } } } delete doc; return scene; }
PhysicsRagDoll::PhysicsRagDoll(const Ogre::String& ragdollResource, Actor* actor) : mRootBone(NULL), mNode(NULL), mWorld(NULL), mMesh(NULL), mSkeleton(NULL) { mRootBone = NULL; mNode = actor->_getSceneNode(); mWorld = PhysicsManager::getSingleton()._getNewtonWorld(); if (!actor->getControlledObject()->isMeshObject()) Throw(IllegalArgumentException, "PhysicsRagDoll::PhysicsRagDoll needs a Mesh-Actor as argument!"); MeshObject* meshObj = static_cast<MeshObject*>(actor->getControlledObject()); // stop all animations meshObj->stopAllAnimations(); // get the skeleton. mSkeleton = meshObj->getEntity()->getSkeleton(); // get the mesh. mMesh = meshObj->getEntity()->getMesh(); LOG_MESSAGE(Logger::CORE, "Loading ragdoll '" + ragdollResource + "'"); TiXmlDocument* doc = loadDocument(ragdollResource); if (!doc) { LOG_ERROR(Logger::CORE, "Ragdoll resource '" + ragdollResource + "' not found"); } else { TiXmlElement* dataDocumentContent = doc->RootElement(); mRootBone =_addAllBones(NULL, getChildNamed(dataDocumentContent, "Bone"), actor); } }
/*! Constructs the main application window. Initialize all components and connect them. */ MPWindow::MPWindow(QWidget *parent) : QMainWindow(parent), m_view(0), m_document(0), m_streetlayer(0), m_infosdock(0), m_coordsLabel(0), m_paintTimeLabel(0), m_meterPerPixelLabel(0), m_imagesProgress(0), m_dataProgress(0), m_wsProgress(0), ui(new Ui::MPWindow) { ui->setupUi(this); setWindowTitle(windowTitle() + QString(" - %1").arg(VERSION)); m_streetlayer = new ImageMapLayer(""); m_streetlayer->setMapAdapter(TMS_ADAPTER_UUID, "OSM Mapnik"); m_streetlayer->setVisible(true); initUIComponents(); // Allow slots connecting between threads with type CoordBox qRegisterMetaType<CoordBox>(); // Restore settings loadSettings(); // Abstract document loadDocument(new MPDocument()); // Default interaction m_view->launch(m_view->defaultInteraction()); }
//============================================================================== Result FileBasedDocument::loadFrom (const File& newFile, const bool showMessageOnFailure) { MouseCursor::showWaitCursor(); const File oldFile (documentFile); documentFile = newFile; Result result (Result::fail (TRANS("The file doesn't exist"))); if (newFile.existsAsFile()) { result = loadDocument (newFile); if (result.wasOk()) { setChangedFlag (false); MouseCursor::hideWaitCursor(); setLastDocumentOpened (newFile); return result; } } documentFile = oldFile; MouseCursor::hideWaitCursor(); if (showMessageOnFailure) AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, TRANS("Failed to open file..."), TRANS("There was an error while trying to load the file: FLNM") .replace ("FLNM", "\n" + newFile.getFullPathName()) + "\n\n" + result.getErrorMessage()); return result; }
void MenuSystem::initialize() { auto rocketBackend = static_cast<LibRocketBackendSystem*>( m_world->getSystem(SystemType::LibRocketBackendSystem)); auto rocketEventManager = static_cast<LibRocketEventManagerSystem*>( m_world->getSystem(SystemType::LibRocketEventManagerSystem)); auto connectToServerSys = static_cast<ClientConnectToServerSystem*>( m_world->getSystem(SystemType::ClientConnectoToServerSystem)); rocketBackend->loadDocument(GUI_MENU_PATH.c_str(),"main_menu"); rocketBackend->loadDocument(GUI_MENU_PATH.c_str(),"play"); m_joinIdx = rocketBackend->loadDocument(GUI_MENU_PATH.c_str(),"join"); m_hostIdx = rocketBackend->loadDocument(GUI_MENU_PATH.c_str(),"host"); rocketBackend->loadDocument(GUI_MENU_PATH.c_str(),"options"); rocketBackend->loadDocument(GUI_MENU_PATH.c_str(),"credits"); m_lobbyDocIdx = rocketBackend->loadDocument(GUI_MENU_PATH.c_str(),"lobby"); m_disconnectPopupIdx = rocketBackend->loadDocument(GUI_MENU_PATH.c_str(), "connection_lost"); m_loadingWindowIdx = rocketBackend->loadDocument(GUI_MENU_PATH.c_str(),"loading"); rocketEventManager->loadWindow("main_menu"); }
static LRESULT CALLBACK mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CREATE: { trackViewWin = trackView->create(hInst, hwnd); InitCommonControls(); statusBarWin = createStatusBar(hInst, hwnd); if (ERROR_SUCCESS != RegOpenKey(HKEY_CURRENT_USER, keyName, ®ConfigKey)) { if (ERROR_SUCCESS != RegCreateKey(HKEY_CURRENT_USER, keyName, ®ConfigKey)) die("failed to create registry key"); } /* Recent Files menu */ mruFileList = RecentFiles(findSubMenuContaining(GetMenu(hwnd), ID_RECENTFILES_NORECENTFILES)); mruFileList.load(regConfigKey); } break; case WM_CLOSE: attemptQuit(); break; case WM_DESTROY: mruFileList.save(regConfigKey); RegCloseKey(regConfigKey); regConfigKey = NULL; PostQuitMessage(0); break; case WM_SIZE: { int width = LOWORD(lParam); int height = HIWORD(lParam); RECT statusBarRect; GetClientRect(statusBarWin, &statusBarRect); int statusBarHeight = statusBarRect.bottom - statusBarRect.top; MoveWindow(trackViewWin, 0, 0, width, height - statusBarHeight, TRUE); MoveWindow(statusBarWin, 0, height - statusBarHeight, width, statusBarHeight, TRUE); } break; case WM_SETFOCUS: SetFocus(trackViewWin); // needed to forward keyboard input break; case WM_SETROWS: trackView->setRows(int(lParam)); break; case WM_BIASSELECTION: trackView->editBiasValue(float(lParam)); break; case WM_COMMAND: switch (LOWORD(wParam)) { case ID_FILE_NEW: fileNew(); InvalidateRect(trackViewWin, NULL, FALSE); break; case ID_FILE_OPEN: fileOpen(); break; case ID_FILE_SAVE_AS: fileSaveAs(); break; case ID_FILE_SAVE: fileSave(); break; case ID_EDIT_SELECTALL: trackView->selectAll(); break; case ID_EDIT_SELECTTRACK: trackView->selectTrack(trackView->getEditTrack()); break; case ID_EDIT_SELECTROW: trackView->selectRow(trackView->getEditRow()); break; case ID_FILE_REMOTEEXPORT: document.sendSaveCommand(); break; case ID_RECENTFILES_FILE1: case ID_RECENTFILES_FILE2: case ID_RECENTFILES_FILE3: case ID_RECENTFILES_FILE4: case ID_RECENTFILES_FILE5: { int index = LOWORD(wParam) - ID_RECENTFILES_FILE1; std::wstring fileName; if (mruFileList.getEntry(index, fileName)) { loadDocument(fileName); } } break; case ID_FILE_EXIT: attemptQuit(); break; case ID_EDIT_UNDO: SendMessage(trackViewWin, WM_UNDO, 0, 0); break; case ID_EDIT_REDO: SendMessage(trackViewWin, WM_REDO, 0, 0); break; case ID_EDIT_COPY: SendMessage(trackViewWin, WM_COPY, 0, 0); break; case ID_EDIT_CUT: SendMessage(trackViewWin, WM_CUT, 0, 0); break; case ID_EDIT_PASTE: SendMessage(trackViewWin, WM_PASTE, 0, 0); break; case ID_EDIT_SETROWS: { int rows = int(trackView->getRows()); INT_PTR result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SETROWS), hwnd, (DLGPROC)setRowsDialogProc, (LPARAM)&rows); if (FAILED(result)) error("unable to create dialog box"); } break; case ID_EDIT_BIAS: { int initialBias = 0; INT_PTR result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_BIASSELECTION), hwnd, (DLGPROC)biasSelectionDialogProc, (LPARAM)&initialBias); if (FAILED(result)) error("unable to create dialog box"); } break; } break; case WM_ROWCHANGED: { char temp[256]; snprintf(temp, 256, "%d", lParam ); SendMessage(statusBarWin, SB_SETTEXT, 1, (LPARAM)temp); } break; case WM_TRACKCHANGED: { char temp[256]; snprintf(temp, 256, "%d", lParam); SendMessage(statusBarWin, SB_SETTEXT, 2, (LPARAM)temp); } break; case WM_CURRVALDIRTY: { char temp[256]; if (document.num_tracks > 0) { const sync_track *t = document.tracks[document.getTrackIndexFromPos(trackView->getEditTrack())]; int row = trackView->getEditRow(); int idx = key_idx_floor(t, row); snprintf(temp, 256, "%f", sync_get_val(t, row)); const char *str = "---"; if (idx >= 0) { switch (t->keys[idx].type) { case KEY_STEP: str = "step"; break; case KEY_LINEAR: str = "linear"; break; case KEY_SMOOTH: str = "smooth"; break; case KEY_RAMP: str = "ramp"; break; } } SendMessage(statusBarWin, SB_SETTEXT, 4, (LPARAM)str); } else snprintf(temp, 256, "---"); SendMessage(statusBarWin, SB_SETTEXT, 3, (LPARAM)temp); } break; default: return DefWindowProcW(hwnd, msg, wParam, lParam); } return 0; }
bool XMLWriter::loadAll(const QString& p_type, TrollingObjectFactory* p_factory, int id /*=-1*/) { if(!loadDocument()) return false; if(m_document.elementsByTagName("TrollingObjects").count() != 1) { qDebug() << "Invalid number of TrollingObjects roots"; return false; } QDomNodeList trollingobjectsnodelist = m_document.elementsByTagName("TrollingObject"); for(int loop0=0; loop0 < trollingobjectsnodelist.size(); loop0++) { if(trollingobjectsnodelist.at(loop0).isElement()) { QDomElement trollingobjectelement = trollingobjectsnodelist.at(loop0).toElement(); QDomNodeList propertiesnodes = trollingobjectelement.childNodes(); QHash<QString, QString> properties; if(trollingobjectelement.attribute("type") != p_type) { qDebug() << "Skipping non expected type" << p_type; continue; } if(id != -1) { int currId = trollingobjectelement.attribute("id").toInt(); if(id != currId) continue; } TrollingObject* object = p_factory->createTrollingObject(p_type); object->setId(trollingobjectelement.attribute("id").toInt()); for(int loop=0; loop < propertiesnodes.size(); loop++) { QDomNode node = propertiesnodes.at(loop); if(node.isElement() && node.toElement().tagName() != "PropertyList") { QDomElement element = node.toElement(); properties[element.tagName()] = element.text(); //qDebug() << "read" << element.tagName(); } else if(node.isElement() && node.hasChildNodes() && node.toElement().tagName() == "PropertyList") { QList< QHash<QString, QString> > list; QDomNodeList propertylist = node.toElement().elementsByTagName("PropertyListItem"); for(int loop2=0; loop2 < propertylist.size(); loop2++) { QHash<QString, QString> propertylistitem; QDomNodeList listitemlist = propertylist.at(loop2).childNodes(); for(int loop3=0; loop3 < listitemlist.size(); loop3++) { QDomNode subnode = listitemlist.at(loop3); if(subnode.isElement()) { QDomElement subelement = subnode.toElement(); propertylistitem[subelement.tagName()] = subelement.text(); //qDebug() << "subread" << subelement.tagName(); } } list.push_back(propertylistitem); } object->storeList(list); } } object->storeProperties(properties); } } return true; }