1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-21 13:21:52 +02:00

Fix invalid variant conversion; need to make sure it's actually working properly, though

This commit is contained in:
Jeff Mitchell
2012-04-22 16:57:50 -04:00
parent 261aa7b677
commit 456d6f74bb
2 changed files with 41 additions and 1 deletions

View File

@@ -31,6 +31,43 @@
#include "jobview/JobStatusModel.h"
QDataStream& operator<<( QDataStream &out, const ACLRegistry::User &user )
{
out << ACLUSERVERSION;
out << user.uuid;
out << user.knownDbids.length();
foreach( QString knownDbid, user.knownDbids )
out << knownDbid;
out << user.knownAccountIds.length();
foreach( QString knownAccount, user.knownAccountIds )
out << user.knownAccountIds;
out << (int)( user.acl );
return out;
}
QDataStream& operator>>( QDataStream &in, ACLRegistry::User &user )
{
int ver;
in >> ver;
if ( ver == ACLUSERVERSION )
{
in >> user.uuid;
int dbidsLength;
in >> dbidsLength;
for ( int i = 0; i < dbidsLength; i++ )
in >> user.knownDbids;
int accountsLength;
in >> accountsLength;
for ( int i = 0; i < accountsLength; i++ )
in >> user.knownAccountIds;
int aclIn;
in >> aclIn;
user.acl = (ACLRegistry::ACL)( aclIn );
}
return in;
}
ACLRegistry* ACLRegistry::s_instance = 0;
ACLRegistry*
@@ -49,6 +86,7 @@ ACLRegistry::ACLRegistry( QObject* parent )
s_instance = this;
qRegisterMetaType< ACLRegistry::ACL >( "ACLRegistry::ACL" );
qRegisterMetaType< ACLRegistry::User >( "ACLRegistry::User" );
qRegisterMetaTypeStreamOperators< ACLRegistry::User >( "ACLRegistry::User" );
load();
}

View File

@@ -30,6 +30,8 @@
#include "HeadlessCheck.h"
#include "DllMacro.h"
#define ACLUSERVERSION 1
class AclJobItem;
class DLLEXPORT ACLRegistry : public QObject
@@ -51,7 +53,7 @@ public:
QString uuid;
QStringList knownDbids;
QStringList knownAccountIds;
ACL acl;
ACLRegistry::ACL acl;
User()
: uuid( QUuid::createUuid().toString() )