OTHER: Update to c++ iterators and uint remove
This commit is contained in:
parent
58693f9421
commit
6d271f221c
4 changed files with 45 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include <xmmsclient/xmmsclient++.h>
|
||||||
|
#include "compat.h"
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
@ -119,7 +120,11 @@ PlaylistModel::handle_update_pos (const Xmms::Dict &posdict)
|
||||||
{
|
{
|
||||||
QString changed_pl = XClient::stdToQ (posdict.get<std::string> ("name"));
|
QString changed_pl = XClient::stdToQ (posdict.get<std::string> ("name"));
|
||||||
if (changed_pl == m_name) {
|
if (changed_pl == m_name) {
|
||||||
|
#if HAVE_XMMSV
|
||||||
|
uint32_t pos = posdict.get<int32_t> ("position");
|
||||||
|
#else
|
||||||
uint32_t pos = posdict.get<uint32_t> ("position");
|
uint32_t pos = posdict.get<uint32_t> ("position");
|
||||||
|
#endif
|
||||||
m_current_pos = pos;
|
m_current_pos = pos;
|
||||||
emit currentPosChanged (index (pos, 0));
|
emit currentPosChanged (index (pos, 0));
|
||||||
emit dataChanged(index (pos, 0), index (pos, m_columns.size ()));
|
emit dataChanged(index (pos, 0), index (pos, m_columns.size ()));
|
||||||
|
@ -231,21 +236,40 @@ PlaylistModel::handle_change (const Xmms::Dict &chg)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_XMMSV
|
||||||
|
bool
|
||||||
|
PlaylistModel::handle_list (const Xmms::List< int > &list)
|
||||||
|
#else
|
||||||
bool
|
bool
|
||||||
PlaylistModel::handle_list (const Xmms::List< unsigned int > &list)
|
PlaylistModel::handle_list (const Xmms::List< unsigned int > &list)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
beginRemoveRows (QModelIndex (), 0, m_plist.size ());
|
beginRemoveRows (QModelIndex (), 0, m_plist.size ());
|
||||||
m_plist.clear ();
|
m_plist.clear ();
|
||||||
endRemoveRows ();
|
endRemoveRows ();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
#if HAVE_XMMSV
|
||||||
|
for (Xmms::List< int >::const_iterator iter = list.begin();
|
||||||
|
iter != list.end(); iter ++) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (list.first (); list.isValid (); ++list) {
|
for (list.first (); list.isValid (); ++list) {
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
beginInsertRows (QModelIndex (), 0, i);
|
beginInsertRows (QModelIndex (), 0, i);
|
||||||
|
#if HAVE_XMMSV
|
||||||
|
for (Xmms::List< int >::const_iterator iter = list.begin();
|
||||||
|
iter != list.end(); iter ++) {
|
||||||
|
m_plist.append (*iter);
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (list.first (); list.isValid (); ++list) {
|
for (list.first (); list.isValid (); ++list) {
|
||||||
m_plist.append (*list);
|
m_plist.append (*list);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
endInsertRows ();
|
endInsertRows ();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#define __PLAYLIST_MODEL_H__
|
#define __PLAYLIST_MODEL_H__
|
||||||
|
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include <xmmsclient/xmmsclient++.h>
|
||||||
|
#include "compat.h"
|
||||||
|
|
||||||
class XClient;
|
class XClient;
|
||||||
|
|
||||||
|
@ -134,7 +135,11 @@ class PlaylistModel : public QAbstractItemModel
|
||||||
void entry_changed (uint32_t);
|
void entry_changed (uint32_t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if HAVE_XMMSV
|
||||||
|
bool handle_list (const Xmms::List< int > &list);
|
||||||
|
#else
|
||||||
bool handle_list (const Xmms::List< unsigned int > &list);
|
bool handle_list (const Xmms::List< unsigned int > &list);
|
||||||
|
#endif
|
||||||
bool handle_change (const Xmms::Dict &chg);
|
bool handle_change (const Xmms::Dict &chg);
|
||||||
#if (XMMS_IPC_PROTOCOL_VERSION > 10)
|
#if (XMMS_IPC_PROTOCOL_VERSION > 10)
|
||||||
bool handle_update_pos (const Xmms::Dict &pos);
|
bool handle_update_pos (const Xmms::Dict &pos);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include <xmmsclient/xmmsclient++.h>
|
||||||
|
#include "compat.h"
|
||||||
|
|
||||||
#include "xcollection.h"
|
#include "xcollection.h"
|
||||||
#include "xcollection_p.h"
|
#include "xcollection_p.h"
|
||||||
|
@ -163,9 +164,16 @@ XCollection::Private::handle_playlists_list (const Xmms::List< std::string > &li
|
||||||
{
|
{
|
||||||
m_playlists.clear ();
|
m_playlists.clear ();
|
||||||
|
|
||||||
|
#if HAVE_XMMSV
|
||||||
|
for (Xmms::List< std::string >::const_iterator iter = list.begin();
|
||||||
|
iter != list.end(); iter ++) {
|
||||||
|
m_playlists.append (XClient::stdToQ(*iter));
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (list.first (); list.isValid (); ++list) {
|
for (list.first (); list.isValid (); ++list) {
|
||||||
m_playlists.append (XClient::stdToQ(*list));
|
m_playlists.append (XClient::stdToQ(*list));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
m_playlists.sort ();
|
m_playlists.sort ();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xclient.h"
|
#include "xclient.h"
|
||||||
|
#include "compat.h"
|
||||||
#include "BrowseModel.h"
|
#include "BrowseModel.h"
|
||||||
|
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
@ -100,8 +101,14 @@ BrowseModel::list_cb (const Xmms::List< Xmms::Dict > &res)
|
||||||
delete m_list.takeFirst ();
|
delete m_list.takeFirst ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_XMMSV
|
||||||
|
for (Xmms::List< Xmms::Dict >::const_iterator iter = res.begin();
|
||||||
|
iter != res.end(); iter++) {
|
||||||
|
Xmms::Dict d = *iter;
|
||||||
|
#else
|
||||||
for (res.first (); res.isValid (); ++res) {
|
for (res.first (); res.isValid (); ++res) {
|
||||||
Xmms::Dict d = *res;
|
Xmms::Dict d = *res;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!d.contains ("path"))
|
if (!d.contains ("path"))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue