Changeset 81442 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 22, 2019 8:39:20 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 134160
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r81401 r81442 2408 2408 } 2409 2409 2410 bool UIMessageCenter::confirmSoftKeyboardClose() const 2411 { 2412 return questionBinary(0, MessageType_Warning, 2413 tr("There are not saved layouts? Closing this dialog will cause loosing the changed. Proceed?"), 2414 0 /* auto-confirm id */, 2415 "Ok", "Cancel"); 2416 2417 2418 2419 // bool questionBinary(QWidget *pParent, MessageType enmType, 2420 // const QString &strMessage, 2421 // const char *pcszAutoConfirmId = 0, 2422 // const QString &strOkButtonText = QString(), 2423 // const QString &strCancelButtonText = QString(), 2424 // bool fDefaultFocusForOk = true) const; 2425 2426 } 2427 2410 2428 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 2411 2429 bool UIMessageCenter::confirmCancelingAllNetworkRequests() const -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r80215 r81442 446 446 void cannotSwitchScreenInSeamless(quint64 uMinVRAM) const; 447 447 void cannotAddDiskEncryptionPassword(const CConsole &console); 448 bool confirmSoftKeyboardClose() const; 448 449 449 450 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER -
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r81405 r81442 512 512 UIKeyCaptions keyCaptions(int iKeyPosition) const; 513 513 514 bool operator==(const UISoftKeyboardLayout &otherLayout) ;514 bool operator==(const UISoftKeyboardLayout &otherLayout) const; 515 515 516 516 QString baseCaption(int iKeyPosition) const; … … 518 518 QString altGrCaption(int iKeyPosition) const; 519 519 QString shiftAltGrCaption(int iKeyPosition) const; 520 521 void setEditedBuNotSaved(bool fEditedButNotsaved); 522 bool editedButNotSaved() const; 520 523 521 524 void setUid(const QUuid &uid); … … 537 540 bool m_fEditable; 538 541 bool m_fIsFromResources; 542 bool m_fEditedButNotSaved; 539 543 QUuid m_uid; 540 544 }; … … 650 654 void parentDialogDeactivated(); 651 655 bool isColorThemeEditable() const; 656 bool unsavedLayoutsExist() const; 652 657 653 658 protected: … … 1249 1254 connect(m_pShiftAltGrCaptionEdit, &QLineEdit::textChanged, this, &UIKeyboardLayoutEditor::sltCaptionsUpdate); 1250 1255 1251 1252 1256 QSpacerItem *pSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding); 1253 1257 if (pSpacer) … … 1314 1318 if (pItem->data(Qt::UserRole).toUuid() == layoutUid) 1315 1319 pFoundItem = pItem; 1316 1317 1320 } 1318 1321 if (!pFoundItem) … … 1765 1768 : m_fEditable(true) 1766 1769 , m_fIsFromResources(false) 1770 , m_fEditedButNotSaved(false) 1767 1771 , m_uid(QUuid::createUuid()) 1768 1772 { … … 1784 1788 { 1785 1789 m_strSourceFilePath = strSourceFilePath; 1790 setEditedBuNotSaved(true); 1786 1791 } 1787 1792 … … 1794 1799 { 1795 1800 m_fIsFromResources = fIsFromResources; 1801 setEditedBuNotSaved(true); 1796 1802 } 1797 1803 … … 1804 1810 { 1805 1811 m_strName = strName; 1812 setEditedBuNotSaved(true); 1806 1813 } 1807 1814 … … 1814 1821 { 1815 1822 m_strNativeName = strNativeName; 1823 setEditedBuNotSaved(true); 1816 1824 } 1817 1825 … … 1824 1832 { 1825 1833 m_fEditable = fEditable; 1834 setEditedBuNotSaved(true); 1826 1835 } 1827 1836 … … 1834 1843 { 1835 1844 m_physicalLayoutUuid = uuid; 1845 setEditedBuNotSaved(true); 1836 1846 } 1837 1847 … … 1848 1858 /* Updating the captions invalidates the cached font size. We set it to 0, thereby forcing its recomputaion: */ 1849 1859 m_keyCaptionsFontSizeMap[iKeyPosition] = 0; 1860 setEditedBuNotSaved(true); 1850 1861 } 1851 1862 … … 1855 1866 } 1856 1867 1857 bool UISoftKeyboardLayout::operator==(const UISoftKeyboardLayout &otherLayout) 1868 bool UISoftKeyboardLayout::operator==(const UISoftKeyboardLayout &otherLayout) const 1858 1869 { 1859 1870 if (m_strName != otherLayout.m_strName) … … 1898 1909 } 1899 1910 1911 void UISoftKeyboardLayout::setEditedBuNotSaved(bool fEditedButNotsaved) 1912 { 1913 m_fEditedButNotSaved = fEditedButNotsaved; 1914 } 1915 1916 bool UISoftKeyboardLayout::editedButNotSaved() const 1917 { 1918 return m_fEditedButNotSaved; 1919 } 1920 1900 1921 void UISoftKeyboardLayout::setUid(const QUuid &uid) 1901 1922 { 1902 1923 m_uid = uid; 1924 setEditedBuNotSaved(true); 1903 1925 } 1904 1926 … … 2396 2418 xmlFile.close(); 2397 2419 m_pCurrentKeyboardLayout->setSourceFilePath(strFileName); 2420 m_pCurrentKeyboardLayout->setEditedBuNotSaved(false); 2398 2421 sigStatusBarMessage(QString("%1 %2").arg(strFileName).arg(UISoftKeyboard::tr(" is saved"))); 2399 2422 } … … 2409 2432 strNewNativeName= QString("%1-%2").arg(newLayout.nativeName()).arg(UISoftKeyboard::tr("Copy")); 2410 2433 newLayout.setName(strNewName); 2434 newLayout.setEditedBuNotSaved(true); 2411 2435 newLayout.setNativeName(strNewNativeName); 2412 2436 newLayout.setEditable(true); … … 2545 2569 return false; 2546 2570 return m_currentColorTheme->isEditable(); 2571 } 2572 2573 bool UISoftKeyboardWidget::unsavedLayoutsExist() const 2574 { 2575 foreach (const UISoftKeyboardLayout &layout, m_layouts) 2576 { 2577 if (layout.editedButNotSaved()) 2578 return true; 2579 } 2580 return false; 2547 2581 } 2548 2582 … … 3005 3039 if (m_layouts.isEmpty()) 3006 3040 return; 3041 for (int i = 0; i < m_layouts.size(); ++i) 3042 m_layouts[i].setEditedBuNotSaved(false); 3007 3043 setCurrentLayout(&(m_layouts[0])); 3008 3044 } … … 3759 3795 } 3760 3796 3797 void UISoftKeyboard::closeEvent(QCloseEvent *event) 3798 { 3799 /* Show a warning dialog when there are not saved layouts: */ 3800 if (m_pKeyboardWidget && m_pKeyboardWidget->unsavedLayoutsExist()) 3801 { 3802 if (msgCenter().confirmSoftKeyboardClose()) 3803 QMainWindowWithRestorableGeometryAndRetranslateUi::closeEvent(event); 3804 else 3805 event->ignore(); 3806 return; 3807 } 3808 QMainWindowWithRestorableGeometryAndRetranslateUi::closeEvent(event); 3809 } 3810 3761 3811 bool UISoftKeyboard::event(QEvent *pEvent) 3762 3812 { -
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h
r81303 r81442 64 64 virtual void retranslateUi() /* override */; 65 65 virtual bool shouldBeMaximized() const /* override */; 66 virtual void closeEvent(QCloseEvent *event) /* override */; 66 67 bool event(QEvent *pEvent) /* override */; 67 68
Note:
See TracChangeset
for help on using the changeset viewer.