view widgets/SearchWidget.h @ 282:d9319859a4cf tip

(none)
author benoitrigolleau
date Fri, 31 Oct 2008 11:00:24 +0000
parents a6b881972a62
children
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */

/*	Sound Access	
		EASAIER client application.	
		Silogic 2007. Laure Bajard. 
	
	This program is free software; you can redistribute it and/or    
	modify it under the terms of the GNU General Public License as    
	published by the Free Software Foundation; either version 2 of the    
	License, or (at your option) any later version.  See the file    
	COPYING included with this distribution for more information.
*/

#ifndef _SEARCH_WIDGET_H_
#define _SEARCH_WIDGET_H_

#include <QWidget>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QStackedLayout>

#include <map>

#include "data/model/QueryModel.h"

#include "widgets/AdvancedToolBox.h"

class SearchWidget : public QWidget {

	Q_OBJECT
public:
	SearchWidget();
	virtual ~SearchWidget();

	/*display the widgets of the search tab according the QueryModel*/
	void displayQuerymodel(QueryModel* queryModel);

	/*add a new theme (music, speech...) to the search tab*/
	void addTheme(const QString &name, const QString &label);
	
	/*add a new group of query to the current search theme*/
	void addFieldGroup(const QString &name, const QString &label);
	void endFieldGroup();

	/*add a query property to the current group and current theme*/
	void addField(const QString &name, QueryThemeModel* curTheme);

	/* return the name of the active query theme */
	QString getActiveTheme();

	/*highlight the button of the theme "name"*/
	void highlightThemeButton(QString &name);

	void reset();

	virtual void keyPressEvent( QKeyEvent * e);

public slots:
	void activeTheme();
	
signals:
	void fileSelected(const QString &);

protected:

	QStackedLayout	*m_themesLayout;
	QHBoxLayout		*m_buttonLayout; // each button correspond to a theme

	QPushButton		*m_searchButton;

	AdvancedToolBox		*m_curThemeWidget;
	QGridLayout			*m_curBoxLayout;

	std::map<QString, int>	m_themes;

	int m_curBoxRow;
};


#endif