diff options
| -rw-r--r-- | interchange.cxx | 27 | ||||
| -rw-r--r-- | interchange.hxx | 15 | 
2 files changed, 22 insertions, 20 deletions
diff --git a/interchange.cxx b/interchange.cxx index 2daba1e..c9faf1f 100644 --- a/interchange.cxx +++ b/interchange.cxx @@ -21,6 +21,15 @@ namespace QInterchange {  		interchange_cleanup();  	} +	void Interchange::flypage(QString const& path) +	{ +		interchange_flypage(path.toLatin1().constData(), +				[](interchange_response* response) { +			interchange->emitFlypage(QString{response->data}); +			interchange_free_response(response); +		}); +	} +  	void Interchange::catalog(QString const& prodGroup)  	{  		interchange_catalog(prodGroup.toLatin1().constData(), [](interchange_response* response) { @@ -42,14 +51,6 @@ namespace QInterchange {  		}, nullptr);  	} -	void Interchange::page(QString const& path) -	{ -		interchange_page(path.toLatin1().constData(), [](interchange_response* response) { -			interchange->emitPage(QString{response->data}); -			interchange_free_response(response); -		}); -	} -  	void Interchange::defaultCatalog(QString const& prodGroup)  	{  		interchange_catalog(prodGroup.toLatin1().constData(), nullptr, [](struct interchange_catalog* catalog) { @@ -62,6 +63,11 @@ namespace QInterchange {  		defaultCatalog("All-Products");  	} +	void Interchange::emitFlypage(QString const& response) +	{ +		emit gotFlypage(response); +	} +  	void Interchange::emitCatalog(QString const& response)  	{  		emit gotCatalog(response); @@ -72,11 +78,6 @@ namespace QInterchange {  		emit gotProduct(response);  	} -	void Interchange::emitPage(QString const& response) -	{ -		emit gotPage(response); -	} -  	void Interchange::emitOrder(QString const& response)  	{  		emit gotOrder(response); diff --git a/interchange.hxx b/interchange.hxx index b8b36d5..ae5d5e8 100644 --- a/interchange.hxx +++ b/interchange.hxx @@ -31,6 +31,12 @@ namespace QInterchange {  		public slots:  			/*! +			 * \brief Generic function for fetching data using +			 * a relative path. +			 * \param path The path. +			 */ +			void flypage(QString const& path); +			/*!  			 * \brief For fetching products that belong a specific group.  			 * \param prodGroup The name of the product group.  			 */ @@ -45,11 +51,6 @@ namespace QInterchange {  			 */  			void product(QString const& sku);  			/*! -			 * \brief For fetching data from a specific path. -			 * \param path The path. -			 */ -			void page(QString const& path); -			/*!  			 * \brief For fetching products that belong a specific group.  			 * \param prodGroup The name of the product group.  			 */ @@ -65,15 +66,15 @@ namespace QInterchange {  			void order(QString const& sku);  		signals: +			void gotFlypage(QString const& response);  			void gotCatalog(QString const& response);  			void gotProduct(QString const& response); -			void gotPage(QString const& response);  			void gotOrder(QString const& response);  		protected: +			void emitFlypage(QString const& response);  			void emitCatalog(QString const& response);  			void emitProduct(QString const& response); -			void emitPage(QString const& response);  			void emitOrder(QString const& response);  	};  |