--- a/src/file.h Sat Jun 15 01:29:46 2013 +0300 +++ b/src/file.h Sat Jun 15 04:20:44 2013 +0300 @@ -26,6 +26,7 @@ class History; class OpenProgressDialog; + namespace LDPaths { void initPaths (); bool tryConfigure (str path); @@ -138,6 +139,14 @@ str basename (str path); str dirname (str path); +// ============================================================================= +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// ============================================================================= +// FileLoader +// +// Loads the given file and parses it to LDObjects using parseLine. It's a +// separate class so as to be able to do the work in a separate thread. +// ============================================================================= class FileLoader : public QObject { Q_OBJECT @@ -158,4 +167,40 @@ void workDone (); }; +struct PrimitiveInfo { + str name, title; +}; + +// ============================================================================= +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// ============================================================================= +// PrimitiveLister +// +// Worker object that scans the primitives folder for primitives and +// builds an index of them. +// ============================================================================= +class PrimitiveLister : public QObject { + Q_OBJECT + +public: + static void start (); + +public slots: + void work (); + +signals: + void starting (ulong num); + void workDone (); + void update (ulong i); + +private: + vector<PrimitiveInfo> m_prims; +}; + +extern vector<PrimitiveInfo> g_Primitives; +extern PrimitiveLister* g_activePrimLister; +extern bool g_primListerMutex; + +void loadPrimitiveInfo (); + #endif // FILE_H \ No newline at end of file