Beispiel #1
0
void SVGDocument::updatePan(const FloatPoint& pos) const
{
    if (rootElement()) {
        rootElement()->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), pos.y() - m_translate.y()));
        if (renderer())
            renderer()->repaint();
    }
}
Beispiel #2
0
bool SVGDocument::zoomAndPanEnabled() const
{
    if (rootElement()) {
        if (rootElement()->useCurrentView()) {
            if (rootElement()->currentView())
                return rootElement()->currentView()->zoomAndPan() == SVGZoomAndPanMagnify;
        } else
            return rootElement()->zoomAndPan() == SVGZoomAndPanMagnify;
    }

    return false;
}
Beispiel #3
0
bool SVGDocument::zoomAndPanEnabled() const
{
    if (rootElement()) {
        if (rootElement()->useCurrentView()) {
            if (rootElement()->currentView())
                return rootElement()->currentView()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY;
        } else
            return rootElement()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY;
    }

    return false;
}
Beispiel #4
0
void SVGDocument::dispatchScrollEvent()
{
    ExceptionCode ec = 0;
    RefPtr<Event> event = createEvent("SVGEvents", ec);
    event->initEvent(eventNames().scrollEvent, true, false);
    rootElement()->dispatchEvent(event.release(), ec);
}
Beispiel #5
0
void CAppRegistry::Save()
{
  CSingleLock lock(m_lock);

  TiXmlElement rootElement("registry");
  CStdString key;
  for (RegistryDataIterator keyIter = m_data.begin(); keyIter != m_data.end(); keyIter++)
  {
    key = keyIter->first;
    RegistryValue& values = keyIter->second;
    
    for (size_t i = 0; i < values.size(); i++)
    {
      TiXmlElement valueElement("value");
      valueElement.SetAttribute("id", key.c_str());
      
      TiXmlText valueText(values[i]);
      valueElement.InsertEndChild(valueText);
      
      rootElement.InsertEndChild(valueElement);
    }
  }

  TiXmlDocument xmlDoc;
  xmlDoc.InsertEndChild(rootElement);

  ::CreateDirectory(m_dir, NULL);
  
  xmlDoc.SaveFile(m_fileName);
}
Beispiel #6
0
void SVGDocument::dispatchZoomEvent(float prevScale, float newScale)
{
    RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", IGNORE_EXCEPTION));
    event->initEvent(eventNames().zoomEvent, true, false);
    event->setPreviousScale(prevScale);
    event->setNewScale(newScale);
    rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION);
}
Beispiel #7
0
bool CSettingsBase::SaveValuesToXml(CXBMCTinyXML& xml) const
{
  TiXmlElement rootElement(SETTINGS_XML_ROOT);
  TiXmlNode* xmlRoot = xml.InsertEndChild(rootElement);
  if (xmlRoot == nullptr)
    return false;

  return m_settingsManager->Save(xmlRoot);
}
Beispiel #8
0
void SVGDocument::updatePan(const FloatPoint &pos) const
{
    Q_UNUSED(pos);
    if (rootElement()) {
        /*rootElement()->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), m_translate.y() - pos.y()));
        if (renderer())
            renderer()->repaint();*/
    }
}
Beispiel #9
0
void SVGDocument::dispatchZoomEvent(float prevScale, float newScale)
{
    ExceptionCode ec = 0;
    RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", ec));
    event->initEvent(eventNames().zoomEvent, true, false);
    event->setPreviousScale(prevScale);
    event->setNewScale(newScale);
    rootElement()->dispatchEvent(event.release(), ec);
}
Beispiel #10
0
bool ModItemsTree::hasChildren ( const QModelIndex & parent ) const
{
    bool hasChildren;
    bool triedToFind;

    if(!_enabled)
        return false;

    ModItem *parentElement;

    if (parent.column() > 0)
        return false;

    if (!parent.isValid())
        parentElement = rootElement();
    else
        parentElement = static_cast<ModItem*>(parent.internalPointer());

    if(parentElement->childrenReaden())
    {
        if(_showComponents)
            return (parentElement->childCount()>0);
        else
            return (parentElement->childCount()-parentElement->compChildCount()>0);
    }
    else
    {
        triedToFind = true;
        hasChildren = false;

        QStringList children = _moomc->getClassNames(parentElement->name());
        children.removeAll(QString());
        if(!children.isEmpty())
            hasChildren = true;
        else if(parentElement->getClassRestr()==Modelica::MODEL)
        {
            if(!_showComponents)
            {
                hasChildren = false;
                triedToFind = false;
            }
            else
            {
                // look if has component children
                QStringList compNames;
                QStringList compClasses;
                _moomc->getContainedComponents(parentElement->getModClassName(),compNames,compClasses,true);
                hasChildren = (!compNames.isEmpty());
            }
        }
        if(triedToFind && !hasChildren)
            parentElement->setChildrenReaden(true); // avoid re-reading

        return hasChildren;
    }
}
void
SelectionData::updateCoveredFractionForFrame()
{
    if (isCoveredFractionDynamic())
    {
        real cfrac = _gmx_selelem_estimate_coverfrac(rootElement());
        coveredFraction_         = cfrac;
        averageCoveredFraction_ += cfrac;
    }
}
void
SelectionData::restoreOriginalPositions(const t_topology *top)
{
    if (isDynamic())
    {
        gmx_ana_pos_t &p = rawPositions_;
        gmx_ana_indexmap_update(&p.m, rootElement().v.u.g,
                                hasFlag(gmx::efSelection_DynamicMask));
        refreshMassesAndCharges(top);
    }
}
bool SVGDocumentExtensions::zoomAndPanEnabled() const
{
    if (SVGSVGElement* svg = rootElement(*m_document)) {
        if (svg->useCurrentView()) {
            if (svg->currentView())
                return svg->currentView()->zoomAndPan() == SVGZoomAndPanMagnify;
        } else {
            return svg->zoomAndPan() == SVGZoomAndPanMagnify;
        }
    }

    return false;
}
bool
SelectionData::initCoveredFraction(e_coverfrac_t type)
{
    coveredFractionType_ = type;
    if (type == CFRAC_NONE)
    {
        bDynamicCoveredFraction_ = false;
    }
    else if (!_gmx_selelem_can_estimate_cover(rootElement()))
    {
        coveredFractionType_     = CFRAC_NONE;
        bDynamicCoveredFraction_ = false;
    }
    else
    {
        bDynamicCoveredFraction_ = true;
    }
    coveredFraction_        = bDynamicCoveredFraction_ ? 0.0 : 1.0;
    averageCoveredFraction_ = coveredFraction_;
    return type == CFRAC_NONE || coveredFractionType_ != CFRAC_NONE;
}
Beispiel #15
0
void LayoutRoot::paint(Canvas* canvas)
{
    if (m_document && canvas && canvas->skCanvas())
        rootElement()->paint(canvas);
}
Beispiel #16
0
void SVGDocument::dispatchScrollEvent()
{
    RefPtr<Event> event = createEvent("SVGEvents", IGNORE_EXCEPTION);
    event->initEvent(eventNames().scrollEvent, true, false);
    rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION);
}
void UnfuddleAPIWrapper::requestFinished(QNetworkReply *reply)
{
    QVariant requestTypeV = reply->property("requestType");
    Q_ASSERT(requestTypeV.isValid());
    RequestType requestType = static_cast<RequestType>(requestTypeV.toInt());

    if (reply->error() == QNetworkReply::NoError) {
        if (!isOnline) {
            isOnline = true;
            emit wentOnline();
        }
        // the following block detects if we use wrong protocol - http instead of https
        // FIXME: what if SSL not available for our account and we use https?
        // probably should handle ssl errors too
        QVariant statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
        if (statusCode.toInt() == 302) {
            this->setUseSsl(!this->getUseSsl());

            // FIXME: the request which is failed may not necessarily be /account
            // BUG POSSIBILITY IS HIGH!!!
            requestGetAccount();

            return;
        }

        QNetworkReply *nr;

        switch (requestType) {
        case ACCOUNT_LOAD:
            emit getAccountComplete(unf::Account::loadFromDom(rootElement(reply)));
            break;
        case CURRENT_PERSON_LOAD:
            emit getCurrentPersonComplete(unf::Person::loadFromDom(rootElement(reply)));
            break;
        case PERSON_INVOLVEMENTS_LOAD:
            {
                involvementsForProjectsForPerson =
                        unf::Involvement::loadListFromDom(rootElement(reply));
                nr = sendGetRequest("/projects");
                nr->setProperty("requestType", PROJECTS_LOAD);
                nr->setProperty("person_id", reply->property("person_id"));
            }
            break;
        case PROJECTS_LOAD:
            {
                QList<unf::Project> projects =
                        unf::Project::loadListFromDom(rootElement(reply));
                projects = unf::Project::filterProjectListWithInvolvements(
                        projects,
                        involvementsForProjectsForPerson);
                emit getProjectsForPersonComplete(projects,
                                                  reply->property("person_id").toInt());
            }
            break;
        case MILESTONES_LOAD: // Milestones are not used in the program
            break;
        case TICKETS_LOAD:
            {
                int person_id = reply->property("person_id").toInt();
                QList<unf::Ticket> tickets = unf::Ticket::loadListFromDom(rootElement(reply));
                QList<unf::Ticket> tmpTickets;  // filter tickets
                foreach (unf::Ticket t, tickets) {
                    if (t.assignee_id == person_id && t.status != "closed")
                        tmpTickets.push_back(t);
                }
                emit getTicketsForPersonComplete(tmpTickets, person_id,
                                                 reply->property("project_id").toInt());
            }
            break;
        case UPDATE_TIME_ENTRY:
            emit saveTimeEntryComplete(reply->property("project_id").toInt(),
                                       reply->property("ticket_id").toInt(),
                                       timeEntryForSaving);
            break;
        case LIST_TIME_ENTRIES:
        case LIST_AFTER_POST_TIME_ENTRY:
            {
                int project_id = reply->property("project_id").toInt();
                int ticket_id = reply->property("ticket_id").toInt();

                QList<unf::TimeEntry> timeEntries =
                        unf::TimeEntry::loadListFromDom(rootElement(reply));

                unf::TimeEntry curTimeEntry;
                bool found = false;
                foreach (unf::TimeEntry te, timeEntries) {
                    if (te.date == timeEntryForSaving.date &&
                        te.person_id == timeEntryForSaving.person_id) {
                            curTimeEntry = te;
                            found = true;
                            break;
                    }
                }

                if (found) {
                    if (requestType == LIST_TIME_ENTRIES) {
                        curTimeEntry.hours += reply->property("hoursAdd").toFloat();
                        requestSaveTimeEntry(project_id, ticket_id, curTimeEntry);
                    }
                    else if (requestType == LIST_AFTER_POST_TIME_ENTRY)
                        emit saveTimeEntryComplete(project_id, ticket_id, curTimeEntry);
                }
                else {
                    timeEntryForSaving.hours = reply->property("hoursAdd").toFloat();
                    nr = sendPostRequest(
                            QString("/projects/%1/tickets/%2/time_entries")
                                .arg(project_id)
                                .arg(ticket_id),
                            timeEntryForSaving.toXml().toUtf8());
                    nr->setProperty("requestType", POST_NEW_TIME_ENTRY);
                    nr->setProperty("project_id", project_id);
                    nr->setProperty("ticket_id", ticket_id);
                }
            }
            break;
        case POST_NEW_TIME_ENTRY:
            {
                int project_id = reply->property("project_id").toInt();
                int ticket_id = reply->property("ticket_id").toInt();

                nr = sendGetRequest(
                        QString("/projects/%1/tickets/%2/time_entries")
                            .arg(project_id)
                            .arg(ticket_id));
                nr->setProperty("requestType", LIST_AFTER_POST_TIME_ENTRY);
                nr->setProperty("project_id", project_id);
                nr->setProperty("ticket_id", ticket_id);
            }
            break;
        case CHANGE_TICKET:
            emit changeTicketComplete(reply->property("project_id").toInt(),
                                      reply->property("ticket_id").toInt());
            break;
        case ADD_TICKET_COMMENT:
            {
                int project_id = reply->property("project_id").toInt();
                int ticket_id = reply->property("ticket_id").toInt();

                nr = sendGetRequest(QString("/projects/%1/tickets/%2/comments")
                                        .arg(project_id).arg(ticket_id));
                nr->setProperty("requestType", LIST_TICKET_COMMENTS);
                nr->setProperty("project_id", project_id);
                nr->setProperty("ticket_id", ticket_id);
            }
            break;
        case LIST_TICKET_COMMENTS:
            {
                int comment_id = unf::Comment::loadFromDom(
                        rootElement(reply).lastChild().toElement()).id;
                emit addTicketCommentComplete(reply->property("project_id").toInt(),
                                              reply->property("ticket_id").toInt(),
                                              comment_id);
            }
            break;
        case UPLOAD_TICKET_COMMENT_ATTACHMENT:
            {
                int project_id = reply->property("project_id").toInt();
                int ticket_id = reply->property("ticket_id").toInt();
                int comment_id = reply->property("comment_id").toInt();

                unf::Attachment a;
                a.filename = reply->property("filename").toString();
                a.content_type = "application/octet-stream";
                a.upload_key = rootElement(reply).firstChildElement("key").text();

                nr = sendPostRequest(
                        QString("/projects/%1/tickets/%2/comments/%3/attachments")
                            .arg(project_id).arg(ticket_id).arg(comment_id),
                        a.toXml().toUtf8());
                nr->setProperty("requestType", ADD_ATTACHMENT_TO_TICKET_COMMENT);
                nr->setProperty("project_id", project_id);
                nr->setProperty("ticket_id", ticket_id);
                nr->setProperty("comment_id", comment_id);
            }
            break;
        case ADD_ATTACHMENT_TO_TICKET_COMMENT:
            emit addAttachmentToTicketCommentComplete(reply->property("project_id").toInt(),
                                                      reply->property("ticket_id").toInt(),
                                                      reply->property("comment_id").toInt());
            break;
        case TICKET_COMMENTS_LOAD:
            emit getCommentsForTicketComplete(
                    unf::Comment::loadListFromDom(rootElement(reply)),
                    reply->property("project_id").toInt(),
                    reply->property("ticket_id").toInt());
            break;
        case ALL_PEOPLE_LOAD:
            emit getAllPeopleComplete(unf::Person::loadListFromDom(rootElement(reply)));
            break;
        }
    }
    else
Beispiel #18
0
void SVGDocument::startPan(const FloatPoint& start)
{
    if (rootElement())
        m_translate = FloatPoint(start.x() - rootElement()->currentTranslate().x(), start.y() - rootElement()->currentTranslate().y());
}
void SVGDocumentExtensions::updatePan(const FloatPoint& pos) const
{
    if (SVGSVGElement* svg = rootElement(*m_document))
        svg->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), pos.y() - m_translate.y()));
}
SVGSVGElement* SVGDocumentExtensions::rootElement() const
{
    ASSERT(m_document);
    return rootElement(*m_document);
}
void SVGDocumentExtensions::startPan(const FloatPoint& start)
{
    if (SVGSVGElement* svg = rootElement(*m_document))
        m_translate = FloatPoint(start.x() - svg->currentTranslate().x(), start.y() - svg->currentTranslate().y());
}
bool SVGDocumentExtensions::zoomAndPanEnabled() const
{
    if (SVGSVGElement* svg = rootElement(*m_document))
        return svg->zoomAndPanEnabled();
    return false;
}