mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-10-04 09:31:41 +02:00
CamelCase Round 2...FIGHT
This commit is contained in:
158
src/libtomahawk/Result.h
Normal file
158
src/libtomahawk/Result.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RESULT_H
|
||||
#define RESULT_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
#include "Typedefs.h"
|
||||
|
||||
#include "DllMacro.h"
|
||||
|
||||
class DatabaseCommand_Resolve;
|
||||
class DatabaseCommand_AllTracks;
|
||||
class DatabaseCommand_AddFiles;
|
||||
class DatabaseCommand_LoadFile;
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
|
||||
struct SocialAction
|
||||
{
|
||||
QVariant action;
|
||||
QVariant value;
|
||||
QVariant timestamp;
|
||||
Tomahawk::source_ptr source;
|
||||
};
|
||||
|
||||
|
||||
class DLLEXPORT Result : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class ::DatabaseCommand_Resolve;
|
||||
friend class ::DatabaseCommand_AllTracks;
|
||||
friend class ::DatabaseCommand_AddFiles;
|
||||
friend class ::DatabaseCommand_LoadFile;
|
||||
|
||||
public:
|
||||
static Tomahawk::result_ptr get( const QString& url );
|
||||
static bool isCached( const QString& url );
|
||||
virtual ~Result();
|
||||
|
||||
QVariant toVariant() const;
|
||||
QString toString() const;
|
||||
Tomahawk::query_ptr toQuery();
|
||||
|
||||
float score() const;
|
||||
RID id() const;
|
||||
bool isOnline() const;
|
||||
|
||||
collection_ptr collection() const;
|
||||
Tomahawk::artist_ptr artist() const;
|
||||
Tomahawk::album_ptr album() const;
|
||||
Tomahawk::artist_ptr composer() const;
|
||||
QString track() const { return m_track; }
|
||||
QString url() const { return m_url; }
|
||||
QString mimetype() const { return m_mimetype; }
|
||||
QString friendlySource() const;
|
||||
|
||||
unsigned int duration() const { return m_duration; }
|
||||
unsigned int bitrate() const { return m_bitrate; }
|
||||
unsigned int size() const { return m_size; }
|
||||
unsigned int albumpos() const { return m_albumpos; }
|
||||
unsigned int modificationTime() const { return m_modtime; }
|
||||
int year() const { return m_year; }
|
||||
unsigned int discnumber() const { return m_discnumber; }
|
||||
|
||||
void setScore( float score ) { m_score = score; }
|
||||
void setTrackId( unsigned int id ) { m_trackId = id; }
|
||||
void setFileId( unsigned int id ) { m_fileId = id; }
|
||||
void setRID( RID id ) { m_rid = id; }
|
||||
void setCollection( const Tomahawk::collection_ptr& collection );
|
||||
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
|
||||
void setArtist( const Tomahawk::artist_ptr& artist );
|
||||
void setAlbum( const Tomahawk::album_ptr& album );
|
||||
void setComposer( const Tomahawk::artist_ptr& composer );
|
||||
void setTrack( const QString& track ) { m_track = track; }
|
||||
void setMimetype( const QString& mimetype ) { m_mimetype = mimetype; }
|
||||
void setDuration( unsigned int duration ) { m_duration = duration; }
|
||||
void setBitrate( unsigned int bitrate ) { m_bitrate = bitrate; }
|
||||
void setSize( unsigned int size ) { m_size = size; }
|
||||
void setAlbumPos( unsigned int albumpos ) { m_albumpos = albumpos; }
|
||||
void setModificationTime( unsigned int modtime ) { m_modtime = modtime; }
|
||||
void setYear( unsigned int year ) { m_year = year; }
|
||||
void setDiscNumber( unsigned int discnumber ) { m_discnumber = discnumber; }
|
||||
|
||||
QVariantMap attributes() const { return m_attributes; }
|
||||
void setAttributes( const QVariantMap& map ) { m_attributes = map; updateAttributes(); }
|
||||
|
||||
unsigned int trackId() const { return m_trackId; }
|
||||
unsigned int fileId() const { return m_fileId; }
|
||||
|
||||
public slots:
|
||||
void deleteLater();
|
||||
|
||||
signals:
|
||||
// emitted when the collection this result comes from is going offline/online:
|
||||
void statusChanged();
|
||||
|
||||
private slots:
|
||||
void onOffline();
|
||||
void onOnline();
|
||||
|
||||
private:
|
||||
// private constructor
|
||||
explicit Result( const QString& url );
|
||||
explicit Result();
|
||||
|
||||
void updateAttributes();
|
||||
|
||||
mutable RID m_rid;
|
||||
collection_ptr m_collection;
|
||||
Tomahawk::query_ptr m_query;
|
||||
|
||||
Tomahawk::artist_ptr m_artist;
|
||||
Tomahawk::album_ptr m_album;
|
||||
Tomahawk::artist_ptr m_composer;
|
||||
QString m_track;
|
||||
QString m_url;
|
||||
QString m_mimetype;
|
||||
QString m_friendlySource;
|
||||
|
||||
unsigned int m_duration;
|
||||
unsigned int m_bitrate;
|
||||
unsigned int m_size;
|
||||
unsigned int m_albumpos;
|
||||
unsigned int m_modtime;
|
||||
unsigned int m_discnumber;
|
||||
int m_year;
|
||||
float m_score;
|
||||
|
||||
QVariantMap m_attributes;
|
||||
unsigned int m_trackId, m_fileId;
|
||||
};
|
||||
|
||||
} //ns
|
||||
|
||||
#endif // RESULT_H
|
Reference in New Issue
Block a user