mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-14 04:18:36 +00:00
Improved build time by rearranging includes and forward declaring as much as possible.
This commit is contained in:
parent
83024bb1a4
commit
b4b0aaaa7d
@ -36,6 +36,7 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <core/Common.h>
|
||||
#include <core/config_filesystem.h>
|
||||
#include <utf8/utf8.h>
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
@ -35,17 +35,19 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <core/Indexer.h>
|
||||
|
||||
#include <core/config_filesystem.h>
|
||||
#include <core/config_format.h>
|
||||
#include <core/Track.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/db/Statement.h>
|
||||
#include <core/PluginFactory.h>
|
||||
#include <core/Preferences.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/thread/xtime.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
using namespace musik::core;
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/config.h>
|
||||
|
||||
#include <core/ThreadHelper.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/Plugin/IMetaDataReader.h>
|
||||
@ -49,66 +50,74 @@
|
||||
|
||||
#include <deque>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{
|
||||
class Indexer : public ThreadHelper,private boost::noncopyable {
|
||||
public:
|
||||
Indexer(void);
|
||||
~Indexer(void);
|
||||
|
||||
void AddPath(utfstring sPath);
|
||||
void RemovePath(utfstring sPath);
|
||||
std::vector<utfstring> GetPaths();
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool Startup(utfstring setLibraryPath);
|
||||
void ThreadLoop();
|
||||
class Indexer : public ThreadHelper,private boost::noncopyable {
|
||||
public:
|
||||
Indexer(void);
|
||||
~Indexer(void);
|
||||
|
||||
utfstring GetStatus();
|
||||
void RestartSync(bool bNewRestart=true);
|
||||
bool Restarted();
|
||||
void AddPath(utfstring sPath);
|
||||
void RemovePath(utfstring sPath);
|
||||
std::vector<utfstring> GetPaths();
|
||||
|
||||
utfstring database;
|
||||
bool Startup(utfstring setLibraryPath);
|
||||
void ThreadLoop();
|
||||
|
||||
sigslot::signal0<> SynchronizeStart;
|
||||
sigslot::signal0<> SynchronizeEnd;
|
||||
sigslot::signal0<> PathsUpdated;
|
||||
utfstring GetStatus();
|
||||
void RestartSync(bool bNewRestart=true);
|
||||
bool Restarted();
|
||||
|
||||
private:
|
||||
|
||||
db::Connection dbConnection;
|
||||
utfstring database;
|
||||
|
||||
utfstring libraryPath;
|
||||
int iStatus;
|
||||
bool bRestart;
|
||||
sigslot::signal0<> SynchronizeStart;
|
||||
sigslot::signal0<> SynchronizeEnd;
|
||||
sigslot::signal0<> PathsUpdated;
|
||||
|
||||
boost::thread *oThread;
|
||||
boost::mutex oProgressMutex;
|
||||
private:
|
||||
|
||||
db::Connection dbConnection;
|
||||
|
||||
double iProgress;
|
||||
int iNOFFiles;
|
||||
int iFilesIndexed;
|
||||
utfstring libraryPath;
|
||||
int iStatus;
|
||||
bool bRestart;
|
||||
|
||||
void CountFiles(utfstring &sFolder);
|
||||
boost::thread *oThread;
|
||||
boost::mutex oProgressMutex;
|
||||
|
||||
void Synchronize();
|
||||
void SyncDirectory(utfstring &sFolder,DBINT iParentFolderId,DBINT iPathId,utfstring &syncPath);
|
||||
void SyncDelete(std::vector<DBINT> aPaths);
|
||||
void SyncCleanup();
|
||||
void SyncAddRemovePaths();
|
||||
void SyncOptimize();
|
||||
double iProgress;
|
||||
int iNOFFiles;
|
||||
int iFilesIndexed;
|
||||
|
||||
class _AddRemovePath{
|
||||
public:
|
||||
bool add;
|
||||
utfstring path;
|
||||
};
|
||||
void CountFiles(utfstring &sFolder);
|
||||
|
||||
typedef std::vector<boost::shared_ptr<Plugin::IMetaDataReader>> MetadataReaderList;
|
||||
void Synchronize();
|
||||
void SyncDirectory(utfstring &sFolder,DBINT iParentFolderId,DBINT iPathId,utfstring &syncPath);
|
||||
void SyncDelete(std::vector<DBINT> aPaths);
|
||||
void SyncCleanup();
|
||||
void SyncAddRemovePaths();
|
||||
void SyncOptimize();
|
||||
|
||||
std::deque<_AddRemovePath> addRemoveQueue;
|
||||
class _AddRemovePath{
|
||||
public:
|
||||
bool add;
|
||||
utfstring path;
|
||||
};
|
||||
|
||||
MetadataReaderList metadataReaders;
|
||||
typedef std::vector<boost::shared_ptr<Plugin::IMetaDataReader>> MetadataReaderList;
|
||||
|
||||
};
|
||||
} }
|
||||
std::deque<_AddRemovePath> addRemoveQueue;
|
||||
|
||||
MetadataReaderList metadataReaders;
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} } // musik::core
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
@ -37,10 +37,12 @@
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
#include <core/config_filesystem.h>
|
||||
#include <core/Query/Base.h>
|
||||
#include <core/Common.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
//#include <boost/function.hpp>
|
||||
|
||||
using namespace musik::core;
|
||||
|
||||
|
@ -36,16 +36,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define INCLUDE_BOOSTFS
|
||||
#include <core/config.h>
|
||||
#include <core/db/Connection.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <sigslot/sigslot.h>
|
||||
#include <string>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik{ namespace core{
|
||||
class Indexer;
|
||||
|
||||
@ -54,217 +58,206 @@ namespace musik{ namespace core{
|
||||
typedef boost::shared_ptr<musik::core::Query::Base> Ptr;
|
||||
}
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <sigslot/sigslot.h>
|
||||
#include <string>
|
||||
namespace musik{ namespace core{ namespace Library{
|
||||
|
||||
namespace musik{ namespace core{
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///This is the base class that all Libraries should extend.
|
||||
///
|
||||
///The Library::Base is the main interface for all libraries
|
||||
///and contains the main functionallity for parsing the query queue
|
||||
///and is responsible for calling callbacks in the right order.
|
||||
///
|
||||
///\remarks
|
||||
///Library::Base is only the interface and can not be used directly.
|
||||
///Library::Base extends the ThreadHelper and is therefore a noncopyable object.
|
||||
///
|
||||
///\see
|
||||
///musik::core::Library::LocalDB
|
||||
//////////////////////////////////////////
|
||||
class Base : boost::noncopyable{
|
||||
public:
|
||||
Base(void);
|
||||
virtual ~Base(void);
|
||||
|
||||
namespace Library{
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///This is the base class that all Libraries should extend.
|
||||
///Start up the Library thread(s)
|
||||
///
|
||||
///The Library::Base is the main interface for all libraries
|
||||
///and contains the main functionallity for parsing the query queue
|
||||
///and is responsible for calling callbacks in the right order.
|
||||
///\returns
|
||||
///True if successfully started.
|
||||
///
|
||||
///The Startup method will start all the librarys threads.
|
||||
//////////////////////////////////////////
|
||||
virtual bool Startup()=0;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Get state of the library
|
||||
///
|
||||
///\returns
|
||||
///Status of the library. May be empty.
|
||||
///
|
||||
///Get the current status of the Library.
|
||||
///Will for instance report current status of the indexer in the LocalDB.
|
||||
///
|
||||
///\remarks
|
||||
///Library::Base is only the interface and can not be used directly.
|
||||
///Library::Base extends the ThreadHelper and is therefore a noncopyable object.
|
||||
///Empty string means that the library thread is holding.
|
||||
//////////////////////////////////////////
|
||||
virtual utfstring GetInfo()=0;
|
||||
|
||||
virtual bool AddQuery( const Query::Base &query,unsigned int options=0 );
|
||||
|
||||
virtual bool RunCallbacks();
|
||||
|
||||
utfstring GetLibraryDirectory();
|
||||
|
||||
bool QueryCanceled();
|
||||
|
||||
|
||||
virtual musik::core::Indexer *Indexer();
|
||||
|
||||
bool Exited();
|
||||
|
||||
static bool IsStaticMetaKey(std::string &metakey);
|
||||
static bool IsSpecialMTOMetaKey(std::string &metakey);
|
||||
static bool IsSpecialMTMMetaKey(std::string &metakey);
|
||||
|
||||
|
||||
static void CreateDatabase(db::Connection &db);
|
||||
|
||||
protected:
|
||||
// Methods:
|
||||
virtual void Exit();
|
||||
|
||||
Query::Ptr GetNextQuery();
|
||||
|
||||
virtual void CancelCurrentQuery( );
|
||||
|
||||
utfstring GetDBPath();
|
||||
|
||||
private:
|
||||
// Methods:
|
||||
|
||||
bool ClearFinishedQueries();
|
||||
|
||||
public:
|
||||
// Variables:
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Signal called when query queue goes from empty to not empty.
|
||||
///
|
||||
///The OnQueryQueueStart signal will be called when the query queue is
|
||||
///filled with queries. This signal is usefull when you are calling the
|
||||
///RunCallbacks method from a windows timer function. Just connect a slot
|
||||
///to this signal and start the timer when it's called. The timer can then
|
||||
///be removed on the OnQueryQueueEnd signal is called.
|
||||
///
|
||||
///\see
|
||||
///musik::core::Library::LocalDB
|
||||
///OnQueryQueueEnd
|
||||
//////////////////////////////////////////
|
||||
class Base : boost::noncopyable{
|
||||
public:
|
||||
Base(void);
|
||||
virtual ~Base(void);
|
||||
sigslot::signal0<> OnQueryQueueStart;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Start up the Library thread(s)
|
||||
///
|
||||
///\returns
|
||||
///True if successfully started.
|
||||
///
|
||||
///The Startup method will start all the librarys threads.
|
||||
//////////////////////////////////////////
|
||||
virtual bool Startup()=0;
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Signal called when query queue goes from not empty to empty.
|
||||
///
|
||||
///The OnQueryQueueEnd signal will be called when the query queue is
|
||||
///empty again and all callbacks has been called.
|
||||
///This signal is usefull when you are calling the
|
||||
///RunCallbacks method from a windows timer function. Just connect a slot
|
||||
///to the OnQueryQueueStart signal and start the timer when it's called.
|
||||
///The timer can then be removed on the OnQueryQueueEnd signal is called.
|
||||
///
|
||||
///\see
|
||||
///OnQueryQueueStart
|
||||
//////////////////////////////////////////
|
||||
sigslot::signal0<> OnQueryQueueEnd;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Get state of the library
|
||||
///
|
||||
///\returns
|
||||
///Status of the library. May be empty.
|
||||
///
|
||||
///Get the current status of the Library.
|
||||
///Will for instance report current status of the indexer in the LocalDB.
|
||||
///
|
||||
///\remarks
|
||||
///Empty string means that the library thread is holding.
|
||||
//////////////////////////////////////////
|
||||
virtual utfstring GetInfo()=0;
|
||||
|
||||
virtual bool AddQuery( const Query::Base &query,unsigned int options=0 );
|
||||
|
||||
virtual bool RunCallbacks();
|
||||
|
||||
utfstring GetLibraryDirectory();
|
||||
|
||||
bool QueryCanceled();
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///This mutex is used by the queries for protecting the outgoing results.
|
||||
///
|
||||
///\remarks
|
||||
///This mutex needs to be public
|
||||
//////////////////////////////////////////
|
||||
boost::mutex oResultMutex;
|
||||
|
||||
|
||||
virtual musik::core::Indexer *Indexer();
|
||||
protected:
|
||||
typedef std::list<Query::Ptr> QueryList;
|
||||
// Variables:
|
||||
|
||||
bool Exited();
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Is the current query canceled?
|
||||
///
|
||||
///\see
|
||||
///CancelCurrentQuery|QueryCanceled
|
||||
//////////////////////////////////////////
|
||||
bool bCurrentQueryCanceled;
|
||||
|
||||
static bool IsStaticMetaKey(std::string &metakey);
|
||||
static bool IsSpecialMTOMetaKey(std::string &metakey);
|
||||
static bool IsSpecialMTMMetaKey(std::string &metakey);
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///queue (std::list) for incoming queries.
|
||||
//////////////////////////////////////////
|
||||
QueryList incomingQueries;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///queue (std::list) for finished queries that havn't
|
||||
///been run through the callbacks yet.
|
||||
//////////////////////////////////////////
|
||||
QueryList outgoingQueries;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Current running query
|
||||
//////////////////////////////////////////
|
||||
Query::Ptr runningQuery;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Identifier of the library.
|
||||
///This is used for directory name where the library is located.
|
||||
///
|
||||
///\see
|
||||
///GetLibraryDirectory
|
||||
//////////////////////////////////////////
|
||||
utfstring identifier;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///A thread_group of all the librarys running threads.
|
||||
///
|
||||
///\see
|
||||
///ThreadHelper
|
||||
//////////////////////////////////////////
|
||||
boost::thread_group threads;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Internal state of the library
|
||||
//////////////////////////////////////////
|
||||
bool queueCallbackStarted;
|
||||
|
||||
bool exit;
|
||||
boost::condition waitCondition;
|
||||
public:
|
||||
boost::mutex libraryMutex;
|
||||
|
||||
|
||||
static void CreateDatabase(db::Connection &db);
|
||||
};
|
||||
|
||||
protected:
|
||||
// Methods:
|
||||
virtual void Exit();
|
||||
|
||||
Query::Ptr GetNextQuery();
|
||||
|
||||
virtual void CancelCurrentQuery( );
|
||||
|
||||
utfstring GetDBPath();
|
||||
|
||||
private:
|
||||
// Methods:
|
||||
|
||||
bool ClearFinishedQueries();
|
||||
|
||||
public:
|
||||
// Variables:
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Signal called when query queue goes from empty to not empty.
|
||||
///
|
||||
///The OnQueryQueueStart signal will be called when the query queue is
|
||||
///filled with queries. This signal is usefull when you are calling the
|
||||
///RunCallbacks method from a windows timer function. Just connect a slot
|
||||
///to this signal and start the timer when it's called. The timer can then
|
||||
///be removed on the OnQueryQueueEnd signal is called.
|
||||
///
|
||||
///\see
|
||||
///OnQueryQueueEnd
|
||||
//////////////////////////////////////////
|
||||
sigslot::signal0<> OnQueryQueueStart;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Signal called when query queue goes from not empty to empty.
|
||||
///
|
||||
///The OnQueryQueueEnd signal will be called when the query queue is
|
||||
///empty again and all callbacks has been called.
|
||||
///This signal is usefull when you are calling the
|
||||
///RunCallbacks method from a windows timer function. Just connect a slot
|
||||
///to the OnQueryQueueStart signal and start the timer when it's called.
|
||||
///The timer can then be removed on the OnQueryQueueEnd signal is called.
|
||||
///
|
||||
///\see
|
||||
///OnQueryQueueStart
|
||||
//////////////////////////////////////////
|
||||
sigslot::signal0<> OnQueryQueueEnd;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///This mutex is used by the queries for protecting the outgoing results.
|
||||
///
|
||||
///\remarks
|
||||
///This mutex needs to be public
|
||||
//////////////////////////////////////////
|
||||
boost::mutex oResultMutex;
|
||||
|
||||
|
||||
protected:
|
||||
typedef std::list<Query::Ptr> QueryList;
|
||||
// Variables:
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Is the current query canceled?
|
||||
///
|
||||
///\see
|
||||
///CancelCurrentQuery|QueryCanceled
|
||||
//////////////////////////////////////////
|
||||
bool bCurrentQueryCanceled;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///queue (std::list) for incoming queries.
|
||||
//////////////////////////////////////////
|
||||
QueryList incomingQueries;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///queue (std::list) for finished queries that havn't
|
||||
///been run through the callbacks yet.
|
||||
//////////////////////////////////////////
|
||||
QueryList outgoingQueries;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Current running query
|
||||
//////////////////////////////////////////
|
||||
Query::Ptr runningQuery;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///This mutex protects incomingQueries, outgoingQueries, runningQuery and iState
|
||||
//////////////////////////////////////////
|
||||
// boost::mutex queryQueueMutex;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Condition for notifying when a query is finished.
|
||||
//////////////////////////////////////////
|
||||
// boost::condition queryNotify;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Identifier of the library.
|
||||
///This is used for directory name where the library is located.
|
||||
///
|
||||
///\see
|
||||
///GetLibraryDirectory
|
||||
//////////////////////////////////////////
|
||||
utfstring identifier;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///A thread_group of all the librarys running threads.
|
||||
///
|
||||
///\see
|
||||
///ThreadHelper
|
||||
//////////////////////////////////////////
|
||||
boost::thread_group threads;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Internal state of the library
|
||||
//////////////////////////////////////////
|
||||
bool queueCallbackStarted;
|
||||
|
||||
bool exit;
|
||||
boost::condition waitCondition;
|
||||
public:
|
||||
boost::mutex libraryMutex;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} } } // musik::core::Library
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{
|
||||
typedef boost::shared_ptr<musik::core::Library::Base> LibraryPtr;
|
||||
|
||||
} }
|
||||
|
@ -36,13 +36,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik{ namespace core{
|
||||
namespace Query{
|
||||
class Base;
|
||||
}
|
||||
} }
|
||||
|
||||
#include <string>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/db/Connection.h>
|
||||
@ -51,46 +52,52 @@ namespace musik{ namespace core{
|
||||
#include <core/Library/Base.h>
|
||||
#include <core/Indexer.h>
|
||||
|
||||
namespace musik{ namespace core{
|
||||
namespace Library{
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{ namespace Library{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Library used for your local music.
|
||||
///
|
||||
///This library is used for music located
|
||||
///on you local computer.
|
||||
///
|
||||
///\see
|
||||
///Indexer
|
||||
//////////////////////////////////////////
|
||||
class LocalDB : public Library::Base{
|
||||
public:
|
||||
// Methods:
|
||||
LocalDB(void);
|
||||
~LocalDB(void);
|
||||
|
||||
bool Startup();
|
||||
utfstring GetInfo();
|
||||
musik::core::Indexer *Indexer();
|
||||
|
||||
protected:
|
||||
void CancelCurrentQuery( );
|
||||
|
||||
private:
|
||||
// Methods:
|
||||
|
||||
void ThreadLoop();
|
||||
|
||||
private:
|
||||
// Variables:
|
||||
db::Connection db;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Library used for your local music.
|
||||
///
|
||||
///This library is used for music located
|
||||
///on you local computer.
|
||||
///
|
||||
///\see
|
||||
///Indexer
|
||||
///Indexer that indexes all your tracks.
|
||||
//////////////////////////////////////////
|
||||
class LocalDB : public Library::Base{
|
||||
public:
|
||||
// Methods:
|
||||
LocalDB(void);
|
||||
~LocalDB(void);
|
||||
musik::core::Indexer indexer;
|
||||
|
||||
bool Startup();
|
||||
utfstring GetInfo();
|
||||
musik::core::Indexer *Indexer();
|
||||
};
|
||||
|
||||
protected:
|
||||
void CancelCurrentQuery( );
|
||||
|
||||
private:
|
||||
// Methods:
|
||||
|
||||
void ThreadLoop();
|
||||
|
||||
private:
|
||||
// Variables:
|
||||
db::Connection db;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Indexer that indexes all your tracks.
|
||||
//////////////////////////////////////////
|
||||
musik::core::Indexer indexer;
|
||||
|
||||
};
|
||||
}
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} } } // musik::core::Library
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
222
src/core/Library/Remote.cpp
Normal file
222
src/core/Library/Remote.cpp
Normal file
@ -0,0 +1,222 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <core/Library/Remote.h>
|
||||
#include <core/Query/Base.h>
|
||||
#include <core/Preferences.h>
|
||||
#include <core/xml/Parser.h>
|
||||
#include <core/xml/Writer.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
||||
using namespace musik::core;
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Constructor.
|
||||
///
|
||||
///The constructor will not start the Library.
|
||||
///
|
||||
///\see
|
||||
///Startup
|
||||
//////////////////////////////////////////
|
||||
Library::Remote::Remote(void)
|
||||
:socket(ioService)
|
||||
{
|
||||
}
|
||||
|
||||
Library::Remote::~Remote(void){
|
||||
this->Exit();
|
||||
this->threads.join_all();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Get a short status string of what is going on in the Library.
|
||||
///
|
||||
///\returns
|
||||
///Information string.
|
||||
///
|
||||
///The information is mostly used to get the information
|
||||
///about the Indexer.
|
||||
//////////////////////////////////////////
|
||||
utfstring Library::Remote::GetInfo(){
|
||||
return UTF("");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Startup the library threads.
|
||||
///
|
||||
///\returns
|
||||
///True if successfully started. This should always be true. Nothing else is expected.
|
||||
//////////////////////////////////////////
|
||||
bool Library::Remote::Startup(){
|
||||
|
||||
// Lets start the ReadThread first, it will startup the connection and
|
||||
// then start the WriteThread
|
||||
this->threads.create_thread(boost::bind(&Library::Remote::ReadThread,this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Thread for reading from the socket
|
||||
//////////////////////////////////////////
|
||||
void Library::Remote::ReadThread(){
|
||||
|
||||
boost::asio::ip::tcp::resolver resolver(this->ioService);
|
||||
boost::asio::ip::tcp::resolver::query resolverQuery(this->address,this->port);
|
||||
|
||||
boost::asio::ip::tcp::resolver::iterator endpointIterator = resolver.resolve(resolverQuery);
|
||||
boost::asio::ip::tcp::resolver::iterator end;
|
||||
|
||||
boost::system::error_code error = boost::asio::error::host_not_found;
|
||||
while (error && endpointIterator!=end){
|
||||
this->socket.close();
|
||||
this->socket.connect(*endpointIterator++, error);
|
||||
}
|
||||
if (error){
|
||||
this->Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
// Successfully connected to server
|
||||
// Start the WriteThread
|
||||
this->threads.create_thread(boost::bind(&Library::Remote::WriteThread,this));
|
||||
|
||||
// Lets start recieving queries
|
||||
xml::Parser parser(&this->socket);
|
||||
if( xml::ParserNode rootNode=parser.ChildNode("musik")){
|
||||
while(xml::ParserNode node=rootNode.ChildNode()){
|
||||
if(node.Name()=="queryresults"){
|
||||
|
||||
unsigned int queryId = boost::lexical_cast<unsigned int>(node.Attributes()["id"]);
|
||||
Query::Ptr currentQuery;
|
||||
// This is a query node
|
||||
// Find the query in the outgoingQueries list
|
||||
{
|
||||
boost::mutex::scoped_lock lock(this->libraryMutex);
|
||||
// Reverse loop since it's most likely the query is in the end
|
||||
for(QueryList::reverse_iterator query=this->outgoingQueries.rbegin();query!=this->outgoingQueries.rend();++query){
|
||||
if( (*query)->iQueryId==queryId ){
|
||||
currentQuery = *query;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->Exit();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Thread for writing to the socket
|
||||
//////////////////////////////////////////
|
||||
void Library::Remote::WriteThread(){
|
||||
|
||||
xml::Writer writer(&this->socket);
|
||||
|
||||
// Start by writing the musik-tag
|
||||
xml::WriterNode rootNode(writer,"musik");
|
||||
|
||||
while(!this->Exited()){
|
||||
Query::Ptr query(this->GetNextQuery());
|
||||
|
||||
if(query){ // No empty query
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Add to the finished queries
|
||||
{
|
||||
boost::mutex::scoped_lock lock(this->libraryMutex);
|
||||
this->bCurrentQueryCanceled = false;
|
||||
this->runningQuery = query;
|
||||
this->outgoingQueries.push_back(query);
|
||||
|
||||
// Set query as started
|
||||
// query->status |= Query::Base::Status::Started;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Lets send the query
|
||||
xml::WriterNode queryNode(rootNode,"query");
|
||||
queryNode.Attributes()["type"] = query->Name();
|
||||
queryNode.Attributes()["id"] = boost::lexical_cast<std::string>(query->iQueryId);
|
||||
|
||||
query->SendQuery(queryNode);
|
||||
|
||||
// Check if writer has quit
|
||||
if(writer.Exited()){
|
||||
this->Exit();
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Tricky part, waiting for queries to be added.
|
||||
// Not sure I'm doing this the right way.
|
||||
// Could this part lead to a deadlock???
|
||||
boost::mutex::scoped_lock lock(this->libraryMutex);
|
||||
if(!this->exit && this->incomingQueries.size()==0 ){
|
||||
this->waitCondition.wait(lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Cancel the current running query
|
||||
///
|
||||
///This method will also send a sqlite3_interrupt to cancel the
|
||||
///current running SQL Query
|
||||
//////////////////////////////////////////
|
||||
void Library::Remote::CancelCurrentQuery( ){
|
||||
this->bCurrentQueryCanceled = true;
|
||||
}
|
||||
|
||||
|
89
src/core/Library/Remote.h
Normal file
89
src/core/Library/Remote.h
Normal file
@ -0,0 +1,89 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace musik{ namespace core{
|
||||
namespace Query{
|
||||
class Base;
|
||||
}
|
||||
} }
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{ namespace Library{
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Library used for your remote music.
|
||||
//////////////////////////////////////////
|
||||
class Remote : public Library::Base{
|
||||
public:
|
||||
// Methods:
|
||||
Remote(void);
|
||||
~Remote(void);
|
||||
|
||||
bool Startup();
|
||||
utfstring GetInfo();
|
||||
|
||||
protected:
|
||||
void CancelCurrentQuery( );
|
||||
|
||||
private:
|
||||
// Methods:
|
||||
void ReadThread();
|
||||
void WriteThread();
|
||||
|
||||
private:
|
||||
// Variables:
|
||||
boost::asio::io_service ioService;
|
||||
boost::asio::ip::tcp::socket socket;
|
||||
|
||||
std::string address;
|
||||
std::string port;
|
||||
|
||||
};
|
||||
//////////////////////////////////////////
|
||||
} } }
|
||||
//////////////////////////////////////////
|
||||
|
@ -35,7 +35,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include "pch.hpp"
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <Library/LocalDB.h>
|
||||
#include <core/Library/LocalDB.h>
|
||||
|
||||
using namespace musik::core;
|
||||
|
||||
@ -51,9 +51,6 @@ LibraryFactory::LibraryFactory(void) : currentPosition(0){
|
||||
LibraryFactory::~LibraryFactory(void){
|
||||
}
|
||||
|
||||
/*LibraryFactory& LibraryFactory::Instance(){
|
||||
return sInstance;
|
||||
}*/
|
||||
|
||||
LibraryPtr LibraryFactory::GetCurrentLibrary(){
|
||||
return Instance().GetLibrary(sInstance.currentPosition);
|
||||
|
@ -39,33 +39,39 @@
|
||||
#include <core/Library/Base.h>
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{
|
||||
|
||||
class LibraryFactory{
|
||||
private:
|
||||
static LibraryFactory sInstance;
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef sigslot::signal1<LibraryPtr> LibraryChangeEvent;
|
||||
class LibraryFactory{
|
||||
private:
|
||||
static LibraryFactory sInstance;
|
||||
public:
|
||||
|
||||
static LibraryFactory& Instance(){ return sInstance; };
|
||||
static LibraryPtr GetCurrentLibrary();
|
||||
static LibraryChangeEvent& OnLibraryChange();
|
||||
typedef sigslot::signal1<LibraryPtr> LibraryChangeEvent;
|
||||
|
||||
private:
|
||||
static LibraryFactory& Instance(){ return sInstance; };
|
||||
static LibraryPtr GetCurrentLibrary();
|
||||
static LibraryChangeEvent& OnLibraryChange();
|
||||
|
||||
sigslot::signal1<LibraryPtr> OnLibraryChangeSignal;
|
||||
LibraryPtr GetLibrary(int position);
|
||||
private:
|
||||
|
||||
std::vector<LibraryPtr> libraries;
|
||||
int currentPosition;
|
||||
sigslot::signal1<LibraryPtr> OnLibraryChangeSignal;
|
||||
LibraryPtr GetLibrary(int position);
|
||||
|
||||
LibraryFactory(void);
|
||||
~LibraryFactory(void);
|
||||
std::vector<LibraryPtr> libraries;
|
||||
int currentPosition;
|
||||
|
||||
|
||||
LibraryFactory(void);
|
||||
~LibraryFactory(void);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} }
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} } // musik::core
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/IPlugin.h>
|
||||
|
||||
|
@ -36,22 +36,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/db/Statement.h>
|
||||
#include <core/xml/ParserNode.h>
|
||||
#include <core/xml/WriterNode.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <string>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare
|
||||
namespace musik{ namespace core{
|
||||
namespace db{
|
||||
class Connection;
|
||||
}
|
||||
namespace Library{
|
||||
class Base;
|
||||
class LocalDB;
|
||||
class Remote;
|
||||
}
|
||||
namespace server{
|
||||
class Connection;
|
||||
@ -59,6 +53,15 @@ namespace musik{ namespace core{
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <core/config.h>
|
||||
#include <sigslot/sigslot.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <core/xml/ParserNode.h>
|
||||
#include <core/xml/WriterNode.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{ namespace Query{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -85,6 +88,7 @@ class Base : public sigslot::has_slots<> {
|
||||
|
||||
protected:
|
||||
friend class Library::Base;
|
||||
friend class Library::Remote;
|
||||
friend class Library::LocalDB;
|
||||
friend class server::Connection;
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "pch.hpp"
|
||||
#include <core/Query/SortTracks.h>
|
||||
#include <core/Library/Base.h>
|
||||
#include <core/config_format.h>
|
||||
|
||||
using namespace musik::core;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/config.h>
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
@ -37,7 +37,10 @@
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <core/Track.h>
|
||||
#include <core/config_filesystem.h>
|
||||
|
||||
#include <core/Common.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/db/Statement.h>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
|
198
src/core/Track.h
198
src/core/Track.h
@ -36,111 +36,119 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <core/config_filesystem.h>
|
||||
|
||||
#include <core/TrackMeta.h>
|
||||
#include <core/ITrack.h>
|
||||
|
||||
#include <vector>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/TrackMeta.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/ITrack.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik{ namespace core{
|
||||
|
||||
// Forward declare
|
||||
class Track;
|
||||
namespace Library{
|
||||
class Base;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
* shared pointer to a track.
|
||||
*
|
||||
* The TrackPtr is used almost everywhere since the Tracks can be
|
||||
* shared between different threads.
|
||||
*
|
||||
* \remarks
|
||||
* For the Tracks to be thread-safe, you need to pass the ThreadHelper object when required.
|
||||
*
|
||||
* \see
|
||||
* Track|TrackVector
|
||||
*/
|
||||
typedef boost::shared_ptr<Track> TrackPtr;
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
* Track is the main class for handling Tracks.
|
||||
*
|
||||
* \see
|
||||
* TrackPtr|TrackVector
|
||||
*/
|
||||
class Track : public ITrack {
|
||||
public:
|
||||
Track(void);
|
||||
Track(DBINT newId);
|
||||
~Track(void);
|
||||
|
||||
|
||||
TrackMeta::TagMapIteratorPair GetAllValues() const;
|
||||
|
||||
//void SetValue(const TrackMeta::Key &key,TrackMeta::Value &value);
|
||||
|
||||
TrackMeta::TagMapIteratorPair GetValues(const char* metakey) const;
|
||||
|
||||
const utfchar* GetValue(const char* metakey) const;
|
||||
void SetValue(const char* metakey,const utfchar* value);
|
||||
void SetThumbnail(const char *data,unsigned int size);
|
||||
|
||||
|
||||
void InitMeta(Library::Base *library);
|
||||
bool HasMeta();
|
||||
|
||||
// static const utfstring emptyString;
|
||||
DBINT id;
|
||||
|
||||
void ClearMeta();
|
||||
TrackPtr Copy();
|
||||
|
||||
private:
|
||||
// const TrackMeta::Value& GetValue(const TrackMeta::Key &key) const;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
* A pointer to a std::multimap of all required tags.
|
||||
*
|
||||
* \remarks
|
||||
* The reason that this is a pointer and not a multimap on it's own
|
||||
* is that we try to keep the Track as small as possible since there
|
||||
* may be several thousand in use at the same time
|
||||
*/
|
||||
TrackMeta *meta;
|
||||
|
||||
|
||||
inline const TrackMeta::Value& _GetValue(const TrackMeta::Key & key) const;
|
||||
|
||||
private:
|
||||
friend class Indexer;
|
||||
|
||||
bool CompareDBAndFileInfo(const boost::filesystem::utfpath &file,db::Connection &dbConnection,DBINT currentFolderId);
|
||||
bool Save(db::Connection &dbConnection,utfstring libraryDirectory,DBINT folderId);
|
||||
DBINT _GetGenre(db::Connection &dbConnection,utfstring genre,bool addRelation,bool aggregated=false);
|
||||
DBINT _GetArtist(db::Connection &dbConnection,utfstring artist,bool addRelation,bool aggregated=false);
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
* A vector of TrackPtr
|
||||
*
|
||||
* \see
|
||||
* Track|TrackPtr
|
||||
*/
|
||||
typedef std::vector<TrackPtr> TrackVector;
|
||||
|
||||
namespace db{
|
||||
class Connection;
|
||||
}
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
* shared pointer to a track.
|
||||
*
|
||||
* The TrackPtr is used almost everywhere since the Tracks can be
|
||||
* shared between different threads.
|
||||
*
|
||||
* \remarks
|
||||
* For the Tracks to be thread-safe, you need to pass the ThreadHelper object when required.
|
||||
*
|
||||
* \see
|
||||
* Track|TrackVector
|
||||
*/
|
||||
typedef boost::shared_ptr<Track> TrackPtr;
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
* A vector of TrackPtr
|
||||
*
|
||||
* \see
|
||||
* Track|TrackPtr
|
||||
*/
|
||||
typedef std::vector<TrackPtr> TrackVector;
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
* Track is the main class for handling Tracks.
|
||||
*
|
||||
* \see
|
||||
* TrackPtr|TrackVector
|
||||
*/
|
||||
class Track : public ITrack {
|
||||
public:
|
||||
Track(void);
|
||||
Track(DBINT newId);
|
||||
~Track(void);
|
||||
|
||||
|
||||
TrackMeta::TagMapIteratorPair GetAllValues() const;
|
||||
|
||||
//void SetValue(const TrackMeta::Key &key,TrackMeta::Value &value);
|
||||
|
||||
TrackMeta::TagMapIteratorPair GetValues(const char* metakey) const;
|
||||
|
||||
const utfchar* GetValue(const char* metakey) const;
|
||||
void SetValue(const char* metakey,const utfchar* value);
|
||||
void SetThumbnail(const char *data,unsigned int size);
|
||||
|
||||
|
||||
void InitMeta(Library::Base *library);
|
||||
bool HasMeta();
|
||||
|
||||
DBINT id;
|
||||
|
||||
void ClearMeta();
|
||||
TrackPtr Copy();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
* A pointer to a std::multimap of all required tags.
|
||||
*
|
||||
* \remarks
|
||||
* The reason that this is a pointer and not a multimap on it's own
|
||||
* is that we try to keep the Track as small as possible since there
|
||||
* may be several thousand in use at the same time
|
||||
*/
|
||||
TrackMeta *meta;
|
||||
|
||||
|
||||
inline const TrackMeta::Value& _GetValue(const TrackMeta::Key & key) const;
|
||||
|
||||
private:
|
||||
friend class Indexer;
|
||||
|
||||
bool CompareDBAndFileInfo(const boost::filesystem::utfpath &file,db::Connection &dbConnection,DBINT currentFolderId);
|
||||
bool Save(db::Connection &dbConnection,utfstring libraryDirectory,DBINT folderId);
|
||||
DBINT _GetGenre(db::Connection &dbConnection,utfstring genre,bool addRelation,bool aggregated=false);
|
||||
DBINT _GetArtist(db::Connection &dbConnection,utfstring artist,bool addRelation,bool aggregated=false);
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} } // musik::core
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include <core/TrackMeta.h>
|
||||
#include <core/ThreadHelper.h>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
using namespace musik::core;
|
||||
|
||||
|
@ -36,50 +36,61 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <boost/utility.hpp>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forwar declare
|
||||
namespace musik{ namespace core{
|
||||
class Track;
|
||||
namespace Library{
|
||||
class Base;
|
||||
}
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <core/config.h>
|
||||
#include <map>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{
|
||||
class TrackMeta : boost::noncopyable{
|
||||
public:
|
||||
TrackMeta(Library::Base *library);
|
||||
~TrackMeta(void);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TrackMeta : boost::noncopyable{
|
||||
public:
|
||||
TrackMeta(Library::Base *library);
|
||||
~TrackMeta(void);
|
||||
|
||||
|
||||
typedef std::string Key;
|
||||
typedef utfstring Value;
|
||||
typedef std::multimap<Key,Value> TagMap;
|
||||
typedef TagMap::iterator TagMapIterator;
|
||||
typedef TagMap::const_iterator TagMapConstIterator;
|
||||
typedef std::pair<TagMapConstIterator,TagMapConstIterator> TagMapIteratorPair;
|
||||
typedef std::pair<Key,Value> TagMapPair;
|
||||
typedef std::string Key;
|
||||
typedef utfstring Value;
|
||||
typedef std::multimap<Key,Value> TagMap;
|
||||
typedef TagMap::iterator TagMapIterator;
|
||||
typedef TagMap::const_iterator TagMapConstIterator;
|
||||
typedef std::pair<TagMapConstIterator,TagMapConstIterator> TagMapIteratorPair;
|
||||
typedef std::pair<Key,Value> TagMapPair;
|
||||
|
||||
// static const utfstring emptyString;
|
||||
private:
|
||||
friend class Track;
|
||||
|
||||
const utfstring& GetValue(const Key &key) const;
|
||||
TrackMeta::TagMapIteratorPair GetValues(const char* metakey) const;
|
||||
void SetValue(const Key &key,const Value &value);
|
||||
const utfchar* GetValue(const char* metakey) const;
|
||||
|
||||
Library::Base *library;
|
||||
TrackMeta::TagMap tags;
|
||||
|
||||
private:
|
||||
friend class Track;
|
||||
char *thumbnailData;
|
||||
unsigned int thumbnailSize;
|
||||
void SetThumbnail(const char *data,unsigned int size);
|
||||
|
||||
const utfstring& GetValue(const Key &key) const;
|
||||
TrackMeta::TagMapIteratorPair GetValues(const char* metakey) const;
|
||||
void SetValue(const Key &key,const Value &value);
|
||||
const utfchar* GetValue(const char* metakey) const;
|
||||
private:
|
||||
const Value& _GetValue(const Key &key) const;
|
||||
|
||||
Library::Base *library;
|
||||
TrackMeta::TagMap tags;
|
||||
};
|
||||
|
||||
char *thumbnailData;
|
||||
unsigned int thumbnailSize;
|
||||
void SetThumbnail(const char *data,unsigned int size);
|
||||
|
||||
private:
|
||||
const Value& _GetValue(const Key &key) const;
|
||||
|
||||
};
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} } // musik::core
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/audio/AudioPacketizer.h>
|
||||
|
||||
using namespace musik::core::audio;
|
||||
|
@ -34,8 +34,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if ! defined(__MUSIK_CORE_CONFIG_H__)
|
||||
#define __MUSIK_CORE_CONFIG_H__
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -66,8 +65,7 @@ typedef unsigned int DBTIME;
|
||||
////////////////////////////////
|
||||
|
||||
#include <string>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
@ -94,16 +92,6 @@ typedef unsigned int DBTIME;
|
||||
//////////////////////////////////////////
|
||||
typedef wchar_t utfchar;
|
||||
|
||||
// Boost specific
|
||||
namespace boost{
|
||||
namespace filesystem{
|
||||
typedef boost::filesystem::wpath utfpath;
|
||||
typedef wdirectory_iterator utfdirectory_iterator;
|
||||
}
|
||||
|
||||
typedef wformat utfformat;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///utfstringstream is the stringstream for utfchar & utfstring
|
||||
@ -134,17 +122,6 @@ typedef unsigned int DBTIME;
|
||||
//////////////////////////////////////////
|
||||
#define UTF(x) x
|
||||
|
||||
// Boost specific
|
||||
namespace boost{
|
||||
namespace filesystem{
|
||||
typedef path utfpath;
|
||||
typedef directory_iterator utfdirectory_iterator;
|
||||
}
|
||||
|
||||
typedef format utfformat;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///utfstringstream is the stringstream for utfchar & utfstring
|
||||
@ -165,5 +142,3 @@ typedef std::basic_string<utfchar> utfstring;
|
||||
#define CopyFloat(dst, src, num) CopyMemory(dst, src, (num) * sizeof(float))
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
|
56
src/core/config_filesystem.h
Normal file
56
src/core/config_filesystem.h
Normal file
@ -0,0 +1,56 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/config.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#ifdef UTF_WIDECHAR
|
||||
namespace boost{
|
||||
namespace filesystem{
|
||||
typedef boost::filesystem::wpath utfpath;
|
||||
typedef wdirectory_iterator utfdirectory_iterator;
|
||||
}
|
||||
}
|
||||
#else
|
||||
namespace boost{
|
||||
namespace filesystem{
|
||||
typedef path utfpath;
|
||||
typedef directory_iterator utfdirectory_iterator;
|
||||
}
|
||||
}
|
||||
#endif
|
49
src/core/config_format.h
Normal file
49
src/core/config_format.h
Normal file
@ -0,0 +1,49 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#ifdef UTF_WIDECHAR
|
||||
namespace boost{
|
||||
typedef wformat utfformat;
|
||||
}
|
||||
#else
|
||||
namespace boost{
|
||||
typedef format utfformat;
|
||||
}
|
||||
#endif
|
@ -150,10 +150,6 @@
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ITrack.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pch.cpp"
|
||||
>
|
||||
@ -201,6 +197,14 @@
|
||||
RelativePath=".\config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\config_filesystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\config_format.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Preferences.cpp"
|
||||
>
|
||||
@ -370,6 +374,14 @@
|
||||
RelativePath=".\Library\LocalDB.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Library\Remote.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Library\Remote.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="db"
|
||||
@ -415,6 +427,10 @@
|
||||
<Filter
|
||||
Name="metadata"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ITrack.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MetadataValue.cpp"
|
||||
>
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Forward declare
|
||||
struct sqlite3_stmt;
|
||||
struct sqlite3_stmt;
|
||||
//////////////////////////////////////////
|
||||
|
||||
|
||||
|
@ -39,30 +39,39 @@
|
||||
|
||||
#pragma warning (disable : 4996 4018 4482)
|
||||
|
||||
|
||||
|
||||
#include <core/config.h>
|
||||
|
||||
#include <sigslot/sigslot.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/db/Statement.h>
|
||||
#include <core/db/CachedStatement.h>
|
||||
|
||||
#include <core/Query/Base.h>
|
||||
|
||||
#include <core/Track.h>
|
||||
#include <core/TrackMeta.h>
|
||||
|
||||
#include <core/xml/Node.h>
|
||||
#include <core/xml/WriterNode.h>
|
||||
#include <core/xml/ParserNode.h>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
/*
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/db/Statement.h>
|
||||
#include <core/db/CachedStatement.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
*/
|
||||
#include <vld/vld.h>
|
||||
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include <core/xml/Writer.h>
|
||||
#include <core/xml/WriterNode.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
using namespace musik::core::server;
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "pch.hpp"
|
||||
#include <core/xml/Parser.h>
|
||||
#include <core/xml/ParserNode.h>
|
||||
|
||||
#include <expat/expat.h>
|
||||
|
||||
using namespace musik::core::xml;
|
||||
|
||||
|
@ -36,23 +36,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/config.h>
|
||||
#include <expat/expat.h>
|
||||
#include <sigslot/sigslot.h>
|
||||
#include <string>
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
#include <core/xml/Node.h>
|
||||
#include <core/xml/ParserNode.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward
|
||||
typedef struct XML_ParserStruct *XML_Parser;
|
||||
|
||||
|
||||
namespace musik{ namespace core{ namespace xml{
|
||||
// Forward
|
||||
class ParserNode;
|
||||
} } }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{ namespace xml{
|
||||
|
||||
// Forward
|
||||
class ParserNode;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class Parser : public ParserNode{
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <core/config.h>
|
||||
#include <core/xml/Node.h>
|
||||
#include <boost/utility.hpp>
|
||||
#include <set>
|
||||
|
||||
using namespace musik::core::xml;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -73,6 +73,10 @@ void Writer::Exit(){
|
||||
this->exit = true;
|
||||
}
|
||||
|
||||
bool Writer::Exited(){
|
||||
return this->exit;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void Writer::Send(){
|
||||
|
||||
|
@ -53,6 +53,7 @@ class Writer : public WriterNode{
|
||||
public:
|
||||
Writer(boost::asio::ip::tcp::socket *socket);
|
||||
~Writer();
|
||||
bool Exited();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/BrowseController.hpp>
|
||||
#include <cube/BrowseView.hpp>
|
||||
#include <cube/TracklistController.hpp>
|
||||
#include <core/LibraryFactory.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -38,12 +38,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik { namespace cube {
|
||||
class BrowseView;
|
||||
class TracklistController;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cube/BrowseView.hpp>
|
||||
#include <cube/MetadataFilterController.hpp>
|
||||
#include <cube/TracklistController.hpp>
|
||||
|
||||
#include <core/Query/ListSelection.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -77,4 +80,4 @@ public: void SendQuery();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -38,6 +38,11 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/BrowseView.hpp>
|
||||
#include <cube/TracklistView.hpp>
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <win32cpp/Splitter.hpp>
|
||||
#include <win32cpp/BarLayout.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -38,10 +38,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <cube/TracklistView.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class ListView;
|
||||
class Splitter;
|
||||
class BarLayout;
|
||||
}
|
||||
namespace musik{ namespace cube{
|
||||
class TracklistView;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <win32cpp/Frame.hpp>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -73,4 +83,4 @@ protected: Splitter* mainVSplitter;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -38,6 +38,9 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/MainMenuController.hpp>
|
||||
#include <win32cpp/Application.hpp>
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -110,7 +113,7 @@ void MainMenuController::OnHelpAbout(MenuItemRef menuItem)
|
||||
MenuRef MainMenuController::CreateMenu()
|
||||
{
|
||||
// main menu
|
||||
this->mainMenu.reset(new Menu());
|
||||
this->mainMenu = Menu::Create();
|
||||
MenuItemCollection& mainItems = this->mainMenu->Items();
|
||||
//
|
||||
this->file = mainItems.Append(MenuItem::Create(_T("&File")));
|
||||
@ -120,14 +123,14 @@ MenuRef MainMenuController::CreateMenu()
|
||||
this->help = mainItems.Append(MenuItem::Create(_T("&Help")));
|
||||
|
||||
// file menu
|
||||
this->fileMenu.reset(new Menu());
|
||||
this->fileMenu = Menu::Create();
|
||||
MenuItemCollection& fileItems = this->fileMenu->Items();
|
||||
//
|
||||
this->file->SetSubMenu(this->fileMenu);
|
||||
this->fileExit = fileItems.Append(MenuItem::Create(_T("E&xit")));
|
||||
|
||||
// help menu
|
||||
this->helpMenu.reset(new Menu());
|
||||
this->helpMenu = Menu::Create();
|
||||
MenuItemCollection& helpItems = this->helpMenu->Items();
|
||||
//
|
||||
this->help->SetSubMenu(this->helpMenu);
|
||||
|
@ -38,9 +38,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp {
|
||||
class Window;
|
||||
class TopLevelWindow;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
#include <win32cpp/Menu.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -70,4 +75,4 @@ private: MenuItemRef fileExit, helpAbout;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -39,14 +39,21 @@
|
||||
#include "pch.hpp"
|
||||
#include <cube/MainWindowController.hpp>
|
||||
#include <cube/TransportView.hpp>
|
||||
#include <cube/TracklistView.hpp>
|
||||
#include <cube/SourcesView.hpp>
|
||||
#include <cube/SourcesController.hpp>
|
||||
#include <cube/TransportController.hpp>
|
||||
|
||||
#include <core/Library/LocalDB.h>
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <core/Pluginfactory.h>
|
||||
|
||||
#include <cube/resources/resource.h>
|
||||
|
||||
#include <win32cpp/Types.hpp> // uichar, uistring
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
#include <win32cpp/Splitter.hpp>
|
||||
#include <win32cpp/TabView.hpp>
|
||||
#include <win32cpp/RedrawLock.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace musik::cube;
|
||||
|
@ -38,16 +38,23 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Splitter;
|
||||
class TabView;
|
||||
class Window;
|
||||
class TopLevelWindow;
|
||||
}
|
||||
namespace musik { namespace cube {
|
||||
class SourcesController;
|
||||
class TransportController;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
#include <win32cpp/Button.hpp>
|
||||
#include <win32cpp/Types.hpp> // uichar, uistring
|
||||
#include <win32cpp/Timer.hpp>
|
||||
|
||||
#include <cube/MainMenuController.hpp>
|
||||
#include <cube/SourcesController.hpp>
|
||||
#include <cube/TransportController.hpp>
|
||||
|
||||
#include <core/LibraryFactory.h>
|
||||
|
||||
@ -73,6 +80,8 @@ protected: TopLevelWindow& mainWindow;
|
||||
protected: Splitter* clientView;
|
||||
protected: SourcesController* sourcesController;
|
||||
protected: TransportController* transportController;
|
||||
protected: TabView* tabView;
|
||||
|
||||
protected: MainMenuController menuController;
|
||||
protected: Timer LibraryCallbackTimer;
|
||||
|
||||
@ -84,4 +93,4 @@ protected: void QueryQueueLoop();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <cube/MetadataFilterModel.hpp>
|
||||
#include <cube/BrowseController.hpp>
|
||||
#include <core/Common.h>
|
||||
#include <win32cpp/RedrawLock.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -41,13 +41,11 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <win32cpp/Utility.hpp>
|
||||
|
||||
#include <cube/MetadataFilterModel.hpp>
|
||||
|
||||
#include <cube/MetadataFilterController.hpp>
|
||||
#include <cube/BrowseController.hpp>
|
||||
|
||||
#include <win32cpp/Utility.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
using namespace musik::cube;
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <core/MetadataValue.h>
|
||||
#include <core/Query/ListSelection.h>
|
||||
//#include <core/Query/ListSelection.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -75,4 +75,4 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -38,10 +38,13 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/SettingsController.hpp>
|
||||
#include <cube/SettingsView.hpp>
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <core/Indexer.h>
|
||||
|
||||
#include <win32cpp/FolderBrowseDialog.hpp>
|
||||
#include <win32cpp/Button.hpp>
|
||||
#include <win32cpp/Label.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -38,9 +38,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik { namespace cube {
|
||||
class SettingsView;
|
||||
} }
|
||||
namespace win32cpp{
|
||||
class Window;
|
||||
class Button;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cube/SettingsView.hpp>
|
||||
#include <cube/settings/SyncPathController.hpp>
|
||||
#include <win32cpp/Timer.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
@ -38,6 +38,11 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/SettingsView.hpp>
|
||||
#include <win32cpp/LinearLayout.hpp>
|
||||
#include <win32cpp/Button.hpp>
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <win32cpp/Label.hpp>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -37,12 +37,16 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Button;
|
||||
class ListView;
|
||||
class Label;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Frame.hpp>
|
||||
#include <win32cpp/Button.hpp>
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <win32cpp/Label.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -40,9 +40,9 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <cube/SourcesItem.hpp>
|
||||
#include <win32cpp/Exception.hpp>
|
||||
#include <vector>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -76,4 +76,4 @@ typedef boost::shared_ptr<SourcesCategory> SourcesCategoryRef;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // namespace musik::cube
|
||||
} } // namespace musik::cube
|
||||
|
@ -36,8 +36,9 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/SourcesListModel.hpp>
|
||||
#include <cube/SourcesController.hpp>
|
||||
#include <cube/SourcesListModel.hpp>
|
||||
#include <cube/SourcesView.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -120,4 +121,4 @@ void SC::ListController::OnListCreated(Window* window)
|
||||
void SC::ListController::OnListSelectionChanged(ListView* listView)
|
||||
{
|
||||
this->sourcesListModel->SelectedRowChanged(this->listView.SelectedRow());
|
||||
}
|
||||
}
|
||||
|
@ -38,9 +38,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik { namespace cube {
|
||||
class SourcesView;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cube/SourcesView.hpp>
|
||||
#include <cube/SourcesModel.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -92,4 +96,4 @@ private: ListModelRef sourcesListModel;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -38,9 +38,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Window;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <win32cpp/Types.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -60,4 +65,4 @@ public: virtual Window* View() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // namespace musik::cube
|
||||
} } // namespace musik::cube
|
||||
|
@ -40,7 +40,6 @@
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <cube/SourcesCategory.hpp>
|
||||
#include <list>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -145,4 +144,4 @@ protected: virtual void Render(const ListView& listView, ListView::RenderParams
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -42,8 +42,11 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/SourcesModel.hpp>
|
||||
#include <cube/TracklistView.hpp>
|
||||
#include <cube/TracklistController.hpp>
|
||||
|
||||
#include <core/PlaybackQueue.h>
|
||||
#include <win32cpp/Label.hpp>
|
||||
|
||||
using namespace musik::cube;
|
||||
|
||||
|
@ -39,7 +39,10 @@
|
||||
#include "pch.hpp"
|
||||
#include <cube/SourcesView.hpp>
|
||||
#include <cube/BrowseView.hpp>
|
||||
|
||||
#include <win32cpp/Splitter.hpp>
|
||||
#include <win32cpp/Label.hpp>
|
||||
#include <win32cpp/RedrawLock.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace musik::cube;
|
||||
@ -133,4 +136,4 @@ void SourcesView::OnListViewHotRowChanged(ListView* listView, int rowInde
|
||||
if (rowIndex >= 0) this->listView->RedrawRow(rowIndex);
|
||||
if (this->lastHotRowIndex != -1) this->listView->RedrawRow(this->lastHotRowIndex);
|
||||
this->lastHotRowIndex = rowIndex;
|
||||
}
|
||||
}
|
||||
|
@ -38,11 +38,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Splitter;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <win32cpp/Frame.hpp>
|
||||
|
||||
#include <cube/SourcesCategory.hpp>
|
||||
//#include <cube/SourcesCategory.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -79,4 +85,4 @@ protected: Splitter* splitter;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -1,5 +1,41 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include "TracklistColumn.hpp"
|
||||
#include <cube/TracklistColumn.hpp>
|
||||
|
||||
#include <core/MetaKey.h>
|
||||
|
||||
|
@ -1,3 +1,39 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/config.h>
|
||||
|
@ -38,9 +38,13 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/TracklistController.hpp>
|
||||
#include <cube/TracklistView.hpp>
|
||||
#include <cube/TracklistModel.hpp>
|
||||
#include <cube/TracklistColumn.hpp>
|
||||
#include <cube/TracklistInfoView.hpp>
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <win32cpp/Label.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -38,17 +38,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik { namespace cube {
|
||||
class TracklistView;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <core/config.h>
|
||||
#include <core/Query/ListBase.h>
|
||||
#include <core/tracklist/Standard.h>
|
||||
#include <core/Query/SortTracks.h>
|
||||
|
||||
#include <cube/TracklistView.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace win32cpp;
|
||||
@ -89,4 +92,4 @@ private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/TracklistInfoView.hpp>
|
||||
#include <win32cpp/Label.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -68,4 +69,4 @@ void TracklistInfoView::OnCreated()
|
||||
void TracklistInfoView::Layout()
|
||||
{
|
||||
base::Layout();
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik { namespace cube {
|
||||
class TracklistController;
|
||||
} }
|
||||
namespace win32cpp{
|
||||
class Label;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/LinearLayout.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -45,8 +56,6 @@ using namespace win32cpp;
|
||||
|
||||
namespace musik { namespace cube {
|
||||
|
||||
// Forward
|
||||
class TracklistController;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TracklistInfoView: public LinearLayout
|
||||
@ -64,4 +73,4 @@ private: Label *trackCountLabel, *durationLabel, *sizeLabel;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -41,6 +41,8 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/TracklistModel.hpp>
|
||||
#include <cube/TracklistColumn.hpp>
|
||||
|
||||
#include <win32cpp/Utility.hpp>
|
||||
|
||||
@ -48,8 +50,6 @@
|
||||
#include <core/PlaybackQueue.h>
|
||||
#include <core/MetaKey.h>
|
||||
|
||||
#include <cube/TracklistModel.hpp>
|
||||
#include <cube/TracklistColumn.hpp>
|
||||
|
||||
|
||||
using namespace musik::cube;
|
||||
|
@ -38,8 +38,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik{ namespace core{ namespace Query{
|
||||
class ListBase;
|
||||
} } }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <list>
|
||||
#include <core/tracklist/Standard.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -79,4 +85,4 @@ public: musik::core::tracklist::Standard::Ptr tracklist; // FIXME: no pub
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -38,6 +38,9 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/TracklistView.hpp>
|
||||
#include <cube/TracklistInfoView.hpp>
|
||||
#include <win32cpp/Frame.hpp>
|
||||
#include <win32cpp/ListView.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -64,4 +67,4 @@ void TracklistView::OnCreated()
|
||||
this->SetChildAlignment(this->infoView, ChildAlignCenter);
|
||||
this->SetChildFill(this->infoView, false);
|
||||
this->SetFlexibleChild(listViewFrame);
|
||||
}
|
||||
}
|
||||
|
@ -38,9 +38,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace musik { namespace cube {
|
||||
class TracklistInfoView;
|
||||
} }
|
||||
namespace win32cpp{
|
||||
class ListView;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cube/TracklistInfoView.hpp>
|
||||
#include <win32cpp/LinearLayout.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -66,4 +74,4 @@ private: TracklistInfoView* infoView;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -37,11 +37,15 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <cube/TransportController.hpp>
|
||||
|
||||
#include <cube/TransportView.hpp>
|
||||
#include <core/PlaybackQueue.h>
|
||||
#include <win32cpp/ApplicationThread.hpp>
|
||||
#include <win32cpp/Trackbar.hpp>
|
||||
#include <win32cpp/Button.hpp>
|
||||
#include <win32cpp/Label.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -270,4 +274,4 @@ win32cpp::uistring TransportController::FormatTime(unsigned long ms)
|
||||
format % seconds;
|
||||
|
||||
return format.str();
|
||||
}
|
||||
}
|
||||
|
@ -38,11 +38,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Trackbar;
|
||||
class Button;
|
||||
class Window;
|
||||
}
|
||||
namespace musik { namespace cube {
|
||||
class TransportView;
|
||||
} }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <core/PlaybackQueue.h>
|
||||
#include <cube/TransportView.hpp>
|
||||
#include <win32cpp/Timer.hpp>
|
||||
#include <core/Track.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -38,6 +38,11 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/TransportView.hpp>
|
||||
#include <win32cpp/LinearLayout.hpp>
|
||||
#include <win32cpp/Label.hpp>
|
||||
#include <win32cpp/Button.hpp>
|
||||
#include <win32cpp/Trackbar.hpp>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -38,9 +38,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Forward declare
|
||||
namespace win32cpp{
|
||||
class Button;
|
||||
class Label;
|
||||
class Trackbar;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/ListView.hpp>
|
||||
#include <win32cpp/Frame.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -67,4 +74,4 @@ protected: Label *titleLabel, *artistLabel, *timeElapsedLabel, *timeDurationLa
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} } // musik::cube
|
||||
} } // musik::cube
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#include "pch.hpp"
|
||||
#include <cube/MainWindowController.hpp>
|
||||
#include <win32cpp/Application.hpp>
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -48,14 +48,33 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#pragma warning (disable : 4996 4018 4482)
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/LibraryFactory.h>
|
||||
#include <core/ITrack.h>
|
||||
#include <core/Track.h>
|
||||
#include <core/TrackMeta.h>
|
||||
#include <core/db/dbconfig.h>
|
||||
#include <core/db/CachedStatement.h>
|
||||
#include <core/db/Connection.h>
|
||||
#include <core/db/ScopedTransaction.h>
|
||||
#include <core/db/Statement.h>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/win32cpp.hpp>
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <win32cpp/WindowGeometry.hpp>
|
||||
#include <win32cpp/Exception.hpp>
|
||||
#include <win32cpp/Container.hpp>
|
||||
#include <win32cpp/Font.hpp>
|
||||
#include <win32cpp/Menu.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
#include <win32cpp/Application.hpp>
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -38,12 +38,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
#include <win32cpp/TopLevelWindow.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -110,4 +108,4 @@ private: // class data
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -36,15 +36,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Application.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
#include <sigslot/sigslot.h>
|
||||
#include <list>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Application.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace win32cpp {
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include <pch.hpp>
|
||||
#include <win32cpp/BarLayout.hpp>
|
||||
#include <win32cpp/RedrawLock.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Panel.hpp>
|
||||
#include <win32cpp/ILayout.hpp>
|
||||
|
||||
@ -86,4 +86,4 @@ private: // instance data
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
|
||||
namespace win32cpp {
|
||||
@ -82,4 +82,4 @@ protected: // instance data
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -83,4 +83,4 @@ public: // operators
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -38,8 +38,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Types.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <vector>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -71,4 +71,4 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
|
||||
namespace win32cpp {
|
||||
@ -240,4 +240,4 @@ WindowType* Container::RemoveChild(WindowType* window)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -38,8 +38,8 @@
|
||||
|
||||
#include <pch.hpp>
|
||||
#include <win32cpp/DateTime.hpp>
|
||||
#include <win32cpp/Utility.hpp>
|
||||
#include <win32cpp/Win32Exception.hpp>
|
||||
#include <win32cpp/Utility.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <sstream>
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Locale.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -92,4 +92,4 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <pch.hpp>
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/EditView.hpp>
|
||||
#include <win32cpp/Application.hpp>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
|
||||
namespace win32cpp {
|
||||
@ -95,4 +95,4 @@ protected: // instance data
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -38,7 +38,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <string>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -69,4 +69,4 @@ private: // instance data
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include <pch.hpp>
|
||||
#include <win32cpp/Font.hpp>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace win32cpp;
|
||||
@ -390,4 +390,4 @@ HFONT Font::CreateHFONT(const Font& font, HDC hdc)
|
||||
}
|
||||
|
||||
return newFont;
|
||||
}
|
||||
}
|
||||
|
@ -40,9 +40,10 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <win32cpp/Exception.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -148,4 +149,4 @@ private: // instance data
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include <pch.hpp>
|
||||
#include <win32cpp/Frame.hpp>
|
||||
#include <win32cpp/Color.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -40,9 +40,8 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Panel.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
|
||||
namespace win32cpp {
|
||||
|
||||
|
@ -38,8 +38,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace win32cpp {
|
||||
@ -68,4 +66,4 @@ public: // methods
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
|
||||
namespace win32cpp {
|
||||
@ -75,4 +75,4 @@ protected: // instance data
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include <pch.hpp>
|
||||
#include <win32cpp/LinearLayout.hpp>
|
||||
#include <win32cpp/RedrawLock.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Panel.hpp>
|
||||
#include <win32cpp/ILayout.hpp>
|
||||
|
||||
@ -196,4 +196,4 @@ private: // instance data
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -168,6 +168,24 @@ LRESULT ListView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_RCLICK:
|
||||
{
|
||||
POINT mousePos = { 0 };
|
||||
::GetCursorPos(&mousePos);
|
||||
if (this->contextMenu)
|
||||
{
|
||||
::TrackPopupMenu(
|
||||
this->contextMenu->Handle(),
|
||||
NULL,
|
||||
mousePos.x,
|
||||
mousePos.y,
|
||||
NULL,
|
||||
this->Handle(),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case HDN_BEGINTRACK:
|
||||
{
|
||||
return ( ! this->columnsResizable);
|
||||
@ -994,6 +1012,14 @@ int ListView::SelectedRow()
|
||||
return this->selectedRowIndex;
|
||||
}
|
||||
|
||||
///\brief
|
||||
///Sets the context menu for the ListView. The context menu is displayed
|
||||
///whenever the user right clicks inside the ListView.
|
||||
void ListView::SetContextMenu(MenuRef contextMenu)
|
||||
{
|
||||
this->contextMenu = contextMenu;
|
||||
}
|
||||
|
||||
void ListView::SelectRows(const std::vector<int>& indices)
|
||||
{
|
||||
std::vector<int>::const_iterator it = indices.begin();
|
||||
|
@ -40,11 +40,10 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Window.hpp>
|
||||
#include <win32cpp/Win32Exception.hpp>
|
||||
#include <win32cpp/Color.hpp>
|
||||
#include <win32cpp/Font.hpp>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
@ -83,7 +82,7 @@ const int DefaultRowHeight = -1;
|
||||
///This makes displaying large amounts of data extremely efficient.
|
||||
///
|
||||
///ListView also supports custom drawing via CellRenderer and RowRenderer
|
||||
///objects. The model can optionally supply custom renderers to drastically
|
||||
///objects. The model can optionally supply custom renderers to easily
|
||||
///change the appearance of the view.
|
||||
///
|
||||
///\see
|
||||
@ -142,7 +141,7 @@ public: // events
|
||||
///\brief Emitted when the selection has changed
|
||||
SelectionChangedEvent SelectionChanged;
|
||||
///\brief Emitted when a Column is clicked
|
||||
ColumnClickedEvent ColumnClicked;
|
||||
ColumnClickedEvent ColumnClicked;
|
||||
|
||||
public: // constructors
|
||||
/*ctor*/ ListView();
|
||||
@ -177,6 +176,7 @@ public: // methods
|
||||
void SelectRow(int index);
|
||||
void DeselectRows(const std::vector<int>& indices);
|
||||
void DeselectRow(int index);
|
||||
void SetContextMenu(MenuRef contextMenu);
|
||||
|
||||
protected: // methods
|
||||
virtual HWND Create(Window* parent);
|
||||
@ -216,6 +216,7 @@ protected: // instance data
|
||||
RowIndexList selectedRows;
|
||||
int selectedRowIndex;
|
||||
bool selectedRowsDirty;
|
||||
MenuRef contextMenu;
|
||||
|
||||
protected: // class data
|
||||
static ModelRef sNullModel;
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <win32cpp/Locale.hpp>
|
||||
#include <win32cpp/Win32Exception.hpp>
|
||||
#include <win32cpp/Utility.hpp>
|
||||
#include "boost/filesystem/operations.hpp"
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -38,10 +38,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Config.hpp>
|
||||
#include <map>
|
||||
#include <map>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -103,4 +102,4 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -99,4 +99,4 @@ private: // instance data
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // win32cpp
|
||||
} // win32cpp
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include <win32cpp/Menu.hpp>
|
||||
#include <win32cpp/Win32Exception.hpp>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace win32cpp;
|
||||
@ -54,9 +52,34 @@ Menu::IDToMenuItemMap Menu::sIDToMenuItemRef;
|
||||
|
||||
/*ctor*/ Menu::Menu()
|
||||
: menuHandle(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
/*dtor*/ Menu::~Menu()
|
||||
{
|
||||
::DestroyMenu(this->menuHandle);
|
||||
}
|
||||
|
||||
MenuRef Menu::Create()
|
||||
{
|
||||
MenuRef menu(new Menu());
|
||||
menu->Initialize(::CreateMenu());
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
MenuRef Menu::CreatePopup()
|
||||
{
|
||||
MenuRef menu(new Menu());
|
||||
menu->Initialize(::CreatePopupMenu());
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
void Menu::Initialize(HMENU menuHandle)
|
||||
{
|
||||
this->items.reset(new MenuItemCollection(*this));
|
||||
this->menuHandle = ::CreateMenu();
|
||||
this->menuHandle = menuHandle;
|
||||
|
||||
if ( ! this->menuHandle)
|
||||
{
|
||||
@ -67,11 +90,6 @@ Menu::IDToMenuItemMap Menu::sIDToMenuItemRef;
|
||||
this->items->ItemRemoved.connect(this, &Menu::OnItemRemoved);
|
||||
}
|
||||
|
||||
/*dtor*/ Menu::~Menu()
|
||||
{
|
||||
::DestroyMenu(this->menuHandle);
|
||||
}
|
||||
|
||||
void Menu::OnItemAdded(MenuItemRef newMenuItem, unsigned index)
|
||||
{
|
||||
newMenuItem->Changed.connect(this, &Menu::OnItemChanged);
|
||||
@ -346,4 +364,4 @@ MenuItemRef MenuItemCollection::ItemAt(unsigned index)
|
||||
MenuItemRef MenuItemCollection::operator[](unsigned index)
|
||||
{
|
||||
return this->ItemAt(index);
|
||||
}
|
||||
}
|
||||
|
@ -38,14 +38,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Types.hpp>
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Exception.hpp>
|
||||
#include <win32cpp/Types.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <boost/utility.hpp> // noncopyable
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -146,7 +148,7 @@ private: // types
|
||||
typedef std::vector<MenuItemRef> MenuItemList;
|
||||
|
||||
private: // constructors
|
||||
/*ctor*/ MenuItemCollection(Menu& owner);
|
||||
/*ctor*/ MenuItemCollection(Menu& owner);
|
||||
|
||||
public: // methods
|
||||
MenuItemRef Append(MenuItemRef newMenuItem);
|
||||
@ -180,14 +182,21 @@ private: // types
|
||||
typedef std::map<UINT, MenuItemRef> IDToMenuItemMap;
|
||||
|
||||
public: // constructors, destructors
|
||||
/*ctor*/ Menu();
|
||||
/*dtor*/ ~Menu();
|
||||
|
||||
private: // constructors
|
||||
/*ctor*/ Menu();
|
||||
|
||||
public: // methods
|
||||
static MenuRef Create();
|
||||
static MenuRef CreatePopup();
|
||||
|
||||
MenuItemCollection& Items() { return (*this->items); }
|
||||
HMENU Handle() { return this->menuHandle; }
|
||||
|
||||
protected: // methods
|
||||
void Initialize(HMENU menu);
|
||||
|
||||
static void ItemActivated(UINT menuID); // used by Window
|
||||
void OnItemAdded(MenuItemRef newMenuItem, unsigned index);
|
||||
void OnItemRemoved(MenuItemRef oldMenuItem);
|
||||
|
@ -40,8 +40,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <win32cpp/Win32Config.hpp> // Must be first!
|
||||
#include <win32cpp/Window.hpp>
|
||||
#include <win32cpp/Win32Config.hpp>
|
||||
#include <win32cpp/Container.hpp>
|
||||
|
||||
namespace win32cpp {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user