2012-02-20 21:47:14 +00:00
|
|
|
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
2009-01-28 20:55:45 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef __GROUPS_HH_INCLUDED__
|
|
|
|
#define __GROUPS_HH_INCLUDED__
|
|
|
|
|
|
|
|
#include "ui_groups.h"
|
|
|
|
#include "config.hh"
|
2023-04-17 20:55:34 +00:00
|
|
|
#include "dict/dictionary.hh"
|
2009-01-28 20:55:45 +00:00
|
|
|
#include <QToolButton>
|
2014-03-03 13:47:06 +00:00
|
|
|
#include <QMenu>
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2009-04-30 15:29:03 +00:00
|
|
|
class Groups: public QWidget
|
2009-01-28 20:55:45 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Groups( QWidget * parent,
|
|
|
|
std::vector< sptr< Dictionary::Class > > const &,
|
2009-05-18 18:01:50 +00:00
|
|
|
Config::Groups const &,
|
|
|
|
Config::Group const & order );
|
|
|
|
|
2010-05-08 14:01:59 +00:00
|
|
|
/// Instructs the dialog to position itself on editing the given group.
|
|
|
|
void editGroup( unsigned id );
|
|
|
|
|
2009-05-18 18:01:50 +00:00
|
|
|
/// Should be called when the dictionary order has changed to reflect on
|
|
|
|
/// that changes. It would only do anything if the order has actually
|
|
|
|
/// changed.
|
|
|
|
void updateDictionaryOrder( Config::Group const & order );
|
2009-01-28 20:55:45 +00:00
|
|
|
|
|
|
|
Config::Groups getGroups() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::Groups ui;
|
|
|
|
std::vector< sptr< Dictionary::Class > > const & dicts;
|
|
|
|
Config::Groups groups;
|
|
|
|
|
2014-03-03 13:47:06 +00:00
|
|
|
QToolButton * groupsListButton;
|
|
|
|
QMenu * groupsListMenu;
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
// Reacts to the event that the number of groups is possibly changed
|
|
|
|
void countChanged();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void addNew();
|
|
|
|
void renameCurrent();
|
|
|
|
void removeCurrent();
|
2009-04-29 23:32:42 +00:00
|
|
|
void removeAll();
|
2009-05-02 17:12:52 +00:00
|
|
|
void addToGroup();
|
|
|
|
void removeFromGroup();
|
2023-04-21 00:45:38 +00:00
|
|
|
|
|
|
|
/// Traditional Add Group by Language
|
2010-09-16 18:50:31 +00:00
|
|
|
void addAutoGroups();
|
2023-04-21 00:45:38 +00:00
|
|
|
/// by Containing Folder
|
|
|
|
void addAutoGroupsByFolders();
|
2023-04-29 06:59:19 +00:00
|
|
|
void groupsByMetadata();
|
2023-04-21 00:45:38 +00:00
|
|
|
|
2012-12-20 13:25:03 +00:00
|
|
|
void showDictInfo( const QPoint & pos );
|
2014-03-03 13:47:06 +00:00
|
|
|
void fillGroupsMenu();
|
|
|
|
void switchToGroup( QAction * act );
|
2012-12-20 13:25:03 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void showDictionaryInfo( QString const & id );
|
2009-01-28 20:55:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|