File: groups.hh

package info (click to toggle)
goldendict-webengine 23.02.05-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 19,148 kB
  • sloc: cpp: 58,537; javascript: 9,942; ansic: 9,242; xml: 41; makefile: 15; sh: 9
file content (61 lines) | stat: -rw-r--r-- 1,548 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
 * 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"
#include "dictionary.hh"
#include "groups_widgets.hh"
#include <QToolButton>
#include <QMenu>

class Groups: public QWidget
{
  Q_OBJECT

public:
  Groups( QWidget * parent,
          std::vector< sptr< Dictionary::Class > > const &,
          Config::Groups const &,
          Config::Group const & order );

  /// Instructs the dialog to position itself on editing the given group.
  void editGroup( unsigned id );

  /// 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 );

  Config::Groups getGroups() const;

private:
  Ui::Groups ui;
  std::vector< sptr< Dictionary::Class > > const & dicts;
  Config::Groups groups;

  QToolButton * groupsListButton;
  QMenu * groupsListMenu;

  // Reacts to the event that the number of groups is possibly changed
  void countChanged();

private slots:
  void addNew();
  void renameCurrent();
  void removeCurrent();
  void removeAll();
  void addToGroup();
  void removeFromGroup();
  void addAutoGroups();
  void showDictInfo( const QPoint & pos );
  void fillGroupsMenu();
  void switchToGroup( QAction * act );

signals:
  void showDictionaryInfo( QString const & id );
};

#endif