- Timestamp:
- Apr 21, 2017 6:08:55 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r63567 r66647 188 188 189 189 /* Set redefined machine-window icon if any: */ 190 QIcon *pMachineWidnowIcon = uisession()->machineWindowIcon();191 if (pMachineWi dnowIcon)192 setWindowIcon(*pMachineWi dnowIcon);190 const QIcon *pMachineWindowIcon = uisession()->machineWindowIcon(); 191 if (pMachineWindowIcon) 192 setWindowIcon(*pMachineWindowIcon); 193 193 /* Or set default machine-window icon: */ 194 194 else … … 346 346 console().GetGuestEnteredACPIMode(), 347 347 restrictedCloseActions); 348 /* Configure close-dialog: */ 349 const QIcon *pMachineWindowIcon = uisession()->machineWindowIcon(); 350 if (pMachineWindowIcon) 351 pCloseDlg->setPixmap(pMachineWindowIcon->pixmap(QSize(32, 32))); 348 352 349 353 /* Make sure close-dialog is valid: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r66579 r66647 1290 1290 1291 1291 #ifndef VBOX_WS_MAC 1292 /* Load/prepare user's machine-window icon: */ 1293 QIcon icon; 1294 foreach (const QString &strIconName, gEDataManager->machineWindowIconNames(strMachineID)) 1295 if (!strIconName.isEmpty() && QFile::exists(strIconName)) 1296 icon.addFile(strIconName); 1297 if (!icon.isNull()) 1298 m_pMachineWindowIcon = new QIcon(icon); 1292 /* Check whether we have overriding machine-window icon: */ 1293 { 1294 /* Prepare null icon: */ 1295 QIcon icon; 1296 1297 /* 1. Load icon from IMachine extra-data: */ 1298 if (icon.isNull()) 1299 foreach (const QString &strIconName, gEDataManager->machineWindowIconNames(strMachineID)) 1300 if (!strIconName.isEmpty() && QFile::exists(strIconName)) 1301 icon.addFile(strIconName); 1302 1303 /* 2. Load icon from IMachine interface: */ 1304 if (icon.isNull()) 1305 { 1306 const QVector<BYTE> byteVector = machine().GetIcon(); 1307 const QByteArray byteArray = QByteArray::fromRawData(reinterpret_cast<const char*>(byteVector.constData()), byteVector.size()); 1308 const QImage image = QImage::fromData(byteArray); 1309 if (!image.isNull()) 1310 { 1311 QPixmap pixmap = QPixmap::fromImage(image); 1312 const int iMinimumLength = qMin(pixmap.width(), pixmap.height()); 1313 pixmap = pixmap.scaled(QSize(iMinimumLength, iMinimumLength), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); 1314 icon.addPixmap(pixmap); 1315 } 1316 } 1317 1318 /* Finally, store the icon dynamically if overriden: */ 1319 if (!icon.isNull()) 1320 m_pMachineWindowIcon = new QIcon(icon); 1321 } 1299 1322 1300 1323 /* Load user's machine-window name postfix: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
r62493 r66647 70 70 } 71 71 72 void UIVMCloseDialog::setPixmap(const QPixmap &pixmap) 73 { 74 /* Make sure pixmap is valid: */ 75 if (pixmap.isNull()) 76 return; 77 78 /* Assign new pixmap: */ 79 m_pIcon->setPixmap(pixmap); 80 } 81 72 82 void UIVMCloseDialog::sltUpdateWidgetAvailability() 73 83 { … … 103 113 /* Hide the dialog: */ 104 114 hide(); 105 }106 107 void UIVMCloseDialog::setPixmap(const QPixmap &pixmap)108 {109 /* Make sure pixmap is valid: */110 if (pixmap.isNull())111 return;112 113 /* Assign new pixmap: */114 m_pIcon->setPixmap(pixmap);115 115 } 116 116 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h
r62493 r66647 44 44 bool isValid() const { return m_fValid; } 45 45 46 /* API: Pixmap stuff: */ 47 void setPixmap(const QPixmap &pixmap); 48 46 49 private slots: 47 50 … … 53 56 54 57 private: 55 56 /* API: Pixmap stuff: */57 void setPixmap(const QPixmap &pixmap);58 58 59 59 /* API: Detach-button stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.