|
|
#pragma once |
|
|
|
|
|
#include <QToolBar> |
|
|
class QMainWindow; |
|
|
#include <QSize> |
|
|
#include <QList> |
|
|
#include <QString> |
|
|
#include <QTimer> |
|
|
#include "dict/dictionary.hh" |
|
|
#include "config.hh" |
|
|
|
|
|
namespace Instances { |
|
|
struct Group; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class DictionaryBar: public QToolBar |
|
|
{ |
|
|
Q_OBJECT |
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
DictionaryBar( QWidget * parent, Config::Events &, const unsigned short & maxDictionaryRefsInContextMenu_ ); |
|
|
|
|
|
|
|
|
|
|
|
void setDictionaries( const std::vector< sptr< Dictionary::Class > > & ); |
|
|
void setMutedDictionaries( Config::DictionarySets * mutedDictionaries_ ) |
|
|
{ |
|
|
mutedDictionaries = mutedDictionaries_; |
|
|
} |
|
|
const Config::DictionarySets * getMutedDictionaries() const |
|
|
{ |
|
|
return mutedDictionaries; |
|
|
} |
|
|
|
|
|
enum class IconSize { |
|
|
Small, |
|
|
Normal, |
|
|
Large, |
|
|
}; |
|
|
|
|
|
void setDictionaryIconSize( IconSize size ); |
|
|
void updateToGroup( const Instances::Group * grp, |
|
|
Config::DictionarySets * allGroupMutedDictionaries, |
|
|
Config::Class & cfg ); |
|
|
|
|
|
signals: |
|
|
|
|
|
|
|
|
|
|
|
void editGroupRequested(); |
|
|
|
|
|
|
|
|
void showDictionaryInfo( const QString & id ); |
|
|
|
|
|
|
|
|
void showDictionaryHeadwords( Dictionary::Class * dict ); |
|
|
|
|
|
|
|
|
void openDictionaryFolder( const QString & id ); |
|
|
|
|
|
|
|
|
void closePopupMenu(); |
|
|
|
|
|
|
|
|
void showStatusBarMessage( const QString & message, int timeout = 3000 ); |
|
|
|
|
|
private: |
|
|
|
|
|
Config::DictionarySets * mutedDictionaries; |
|
|
|
|
|
|
|
|
std::optional< Config::DictionarySets > tempSelectionCapturedMuted; |
|
|
|
|
|
Config::Events & configEvents; |
|
|
|
|
|
void selectSingleDict( const QString & id ); |
|
|
|
|
|
|
|
|
const unsigned short & maxDictionaryRefsInContextMenu; |
|
|
std::vector< sptr< Dictionary::Class > > allDictionaries; |
|
|
|
|
|
QList< QAction * > dictActions; |
|
|
QAction * maxDictionaryRefsAction; |
|
|
|
|
|
QSize normalIconSize; |
|
|
|
|
|
protected: |
|
|
|
|
|
void contextMenuEvent( QContextMenuEvent * event ); |
|
|
|
|
|
private slots: |
|
|
|
|
|
void mutedDictionariesChanged(); |
|
|
|
|
|
void actionWasTriggered( QAction * ); |
|
|
|
|
|
void showContextMenu( QContextMenuEvent * event, bool extended = false ); |
|
|
|
|
|
public slots: |
|
|
|
|
|
void dictsPaneClicked( const QString & ); |
|
|
}; |
|
|
|