Cleaned up a couple more core class and typedef definitions, including QueryPtr -> IQueryPtr.

This commit is contained in:
casey 2016-06-12 12:25:17 -07:00
parent 0ac12016e9
commit c3217bf65c
12 changed files with 23 additions and 34 deletions

View File

@ -126,6 +126,7 @@ int Player::State() {
void Player::ThreadLoop() {
/* create and open the stream */
this->stream = Stream::Create();
if (this->stream->OpenStream(this->url)) {
/* precache until buffers are full */
bool keepPrecaching = true;

View File

@ -47,11 +47,11 @@ namespace musik { namespace core {
class ILibrary {
public:
sigslot::signal1<QueryPtr> QueryCompleted;
sigslot::signal1<IQueryPtr> QueryCompleted;
virtual ~ILibrary() { }
virtual int Enqueue(QueryPtr query, unsigned int options = 0) = 0;
virtual int Enqueue(IQueryPtr query, unsigned int options = 0) = 0;
virtual IIndexer *Indexer() = 0;
virtual int Id() = 0;
virtual const std::string& Name() = 0;

View File

@ -43,14 +43,8 @@
#include <core/db/Connection.h>
namespace musik { namespace core {
class IQuery;
typedef std::shared_ptr<IQuery> QueryPtr;
class IQuery {
public:
sigslot::signal2<int, QueryPtr> QueryCompleted;
typedef enum {
Idle = 1,
Running = 2,
@ -68,4 +62,5 @@ namespace musik { namespace core {
virtual std::string Name() = 0;
};
typedef std::shared_ptr<IQuery> IQueryPtr;
} }

View File

@ -134,7 +134,7 @@ std::string LocalLibrary::GetDatabaseFilename() {
return this->GetLibraryDirectory() + "musik.db";
}
int LocalLibrary::Enqueue(QueryPtr query, unsigned int options) {
int LocalLibrary::Enqueue(IQueryPtr query, unsigned int options) {
boost::recursive_mutex::scoped_lock l(this->mutex);
queryQueue.push_back(query);
@ -162,19 +162,19 @@ void LocalLibrary::Exit() {
this->queueCondition.notify_all();
}
QueryPtr LocalLibrary::GetNextQuery() {
IQueryPtr LocalLibrary::GetNextQuery() {
if (queryQueue.size()) {
QueryPtr front = queryQueue.front();
IQueryPtr front = queryQueue.front();
queryQueue.pop_front();
return front;
}
return QueryPtr();
return IQueryPtr();
}
void LocalLibrary::ThreadProc() {
while (!this->Exited()) {
QueryPtr query;
IQueryPtr query;
{
boost::recursive_mutex::scoped_lock lock(this->mutex);

View File

@ -63,7 +63,7 @@ namespace musik { namespace core { namespace library {
virtual ~LocalLibrary();
virtual int Enqueue(QueryPtr query, unsigned int options = 0);
virtual int Enqueue(IQueryPtr query, unsigned int options = 0);
virtual musik::core::IIndexer *Indexer();
virtual int Id();
virtual const std::string& Name();
@ -80,10 +80,10 @@ namespace musik { namespace core { namespace library {
virtual void Exit();
bool Exited();
void ThreadProc();
QueryPtr GetNextQuery();
IQueryPtr GetNextQuery();
private:
typedef std::list<QueryPtr> QueryList;
typedef std::list<IQueryPtr> QueryList;
boost::recursive_mutex mutex;
QueryList queryQueue;

View File

@ -40,10 +40,6 @@
namespace musik { namespace core {
//////////////////////////////////////////
///\brief
///A concrete implementation of Track used for indexing and insertion into the database.
//////////////////////////////////////////
class IndexerTrack : public Track {
public:
IndexerTrack(DBID id);

View File

@ -39,16 +39,8 @@
#include <core/library/LocalLibrary.h>
#include <core/db/Connection.h>
namespace musik { namespace core { namespace http {
class Responder;
} } }
namespace musik { namespace core {
//////////////////////////////////////////
///\brief
///A LibraryTrack is a track related to a Library.
//////////////////////////////////////////
class LibraryTrack : public Track {
public:
LibraryTrack();

View File

@ -100,7 +100,7 @@ void CategoryListView::SetFieldName(const std::string& fieldName) {
}
}
void CategoryListView::OnQueryCompleted(QueryPtr query) {
void CategoryListView::OnQueryCompleted(IQueryPtr query) {
if (query == this->activeQuery) {
this->PostMessage(WINDOW_MESSAGE_QUERY_COMPLETED);
}

View File

@ -44,7 +44,7 @@
#include <core/library/IQuery.h>
#include <core/library/ILibrary.h>
using musik::core::QueryPtr;
using musik::core::IQueryPtr;
using musik::core::LibraryPtr;
using cursespp::IMessage;
@ -75,7 +75,7 @@ namespace musik {
protected:
virtual IScrollAdapter& GetScrollAdapter();
void OnQueryCompleted(QueryPtr query);
void OnQueryCompleted(IQueryPtr query);
class Adapter : public ScrollAdapterBase {
public:

View File

@ -83,7 +83,7 @@ void TrackListView::Requery(std::shared_ptr<TrackListQueryBase> query) {
this->library->Enqueue(this->query);
}
void TrackListView::OnQueryCompleted(QueryPtr query) {
void TrackListView::OnQueryCompleted(IQueryPtr query) {
if (query == this->query) {
this->PostMessage(WINDOW_MESSAGE_QUERY_COMPLETED);
}

View File

@ -73,7 +73,7 @@ namespace musik {
protected:
virtual cursespp::IScrollAdapter& GetScrollAdapter();
void OnQueryCompleted(musik::core::QueryPtr query);
void OnQueryCompleted(musik::core::IQueryPtr query);
class Adapter : public cursespp::ScrollAdapterBase {
public:

View File

@ -74,7 +74,12 @@ void TextInput::Show() {
}
void TextInput::Write(const std::string& key) {
if (key == "^H" || key == "^?" || key == "KEY_BACKSPACE") { /* backspace */
if (key == "M-bksp") {
this->buffer = "";
redrawContents(*this, "");
this->TextChanged(this, "");
}
else if (key == "^H" || key == "^?" || key == "KEY_BACKSPACE") { /* backspace */
removeUtf8Char(this->buffer);
this->TextChanged(this, this->buffer);
}