VirtualBox

Ignore:
Timestamp:
Mar 6, 2014 2:49:13 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Medium Manager rework/cleanup: Rework medium-item *copy* method to be polymorphic call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r50715 r50716  
    7676    /** Removes UIMedium wrapped by <i>this</i> item. */
    7777    virtual bool remove() = 0;
     78    /** Copy UIMedium wrapped by <i>this</i> item. */
     79    virtual bool copy() = 0;
    7880
    7981    /** Refreshes item fully. */
     
    168170    {}
    169171
    170 private:
     172protected:
    171173
    172174    /** Removes UIMedium wrapped by <i>this</i> item. */
     
    199201        return true;
    200202    }
     203
     204    /** Copy UIMedium wrapped by <i>this</i> item. */
     205    bool copy()
     206    {
     207        /* Show Clone VD wizard: */
     208        UISafePointerWizard pWizard = new UIWizardCloneVD(treeWidget(), medium().medium());
     209        pWizard->prepare();
     210        pWizard->exec();
     211
     212        /* Delete if still exists: */
     213        if (pWizard)
     214            delete pWizard;
     215
     216        /* True by default: */
     217        return true;
     218    }
     219
     220private:
    201221
    202222    /** Proposes user to remove CMedium storage wrapped by <i>this</i> item. */
     
    259279    {}
    260280
    261 private:
     281protected:
    262282
    263283    /** Removes UIMedium wrapped by <i>this</i> item. */
     
    285305        /* True by default: */
    286306        return true;
     307    }
     308
     309    /** Copy UIMedium wrapped by <i>this</i> item. */
     310    bool copy()
     311    {
     312        AssertMsgFailedReturn(("That functionality in not supported!\n"), false);
    287313    }
    288314};
     
    298324    {}
    299325
    300 private:
     326protected:
    301327
    302328    /** Removes UIMedium wrapped by <i>this</i> item. */
     
    324350        /* True by default: */
    325351        return true;
     352    }
     353
     354    /** Copy UIMedium wrapped by <i>this</i> item. */
     355    bool copy()
     356    {
     357        AssertMsgFailedReturn(("That functionality in not supported!\n"), false);
    326358    }
    327359};
     
    492524void UIMediumManager::sltHandleMediumDeleted(const QString &strMediumID)
    493525{
    494     /* Delete UIMediumItem for corresponding 'strMediumID': */
     526    /* Make sure corresponding medium-item deleted: */
    495527    deleteMediumItem(strMediumID);
    496528}
     
    537569        return;
    538570
    539     /* Update UIMediumItem for corresponding 'medium': */
     571    /* Update medium-item for corresponding medium: */
    540572    updateMediumItem(medium);
    541573
     
    563595    AssertReturnVoid(!pMediumItem->id().isNull());
    564596
    565     /* Show Clone VD wizard: */
    566     UISafePointerWizard pWizard = new UIWizardCloneVD(this, pMediumItem->medium().medium());
    567     pWizard->prepare();
    568     pWizard->exec();
    569 
    570     /* Delete if still exists: */
    571     if (pWizard)
    572         delete pWizard;
     597    /* Copy current medium-item: */
     598    pMediumItem->copy();
    573599}
    574600
Note: See TracChangeset for help on using the changeset viewer.

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