VirtualBox

Changeset 92638 in vbox


Ignore:
Timestamp:
Nov 30, 2021 7:20:00 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9371. More changes on file maanager code in order to use it as a machine tool.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r92492 r92638  
    295295                case UIToolType_Logs:
    296296                case UIToolType_VMActivity:
     297                case UIToolType_FileManager:
    297298                    return true;
    298299                default:
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp

    r92633 r92638  
    113113
    114114UIFileManager::UIFileManager(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    115                              const CMachine &comMachine, QWidget *pParent, bool fShowToolbar /* = true */)
     115                             const CMachine &comMachine, QWidget *pParent, bool fShowToolbar)
    116116    : QIWithRetranslateUI<QWidget>(pParent)
    117117    , m_comMachine(comMachine)
     
    583583bool UIFileManager::openSession(const QString& strUserName, const QString& strPassword)
    584584{
     585    AssertReturn(!m_comMachine.isNull(), false);
    585586    m_comSession = uiCommon().openSession(m_comMachine.GetId(), KLockType_Shared);
    586587    AssertReturn(!m_comSession.isNull(), false);
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h

    r92633 r92638  
    9494
    9595    UIFileManager(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    96                               const CMachine &comMachine, QWidget *pParent, bool fShowToolbar = true);
     96                  const CMachine &comMachine, QWidget *pParent, bool fShowToolbar);
    9797    ~UIFileManager();
    9898    QMenu *menu() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerDialog.cpp

    r92630 r92638  
    3636*********************************************************************************************************************************/
    3737
    38 UIFileManagerDialogFactory::UIFileManagerDialogFactory(UIActionPool *pActionPool,
    39                                                        const CMachine &comMachine,
    40                                                        const QString &strMachineName)
     38UIFileManagerDialogFactory::UIFileManagerDialogFactory(UIActionPool *pActionPool, const CMachine &comMachine)
    4139    : m_pActionPool(pActionPool)
    4240    , m_comMachine(comMachine)
    43     , m_strMachineName(strMachineName)
    4441{
    4542}
     
    5451void UIFileManagerDialogFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget)
    5552{
    56     pDialog = new UIFileManagerDialog(pCenterWidget, m_pActionPool, m_comMachine, m_strMachineName);
     53    pDialog = new UIFileManagerDialog(pCenterWidget, m_pActionPool, m_comMachine);
    5754}
    5855
     
    6360
    6461UIFileManagerDialog::UIFileManagerDialog(QWidget *pCenterWidget,
    65                                            UIActionPool *pActionPool,
    66                                            const CMachine &comMachine,
    67                                            const QString &strMachineName)
     62                                         UIActionPool *pActionPool,
     63                                         const CMachine &comMachine)
    6864    : QIWithRetranslateUI<QIManagerDialog>(pCenterWidget)
    6965    , m_pActionPool(pActionPool)
    7066    , m_comMachine(comMachine)
    71     , m_strMachineName(strMachineName)
    7267{
    7368}
     
    8277void UIFileManagerDialog::retranslateUi()
    8378{
    84     /* Translate window title: */
    85     setWindowTitle(UIFileManager::tr("%1 - File Manager").arg(m_strMachineName));
     79    if (!m_comMachine.isNull())
     80        setWindowTitle(UIFileManager::tr("%1 - File Manager").arg(m_comMachine.GetName()));
     81    else
     82        setWindowTitle(UIFileManager::tr("File Manager"));
    8683
    8784    /* Retranslate button box buttons: */
     
    113110    /* Create widget: */
    114111    UIFileManager *pWidget = new UIFileManager(EmbedTo_Dialog, m_pActionPool,
    115                                                                        m_comMachine, this);
     112                                               m_comMachine, this, true);
    116113
    117114    if (pWidget)
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerDialog.h

    r92630 r92638  
    4646public:
    4747
    48     UIFileManagerDialogFactory(UIActionPool *pActionPool, const CMachine &comMachine, const QString &strMachineName);
     48    UIFileManagerDialogFactory(UIActionPool *pActionPool, const CMachine &comMachine);
    4949    UIFileManagerDialogFactory();
    5050
     
    5757    UIActionPool *m_pActionPool;
    5858    CMachine      m_comMachine;
    59     QString       m_strMachineName;
    6059};
    6160
     
    7170      * @param  pActionPool    Passes the action-pool reference.
    7271      * @param  comMachine     Passes the machine reference. */
    73     UIFileManagerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool, const CMachine &comMachine, const QString &strMachineName);
     72    UIFileManagerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool, const CMachine &comMachine);
    7473    ~UIFileManagerDialog();
    7574
     
    112111    UIActionPool *m_pActionPool;
    113112    CMachine    m_comMachine;
    114     QString     m_strMachineName;
    115113};
    116114
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp

    r92633 r92638  
    218218            {
    219219                if (!m_items.isEmpty())
    220                 {
    221220                    m_pPaneFileManager = new UIFileManager(EmbedTo_Stack, m_pActionPool,
    222221                                                           uiCommon().virtualBox().FindMachine(m_items[0]->id().toString()),
    223222                                                           0, false /* fShowToolbar */);
    224                     AssertPtrReturnVoid(m_pPaneFileManager);
    225 #ifndef VBOX_WS_MAC
    226                     const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4;
    227                     m_pPaneFileManager->setContentsMargins(iMargin, 0, iMargin, 0);
    228 #endif
    229                     /* Configure pane: */
    230                     m_pPaneFileManager->setProperty("ToolType", QVariant::fromValue(UIToolType_FileManager));
    231                     //m_pPaneFileManager->setSelectedVMListItems(m_items);
    232                     /* Add into layout: */
    233                     m_pLayout->addWidget(m_pPaneFileManager);
    234                     m_pLayout->setCurrentWidget(m_pPaneFileManager);
    235                 }
     223                else
     224                    m_pPaneFileManager = new UIFileManager(EmbedTo_Stack, m_pActionPool, CMachine(),
     225                                                           0, false /* fShowToolbar */);
     226                AssertPtrReturnVoid(m_pPaneFileManager);
     227#ifndef VBOX_WS_MAC
     228                const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4;
     229                m_pPaneFileManager->setContentsMargins(iMargin, 0, iMargin, 0);
     230#endif
     231                /* Configure pane: */
     232                m_pPaneFileManager->setProperty("ToolType", QVariant::fromValue(UIToolType_FileManager));
     233                //m_pPaneFileManager->setSelectedVMListItems(m_items);
     234                /* Add into layout: */
     235                m_pLayout->addWidget(m_pPaneFileManager);
     236                m_pLayout->setCurrentWidget(m_pPaneFileManager);
    236237                break;
    237238            }
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r92487 r92638  
    742742            break;
    743743        case UIToolType_VMActivity:
    744             break;
     744        case UIToolType_FileManager:
    745745        default:
    746746            break;
     
    30443044                                       m_pWidget->currentMachineTool() == UIToolType_VMActivity;
    30453045    actionPool()->action(UIActionIndex_M_Activity)->setVisible(fPerformanceMenuShown);
     3046    /* Determine whether File Manager menu item should be visible: */
     3047    const bool fFileManagerMenuShown = (fMachineMenuShown || fGroupMenuShown) &&
     3048                                       m_pWidget->currentMachineTool() == UIToolType_FileManager;
     3049    actionPool()->action(UIActionIndex_M_FileManager)->setVisible(fFileManagerMenuShown);
    30463050
    30473051    /* Hide action shortcuts: */
     
    32213225                break;
    32223226            }
     3227            case UIToolType_FileManager:
     3228            {
     3229                actionPool()->action(UIActionIndexMN_M_Group_M_Tools_T_FileManager)->setChecked(true);
     3230                actionPool()->action(UIActionIndexMN_M_Machine_M_Tools_T_FileManager)->setChecked(true);
     3231                break;
     3232            }
    32233233            default:
    32243234                break;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp

    r92487 r92638  
    463463            case UIToolType_Logs:                 pItem->reconfigure(tr("Logs")); break;
    464464            case UIToolType_VMActivity:           pItem->reconfigure(tr("Activity")); break;
     465            case UIToolType_FileManager:          pItem->reconfigure(tr("File Manager")); break;
    465466            default: break;
    466467        }
     
    539540    m_items << new UIToolsItem(scene(), UIToolClass_Machine, UIToolType_VMActivity, QString(),
    540541                               UIIconPool::iconSet(":/performance_monitor_24px.png", ":/performance_monitor_disabled_24px.png"));
     542
     543    m_items << new UIToolsItem(scene(), UIToolClass_Machine, UIToolType_FileManager, QString(),
     544                               UIIconPool::iconSet(":/file_manager_24px.png", ":/file_manager_disabled_24px.png"));
    541545}
    542546
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r92630 r92638  
    17811781
    17821782    QIManagerDialog *pFileManagerDialog;
    1783     UIFileManagerDialogFactory dialogFactory(actionPool(), machine(), machine().GetName());
     1783    UIFileManagerDialogFactory dialogFactory(actionPool(), machine());
    17841784    dialogFactory.prepare(pFileManagerDialog, activeMachineWindow());
    17851785    if (pFileManagerDialog)
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