Changeset 50959 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 3, 2014 10:37:49 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93116
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r50939 r50959 921 921 /* Prepare this: */ 922 922 prepareThis(); 923 /* Prepare actions: */924 prepareActions();925 /* Prepare menu-bar: */926 prepareMenuBar();927 /* Prepare tool-bar: */928 prepareToolBar();929 /* Prepare context-menu: */930 prepareContextMenu();931 /* Prepare tab-widget: */932 prepareTabWidget();933 /* Prepare tree-widgets: */934 prepareTreeWidgets();935 /* Prepare information-panes: */936 prepareInformationPanes();937 /* Prepare button-box: */938 prepareButtonBox();939 /* Prepare progress-bar: */940 prepareProgressBar();941 923 942 924 /* Translate dialog: */ … … 974 956 /* Dialog should delete itself on 'close': */ 975 957 setAttribute(Qt::WA_DeleteOnClose); 976 977 958 /* And no need to count it as important for application. 978 959 * This way it will NOT be taken into account … … 987 968 Ui::UIMediumManager::setupUi(this); 988 969 970 /* Prepare connections: */ 971 prepareConnections(); 972 /* Prepare actions: */ 973 prepareActions(); 974 /* Prepare central-widget: */ 975 prepareCentralWidget(); 976 } 977 978 void UIMediumManager::prepareConnections() 979 { 989 980 /* Configure medium-processing connections: */ 990 981 connect(&vboxGlobal(), SIGNAL(sigMediumCreated(const QString&)), … … 1046 1037 /* Update action icons: */ 1047 1038 updateActionIcons(); 1039 1040 /* Prepare menu-bar: */ 1041 prepareMenuBar(); 1042 /* Prepare context-menu: */ 1043 prepareContextMenu(); 1048 1044 } 1049 1045 … … 1060 1056 m_pMenu->addAction(m_pActionRefresh); 1061 1057 } 1058 } 1059 1060 void UIMediumManager::prepareContextMenu() 1061 { 1062 /* Create context-menu: */ 1063 m_pContextMenu = new QMenu(this); 1064 { 1065 /* Configure contex-menu: */ 1066 m_pContextMenu->addAction(m_pActionCopy); 1067 m_pContextMenu->addAction(m_pActionModify); 1068 m_pContextMenu->addAction(m_pActionRemove); 1069 m_pContextMenu->addAction(m_pActionRelease); 1070 } 1071 } 1072 1073 void UIMediumManager::prepareCentralWidget() 1074 { 1075 /* Prepare tool-bar: */ 1076 prepareToolBar(); 1077 /* Prepare tab-widget: */ 1078 prepareTabWidget(); 1079 /* Prepare button-box: */ 1080 prepareButtonBox(); 1062 1081 } 1063 1082 … … 1097 1116 } 1098 1117 1099 void UIMediumManager::prepareContextMenu()1100 {1101 /* Create context-menu: */1102 m_pContextMenu = new QMenu(this);1103 {1104 /* Configure contex-menu: */1105 m_pContextMenu->addAction(m_pActionCopy);1106 m_pContextMenu->addAction(m_pActionModify);1107 m_pContextMenu->addAction(m_pActionRemove);1108 m_pContextMenu->addAction(m_pActionRelease);1109 }1110 }1111 1112 1118 void UIMediumManager::prepareTabWidget() 1113 1119 { … … 1120 1126 mTabWidget->setTabIcon(TabIndex_FD, m_iconFD); 1121 1127 connect(mTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandleCurrentTabChanged())); 1128 /* Prepare tree-widgets: */ 1129 prepareTreeWidgets(); 1130 /* Prepare information-panes: */ 1131 prepareInformationPanes(); 1122 1132 } 1123 1133 } … … 1231 1241 connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept())); 1232 1242 connect(mButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog())); 1243 /* Prepare progress-bar: */ 1244 prepareProgressBar(); 1233 1245 } 1234 1246 } … … 1855 1867 } 1856 1868 1869 QTreeWidget* UIMediumManager::treeWidget(UIMediumType type) const 1870 { 1871 /* Return corresponding tree-widget for known medium types: */ 1872 switch (type) 1873 { 1874 case UIMediumType_HardDisk: return mTwHD; 1875 case UIMediumType_DVD: return mTwCD; 1876 case UIMediumType_Floppy: return mTwFD; 1877 default: AssertMsgFailed(("Unknown medium type: %d\n", type)); break; 1878 } 1879 /* Null by default: */ 1880 return 0; 1881 } 1882 1883 UIMediumItem* UIMediumManager::mediumItem(UIMediumType type) const 1884 { 1885 /* Get corresponding tree-widget: */ 1886 QTreeWidget *pTreeWidget = treeWidget(type); 1887 /* Return corresponding medium-item: */ 1888 return pTreeWidget ? toMediumItem(pTreeWidget->currentItem()) : 0; 1889 } 1890 1857 1891 UIMediumType UIMediumManager::currentMediumType() const 1858 1892 { … … 1869 1903 } 1870 1904 1871 QTreeWidget* UIMediumManager::treeWidget(UIMediumType type) const1872 {1873 /* Return corresponding tree-widget for known medium types: */1874 switch (type)1875 {1876 case UIMediumType_HardDisk: return mTwHD;1877 case UIMediumType_DVD: return mTwCD;1878 case UIMediumType_Floppy: return mTwFD;1879 default: AssertMsgFailed(("Unknown medium type: %d\n", type)); break;1880 }1881 /* Null by default: */1882 return 0;1883 }1884 1885 1905 QTreeWidget* UIMediumManager::currentTreeWidget() const 1886 1906 { 1887 1907 /* Return current tree-widget: */ 1888 1908 return treeWidget(currentMediumType()); 1889 }1890 1891 UIMediumItem* UIMediumManager::mediumItem(UIMediumType type) const1892 {1893 /* Get corresponding tree-widget: */1894 QTreeWidget *pTreeWidget = treeWidget(type);1895 /* Return corresponding medium-item: */1896 return pTreeWidget ? toMediumItem(pTreeWidget->currentItem()) : 0;1897 1909 } 1898 1910 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r50939 r50959 104 104 /** Prepare dialog. */ 105 105 void prepareThis(); 106 /** Prepare connections. */ 107 void prepareConnections(); 106 108 /** Prepare actions. */ 107 109 void prepareActions(); 108 110 /** Prepare menu-bar. */ 109 111 void prepareMenuBar(); 112 /** Prepare context-menu. */ 113 void prepareContextMenu(); 114 /** Prepare central-widget. */ 115 void prepareCentralWidget(); 110 116 /** Prepare tool-bar. */ 111 117 void prepareToolBar(); 112 /** Prepare context-menu. */113 void prepareContextMenu();114 118 /** Prepare tab-widget. */ 115 119 void prepareTabWidget(); … … 177 181 void deleteMediumItem(const QString &strMediumID); 178 182 179 /** Determines medium type for passed @a pTreeWidget. */183 /** Returns medium type for passed @a pTreeWidget. */ 180 184 UIMediumType mediumType(QTreeWidget *pTreeWidget) const; 185 /** Returns tree-widget for passed medium @a type. */ 186 QTreeWidget* treeWidget(UIMediumType type) const; 187 /** Returns item for passed medium @a type. */ 188 UIMediumItem* mediumItem(UIMediumType type) const; 181 189 182 190 /** Returns current medium type. */ 183 191 UIMediumType currentMediumType() const; 184 185 /** Returns tree-widget for passed medium @a type. */186 QTreeWidget* treeWidget(UIMediumType type) const;187 192 /** Returns current tree-widget. */ 188 193 QTreeWidget* currentTreeWidget() const; 189 190 /** Returns item for passed medium @a type. */191 UIMediumItem* mediumItem(UIMediumType type) const;192 194 /** Returns current item. */ 193 195 UIMediumItem* currentMediumItem() const;
Note:
See TracChangeset
for help on using the changeset viewer.