void UIVMInformationDialog::prepareThis() { /* Delete dialog on close: */ setAttribute(Qt::WA_DeleteOnClose); /* Delete dialog on machine-window destruction: */ connect(m_pMachineWindow, SIGNAL(destroyed(QObject*)), this, SLOT(suicide())); #ifdef Q_WS_MAC /* No window-icon on Mac OX X, because it acts as proxy icon which isn't necessary here. */ setWindowIcon(QIcon()); #else /* !Q_WS_MAC */ /* Assign window-icon(s: */ setWindowIcon(UIIconPool::iconSetFull(":/session_info_32px.png", ":/session_info_16px.png")); #endif /* !Q_WS_MAC */ /* Prepare central-widget: */ prepareCentralWidget(); /* Configure handlers: */ connect(m_pMachineWindow->uisession(), SIGNAL(sigMediumChange(const CMediumAttachment&)), this, SLOT(sltUpdateDetails())); connect(m_pMachineWindow->uisession(), SIGNAL(sigSharedFolderChange()), this, SLOT(sltUpdateDetails())); /* TODO_NEW_CORE: this is ofc not really right in the mm sense. There are more than one screens. */ connect(m_pMachineWindow->machineView(), SIGNAL(sigFrameBufferResize()), this, SLOT(sltProcessStatistics())); connect(m_pTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandlePageChanged(int))); connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltUpdateDetails())); connect(m_pTimer, SIGNAL(timeout()), this, SLOT(sltProcessStatistics())); /* Retranslate: */ retranslateUi(); /* Details page update: */ sltUpdateDetails(); /* Statistics page update: */ sltProcessStatistics(); m_pTimer->start(5000); }
void UIMediumEnumerator::sltHandleMediumEnumerationTaskComplete(UITask *pTask) { /* Make sure that is one of our tasks: */ if (pTask->type() != UITask::Type_MediumEnumeration) return; AssertReturnVoid(m_tasks.contains(pTask)); /* Get enumerated UIMedium: */ const UIMedium uimedium = pTask->property("medium").value<UIMedium>(); const QString strUIMediumKey = uimedium.key(); LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} enumerated\n", strUIMediumKey.toUtf8().constData())); /* Remove task from internal set: */ m_tasks.remove(pTask); /* Make sure such UIMedium still exists: */ AssertReturnVoid(m_mediums.contains(strUIMediumKey)); /* Check if UIMedium ID was changed: */ const QString strUIMediumID = uimedium.id(); /* UIMedium ID was changed to nullID: */ if (strUIMediumID == UIMedium::nullID()) { /* Delete this medium: */ m_mediums.remove(strUIMediumKey); LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} closed and deleted (after enumeration)\n", strUIMediumKey.toUtf8().constData())); /* And notify listener about delete: */ emit sigMediumDeleted(strUIMediumKey); } /* UIMedium ID was changed to something proper: */ else if (strUIMediumID != strUIMediumKey) { /* We have to reinject enumerated medium: */ m_mediums.remove(strUIMediumKey); m_mediums[strUIMediumID] = uimedium; m_mediums[strUIMediumID].setKey(strUIMediumID); LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} has it changed to {%s}\n", strUIMediumKey.toUtf8().constData(), strUIMediumID.toUtf8().constData())); /* And notify listener about delete/create: */ emit sigMediumDeleted(strUIMediumKey); emit sigMediumCreated(strUIMediumID); } /* UIMedium ID was not changed: */ else { /* Just update enumerated medium: */ m_mediums[strUIMediumID] = uimedium; LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} updated\n", strUIMediumID.toUtf8().constData())); /* And notify listener about update: */ emit sigMediumEnumerated(strUIMediumID); } /* If there are no more tasks we know about: */ if (m_tasks.isEmpty()) { /* Notify listener: */ LogRel(("GUI: UIMediumEnumerator: Medium-enumeration finished!\n")); m_fMediumEnumerationInProgress = false; emit sigMediumEnumerationFinished(); } }