forked from goldendict/goldendict
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editdictionaries.hh
96 lines (65 loc) · 2.19 KB
/
editdictionaries.hh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef __EDITDICTIONARIES_HH_INCLUDED__
#define __EDITDICTIONARIES_HH_INCLUDED__
#include "dictionary.hh"
#include "config.hh"
#include "ui_editdictionaries.h"
#include "sources.hh"
#include "orderandprops.hh"
#include "groups.hh"
#include "instances.hh"
#include "helpwindow.hh"
#include <QNetworkAccessManager>
#include <QAction>
class EditDictionaries: public QDialog
{
Q_OBJECT
public:
EditDictionaries( QWidget * parent, Config::Class & cfg,
std::vector< sptr< Dictionary::Class > > & dictionaries,
Instances::Groups & groupInstances, // We only clear those on rescan
QNetworkAccessManager & dictNetMgr );
~EditDictionaries()
{ if( helpWindow ) delete helpWindow; }
/// Instructs the dialog to position itself on editing the given group.
void editGroup( unsigned id );
/// Returns true if any changes to the 'dictionaries' vector passed were done.
bool areDictionariesChanged() const
{ return dictionariesChanged; }
/// Returns true if groups were changed.
bool areGroupsChanged() const
{ return groupsChanged; }
protected:
virtual void accept();
private slots:
void on_tabs_currentChanged( int index );
void buttonBoxClicked( QAbstractButton * button );
void rescanSources();
void helpRequested();
void closeHelp();
signals:
void showDictionaryInfo( QString const & dictId );
void showDictionaryHeadwords( QString const & dictId );
private:
bool isSourcesChanged() const;
void acceptChangedSources( bool rebuildGroups );
void save();
private:
Config::Class & cfg;
std::vector< sptr< Dictionary::Class > > & dictionaries;
Instances::Groups & groupInstances;
QNetworkAccessManager & dictNetMgr;
// Backed up to decide later if something was changed or not
Config::Class origCfg;
Ui::EditDictionaries ui;
Sources sources;
sptr< OrderAndProps > orderAndProps;
sptr< Groups > groups;
bool dictionariesChanged;
bool groupsChanged;
int lastCurrentTab;
Help::HelpWindow * helpWindow;
QAction helpAction;
};
#endif