Changeset 3943 in vbox for trunk/src/VBox
- Timestamp:
- Jul 31, 2007 2:42:32 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/QIMessageBox.h
r3894 r3943 30 30 #include <qtextedit.h> 31 31 32 class QIRichLabel; 32 33 class QLabel; 33 34 class QPushButton; … … 47 48 Warning = QMessageBox::Warning, 48 49 Critical = QMessageBox::Critical, 49 50 Question = QMessageBox::Question 50 51 }; 51 52 … … 93 94 94 95 int mButton0, mButton1, mButton2, mButtonEsc; 95 QLabel *mIconLabel, *mTextLabel; 96 QLabel *mIconLabel; 97 QIRichLabel *mTextLabel; 96 98 QPushButton *mButton0PB, *mButton1PB, *mButton2PB; 97 99 QVBox *mMessageVBox; -
trunk/src/VBox/Frontends/VirtualBox/include/QIRichLabel.h
r2981 r3943 125 125 QMovie *lmovie; 126 126 QPopupMenu *popupMenu; 127 QString popupBuffer; 127 128 QWidget *lbuddy; 128 129 ushort align; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r3936 r3943 195 195 const QString &, const QString &); 196 196 197 int cannotFindGuestAdditions (const QString &aSrc1, const QString &aSrc2); 197 198 void cannotDownloadGuestAdditions (const QString &aURL, 198 199 const QString &aReason); 199 int confirmDownloadAdditions (const QString &a Src1, const QString &aSrc2,200 const QString &aURL, ulong aSize);200 int confirmDownloadAdditions (const QString &aURL, ulong aSize); 201 int confirmMountAdditions (const QString &aURL, const QString &aSrc); 201 202 void warnAboutTooOldAdditions (QWidget *, const QString &, const QString &); 202 203 void warnAboutOldAdditions (QWidget *, const QString &, const QString &); -
trunk/src/VBox/Frontends/VirtualBox/src/QIMessageBox.cpp
r3898 r3943 23 23 #include "QIMessageBox.h" 24 24 #include "VBoxDefs.h" 25 #include "QIRichLabel.h" 25 26 26 27 #include <qpixmap.h> … … 80 81 mMessageVBox->setSpacing (10); 81 82 82 mTextLabel = new Q Label (aText, mMessageVBox);83 mTextLabel = new QIRichLabel (aText, mMessageVBox); 83 84 mTextLabel->setAlignment (AlignAuto | AlignTop | ExpandTabs | WordBreak); 84 85 mTextLabel->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Fixed, true); -
trunk/src/VBox/Frontends/VirtualBox/src/QIRichLabel.cpp
r2981 r3943 397 397 398 398 QString link = doc->anchorAt (aEvent->pos()); 399 if (!link.isEmpty()) /* Mouse clicked on the link */ 399 /* Check for mouse left button clicked on the link */ 400 if (!link.isEmpty() && aEvent->button() == LeftButton) 400 401 emit clickedOnLink (link); 401 402 } … … 484 485 void QIRichLabel::contextMenuEvent (QContextMenuEvent *aEvent) 485 486 { 486 if (hasFocus()) 487 popupMenu->popup(aEvent->globalPos()); 487 popupBuffer = doc->anchorAt (aEvent->pos()); 488 if (hasFocus() || !popupBuffer.isEmpty()) 489 popupMenu->popup (aEvent->globalPos()); 488 490 } 489 491 … … 491 493 void QIRichLabel::putToClipBoard() 492 494 { 493 QClipboard *appClipboard = QApplication::clipboard(); 494 QString toClipBoard = ltext; 495 toClipBoard.remove (QRegExp ("<[^>]*>")); 496 appClipboard->setText (toClipBoard); 495 QString toClipBoard = ltext; 496 497 if (popupBuffer.isEmpty()) 498 toClipBoard.remove (QRegExp ("<[^>]*>")); 499 else 500 toClipBoard = popupBuffer; 501 502 QApplication::clipboard()->setText (toClipBoard); 497 503 } 498 504 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r3936 r3943 212 212 public: 213 213 214 VBoxGADownloader (QStatusBar *aStatusBar, QAction *aAction, 215 const QString &aSrc1, const QString &aSrc2) 214 VBoxGADownloader (QStatusBar *aStatusBar, QAction *aAction) 216 215 : QWidget (0, "VBoxGADownloader") 217 216 , mStatusBar (aStatusBar) 218 , m Src1 (aSrc1), mSrc2 (aSrc2)217 , mProtocol ("http://") 219 218 , mHost (QString::null), mPath (QString::null), mFile (QString::null) 220 219 , mHttp (0), mIsChecking (true) … … 226 225 227 226 /* Drawing itself */ 227 setFixedHeight (16); 228 228 229 mProgressBar = new QProgressBar (this); 229 230 mProgressBar->setFixedWidth (100); … … 240 241 241 242 languageChange(); 243 mStatusBar->addWidget (this); 242 244 243 245 /* Select the product version */ … … 315 317 else if (!aError && !mIsChecking) 316 318 { 319 mHttp->abort(); 317 320 /* Serialize the incoming buffer into the .iso image. */ 318 321 QString path = QDir (QDir::home()).absFilePath (mFile); … … 322 325 file.writeBlock (mHttp->readAll()); 323 326 file.close(); 324 vboxGlobal().consoleWnd().installGuestAdditionsFrom (path); 327 int rc = vboxProblem().confirmMountAdditions (mProtocol + mHost + 328 mPath + mFile, QDir::convertSeparators (path)); 329 if (rc == QIMessageBox::Yes) 330 vboxGlobal().consoleWnd().installGuestAdditionsFrom (path); 325 331 QTimer::singleShot (0, this, SLOT (suicide())); 326 332 } … … 365 371 /* Ask user about GA image downloading */ 366 372 int rc = vboxProblem(). 367 confirmDownloadAdditions (mSrc1, mSrc2, 368 mHost + mPath + mFile, aSize); 373 confirmDownloadAdditions (mProtocol + mHost + mPath + mFile, aSize); 369 374 if (rc == QIMessageBox::Yes) 370 375 { 371 mStatusBar->addWidget (this);372 setFixedHeight (16);373 376 mIsChecking = false; 374 377 mHttp->get (mPath + mFile); … … 383 386 void abortDownload (const QString &aReason) 384 387 { 385 vboxProblem().cannotDownloadGuestAdditions (m Host + mPath + mFile,386 aReason);388 vboxProblem().cannotDownloadGuestAdditions (mProtocol + mHost + 389 mPath + mFile, aReason); 387 390 /* Allows all the queued signals to be processed before quit. */ 388 391 QTimer::singleShot (0, this, SLOT (suicide())); … … 390 393 391 394 QStatusBar *mStatusBar; 392 QString mSrc1; 393 QString mSrc2; 395 QString mProtocol; 394 396 QString mHost; 395 397 QString mPath; … … 2520 2522 installGuestAdditionsFrom (src2); 2521 2523 else 2522 new VBoxGADownloader (statusBar(), devicesInstallGuestToolsAction, 2523 src1, src2); 2524 { 2525 int rc = vboxProblem().cannotFindGuestAdditions ( 2526 QDir::convertSeparators (src1), QDir::convertSeparators (src2)); 2527 if (rc == QIMessageBox::Yes) 2528 new VBoxGADownloader (statusBar(), devicesInstallGuestToolsAction); 2529 } 2524 2530 } 2525 2531 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r3936 r3943 1254 1254 } 1255 1255 1256 int VBoxProblemReporter::cannotFindGuestAdditions (const QString &aSrc1, 1257 const QString &aSrc2) 1258 { 1259 return message (&vboxGlobal().consoleWnd(), Question, 1260 tr ("<p>Failed to find the VirtualBox Guest Additions " 1261 "CD image <nobr><b>%1</b></nobr> or " 1262 "<nobr><b>%2</b>.</nobr></p><p>Do you want to " 1263 "download this image from the Internet?</p>") 1264 .arg (aSrc1).arg (aSrc2), 1265 0, /* autoConfirmId */ 1266 QIMessageBox::Yes | QIMessageBox::Default, 1267 QIMessageBox::No | QIMessageBox::Escape); 1268 } 1269 1256 1270 void VBoxProblemReporter::cannotDownloadGuestAdditions (const QString &aURL, 1257 1271 const QString &aReason) 1258 1272 { 1259 QString msg = tr ("<p>Failed to download the VirtualBox Guest " 1260 "Additions CD image from <nobr><b>%1</b>.</nobr></p>").arg (aURL); 1261 msg += QString ("<p>%1</p>").arg (aReason); 1262 message (&vboxGlobal().consoleWnd(), Error, msg); 1263 } 1264 1265 int VBoxProblemReporter::confirmDownloadAdditions (const QString &aSrc1, 1266 const QString &aSrc2, 1267 const QString &aURL, 1273 message (&vboxGlobal().consoleWnd(), Error, 1274 tr ("<p>Failed to download the VirtualBox Guest Additions CD " 1275 "image from <nobr><a href=\"%1\">%2</a>.</nobr></p><p>%3</p>") 1276 .arg (aURL).arg (aURL).arg (aReason)); 1277 } 1278 1279 int VBoxProblemReporter::confirmDownloadAdditions (const QString &aURL, 1268 1280 ulong aSize) 1269 1281 { 1270 QString msg = tr ("<p>Failed to find the VirtualBox Guest Additions CD image " 1271 "<nobr><b>%1</b></nobr> or " 1272 "<nobr><b>%2</b></nobr></p>").arg (aSrc1).arg (aSrc2); 1273 msg += tr ("<p>Do you want to download this image from " 1274 "<nobr><b>%1</b></nobr> (%2 bytes)?</p>").arg (aURL).arg (aSize); 1275 1276 return message (&vboxGlobal().consoleWnd(), Question, msg, 1282 return message (&vboxGlobal().consoleWnd(), Question, 1283 tr ("<p>Are you sure you want to download the VirtualBox " 1284 "Guest Additions CD image from " 1285 "<nobr><a href=\"%1\">%2</a></nobr> " 1286 "(size %3 bytes)?</p>").arg (aURL).arg (aURL).arg (aSize), 1287 0, /* autoConfirmId */ 1288 QIMessageBox::Yes | QIMessageBox::Default, 1289 QIMessageBox::No | QIMessageBox::Escape); 1290 } 1291 1292 int VBoxProblemReporter::confirmMountAdditions (const QString &aURL, 1293 const QString &aSrc) 1294 { 1295 return message (&vboxGlobal().consoleWnd(), Question, 1296 tr ("<p>The VirtualBox Guest Additions CD image was " 1297 "successfully downloaded from " 1298 "<nobr><a href=\"%1\">%2</a></nobr> " 1299 "and saved locally as <nobr><b>%3</b>.</nobr></p>" 1300 "<p>Do you want to register this CD image and mount it " 1301 "on the virtual CD/DVD drive?</p>") 1302 .arg (aURL).arg (aURL).arg (aSrc), 1277 1303 0, /* autoConfirmId */ 1278 1304 QIMessageBox::Yes | QIMessageBox::Default,
Note:
See TracChangeset
for help on using the changeset viewer.