convert passed pa struct from pointer to const reference

This commit is contained in:
mappu 2018-10-02 19:27:25 +13:00
parent 5bef09df7c
commit 2d6e6c8006
4 changed files with 13 additions and 19 deletions

View File

@ -46,7 +46,7 @@ void QPulse::onGotCardInfoListSt(pa_context*, const pa_card_info *i, int eol, vo
QPulse* qp = static_cast<QPulse*>(userdata);
//ThreadedMainLoopLock lock(qp->ml);
emit qp->GotCardInfoList(i, eol);
emit qp->GotCardInfoList(*i, eol);
}
void QPulse::onGotServerInfoSt(pa_context*, const pa_server_info *i, void *userdata)
@ -54,7 +54,7 @@ void QPulse::onGotServerInfoSt(pa_context*, const pa_server_info *i, void *userd
QPulse* qp = static_cast<QPulse*>(userdata);
//ThreadedMainLoopLock lock(qp->ml);
emit qp->GotServerInfo(i);
emit qp->GotServerInfo(*i);
}
void QPulse::onConnectionStateChangedSt(pa_context*, void *userdata)

View File

@ -18,8 +18,8 @@ public:
signals:
void ConnectionStateChanged();
void GotServerInfo(const pa_server_info *i);
void GotCardInfoList(const pa_card_info *i, int eol);
void GotServerInfo(const pa_server_info& i);
void GotCardInfoList(const pa_card_info& i, int eol);
public slots:

View File

@ -69,7 +69,7 @@ void TrayIcon::onRefreshAction_triggered()
refreshData();
}
void TrayIcon::onGotPulseCardInfo(const pa_card_info *cardInfo, int eol)
void TrayIcon::onGotPulseCardInfo(const pa_card_info& cardInfo, int eol)
{
if (eol) {
// OK - rebuild the menu
@ -84,25 +84,19 @@ void TrayIcon::onGotPulseCardInfo(const pa_card_info *cardInfo, int eol)
return;
}
/*
QString name; // = pa_proplist_to_string(cardInfo->proplist);; // copy to QString from internally-managed buffers
if (true) { // 0 != pa_proplist_isempty(cardInfo->proplist) && 1 == pa_proplist_contains(cardInfo->proplist, PA_PROP_DEVICE_DESCRIPTION)) {
name = pa_proplist_gets(cardInfo->proplist, PA_PROP_DEVICE_DESCRIPTION);;
} else {
name = cardInfo->name;
}
*/
/*
QString name(cardInfo->name);
QString name = pa_proplist_gets(cardInfo.proplist, PA_PROP_DEVICE_DESCRIPTION);
if (name.length() == 0) {
name = cardInfo.name;
}
if (name.length() == 0) {
name = tr("Default card");
}
*/
QMenu* cardMenu = new QMenu(name);
for (size_t i = 0; i < cardInfo->n_profiles; ++i) {
auto profileAction = new QAction(cardInfo->profiles[i].description, cardMenu);
for (size_t i = 0; i < cardInfo.n_profiles; ++i) {
auto profileAction = new QAction(cardInfo.profiles[i].description, cardMenu);
cardMenu->addAction(profileAction);
}

View File

@ -19,7 +19,7 @@ public:
public slots:
void on_quitAction_triggered();
void onRefreshAction_triggered();
void onGotPulseCardInfo(const pa_card_info *i, int eol);
void onGotPulseCardInfo(const pa_card_info& i, int eol);
protected:
QPulse pulse;