2009-09-21 17:50:03 +00:00
|
|
|
#ifndef __DICTIONARYBAR_HH_INCLUDED__
|
|
|
|
#define __DICTIONARYBAR_HH_INCLUDED__
|
|
|
|
|
|
|
|
#include <QToolBar>
|
|
|
|
#include <QSize>
|
2009-09-23 18:44:38 +00:00
|
|
|
#include <QList>
|
2012-11-28 19:32:37 +00:00
|
|
|
#include <QString>
|
2009-09-21 17:50:03 +00:00
|
|
|
#include "dictionary.hh"
|
|
|
|
#include "config.hh"
|
|
|
|
|
|
|
|
/// A bar containing dictionary icons of the currently chosen group.
|
|
|
|
/// Individual dictionaries can be toggled on and off.
|
|
|
|
class DictionaryBar: public QToolBar
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// Constructs an empty dictionary bar
|
|
|
|
DictionaryBar( QWidget * parent,
|
2012-11-28 19:32:37 +00:00
|
|
|
Config::Events &, QString const & _editDictionaryCommand );
|
2009-09-21 17:50:03 +00:00
|
|
|
|
|
|
|
/// Sets dictionaries to be displayed in the bar. Their statuses (enabled/
|
|
|
|
/// disabled) are taken from the configuration data.
|
|
|
|
void setDictionaries( std::vector< sptr< Dictionary::Class > > const & );
|
2012-09-26 13:13:47 +00:00
|
|
|
void setMutedDictionaries( Config::MutedDictionaries * mutedDictionaries_ )
|
|
|
|
{ mutedDictionaries = mutedDictionaries_; }
|
|
|
|
Config::MutedDictionaries const * getMutedDictionaries() const
|
|
|
|
{ return mutedDictionaries; }
|
2012-11-07 15:18:56 +00:00
|
|
|
void setDictionaryIconSize( int extent );
|
2009-09-21 17:50:03 +00:00
|
|
|
|
2010-05-08 14:01:59 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
/// Signalled when the user decided to edit group the bar currently
|
|
|
|
/// shows.
|
|
|
|
void editGroupRequested();
|
2009-10-12 13:58:32 +00:00
|
|
|
|
2012-09-25 13:13:35 +00:00
|
|
|
/// Signal for show dictionary info command from context menu
|
|
|
|
void showDictionaryInfo( QString const & id );
|
|
|
|
|
|
|
|
/// Signal to close context menu
|
|
|
|
void closePopupMenu();
|
|
|
|
|
2009-09-21 17:50:03 +00:00
|
|
|
private:
|
|
|
|
|
2012-09-26 13:13:47 +00:00
|
|
|
Config::MutedDictionaries * mutedDictionaries;
|
2009-09-21 17:50:03 +00:00
|
|
|
Config::Events & configEvents;
|
2012-09-27 14:28:05 +00:00
|
|
|
Config::MutedDictionaries storedMutedSet;
|
2012-11-28 19:32:37 +00:00
|
|
|
QString editDictionaryCommand;
|
|
|
|
std::vector< sptr< Dictionary::Class > > allDictionaries;
|
2009-09-23 18:44:38 +00:00
|
|
|
/// All the actions we have added to the toolbar
|
|
|
|
QList< QAction * > dictActions;
|
|
|
|
|
2012-11-07 15:18:56 +00:00
|
|
|
bool use14x21;
|
|
|
|
|
2009-10-12 13:58:32 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
void contextMenuEvent( QContextMenuEvent * event );
|
|
|
|
|
2009-09-21 17:50:03 +00:00
|
|
|
private slots:
|
|
|
|
|
2009-09-23 18:44:38 +00:00
|
|
|
void mutedDictionariesChanged();
|
2009-09-21 17:50:03 +00:00
|
|
|
|
|
|
|
void actionWasTriggered( QAction * );
|
2012-09-19 12:44:36 +00:00
|
|
|
|
|
|
|
void dictsPaneClicked( QString const & );
|
2009-09-21 17:50:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|