VirtualBox

Changeset 56653 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jun 26, 2015 8:31:29 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
101289
Message:

DnD: Some renaming, documentation, logging.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestDnDPrivate.h

    r56074 r56653  
    147147    /** Target (VM) screen ID. */
    148148    uint32_t                            mScreenID;
    149     /** Drag'n drop format to send. */
    150     com::Utf8Str                        mFormat;
     149    /** Drag'n drop format requested by the guest. */
     150    com::Utf8Str                        mFmtReq;
    151151    /** Drag'n drop data to send.
    152152     *  This can be arbitrary data or an URI list. */
     
    361361    uint32_t defAction(void) const { return m_defAction; }
    362362
    363     void setFormat(const Utf8Str &strFormat) { m_strFormat = strFormat; }
    364     Utf8Str format(void) const { return m_strFormat; }
     363    void setFmtReq(const Utf8Str &strFormat) { m_strFmtReq = strFormat; }
     364    Utf8Str fmtReq(void) const { return m_strFmtReq; }
    365365
    366366    void reset(void);
     
    383383    /** Pointer to context this class is tied to. */
    384384    void                 *m_pvCtx;
     385    /** Event for waiting for response. */
    385386    RTSEMEVENT            m_EventSem;
     387    /** Default action to perform in case of a
     388     *  successful drop. */
    386389    uint32_t              m_defAction;
     390    /** Actions supported by the guest in case of
     391     *  a successful drop. */
    387392    uint32_t              m_allActions;
    388     Utf8Str               m_strFormat;
    389 
     393    /** Format requested by the guest. */
     394    Utf8Str               m_strFmtReq;
    390395    /** Pointer to IGuest parent object. */
    391396    ComObjPtr<Guest>      m_parent;
     
    451456    /** @name Static helper methods.
    452457     * @{ */
    453     static com::Utf8Str        toFormatString(const std::vector<com::Utf8Str> &lstSupportedFormats, const std::vector<com::Utf8Str> &lstFormats);
     458    static com::Utf8Str        toFormatString(const std::vector<com::Utf8Str> &lstSupportedFormats, const std::vector<com::Utf8Str> &lstWantedFormats);
    454459    static void                toFormatVector(const std::vector<com::Utf8Str> &lstSupportedFormats, const com::Utf8Str &strFormats, std::vector<com::Utf8Str> &vecformats);
    455460    static DnDAction_T         toMainAction(uint32_t uAction);
     
    528533    const ComObjPtr<Guest>          m_pGuest;
    529534    /** List of supported MIME/Content-type formats. */
    530     std::vector<com::Utf8Str>       m_strFormats;
     535    std::vector<com::Utf8Str>       m_vecFmtSup;
     536    /** List of offered/compatible MIME/Content-type formats to the
     537     *  counterpart. */
     538    std::vector<com::Utf8Str>       m_vecFmtOff;
    531539    /** @}  */
    532540
  • trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp

    r56494 r56653  
    221221    m_allActions = 0;
    222222
    223     m_strFormat  = "";
     223    m_strFmtReq  = "";
    224224}
    225225
     
    382382
    383383            if (   pCBData->cbFormat == 0
    384                 || pCBData->cbFormat >  _64K)
     384                || pCBData->cbFormat > _64K)
    385385            {
    386386                rc = VERR_INVALID_PARAMETER;
     
    388388            else
    389389            {
    390                 setFormat(pCBData->pszFormat);
     390                setFmtReq(pCBData->pszFormat);
    391391
    392392                rc = VINF_SUCCESS;
     
    428428            else
    429429            {
    430                 setFormat    (pCBData->pszFormat);
     430                setFmtReq    (pCBData->pszFormat);
    431431                setDefAction (pCBData->uDefAction);
    432432                setAllActions(pCBData->uAllActions);
     
    492492
    493493    /* List of supported default MIME types. */
     494    LogRel2(("DnD: Supported default host formats:\n"));
    494495    const com::Utf8Str arrEntries[] = { VBOX_DND_FORMATS_DEFAULT };
    495496    for (size_t i = 0; i < RT_ELEMENTS(arrEntries); i++)
     497    {
    496498        m_strDefaultFormats.push_back(arrEntries[i]);
     499        LogRel2(("DnD: \t%s\n", arrEntries[i].c_str()));
     500    }
    497501}
    498502
     
    577581/* static */
    578582com::Utf8Str GuestDnD::toFormatString(const std::vector<com::Utf8Str> &lstSupportedFormats,
    579                                       const std::vector<com::Utf8Str> &lstFormats)
     583                                      const std::vector<com::Utf8Str> &lstWantedFormats)
    580584{
    581585    com::Utf8Str strFormat;
    582     for (size_t i = 0; i < lstFormats.size(); ++i)
    583     {
    584         const com::Utf8Str &f = lstFormats.at(i);
     586    for (size_t i = 0; i < lstWantedFormats.size(); ++i)
     587    {
     588        const com::Utf8Str &f = lstWantedFormats.at(i);
    585589        /* Only keep allowed format types. */
    586590        if (std::find(lstSupportedFormats.begin(),
     
    707711     * Initialize public attributes.
    708712     */
    709     m_strFormats = GuestDnDInst()->defaultFormats();
     713    m_vecFmtSup = GuestDnDInst()->defaultFormats();
    710714}
    711715
    712716HRESULT GuestDnDBase::i_isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported)
    713717{
    714     *aSupported = std::find(m_strFormats.begin(),
    715                             m_strFormats.end(), aFormat) != m_strFormats.end()
     718    *aSupported = std::find(m_vecFmtSup.begin(),
     719                            m_vecFmtSup.end(), aFormat) != m_vecFmtSup.end()
    716720                ? TRUE : FALSE;
    717721    return S_OK;
     
    720724HRESULT GuestDnDBase::i_getFormats(std::vector<com::Utf8Str> &aFormats)
    721725{
    722     aFormats = m_strFormats;
     726    aFormats = m_vecFmtSup;
    723727
    724728    return S_OK;
     
    730734    {
    731735        Utf8Str strFormat = aFormats.at(i);
    732         if (std::find(m_strFormats.begin(),
    733                       m_strFormats.end(), strFormat) == m_strFormats.end())
    734         {
    735             m_strFormats.push_back(strFormat);
     736        if (std::find(m_vecFmtSup.begin(),
     737                      m_vecFmtSup.end(), strFormat) == m_vecFmtSup.end())
     738        {
     739            m_vecFmtSup.push_back(strFormat);
    736740        }
    737741    }
     
    745749    {
    746750        Utf8Str strFormat = aFormats.at(i);
    747         std::vector<com::Utf8Str>::iterator itFormat = std::find(m_strFormats.begin(),
    748                                                                  m_strFormats.end(), strFormat);
    749         if (itFormat != m_strFormats.end())
    750             m_strFormats.erase(itFormat);
     751        std::vector<com::Utf8Str>::iterator itFormat = std::find(m_vecFmtSup.begin(),
     752                                                                 m_vecFmtSup.end(), strFormat);
     753        if (itFormat != m_vecFmtSup.end())
     754            m_vecFmtSup.erase(itFormat);
    751755    }
    752756
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette