Changeset 103169 in vbox
- Timestamp:
- Feb 1, 2024 5:51:58 PM (10 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp
r102712 r103169 68 68 #ifdef VBOX_WS_MAC 69 69 # include "VBoxUtils.h" 70 #endif71 72 #ifdef VBOX_WS_MAC73 //# define VBOX_GUI_WITH_TOOLBAR_SETTINGS74 #endif75 76 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS77 # include "QIToolBar.h"78 70 #endif 79 71 … … 783 775 void UIAdvancedSettingsDialog::sltCategoryChanged(int cId) 784 776 { 785 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS786 setWindowTitle(title());787 #endif788 789 777 /* Cache current page ID for reusing: */ 790 778 m_iPageId = cId; … … 1354 1342 void UIAdvancedSettingsDialog::prepareSelector() 1355 1343 { 1356 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS1357 /* Prepare modern tool-bar selector: */1358 m_pSelector = new UISettingsSelectorToolBar(this);1359 if (m_pSelector)1360 {1361 static_cast<QIToolBar*>(m_pSelector->widget())->enableMacToolbar();1362 addToolBar(qobject_cast<QToolBar*>(m_pSelector->widget()));1363 }1364 1365 /* No title in this mode, we change the title of the window: */1366 m_pLayoutMain->setColumnMinimumWidth(0, 0);1367 m_pLayoutMain->setHorizontalSpacing(0);1368 1369 #else /* !VBOX_GUI_WITH_TOOLBAR_SETTINGS */1370 1371 1344 /* Make sure there is a serious spacing between selector and pages: */ 1372 1345 m_pLayoutMain->setColumnMinimumWidth(1, 20); … … 1401 1374 m_pLayoutMain->addWidget(m_pEditorFilter, 0, 2); 1402 1375 } 1403 #endif /* !VBOX_GUI_WITH_TOOLBAR_SETTINGS */1404 1376 1405 1377 /* Configure selector created above: */ 1406 1378 if (m_pSelector) 1407 connect(m_pSelector, &UISettingsSelectorTree Widget::sigCategoryChanged,1379 connect(m_pSelector, &UISettingsSelectorTreeView::sigCategoryChanged, 1408 1380 this, &UIAdvancedSettingsDialog::sltCategoryChanged); 1409 1381 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialogSpecific.cpp
r102160 r103169 71 71 #include "CUSBController.h" 72 72 73 #ifdef VBOX_WS_MAC74 //# define VBOX_GUI_WITH_TOOLBAR_SETTINGS75 #endif76 77 73 78 74 /********************************************************************************************************************************* … … 178 174 QString UIAdvancedSettingsDialogGlobal::titleExtension() const 179 175 { 180 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS181 return m_pSelector->itemText(m_pSelector->currentId());182 #else183 176 return tr("Preferences"); 184 #endif185 177 } 186 178 … … 493 485 QString UIAdvancedSettingsDialogMachine::titleExtension() const 494 486 { 495 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS496 return m_pSelector->itemText(m_pSelector->currentId());497 #else498 487 return tr("Settings"); 499 #endif500 488 } 501 489 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.cpp
r102707 r103169 31 31 #include <QAction> 32 32 #include <QActionGroup> 33 #include <QHeaderView>34 33 #include <QItemDelegate> 35 34 #include <QLayout> … … 42 41 #include "QITabWidget.h" 43 42 #include "QITreeView.h" 44 #include "QITreeWidget.h"45 43 #include "UICommon.h" 46 44 #include "UIDesktopWidgetWatchdog.h" … … 1083 1081 1084 1082 1085 /*********************************************************************************************************************************1086 * Class UISettingsSelectorTreeWidget implementation. *1087 *********************************************************************************************************************************/1088 1089 UISettingsSelectorTreeWidget::UISettingsSelectorTreeWidget(QWidget *pParent /* = 0 */)1090 : UISettingsSelector(pParent)1091 , m_pTreeWidget(0)1092 {1093 prepare();1094 }1095 1096 UISettingsSelectorTreeWidget::~UISettingsSelectorTreeWidget()1097 {1098 /* Cleanup the tree-widget: */1099 delete m_pTreeWidget;1100 m_pTreeWidget = 0;1101 }1102 1103 QWidget *UISettingsSelectorTreeWidget::widget() const1104 {1105 return m_pTreeWidget;1106 }1107 1108 QWidget *UISettingsSelectorTreeWidget::addItem(const QString & /* strBigIcon */,1109 const QString &strMediumIcon ,1110 const QString & /* strSmallIcon */,1111 int iID,1112 const QString &strLink,1113 UISettingsPage *pPage /* = 0 */,1114 int iParentID /* = -1 */)1115 {1116 QWidget *pResult = 0;1117 if (pPage)1118 {1119 /* Adjust page a bit: */1120 pPage->setContentsMargins(0, 0, 0, 0);1121 if (pPage->layout())1122 pPage->layout()->setContentsMargins(0, 0, 0, 0);1123 pResult = pPage;1124 1125 /* Add selector-item object: */1126 const QIcon icon = UIIconPool::iconSet(strMediumIcon);1127 UISelectorItem *pItem = new UISelectorItem(icon, iID, strLink, pPage, iParentID);1128 if (pItem)1129 m_list.append(pItem);1130 1131 /* Add tree-widget item: */1132 QITreeWidgetItem *pTwItem = new QITreeWidgetItem(m_pTreeWidget, QStringList() << QString("")1133 << idToString(iID)1134 << strLink);1135 if (pTwItem)1136 pTwItem->setIcon(TreeWidgetSection_Category, pItem->icon());1137 }1138 return pResult;1139 }1140 1141 void UISettingsSelectorTreeWidget::setItemText(int iID, const QString &strText)1142 {1143 /* Call to base-class: */1144 UISettingsSelector::setItemText(iID, strText);1145 1146 /* Look for the tree-widget item to assign the text: */1147 QTreeWidgetItem *pItem = findItem(m_pTreeWidget, idToString(iID), TreeWidgetSection_Id);1148 if (pItem)1149 pItem->setText(TreeWidgetSection_Category, QString(" %1 ").arg(strText));1150 }1151 1152 QString UISettingsSelectorTreeWidget::itemText(int iID) const1153 {1154 return pagePath(idToString(iID));1155 }1156 1157 int UISettingsSelectorTreeWidget::currentId() const1158 {1159 int iID = -1;1160 const QTreeWidgetItem *pItem = m_pTreeWidget->currentItem();1161 if (pItem)1162 iID = pItem->text(TreeWidgetSection_Id).toInt();1163 return iID;1164 }1165 1166 int UISettingsSelectorTreeWidget::linkToId(const QString &strLink) const1167 {1168 int iID = -1;1169 const QTreeWidgetItem *pItem = findItem(m_pTreeWidget, strLink, TreeWidgetSection_Link);1170 if (pItem)1171 iID = pItem->text(TreeWidgetSection_Id).toInt();1172 return iID;1173 }1174 1175 void UISettingsSelectorTreeWidget::selectById(int iID, bool)1176 {1177 QTreeWidgetItem *pItem = findItem(m_pTreeWidget, idToString(iID), TreeWidgetSection_Id);1178 if (pItem)1179 m_pTreeWidget->setCurrentItem(pItem);1180 }1181 1182 void UISettingsSelectorTreeWidget::polish()1183 {1184 /* Get recommended size hint: */1185 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);1186 const int iItemWidth = static_cast<QAbstractItemView*>(m_pTreeWidget)->sizeHintForColumn(TreeWidgetSection_Category);1187 const int iItemHeight = qMax((int)(iIconMetric * 1.5) /* icon height */,1188 m_pTreeWidget->fontMetrics().height() /* text height */)1189 + 4 /* margin itself */ * 2 /* margin count */;1190 1191 /* Set final size hint for items: */1192 m_pTreeWidget->setSizeHintForItems(QSize(iItemWidth , iItemHeight));1193 1194 /* Adjust selector width/height: */1195 m_pTreeWidget->setFixedWidth(iItemWidth + 2 * m_pTreeWidget->frameWidth());1196 m_pTreeWidget->setMinimumHeight( m_pTreeWidget->topLevelItemCount() * iItemHeight1197 + 1 /* margin itself */ * 2 /* margin count */);1198 1199 /* Sort selector by the id column: */1200 m_pTreeWidget->sortItems(TreeWidgetSection_Id, Qt::AscendingOrder);1201 1202 /* Resize column(s) to content: */1203 m_pTreeWidget->resizeColumnToContents(TreeWidgetSection_Category);1204 }1205 1206 void UISettingsSelectorTreeWidget::sltSettingsGroupChanged(QTreeWidgetItem *pItem, QTreeWidgetItem * /* pPrevItem */)1207 {1208 if (pItem)1209 {1210 const int iID = pItem->text(TreeWidgetSection_Id).toInt();1211 Assert(iID >= 0);1212 emit sigCategoryChanged(iID);1213 }1214 }1215 1216 void UISettingsSelectorTreeWidget::prepare()1217 {1218 /* Prepare the tree-widget: */1219 m_pTreeWidget = new QITreeWidget(qobject_cast<QWidget*>(parent()));1220 if (m_pTreeWidget)1221 {1222 /* Configure tree-widget: */1223 m_pTreeWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);1224 m_pTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);1225 m_pTreeWidget->setRootIsDecorated(false);1226 m_pTreeWidget->setUniformRowHeights(true);1227 /* Adjust size-policy: */1228 QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);1229 m_pTreeWidget->setSizePolicy(sizePolicy);1230 /* Adjust icon size: */1231 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);1232 m_pTreeWidget->setIconSize(QSize((int)(1.5 * iIconMetric), (int)(1.5 * iIconMetric)));1233 /* Add the columns, hide unnecessary columns and header: */1234 m_pTreeWidget->setColumnCount(TreeWidgetSection_Max);1235 m_pTreeWidget->header()->hide();1236 m_pTreeWidget->hideColumn(TreeWidgetSection_Id);1237 m_pTreeWidget->hideColumn(TreeWidgetSection_Link);1238 /* Setup connections: */1239 connect(m_pTreeWidget, &QITreeWidget::currentItemChanged,1240 this, &UISettingsSelectorTreeWidget::sltSettingsGroupChanged);1241 }1242 }1243 1244 QString UISettingsSelectorTreeWidget::pagePath(const QString &strMatch) const1245 {1246 const QTreeWidgetItem *pTreeItem = findItem(m_pTreeWidget, strMatch, TreeWidgetSection_Id);1247 return path(pTreeItem);1248 }1249 1250 QTreeWidgetItem *UISettingsSelectorTreeWidget::findItem(QTreeWidget *pView, const QString &strMatch, int iColumn) const1251 {1252 const QList<QTreeWidgetItem*> list = pView->findItems(strMatch, Qt::MatchExactly, iColumn);1253 return list.count() ? list.first() : 0;1254 }1255 1256 QString UISettingsSelectorTreeWidget::idToString(int iID) const1257 {1258 return QString("%1").arg(iID, 2, 10, QLatin1Char('0'));1259 }1260 1261 /* static */1262 QString UISettingsSelectorTreeWidget::path(const QTreeWidgetItem *pItem)1263 {1264 static QString strSep = ": ";1265 QString strPath;1266 const QTreeWidgetItem *pCurrentItem = pItem;1267 while (pCurrentItem)1268 {1269 if (!strPath.isNull())1270 strPath = strSep + strPath;1271 strPath = pCurrentItem->text(TreeWidgetSection_Category).simplified() + strPath;1272 pCurrentItem = pCurrentItem->parent();1273 }1274 return strPath;1275 }1276 1277 1278 /*********************************************************************************************************************************1279 * Class UISettingsSelectorToolBar implementation. *1280 *********************************************************************************************************************************/1281 1282 UISettingsSelectorToolBar::UISettingsSelectorToolBar(QWidget *pParent /* = 0 */)1283 : UISettingsSelector(pParent)1284 , m_pToolBar(0)1285 , m_pActionGroup(0)1286 {1287 prepare();1288 }1289 1290 UISettingsSelectorToolBar::~UISettingsSelectorToolBar()1291 {1292 /* Cleanup the action group: */1293 delete m_pActionGroup;1294 m_pActionGroup = 0;1295 1296 /* Cleanup the toolbar: */1297 delete m_pToolBar;1298 m_pToolBar = 0;1299 }1300 1301 QWidget *UISettingsSelectorToolBar::widget() const1302 {1303 return m_pToolBar;1304 }1305 1306 QWidget *UISettingsSelectorToolBar::addItem(const QString &strBigIcon,1307 const QString & /* strMediumIcon */,1308 const QString &strSmallIcon,1309 int iID,1310 const QString &strLink,1311 UISettingsPage *pPage /* = 0 */,1312 int iParentID /* = -1 */)1313 {1314 const QIcon icon = UIIconPool::iconSet(strBigIcon);1315 1316 QWidget *pResult = 0;1317 UISelectorActionItem *pItem = new UISelectorActionItem(icon, iID, strLink, pPage, iParentID, this);1318 m_list.append(pItem);1319 1320 if (iParentID == -1 &&1321 pPage != 0)1322 {1323 m_pActionGroup->addAction(pItem->action());1324 m_pToolBar->addAction(pItem->action());1325 m_pToolBar->widgetForAction(pItem->action())1326 ->setProperty("Belongs to", "UISettingsSelectorToolBar");1327 pPage->setContentsMargins(0, 0, 0, 0);1328 pPage->layout()->setContentsMargins(0, 0, 0, 0);1329 pResult = pPage;1330 }1331 else if (iParentID == -1 &&1332 pPage == 0)1333 {1334 m_pActionGroup->addAction(pItem->action());1335 m_pToolBar->addAction(pItem->action());1336 m_pToolBar->widgetForAction(pItem->action())1337 ->setProperty("Belongs to", "UISettingsSelectorToolBar");1338 QITabWidget *pTabWidget = new QITabWidget();1339 pTabWidget->setIconSize(QSize(16, 16));1340 pTabWidget->setContentsMargins(0, 0, 0, 0);1341 pItem->setTabWidget(pTabWidget);1342 pResult = pTabWidget;1343 }1344 else1345 {1346 UISelectorActionItem *pParent = findActionItem(iParentID);1347 if (pParent)1348 {1349 QTabWidget *pTabWidget = pParent->tabWidget();1350 pPage->setContentsMargins(9, 5, 9, 9);1351 pPage->layout()->setContentsMargins(0, 0, 0, 0);1352 const QIcon icon1 = UIIconPool::iconSet(strSmallIcon);1353 if (pTabWidget)1354 pTabWidget->addTab(pPage, icon1, "");1355 }1356 }1357 return pResult;1358 }1359 1360 void UISettingsSelectorToolBar::setItemText(int iID, const QString &strText)1361 {1362 if (UISelectorActionItem *pItem = findActionItem(iID))1363 {1364 pItem->setText(strText);1365 if (pItem->action())1366 pItem->action()->setText(strText);1367 if (pItem->parentID() &&1368 pItem->page())1369 {1370 const UISelectorActionItem *pParent = findActionItem(pItem->parentID());1371 if (pParent &&1372 pParent->tabWidget())1373 pParent->tabWidget()->setTabText(1374 pParent->tabWidget()->indexOf(pItem->page()), strText);1375 }1376 }1377 }1378 1379 QString UISettingsSelectorToolBar::itemText(int iID) const1380 {1381 QString strResult;1382 if (UISelectorItem *pItem = findItem(iID))1383 strResult = pItem->text();1384 return strResult;1385 }1386 1387 int UISettingsSelectorToolBar::currentId() const1388 {1389 const UISelectorActionItem *pAction = findActionItemByAction(m_pActionGroup->checkedAction());1390 int iID = -1;1391 if (pAction)1392 iID = pAction->id();1393 return iID;1394 }1395 1396 int UISettingsSelectorToolBar::linkToId(const QString &strLink) const1397 {1398 int iID = -1;1399 const UISelectorItem *pItem = UISettingsSelector::findItemByLink(strLink);1400 if (pItem)1401 iID = pItem->id();1402 return iID;1403 }1404 1405 QWidget *UISettingsSelectorToolBar::idToPage(int iID) const1406 {1407 QWidget *pPage = 0;1408 if (const UISelectorActionItem *pItem = findActionItem(iID))1409 {1410 pPage = pItem->page();1411 if (!pPage)1412 pPage = pItem->tabWidget();1413 }1414 return pPage;1415 }1416 1417 void UISettingsSelectorToolBar::selectById(int iID, bool)1418 {1419 if (const UISelectorActionItem *pItem = findActionItem(iID))1420 {1421 if (pItem->parentID() != -1)1422 {1423 const UISelectorActionItem *pParent = findActionItem(pItem->parentID());1424 if (pParent &&1425 pParent->tabWidget())1426 {1427 pParent->action()->trigger();1428 pParent->tabWidget()->setCurrentIndex(1429 pParent->tabWidget()->indexOf(pItem->page()));1430 }1431 }1432 else1433 pItem->action()->trigger();1434 }1435 }1436 1437 int UISettingsSelectorToolBar::minWidth() const1438 {1439 return m_pToolBar->sizeHint().width() + 2 * 10;1440 }1441 1442 void UISettingsSelectorToolBar::sltSettingsGroupChanged(QAction *pAction)1443 {1444 const UISelectorActionItem *pItem = findActionItemByAction(pAction);1445 if (pItem)1446 emit sigCategoryChanged(pItem->id());1447 }1448 1449 void UISettingsSelectorToolBar::prepare()1450 {1451 /* Install tool-bar button accessibility interface factory: */1452 QAccessible::installFactory(UIAccessibilityInterfaceForUISettingsSelectorToolBarButton::pFactory);1453 1454 /* Prepare the toolbar: */1455 m_pToolBar = new QIToolBar(qobject_cast<QWidget*>(parent()));1456 if (m_pToolBar)1457 {1458 /* Configure toolbar: */1459 m_pToolBar->setUseTextLabels(true);1460 m_pToolBar->setIconSize(QSize(32, 32));1461 #ifdef VBOX_WS_MAC1462 m_pToolBar->setShowToolBarButton(false);1463 #endif1464 1465 /* Prepare the action group: */1466 m_pActionGroup = new QActionGroup(this);1467 if (m_pActionGroup)1468 {1469 m_pActionGroup->setExclusive(true);1470 connect(m_pActionGroup, &QActionGroup::triggered,1471 this, &UISettingsSelectorToolBar::sltSettingsGroupChanged);1472 }1473 }1474 }1475 1476 UISelectorActionItem *UISettingsSelectorToolBar::findActionItem(int iID) const1477 {1478 return static_cast<UISelectorActionItem*>(UISettingsSelector::findItem(iID));1479 }1480 1481 UISelectorActionItem *UISettingsSelectorToolBar::findActionItemByAction(QAction *pAction) const1482 {1483 UISelectorActionItem *pResult = 0;1484 foreach (UISelectorItem *pItem, m_list)1485 if (static_cast<UISelectorActionItem*>(pItem)->action() == pAction)1486 {1487 pResult = static_cast<UISelectorActionItem*>(pItem);1488 break;1489 }1490 1491 return pResult;1492 }1493 1494 UISelectorActionItem *UISettingsSelectorToolBar::findActionItemByTabWidget(QTabWidget *pTabWidget, int iIndex) const1495 {1496 UISelectorActionItem *pResult = 0;1497 foreach (UISelectorItem *pItem, m_list)1498 if (static_cast<UISelectorActionItem*>(pItem)->tabWidget() == pTabWidget)1499 {1500 QTabWidget *pTabWidget2 = static_cast<UISelectorActionItem*>(pItem)->tabWidget(); /// @todo r=bird: same as pTabWidget?1501 pResult = static_cast<UISelectorActionItem*>(1502 findItemByPage(static_cast<UISettingsPage*>(pTabWidget2->widget(iIndex))));1503 break;1504 }1505 1506 return pResult;1507 1508 }1509 1510 1511 1083 #include "UISettingsSelector.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.h
r102261 r103169 39 39 40 40 /* Forward declarations: */ 41 class QAction;42 class QActionGroup;43 41 class QSortFilterProxyModel; 44 class QTabWidget;45 class QTreeWidget;46 class QTreeWidgetItem;47 class QITreeWidget;48 class UISelectorActionItem;49 42 class UISelectorItem; 50 43 class UISelectorModel; 51 44 class UISelectorTreeView; 52 45 class UISettingsPage; 53 class QIToolBar;54 46 55 47 … … 199 191 200 192 201 /** UISettingsSelector subclass providing settings dialog202 * with the means to switch between settings pages.203 * This one represented as tree-widget. */204 class SHARED_LIBRARY_STUFF UISettingsSelectorTreeWidget : public UISettingsSelector205 {206 Q_OBJECT;207 208 public:209 210 /** Constructs settings selector passing @a pParent to the base-class. */211 UISettingsSelectorTreeWidget(QWidget *pParent = 0);212 /** Destructs settings selector. */213 virtual ~UISettingsSelectorTreeWidget() RT_OVERRIDE;214 215 /** Returns the widget selector operates on. */216 virtual QWidget *widget() const RT_OVERRIDE;217 218 /** Adds a new selector item.219 * @param strBigIcon Brings the big icon reference.220 * @param strMediumIcon Brings the medium icon reference.221 * @param strSmallIcon Brings the small icon reference.222 * @param iID Brings the selector section ID.223 * @param strLink Brings the selector section link.224 * @param pPage Brings the selector section page reference.225 * @param iParentID Brings the parent section ID or -1 if there is no parent. */226 virtual QWidget *addItem(const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,227 int iID, const QString &strLink, UISettingsPage *pPage = 0, int iParentID = -1) RT_OVERRIDE;228 229 /** Defines the @a strText for section with @a iID. */230 virtual void setItemText(int iID, const QString &strText) RT_OVERRIDE;231 /** Returns the text for section with @a iID. */232 virtual QString itemText(int iID) const RT_OVERRIDE;233 234 /** Returns the current selector ID. */235 virtual int currentId() const RT_OVERRIDE;236 237 /** Returns the section ID for passed @a strLink. */238 virtual int linkToId(const QString &strLink) const RT_OVERRIDE;239 240 /** Make the section with @a iID current. */241 virtual void selectById(int iID, bool fSilently) RT_OVERRIDE;242 243 /** Performs selector polishing. */244 virtual void polish() RT_OVERRIDE;245 246 private slots:247 248 /** Handles selector section change from @a pPrevItem to @a pItem. */249 void sltSettingsGroupChanged(QTreeWidgetItem *pItem, QTreeWidgetItem *pPrevItem);250 251 private:252 253 /** Prepares all. */254 void prepare();255 256 /** Returns page path for passed @a strMatch. */257 QString pagePath(const QString &strMatch) const;258 /** Find item within the passed @a pView and @a iColumn matching @a strMatch. */259 QTreeWidgetItem *findItem(QTreeWidget *pView, const QString &strMatch, int iColumn) const;260 /** Performs @a iID to QString serialization. */261 QString idToString(int iID) const;262 263 /** Forges the full path for passed @a pItem. */264 static QString path(const QTreeWidgetItem *pItem);265 266 /** Holds the tree-widget instance. */267 QITreeWidget *m_pTreeWidget;268 };269 270 271 /** UISettingsSelector subclass providing settings dialog272 * with the means to switch between settings pages.273 * This one represented as tool-bar. */274 class SHARED_LIBRARY_STUFF UISettingsSelectorToolBar : public UISettingsSelector275 {276 Q_OBJECT;277 278 public:279 280 /** Constructs settings selector passing @a pParent to the base-class. */281 UISettingsSelectorToolBar(QWidget *pParent = 0);282 /** Destructs settings selector. */283 virtual ~UISettingsSelectorToolBar() RT_OVERRIDE;284 285 /** Returns the widget selector operates on. */286 virtual QWidget *widget() const RT_OVERRIDE;287 288 /** Adds a new selector item.289 * @param strBigIcon Brings the big icon reference.290 * @param strMediumIcon Brings the medium icon reference.291 * @param strSmallIcon Brings the small icon reference.292 * @param iID Brings the selector section ID.293 * @param strLink Brings the selector section link.294 * @param pPage Brings the selector section page reference.295 * @param iParentID Brings the parent section ID or -1 if there is no parent. */296 virtual QWidget *addItem(const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,297 int iID, const QString &strLink, UISettingsPage *pPage = 0, int iParentID = -1) RT_OVERRIDE;298 299 /** Defines the @a strText for section with @a iID. */300 virtual void setItemText(int iID, const QString &strText) RT_OVERRIDE;301 /** Returns the text for section with @a iID. */302 virtual QString itemText(int iID) const RT_OVERRIDE;303 304 /** Returns the current selector ID. */305 virtual int currentId() const RT_OVERRIDE;306 307 /** Returns the section ID for passed @a strLink. */308 virtual int linkToId(const QString &strLink) const RT_OVERRIDE;309 310 /** Returns the section page for passed @a iID. */311 virtual QWidget *idToPage(int iID) const RT_OVERRIDE;312 313 /** Make the section with @a iID current. */314 virtual void selectById(int iID, bool fSilently) RT_OVERRIDE;315 316 /** Returns minimum selector width. */317 virtual int minWidth() const RT_OVERRIDE;318 319 private slots:320 321 /** Handles selector section change to @a pAction. */322 void sltSettingsGroupChanged(QAction *pAction);323 324 private:325 326 /** Prepares all. */327 void prepare();328 329 /** Searches for action item with passed @a iID. */330 UISelectorActionItem *findActionItem(int iID) const;331 /** Searches for action item with passed @a pAction. */332 UISelectorActionItem *findActionItemByAction(QAction *pAction) const;333 /** Searches for action item with passed @a pTabWidget and @a iIndex. */334 UISelectorActionItem *findActionItemByTabWidget(QTabWidget *pTabWidget, int iIndex) const;335 336 /** Holds the toolbar instance. */337 QIToolBar *m_pToolBar;338 /** Holds the action group instance. */339 QActionGroup *m_pActionGroup;340 };341 342 343 193 #endif /* !FEQT_INCLUDED_SRC_settings_UISettingsSelector_h */
Note:
See TracChangeset
for help on using the changeset viewer.