VirtualBox

Changeset 103169 in vbox


Ignore:
Timestamp:
Feb 1, 2024 5:51:58 PM (10 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: Removing unused types of settings selector and a bit of other unused stuff.

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  
    6868#ifdef VBOX_WS_MAC
    6969# include "VBoxUtils.h"
    70 #endif
    71 
    72 #ifdef VBOX_WS_MAC
    73 //# define VBOX_GUI_WITH_TOOLBAR_SETTINGS
    74 #endif
    75 
    76 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
    77 # include "QIToolBar.h"
    7870#endif
    7971
     
    783775void UIAdvancedSettingsDialog::sltCategoryChanged(int cId)
    784776{
    785 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
    786     setWindowTitle(title());
    787 #endif
    788 
    789777    /* Cache current page ID for reusing: */
    790778    m_iPageId = cId;
     
    13541342void UIAdvancedSettingsDialog::prepareSelector()
    13551343{
    1356 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
    1357     /* 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 
    13711344    /* Make sure there is a serious spacing between selector and pages: */
    13721345    m_pLayoutMain->setColumnMinimumWidth(1, 20);
     
    14011374        m_pLayoutMain->addWidget(m_pEditorFilter, 0, 2);
    14021375    }
    1403 #endif /* !VBOX_GUI_WITH_TOOLBAR_SETTINGS */
    14041376
    14051377    /* Configure selector created above: */
    14061378    if (m_pSelector)
    1407         connect(m_pSelector, &UISettingsSelectorTreeWidget::sigCategoryChanged,
     1379        connect(m_pSelector, &UISettingsSelectorTreeView::sigCategoryChanged,
    14081380                this, &UIAdvancedSettingsDialog::sltCategoryChanged);
    14091381}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialogSpecific.cpp

    r102160 r103169  
    7171#include "CUSBController.h"
    7272
    73 #ifdef VBOX_WS_MAC
    74 //# define VBOX_GUI_WITH_TOOLBAR_SETTINGS
    75 #endif
    76 
    7773
    7874/*********************************************************************************************************************************
     
    178174QString UIAdvancedSettingsDialogGlobal::titleExtension() const
    179175{
    180 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
    181     return m_pSelector->itemText(m_pSelector->currentId());
    182 #else
    183176    return tr("Preferences");
    184 #endif
    185177}
    186178
     
    493485QString UIAdvancedSettingsDialogMachine::titleExtension() const
    494486{
    495 #ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
    496     return m_pSelector->itemText(m_pSelector->currentId());
    497 #else
    498487    return tr("Settings");
    499 #endif
    500488}
    501489
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.cpp

    r102707 r103169  
    3131#include <QAction>
    3232#include <QActionGroup>
    33 #include <QHeaderView>
    3433#include <QItemDelegate>
    3534#include <QLayout>
     
    4241#include "QITabWidget.h"
    4342#include "QITreeView.h"
    44 #include "QITreeWidget.h"
    4543#include "UICommon.h"
    4644#include "UIDesktopWidgetWatchdog.h"
     
    10831081
    10841082
    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() const
    1104 {
    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) const
    1153 {
    1154     return pagePath(idToString(iID));
    1155 }
    1156 
    1157 int UISettingsSelectorTreeWidget::currentId() const
    1158 {
    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) const
    1167 {
    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() * iItemHeight
    1197                                     + 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) const
    1245 {
    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) const
    1251 {
    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) const
    1257 {
    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() const
    1302 {
    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     else
    1345     {
    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) const
    1380 {
    1381     QString strResult;
    1382     if (UISelectorItem *pItem = findItem(iID))
    1383         strResult = pItem->text();
    1384     return strResult;
    1385 }
    1386 
    1387 int UISettingsSelectorToolBar::currentId() const
    1388 {
    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) const
    1397 {
    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) const
    1406 {
    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         else
    1433             pItem->action()->trigger();
    1434     }
    1435 }
    1436 
    1437 int UISettingsSelectorToolBar::minWidth() const
    1438 {
    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_MAC
    1462         m_pToolBar->setShowToolBarButton(false);
    1463 #endif
    1464 
    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) const
    1477 {
    1478     return static_cast<UISelectorActionItem*>(UISettingsSelector::findItem(iID));
    1479 }
    1480 
    1481 UISelectorActionItem *UISettingsSelectorToolBar::findActionItemByAction(QAction *pAction) const
    1482 {
    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) const
    1495 {
    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 
    15111083#include "UISettingsSelector.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.h

    r102261 r103169  
    3939
    4040/* Forward declarations: */
    41 class QAction;
    42 class QActionGroup;
    4341class QSortFilterProxyModel;
    44 class QTabWidget;
    45 class QTreeWidget;
    46 class QTreeWidgetItem;
    47 class QITreeWidget;
    48 class UISelectorActionItem;
    4942class UISelectorItem;
    5043class UISelectorModel;
    5144class UISelectorTreeView;
    5245class UISettingsPage;
    53 class QIToolBar;
    5446
    5547
     
    199191
    200192
    201 /** UISettingsSelector subclass providing settings dialog
    202   * with the means to switch between settings pages.
    203   * This one represented as tree-widget. */
    204 class SHARED_LIBRARY_STUFF UISettingsSelectorTreeWidget : public UISettingsSelector
    205 {
    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 dialog
    272   * with the means to switch between settings pages.
    273   * This one represented as tool-bar. */
    274 class SHARED_LIBRARY_STUFF UISettingsSelectorToolBar : public UISettingsSelector
    275 {
    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 
    343193#endif /* !FEQT_INCLUDED_SRC_settings_UISettingsSelector_h */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette