VirtualBox

Ignore:
Timestamp:
Aug 9, 2017 11:41:22 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: Using Qt5 signal-slot connection notation for VBox Qt extradata manager.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r68342 r68348  
    193193{
    194194    /* Create direct (sync) connections for signals of main listener: */
    195     connect(m_pQtListener->getWrapped(), SIGNAL(sigExtraDataCanChange(QString, QString, QString, bool&, QString&)),
    196             this, SLOT(sltPreprocessExtraDataCanChange(QString, QString, QString, bool&, QString&)),
     195    connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigExtraDataCanChange,
     196            this, &UIExtraDataEventHandler::sltPreprocessExtraDataCanChange,
    197197            Qt::DirectConnection);
    198     connect(m_pQtListener->getWrapped(), SIGNAL(sigExtraDataChange(QString, QString, QString)),
    199             this, SLOT(sltPreprocessExtraDataChange(QString, QString, QString)),
     198    connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigExtraDataChange,
     199            this, &UIExtraDataEventHandler::sltPreprocessExtraDataChange,
    200200            Qt::DirectConnection);
    201201}
     
    476476    /** @} */
    477477
     478public slots:
     479
     480    /** @name General
     481      * @{ */
     482        /** Handles extra-data map acknowledging. */
     483        void sltExtraDataMapAcknowledging(QString strID);
     484        /** Handles extra-data change. */
     485        void sltExtraDataChange(QString strID, QString strKey, QString strValue);
     486    /** @} */
     487
    478488private slots:
    479489
     
    482492        /** Handles machine (un)registration. */
    483493        void sltMachineRegistered(QString strID, bool fAdded);
    484         /** Handles extra-data map acknowledging. */
    485         void sltExtraDataMapAcknowledging(QString strID);
    486         /** Handles extra-data change. */
    487         void sltExtraDataChange(QString strID, QString strKey, QString strValue);
    488494    /** @} */
    489495
     
    10071013                    {
    10081014                        /* Configure key-editor property setter: */
    1009                         connect(pEditorKey, SIGNAL(editTextChanged(const QString&)),
    1010                                 pKeyPropertySetter, SLOT(sltAssignProperty(const QString&)));
     1015                        connect(pEditorKey, &QComboBox::editTextChanged,
     1016                                pKeyPropertySetter, &QObjectPropertySetter::sltAssignProperty);
    10111017                    }
    10121018                    /* Create key-editor validator: */
     
    10151021                    {
    10161022                        /* Configure key-editor validator: */
    1017                         connect(pEditorKey, SIGNAL(editTextChanged(const QString&)),
    1018                                 pKeyValidator, SLOT(sltValidate(QString)));
     1023                        connect(pEditorKey, &QComboBox::editTextChanged,
     1024                                pKeyValidator, &QObjectValidator::sltValidate);
    10191025                        /* Add key-editor validator into dialog validator group: */
    10201026                        pValidatorGroup->addObjectValidator(pKeyValidator);
     
    10411047                    {
    10421048                        /* Configure value-editor property setter: */
    1043                         connect(pEditorValue, SIGNAL(textEdited(const QString&)),
    1044                                 pValuePropertySetter, SLOT(sltAssignProperty(const QString&)));
     1049                        connect(pEditorValue, &QLineEdit::textEdited,
     1050                                pValuePropertySetter, &QObjectPropertySetter::sltAssignProperty);
    10451051                    }
    10461052                    /* Create value-editor validator: */
     
    10491055                    {
    10501056                        /* Configure value-editor validator: */
    1051                         connect(pEditorValue, SIGNAL(textEdited(const QString&)),
    1052                                 pValueValidator, SLOT(sltValidate(QString)));
     1057                        connect(pEditorValue, &QLineEdit::textEdited,
     1058                                pValueValidator, &QObjectValidator::sltValidate);
    10531059                        /* Add value-editor validator into dialog validator group: */
    10541060                        pValidatorGroup->addObjectValidator(pValueValidator);
     
    10711077                pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(pValidatorGroup->result());
    10721078                pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape);
    1073                 connect(pValidatorGroup, SIGNAL(sigValidityChange(bool)),
    1074                         pButtonBox->button(QDialogButtonBox::Ok), SLOT(setEnabled(bool)));
    1075                 connect(pButtonBox, SIGNAL(accepted()), pInputDialog, SLOT(accept()));
    1076                 connect(pButtonBox, SIGNAL(rejected()), pInputDialog, SLOT(reject()));
     1079                connect(pValidatorGroup, &QObjectValidatorGroup::sigValidityChange,
     1080                        pButtonBox->button(QDialogButtonBox::Ok), &QPushButton::setEnabled);
     1081                connect(pButtonBox, &QIDialogButtonBox::accepted, pInputDialog, &QIDialog::accept);
     1082                connect(pButtonBox, &QIDialogButtonBox::rejected, pInputDialog, &QIDialog::reject);
    10771083                /* Add button-box into main-layout: */
    10781084                pMainLayout->addWidget(pButtonBox);
     
    13651371{
    13661372    /* Prepare connections: */
    1367     connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)),
    1368             this, SLOT(sltMachineRegistered(QString, bool)));
     1373    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineRegistered,
     1374            this, &UIExtraDataManagerWindow::sltMachineRegistered);
    13691375}
    13701376
     
    13831389                                                          ":/edata_add_disabled_22px.png", ":/edata_add_disabled_16px.png"));
    13841390            m_pActionAdd->setShortcut(QKeySequence("Ctrl+T"));
    1385             connect(m_pActionAdd, SIGNAL(triggered(bool)), this, SLOT(sltAdd()));
     1391            connect(m_pActionAdd, &QAction::triggered, this, &UIExtraDataManagerWindow::sltAdd);
    13861392        }
    13871393        /* Create 'Del' action: */
     
    13931399                                                          ":/edata_remove_disabled_22px.png", ":/edata_remove_disabled_16px.png"));
    13941400            m_pActionDel->setShortcut(QKeySequence("Ctrl+R"));
    1395             connect(m_pActionDel, SIGNAL(triggered(bool)), this, SLOT(sltDel()));
     1401            connect(m_pActionDel, &QAction::triggered, this, &UIExtraDataManagerWindow::sltDel);
    13961402        }
    13971403
     
    14071413                                                           ":/edata_load_disabled_22px.png", ":/edata_load_disabled_16px.png"));
    14081414            m_pActionLoad->setShortcut(QKeySequence("Ctrl+L"));
    1409             connect(m_pActionLoad, SIGNAL(triggered(bool)), this, SLOT(sltLoad()));
     1415            connect(m_pActionLoad, &QAction::triggered, this, &UIExtraDataManagerWindow::sltLoad);
    14101416        }
    14111417        /* Create 'Save' action: */
     
    14171423                                                           ":/edata_save_disabled_22px.png", ":/edata_save_disabled_16px.png"));
    14181424            m_pActionSave->setShortcut(QKeySequence("Ctrl+S"));
    1419             connect(m_pActionSave, SIGNAL(triggered(bool)), this, SLOT(sltSave()));
     1425            connect(m_pActionSave, &QAction::triggered, this, &UIExtraDataManagerWindow::sltSave);
    14201426        }
    14211427    }
     
    15061512    preparePaneData();
    15071513    /* Link chooser and data panes: */
    1508     connect(m_pViewOfChooser->selectionModel(),
    1509             SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
    1510             this, SLOT(sltChooserHandleCurrentChanged(const QModelIndex&)));
    1511     connect(m_pViewOfChooser->selectionModel(),
    1512             SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
    1513             this, SLOT(sltChooserHandleSelectionChanged(const QItemSelection&, const QItemSelection&)));
    1514     connect(m_pViewOfData->selectionModel(),
    1515             SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
    1516             this, SLOT(sltDataHandleSelectionChanged(const QItemSelection&, const QItemSelection&)));
    1517     connect(m_pModelSourceOfData, SIGNAL(itemChanged(QStandardItem*)),
    1518             this, SLOT(sltDataHandleItemChanged(QStandardItem*)));
     1514    connect(m_pViewOfChooser->selectionModel(), &QItemSelectionModel::currentChanged,
     1515            this, &UIExtraDataManagerWindow::sltChooserHandleCurrentChanged);
     1516    connect(m_pViewOfChooser->selectionModel(), &QItemSelectionModel::selectionChanged,
     1517            this, &UIExtraDataManagerWindow::sltChooserHandleSelectionChanged);
     1518    connect(m_pViewOfData->selectionModel(), &QItemSelectionModel::selectionChanged,
     1519            this, &UIExtraDataManagerWindow::sltDataHandleSelectionChanged);
     1520    connect(m_pModelSourceOfData, &QStandardItemModel::itemChanged,
     1521            this, &UIExtraDataManagerWindow::sltDataHandleItemChanged);
    15191522    /* Make sure chooser have current-index if possible: */
    15201523    makeSureChooserHaveCurrentIndexIfPossible();
     
    15391542                /* Configure chooser-filter: */
    15401543                m_pFilterOfChooser->setPlaceholderText("Search..");
    1541                 connect(m_pFilterOfChooser, SIGNAL(textChanged(const QString&)),
    1542                         this, SLOT(sltChooserApplyFilter(const QString&)));
     1544                connect(m_pFilterOfChooser, &QLineEdit::textChanged,
     1545                        this, &UIExtraDataManagerWindow::sltChooserApplyFilter);
    15431546                /* Add chooser-filter into layout: */
    15441547                pLayout->addWidget(m_pFilterOfChooser);
     
    16041607                /* Configure data-filter: */
    16051608                m_pFilterOfData->setPlaceholderText("Search..");
    1606                 connect(m_pFilterOfData, SIGNAL(textChanged(const QString&)),
    1607                         this, SLOT(sltDataApplyFilter(const QString&)));
     1609                connect(m_pFilterOfData, &QLineEdit::textChanged,
     1610                        this, &UIExtraDataManagerWindow::sltDataApplyFilter);
    16081611                /* Add data-filter into layout: */
    16091612                pLayout->addWidget(m_pFilterOfData);
     
    16361639                m_pViewOfData->setSelectionMode(QAbstractItemView::ExtendedSelection);
    16371640                m_pViewOfData->setSelectionBehavior(QAbstractItemView::SelectRows);
    1638                 connect(m_pViewOfData, SIGNAL(customContextMenuRequested(const QPoint&)),
    1639                         this, SLOT(sltDataHandleCustomContextMenuRequested(const QPoint&)));
     1641                connect(m_pViewOfData, &QTableView::customContextMenuRequested,
     1642                        this, &UIExtraDataManagerWindow::sltDataHandleCustomContextMenuRequested);
    16401643                QHeaderView *pVHeader = m_pViewOfData->verticalHeader();
    16411644                QHeaderView *pHHeader = m_pViewOfData->horizontalHeader();
     
    16621665        m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Close);
    16631666        m_pButtonBox->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape);
    1664         connect(m_pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog()));
    1665         connect(m_pButtonBox, SIGNAL(rejected()), this, SLOT(close()));
     1667        connect(m_pButtonBox, &QIDialogButtonBox::helpRequested, &msgCenter(), &UIMessageCenter::sltShowHelpHelpDialog);
     1668        connect(m_pButtonBox, &QIDialogButtonBox::rejected,      this, &UIExtraDataManagerWindow::close);
    16661669        /* Add button-box into main layout: */
    16671670        m_pMainLayout->addWidget(m_pButtonBox);
     
    43404343    {
    43414344        /* Create queued (async) connections for signals of event proxy object: */
    4342         connect(m_pHandler, SIGNAL(sigExtraDataChange(QString, QString, QString)),
    4343                 this, SLOT(sltExtraDataChange(QString, QString, QString)),
     4345        connect(m_pHandler, &UIExtraDataEventHandler::sigExtraDataChange,
     4346                this, &UIExtraDataManager::sltExtraDataChange,
    43444347                Qt::QueuedConnection);
    43454348    }
     
    43794382        m_pWindow = new UIExtraDataManagerWindow;
    43804383        /* Configure window connections: */
    4381         connect(this, SIGNAL(sigExtraDataMapAcknowledging(QString)),
    4382                 m_pWindow, SLOT(sltExtraDataMapAcknowledging(QString)));
    4383         connect(this, SIGNAL(sigExtraDataChange(QString, QString, QString)),
    4384                 m_pWindow, SLOT(sltExtraDataChange(QString, QString, QString)));
     4384        connect(this, &UIExtraDataManager::sigExtraDataMapAcknowledging,
     4385                m_pWindow, &UIExtraDataManagerWindow::sltExtraDataMapAcknowledging);
     4386        connect(this, &UIExtraDataManager::sigExtraDataChange,
     4387                m_pWindow, &UIExtraDataManagerWindow::sltExtraDataChange);
    43854388    }
    43864389    /* Show and raise window: */
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