Changeset 7763 in vbox
- Timestamp:
- Apr 7, 2008 9:48:29 AM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h
r7678 r7763 24 24 #include "VBoxGlobalSettings.h" 25 25 26 #include <qapplication.h> 27 #include <qpixmap.h> 28 #include <qicon.h> 29 #include <qcolor.h> 30 #include <quuid.h> 31 #include <qthread.h> 32 #include <q3popupmenu.h> 26 /* Qt includes */ 27 #include <QApplication> 28 #include <QLayout> 29 #include <QHash> 30 #include <QPixmap> 33 31 #include <QMenu> 34 #include <qtooltip.h>35 36 #include <q3ptrvector.h>37 #include <q3valuevector.h>38 #include <q3valuelist.h>39 #include <q3dict.h>40 #include <q3intdict.h>41 //Added by qt3to4:42 #include <QLabel>43 #include <QEvent>44 #include <QLayout>45 32 46 33 class QAction; … … 66 53 }; 67 54 68 typedef Q 3ValueList <VBoxMedia> VBoxMediaList;55 typedef QList <VBoxMedia> VBoxMediaList; 69 56 70 57 // VirtualBox callback events … … 196 183 QPixmap toIcon (KMachineState s) const 197 184 { 198 QPixmap *pm = mStateIcons [s];185 QPixmap *pm = mStateIcons.value (s); 199 186 AssertMsg (pm, ("Icon for VM state %d must be defined", s)); 200 187 return pm ? *pm : QPixmap(); … … 204 191 { 205 192 static const QColor none; 206 AssertMsg (vm_state_color [s], ("No color for %d", s));207 return vm_state_color [s] ? *vm_state_color [s]: none;193 AssertMsg (vm_state_color.value (s), ("No color for %d", s)); 194 return vm_state_color.value (s) ? *vm_state_color.value(s) : none; 208 195 } 209 196 210 197 QString toString (KMachineState s) const 211 198 { 212 AssertMsg (!machineStates [s].isNull(), ("No text for %d", s));213 return machineStates [s];199 AssertMsg (!machineStates.value (s).isNull(), ("No text for %d", s)); 200 return machineStates.value (s); 214 201 } 215 202 216 203 QString toString (KSessionState s) const 217 204 { 218 AssertMsg (!sessionStates [s].isNull(), ("No text for %d", s));219 return sessionStates [s];205 AssertMsg (!sessionStates.value (s).isNull(), ("No text for %d", s)); 206 return sessionStates.value (s); 220 207 } 221 208 222 209 QString toString (KStorageBus t) const 223 210 { 224 AssertMsg (!storageBuses [t].isNull(), ("No text for %d", t));225 return storageBuses [t];211 AssertMsg (!storageBuses.value (t).isNull(), ("No text for %d", t)); 212 return storageBuses.value (t); 226 213 } 227 214 … … 231 218 QString toString (KHardDiskType t) const 232 219 { 233 AssertMsg (!diskTypes [t].isNull(), ("No text for %d", t));234 return diskTypes [t];220 AssertMsg (!diskTypes.value (t).isNull(), ("No text for %d", t)); 221 return diskTypes.value (t); 235 222 } 236 223 237 224 QString toString (KHardDiskStorageType t) const 238 225 { 239 AssertMsg (!diskStorageTypes [t].isNull(), ("No text for %d", t));240 return diskStorageTypes [t];226 AssertMsg (!diskStorageTypes.value (t).isNull(), ("No text for %d", t)); 227 return diskStorageTypes.value (t); 241 228 } 242 229 243 230 QString toString (KVRDPAuthType t) const 244 231 { 245 AssertMsg (!vrdpAuthTypes [t].isNull(), ("No text for %d", t));246 return vrdpAuthTypes [t];232 AssertMsg (!vrdpAuthTypes.value (t).isNull(), ("No text for %d", t)); 233 return vrdpAuthTypes.value (t); 247 234 } 248 235 249 236 QString toString (KPortMode t) const 250 237 { 251 AssertMsg (!portModeTypes [t].isNull(), ("No text for %d", t));252 return portModeTypes [t];238 AssertMsg (!portModeTypes.value (t).isNull(), ("No text for %d", t)); 239 return portModeTypes.value (t); 253 240 } 254 241 255 242 QString toString (KUSBDeviceFilterAction t) const 256 243 { 257 AssertMsg (!usbFilterActionTypes [t].isNull(), ("No text for %d", t));258 return usbFilterActionTypes [t];244 AssertMsg (!usbFilterActionTypes.value (t).isNull(), ("No text for %d", t)); 245 return usbFilterActionTypes.value (t); 259 246 } 260 247 261 248 QString toString (KClipboardMode t) const 262 249 { 263 AssertMsg (!clipboardTypes [t].isNull(), ("No text for %d", t));264 return clipboardTypes [t];250 AssertMsg (!clipboardTypes.value (t).isNull(), ("No text for %d", t)); 251 return clipboardTypes.value (t); 265 252 } 266 253 … … 275 262 QString toString (KIDEControllerType t) const 276 263 { 277 AssertMsg (!ideControllerTypes [t].isNull(), ("No text for %d", t));278 return ideControllerTypes [t];264 AssertMsg (!ideControllerTypes.value (t).isNull(), ("No text for %d", t)); 265 return ideControllerTypes.value (t); 279 266 } 280 267 … … 327 314 QString toString (KDeviceType t) const 328 315 { 329 AssertMsg (!deviceTypes [t].isNull(), ("No text for %d", t));330 return deviceTypes [t];316 AssertMsg (!deviceTypes.value (t).isNull(), ("No text for %d", t)); 317 return deviceTypes.value (t); 331 318 } 332 319 … … 343 330 QString toString (KAudioDriverType t) const 344 331 { 345 AssertMsg (!audioDriverTypes [t].isNull(), ("No text for %d", t));346 return audioDriverTypes [t];332 AssertMsg (!audioDriverTypes.value (t).isNull(), ("No text for %d", t)); 333 return audioDriverTypes.value (t); 347 334 } 348 335 … … 357 344 QString toString (KAudioControllerType t) const 358 345 { 359 AssertMsg (!audioControllerTypes [t].isNull(), ("No text for %d", t));360 return audioControllerTypes [t];346 AssertMsg (!audioControllerTypes.value (t).isNull(), ("No text for %d", t)); 347 return audioControllerTypes.value (t); 361 348 } 362 349 … … 371 358 QString toString (KNetworkAdapterType t) const 372 359 { 373 AssertMsg (!networkAdapterTypes [t].isNull(), ("No text for %d", t));374 return networkAdapterTypes [t];360 AssertMsg (!networkAdapterTypes.value (t).isNull(), ("No text for %d", t)); 361 return networkAdapterTypes.value (t); 375 362 } 376 363 … … 385 372 QString toString (KNetworkAttachmentType t) const 386 373 { 387 AssertMsg (!networkAttachmentTypes [t].isNull(), ("No text for %d", t));388 return networkAttachmentTypes [t];374 AssertMsg (!networkAttachmentTypes.value (t).isNull(), ("No text for %d", t)); 375 return networkAttachmentTypes.value (t); 389 376 } 390 377 … … 399 386 QString toString (KUSBDeviceState aState) const 400 387 { 401 AssertMsg (!USBDeviceStates [aState].isNull(), ("No text for %d", aState));402 return USBDeviceStates [aState];388 AssertMsg (!USBDeviceStates.value (aState).isNull(), ("No text for %d", aState)); 389 return USBDeviceStates.value (aState); 403 390 } 404 391 … … 513 500 514 501 static QString getExistingDirectory (const QString &aDir, QWidget *aParent, 515 const char *aName = 0,516 502 const QString &aCaption = QString::null, 517 503 bool aDirOnly = TRUE, … … 519 505 520 506 static QString getOpenFileName (const QString &, const QString &, QWidget*, 521 const char*, const QString &, 522 QString *defaultFilter = 0, 507 const QString &, QString *defaultFilter = 0, 523 508 bool resolveSymLinks = true); 524 509 … … 601 586 602 587 VBoxGlobal(); 603 ~VBoxGlobal() {}588 ~VBoxGlobal(); 604 589 605 590 void init(); … … 637 622 CVirtualBoxCallback callback; 638 623 639 typedef Q 3ValueVector <QString> QStringVector;624 typedef QVector <QString> QStringVector; 640 625 641 626 QString verString; 642 627 643 Q 3ValueVector <CGuestOSType> vm_os_types;644 Q 3Dict <QPixmap> vm_os_type_icons;645 Q 3PtrVector <QColor> vm_state_color;646 647 Q 3IntDict <QPixmap> mStateIcons;628 QVector <CGuestOSType> vm_os_types; 629 QHash <QString, QPixmap *> vm_os_type_icons; 630 QVector <QColor *> vm_state_color; 631 632 QHash <long int, QPixmap *> mStateIcons; 648 633 QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon; 649 634 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDownloaderWgt.cpp
r7722 r7763 270 270 /// the title) 271 271 QString target = vboxGlobal().getExistingDirectory ( 272 QFileInfo (mTarget).absolutePath(), this, "selectSaveDir",272 QFileInfo (mTarget).absolutePath(), this, 273 273 tr ("Select folder to save Guest Additions image to"), true); 274 274 if (target.isNull()) -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp
r7678 r7763 26 26 #include "QIMessageBox.h" 27 27 28 //Added by qt3to4:29 #include <QDesktopWidget>30 #include <QTranslator>31 #include <Q3VBoxLayout>32 #include <Q3Frame>33 #include <QEvent>34 #include <QShowEvent>35 #include <Q3PopupMenu>36 #include <Q3HBoxLayout>37 38 28 #ifdef VBOX_WITH_REGISTRATION 39 29 #include "VBoxRegistrationDlg.h" 40 30 #endif 41 31 42 #include <qapplication.h> 43 #include <qmessagebox.h> 44 #include <qpixmap.h> 45 #include <qicon.h> 46 #include <qwidget.h> 47 #include <q3filedialog.h> 48 #include <qimage.h> 49 #include <qlabel.h> 50 #include <qtoolbutton.h> 51 #include <qfileinfo.h> 52 #include <qdir.h> 53 #include <qmutex.h> 54 #include <qregexp.h> 55 #include <qlocale.h> 32 /* Qt includes */ 33 #include <QLibraryInfo> 34 #include <QDialogButtonBox> 35 #include <QFileDialog> 36 #include <QToolTip> 37 #include <QTranslator> 38 #include <QDesktopWidget> 39 #include <QMutex> 40 #include <QToolButton> 56 41 #include <QProcess> 57 #include <QList>58 42 59 43 #ifdef Q_WS_X11 60 #include < q3textbrowser.h>61 #include < qpushbutton.h>62 #include < qlayout.h>44 #include <QTextBrowser> 45 #include <QScrollBar> 46 #include <QX11Info> 63 47 #endif 64 48 … … 70 54 #if defined (Q_WS_WIN) 71 55 #include "shlobj.h" 72 #include < qeventloop.h>56 #include <QEventLoop> 73 57 #endif 74 58 … … 224 208 { 225 209 /* it's a global extra data key someone wants to change */ 226 QString sKey = QString::fromU cs2(key);227 QString sVal = QString::fromU cs2(value);210 QString sKey = QString::fromUtf16 (key); 211 QString sVal = QString::fromUtf16 (value); 228 212 if (sKey.startsWith ("GUI/")) 229 213 { … … 252 236 /* disallow the change when there is an error*/ 253 237 *error = SysAllocString ((const OLECHAR *) 254 gs.lastError().u cs2());238 gs.lastError().utf16()); 255 239 *allowChange = FALSE; 256 240 } … … 272 256 if (COMBase::ToQUuid (id).isNull()) 273 257 { 274 QString sKey = QString::fromU cs2(key);275 QString sVal = QString::fromU cs2(value);258 QString sKey = QString::fromUtf16 (key); 259 QString sVal = QString::fromUtf16 (value); 276 260 if (sKey.startsWith ("GUI/")) 277 261 { … … 487 471 if (!initDir->isEmpty()) 488 472 { 489 SendMessage (hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG (initDir->u cs2()));490 //SendMessage (hwnd, BFFM_SETEXPANDED, TRUE, Q_ULONG (initDir->u cs2()));473 SendMessage (hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG (initDir->utf16())); 474 //SendMessage (hwnd, BFFM_SETEXPANDED, TRUE, Q_ULONG (initDir->utf16())); 491 475 } 492 476 } … … 495 479 TCHAR path [MAX_PATH]; 496 480 SHGetPathFromIDList (LPITEMIDLIST (lParam), path); 497 QString tmpStr = QString::fromU cs2((ushort*)path);481 QString tmpStr = QString::fromUtf16 ((ushort*)path); 498 482 if (!tmpStr.isEmpty()) 499 483 SendMessage (hwnd, BFFM_ENABLEOK, 1, 1); … … 565 549 566 550 VBoxLicenseViewer (const QString &aFilePath) 567 : QDialog ( 0, "VBoxLicenseViewerObject")551 : QDialog () 568 552 , mFilePath (aFilePath) 569 553 , mLicenseText (0), mAgreeButton (0), mDisagreeButton (0) 570 554 { 571 set Caption("VirtualBox License");572 set Icon (QPixmap(":/ico40x01.png"));573 574 mLicenseText = new Q 3TextBrowser (this);555 setWindowTitle ("VirtualBox License"); 556 setWindowIcon (QIcon (":/ico40x01.png")); 557 558 mLicenseText = new QTextBrowser (this); 575 559 mAgreeButton = new QPushButton (tr ("I &Agree"), this); 576 560 mDisagreeButton = new QPushButton (tr ("I &Disagree"), this); 577 578 mLicenseText->setTextFormat (Qt::RichText); 561 QDialogButtonBox *dbb = new QDialogButtonBox (this); 562 dbb->addButton (mAgreeButton, QDialogButtonBox::AcceptRole); 563 dbb->addButton (mDisagreeButton, QDialogButtonBox::RejectRole); 579 564 580 565 connect (mLicenseText->verticalScrollBar(), SIGNAL (valueChanged (int)), … … 583 568 connect (mDisagreeButton, SIGNAL (clicked()), SLOT (reject())); 584 569 585 Q3VBoxLayout *mainLayout = new Q3VBoxLayout (this, 10, 10); 570 QVBoxLayout *mainLayout = new QVBoxLayout (this); 571 mainLayout->setSpacing (10); 572 VBoxGlobal::setLayoutMargin (mainLayout, 10); 586 573 mainLayout->addWidget (mLicenseText); 587 588 Q3HBoxLayout *buttonLayout = new Q3HBoxLayout (mainLayout, 10); 589 buttonLayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding, 590 QSizePolicy::Preferred)); 591 buttonLayout->addWidget (mAgreeButton); 592 buttonLayout->addWidget (mDisagreeButton); 574 mainLayout->addWidget (dbb); 593 575 594 576 mLicenseText->verticalScrollBar()->installEventFilter (this); … … 619 601 void onScrollBarMoving (int aValue) 620 602 { 621 if (aValue == mLicenseText->verticalScrollBar()->max Value())603 if (aValue == mLicenseText->verticalScrollBar()->maximum()) 622 604 unlockButtons(); 623 605 } … … 645 627 { 646 628 case QEvent::Hide: 647 if (aObject == mLicenseText->verticalScrollBar() && 648 (windowState() & Qt::WindowActive)) 629 if (aObject == mLicenseText->verticalScrollBar()) 630 /* Doesn't work on wm's like ion3 where the window starts 631 * maximized: isActiveWindow() */ 649 632 unlockButtons(); 650 633 default: … … 655 638 656 639 QString mFilePath; 657 Q 3TextBrowser *mLicenseText;640 QTextBrowser *mLicenseText; 658 641 QPushButton *mAgreeButton; 659 642 QPushButton *mDisagreeButton; … … 819 802 } 820 803 804 VBoxGlobal::~VBoxGlobal() 805 { 806 qDeleteAll (vm_os_type_icons); 807 qDeleteAll (mStateIcons); 808 qDeleteAll (vm_state_color); 809 } 810 821 811 /** 822 812 * Sets the new global settings and saves them to the VirtualBox server. … … 927 917 CGuestOSType type; 928 918 if (aIndex >= 0 && aIndex < (int) vm_os_types.count()) 929 type = vm_os_types [aIndex];919 type = vm_os_types.value (aIndex); 930 920 AssertMsg (!type.isNull(), ("Index for OS type must be valid: %d", aIndex)); 931 921 return type; … … 954 944 { 955 945 static const QPixmap none; 956 QPixmap *p = vm_os_type_icons [aId];957 AssertMsg (p, ("Icon for type `%s' must be defined", aId. latin1()));946 QPixmap *p = vm_os_type_icons.value (aId); 947 AssertMsg (p, ("Icon for type `%s' must be defined", aId.toLatin1().constData())); 958 948 return p ? *p : none; 959 949 } … … 1114 1104 { 1115 1105 for (size_t i = 0; i < ELEMENTS (comKnownPorts); ++ i) 1116 if (strcmp (comKnownPorts [i].name, aName. utf8().data()) == 0)1106 if (strcmp (comKnownPorts [i].name, aName.toUtf8().data()) == 0) 1117 1107 { 1118 1108 aIRQ = comKnownPorts [i].IRQ; … … 1133 1123 { 1134 1124 for (size_t i = 0; i < ELEMENTS (lptKnownPorts); ++ i) 1135 if (strcmp (lptKnownPorts [i].name, aName. utf8().data()) == 0)1125 if (strcmp (lptKnownPorts [i].name, aName.toUtf8().data()) == 0) 1136 1126 { 1137 1127 aIRQ = lptKnownPorts [i].IRQ; … … 1234 1224 { 1235 1225 QString details; 1236 QString m = aDevice.GetManufacturer(). stripWhiteSpace();1237 QString p = aDevice.GetProduct(). stripWhiteSpace();1226 QString m = aDevice.GetManufacturer().trimmed(); 1227 QString p = aDevice.GetProduct().trimmed(); 1238 1228 if (m.isEmpty() && p.isEmpty()) 1239 1229 { … … 1245 1235 else 1246 1236 { 1247 if (p. upper().startsWith (m.upper()))1237 if (p.toUpper().startsWith (m.toUpper())) 1248 1238 details = p; 1249 1239 else … … 1254 1244 details += QString().sprintf (" [%04hX]", r); 1255 1245 1256 return details. stripWhiteSpace();1246 return details.trimmed(); 1257 1247 } 1258 1248 … … 1818 1808 QDir docDir (path); 1819 1809 docDir.setFilter (QDir::Files); 1820 docDir.setNameFilter ("License-*.html");1810 docDir.setNameFilters (QStringList ("License-*.html")); 1821 1811 1822 1812 /* get the license files list and search for the latest license */ … … 1826 1816 { 1827 1817 QRegExp regExp ("License-([\\d\\.]+).html"); 1828 regExp. search(filesList [index]);1818 regExp.indexIn (filesList [index]); 1829 1819 QString version = regExp.cap (1); 1830 1820 if (maxVersionNumber < version.toDouble()) … … 1839 1829 /* compose the latest license file full path */ 1840 1830 QString latestVersion = QString::number (maxVersionNumber); 1841 QString latestFilePath = docDir.abs FilePath (1831 QString latestFilePath = docDir.absoluteFilePath ( 1842 1832 QString ("License-%1.html").arg (latestVersion)); 1843 1833 … … 2470 2460 2471 2461 const QPixmap *pix = aLabel->pixmap(); 2472 QImage img = pix-> convertToImage();2462 QImage img = pix->toImage(); 2473 2463 QRgb rgbBack = img.pixel (img.width() - 1, img.height() - 1); 2474 2464 QRgb rgbFrame = img.pixel (img.width() - 1, 0); … … 2491 2481 2492 2482 VBoxTranslator (QObject *aParent = 0) 2493 : QTranslator (aParent , "VBoxTranslatorObject") {}2483 : QTranslator (aParent) {} 2494 2484 2495 2485 bool loadFile (const QString &aFileName) … … 2555 2545 { 2556 2546 QRegExp regExp (gVBoxLangIDRegExp); 2557 int pos = regExp. search(langId);2547 int pos = regExp.indexIn (langId); 2558 2548 /* the language ID should match the regexp completely */ 2559 2549 AssertReturnVoid (pos == 0); … … 2563 2553 if (nlsDir.exists (gVBoxLangFileBase + langId + gVBoxLangFileExt)) 2564 2554 { 2565 languageFileName = nlsDir.abs FilePath (gVBoxLangFileBase + langId +2566 gVBoxLangFileExt);2555 languageFileName = nlsDir.absoluteFilePath (gVBoxLangFileBase + langId + 2556 gVBoxLangFileExt); 2567 2557 selectedLangId = langId; 2568 2558 } 2569 2559 else if (nlsDir.exists (gVBoxLangFileBase + lang + gVBoxLangFileExt)) 2570 2560 { 2571 languageFileName = nlsDir.abs FilePath (gVBoxLangFileBase + lang +2572 gVBoxLangFileExt);2561 languageFileName = nlsDir.absoluteFilePath (gVBoxLangFileBase + lang + 2562 gVBoxLangFileExt); 2573 2563 selectedLangId = lang; 2574 2564 } … … 2627 2617 /* We use system installations of Qt on Linux systems, so first, try 2628 2618 * to load the Qt translation from the system location. */ 2629 languageFileName = Q String (qInstallPathTranslations()) + "/qt_" +2619 languageFileName = QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" + 2630 2620 sLoadedLangId + gVBoxLangFileExt; 2631 2621 QTranslator *qtSysTr = new QTranslator (sTranslator); … … 2642 2632 * innotek translation is always the best one. */ 2643 2633 #endif 2644 languageFileName = nlsDir.abs FilePath (QString ("qt_") +2645 sLoadedLangId +2646 gVBoxLangFileExt);2634 languageFileName = nlsDir.absoluteFilePath (QString ("qt_") + 2635 sLoadedLangId + 2636 gVBoxLangFileExt); 2647 2637 QTranslator *qtTr = new QTranslator (sTranslator); 2648 2638 Assert (qtTr); … … 2686 2676 QIcon iconSet; 2687 2677 2688 iconSet.setPixmap (QPixmap (aNormal), 2689 QIcon::Large, QIcon::Normal); 2690 iconSet.setPixmap (QPixmap (aSmallNormal), 2691 QIcon::Small, QIcon::Normal); 2678 iconSet.addFile (aNormal, QSize(), QIcon::Normal); 2679 iconSet.addFile (aSmallNormal, QSize(), QIcon::Normal); 2692 2680 if (aSmallDisabled != NULL) 2693 2681 { 2694 iconSet.setPixmap (QPixmap (aDisabled), 2695 QIcon::Large, QIcon::Disabled); 2696 iconSet.setPixmap (QPixmap (aSmallDisabled), 2697 QIcon::Small, QIcon::Disabled); 2682 iconSet.addFile (aDisabled, QSize(), QIcon::Disabled); 2683 iconSet.addFile (aSmallDisabled, QSize(), QIcon::Disabled); 2698 2684 } 2699 2685 if (aSmallActive != NULL) 2700 2686 { 2701 iconSet.setPixmap (QPixmap (aActive), 2702 QIcon::Large, QIcon::Active); 2703 iconSet.setPixmap (QPixmap (aSmallActive), 2704 QIcon::Small, QIcon::Active); 2687 iconSet.addFile (aActive, QSize(), QIcon::Active); 2688 iconSet.addFile (aSmallActive, QSize(), QIcon::Active); 2705 2689 } 2706 2690 … … 2727 2711 2728 2712 /* remember the icon set as setText() will kill it */ 2729 QIcon iset = aToolButton->icon Set();2713 QIcon iset = aToolButton->icon(); 2730 2714 /* re-use the setText() method to detect and set the accelerator */ 2731 2715 aToolButton->setText (aTextLabel); 2732 QKeySequence accel = aToolButton-> accel();2733 aToolButton->setText Label(aTextLabel);2734 aToolButton->setIcon Set(iset);2716 QKeySequence accel = aToolButton->shortcut(); 2717 aToolButton->setText (aTextLabel); 2718 aToolButton->setIcon (iset); 2735 2719 /* set the accel last as setIconSet() would kill it */ 2736 aToolButton->set Accel(accel);2720 aToolButton->setShortcut (accel); 2737 2721 } 2738 2722 … … 2753 2737 int rd = aBoundRect.right() - fr.right(); 2754 2738 int bd = aBoundRect.bottom() - fr.bottom(); 2755 fr. moveBy(rd < 0 ? rd : 0, bd < 0 ? bd : 0);2739 fr.translate (rd < 0 ? rd : 0, bd < 0 ? bd : 0); 2756 2740 2757 2741 /* ensure the top left corner is visible */ 2758 2742 int ld = fr.left() - aBoundRect.left(); 2759 2743 int td = fr.top() - aBoundRect.top(); 2760 fr. moveBy(ld < 0 ? -ld : 0, td < 0 ? -td : 0);2744 fr.translate (ld < 0 ? -ld : 0, td < 0 ? -td : 0); 2761 2745 2762 2746 if (aCanResize) … … 2766 2750 bd = aBoundRect.bottom() - fr.bottom(); 2767 2751 if (rd < 0) 2768 fr. rRight() += rd;2752 fr.setRight (fr.right() + rd); 2769 2753 if (bd < 0) 2770 fr. rBottom() += bd;2754 fr.setBottom (fr.bottom() + bd); 2771 2755 } 2772 2756 … … 2874 2858 QChar VBoxGlobal::decimalSep() 2875 2859 { 2876 QString n = QLocale::system().toString (0.0, 'f', 1).stripWhiteSpace(); 2877 return n [1]; 2860 return QLocale::system().decimalPoint(); 2878 2861 } 2879 2862 … … 2909 2892 { 2910 2893 QRegExp regexp (sizeRegexp()); 2911 int pos = regexp. search(aText);2894 int pos = regexp.indexIn (aText); 2912 2895 if (pos != -1) 2913 2896 { … … 2940 2923 return intg; 2941 2924 2942 Q_UINT64 hund = hundS.rightJustif y(2, '0').toULongLong();2925 Q_UINT64 hund = hundS.rightJustified (2, '0').toULongLong(); 2943 2926 hund = hund * denom / 100; 2944 2927 intg = intg * denom + hund; … … 3043 3026 } 3044 3027 number = QString ("%1%2%3").arg (intg).arg (decimalSep()) 3045 .arg (QString::number (hund).rightJustif y(2, '0'));3028 .arg (QString::number (hund).rightJustified (2, '0')); 3046 3029 } 3047 3030 else … … 3156 3139 */ 3157 3140 QString VBoxGlobal::getExistingDirectory (const QString &aDir, 3158 QWidget *aParent, const char *aName,3141 QWidget *aParent, 3159 3142 const QString &aCaption, 3160 3143 bool aDirOnly, … … 3203 3186 bi.hwndOwner = topParent ? topParent->winId() : 0; 3204 3187 bi.pidlRoot = NULL; 3205 bi.lpszTitle = (TCHAR*)title.u cs2();3188 bi.lpszTitle = (TCHAR*)title.utf16(); 3206 3189 bi.pszDisplayName = initPath; 3207 3190 bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; … … 3229 3212 pMalloc->Free (itemIdList); 3230 3213 pMalloc->Release(); 3231 result = QString::fromU cs2((ushort*)path);3214 result = QString::fromUtf16 ((ushort*)path); 3232 3215 } 3233 3216 } … … 3259 3242 #else 3260 3243 3261 return Q3FileDialog::getExistingDirectory (aDir, aParent, aName, aCaption, 3262 aDirOnly, aResolveSymlinks); 3244 QFileDialog::Options o; 3245 if (aDirOnly) 3246 o = QFileDialog::ShowDirsOnly; 3247 if (!aResolveSymlinks) 3248 o |= QFileDialog::DontResolveSymlinks; 3249 return QFileDialog::getExistingDirectory (aParent, aCaption, aDir, o); 3263 3250 3264 3251 #endif … … 3269 3256 * oddities and limitations. 3270 3257 * 3271 * On Win32, this func iton makes sure a file filter is applied automatically3258 * On Win32, this function makes sure a file filter is applied automatically 3272 3259 * right after it is selected from the drop-down list, to conform to common 3273 3260 * experience in other applications. Note that currently, @a selectedFilter … … 3281 3268 const QString &aFilters, 3282 3269 QWidget *aParent, 3283 const char *aName,3284 3270 const QString &aCaption, 3285 3271 QString *aSelectedFilter, … … 3343 3329 TCHAR buf [1024]; 3344 3330 if (initSel.length() > 0 && initSel.length() < sizeof (buf)) 3345 memcpy (buf, initSel.u cs2(), (initSel.length() + 1) * sizeof (TCHAR));3331 memcpy (buf, initSel.utf16(), (initSel.length() + 1) * sizeof (TCHAR)); 3346 3332 else 3347 3333 buf [0] = 0; … … 3352 3338 ofn.lStructSize = sizeof (OPENFILENAME); 3353 3339 ofn.hwndOwner = topParent ? topParent->winId() : 0; 3354 ofn.lpstrFilter = (TCHAR *) winFilters.u cs2();3340 ofn.lpstrFilter = (TCHAR *) winFilters.utf16(); 3355 3341 ofn.lpstrFile = buf; 3356 3342 ofn.nMaxFile = sizeof (buf) - 1; 3357 ofn.lpstrInitialDir = (TCHAR *) workDir.u cs2();3358 ofn.lpstrTitle = (TCHAR *) title.u cs2();3343 ofn.lpstrInitialDir = (TCHAR *) workDir.utf16(); 3344 ofn.lpstrTitle = (TCHAR *) title.utf16(); 3359 3345 ofn.Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | 3360 3346 OFN_EXPLORER | OFN_ENABLEHOOK | … … 3364 3350 if (GetOpenFileName (&ofn)) 3365 3351 { 3366 result = QString::fromU cs2((ushort *) ofn.lpstrFile);3352 result = QString::fromUtf16 ((ushort *) ofn.lpstrFile); 3367 3353 } 3368 3354 … … 3401 3387 #else 3402 3388 3403 return Q3FileDialog::getOpenFileName (aStartWith, aFilters, aParent, aName, 3404 aCaption, aSelectedFilter, aResolveSymlinks); 3405 3389 QFileDialog::Options o; 3390 if (!aResolveSymlinks) 3391 o |= QFileDialog::DontResolveSymlinks; 3392 return QFileDialog::getOpenFileName (aParent, aCaption, aStartWith, 3393 aFilters, aSelectedFilter, o); 3406 3394 #endif 3407 3395 } … … 3419 3407 while (!dir.exists() && !dir.isRoot()) 3420 3408 { 3421 QFileInfo dirInfo (dir.abs Path());3422 dir = dirInfo. dirPath (true);3409 QFileInfo dirInfo (dir.absolutePath()); 3410 dir = dirInfo.absolutePath(); 3423 3411 } 3424 3412 if (dir.exists() && !dir.isRoot()) 3425 result = dir.abs Path();3413 result = dir.absolutePath(); 3426 3414 return result; 3427 3415 } … … 3513 3501 #elif defined (Q_WS_X11) 3514 3502 3515 Display *dpy = Q PaintDevice::x11AppDisplay();3503 Display *dpy = QX11Info::display(); 3516 3504 3517 3505 if (aSwitchDesktop) … … 3589 3577 3590 3578 QRegExp accel ("\\(&[a-zA-Z]\\)"); 3591 int pos = accel. search(result);3579 int pos = accel.indexIn (result); 3592 3580 if (pos >= 0) 3593 3581 result.remove (pos, accel.cap().length()); 3594 3582 else 3595 3583 { 3596 pos = result. find('&');3584 pos = result.indexOf ('&'); 3597 3585 if (pos >= 0) 3598 3586 result.remove (pos, 1); … … 3668 3656 void run() 3669 3657 { 3670 int rc = (int) ShellExecute (NULL, NULL, mURL.u cs2(), NULL, NULL, SW_SHOW);3658 int rc = (int) ShellExecute (NULL, NULL, mURL.utf16(), NULL, NULL, SW_SHOW); 3671 3659 bool ok = rc > 32; 3672 3660 QApplication::postEvent … … 3752 3740 mRegDlg->setWindowState (mRegDlg->windowState() & ~Qt::WindowMinimized); 3753 3741 mRegDlg->raise(); 3754 mRegDlg-> setActiveWindow();3742 mRegDlg->activateWindow(); 3755 3743 } 3756 3744 else … … 3967 3955 {"l4", ":/os_l4.png"}, 3968 3956 }; 3969 vm_os_type_icons.setAutoDelete (true); /* takes ownership of elements */3970 3957 for (uint n = 0; n < SIZEOF_ARRAY (kOSTypeIcons); n ++) 3971 3958 { … … 3995 3982 {KMachineState_Discarding, ":/state_discarding_16px.png"}, 3996 3983 }; 3997 mStateIcons.setAutoDelete (true); // takes ownership of elements3998 3984 for (uint n = 0; n < SIZEOF_ARRAY (vmStateIcons); n ++) 3999 3985 { … … 4007 3993 4008 3994 /* initialize state colors vector */ 4009 vm_state_color.setAutoDelete (true); /* takes ownership of elements */4010 3995 vm_state_color.insert (KMachineState_Null, new QColor(Qt::red)); 4011 3996 vm_state_color.insert (KMachineState_PoweredOff, new QColor(Qt::gray)); -
trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxDiskImageManagerDlg.ui.h
r7447 r7763 18 18 #include <QMenuItem> 19 19 #include <QDir> 20 #include <QToolTip> 20 21 /** 21 22 * … … 2015 2016 } 2016 2017 2017 QString src = VBoxGlobal::getOpenFileName (dir, filter, this, 2018 "AddDiskImageDialog", title); 2018 QString src = VBoxGlobal::getOpenFileName (dir, filter, this, title); 2019 2019 src = QDir::convertSeparators (src); 2020 2020 -
trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxGlobalSettingsDlg.ui.h
r7678 r7763 843 843 844 844 QString path = le == leVRDPLib ? 845 VBoxGlobal::getOpenFileName (initDir, QString::null, this, 846 "getFile", QString::null) : 845 VBoxGlobal::getOpenFileName (initDir, QString::null, this, QString::null) : 847 846 VBoxGlobal::getExistingDirectory (initDir, this); 848 847 if (path.isNull()) -
trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMLogViewer.ui.h
r7250 r7763 10 10 #include <Q3VBoxLayout> 11 11 #include <QShowEvent> 12 #include <QToolTip> 12 13 /** 13 14 * -
trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsDlg.ui.h
r7678 r7763 9 9 #include <QEvent> 10 10 #include <Q3VBoxLayout> 11 #include <QToolTip> 11 12 /** 12 13 *
Note:
See TracChangeset
for help on using the changeset viewer.